"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[96785],{152408:(e,t,n)=>{n.d(t,{A:()=>s});var r=n(296540),a=n(162420),o=n(699784),i=n(765562),l=n(349107),c=n(263130);const s=({feature:e,isAlternativeTranslation:t})=>r.createElement(c.A,{icon:r.createElement(a.A,{size:"original",isActive:!0,variant:"fill"}),description:r.createElement(o.sA,{id:t?"SETTINGS_LOW_PERFORMANCE_GATEWAY_WARNING_ALTERNATIVE_TEXT":"SETTINGS_LOW_PERFORMANCE_GATEWAY_WARNING",values:{feature:(0,o.tz)().formatMessage({id:e}),link:r.createElement(l.A,{href:i.A.storeCloudGateways,id:"SETTINGS_CLOUD_GATEWAY"})}})})},200826:(e,t,n)=>{n.d(t,{A:()=>E});var r=n(469733),a=n(296540),o=n(429252),i=n.n(o),l=n(198494),c=n(415246),s=n(305988),m=n(789768),_=n(249304);const d=Object.keys(_.l).reduce((e,t)=>(e[t]=!1,e),{}),u=e=>{const t=(0,r.useDispatch)(),n=(0,r.useSelector)(l.Bm);return(0,a.useEffect)(()=>{if(!d[e]){d[e]=!0;const r=s.W2[c.xz.TABLES][e],a=n[e]||{},o=r?.initialColumnSnapshot;if(o){const n={...a?.initialColumnSnapshot},r=[...a.initialColumns||[]];if(Object.keys(n).length)Object.entries(o).forEach(([e,t])=>{e in n||(n[e]=t)}),Object.entries(n).forEach(([e,t])=>{!r.includes(e)&&t&&r.push(e)}),i()(r,a.initialColumns)||t((0,m.yT)(e,{initialColumns:Array.from(new Set([...r,...a.initialColumns])),initialColumnSnapshot:n}));else if(r.length){const n=r.reduce((e,t)=>(e[t]=!0,e),{});t((0,m.yT)(e,{initialColumnSnapshot:n,initialColumns:Object.keys(n)}))}}}},[t,e,n]),null},E=e=>{u(e);return(0,r.useSelector)((0,a.useMemo)(()=>(0,l.h)(e),[e]))}},319551:(e,t,n)=>{n.d(t,{A:()=>d,I:()=>_});var r=n(296540),a=n(888170),o=n(118818),i=n(259902),l=n(71479),c=n(691294);const s=(0,l.A)(o.A,{shouldForwardProp:e=>!["marginLeft","marginRight"].includes(e)})`
  width: 6px;
  height: 6px;
  ${({marginLeft:e})=>e&&`margin-left: ${e}px;`}
  ${({marginRight:e})=>e&&`margin-right: ${e}px;`}
`,m=(0,l.A)(i.A,{shouldForwardProp:e=>!["marginLeft","marginRight"].includes(e)})`
  width: 13px;
  height: 13px;
  color: ${a.Ay["white-6"]};
  ${({marginLeft:e})=>e&&`margin-left: ${e}px;`}
  ${({marginRight:e})=>e&&`margin-right: ${e}px;`}
