"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[84138],{373229:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(296540),r=n(758649),o=n(71479),i=n(566723),l=n(699784);const m=(0,o.A)("footer",{shouldForwardProp:e=>"hasFormResetButton"!==e})`
  display: flex;
  justify-content: ${({hasFormResetButton:e})=>e?"space-between":"flex-end"};
  padding: ${i.S2} ${i.fS};
  gap: ${i.kc};
`,s=({allowCancel:e,isDirty:t,isInvalid:n,isSubmitting:o,onFormSubmit:i,onFormReset:s,onFormCancel:c,className:d,submitButtonText:p,customButton:E,applyButton:u,applyButtonFirst:A,hideCancelButton:b,form:_})=>{const O=(0,a.useMemo)(()=>u||a.createElement(r.A,{name:"submit",variant:"primary",type:"submit",onClick:i,disabled:!t||n||o,form:_},a.createElement(l.sA,{id:p||"COMMON_ACTION_APPLY_CHANGES"})),[u,_,t,n,o,i,p]);return a.createElement(m,{className:d,hasFormResetButton:!!s},A?O:E,b?null:a.createElement(r.A,{name:"cancel",variant:"default",type:"button",onClick:c,disabled:!e&&!t},a.createElement(l.sA,{id:"COMMON_ACTION_CANCEL"})),s?a.createElement(r.A,{name:"reset",variant:"default",type:"button",onClick:s,disabled:!t},a.createElement(l.sA,{id:"COMMON_ACTION_RESET_TO_DEFAULTS"})):null,A?E:O)}},384138:(e,t,n)=>{n.r(t),n.d(t,{default:()=>S});var a=n(868238),r=n(469733),o=n(951272),i=n(742920),l=n(870443),m=n(960407),s=n(398300),c=n(296540),d=n(927099),p=n(822336),E=n(350312),u=n(71479),A=n(316144),b=n(566723),_=n(373229),O=n(143811),C=n(294303),I=n(845030),R=n(699784),v=n(366188),P=n(780811);const h=(0,u.A)(C.A)`
  position: relative;
  margin: -18px -30px 40px;
  padding-bottom: 12px;
  border-bottom: ${({theme:{themeName:e}})=>p.Ay[`desktop-border-divider-${e}`]};

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