"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[10916],{17441:(e,t,l)=>{l.d(t,{A:()=>o});var n=l(296540),a=l(713769),r=l(264863);const o=({children:e})=>n.createElement(r.A,null,n.createElement(a.y,null,e))},79786:(e,t,l)=>{l.d(t,{m:()=>s});var n=l(349785),a=l(296540),r=l(59116),o=l(870893);function s({schema:e,defaultValues:t,presets:l}){const s=(0,a.useMemo)(()=>l?(0,r.A)(l,e=>e.defaultValues):{},[l]),i=(0,a.useMemo)(()=>({...t,...s}),[s,t]),c=(0,n.mN)({resolver:(0,o.u)(e),shouldFocusError:!0,defaultValues:i,shouldUseNativeValidation:!1,mode:"onTouched"}),m=(0,a.useRef)(i);m.current=i;const u=(0,a.useCallback)((...e)=>{const[t,...l]=e;return c.reset(t?{...t,...s}:m.current,...l)},[s,c]);return{...c,reset:u,formState:{...c.formState,isDirty:!!Object.keys(c.formState.dirtyFields).length,isSubmitting:c.formState.isSubmitting},handleSubmit:(...e)=>c.handleSubmit(e[0],(t,...l)=>{const n=Object.keys(t)[0];if(n)try{const e=document.getElementsByName(n)?.[0];e?.scrollIntoView?.({behavior:"smooth",block:"center"}),e?.focus?.({preventScroll:!0})}catch{}e[1]?.(t,...l)})}}},263963:(e,t,l)=>{l.d(t,{L_:()=>m,MS:()=>c,rn:()=>i});var n=l(117958),a=l(215616),r=l(296540),o=l(699784);const s="{::}",i=(e,t)=>`${e}${s}${JSON.stringify(t??{})}`,c=(e,t)=>{if("string"!=typeof t)return;const[l,...n]=t.split(s);if(!l||!n.length)return t;let a={};try{a=Object.fromEntries(Object.entries(JSON.parse(n.join(s))).map(([t,l])=>[t,"string"==typeof l?c(e,l):l]))}catch{0}return e.formatMessage({id:l},a)};function m(){const{formatMessage:e}=(0,o.tz)();return(0,r.useCallback)(t=>c({formatMessage:e},t),[e])}n.pJ((e,t)=>e.message?{message:e.message}:e.code===a.eq.too_small&&"string"===e.type?{message:i("COMMON_MIN_CHARS",{min:Number(e.minimum)})}:e.code===a.eq.too_big&&"string"===e.type?{message:i("COMMON_MAX_CHARS",{name:i("COMMON_VALUE"),max:Number(e.maximum)})}:e.code===a.eq.invalid_type&&"array"===e.expected&&"undefined"===e.received?{message:i("COMMON_SELECT_AT_LEAST_ONE_ITEM")}:e.code===a.eq.too_small&&"array"===e.type?{message:i("COMMON_ADD_AT_LEAST_X_ITEMS",{min:Number(e.minimum)})}:e.code===a.eq.invalid_type&&"undefined"===e.received?{message:i("COMMON_VALIDATION_VALUE_REQUIRED")}:e.code===a.eq.invalid_type&&"number"===e.expected?{message:i("COMMON_VALIDATION_PLEASE_ENTER_A_NUMBER")}:{message:t.defaultError})},264863:(e,t,l)=>{l.d(t,{A:()=>s});var n=l(296540),a=l(113851),r=l(362584),o=l(528552);const s=({children:e})=>{const{[r.A.IS_MAXIMIZED]:t}=(0,n.useContext)(o.A);return n.createElement(a.A,{isHidden:t},e)}},312583:(e,t,l)=>{l.d(t,{A:()=>f});var n=l(469733),a=l(296540),r=l(429252),o=l.n(r),s=l(217439),i=l(592563),c=l(249304),m=l(77247),u=l(684342),E=l(225269),A=l(580176),d=l(699784),C=l(198494),_=l(200826),O=l(305988),b=l(789768),p=l(67716),M=l(518089);const f=({leftFilterPageId:e,...t})=>{const l=(0,n.useDispatch)(),r=(0,a.useRef)(null),f=(0,m.A)(r),g=u.l[t.tableType],N=Boolean(g),T=(0,_.A)(t.tableType),y=(0,n.useSelector)(C.Bm),S=(0,a.useCallback)(()=>{const e=O.W2.tables?.[t.tableType],n=[...e?.initialColumns||[]],a=e?.columnOrder,r={[t.tableType]:{initialColumns:n,...a?{columnOrder:a}:{},initialColumnSnapshot:n.reduce((e,t)=>(e[String(t)]=!0,e),{...e?.initialColumnSnapshot||{}})}};N&&(r[t.tableType].columnSize=g,t.tableType===c.l.UNIFI_DEVICE&&u.t.forEach(e=>{r[e]={columnSize:g}})),l((0,b.zF)(r))},[l,t.tableType,N,g]),h=(0,a.useCallback)(()=>{l((0,A.Zi)(e))},[l,e]),I=(0,a.useMemo)(()=>{const e=o()([...O.W2.tables?.[t.tableType]?.initialColumns||[]].sort(),[...T?.initialColumns||[]].sort()),l=o()(O.W2.tables?.[t.tableType]?.columnOrder,T?.columnOrder);if(N){let n=!T?.columnSize||o()(g,T?.columnSize);if(t.tableType===c.l.UNIFI_DEVICE){const e=u.t.every(e=>!y[e]?.columnSize||o()(g,y[e]?.columnSize));n=n&&e}return e&&l&&n}return e&&l},[t.tableType,T,N,y,g]);return a.createElement(M.CW,{hasOverflow:f},a.createElement(M.kp,{ref:r},a.createElement(s.A,{size:"small",color:"text-1"},a.createElement(d.sA,{id:"COMMON_CUSTOMIZE_COLUMNS"})),a.createElement(E.A,{...t}),a.createElement(M.Ot,null,a.createElement(p.d$,null),a.createElement(i.A,{type:"button",onPress:S,isDisabled:I},a.createElement(s.A,{size:"medium",color:"inherit"},a.createElement(d.sA,{id:"COMMON_ACTION_RESTORE"}))),a.createElement(i.A,{type:"button",onPress:h},a.createElement(s.A,{size:"medium",color:"inherit"},a.createElement(d.sA,{id:"COMMON_ACTION_DONE"}))))))}},713769:(e,t,l)=>{l.d(t,{y:()=>o});var n=l(71479),a=l(566723),r=l(294303);const o=(0,n.A)(r.A)`
  flex-direction: column;
  gap: ${a.kc};
  margin: 0 0 ${a.Ln} ${a.kc};