`,_=(e,t,n)=>t===c.S2.ONLINE?"success":e!==c.sK.VPN&&e!==c.sK.TELEPORT&&n?"danger":"neutral",d=(0,r.memo)(({status:e,marginLeft:t=5,marginRight:n=12})=>"blocked"===e?r.createElement(m,{marginLeft:t-3,marginRight:n-3}):r.createElement(s,{variant:e,marginLeft:t,marginRight:n}))},396785:(e,t,n)=>{n.d(t,{A:()=>Pt});var r=n(469733),a=n(296540),o=n(592510),i=n(853801),l=n(47801),c=n(743663),s=n(91589),m=n(90086),_=n(832468),d=n(895424),u=n(897502),E=n(641777),p=n(79786),A=n(398300),I=n(566723),O=n(152408),T=n(48925),f=n(821580),R=n(294303),N=n(845030),C=n(699784),S=n(772690),g=n(110456),h=n(711748),P=n(366188),M=n(602021),D=n(414783),L=n(934474),v=n(532419),w=n(984652),G=n(959341),y=n(329109),b=n(407814),F=n(215616),W=n(387521),k=n(242299),x=n(143985),U=n(263963),$=n(737410),V=n(760370),H=n(348466),B=n(306190),Y=n(470310);const j=(e,t)=>(0,s.Y)((e=>({dst_port:e.interface_port,proto:e.protocol,destination_ip:(0,B.xs)(e.interface)?void 0:e.interface_ips[e.interface],destination_ips:(0,B.xs)(e.interface)?Object.entries(e.interface_ips).map(([e,t])=>({interface:e,destination_ip:t})):void 0,pfwd_interface:e.interface,src_limiting_enabled:e.source.type!==Y.I.ANY,src:e.source.type===Y.I.LIMITED&&e.source.value.type===Y.y.SPECIFIC?e.source.value.ip:void 0,src_firewall_group_id:e.source.type===Y.I.LIMITED&&e.source.value.type===Y.y.LIST?e.source.value.object_id:void 0,src_limiting_type:e.source.type!==Y.I.ANY?e.source.value.type===Y.y.SPECIFIC?$.sp.IP:$.sp.FIREWALL_GROUP:void 0}))(e),t),z=b.KC([b.Ik({type:b.eu(Y.I.ANY)}),b.Ik({type:b.eu(Y.I.LIMITED),value:b.KC([b.Ik({type:b.eu(Y.y.SPECIFIC),ip:k.q}),b.Ik({type:b.eu(Y.y.LIST),object_id:b.Yj({message:(0,U.rn)("SETTINGS_COMMON_LIST_REQUIRED")})})])})]),K=e=>e.includes(H.KE)||e.includes(H.jr),X=(e,t)=>(0,B.xs)(t?.pfwd_interface)?t?.destination_ips?.find(t=>t.interface===e)?.destination_ip||V.U:t?.pfwd_interface===e&&t?.destination_ip||V.U,q=(e,t)=>({name:e?.name||t,interface:e?(0,B.xs)(e.pfwd_interface)?$.ep.ALL:e.pfwd_interface||$.ep.ALL:$.ep.WAN,interface_ips:Object.fromEntries(Object.values($.ep).map(t=>[t,X(t,e)])),interface_port:e?.dst_port||"",source:e?.src_limiting_enabled?e?.src_limiting_type===$.sp.FIREWALL_GROUP?{type:Y.I.LIMITED,value:{type:Y.y.LIST,object_id:e?.src_firewall_group_id}}:e?.src_limiting_type===$.sp.IP?{type:Y.I.LIMITED,value:{type:Y.y.SPECIFIC,ip:e?.src}}:{type:Y.I.ANY,value:{type:Y.y.SPECIFIC}}:{type:Y.I.ANY,value:{type:Y.y.SPECIFIC}},forward_ip:e?.fwd||"",forward_port:e?.fwd_port||"",protocol:e?.proto||$.do.TCP_UDP,logging_enabled:!!e?.log});var Q=n(349785),J=n(758649),Z=n(284428),ee=n(349107),te=n(765562);const ne="1-10,11,12",re=({form:e})=>{const{formatMessage:t}=(0,C.tz)(),n=(0,Z.mQ)(),r=(0,Q.FH)({control:e.control,name:"interface_port"}),o=(0,Q.FH)({control:e.control,name:"forward_port"});return a.createElement(R.A,{flexDirection:"column",gap:I.YC,width:"100%"},a.createElement(d.A,{control:e.control,name:"interface_port",placeholder:t({id:"COMMON_PLACEHOLDER_EG"},{value:ne}),label:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_WAN_PORT"}),tooltip:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_WAN_PORT_TOOLTIP",values:{link:a.createElement(ee.A,{id:"COMMON_LEARN_MORE",href:te.A.portForwardingGuide})}}),tooltipProps:{portal:!0,isInteractive:!0}}),a.createElement(R.A,null,a.createElement(J.A,{type:"button",variant:"inline",size:"medium",disabled:n||!r||r===o,onClick:()=>e.setValue("forward_port",r,{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0})},a.createElement(C.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_PORT_FORWARD_UPDATE_FORWARD_PORT"}))))};var ae=n(71479),oe=n(311785),ie=n(271856),le=n(438628),ce=n(594827),se=n(188738),me=n(128736),_e=n(317672),de=n(349665),ue=n(339879),Ee=n(517940),pe=n(547868),Ae=n(177651),Ie=n(546391),Oe=n(592563),Te=n(149133);const fe=({label:e,network:t,form:n})=>{const{formatMessage:o}=(0,C.tz)(),i=(0,r.useDispatch)(),l=(0,r.useSelector)(Ae.E),c=(0,r.useSelector)(ue.uM),s=(0,Q.FH)({control:n.control,name:"interface_port"}),m=(0,Q.FH)({control:n.control,name:`interface_ips.${(0,B.RJ)(t.wan_networkgroup)}`}),_=c.find(e=>e._id===t._id),d=m===V.U?_?.ip:m||_?.ip,u=l.some(e=>e.interface===(0,pe.d)(t.wan_networkgroup)),E=((e,t,n,r,o,i)=>{if(!e)return null;const l=a.createElement(C.sA,{id:"COMMON_NETWORK_PURPOSE_WANX",values:{number:(0,ce.si)(r)}});return(0,Te.J6)(e)?a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_INTERFACE_IPS_CGNAT_WARNING",values:{name:l,link:a.createElement(ee.A,{href:te.A.portForwardingGuide,id:"COMMON_LEARN_MORE",noWrap:!0}),multiplePorts:o}}):(0,Te.C0)(e)?a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_INTERFACE_PRIVATE_IP_WARNING",values:{name:l,link:a.createElement(ee.A,{href:te.A.portForwardingGuide,id:"COMMON_LEARN_MORE",noWrap:!0}),multiplePorts:o}}):!n&&[Ee.mR.DHCP,Ee.mR.PPPOE,Ee.mR.DS_LITE].includes(t)?a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_INTERFACE_IPS_DHCP_PPPOE_WARNING",values:{name:l,link:a.createElement(ee.A,{href:te.A.vpnDynamicDnsConfigGuide,id:"COMMON_LEARN_MORE",noWrap:!0}),dynamicDnsLink:a.createElement(Oe.A,{onClick:i},a.createElement(C.sA,{id:"COMMON_DYNAMIC_DNS"})),multiplePorts:o}}):null})(d,t.wan_type||Ee.mR.STATIC,u,t.wan_networkgroup,s?.includes(H.KE)||s?.includes(H.jr),()=>i((0,N.XP)({type:A.H.WAN,id:t._id}))),p=a.createElement(R.A,{gap:I.YC},a.createElement(_e.A,{htmlFor:"interface_ip",tooltip:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_WAN_IP_TOOLTIP"})},e??a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_WAN_X_IP",values:{name:(0,ce.qY)(t.wan_networkgroup,o)}})),E?a.createElement(ie.A,{description:E,portal:!0,isInteractive:!0,style:{display:"flex",alignItems:"center"}},a.createElement(me.A,{variant:"fill",size:"medium"})):null),O=(e=>[Ee.mR.STATIC,Ee.mR.PPPOE].includes(e.wan_type)?(e.wan_ip_aliases||[]).map(e=>e?.replace(Ie.M9,"")).filter(Boolean):[])(t);if(O.length){const e=[{label:o({id:"SETTINGS_NETWORKS_FORM_FIELDS_INTERNET_SOURCE_IP_VALUE_MAIN"}),value:V.U,additionalInfo:t?.wan_ip||void 0},...O.map(e=>({label:`${e}`,value:e}))];return a.createElement(se.A,{control:n.control,name:`interface_ips.${(0,B.RJ)(t.wan_networkgroup)}`,options:e,key:t._id,label:p})}const T=_?.ip||(t.wan_type===Ee.mR.STATIC?t.wan_ip:d)||o({id:t.wan_type===Ee.mR.DHCP?"COMMON_DHCP":"COMMON_IPV4_CONNECTION_TYPE_PPPOE"});return a.createElement(de.A,null,p,a.createElement(le.A,{type:"text",value:T,disabled:!0,variant:"secondary",width:"100%",style:{marginTop:2}}))},Re=(0,ae.A)("div",(0,oe.A)("numColumns"))`
  display: grid;
  grid-template-columns: repeat(${({numColumns:e})=>e}, 1fr);
  gap: ${I.kc};
