"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[11478],{411478(e,t,n){n.r(t),n.d(t,{default:()=>ge});var l=n(296540),a=n(469733),r=n(720903),o=n(349785),c=n(614476),i=n(162420),m=n(79786),s=n(943390),u=n(641777),d=n(602021),A=n(294303),E=n(689965),p=n(242366),_=n(566723),b=n(329109),O=n(171073),g=n(566425),I=n(659833),C=n(675359),h=n(742920),f=n(953141),S=n(916537),N=n(263130),M=n(48925),T=n(491190),v=n(366247),y=n(901502),R=n(53182),w=n(263963),x=n(183615);const V=c.Ay.object({name:c.Ay.string().min(1,{message:(0,w.rn)("COMMON_VALIDATION_SIZE_RANGE",{min:1,max:128})}).max(128,{message:(0,w.rn)("COMMON_VALIDATION_SIZE_RANGE",{min:1,max:128})}),channel:c.Ay.number(),enabled:c.Ay.boolean()}),D=c.Ay.discriminatedUnion("role",[c.Ay.object({role:c.Ay.literal(s.cX.HOST),source:c.Ay.nativeEnum(s.uC),phantom_power:c.Ay.boolean()}).merge(V),c.Ay.object({role:c.Ay.literal(s.cX.CLIENT),dst:c.Ay.nativeEnum(s.lv),gain:c.Ay.number().min(x.C7).max(x.iS),muted:c.Ay.boolean(),phantom_power:c.Ay.boolean(),equalizer_enabled:c.Ay.boolean().default(!1),equalizer_settings:c.Ay.array(c.Ay.number().min(-12).max(12)).length(10)}).merge(V)]);var L=n(895424);const k=({form:e})=>l.createElement(L.A,{control:e.control,name:"name",label:l.createElement(S.sA,{id:"COMMON_NAME"})});var P=n(100946),F=n(349665),z=n(284428),U=n(317672),H=n(454195),$=n(573531);const q=({form:e})=>{const t=(0,z.mQ)();return l.createElement(F.A,null,l.createElement(o.xI,{control:e.control,name:"gain",render:({field:e})=>l.createElement(A.A,{height:H.b,justifyContent:"center",width:"100%",flexDirection:"column"},l.createElement(P.A,{value:e.value??x.BL,minValue:x.C7,maxValue:x.iS,step:1,onChange:t=>e.onChange(t),isDisabled:t,labelEnd:l.createElement(l.Fragment,null,e.value||$.L),label:l.createElement(U.A,null,l.createElement(S.sA,{id:"COMMON_VOLUME"}))}))}))};var B=n(821580),G=n(897502);const X=({form:e})=>l.createElement(F.A,null,l.createElement(B.A,null,l.createElement(G.A,{control:e.control,name:"phantom_power"},l.createElement(S.sA,{id:"PRO_AV_PHANTOM_POWER"}))));var Y=n(592563),j=n(813040);const Q=({form:e,onClick:t})=>{const n=(0,o.FH)({control:e.control,name:"muted"}),a=(0,z.mQ)();return l.createElement(j.A,null,l.createElement(Y.A,{type:"button",variant:"emphasis",onPress:t,fontSize:"medium",isDisabled:a},l.createElement(S.sA,{id:n?"PRO_AV_UNMUTE":"PRO_AV_MUTE"})))},Z=({form:e,onClick:t})=>{const n=(0,o.FH)({control:e.control,name:"enabled"}),a=(0,z.mQ)();return l.createElement(j.A,null,l.createElement(Y.A,{type:"button",variant:n?"destructive":"emphasis",onPress:t,fontSize:"medium",isDisabled:a},l.createElement(S.sA,{id:n?"COMMON_ACTION_DISABLE":"COMMON_ACTION_ENABLE"})))};var K=n(553432),J=n(610356);const W=({form:e})=>l.createElement(F.A,null,l.createElement(U.A,null,l.createElement(S.sA,{id:"COMMON_DESTINATION"})),l.createElement(K.A,null,l.createElement(J.A,{control:e.control,name:"dst",value:s.lv.HDMI},l.createElement(S.sA,{id:"COMMON_HDMI"})),l.createElement(J.A,{control:e.control,name:"dst",value:s.lv.XLR},l.createElement(S.sA,{id:"COMMON_XLR"})))),ee=({form:e})=>l.createElement(F.A,null,l.createElement(U.A,null,l.createElement(S.sA,{id:"COMMON_SOURCE"})),l.createElement(K.A,null,l.createElement(J.A,{control:e.control,name:"source",value:s.uC.LINE_IN},l.createElement(S.sA,{id:"PRO_AV_LINE_IN"})),l.createElement(J.A,{control:e.control,name:"source",value:s.uC.HDMI},l.createElement(S.sA,{id:"COMMON_HDMI"})),l.createElement(J.A,{control:e.control,name:"source",value:s.uC.MICROPHONE},l.createElement(S.sA,{id:"PRO_AV_MICROPHONE"}))));var te,ne=n(604838),le=n(632515),ae=n(456977),re=n(225777),oe=n(259380),ce=n(439969),ie=n(217439);!function(e){e.CUSTOM="custom",e.MUSIC="music",e.MOVIE="movie",e.NIGHT="night"}(te||(te={}));const me={[te.CUSTOM]:[0,0,0,0,0,0,0,0,0,0],[te.MUSIC]:[4,5,3,-2,-1,0,2,3,4,3],[te.MOVIE]:[6,5,2,-1,0,3,4,3,2,1],[te.NIGHT]:[-6,-4,-2,0,2,3,4,2,-2,-4]},se=[{value:-12},{value:-6},{value:0},{value:6},{value:12}],ue=[{color:"#945AE6",label:"31.5"},{color:"#7469EC",label:"63"},{color:"#5479F1",label:"125"},{color:"#3289F7",label:"250"},{color:"#1199FD",label:"500"},{color:"#019CFF",label:"1K"},{color:"#0191FF",label:"2K"},{color:"#0188FF",label:"4K"},{color:"#017EFF",label:"8K"},{color:"#0174FF",label:"16K"}];var de=n(71479),Ae=n(822336),Ee=n(311785);const pe=(0,de.A)(A.A,(0,Ee.A)("color"))`
  align-items: center;
  max-height: 150px;
  width: 25px;

  [data-uic-component='Slider.InputContainer'] {
    width: 14px;
    padding-top: ${_.YC};
  }

  [data-uic-component='Slider.ThumbIcon'] {
    border-color: ${({theme:{themeName:e}})=>Ae.Ay[`desktop-color-neutral-00-${e}`]} !important;
  }

  [data-uic-component='Slider.MarkShape'] {
    background-color: ${({theme:{themeName:e}})=>Ae.Ay[`desktop-color-neutral-01-${e}`]} !important;
  }

  [data-uic-component='Slider.ValueMark'] {
    background-color: transparent;
  }

  [data-uic-component='Slider.Mark'][data-position='end'] {
    margin-bottom: -${_.YC};
  }

  [data-uic-component='Slider.Mark'][data-position='start'] {
    margin-bottom: ${_.YC};
  }
  [data-uic-component='Slider.ThumbIcon'] {
    background-color: ${({color:e})=>e};
  }