`},893594:(e,t,l)=>{l.d(t,{A:()=>V});var n=l(296540),a=l(582724),r=l(469733),o=l(699784),s=l(726743),i=l(592563),c=l(71479),m=l(566723),u=l(294303);const E=(0,c.A)(u.A)`
  margin: ${m.YC} 0 0 ${m.kc};
  gap: ${m.kc};
  > button {
    width: fit-content;
  }
`,A=({isEditorAvailable:e,footerActions:t})=>e?n.createElement(E,null,t.map(({label:e,onPress:t})=>n.createElement(i.A,{key:e.toString(),type:"button",fontSize:"medium",onPress:t},e))):null;var d=l(472807),C=l(874098),_=l(217439),O=l(156870),b=l(445535),p=l(906619);const M="TAGS_CREATOR_CONFIGURE_BUTTON_CLASSNAME",f=(0,c.A)("div")`
  .${M} {
    display: none;
  }
  [data-uic-component='Tree.Item']:hover {
    .${M} {
      display: block;
    }
  }
`,g=(0,c.A)(u.A)`
  align-items: center;
  gap: ${m.YC};
`,N=({leftFilterPanelId:e,items:t,selectedKeys:l,disabledKeys:a,onSelectionChange:r,onSelectAll:s,onDeselectAll:i,labelId:c,labelBubbleId:m,initialExpanded:u,children:E})=>n.createElement(f,null,n.createElement(b.A,{id:e,initialExpanded:u,label:n.createElement(g,null,n.createElement(o.sA,{id:c}),m?n.createElement(p.A,null,n.createElement(_.A,{size:"small",color:"ublue-06"},n.createElement(o.sA,{id:m}))):null)},n.createElement(O.A,{id:e,items:t,selectedKeys:l,disabledKeys:a,onSelectionChange:r,onSelectAll:s,onDeselectAll:i}),E));var T=l(709690),y=l(74750),S=l(349785),h=l(79786),I=l(895424),D=l(822336);const R=(0,c.A)(u.A)`
  background: ${({theme:{themeName:e}})=>D.Ay[`desktop-color-neutral-01-${e}`]};
  flex-direction: column;
  gap: ${m.kc};
  padding: ${m.kc};
`,v=(0,c.A)(u.A)`
  align-items: center;
  gap: ${m.YC};
  white-space: nowrap;