`,Ne=({form:e})=>{const t=(0,Q.FH)({control:e.control,name:"interface"}),n=(0,r.useSelector)(P.Ct),o=(0,a.useMemo)(()=>n.filter(e=>(0,B.EG)(e,t)),[n,t]);return o.length?a.createElement(Re,{numColumns:Math.min(2,o.length)},o.map(t=>a.createElement(fe,{key:t._id,network:t,form:e,label:1===o.length?a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_WAN_IP"}):null}))):null};var Ce=n(610356),Se=n(553432);const ge=[$.do.TCP_UDP,$.do.TCP,$.do.UDP],he={[$.do.TCP_UDP]:"COMMON_TCP_AND_UDP",[$.do.TCP]:"COMMON_TCP",[$.do.UDP]:"COMMON_UDP"},Pe=({form:e})=>a.createElement(de.A,null,a.createElement(_e.A,{htmlFor:"protocol"},a.createElement(C.sA,{id:"COMMON_PROTOCOL"})),a.createElement(Se.A,null,ge.map(t=>a.createElement(Ce.A,{key:t,control:e.control,name:"protocol",value:t},a.createElement(C.sA,{id:he[t]})))));var Me=n(504779),De=n(792072),Le=n(801081),ve=n(519680);const we=({form:e})=>{const{formatMessage:t}=(0,C.tz)(),n=(0,r.useSelector)((e=>(0,Le.Mz)(ue.ht,t=>t.flatMap(t=>{const n=(0,ve.eC)(t.configuration.wan_networkgroup),r=t.configuration.wan_networkgroup&&(0,ce.si)(t.configuration.wan_networkgroup);return[{label:t.configuration.name,value:1===(0,ce.si)(n)?$.ep.WAN:n,additionalInfo:e({id:"COMMON_NETWORK_PURPOSE_WANX"},{number:r})}]})))(t)),o=(0,r.useSelector)(De.S1),i=(0,r.useSelector)(P.qp),l=n.length>3,c=e.formState.defaultValues?.interface,s=(0,a.useMemo)(()=>[...n,...o&&i&&(i.enabled||i._id===c)?[{value:$.ep.WAN_MAGIC,label:t({id:"COMMON_WAN_MAGIC"}),additionalInfo:t({id:"COMMON_WAN_MAGIC"}),tooltipDescription:t({id:"SETTINGS_WAN_MAGIC_INTERFACE_DISABLED_TOOLTIP"}),disabled:!0}]:[],...n.length>=2?[{value:$.ep.ALL,label:t({id:"COMMON_ALL_WANS"}),additionalInfo:l?void 0:t({id:"COMMON_ALL_WANS"})}]:[]],[t,l,o,n,i]),m=a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_WAN_INTERFACE"});return n.length<2?null:l?a.createElement(se.A,{control:e.control,name:"interface",label:m,options:s}):a.createElement(de.A,null,a.createElement(_e.A,{htmlFor:"interface"},m),a.createElement(Se.A,null,s.map(({additionalInfo:t,value:n,tooltipDescription:r})=>a.createElement(Me.A,{reasons:r?[r]:[]},a.createElement(Ce.A,{key:n,control:e.control,name:"interface",value:n},t)))))};var Ge=n(631293),ye=n(242366),be=n(867955);const Fe=({form:e})=>{const{formatMessage:t}=(0,C.tz)(),n=(0,Q.FH)({control:e.control,name:"source"});return a.createElement(ye.A,null,a.createElement(de.A,null,a.createElement(_e.A,{htmlFor:"source.type",tooltip:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_LIMIT_ACCESS_TO_SOURCE_TOOLTIP",values:{link:a.createElement(ee.A,{id:"COMMON_LEARN_MORE",href:te.A.portForwardingGuide})}}),tooltipProps:{isInteractive:!0,portal:!0}},a.createElement(C.sA,{id:"COMMON_FROM"})),a.createElement(Se.A,null,a.createElement(Ce.A,{control:e.control,name:"source.type",value:Y.I.ANY,onCheck:()=>e.trigger("interface_port")},a.createElement(C.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_PORT_FORWARD_FROM_VALUES_ANY"})),a.createElement(Ce.A,{control:e.control,name:"source.type",value:Y.I.LIMITED,onCheck:()=>e.trigger("interface_port")},a.createElement(C.sA,{id:"SETTINGS_INTERNET_GENERAL_ADV_GW_PORT_FORWARD_FROM_VALUES_LIMITED"})))),n?.type===Y.I.LIMITED?a.createElement(a.Fragment,null,a.createElement(Se.A,null,a.createElement(Ce.A,{control:e.control,name:"source.value.type",value:Y.y.SPECIFIC,onCheck:()=>e.trigger("interface_port")},a.createElement(C.sA,{id:"COMMON_SPECIFIC"})),a.createElement(Ce.A,{control:e.control,name:"source.value.type",value:Y.y.LIST,onCheck:()=>e.trigger("interface_port")},a.createElement(C.sA,{id:"SETTINGS_LIST"}))),n.value?.type===Y.y.SPECIFIC?a.createElement(d.A,{control:e.control,name:"source.value.ip",placeholder:t({id:"SETTINGS_ROUTING_PORT_FORWARDING_LIMITED_IP_ADDRESS_PLACEHOLDER"}),onAfterChange:()=>e.trigger("interface_port")}):null,n.value?.type===Y.y.LIST?a.createElement(Ge.A,{form:e,name:"source.value.object_id",types:[be.B.ADDRESS_GROUP]}):null):null)},We=({form:e})=>a.createElement(d.A,{control:e.control,name:"forward_port",placeholder:(0,C.tz)().formatMessage({id:"COMMON_PLACEHOLDER_EG"},{value:ne}),label:a.createElement(C.sA,{id:"COMMON_FORWARD_PORT"}),tooltip:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_FORWARD_PORT_TOOLTIP"}),tooltipProps:{portal:!0}});var ke=n(620637),xe=n(823084),Ue=n(363370),$e=n(784830),Ve=n(189601),He=n(855019),Be=n(837612),Ye=n(691294),je=n(239417);const ze=(0,Ve.WY)()((0,Le.Mz)(je.A8,je.fq,je.xD,(e,t,n)=>e.concat(n?.length>0?n:t||[]).reduce((e,t)=>{if(![Ye.sK.WIRED,Ye.sK.WIRELESS].includes(t.type))return e;const n=t;return n.use_fixedip?(e.push({id:`${n.fixed_ip||n.ip}-${n.mac}`,name:n.display_name||n.name,ip:n.fixed_ip||n.ip,mac:n.mac,client:{status:n.status,type:n.type,oui:n.oui,fingerprint:n.fingerprint,blocked:n.blocked,icon_filename:n?.unifi_device_info?.icon_filename,icon_resolutions:n?.unifi_device_info?.icon_resolutions}}),e):e},[])),e=>e),Ke=(0,Ve.WY)()((0,Le.Mz)(v.ID,e=>e.filter(e=>e.config_network?.type===He.NL.STATIC).map(e=>{const t=(0,Be.S9)(e);return{id:`${e.config_network.ip}-${e.mac}`,name:e.name,mac:e.mac,ip:e.config_network.ip||e.ip,device:{deviceState:t,status:(0,Be.Nf)(e),statusPulse:(0,Be.s1)(e.deviceState),model:e.model}}})),e=>e),Xe=(0,Le.Mz)(ze,Ke,(e,t)=>e.concat(t));var qe,Qe=n(892145),Je=n(617147),Ze=n(985370),et=n(834959),tt=n(413357),nt=n(582724),rt=n(785330),at=n(963070),ot=n(396660),it=n(249304),lt=n(596441),ct=n(905410),st=n(860765),mt=n(269889),_t=n(6176),dt=n(559478),ut=n(319551),Et=n(879275),pt=n(200826),At=n(789768),It=n(602197);!function(e){e.ID="id",e.NAME="name",e.IP="ip",e.MAC="mac"}(qe||(qe={}));const Ot=[{value:10,default:!0}],Tt=e=>e.client?.status===Ye.S2.OFFLINE||e.device?.deviceState===It.g.DISCONNECTED,ft=[{id:qe.NAME,sortable:!0,minWidth:260,label:a.createElement(C.sA,{id:"COMMON_NAME"}),renderCell:e=>a.createElement(R.A,{minWidth:0,width:"100%",gap:I.YC},a.createElement(R.A,{paddingLeft:I.YC,alignItems:"center"},e.client?a.createElement(ut.A,{marginLeft:0,marginRight:0,status:(0,ut.I)(e.client.type,e.client.status,e.client.blocked)}):a.createElement(dt.A,{status:e.device?.status,pulsating:e.device?.statusPulse}),a.createElement(R.A,{marginLeft:I.xO,height:30,minWidth:30,maxWidth:30,justifyContent:"center",alignItems:"center"},e.device?.model?a.createElement(_t.A,{model:e.device.model}):a.createElement(Et.A,{client:e.client}))),a.createElement(R.A,{flex:1,alignItems:"center",minWidth:0},a.createElement(mt.A,{enabled:!Tt(e),truncate:!0},e.name||a.createElement(C.sA,{id:"COMMON_FALLBACK"})))),compare:(0,ot.l0)(({name:e})=>e)},{id:qe.IP,minWidth:120,sortable:!0,label:a.createElement(C.sA,{id:"COMMON_IP_ADDRESS"}),renderCell:e=>a.createElement(mt.A,{enabled:!Tt(e)},e.ip),compare:(e,t,n,r)=>(0,rt.j5)((0,Te.GQ)(n.ip),(0,Te.GQ)(r.ip))},{id:qe.MAC,minWidth:120,sortable:!0,label:a.createElement(C.sA,{id:"COMMON_MAC_ADDRESS"}),renderCell:e=>a.createElement(mt.A,{enabled:!Tt(e)},e.mac),compare:(0,ot.l0)(({mac:e})=>e)}],Rt=(0,a.memo)(({searchText:e,onItemClick:t})=>{const n=(0,r.useDispatch)(),[o,i]=(0,a.useState)(st.B),l=(0,r.useSelector)(Xe),c=(0,a.useCallback)(({id:e},t)=>{n((0,At.yT)(it.l.FIXED_IPS,{sortBy:e,isAscending:t}))},[n]),{isAscending:s,sortBy:m}=(0,pt.A)(it.l.FIXED_IPS),_=(0,a.useMemo)(()=>{const t=e.toLowerCase().trim();return t?l.filter(({name:e,mac:n,ip:r})=>[e,n,r].some(e=>e?.toLowerCase?.().indexOf(t)>=0)):l},[e,l]),d=(0,a.useCallback)(({from:e,rowsPerPage:n})=>a.createElement(at.A,{items:_,rowLimit:n,rowOffset:e,columns:ft,onSort:c,initialSortBy:m,initiallySortAscending:s,onRowClick:t,rowHeight:lt.I.ROW_HEIGHT,disableColumnFilters:!0,truncateHeaderCells:!0}),[s,_,t,c,m]);return a.createElement(ct.A,{section:"COMMON_CLIENTS",wrapperFlexProps:{padding:"0",height:394},itemCount:_.length,tableType:it.l.FIXED_IPS,rowOptions:Ot,onRenderTable:d,onPageChanged:i,pageNumber:o})}),Nt=(0,ae.A)(Je.A)`
  width: 808px;
  height: 515px;
  & > div {
    overflow-x: hidden !important;
  }
