"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[30958],{597104(e,t,n){n.d(t,{E:()=>i});const i=e=>{const t=e;return t.__isSiteQuery=!0,t}},441966(e,t,n){n.d(t,{I:()=>r});var i=n(814328),o=n(602086),s=n(409033);const r=()=>{const e=(0,i.jE)(),t=(0,s.R)();return(0,o.useCallback)(n=>{e.invalidateQueries(n(t))},[e,t])}},208047(e,t,n){n.d(t,{r:()=>d});var i=n(226586),o=n(219582),s=n(437007),r=n(565744);const a=(0,i.Ay)({baseUrl:"/v2",fetch:(...e)=>(0,s.n)(...e).then(r.x9)}),d=(0,o.A)(a)},633502(e,t,n){n.d(t,{J:()=>r});var i=n(597104),o=n(208047),s=n(455425);const r=(0,i.E)(({siteName:e})=>o.r.queryOptions("get","/api/site/{siteName}/routes",{params:{path:{siteName:e}}},{staleTime:30*s.vl}))},547967(e,t,n){n.d(t,{AC:()=>p,D7:()=>_,Ie:()=>x,JL:()=>I,JX:()=>f,KY:()=>A,O2:()=>u,Op:()=>m,Rm:()=>h,e$:()=>g,t7:()=>E,yr:()=>T});var i=n(179102),o=n(505817),s=n(247816),r=n(409844),a=n(291508),d=n(61322),l=n(309130),c=n(100978);const m=(0,s.A)(c.A,(0,a.A)("inline","wrap"))`
  position: relative;
  flex: ${({inline:e})=>e?"1 1 0":"0 0 100%"};
  align-items: flex-start;
  flex-flow: ${({wrap:e})=>"row "+(e?"wrap":"nowrap")};
  gap: ${l.kc};
`,u=(0,s.A)(c.A,(0,a.A)("editMaxHeight","editFieldWrap"))`
  flex-direction: column;
  max-height: ${({editMaxHeight:e})=>`${e||300}px`};
  overflow-y: auto;
  overflow-x: hidden;
  gap: ${l.YC};

  ${({editFieldWrap:e,theme:{themeName:t}})=>e?`\n    gap: 0;\n\n    > * {\n      border-bottom: ${o.Ay[`desktop-border-divider-${t}`]};\n      padding-bottom: ${l.kc};\n      padding-top: ${l.kc};\n    }\n\n    > *:first-child {\n      padding-top: 0;\n    }\n\n    > *:last-child {\n      border-bottom: none;\n      padding-bottom: 0;\n    }\n  `:""}