`,_e=({form:e})=>{const t=(0,o.FH)({control:e.control,name:"equalizer_settings"}),n=(0,l.useCallback)((n,l)=>{e.setValue("equalizer_settings",t.map((e,t)=>t===n?l:e))},[e,t]);return l.createElement(A.A,{flexDirection:"column",gap:_.kc},l.createElement(A.A,{flexDirection:"row",width:"100%",justifyContent:"space-between"},l.createElement(ie.A,{size:"small",color:"text-3",style:{width:"40px"}},l.createElement(S.sA,{id:"PRO_AV_BASS"})),l.createElement(ie.A,{size:"small",color:"text-3",style:{width:"40px",textAlign:"center"}},l.createElement(S.sA,{id:"PRO_AV_MID"})),l.createElement(ie.A,{size:"small",color:"text-3",style:{width:"40px"}},l.createElement(S.sA,{id:"PRO_AV_TREBLE"}))),l.createElement(A.A,{flexDirection:"row",width:"100%",justifyContent:"space-between"},t.map((e,t)=>l.createElement(pe,{key:t,color:ue[t].color,flexDirection:"column"},l.createElement(ce.A,{minValue:-12,maxValue:12,step:.1,marks:se,value:e,onChange:e=>n(t,e)}),l.createElement(ie.A,{size:"small",color:"text-3"},ue[t].label),l.createElement(ie.A,{size:"xsmall",color:"text-2",weight:"bold"},e)))))},be=[{id:te.CUSTOM,label:l.createElement(S.sA,{id:"COMMON_CUSTOM"}),Symbol:le.A},{id:te.MUSIC,label:l.createElement(S.sA,{id:"COMMON_URL_CATEGORY_MUSIC"}),Symbol:ae.A},{id:te.MOVIE,label:l.createElement(S.sA,{id:"PRO_AV_EQUALIZER_MOVIE"}),Symbol:re.A},{id:te.NIGHT,label:l.createElement(S.sA,{id:"PRO_AV_EQUALIZER_NIGHT"}),Symbol:oe.A}],Oe=({form:e})=>{const[t,n]=(0,l.useState)(new Set([te.CUSTOM])),a=(0,o.FH)({control:e.control,name:"equalizer_enabled"}),r=(0,l.useCallback)(t=>{n(new Set([t])),e.setValue("equalizer_settings",me[t])},[e]);return l.createElement(A.A,{flexDirection:"column",gap:_.Ln,width:"100%"},l.createElement(G.A,{control:e.control,name:"equalizer_enabled",tooltip:l.createElement(S.sA,{id:"PRO_AV_EQUALIZER_DESCRIPTION"})},l.createElement(S.sA,{id:"PRO_AV_EQUALIZER"})),a?l.createElement(l.Fragment,null,l.createElement(ne.A,{width:"full",size:"medium",onTabSelect:r,selectedTabs:t,tabs:be}),l.createElement(_e,{form:e})):null)},ge=({activeItem:e})=>{const[t]=(0,T.V)("displayEqualizerSettings",!1,c.Ay.boolean()),n=(0,a.useSelector)(I.kn),w=(0,a.useDispatch)(),V=(0,a.useSelector)(v.Iz),L=(0,a.useSelector)(I.Ep),P=(0,l.useMemo)(()=>n.groups.find(t=>t.id===e.groupId),[e.groupId,n.groups]),F=(0,l.useMemo)(()=>L.find(t=>t.mac===e.mac),[L,e.mac]),z=V.length>1,U=(0,l.useMemo)(()=>({name:e?.name||"",channel:e?.channel,enabled:e?.enabled??!0,role:e?.role,type:e.type,gain:e.gain,muted:e.muted,phantom_power:e.phantom_power,source:e.source,dst:e.dst,equalizer_enabled:e.equalizer_enabled||!1,equalizer_settings:e.equalizer_settings||me[te.CUSTOM]}),[e]),H=(0,a.useSelector)(d.EL),$=(0,m.m)({schema:D,defaultValues:U}),{handleSubmit:B,reset:G}=$,Y=(0,o.lN)($),{isDirty:j,isSubmitting:K}=Y,J=(0,o.FH)({control:$.control,name:"enabled"}),ne=(0,o.FH)({control:$.control,name:"role"}),le=(0,l.useCallback)(()=>{const t=(0,r.A)(P);let n=!1;if(ne===s.cX.HOST)t.host.enabled=!t.host.enabled,n=!0;else{const l=t.clients.find(t=>t.mac===e.mac);l&&(l.enabled=!l.enabled,n=!0)}n&&w((0,g.Cn)(t)).then(()=>{w((0,g.aP)()),w((0,O.pI)(e.mac)),$.reset({...Y.defaultValues,enabled:!J},{keepDirtyValues:!0})}).catch(e=>{w((0,C.ox)({icon:h.C.danger,message:f.API_STRING_TRANSLATION[e.apiMsg]||"PRO_AV_NOTICE_SAVE_ERROR"}))})},[w,P,ne,e.mac,$,Y.defaultValues,J]),ae=(0,l.useCallback)(()=>{const t=(0,r.A)(P);if(ne===s.cX.HOST)return;const n=t.clients.find(t=>t.mac===e.mac);n&&ne===s.cX.CLIENT&&(n.muted=!n.muted,w((0,g.Cn)(t)).then(()=>{w((0,g.aP)()),w((0,O.pI)(e.mac)),$.reset({...Y.defaultValues,muted:n.muted},{keepDirtyValues:!0})}).catch(e=>{w((0,C.ox)({icon:h.C.danger,message:f.API_STRING_TRANSLATION[e.apiMsg]||"PRO_AV_NOTICE_SAVE_ERROR"}))}))},[w,P,ne,e.mac,$,Y.defaultValues]),re=B(async t=>{const n=[];n.push(w((0,O.ex)({name:`${t.name}`},e.deviceId,e.mac,{extend:!0})));const l=(0,r.A)(P);if(z)t.role===s.cX.CLIENT&&(l.clients=l.clients.map(e=>V.includes(e.mac)?{...e,dst:t.dst,gain:t.gain,phantom_power:t.phantom_power}:e));else if(t.role===s.cX.HOST)l.host.phantom_power=t.phantom_power,l.host.source=t.source;else{const n=l.clients.find(t=>t.mac===e.mac);n&&(n.dst=t.dst,n.gain=t.gain,n.phantom_power=t.phantom_power)}n.push(w((0,g.Cn)(l))),Promise.all(n).then(()=>{w((0,g.aP)()),w((0,O.pI)(e.mac)),$.reset(t)}).catch(e=>{w((0,C.ox)({icon:h.C.danger,message:f.API_STRING_TRANSLATION[e.apiMsg]||"PRO_AV_NOTICE_SAVE_ERROR"}))})});return l.createElement("form",{id:x.Oq,onSubmit:re},l.createElement(u.A,{isDisabled:H},l.createElement(A.A,{flexDirection:"column",gap:_.kc},l.createElement(M.A,null,l.createElement(p.A,null,z?l.createElement(R.A,{tableBridges:L,selectedRowIds:V,onSetSelectedRowIds:e=>w((0,y.ur)(e))}):null,z&&F?l.createElement(N.A,{icon:l.createElement(i.A,{isActive:!0,size:"original",variant:"fill"}),description:l.createElement(S.sA,{id:"DEVICE_PORT_FORM_NOTICE_PORT_BATCH_EDIT",values:{portIdx:F.name||e.mac,b:S.b}})}):null,l.createElement(u.A,{isDisabled:z},l.createElement(k,{form:$})))),l.createElement(M.A,null,l.createElement(p.A,null,ne===s.cX.CLIENT?l.createElement(l.Fragment,null,l.createElement(W,{form:$}),l.createElement(q,{form:$}),l.createElement(X,{form:$}),t?l.createElement(Oe,{form:$}):null):l.createElement(l.Fragment,null,l.createElement(ee,{form:$}),l.createElement(X,{form:$})))),l.createElement(E.A,{type:E.I.BUTTON_LIST},ne===s.cX.CLIENT?l.createElement(Q,{form:$,onClick:ae}):null,l.createElement(Z,{form:$,onClick:le}))),l.createElement(b.A,{form:x.Oq,onFormCancel:()=>G(U),isDirty:j||V.length>1,isSubmitting:K,hideCancelButton:!j})))}},821580(e,t,n){n.d(t,{A:()=>c});var l=n(296540),a=n(454195),r=n(566723),o=n(294303);const c=e=>l.createElement(o.A,{paddingTop:r.YC,paddingBottom:r.YC,gap:r.Ln,rowGap:r.YC,flexWrap:"wrap",minHeight:a.b,alignItems:"center",...e})},48925(e,t,n){n.d(t,{A:()=>_});var l=n(822336),a=n(296540),r=n(217439),o=n(71479),c=n(566723),i=n(968906),m=n(199582),s=n(311785),u=n(766624),d=n(294303),A=n(689965),E=n(242366);const p=(0,o.A)(A.A,(0,s.A)("isOutlined"))`
  border: ${({theme:{themeName:e},isOutlined:t})=>`1px solid ${t?l.Ay[`desktop-color-ublue-06-${e}`]:"transparent"}`};