`,Ct=({setShowModal:e,onItemSelect:t})=>{const[n,r]=(0,a.useState)(""),o=(0,a.useRef)(null),i=(0,a.useCallback)((e,t)=>{r(String(t))},[]),l=(0,a.useCallback)(()=>{r("")},[]);return(0,nt.A)([(0,tt.Zi)(et.B.SETTINGS)],a.createElement(Nt,{isOpen:!0,onRequestClose:()=>{e(!1)},onAfterOpen:()=>{o.current?.focus()},flushContent:!0,title:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_FIXED_IPS"})},a.createElement(R.A,{flexDirection:"column",gap:I.Ln,padding:`${I.Ln} ${I.Er} 0 ${I.Er}`},a.createElement(R.A,{justifyContent:"start"},a.createElement(Qe.A,{ref:o,iconBefore:a.createElement(Ze.A,{size:"small"}),onChange:i,onClear:l,value:n,variant:"secondary"})),a.createElement(Rt,{searchText:n,onItemClick:t}))))},St=({form:e})=>{const{formatMessage:t}=(0,C.tz)(),n=(0,Z.mQ)(),o=(0,Q.FH)({control:e.control,name:"forward_ip"}),i=(0,r.useSelector)(P.RR),l=(0,r.useSelector)(De.JP),[c,s]=(0,a.useState)(!1),m=(0,r.useSelector)(Xe),_=(0,a.useMemo)(()=>l&&(0,ke.isValidIpv4)(o)&&!i.some(({ip_subnet:e})=>e&&(0,Te.xX)(e,o)),[o,l,i]);return a.createElement(ye.A,null,a.createElement(R.A,{flexDirection:"column",gap:I.YC,width:"100%"},a.createElement(d.A,{control:e.control,name:"forward_ip",placeholder:t({id:"COMMON_IPV4_ADDRESS"}),label:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_FORWARD_IP_ADDRESS"}),tooltip:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_FORWARD_IP_ADDRESS_TOOLTIP"}),tooltipProps:{portal:!0}}),a.createElement(R.A,null,a.createElement(ie.A,{description:0===m.length?a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_SELECT_DEVICE_DISABLED_TOOLTIP"}):null,portal:!0,style:{width:"fit-content"}},a.createElement(J.A,{type:"button",variant:"inline",size:"medium",disabled:n||!m.length,onClick:()=>{s(!0)}},a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_FORWARD_IP_ADDRESS_SELECT_DEVICE_BUTTON"}))))),_?a.createElement(xe.A,null,a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_FORWARD_WARNING",values:{firewallPolicyLink:a.createElement(Ue.A,{to:`${G.g_}?${$e.o5}`},a.createElement(C.sA,{id:"COMMON_FIREWALL_POLICY"})),learnMoreLink:a.createElement(ee.A,{id:"COMMON_LEARN_MORE",noWrap:!0,href:te.A.portForwardingGuide})}})):null,c?a.createElement(Ct,{setShowModal:s,onItemSelect:({ip:t})=>{e.setValue("forward_ip",t,{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0}),s(!1)}}):null)};var gt=n(624461),ht=n(828647);const Pt=({activeItem:e,typeSelector:t})=>{const{sharedName:n,setSharedName:k}=(0,gt.H5)(),H=e?._id?.startsWith(G.R6)?void 0:e,X=(0,r.useDispatch)(),Q=(0,r.useSelector)(P.Ct),J=(0,r.useSelector)(M.EL),Z=(0,r.useSelector)(v.Lt),ee=(0,r.useSelector)(v.jY),te=(0,r.useSelector)(m._),ne=(0,r.useSelector)(v.fq),ae=(0,r.useSelector)(h.O9),oe=(0,a.useMemo)(()=>H?._id?(0,l.Tg)(te,{type:c.y.PORT_FORWARDING,id:H._id}):te,[H?._id,te]),ie=(0,a.useMemo)(()=>{const e=(H?(0,s.Y)(H,ne):[]).find(e=>(0,l.GP)(oe,e,ae));return e?(0,l.GP)(oe,e,ae):null},[oe,H,ae,ne]),le=(0,a.useMemo)(()=>((e,t,n)=>b.Ik({name:b.Yj({message:(0,U.rn)("COMMON_VALIDATION_NAME_REQUIRED")}).min(1,{message:(0,U.rn)("COMMON_VALIDATION_NAME_REQUIRED")}).max(64),interface_port:W.C,source:z,forward_ip:x.B,forward_port:W.C,protocol:b.fc($.do),logging_enabled:b.zM().optional().transform(e=>e??!1),interface:b.fc($.ep).optional().transform(e=>e||$.ep.ALL),interface_ips:b.g1(b.fc($.ep),b.KC([x.B,b.eu(V.U)]).optional())}).refine(e=>!(K(e.forward_port)||K(e.interface_port))||e.forward_port.trim()===e.interface_port.trim(),{path:["forward_port"],message:(0,U.rn)("SETTINGS_INTERNET_GENERAL_ADV_GW_PORT_FORWARD_VALIDATION_INCORRECT_MULTIPORT_FWD_PORT")}).superRefine((r,a)=>{const o=j(r,t).flatMap(t=>{const r=(0,l.GP)(e,t,n);return r?{ownPort:t,conflict:r}:[]})[0];if(o){const e=(0,l.gG)(o.conflict.range),t=(0,l.gG)(o.ownPort.range);a.addIssue({code:F.eq.custom,message:(0,U.rn)(e===t?"SETTINGS_PORT_CONFLICT_VALIDATION_SAME_PORT":"SETTINGS_PORT_CONFLICT_VALIDATION",{otherPorts:e,otherName:o.conflict.usedBy.name,ownPorts:t}),path:["interface_port"]})}}))(oe,ne,ae),[oe,ae,ne]),ce=(0,p.m)({schema:le,defaultValues:q(H,n)});(0,i.y)(ce);const se=ce.handleSubmit(e=>X((0,g.oU)(((e,t,n)=>({enabled:!0,...e,name:t.name,pfwd_interface:t.interface,destination_ip:(0,B.xs)(t.interface)?void 0:t.interface_ips[t.interface||$.ep.WAN]||V.U,destination_ips:(0,B.xs)(t.interface)?n.flatMap(e=>{const n=(0,ht.qV)(e.wan_networkgroup);return(0,B._4)(e)&&e.wan_networkgroup&&n?[{interface:n,destination_ip:t.interface_ips[n]||V.U}]:[]}):[],dst_port:t.interface_port,fwd:t.forward_ip,fwd_port:t.forward_port,proto:t.protocol,src:t.source.type===Y.I.LIMITED&&t.source.value.type===Y.y.SPECIFIC?t.source.value.ip:void 0,src_firewall_group_id:t.source.type===Y.I.LIMITED&&t.source.value.type===Y.y.LIST?t.source.value.object_id:void 0,src_limiting_enabled:t.source.type!==Y.I.ANY,src_limiting_type:t.source.type===Y.I.LIMITED&&t.source.value.type===Y.y.LIST?$.sp.FIREWALL_GROUP:t.source.type===Y.I.LIMITED&&t.source.value.type===Y.y.SPECIFIC?$.sp.IP:void 0,log:t.logging_enabled}))(H,e,Q))).then(async e=>(await X((0,g.Go)(void 0,{resolveWithExisting:!1})),X((0,D.fn)(void 0,{resolveWithExisting:!1})),e)).then(e=>{X((0,N.SQ)(!1)),X((0,N.XP)({type:A.H.PORT_FORWARDING_POLICY,id:e?._id??e?.data?.[0]?._id}))}).then(()=>ce.reset()));(0,a.useEffect)(()=>{X((0,w.Ic)(void 0,{crudCacheStrategy:{type:o.e.CACHE}})),X((0,w.$3)(void 0,{crudCacheStrategy:{type:o.e.CACHE}})),X((0,L.$O)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}))},[X]);const me=`port-forward-form-${H?._id||"new"}`;return a.createElement("form",{onSubmit:se,id:me},a.createElement(E.A,{isDisabled:J},a.createElement(R.A,{gap:I.Ln,flexDirection:"column",width:"100%"},a.createElement(T.A,null,t,Z?a.createElement(O.A,{feature:"COMMON_PORT_FORWARDING"}):null,a.createElement(d.A,{control:ce.control,name:"name",label:a.createElement(C.sA,{id:"COMMON_NAME"}),onChange:(e,t)=>{t.onChange(e),k(e.target.value)}})),a.createElement(T.A,null,ee?a.createElement(we,{form:ce}):null,ee?a.createElement(Ne,{form:ce}):null,a.createElement(re,{form:ce}),a.createElement(Fe,{form:ce}),a.createElement(St,{form:ce}),a.createElement(We,{form:ce}),a.createElement(Pe,{form:ce})),a.createElement(T.A,null,a.createElement(f.A,null,a.createElement(u.A,{control:ce.control,name:"logging_enabled",tooltip:a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_SYSLOG_LOGGING_TOOLTIP"})},a.createElement(C.sA,{id:"COMMON_SYSLOG_LOGGING"})))),H?a.createElement(_.A,{enabled:H.enabled,name:H.name,onPause:async()=>{await X((0,g.oU)({...H,enabled:!1})),await X((0,g.Go)()),await X((0,S.o)())},onResume:async()=>{await X((0,g.oU)({...H,enabled:!0})),await X((0,g.Go)()),await X((0,S.o)())},resumeDisabledReason:ie?a.createElement(C.sA,{id:"SETTINGS_ROUTING_PORT_FORWARDING_RESUME_DISABLED_TOOLTIP",values:{name:ie?.usedBy.name}}):void 0,onRemove:async()=>{await X((0,g.Bc)(H)),await X((0,g.Go)()),await X((0,S.o)())}}):null),a.createElement(y.A,{onFormCancel:()=>ce.reset(),isDirty:ce.formState.isDirty||!H,hideCancelButton:!ce.formState.isDirty,submitButtonText:H?void 0:"COMMON_ACTION_ADD",form:me,isSubmitting:ce.formState.isSubmitting})))}},878237:(e,t,n)=>{n.d(t,{A:()=>d});var r,a=n(296540),o=n(758649),i=n(71479),l=n(825032);!function(e){e.DEFAULT="default",e.HOVER="hover",e.DISABLED="disabled",e.ACTIVE="active"}(r||(r={}));const c={[r.DEFAULT]:{[l.S.LIGHT]:"#d6d9e2",[l.S.DARK]:"#3f3f3f"},[r.HOVER]:{[l.S.LIGHT]:"#7e8190",[l.S.DARK]:"#9d9d9d"},[r.DISABLED]:{[l.S.LIGHT]:"#eeeff3",[l.S.DARK]:"#1e1e1e"},[r.ACTIVE]:{[l.S.LIGHT]:"#a4a7b5",[l.S.DARK]:"#2f2f2f"}},s=(e,t)=>c[t][e],m=(e,t)=>`1px 0px 0px 0px ${s(e,t)}`,_=(0,i.A)(o.A,{shouldForwardProp:e=>"rotate"!==e})`
  margin: 0;
  padding: 0;
  width: 26px;
  height: 24px;
  color: inherit;
  background-color: transparent;
  box-sizing: border-box;
  border-radius: 4px 0 0 4px;
  border-right: 0;
  border-color: transparent;
  border-color: ${({theme:{themeName:e}})=>`${s(e,r.DEFAULT)}`};
  box-shadow: ${({theme:{themeName:e}})=>`${m(e,r.DEFAULT)}`};
  ${({rotate:e=!1})=>e?"\n    transform: rotate(-180deg);\n  ":"\n  position: relative; \n  left: -1px;\n  margin-left: 1px;\n    "}
  > span {
    display: flex;
    align-items: center;
    justify-content: center;
    > div {
      display: flex;
    }
  }
  &:disabled {
    z-index: 0;
    box-shadow: ${({theme:{themeName:e}})=>`${m(e,r.DISABLED)} !important`};
    border-color: ${({theme:{themeName:e}})=>`${s(e,r.DISABLED)} !important`};
  }
  &:hover {
    z-index: 1;
    box-shadow: ${({theme:{themeName:e}})=>`${m(e,r.HOVER)} !important`};
    border-color: ${({theme:{themeName:e}})=>`${s(e,r.HOVER)} !important`};
    border-right: 0;
    background-color: transparent !important;
  }
  &:active {
    box-shadow: ${({theme:{themeName:e}})=>`${m(e,r.ACTIVE)} !important`};
    border-color: ${({theme:{themeName:e}})=>`${s(e,r.ACTIVE)} !important`};
  }