`,p=(0,s.A)("div",(0,a.A)("isWindowsTable","rows","tableMaxHeight","marginTop"))`
  width: 100%;
  // windows table inherits height from parent container
  height: ${({rows:e,isWindowsTable:t})=>t&&`${d.I.ROW_HEIGHT*e+d.I.HEADER_HEIGHT}`}px;
  max-height: ${({tableMaxHeight:e})=>e?`${e}px`:"auto"};
  margin-top: ${({marginTop:e})=>e||l.Ln};

  table {
    td {
      max-width: 170px;

      span {
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
`,_=(0,s.A)(i.A)`
  margin-right: ${l.YC};
`,A=r.AH`
  :first-of-type {
    padding: 0 ${l.fS} 0 0px;
  }
`,h="drag-and-drop-table-row-placeholder",E=(0,s.A)(c.A)`
  flex-direction: column;

  /* Adjust weird padding on the right side for the ID column when right aligned (drag & drop table) */
  table > thead > tr > th:last-of-type {
    padding-right: ${l.kc};
  }

  /* Add missing border between drag and drop groups (tbody elements) */
  table > tbody {
    border-bottom: ${({theme:{themeName:e}})=>o.Ay[`desktop-border-divider-${e}`]};
  }
  /* Last cell in table is hover content which is not used in this table */
  table > tbody[data-rbd-droppable-context-id] td:not(:last-of-type),
  table > thead > tr > th {
    /* Align drag & drop table cell padding to regular table padding */
    padding-right: ${l.kc} !important;
  }
  /* Align drop zone placeholder row when a row is dragged to matched the CSS overrides for drag and drop table we use */
  table .${h} {
    display: flex;
  }
`,I=r.AH`
  /* This is default for the table rows, so we need it for the header. */
  display: flex;
  width: 100%;

  > th:first-child {
    /* Since we flex the header, we must specify this to align with the table rows. */
    width: 24px;
  }
  > th:not(:first-child) {
    /* Something inside UIC sets the padding to 8px for table header and 5px for table rows. This aligns it to make flex work. */
    padding-right: ${l.kc} !important;
  }
`,g=r.AH`
  /* Override the padding-right of the first column to align with manage + drop modes. */
  > th:first-child {
    padding-right: ${l.kc} !important;
  }
  > th:first-child:has(> label) {
    padding-right: 1px !important;
    width: 36px;
  }
`,T=r.AH`
  /* UIC already does this for some table states, like drag and drop and when in manage mode. If we just use this ALWAYS, we're avoiding many issues related to using different alignment techniques in different places. */
  display: flex;
`,f=r.AH`
  tbody {
    display: flex;
    flex-direction: column;
  }
`;function x(e,t){return r.AH`
    width: ${t.width?`${t.width}px`:"auto"};
    min-width: ${t.minWidth?`${t.minWidth}px`:"0px"};
    flex: ${t.growthFactor||0} !important;
    padding-left: ${l.kc} !important;
    padding-right: ${l.kc} !important;
  `}},256468(e,t,n){var i;n.d(t,{EE:()=>s,Uh:()=>i,Vf:()=>o}),function(e){e.SINGLE="single",e.PLURAL="plural"}(i||(i={}));const o="editActive",s=20},531984(e,t,n){n.d(t,{w:()=>r});var i=n(602086),o=n(977872),s=n(205521);const r=e=>{const t=(0,o.wA)();(0,i.useEffect)(()=>{t((0,s.SQ)(e))},[t,e])}},762542(e,t,n){n.d(t,{y:()=>o});var i=n(531984);const o=e=>(0,i.w)(e.formState.isDirty)},612389(e,t,n){n.d(t,{A:()=>m});var i=n(274934),o=n(505817),s=n(179102),r=n(247816),a=n(263705),d=n(309130),l=n(100978);const c=(0,r.A)(s.A)`
  line-height: 20px;
`,m=({icon:e,description:t,action:n,footer:s,background:r,...m})=>{const{themeName:u}=(0,a.u)();return(0,i.jsxs)(l.A,{flexGrow:1,borderRadius:d.YC,padding:d.kc,background:r||o.Ay[`desktop-color-neutral-01-${u}`],gap:d.kc,flexDirection:"column",...m,children:[(0,i.jsxs)(l.A,{flexGrow:1,gap:d.kc,children:[e,t?(0,i.jsx)(c,{size:"medium",children:t}):null,n?(0,i.jsx)(l.A,{marginLeft:"auto",children:(0,i.jsx)(c,{size:"medium",children:n})}):null]}),s]})}},307336(e,t,n){n.d(t,{s:()=>s});var i=n(505817),o=n(106005);const s=(0,n(247816).A)(o.A)`
  color: ${({theme:{themeName:e}})=>i.Ay[`desktop-color-neutral-08-${e}`]};
`},753959(e,t,n){n.d(t,{A:()=>d});var i=n(274934),o=n(505817),s=n(247368),r=n(263705),a=n(612389);const d=({children:e,icon:t,background:n,...d})=>{const{themeName:l}=(0,r.u)();return(0,i.jsx)(a.A,{icon:t||(0,i.jsx)(s.A,{variant:"fill",size:"original",color:o.Ay[`desktop-color-ublue-06-${l}`]}),description:e,background:n,...d})}},842758(e,t,n){n.d(t,{A:()=>p});var i=n(274934),o=n(602086),s=n(977872),r=n(890932),a=n(726831);const d={};var l=n(247816),c=n(291508);const m=(0,l.A)("img",(0,c.A)("dimension"))`
  ${({dimension:e=22})=>`\n    height: ${e}px;\n    width: ${e}px;\n  `}
`;var u;!function(e){e.ICON_FILE_NAME="iconFileName",e.DIMENSION="dimension",e.STYLE="style"}(u||(u={}));const p=(0,o.memo)(({[u.ICON_FILE_NAME]:e,[u.DIMENSION]:t,[u.STYLE]:n={}})=>{const l=(0,s.d4)(r.p),c=(0,o.useMemo)(()=>d[e]||encodeURI(`${a.A.dpiPath}${e}`),[e]),p=(0,o.useCallback)(({target:t})=>{d[e]=t.src},[e]),_=(0,o.useCallback)(({currentTarget:e})=>{e.src=`${l}/dpiFallback.svg`},[l]);return(0,i.jsx)(m,{src:c,dimension:t,onLoad:p,onError:_,style:n})})},535322(e,t,n){n.d(t,{A:()=>_,I:()=>i});var i,o=n(274934),s=n(505817),r=n(753583),a=n(247816),d=n(565527),l=n(309130),c=n(100978),m=n(291508);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(i||(i={}));const u=(0,a.A)(c.A,(0,m.A)("marginBottom","isButtonList","margin","flex","width","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||s.Ay[n===d.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${d.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${d.S.LIGHT}`]};
  ${({nested:e,theme:{themeName:t}})=>e?`border: ${s.Ay[`desktop-border-divider-${t}`]};`:""}
  padding: ${({isButtonList:e,padding:t})=>t||(e?`0 ${l.Ln}`:l.Ln)};
  margin-bottom: ${({marginBottom:e})=>e||l.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}})=>s.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,p=(0,a.A)(r.A,(0,m.A)("marginBottom","margin","flex","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||s.Ay[n===d.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${d.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${d.S.LIGHT}`]};
  ${({nested:e,theme:{themeName:t}})=>e?`border: ${s.Ay[`desktop-border-divider-${t}`]};`:""}
  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,nested:t,theme:{themeName:n}})=>e||s.Ay[n===d.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${d.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${d.S.LIGHT}`]};
      height: 48px;
      padding: 0 ${l.Ln};
    }
    > div:nth-child(2) {
      margin-bottom: 0;
      padding: 0;
      > div {
        padding: 0 ${l.Ln} ${l.Ln};
      }
    }
  }
`,_=({type:e,marginBottom:t,margin:n,padding:s,flex:r,width:a,nested:d,...l})=>"items"in l?(0,o.jsx)(p,{marginBottom:t,margin:n,padding:s,flex:r,nested:d,...l}):(0,o.jsx)(u,{nested:d,width:a,marginBottom:t,margin:n,padding:s,flex:r,isButtonList:e===i.BUTTON_LIST,...l,children:l.children})},199742(e,t,n){n.d(t,{A:()=>l});var i=n(274934),o=n(602086),s=n(798282),r=n(309130),a=n(100978),d=n(535322);const l=({actions:e})=>(0,i.jsx)(d.A,{marginBottom:"none",children:(0,i.jsx)(a.A,{flexDirection:"column",gap:r.kc,width:"100%",children:e.filter(Boolean).map((e,t,n)=>(0,i.jsxs)(o.Fragment,{children:[e,t<n.length-1?(0,i.jsx)(a.A,{width:"100%",flexDirection:"column",paddingTop:r.YC,paddingBottom:r.YC,children:(0,i.jsx)(s.A,{orientation:"horizontal"})}):null]},[t,e.toString()].join()))})})},963428(e,t,n){n.d(t,{A:()=>c});var i=n(274934),o=n(977872),s=n(602086),r=n(266824),a=n(669439),d=n(897166),l=n(100978);const c=(0,s.forwardRef)(({allowReadOnly:e,disabledReason:t,...n},s)=>{const c=(0,o.d4)(d.EL)&&!e;return(0,i.jsx)(l.A,{alignItems:"center",children:(0,i.jsx)(a.A,{description:t,placement:"left",children:(0,i.jsx)(r.A,{fontSize:"medium",type:"button",...n,isDisabled:c||n.isDisabled||!!t,ref:s})})})})},737364(e,t,n){n.d(t,{A:()=>u});var i=n(274934),o=n(526744),s=n(309130),r=n(580988),a=n(100978),d=n(470070),l=n(156007),c=n(300626),m=n(174710);const u=({enabled:e,label:t,tooltipItems:n,neverShowListMarkers:u,limit:p=20,seeMoreCallback:_,isInteractive:A,title:h,showMatchOppositeIcon:E,listGap:I,iconProps:g})=>(0,i.jsxs)(a.A,{flex:1,overflow:"hidden",gap:s.YC,children:[E?(0,i.jsx)(r.A,{enabled:e}):null,(0,i.jsx)(c.A,{tooltip:(0,i.jsx)(m.A,{title:h,position:"top",isInteractive:Boolean(_)||A,items:n,showListMarkers:!u,maxItemCount:p,getItemKey:(e,t)=>t,renderItem:e=>e,listGap:I,renderShowMore:_?()=>(0,i.jsx)(o.A,{variant:"inline",onClick:_,children:(0,i.jsx)(d.sA,{id:"COMMON_SEE_MORE"})}):void 0,iconProps:g}),children:t?(0,i.jsx)(l.A,{color:e?"inherit":"disabled",children:t}):null})]})},174710(e,t,n){n.d(t,{A:()=>r});var i=n(274934),o=n(304151),s=n(158498);const r=function({items:e,getItemKey:t,renderItem:n,maxItemCount:r,renderShowMore:a,showListMarkers:d,title:l,position:c,isInteractive:m,cursorType:u,listGap:p,iconProps:_}){return(0,i.jsx)(o.A,{title:l,position:c,isInteractive:m,cursorType:u,description:(0,i.jsx)(s.A,{items:e,getItemKey:t,renderItem:n,maxItemCount:r,listGap:p,renderShowMore:a,showListMarkers:d}),iconProps:_})}},580988(e,t,n){n.d(t,{A:()=>l});var i=n(274934),o=n(548941),s=n(722682),r=n(309130),a=n(100978),d=n(470070);const l=({enabled:e})=>(0,i.jsx)(a.A,{opacity:e?void 0:r.xN,children:(0,i.jsx)(o.A,{description:(0,i.jsx)(d.sA,{id:"COMMON_MATCH_OPPOSITE"}),portal:!0,children:(0,i.jsx)(s.A,{size:"original"})})})},300626(e,t,n){n.d(t,{A:()=>r});var i=n(274934),o=n(309130),s=n(100978);const r=({children:e,tooltip:t})=>(0,i.jsxs)(s.A,{maxWidth:"100%",overflow:"hidden",gap:o.YC,alignItems:"center",children:[e?(0,i.jsx)(s.A,{flex:1,overflow:"hidden",children:e}):null,t]})},384783(e,t,n){n.d(t,{A:()=>r});var i=n(274934),o=n(122616),s=n(826600);const r=({children:e=null,hideModal:t,onRequestClose:n,portalSelector:r=s.J,forwardedRef:a=null,...d})=>(0,i.jsx)(o.A,{isOpen:!0,shouldCloseOnEsc:!0,onRequestClose:n||t,parentSelector:r,ref:a,...d,children:e})},826600(e,t,n){n.d(t,{J:()=>i,g:()=>o});const i=()=>document.getElementById("modal-container"),o=()=>document.getElementById("modal-settings-container")},420174(e,t,n){n.d(t,{H5:()=>r,ZS:()=>a});var i=n(274934),o=n(602086);const s=(0,o.createContext)(void 0),r=()=>{const e=(0,o.useContext)(s);return void 0===e?{sharedName:"",setSharedName:()=>{}}:e},a=({children:e})=>{const[t,n]=(0,o.useState)(""),r=(0,o.useMemo)(()=>({sharedName:t,setSharedName:n}),[t]);return(0,i.jsx)(s.Provider,{value:r,children:e})}},122985(e,t,n){n.d(t,{A:()=>He});var i,o,s=n(274934),r=n(977872),a=n(42220),d=n(602086),l=n(159469),c=n(464920),m=n(762542),u=n(404056),p=n(292027),_=n(199742),A=n(871808),h=n(635891),E=n(877840),I=n(121713),g=n(449339),T=n(309130),f=n(756782),x=n(100978),S=n(205521),N=n(700444),O=n(470070),C=n(623568),v=n(423564),M=n(197571),R=n(6276),b=n(897166),j=n(95857),D=n(969288),L=n(441966),y=n(633502),w=n(115114);!function(e){e.ANY="any",e.IP="ip",e.DOMAIN="domain",e.REGION="region"}(i||(i={})),function(e){e.ANY="any",e.DEVICES_AND_NETWORKS="devices_and_networks"}(o||(o={}));var k=n(241792),P=n(765282),G=n(745454),$=n(810024),F=n(149450),H=n(260334);const V=e=>k.Ik({name:k.Yj({message:(0,H.rn)("COMMON_VALIDATION_NAME_REQUIRED")}).min(1,{message:(0,H.rn)("COMMON_VALIDATION_NAME_REQUIRED")}).max(128),interface:k.Yj(),next_hop:k.Yj().optional(),kill_switch_enabled:k.zM(),source:k.gM("type",[k.Ik({type:k.eu(o.ANY)}),k.Ik({type:k.eu(o.DEVICES_AND_NETWORKS),devices_and_networks:k.YO(k.Yj()).min(1)})]),destination:k.gM("type",[k.Ik({type:k.eu(i.ANY)}),k.Ik({type:k.eu(i.DOMAIN),domains:k.YO(k.Yj(),{message:(0,H.rn)("SETTINGS_ROUTING_QOS_DOMAINS_VALIDATION")}).min(1,{message:(0,H.rn)("SETTINGS_ROUTING_QOS_DOMAINS_VALIDATION")})}),k.Ik({type:k.eu(i.REGION),regions:k.YO(k.Yj(),{message:(0,H.rn)("COMMON_VALIDATION_SELECT_AT_LEAST_ONE",{target:(0,H.rn)("COMMON_REGION")})}).min(1,{message:(0,H.rn)("COMMON_VALIDATION_SELECT_AT_LEAST_ONE",{target:(0,H.rn)("COMMON_REGION")})}).max(150,{message:(0,H.rn)("COMMON_VALIDATION_TOTAL_ENTRIES_LIMIT",{limit:150})})}),k.Ik({type:k.eu(i.IP),ips:k.YO(k.Ie()).optional(),simple_ips:k.YO(k.Yj()).optional()})])}).superRefine((t,n)=>{const o=e.find(e=>e._id===t.interface);if(o){if((0,v.ok)(o)&&t.destination.type===i.IP){const e=k.YO(F.B).min(1).safeParse(t.destination?.simple_ips);e.error&&e.error.issues.forEach(e=>{n.addIssue({...e,path:["destination","simple_ips"]})})}if(!(0,v.ok)(o)&&t.destination.type===i.IP){const e=k.YO(k.Ie()).min(1).safeParse(t.destination?.ips);e.error&&e.error.issues.forEach(e=>{n.addIssue({...e,path:["destination","ips"]})})}}}).superRefine((t,n)=>{const i=e.find(e=>e._id===t.interface);if(!i||!(0,v.ok)(i)||!i.ip_subnet)return;const o=F.B.refine(e=>(0,$.xc)(i.ip_subnet,e),{message:(0,H.rn)("SETTINGS_TRAFFIC_ROUTES_NEXT_HOP_ERROR")}).safeParse(t.next_hop);o.error&&o.error.issues.forEach(e=>{n.addIssue({...e,path:["next_hop"]})});const s=(0,G.subnet)(i.ip_subnet).info();t.next_hop!==s.networkAddress&&t.next_hop!==s.broadcastAddress||n.addIssue({code:P.eq.custom,message:(0,H.rn)("SETTINGS_NEXT_HOP_NOT_NETWORK_OR_BROADCAST_ADDRESS"),path:["next_hop"]})});var Y=n(482609),U=n(244081),B=n(749445),W=n(254590),K=n(307336),Q=n(243436),X=n(650632),z=n(556059),J=n(287196),q=n(164398),Z=n(570801),ee=n(831433),te=n(239627),ne=n(46497),ie=n(506770),oe=n(928609);const se=[],re=function({form:e,name:t,valueDelimiter:n,networkConfig:i,deviceConfig:o,...l}){const c=(0,r.wA)(),m=(0,r.d4)(M.Ct),{formatMessage:u}=(0,O.tz)(),p=(0,r.d4)(J.g),_=(0,r.d4)(Z.lW);(0,d.useEffect)(()=>{c((0,te.$3)(void 0,{crudCacheStrategy:{type:U.e.CACHE}})),c((0,te.bk)(void 0,{crudCacheStrategy:{type:U.e.CACHE}})),c((0,te.QG)({queryParams:{withinHours:_}},{crudCacheStrategy:{type:U.e.CACHE}}))},[c,_]);const A=(0,a.FH)({control:e.control,name:t})||se,h=(0,d.useMemo)(()=>A.flatMap(e=>{const t=(0,oe.tY)(e,n);return t.type===z.Q.CLIENT?[t.client_mac]:[]}),[A,n]),E=(0,d.useMemo)(()=>(0,ee.rd)(h),[h]),I=(e,t)=>"subnet"===t?(0,v.ok)(e)&&e.ip_subnet?(0,$.nX)(e.ip_subnet):void 0:"",g=(0,d.useMemo)(()=>m.filter(q.mH).map(e=>{const t=(0,Q.A1)(e),o=t&&!i?.hideVlanId?`${e.name} (${t})`:e.name;return{value:(0,oe.gb)(e._id,n),label:o,group:z.Q.NETWORK,image:(0,s.jsx)(K.s,{height:20,width:20}),additionalInfo:I(e,i?.additionalInfo)}}),[i?.additionalInfo,i?.hideVlanId,m,n]),T=(e,t)=>"mac"===t?(0,s.jsx)(ne.A,{mac:e.mac}):"",f=(0,d.useMemo)(()=>{const e=p.flatMap(e=>"mac"in e?[{label:(0,ee.tn)(e)||W.L,value:(0,oe.om)(e.mac,n),group:z.Q.CLIENT,image:(0,s.jsx)(x.A,{alignItems:"center",justifyContent:"center",width:22,height:22,children:(0,s.jsx)(X.A,{client:e,height:20,width:20})}),additionalInfo:T(e,o?.additionalInfo)}]:[]),t=h.filter(t=>!e.some(e=>{const i=(0,oe.tY)(e.value,n);return e.value===t||i.type===z.Q.CLIENT&&i.client_mac===t})).map(e=>({value:(0,oe.om)(e,n),label:e,group:z.Q.CLIENT,additionalInfo:(0,s.jsx)(ne.A,{mac:e})}));return[...e,...t]},[h,o?.additionalInfo,p,n]),S=(0,d.useMemo)(()=>[...g.length?[{label:u({id:"COMMON_NETWORKS"}),value:"network-title",group:z.Q.NETWORK,groupTitle:!0}]:[],...g,...f.length?[{label:u({id:"COMMON_DEVICES"}),value:"devices-title",group:z.Q.CLIENT,groupTitle:!0}]:[],...f],[f,u,g]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(B.A,{control:e.control,name:t,options:S,truncateLabels:!0,triggerButtonText:(0,s.jsx)(O.sA,{id:"COMMON_SELECT"}),...l}),E?(0,s.jsx)(ie.A,{}):null]})};var ae=n(787481),de=n(846294);const le=({children:e,disabled:t})=>(0,s.jsx)(de.A,{reason:t?(0,s.jsx)(O.sA,{id:"SETTINGS_TRAFFIC_ROUTES_FEATURE_NOT_AVAILABLE_WITH_LOCAL_NETWORK"}):null,children:e}),ce=({form:e})=>{const t=(0,r.d4)(M.Ct),n=(0,a.FH)({control:e.control,name:"source.type"}),i=(0,a.FH)({control:e.control,name:"interface"}),l=(0,d.useMemo)(()=>t.find(e=>e._id===i),[i,t]),c=!!l&&(0,v.ok)(l);return(0,s.jsxs)(f.A,{title:(0,s.jsx)(O.sA,{id:"COMMON_SOURCE"}),tooltip:(0,s.jsx)(O.sA,{id:"SETTINGS_TRAFFIC_ROUTES_FORM_TARGET_DEVICES_DESCRIPTION"}),children:[(0,s.jsxs)(ae.A,{children:[(0,s.jsx)(Y.A,{control:e.control,name:"source.type",value:o.ANY,children:(0,s.jsx)(O.sA,{id:"COMMON_ANY"})}),(0,s.jsx)(le,{disabled:c&&n!==o.DEVICES_AND_NETWORKS,children:(0,s.jsx)(Y.A,{control:e.control,name:"source.type",value:o.DEVICES_AND_NETWORKS,children:(0,s.jsx)(O.sA,{id:"SETTINGS_DEVICES_AND_NETWORKS"})})})]}),n===o.DEVICES_AND_NETWORKS?(0,s.jsx)(re,{form:e,name:"source.devices_and_networks",valueDelimiter:":::",networkConfig:{additionalInfo:"subnet"},deviceConfig:{additionalInfo:"mac"}}):null]})};var me=n(625133),ue=n(796091);const pe=({form:e})=>(0,s.jsx)(ue.A,{children:(0,s.jsx)(me.A,{control:e.control,name:"kill_switch_enabled",tooltip:(0,s.jsx)(O.sA,{id:"SETTINGS_KILL_SWITCH_TOOLTIP"}),children:(0,s.jsx)(O.sA,{id:"COMMON_KILL_SWITCH"})})});var _e=n(370115),Ae=n(689941),he=n(167933),Ee=n(754924);const Ie=({form:e})=>{const{formatMessage:t}=(0,O.tz)(),n=(0,r.d4)(M.Ct),l=(0,r.d4)(Ee.AL),c=(0,r.d4)(he.GW),m=(0,A.A)(j.Xj.TRAFFIC_ROUTES_OPENVPN_S2S_VPN),u=(0,A.A)(j.Xj.TRAFFIC_ROUTES_IPSEC_S2S_VPN),p=(0,A.A)(j.Xj.TRAFFIC_ROUTES_WIREGUARD_S2S_VPN),_=(0,a.FH)({control:e.control,name:"destination.type"}),h=(0,a.FH)({control:e.control,name:"interface"}),E=(0,d.useMemo)(()=>{const i={isOpenVpnTrafficRoutesSupported:c,isSiteToSiteOpenVpnTrafficRoutesSupported:m,isSiteToSiteIpsecTrafficRoutesSupported:u,isSiteToSiteWireguardTrafficRoutesSupported:p,trafficRuleTarget:_,networks:n},o=n.filter(e=>{if(h===e._id)return!0;const t=(0,v.ok)(e),n=(0,q.kY)(e,i),o=(0,q.XD)(e,i);return!(t||!n&&!o)}),r=e.formState.defaultValues?.interface;return(0,_e.MG)(o,t,l?.name,e=>{const t=(0,q.XD)(e,i);return{disabled:!!t,tooltipDescription:t?(0,s.jsx)(O.sA,{id:t}):void 0}},r)},[c,m,u,p,_,n,e.formState.defaultValues?.interface,t,l?.name,h]);return(0,s.jsx)(Ae.A,{control:e.control,name:"interface",options:E,onChange:(t,{field:s})=>{s.onChange(t),e.setValue("next_hop","");const r=n.find(e=>e._id===t);r&&(0,v.ok)(r)&&(e.setValue("source.type",o.ANY),e.setValue("destination.type",i.IP))},label:(0,s.jsx)(O.sA,{id:"SETTINGS_TRAFFIC_ROUTES_FORM_INTERFACE_S2S_VPN"}),tooltip:(0,s.jsx)(O.sA,{id:"SETTINGS_TRAFFIC_ROUTES_SOURCE_INTERFACE_DESCRIPTION"}),placeholder:t({id:"SETTINGS_TRAFFIC_ROUTES_INTERFACE_SELECT"}),renderOption:_e.Ku})};var ge=n(926538),Te=n(625796),fe=n(198301),xe=n(680163),Se=n(139847),Ne=n(570866),Oe=n(443444);const Ce=({form:e})=>{const{formatMessage:t}=(0,O.tz)(),n=(0,H.L_)(),i=(0,r.d4)(M.Ct),o=(0,a.FH)({control:e.control,name:"interface"}),l=(0,d.useMemo)(()=>i.find(e=>e._id===o),[o,i]),c=!!l&&(0,v.ok)(l);return(0,s.jsx)(s.Fragment,{children:c?(0,s.jsx)(a.xI,{control:e.control,name:"destination.simple_ips",render:({field:e,fieldState:i,formState:o})=>(0,s.jsx)(xe.A,{value:e.value||[],onChange:t=>e.onChange(t),invalid:i.invalid?n((0,a.Jt)(o.errors,e.name)?.message)||!0:void 0,labels:{fieldLabel:"SETTINGS_IP_ADDRESS_SUBNET",modalTitle:"SETTINGS_ADD_MULTIPLE_IPS",modalFieldPlaceholder:t({id:"SETTINGS_ADD_MULTIPLE_IPS_PLACEHOLDER"})},fieldValidation:{getDuplicationMessage:()=>t({id:"SETTINGS_DUPLICATE_IP_VALIDATION"}),validate:e=>!e||Ne.M9.test(e)?t({id:"COMMON_VALIDATION_VALID_IPV4"}):(0,Oe.GH)(Se.oi.IPV4,e,!0,t)},extraFieldConfig:{placeholder:"COMMON_ENTER_IP_ADDRESS",placeholderValues:{version:Se.oi.IPV4}}})},"simple"):(0,s.jsx)(a.xI,{control:e.control,name:"destination.ips",render:({field:e,fieldState:t,formState:i})=>(0,s.jsx)(fe.f,{value:e.value||[],onChange:t=>e.onChange(t),invalid:t.invalid?n((0,a.Jt)(i.errors,e.name)?.message)||!0:void 0})},"advanced")})},ve=({form:e})=>{const t=(0,r.d4)(M.Ct),n=(0,A.A)(j.Xj.TRAFFIC_RULE_AND_ROUTE_REGIONS),o=(0,a.FH)({control:e.control,name:"destination.type"}),l=(0,a.FH)({control:e.control,name:"interface"}),c=(0,d.useMemo)(()=>t.find(e=>e._id===l),[l,t]),m=!!c&&(0,v.ok)(c);return(0,s.jsxs)(f.A,{title:(0,s.jsx)(O.sA,{id:"COMMON_DESTINATION"}),tooltip:(0,s.jsx)(O.sA,{id:"SETTINGS_POLICY_BASED_ROUTES_DESTINATION_DESCRIPTION"}),children:[(0,s.jsxs)(ae.A,{children:[(0,s.jsx)(le,{disabled:m&&o!==i.ANY,children:(0,s.jsx)(Y.A,{control:e.control,name:"destination.type",value:i.ANY,children:(0,s.jsx)(O.sA,{id:"COMMON_ANY"})})}),(0,s.jsx)(Y.A,{control:e.control,name:"destination.type",value:i.IP,children:(0,s.jsx)(O.sA,{id:"COMMON_IP"})}),(0,s.jsx)(le,{disabled:m&&o!==i.DOMAIN,children:(0,s.jsx)(Y.A,{control:e.control,name:"destination.type",value:i.DOMAIN,children:(0,s.jsx)(O.sA,{id:"COMMON_DOMAIN"})})}),n||o===i.REGION?(0,s.jsx)(le,{disabled:m&&o!==i.REGION,children:(0,s.jsx)(Y.A,{control:e.control,name:"destination.type",value:i.REGION,children:(0,s.jsx)(O.sA,{id:"COMMON_REGION"})})}):null]}),o===i.IP?(0,s.jsx)(Ce,{form:e}):null,o===i.DOMAIN?(0,s.jsx)(ge.A,{form:e,name:"destination.domains"}):null,o===i.REGION?(0,s.jsx)(B.A,{control:e.control,name:"destination.regions",options:Te.Ay,triggerButtonText:(0,s.jsx)(O.sA,{id:"COMMON_SELECT"}),truncateLabels:!0,isWindowed:!0}):null]})};var Me=n(420174),Re=n(753959),be=n(793442),je=n(341699);const De=({existingRecord:e})=>(0,s.jsx)(Re.A,{children:(0,s.jsxs)(x.A,{flexDirection:"column",children:[(0,s.jsx)(O.sA,{id:"COMMON_MANAGED_BY_FABRIC",values:{feature:(0,s.jsx)(O.sA,{id:"COMMON_POLICY_BASED_ROUTE"})}}),(0,s.jsx)(be.A,{id:"COMMON_VIEW_IN_SITE_MANAGER",href:(0,je.vF)(e?.cloud_template)})]})});var Le=n(640708),ye=n(258978);const we=":::";var ke;!function(e){e.DEVICE="device",e.NETWORK="network"}(ke||(ke={}));const Pe=e=>!e||e?.target_devices?.some(e=>e.type===z.Q.ALL_CLIENTS)?{type:o.ANY}:{type:o.DEVICES_AND_NETWORKS,devices_and_networks:e?.target_devices.flatMap(e=>{return e.type===z.Q.NETWORK&&e.network_id?[(t=e.network_id,[ke.NETWORK,t].join(we))]:e.type===z.Q.CLIENT&&e.client_mac?[(n=e.client_mac,[ke.DEVICE,n].join(we))]:[];var t,n})},Ge=e=>e?.matching_target===ye.d.REGION?{type:i.REGION,regions:e.regions||[]}:e?.matching_target===ye.d.DOMAIN?{type:i.DOMAIN,domains:(e.domains||[]).map(q.vt)}:e?.matching_target===ye.d.IP?{type:i.IP,ips:[...e.ip_addresses||[],...e.ip_ranges||[]],simple_ips:e.ip_addresses.flatMap(e=>{return"ip_start"in(t=e)&&t.ip_start||"ip_stop"in t&&t.ip_stop||"ports"in t&&t.ports?.length||"port_ranges"in t&&t.port_ranges?.length?[]:[e.ip_or_subnet];var t})}:{type:i.ANY},$e=(e,t,n)=>({name:e?.description||n,interface:e?.network_id||void 0,kill_switch_enabled:e?.kill_switch_enabled??t,next_hop:e?.next_hop||"",source:Pe(e),destination:Ge(e)}),Fe="policy-based-route-form",He=({activeItem:e,typeSelector:t,subTypeSelector:n})=>{const{sharedName:k,setSharedName:P}=(0,Me.H5)(),$=e&&e._id!==D.R6?e:void 0,F=(0,r.wA)(),H=(0,r.d4)(b.EL),Y=(0,r.d4)(M.Ct),U=(0,A.A)(j.Xj.TRAFFIC_ROUTE_KILL_SWITCH),B=(0,L.I)(),{formatMessage:W}=(0,O.tz)(),K=(0,I.m)({schema:V(Y),defaultValues:$e($,U,k)});(0,m.y)(K);const Q=(0,a.FH)({control:K.control,name:"interface"}),X=(0,a.FH)({control:K.control,name:"destination.type"}),J=(0,d.useMemo)(()=>Y.find(e=>e._id===Q),[Q,Y]),Z=!!J&&(0,v.ok)(J),ee=K.handleSubmit(async e=>F((0,C.kk)(((e,t,n)=>{const s=n.find(e=>e._id===t.interface),r=!!s&&(0,v.ok)(s);return{enabled:!0,...e,description:t.name,network_id:t.interface,kill_switch_enabled:t.kill_switch_enabled,target_devices:t.source.type===o.ANY||r?[{type:z.Q.ALL_CLIENTS}]:t.source.type===o.DEVICES_AND_NETWORKS?t.source.devices_and_networks.map(e=>(e=>{const[t,n]=e.split(we);return t===ke.DEVICE?{type:z.Q.CLIENT,client_mac:n}:{type:z.Q.NETWORK,network_id:n}})(e)):[],next_hop:t.next_hop||"",matching_target:t.destination.type===i.DOMAIN?ye.d.DOMAIN:t.destination.type===i.IP?ye.d.IP:t.destination.type===i.REGION?ye.d.REGION:ye.d.INTERNET,ip_addresses:t.destination.type===i.IP?(r?t.destination.simple_ips?.map(e=>({ip_or_subnet:e}))||[]:t.destination.ips?.filter(e=>"ip_or_subnet"in e)||[]).map(e=>({...e,ip_version:(0,G.isValidIpv6)(e.ip_or_subnet)||(0,Le.dS)(e.ip_or_subnet)?"v6":"v4"})):[],ip_ranges:t.destination.type===i.IP?(t.destination.ips||[]).filter(e=>"ip_start"in e).map(e=>({...e,ip_version:(0,G.isValidIpv6)(e.ip_start)?"v6":"v4"})):[],domains:t.destination.type===i.DOMAIN?t.destination.domains.map(q.DP):[],regions:t.destination.type===i.REGION&&t.destination.regions||[]}})($,e,Y))).then(e=>{F((0,S.SQ)(!1)),F((0,S.XP)({type:g.H.POLICY_BASED_ROUTE,id:e._id})),B(y.J)}).then(()=>{K.reset()}).catch(e=>{const t=(0,c.F)(e)?e:void 0;F((0,N.ox)({errorMessage:t?.msg,errorValues:t?.details,icon:l.C.danger,message:"SETTINGS_TRAFFIC_ROUTES_TOAST_SAVE_FAILURE"}))})),te=(0,R.A)($);return(0,s.jsx)("form",{onSubmit:ee,id:Fe,children:(0,s.jsxs)(E.A,{isDisabled:H||te,children:[(0,s.jsxs)(x.A,{gap:T.Ln,flexDirection:"column",width:"100%",children:[(0,s.jsxs)(f.A,{children:[$&&te?(0,s.jsx)(De,{existingRecord:$}):null,t,(0,s.jsx)(h.A,{control:K.control,name:"name",label:(0,s.jsx)(O.sA,{id:"COMMON_NAME"}),onChange:(e,t)=>{t.onChange(e),P(e.target.value)}})]}),(0,s.jsxs)(f.A,{title:n?(0,s.jsx)(O.sA,{id:"COMMON_TYPE"}):void 0,children:[n,(0,s.jsx)(Ie,{form:K}),Z&&X===i.IP?(0,s.jsx)(h.A,{control:K.control,name:"next_hop",label:(0,s.jsx)(O.sA,{id:"COMMON_NEXT_HOP"}),tooltip:(0,s.jsx)(O.sA,{id:"SETTINGS_TRAFFIC_ROUTES_NEXT_HOP_DESC"}),placeholder:W({id:"COMMON_ENTER_IP_ADDRESS"})}):null,U?(0,s.jsx)(pe,{form:K}):null]}),(0,s.jsx)(ce,{form:K}),(0,s.jsx)(ve,{form:K}),$&&!te?(0,s.jsx)(p.A,{enabled:$.enabled,name:$.description,onPause:async()=>{await F((0,C.kk)({...$,enabled:!1})),await F((0,C.EO)())},onResume:async()=>{await F((0,C.kk)({...$,enabled:!0})),await F((0,C.EO)())},onRemove:()=>F((0,C.Xo)({id:$._id,description:$.description}))}):null,$&&te?(0,s.jsx)(_.A,{actions:[(0,s.jsx)(u.A,{name:$.description,onRemove:()=>F((0,C.Xo)({id:$._id,description:$.description})),additionalMessage:(0,s.jsx)(O.sA,{id:"SETTINGS_ENTITY_MANAGED_BY_SITE_MANAGER_CONFIRMATION",values:{count:1,entity:(0,s.jsx)(O.sA,{id:"COMMON_POLICY_BASED_ROUTE"})}})})]}):null]}),(0,s.jsx)(w.A,{onFormCancel:()=>K.reset(),isDirty:K.formState.isDirty||!$,hideCancelButton:!K.formState.isDirty,submitButtonText:$?void 0:"COMMON_ACTION_ADD",form:Fe,isSubmitting:K.formState.isSubmitting})]})})}},61322(e,t,n){n.d(t,{I:()=>i});const i={HEADER_HEIGHT:32,ROW_HEIGHT:32,EDIT_FIELD_HEIGHT:36,getHeight(e,t,n,i){return Math.min((i||this.ROW_HEIGHT)*e+(n??this.HEADER_HEIGHT),(i||this.ROW_HEIGHT)*t+(n??this.HEADER_HEIGHT))},getEditContainerHeight(e,t,n){return Math.min((n||this.EDIT_FIELD_HEIGHT)*e,(n||this.EDIT_FIELD_HEIGHT)*t)}}},926538(e,t,n){n.d(t,{A:()=>a});var i=n(274934),o=n(115219),s=n(470070),r=n(858098);const a=function({form:e,name:t}){const{formatMessage:n}=(0,s.tz)();return(0,i.jsx)(r.A,{form:e,name:t,fieldLabel:"COMMON_DOMAIN_NAME",modalTitle:(0,i.jsx)(s.sA,{id:"SETTINGS_ADD_MULTIPLE_DOMAINS"}),modalFieldPlaceholder:n({id:"SETTINGS_ADD_MULTIPLE_DOMAINS_PLACEHOLDER"}),itemSchema:o.a,placeholder:n({id:"SETTINGS_NETWORKS_FORM_FIELD_DOMAIN_NAME_PLACEHOLDER"}),getDuplicationMessage:()=>n({id:"SETTINGS_SECURITY_DOMAINS_VALIDATION"})})}},928609(e,t,n){n.d(t,{gb:()=>r,om:()=>s,tY:()=>a});var i,o=n(556059);!function(e){e.DEVICE="device",e.NETWORK="network"}(i||(i={}));const s=(e,t)=>[i.DEVICE,e].join(t),r=(e,t)=>[i.NETWORK,e].join(t),a=(e,t)=>{const[n,s]=e.split(t);return n===i.DEVICE?{type:o.Q.CLIENT,client_mac:s}:{type:o.Q.NETWORK,network_id:s}}},858098(e,t,n){n.d(t,{A:()=>m});var i=n(274934),o=n(602086),s=n(42220),r=n(260334),a=n(184931),d=n(100978),l=n(470070),c=n(680163);const m=function({form:e,name:t,fieldLabel:n,modalTitle:m,modalFieldPlaceholder:u,placeholder:p,itemSchema:_,transformValue:A,getDuplicationMessage:h,extraDisplayColumns:E,actions:I,max:g,disableMultiEdit:T=!1,splitBy:f,validateInArray:x,sortValue:S,hideBatchAddLabel:N=!1}){const O=(0,a.mQ)(),C=(0,r.L_)(),{formatMessage:v}=(0,l.tz)(),M=(0,o.useMemo)(()=>({fieldLabel:n,modalTitle:m,modalFieldPlaceholder:u}),[n,u,m]),R=(0,o.useMemo)(()=>({getDuplicationMessage:h??(()=>v({id:"SETTINGS_VALUE_UNIQUE"})),validateInArray:x,validate:e=>{if(f&&"string"==typeof e){const t=e.split(f).map(e=>e.trim()).filter(Boolean);for(const n of t.length>0?t:[e]){const e=_.safeParse(n);if(!e.success)return C(e.error.issues[0]?.message)}return!0}const t=_.safeParse(e);return!!t.success||C(t.error.issues[0]?.message)}}),[v,C,h,_,f,x]),b=(0,o.useMemo)(()=>({placeholder:p,translatePlaceholder:!1,parser:A?e=>A(e?.[0]?.target?.value):void 0}),[p,A]);return(0,i.jsx)(s.xI,{control:e.control,name:t,render:({field:e,fieldState:t,formState:n})=>(0,i.jsx)(d.A,{flexDirection:"column",width:"100%",children:(0,i.jsx)(c.A,{disabled:O,labels:M,fieldValidation:R,extraFieldConfig:b,value:S?S(e.value||[]):e.value||[],onChange:t=>e.onChange(t),invalid:t.invalid?C((0,s.Jt)(n.errors,e.name)?.message)||!0:void 0,extraDisplayColumns:E,actions:I,disableMultiEdit:T,max:g,splitBy:f,transformValue:A,hideBatchAddLabel:N})})})}},749445(e,t,n){n.d(t,{A:()=>m});var i=n(274934),o=n(42220),s=n(309130),r=n(897396),a=n(470070),d=n(260334),l=n(184931);const c=[],m=function({control:e,name:t,tooltip:n,options:m,triggerButtonText:u,truncateLabels:p=!0,isWindowed:_,searchOptions:A,maxSelections:h,narrowTrigger:E,chipClassName:I,label:g,onAfterChange:T}){const f=(0,l.mQ)(),x=(0,d.L_)();return(0,i.jsx)(o.xI,{control:e,name:t,render:({field:e,fieldState:d,formState:l})=>(0,i.jsx)(r.A,{name:e.name,onChange:t=>{e.onChange(t),T?.(t)},disabled:f,value:e.value||c,tooltipDescription:n,options:m,truncateLabels:p,invalid:d.invalid?x((0,o.Jt)(l.errors,t)?.message)||!0:void 0,translateTriggerButtonText:!1,triggerButtonText:u??(0,i.jsx)(a.sA,{id:"COMMON_EDIT_SELECTIONS"}),isWindowed:_,searchOptions:A,maxSelections:h,isFullWidth:!0,triggerButtonHeight:E?s.S2:void 0,chipClassName:I,label:g})})}},635891(e,t,n){n.d(t,{A:()=>c});var i=n(274934),o=n(42220),s=n(699709),r=n(775250),a=n(309130),d=n(260334),l=n(184931);const c=function({control:e,name:t,label:n,placeholder:c,tooltip:m,tooltipProps:u,autoFocus:p,motif:_,onChange:A,onBlur:h,onAfterChange:E,onPaste:I,onKeyDown:g,passwordToggle:T,type:f,helperMessage:x,autoComplete:S,contentBefore:N,contentAfter:O,onFocus:C,value:v,invalid:M}){const R=(0,l.mQ)(),b=(0,l.Im)(),j=(0,l.q)(),D=(0,d.L_)();return(0,i.jsx)(o.xI,{control:e,name:t,render:({field:e,fieldState:d,formState:l})=>(0,i.jsx)(s.A,{type:f||(T?"password":"text"),variant:"secondary",width:"100%",autoFocus:p,...e,onChange:t=>{A?A(t,e,l):e.onChange(t),E?.(t)},onBlur:t=>{h?h(t,e,l):e.onBlur()},onFocus:C,onPaste:I,disabled:R,value:v??e.value?.toString(),invalid:M||(d.invalid?(0,i.jsxs)(r.A,{variant:"inherit",style:{overflowWrap:"break-word"},children:[D((0,o.Jt)(l.errors,t)?.message)||!0," "]}):void 0),label:n,placeholder:c,labelTooltip:m,labelTooltipProps:{style:{opacity:b?a.xN:void 0,pointerEvents:j?"none":void 0,...u?.style},...u},motif:_,passwordToggle:T,helperMessage:x,autoComplete:S,onKeyDown:g,contentBefore:N,contentAfter:O})})}},509927(e,t,n){n.d(t,{V:()=>r});var i=n(602086),o=n(603606);const s=e=>{const t=(0,i.useRef)(e);return(0,i.useEffect)(()=>{t.current=e},[e]),(0,i.useCallback)((...e)=>t.current(...e),[])};function r(e,t){const n=(0,i.useRef)([]),[,r]=(0,i.useState)(0),[a,d]=(0,i.useState)(null);(0,i.useEffect)(()=>{const e=setInterval(()=>{n.current.length&&t?.estimatedDurationMs&&r(e=>e+1)},1e3);return()=>clearInterval(e)},[t?.estimatedDurationMs]);const l=t?.dedupe??!1,c=s(t?.onSuccess||(()=>{})),m=s(t?.onError||(()=>{})),u=(0,i.useCallback)((...i)=>{if(l&&n.current.length)return Promise.reject();const s=(async()=>e(...i))();return n.current.push({promise:s,startedAt:Date.now()}),r(e=>e+1),s.then(e=>(c?.(e),d(e),e)).catch(async e=>{if(t?.delayOnErrorMs&&await(0,o.u)(t.delayOnErrorMs),d(null),!m)throw e;m(e)}).finally(async()=>{n.current=n.current.filter(e=>e.promise!==s),r(e=>e+1)})},[e,l,m,c,t?.delayOnErrorMs]),p=n.current.at(-1),_=p&&t?.estimatedDurationMs?Math.min((Date.now()-p.startedAt)/t.estimatedDurationMs,.9):void 0;return{execute:u,isLoading:!!n.current.length,lastData:a,estimatedProgress:_}}},292027(e,t,n){n.d(t,{A:()=>h});var i=n(274934),o=n(199742),s=n(977872),r=n(159469),a=n(464920),d=n(509927),l=n(963428),c=n(700444),m=n(470070);const u=({onResume:e,disabledReason:t})=>{const n=(0,s.wA)(),o=(0,d.V)(()=>e(),{onError:e=>{const t=(0,a.F)(e)?e:void 0;return n((0,c.ox)({icon:r.C.danger,message:"SETTINGS_POLICY_RESUME_FAILURE",values:{count:1},errorMessage:t?.msg,errorValues:t}))}});return(0,i.jsx)(l.A,{onPress:o.execute,isDisabled:o.isLoading,disabledReason:t,children:(0,i.jsx)(m.sA,{id:"COMMON_ACTION_RESUME"})})};var p=n(404056),_=n(146215);const A=({name:e,onPause:t,disabledReason:n})=>{const o=(0,s.wA)(),u=(0,d.V)(()=>t(),{onError:e=>{const t=(0,a.F)(e)?e:void 0;return o((0,c.ox)({icon:r.C.danger,message:"SETTINGS_POLICY_PAUSE_FAILURE",values:{count:1},errorMessage:t?.msg,errorValues:t}))}});return(0,i.jsx)(_.A,{trigger:(0,i.jsx)(l.A,{isDisabled:u.isLoading,disabledReason:n,children:(0,i.jsx)(m.sA,{id:"COMMON_ACTION_PAUSE"})}),confirmButtonVariant:"emphasis",title:(0,i.jsx)(m.sA,{id:"SETTINGS_SECURITY_PAUSE_POLICY_TITLE",values:{count:1}}),message:(0,i.jsx)(m.sA,{id:"SETTINGS_SECURITY_PAUSE_FIREWALL_POLICY_MESSAGE_SINGLE",values:{name:e}}),onConfirm:()=>u.execute()})},h=({enabled:e,name:t,onPause:n,pauseDisabledReason:s,onResume:r,resumeDisabledReason:a,onRemove:d,removeDisabledReason:l,removeAdditionalMessage:c})=>(0,i.jsx)(o.A,{actions:[e?(0,i.jsx)(A,{name:t,onPause:n,disabledReason:s}):(0,i.jsx)(u,{onResume:r,disabledReason:a}),(0,i.jsx)(p.A,{name:t,onRemove:d,disabledReason:l,additionalMessage:c})]})},404056(e,t,n){n.d(t,{A:()=>_});var i=n(274934),o=n(977872),s=n(159469),r=n(464920),a=n(509927),d=n(963428),l=n(146215),c=n(700444),m=n(470070),u=n(100978),p=n(309130);const _=({onRemove:e,name:t,disabledReason:n,additionalMessage:_})=>{const A=(0,o.wA)(),h=(0,a.V)(()=>e(),{onError:e=>{const t=(0,r.F)(e)?e:void 0;return A((0,c.ox)({icon:s.C.danger,message:"SETTINGS_POLICY_DELETE_FAILURE",values:{count:1},errorMessage:t?.msg,errorValues:t}))}});return(0,i.jsx)(l.A,{trigger:(0,i.jsx)(d.A,{variant:"destructive",disabledReason:n,children:(0,i.jsx)(m.sA,{id:"COMMON_ACTION_REMOVE"})}),title:(0,i.jsx)(m.sA,{id:"SETTINGS_SECURITY_REMOVE_POLICY_TITLE",values:{count:1}}),message:_?(0,i.jsxs)(u.A,{flexDirection:"column",gap:p.kc,children:[(0,i.jsx)(m.sA,{id:"SETTINGS_SECURITY_REMOVE_FIREWALL_POLICY_SINGLE_MESSAGE",values:{name:t}}),_]}):(0,i.jsx)(m.sA,{id:"SETTINGS_SECURITY_REMOVE_FIREWALL_POLICY_SINGLE_MESSAGE",values:{name:t}}),onConfirm:()=>h.execute()})}},603606(e,t,n){n.d(t,{u:()=>i});const i=e=>new Promise(t=>{setTimeout(t,e)})}}]);