"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[10777],{47115(e,t,n){n.d(t,{LL:()=>o,TG:()=>i});const i=e=>{const{top:t,bottom:n}=e.getBoundingClientRect();return t>=0&&n<=(window.innerHeight||document.documentElement.clientHeight)};function o(e){"function"==typeof e.persist&&e.persist()}},594492(e,t,n){n.d(t,{A:()=>c});var i=n(274934),o=n(602086),s=n(599110),r=n(247816),a=n(309130),l=n(470070),d=n(291508);const m=(0,r.A)("footer",(0,d.A)("hasFormResetButton"))`
  display: flex;
  justify-content: ${({hasFormResetButton:e})=>e?"space-between":"flex-end"};
  padding: ${a.S2} ${a.fS};
  gap: ${a.kc};
`,c=({allowCancel:e,isDirty:t,isInvalid:n,isSubmitting:r,onFormSubmit:a,onFormReset:d,onFormCancel:c,className:p,submitButtonText:u,customButton:A,applyButton:x,applyButtonFirst:b,hideCancelButton:_,form:h})=>{const E=(0,o.useMemo)(()=>x||(0,i.jsx)(s.A,{name:"submit",variant:"primary",type:"submit",onClick:a,disabled:!t||n||r,form:h,children:(0,i.jsx)(l.sA,{id:u||"COMMON_ACTION_APPLY_CHANGES"})}),[x,h,t,n,r,a,u]);return(0,i.jsxs)(m,{className:p,hasFormResetButton:!!d,children:[b?E:A,_?null:(0,i.jsx)(s.A,{name:"cancel",variant:"default",type:"button",onClick:c,disabled:!e&&!t,children:(0,i.jsx)(l.sA,{id:"COMMON_ACTION_CANCEL"})}),d?(0,i.jsx)(s.A,{name:"reset",variant:"default",type:"button",onClick:d,disabled:!t,children:(0,i.jsx)(l.sA,{id:"COMMON_ACTION_RESET_TO_DEFAULT"})}):null,b?A:E]})}},269439(e,t,n){n.r(t),n.d(t,{default:()=>N});var i=n(418398),o=n(977872),s=n(843871),r=n(159469),a=n(950804),l=n(254585),d=n(449339),m=n(274934),c=n(602086),p=n(938984),u=n(814557),A=n(856639),x=n(247816),b=n(51411),_=n(309130),h=n(594492),E=n(120197),C=n(100978),O=n(205521),I=n(470070),R=n(197571),f=n(956978);const g=(0,x.A)(C.A)`
  position: relative;
  margin: -18px -30px 40px;
  padding-bottom: 12px;
  border-bottom: ${({theme:{themeName:e}})=>u.Ay[`desktop-border-divider-${e}`]};

  svg {
    position: absolute;
    left: 24px;
  }
`,j=(0,x.A)(p.A)`
  width: 100%;
  text-align: center;
`,v=(0,x.A)(C.A)`
  width: 100%;
  padding: 30px;
`,P=(0,x.A)(p.A)`
  margin-bottom: ${({theme:{spacing:e}})=>e["spacing-s"]};
`;var T=n(795206);const y=(0,s.bk)({enableReinitialize:!0,mapPropsToValues:({port:e})=>{const{nameOverride:t,enable:n}=e;return{name:t,enable:n??!0}},validationSchema:a.A.object().shape({enable:a.A.boolean(),name:a.A.string()}),handleSubmit:(e,{props:{activeItem:{_id:t,port_overrides:n,mac:i},port:o,updateDeviceWithIdEndpoint:s,intl:{formatMessage:a},propertyPanelActiveItemTab:l,showPropertyPanel:m}})=>{s({port_overrides:[...n?.filter(({port_idx:e})=>e!==o.portIdx)||[],{port_idx:o.portIdx,...e}]},t,i,{failureToast:{icon:r.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR",values:{section:a({id:"DEVICE_PROPERTY_HEADER_PORTS"})}},mergeAndOverrideKeys:["port_overrides"],extend:!0}).then(()=>m({type:d.H.DEVICE,id:i,tab:l}))}}),N=(0,i.Zz)(I.j4,(0,o.Ng)((e,{activeItem:t})=>({port:(0,f.NF$)(+((0,l.Oh)(e)?.replaceAll(/\D/g,"")||0)+1,t),propertyPanelActiveItemTab:(0,l.oI)(e)}),{updateDeviceWithIdEndpoint:T.ex,showPropertyPanel:O.XP}),y)(({activeItem:e,activeItem:{mac:t,model:n},port:i,submitForm:s,resetForm:r,dirty:a})=>{const u=(0,o.wA)(),x=(0,o.d4)(l.oI),T=(0,o.d4)(R.LV),y=(0,b.nL)(i.ifname,e,T),N=(0,c.useMemo)(()=>(0,f.KKO)(n,"poe"),[n]),D=(0,c.useCallback)(()=>{r(),u((0,O.XP)({type:d.H.DEVICE,id:t,tab:x}))},[r,u,x,t]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(v,{flexDirection:"column",flex:"1 1 85%",children:[(0,m.jsxs)(g,{alignItems:"center",children:[(0,m.jsx)(A.A,{onClick:D,style:{cursor:"pointer"}}),(0,m.jsx)(j,{size:"medium",weight:"bold",children:(0,m.jsx)(I.sA,{id:"DEVICE_PROPERTIES_PORT_WITH_NUMBER_AND_NETWORK_GROUP",values:{port:i.portIdx,networkGroup:y?.label}})})]}),(0,m.jsx)(C.A,{marginBottom:_.S2,children:(0,m.jsx)(E.A,{label:"COMMON_NAME",full:!0,name:"name"})}),N?(0,m.jsxs)(C.A,{marginBottom:_.S2,children:[(0,m.jsxs)(C.A,{flexDirection:"column",flex:1,children:[(0,m.jsx)(P,{size:"medium",children:(0,m.jsx)(I.sA,{id:"DEVICE_PORT_FORM_PORT_POWER_LABEL"})}),(0,m.jsx)(p.A,{color:"text-3",size:"medium",children:(0,m.jsx)(I.sA,{id:"DEVICE_PORT_FORM_PORT_POWER_DESCRIPTION"})})]}),(0,m.jsx)(E.A,{name:"enable",type:"checkbox"})]}):null]}),(0,m.jsx)(h.A,{isDirty:a,onFormSubmit:s,onFormCancel:D,allowCancel:!0})]})})}}]);