`,d=({disabled:e,onClick:t,rotate:n})=>a.createElement(_,{variant:"secondary",rotate:n,disabled:e,onClick:t,type:"button"},a.createElement("svg",{width:"4",height:"8",viewBox:"0 0 4 8",fill:"none"},a.createElement("path",{d:"M3.75026 0.999386C3.75026 1.11739 3.70826 1.23639 3.62426 1.33138L1.25026 3.99939L1.27026 4.02039L3.62326 6.66739C3.80726 6.87339 3.78826 7.18939 3.58226 7.37339C3.37626 7.55739 3.06026 7.53839 2.87626 7.33239L0.530256 4.69439C0.156256 4.30739 0.156256 3.69139 0.530256 3.30439L2.87526 0.667385C3.05826 0.461386 3.37526 0.442385 3.58126 0.626385C3.69326 0.724385 3.75026 0.861386 3.75026 0.999386Z",fill:"#A4A7B5"})))},879275:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(296540),a=n(395812),o=n(703447),i=n(691294);const l=({client:e})=>{switch(e.type){case i.sK.VPN:return r.createElement(a.A,{type:"vpn"});case i.sK.TELEPORT:return r.createElement(a.A,{type:"teleport"});case i.sK.WIRED:case i.sK.WIRELESS:default:return r.createElement(o.A,{client:e,alt:e.name})}}},905410:(e,t,n)=>{n.d(t,{A:()=>A});var r=n(469733),a=n(296540),o=n(217439),i=n(362412),l=n(566723),c=n(294303),s=n(699784),m=n(200826),_=n(789768),d=n(878237),u=n(860765);const E=(0,n(71479).A)("div")`
  overflow: auto;
  width: 100%;
  height: 100%;