`,_=({children:e,title:t,tooltip:n,tooltipProps:l,[m.L]:o,titleAction:s,isOutlined:A})=>{const _=(e=>a.Children.toArray(e).length>0)(e);return a.createElement(p,{marginBottom:"none",...i.A.addDataTestId(o??""),isOutlined:A},a.createElement(d.A,{flexDirection:"column",..._&&{gap:c.Ln},width:"100%"},t?a.createElement(d.A,{alignItems:"center",gap:c.YC,justifyContent:"space-between",width:"100%"},a.createElement(d.A,{gap:c.YC,alignItems:"center"},a.createElement(r.A,{variant:"heading-medium"},t),n?a.createElement(u.A,{description:n,portal:!0,...l}):null),s?a.createElement(d.A,null,s):null):null,_?a.createElement(E.A,null,e):null))}},252093(e,t,n){n.d(t,{A:()=>c});var l=n(296540),a=n(271856),r=n(162420),o=n(916537);const c=({messageId:e,tooltipClassName:t,values:n,isInteractive:c,portal:i,variant:m="twoTone",size:s="medium"})=>l.createElement(a.A,{description:l.createElement(o.sA,{id:e,values:n}),width:210,isInteractive:c,portal:i,tooltipClassName:t},l.createElement(r.A,{isActive:!0,omitSvgMargin:!0,variant:m,size:s}))},813040(e,t,n){n.d(t,{A:()=>d,R:()=>u});var l=n(296540),a=n(822336),r=n(71479),o=n(180524),c=n(566723),i=n(294303),m=n(252093);const s=(0,r.A)(i.A)`
  flex-direction: column;
  height: ${48}px;
  border-bottom: ${({theme:{themeName:e}})=>a.Ay[`desktop-border-divider-${e}`]};
  padding: ${c.xO} 0;
  position: relative;
  .tooltip-position-fixer {
    margin-right: -${c.Ln};
  }
`,u=({tooltipId:e,disabledTooltip:t,children:n,tooltipProps:a={},...r})=>l.createElement(s,{...r},l.createElement(i.A,{justifyContent:"space-between",alignItems:"center"},l.createElement(o.A,{description:t,placement:"left"},l.createElement("span",null,n)),e?l.createElement(m.A,{messageId:e,tooltipClassName:"tooltip-position-fixer",variant:"outline",...a}):null)),d=u},491190(e,t,n){n.d(t,{V:()=>o});var l=n(296540),a=n(510497);const r=(e,t)=>{try{return e?t.parse(JSON.parse(e)):null}catch{return null}},o=(e,t,n)=>{const[o,c]=(0,l.useState)(()=>a.D.getItem(e)),i=(0,l.useMemo)(()=>r(o,n),[o,n]),m=(0,l.useCallback)(t=>{const l="function"==typeof t?t(r(a.D.getItem(e),n)):t,o=JSON.stringify(l);a.D.setItem(e,o),window.dispatchEvent(new StorageEvent("storage"))},[e,n]);return(0,l.useEffect)(()=>{const t=()=>{c(a.D.getItem(e))};return window.addEventListener("storage",t),()=>{window.removeEventListener("storage",t)}},[e]),[i??t,m]}}}]);