`;var P;!function(e){e.NAME="name",e.TAGS="tags"}(P||(P={}));var k=l(407814),L=l(263963);var w=l(986905),z=l(760919);const F=({tagId:e,items:t})=>{const{[z.fP.CREATOR_MODE_HEADER_NEW_ID]:l,[z.fP.CREATOR_MODE_HEADER_EDIT_ID]:a,[z.fP.CREATOR_MODE_NOTICE_ID]:s,[z.fP.CREATOR_MODE_CREATE_ID]:i,[z.fP.CREATOR_MODE_REMOVE_ID]:c,[z.fP.CREATOR_MODE_CREATE_CALLBACK]:m,[z.fP.CREATOR_MODE_UPDATE_CALLBACK]:u,[z.fP.CREATOR_MODE_DELETE_CALLBACK]:E,[z.fP.CREATOR_MODE_CANCEL_CALLBACK]:A}=(0,w.A)(e),d=(0,r.useSelector)(C.B8),O=(0,r.useSelector)(C.Gq),b=(0,r.useSelector)(C.bn),p=(0,n.useMemo)(()=>({[P.NAME]:O||"",[P.TAGS]:d}),[O,d]),M=(0,n.useMemo)(()=>{return e=O,l=t.map(({title:e})=>e),k.Ik({[P.NAME]:k.Yj().refine(e=>e===e.trim(),{message:(0,L.rn)("COMMON_VALIDATION_NO_LEADING_TRAILING_SPACES")}).transform(e=>e.trim()).pipe(k.Yj().min(1).max(32)).refine(t=>!(e?l.filter(t=>t.toLowerCase()!==e.toLowerCase()):l).some(e=>e.toLowerCase()===t.toLowerCase()),{message:(0,L.rn)("COMMON_PLEASE_ENTER_UNIQUE_NAME")}),[P.TAGS]:k.YO(k.Yj())});var e,l},[O,t]),{setValue:f,control:g,formState:N}=(0,h.m)({schema:M,defaultValues:p}),D=(0,S.FH)({control:g,name:P.NAME});(0,n.useEffect)(()=>{f(P.TAGS,d,{shouldDirty:!0,shouldValidate:!0})},[f,d]);const{isValid:F}=(0,S.lN)({control:g}),$=(0,n.useCallback)(()=>{m(D,d)},[m,D,d]),x=(0,n.useCallback)(()=>{u(b,D,d)},[u,b,D,d]),B=(0,n.useCallback)(e=>{E(e)},[E]),V=(0,n.useCallback)(()=>{(b?x:$)()},[b,$,x]),U=(0,n.useCallback)(()=>{B(b)},[B,b]),K=(0,n.useCallback)((e,t,l)=>n.createElement(y.A,{type:"button",width:l,size:"medium",onPress:V,variant:t,isDisabled:!N.isDirty||N.isSubmitting||!F},n.createElement(o.sA,{id:e})),[V,N.isDirty,N.isSubmitting,F]),G=(0,n.useCallback)((e,t)=>n.createElement(y.A,{type:"button",width:t,size:"medium",onPress:A,variant:"secondary-emphasis"},n.createElement(o.sA,{id:e})),[A]),j=(0,n.useCallback)(()=>n.createElement(y.A,{type:"button",width:"full",size:"medium",onPress:A,variant:"tertiary-neutral"},n.createElement(o.sA,{id:"COMMON_ACTION_CANCEL"})),[A]),q=(0,n.useCallback)(()=>n.createElement(y.A,{type:"button",width:"full",size:"medium",onPress:U,variant:"tertiary-destructive"},n.createElement(o.sA,{id:c})),[U,c]);return n.createElement(R,null,n.createElement(_.A,{size:"small",color:"text-1",weight:"bold"},n.createElement(o.sA,{id:b?a:l})),n.createElement(I.A,{control:g,name:P.NAME,label:n.createElement(o.sA,{id:"COMMON_NAME"})}),n.createElement(v,null,n.createElement(T.A,{isActive:!0,size:"original"}),n.createElement(_.A,{size:"small",color:"text-3"},n.createElement(o.sA,{id:s,values:{count:d.length}}))),n.createElement(v,null,b?N.isDirty?n.createElement(n.Fragment,null,K("COMMON_ACTION_SAVE","emphasis",void 0),G("COMMON_CLOSE_EDITOR",void 0)):n.createElement(n.Fragment,null,G("COMMON_CLOSE_EDITOR","full"),q()):n.createElement(n.Fragment,null,K(i,"secondary-emphasis","full"),j())))},$=({onPress:e})=>n.createElement(i.A,{className:M,fontSize:"medium",type:"button",onPress:e},n.createElement(o.sA,{id:"COMMON_CONFIGURE"})),x=({leftFilterPanelId:e,items:t,selectedKeys:l,disabledKeys:a,onSelectionChange:i,onSelectAll:c,onDeselectAll:m,labelId:u,labelBubbleId:E,tagId:_})=>{const O=(0,r.useDispatch)(),{formatMessage:b}=(0,o.tz)(),{[z.fP.CREATOR_MODE_CAN_CREATE]:p,[z.fP.CREATOR_MODE_CAN_DELETE]:M,[z.fP.CREATOR_MODE_CAN_EDIT]:f,[z.fP.CREATOR_MODE_TAG_META_CALLBACK]:g}=(0,w.A)(_),T=(0,r.useSelector)(C.MQ),y=(0,n.useMemo)(()=>p||M||f,[p,M,f]),S=(0,n.useCallback)(()=>{O((0,d.cF)(_))},[O,_]),h=(0,n.useMemo)(()=>y?[{label:b({id:"COMMON_CREATE_NEW"}),onPress:S}]:[],[b,S,y]),I=(0,n.useMemo)(()=>T===_,[T,_]),D=(0,n.useCallback)(e=>()=>{const{tagId:t,name:l,tags:n}=g(e);O((0,d.cF)(_)),O((0,d.nS)(n)),O((0,d.UO)(l)),O((0,d.h7)(t))},[O,_,g]),R=(0,n.useMemo)(()=>t.map(e=>({...e,..."checkboxProps"in e?{checkboxProps:{...e.checkboxProps,data:n.createElement($,{onPress:D(e.id)})}}:{}})),[t,D]);return I?n.createElement(F,{tagId:_,items:t}):n.createElement(N,{leftFilterPanelId:e,items:R,selectedKeys:l,disabledKeys:a,onSelectionChange:i,onSelectAll:c,onDeselectAll:m,footerActions:h,labelId:u,labelBubbleId:E},(0,s.H)(t)?null:n.createElement(A,{footerActions:h,isEditorAvailable:y}))},B=e=>{const{[z.fP.CREATOR_MODE]:t,[z.fP.CREATOR_MODE_DEPENDENCIES]:l,[z.fP.CREATOR_MODE_AVAILABLE]:r}=(0,w.A)(e.tagId);return(0,a.A)(l,t&&r?n.createElement(x,{...e}):e.items.length?n.createElement(N,{...e}):null)},V=e=>e.tagId?n.createElement(B,{...e}):e.items.length?n.createElement(N,{...e}):null},895424:(e,t,l)=>{l.d(t,{A:()=>m});var n=l(349785),a=l(296540),r=l(438628),o=l(705145),s=l(566723),i=l(263963),c=l(284428);const m=function({control:e,name:t,label:l,placeholder:m,tooltip:u,tooltipProps:E,autoFocus:A,motif:d,onChange:C,onBlur:_,onAfterChange:O,onPaste:b,onKeyDown:p,passwordToggle:M,type:f,helperMessage:g,autoComplete:N,contentBefore:T,contentAfter:y,onFocus:S,value:h,invalid:I}){const D=(0,c.mQ)(),R=(0,c.Im)(),v=(0,c.q)(),P=(0,i.L_)();return a.createElement(n.xI,{control:e,name:t,render:({field:e,fieldState:i,formState:c})=>a.createElement(r.A,{type:f||(M?"password":"text"),variant:"secondary",width:"100%",autoFocus:A,...e,onChange:t=>{C?C(t,e,c):e.onChange(t),O?.(t)},onBlur:t=>{_?_(t,e,c):e.onBlur()},onFocus:S,onPaste:b,disabled:D,value:h??e.value?.toString(),invalid:I||(i.invalid?a.createElement(o.A,{variant:"inherit",style:{overflowWrap:"break-word"}},P((0,n.Jt)(c.errors,t)?.message)||!0," "):void 0),label:l,placeholder:m,labelTooltip:u,labelTooltipProps:{style:{opacity:R?s.xN:void 0,pointerEvents:v?"none":void 0,...E?.style},...E},motif:d,passwordToggle:M,helperMessage:g,autoComplete:N,onKeyDown:p,contentBefore:T,contentAfter:y})})}},906619:(e,t,l)=>{l.d(t,{A:()=>m});var n=l(296540),a=l(71479),r=l(822336),o=l(566723),s=l(939703),i=l(294303);const c=(0,a.A)(i.A,{shouldForwardProp:e=>"color"!==e})`
  border-radius: ${r.Ay["desktop-radius-infinity"]};
  background: ${({color:e,theme:{themeName:t}})=>(0,s.b_)(e||r.Ay[`desktop-color-ublue-06-${t}`],.1)};
  padding: 2px ${o.kc};
`,m=({children:e,color:t})=>n.createElement(c,{color:t},e)}}]);