`,p=({onRenderTable:e,itemCount:t,section:n="COMMON_RECORDS",rowOptions:p,onRowsChanged:A,onPageChanged:I,onOffsetChanged:O,tableType:T,pageNumber:f,paginationFlexProps:R={},paginationDropdownProps:N={},unknownCount:C=!1,paginationTableContainerClassName:S})=>{const g=(0,r.useDispatch)(),h=(0,a.useMemo)(()=>p||u.o,[p]),P=(0,a.useMemo)(()=>h.map(({value:e})=>({label:String(e),value:e})),[h]),M=(0,m.A)(T),D=(0,a.useMemo)(()=>Number(M?.rowsPerPage&&P.some(({value:e})=>Number(e)===M.rowsPerPage)?M.rowsPerPage:h.find(e=>e?.default)?.value||h?.[0]?.value),[M,P,h]),L=(0,a.useMemo)(()=>Math.max(u.B,f||u.B),[f]),v=(0,a.useCallback)(e=>{I?.(e)},[I]),w=(0,a.useCallback)(()=>{v(L-1)},[L,v]),G=(0,a.useCallback)(()=>{v(L+1)},[L,v]),y=(0,a.useCallback)(({value:e})=>{const t=Number(e);g((0,_.yT)(T,{rowsPerPage:t})),A?.(t)},[g,A,T]),b=(0,a.useMemo)(()=>{let e=L*D;return e>t&&(e=t-D,v(Math.ceil(Math.ceil(e)/D))),e},[v,L,D,t]),F=(0,a.useMemo)(()=>{let e=b+D;return e>=t&&(e=t),e},[b,D,t]),W=(0,a.useMemo)(()=>{const e={pageNumber:f,from:b,rowsPerPage:D};return O?.(e),e},[f,b,D,O]),k=(0,a.useMemo)(()=>L===u.B,[L]),x=(0,a.useMemo)(()=>F>=t,[F,t]);return a.createElement(a.Fragment,null,a.createElement(E,{className:S},e(W)),a.createElement(c.A,{justifyContent:"space-between",...R},void 0!==b&&void 0!==F&&void 0!==t?a.createElement(c.A,{alignItems:"center"},a.createElement(c.A,null,a.createElement(d.A,{disabled:k,onClick:w}),a.createElement(d.A,{disabled:x,rotate:!0,onClick:G})),a.createElement(c.A,{marginLeft:l.kc,marginRight:l.S2},a.createElement(o.A,{size:"small",color:"text-2"},a.createElement(s.sA,{id:"PAGINATION_FROM_TO",values:{from:b+1,to:F,total:`${t}${C?"+":""}`,section:a.createElement(s.sA,{id:n})}}))),P.length>1?a.createElement(c.A,{alignItems:"center"},a.createElement(c.A,{marginRight:l.kc},a.createElement(o.A,{size:"small",color:"text-2"},a.createElement(s.sA,{id:"PAGINATION_ROWS_PER_PAGE"}))),a.createElement("div",{style:{width:"75px"}},a.createElement(i.A.Sorted,{value:D,options:P,onChange:y,variant:"secondary",direction:"top",width:"100%",portal:!0,...N}))):null):null))},A=({itemCount:e,rowOptions:t,onRenderTable:n,wrapperFlexProps:r,paginationTableContainerClassName:o,keepPaginationWhileLoading:i=!1,...s})=>{const m=(0,a.useMemo)(()=>e>Math.min(...(t||u.o).map(({value:e})=>e)),[e,t]);return a.createElement(c.A,{padding:l.Ln,gap:l.Ln,width:"100%",height:"100%",flexDirection:"column",overflow:"hidden",...r},i||m?a.createElement(p,{itemCount:e,rowOptions:t,onRenderTable:n,wrapperFlexProps:r,paginationTableContainerClassName:o,...s}):a.createElement(E,{className:o},n({pageNumber:0,from:0,rowsPerPage:e})))}}}]);