"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[25677],{431682(e,t,s){s.d(t,{A:()=>u});var l=s(274934),n=s(247816),o=s(505817),i=s(309130),a=s(419284),r=s(100978),c=s(291508);const d=(0,n.A)(r.A,(0,c.A)("color"))`
  border-radius: ${o.Ay["desktop-radius-infinity"]};
  background: ${({color:e,theme:{themeName:t}})=>(0,a.b_)(e||o.Ay[`desktop-color-ublue-06-${t}`],.1)};
  padding: 2px ${i.kc};
`,u=({children:e,color:t})=>(0,l.jsx)(d,{color:t,children:e})},530110(e,t,s){s.d(t,{A:()=>g});var l=s(274934),n=s(602086),o=s(977872),i=s(396489),a=s.n(i),r=s(179102),c=s(266824),d=s(858056),u=s(722837),A=s(147328),m=s(486529),E=s(7476),_=s(252445),C=s(470070),O=s(570801),f=s(94411),h=s(230853),p=s(158402),b=s(39279),M=s(696766);const g=({leftFilterPageId:e,...t})=>{const s=(0,o.wA)(),i=(0,n.useRef)(null),g=(0,A.A)(i),T=m.l[t.tableType],N=Boolean(T),I=(0,f.A)(t.tableType),x=(0,o.d4)(O.Bm),y=(0,n.useCallback)(()=>{const e=h.W2.tables?.[t.tableType],l=[...e?.initialColumns||[]],n=e?.columnOrder,o={[t.tableType]:{initialColumns:l,...n?{columnOrder:n}:{},initialColumnSnapshot:l.reduce((e,t)=>(e[String(t)]=!0,e),{...e?.initialColumnSnapshot||{}})}};N&&(o[t.tableType].columnSize=T,t.tableType===u.l.UNIFI_DEVICE&&m.t.forEach(e=>{o[e]={columnSize:T}})),s((0,p.zF)(o))},[s,t.tableType,N,T]),D=(0,n.useCallback)(()=>{s((0,_.Zi)(e))},[s,e]),S=(0,n.useMemo)(()=>{const e=a()([...h.W2.tables?.[t.tableType]?.initialColumns||[]].sort(),[...I?.initialColumns||[]].sort()),s=a()(h.W2.tables?.[t.tableType]?.columnOrder,I?.columnOrder);if(N){let l=!I?.columnSize||a()(T,I?.columnSize);if(t.tableType===u.l.UNIFI_DEVICE){const e=m.t.every(e=>!x[e]?.columnSize||a()(T,x[e]?.columnSize));l=l&&e}return e&&s&&l}return e&&s},[t.tableType,I,N,x,T]);return(0,l.jsx)(M.CW,{hasOverflow:g,children:(0,l.jsxs)(M.kp,{ref:i,children:[(0,l.jsx)(d.D,{variant:"small",children:(0,l.jsx)(C.sA,{id:"COMMON_CUSTOMIZE_COLUMNS"})}),(0,l.jsx)(E.A,{...t}),(0,l.jsxs)(M.Ot,{children:[(0,l.jsx)(b.d$,{}),(0,l.jsx)(c.A,{type:"button",onPress:y,isDisabled:S,children:(0,l.jsx)(r.A,{size:"medium",color:"inherit",children:(0,l.jsx)(C.sA,{id:"COMMON_ACTION_RESTORE"})})}),(0,l.jsx)(c.A,{type:"button",onPress:D,children:(0,l.jsx)(r.A,{size:"medium",color:"inherit",children:(0,l.jsx)(C.sA,{id:"COMMON_ACTION_DONE"})})})]})]})})}},373616(e,t,s){s.d(t,{A:()=>i});var l=s(274934),n=s(558844),o=s(479086);const i=({children:e})=>(0,l.jsx)(o.A,{children:(0,l.jsx)(n.y,{children:e})})},558844(e,t,s){s.d(t,{y:()=>i});var l=s(247816),n=s(309130),o=s(100978);const i=(0,l.A)(o.A)`
  flex-direction: column;
  gap: ${n.kc};
  margin: 0 0 ${n.Ln} ${n.kc};
`},479086(e,t,s){s.d(t,{A:()=>r});var l=s(274934),n=s(602086),o=s(342676),i=s(961231),a=s(614209);const r=({children:e})=>{const{[i.A.IS_MAXIMIZED]:t}=(0,n.useContext)(a.A);return(0,l.jsx)(o.A,{isHidden:t,children:e})}},121713(e,t,s){s.d(t,{m:()=>E});var l=s(602086),n=s(977872),o=s(42220),i=s(369289),a=s(721533),r=s(700444),c=s(159469),d=s(260334);const u=(e,t=[])=>{if(!e||"object"!=typeof e)return[];const s=e;return[...Object.keys(s).filter(e=>"ref"!==e).flatMap(e=>u(s[e],[...t,e])),..."string"==typeof s.message&&s.message?[{path:s.ref?.name??t.join("."),message:s.message}]:[]]},A=e=>[...Array.from(document.getElementsByName(e)),document.getElementById(e),document.querySelector(`label[for="${e}"]`),document.querySelector(`[data-field-error="${e}"]`)].find(e=>e instanceof HTMLElement&&null!==e.offsetParent)??null,m=e=>{const t=(e.split(".").pop()??e).replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").replaceAll(/[_-]+/g," ").trim().toLowerCase();return t?t.charAt(0).toUpperCase()+t.slice(1):e};function E({schema:e,defaultValues:t,presets:s,mode:E="onTouched"}){const _=(0,n.wA)(),C=(0,d.L_)(),O=(0,l.useMemo)(()=>s?(0,i.A)(s,e=>e.defaultValues):{},[s]),f=(0,l.useMemo)(()=>({...t,...O}),[O,t]),h=(0,o.mN)({resolver:(0,a.u)(e),shouldFocusError:!0,defaultValues:f,shouldUseNativeValidation:!1,mode:E}),p=(0,l.useRef)(f);p.current=f;const b=(0,l.useRef)(null),{submitCount:M}=h.formState;(0,l.useEffect)(()=>{const e=b.current;if(b.current=null,!e)return;const t=u(e),s=t[0],l=s?.path??Object.keys(e)[0];if(l)try{const e=t.map(e=>A(e.path)).find(Boolean)??(t.length?null:A(l));if(e)e.scrollIntoView?.({behavior:"smooth",block:"center"}),e.focus?.({preventScroll:!0});else{const e=s&&C(s.message);_((0,r.ox)(s&&e?{icon:c.C.danger,title:"COMMON_VALIDATION_HIDDEN_FIELDS_TITLE",translateTitle:!0,message:"COMMON_VALIDATION_HIDDEN_FIELDS_DETAIL",values:{field:m(s.path),message:e}}:{icon:c.C.danger,message:"COMMON_VALIDATION_HIDDEN_FIELDS_TITLE"}))}}catch{}},[M,_,C]);const g=(0,l.useCallback)((...e)=>{const[t,...s]=e;return h.reset(t?{...t,...O}:p.current,...s)},[O,h]);return{...h,reset:g,formState:{...h.formState,isDirty:!!Object.keys(h.formState.dirtyFields).length,isSubmitting:h.formState.isSubmitting,defaultValues:h.formState.defaultValues},handleSubmit:(...e)=>h.handleSubmit(e[0],(t,...s)=>{b.current=t,e[1]?.(t,...s)})}}},260334(e,t,s){s.d(t,{L_:()=>d,MS:()=>c,rn:()=>r});var l=s(602086),n=s(949812),o=s(765282),i=s(470070);const a="{::}",r=(e,t)=>`${e}${a}${JSON.stringify(t??{})}`,c=(e,t)=>{if("string"!=typeof t)return;const[s,...l]=t.split(a);if(!s||!l.length)return t;let n={};try{n=Object.fromEntries(Object.entries(JSON.parse(l.join(a))).map(([t,s])=>[t,"string"==typeof s?c(e,s):s]))}catch{}return e.formatMessage({id:s},n)};function d(){const{formatMessage:e}=(0,i.tz)();return(0,l.useCallback)(t=>c({formatMessage:e},t),[e])}n.pJ((e,t)=>e.message?{message:e.message}:e.code===o.eq.too_small&&"string"===e.type?{message:r("COMMON_MIN_CHARS",{min:Number(e.minimum)})}:e.code===o.eq.too_big&&"string"===e.type?{message:r("COMMON_MAX_CHARS",{name:r("COMMON_VALUE"),max:Number(e.maximum)})}:e.code===o.eq.invalid_type&&"array"===e.expected&&"undefined"===e.received?{message:r("COMMON_SELECT_AT_LEAST_ONE_ITEM")}:e.code===o.eq.too_small&&"array"===e.type?{message:r("COMMON_ADD_AT_LEAST_X_ITEMS",{min:Number(e.minimum)})}:e.code===o.eq.invalid_type&&"undefined"===e.received?{message:r("COMMON_VALIDATION_VALUE_REQUIRED")}:e.code===o.eq.invalid_type&&"number"===e.expected?{message:r("COMMON_VALIDATION_PLEASE_ENTER_A_NUMBER")}:{message:t.defaultError})},635891(e,t,s){s.d(t,{A:()=>d});var l=s(274934),n=s(42220),o=s(699709),i=s(775250),a=s(309130),r=s(260334),c=s(184931);const d=function({control:e,name:t,label:s,placeholder:d,tooltip:u,tooltipProps:A,autoFocus:m,motif:E,onChange:_,onBlur:C,onAfterChange:O,onPaste:f,onKeyDown:h,passwordToggle:p,type:b,helperMessage:M,autoComplete:g,contentBefore:T,contentAfter:N,onFocus:I,value:x,invalid:y}){const D=(0,c.mQ)(),S=(0,c.Im)(),j=(0,c.q)(),R=(0,r.L_)();return(0,l.jsx)(n.xI,{control:e,name:t,render:({field:e,fieldState:r,formState:c})=>(0,l.jsx)(o.A,{type:b||(p?"password":"text"),variant:"secondary",width:"100%",autoFocus:m,...e,onChange:t=>{_?_(t,e,c):e.onChange(t),O?.(t)},onBlur:t=>{C?C(t,e,c):e.onBlur()},onFocus:I,onPaste:f,disabled:D,value:x??e.value?.toString(),invalid:y||(r.invalid?(0,l.jsxs)(i.A,{variant:"inherit",style:{overflowWrap:"break-word"},children:[R((0,n.Jt)(c.errors,t)?.message)||!0," "]}):void 0),label:s,placeholder:d,labelTooltip:u,labelTooltipProps:{style:{opacity:S?a.xN:void 0,pointerEvents:j?"none":void 0,...A?.style},...A},motif:E,passwordToggle:p,helperMessage:M,autoComplete:g,onKeyDown:h,contentBefore:T,contentAfter:N})})}},967873(e,t,s){s.d(t,{A:()=>F});var l=s(274934),n=s(724081),o=s(602086),i=s(977872),a=s(470070),r=s(915442),c=s(266824),d=s(247816),u=s(309130),A=s(100978);const m=(0,d.A)(A.A)`
  margin: ${u.YC} 0 0 ${u.kc};
  gap: ${u.kc};
  > button {
    width: fit-content;
  }
`,E=({isEditorAvailable:e,footerActions:t})=>e?(0,l.jsx)(m,{children:t.map(({label:e,onPress:t})=>(0,l.jsx)(c.A,{type:"button",fontSize:"medium",onPress:t,children:e},e.toString()))}):null;var _=s(724514),C=s(128379),O=s(179102),f=s(19751),h=s(300842),p=s(431682);const b="TAGS_CREATOR_CONFIGURE_BUTTON_CLASSNAME",M=(0,d.A)("div")`
  .${b} {
    display: none;
  }
  [data-uic-component='Tree.Item']:hover {
    .${b} {
      display: block;
    }
  }
`,g=(0,d.A)(A.A)`
  align-items: center;
  gap: ${u.YC};
`,T=({leftFilterPanelId:e,items:t,selectedKeys:s,disabledKeys:n,onSelectionChange:o,onSelectAll:i,onDeselectAll:r,labelId:c,labelBubbleId:d,initialExpanded:u,children:A})=>(0,l.jsx)(M,{children:(0,l.jsxs)(h.A,{id:e,initialExpanded:u,label:(0,l.jsxs)(g,{children:[(0,l.jsx)(a.sA,{id:c}),d?(0,l.jsx)(p.A,{children:(0,l.jsx)(O.A,{size:"small",color:"ublue-06",children:(0,l.jsx)(a.sA,{id:d})})}):null]}),children:[(0,l.jsx)(f.A,{id:e,items:t,selectedKeys:s,disabledKeys:n,onSelectionChange:o,onSelectAll:i,onDeselectAll:r}),A]})});var N=s(830990),I=s(83985),x=s(42220),y=s(121713),D=s(635891),S=s(505817);const j=(0,d.A)(A.A)`
  background: ${({theme:{themeName:e}})=>S.Ay[`desktop-color-neutral-01-${e}`]};
  flex-direction: column;
  gap: ${u.kc};
  padding: ${u.kc};
`,R=(0,d.A)(A.A)`
  align-items: center;
  gap: ${u.YC};
  white-space: nowrap;
`;var L;!function(e){e.NAME="name",e.TAGS="tags"}(L||(L={}));var v=s(241792),P=s(260334),k=s(764478),w=s(667086);const $=({tagId:e,items:t})=>{const{[w.fP.CREATOR_MODE_HEADER_NEW_ID]:s,[w.fP.CREATOR_MODE_HEADER_EDIT_ID]:n,[w.fP.CREATOR_MODE_NOTICE_ID]:r,[w.fP.CREATOR_MODE_CREATE_ID]:c,[w.fP.CREATOR_MODE_REMOVE_ID]:d,[w.fP.CREATOR_MODE_CAN_DELETE]:u,[w.fP.CREATOR_MODE_CREATE_CALLBACK]:A,[w.fP.CREATOR_MODE_UPDATE_CALLBACK]:m,[w.fP.CREATOR_MODE_DELETE_CALLBACK]:E,[w.fP.CREATOR_MODE_CANCEL_CALLBACK]:_}=(0,k.A)(e),f=(0,i.d4)(C.B8),h=(0,i.d4)(C.Gq),p=(0,i.d4)(C.bn),b=(0,o.useMemo)(()=>({[L.NAME]:h||"",[L.TAGS]:f}),[h,f]),M=(0,o.useMemo)(()=>{return e=h,s=t.map(({title:e})=>e),v.Ik({[L.NAME]:v.Yj().refine(e=>e===e.trim(),{message:(0,P.rn)("COMMON_VALIDATION_NO_LEADING_TRAILING_SPACES")}).transform(e=>e.trim()).pipe(v.Yj().min(1).max(32)).refine(t=>!(e?s.filter(t=>t.toLowerCase()!==e.toLowerCase()):s).some(e=>e.toLowerCase()===t.toLowerCase()),{message:(0,P.rn)("COMMON_PLEASE_ENTER_UNIQUE_NAME")}),[L.TAGS]:v.YO(v.Yj())});var e,s},[h,t]),{setValue:g,control:T,formState:S}=(0,y.m)({schema:M,defaultValues:b}),$=(0,x.FH)({control:T,name:L.NAME});(0,o.useEffect)(()=>{g(L.TAGS,f,{shouldDirty:!0,shouldValidate:!0})},[g,f]);const{isValid:V}=(0,x.lN)({control:T}),B=(0,o.useCallback)(()=>{A($,f)},[A,$,f]),z=(0,o.useCallback)(()=>{m(p,$,f)},[m,p,$,f]),F=(0,o.useCallback)(e=>{E(e)},[E]),U=(0,o.useCallback)(()=>{(p?z:B)()},[p,B,z]),K=(0,o.useCallback)(()=>{F(p)},[F,p]),G=(0,o.useCallback)((e,t,s)=>(0,l.jsx)(I.A,{type:"button",width:s,size:"medium",onPress:U,variant:t,isDisabled:!S.isDirty||S.isSubmitting||!V,children:(0,l.jsx)(a.sA,{id:e})}),[U,S.isDirty,S.isSubmitting,V]),H=(0,o.useCallback)((e,t)=>(0,l.jsx)(I.A,{type:"button",width:t,size:"medium",onPress:_,variant:"secondary-emphasis",children:(0,l.jsx)(a.sA,{id:e})}),[_]),q=(0,o.useCallback)(()=>(0,l.jsx)(I.A,{type:"button",width:"full",size:"medium",onPress:_,variant:"tertiary-neutral",children:(0,l.jsx)(a.sA,{id:"COMMON_ACTION_CANCEL"})}),[_]),Y=(0,o.useCallback)(()=>u?(0,l.jsx)(I.A,{type:"button",width:"full",size:"medium",onPress:K,variant:"tertiary-destructive",children:(0,l.jsx)(a.sA,{id:d})}):null,[K,d,u]);return(0,l.jsxs)(j,{children:[(0,l.jsx)(O.A,{size:"small",color:"text-1",weight:"bold",children:(0,l.jsx)(a.sA,{id:p?n:s})}),(0,l.jsx)(D.A,{control:T,name:L.NAME,label:(0,l.jsx)(a.sA,{id:"COMMON_NAME"})}),(0,l.jsxs)(R,{children:[(0,l.jsx)(N.A,{isActive:!0,size:"original"}),(0,l.jsx)(O.A,{size:"small",color:"text-3",children:(0,l.jsx)(a.sA,{id:r,values:{count:f.length}})})]}),(0,l.jsx)(R,{children:(0,l.jsxs)(l.Fragment,p?S.isDirty?{children:[G("COMMON_ACTION_SAVE","emphasis",void 0),H("COMMON_CLOSE_EDITOR",void 0)]}:{children:[H("COMMON_CLOSE_EDITOR","full"),Y()]}:{children:[G(c,"secondary-emphasis","full"),q()]})})]})},V=({onPress:e})=>(0,l.jsx)(c.A,{className:b,fontSize:"medium",type:"button",onPress:e,children:(0,l.jsx)(a.sA,{id:"COMMON_CONFIGURE"})}),B=({leftFilterPanelId:e,items:t,selectedKeys:s,disabledKeys:n,onSelectionChange:c,onSelectAll:d,onDeselectAll:u,labelId:A,labelBubbleId:m,tagId:O})=>{const f=(0,i.wA)(),{formatMessage:h}=(0,a.tz)(),{[w.fP.CREATOR_MODE_CAN_CREATE]:p,[w.fP.CREATOR_MODE_CAN_DELETE]:b,[w.fP.CREATOR_MODE_CAN_EDIT]:M,[w.fP.CREATOR_MODE_TAG_META_CALLBACK]:g}=(0,k.A)(O),N=(0,i.d4)(C.MQ),I=(0,o.useMemo)(()=>p||b||M,[p,b,M]),x=(0,o.useCallback)(()=>{f((0,_.cF)(O))},[f,O]),y=(0,o.useMemo)(()=>p?[{label:h({id:"COMMON_CREATE_NEW"}),onPress:x}]:[],[h,x,p]),D=(0,o.useMemo)(()=>N===O,[N,O]),S=(0,o.useCallback)(e=>()=>{const{tagId:t,name:s,tags:l}=g(e);f((0,_.cF)(O)),f((0,_.nS)(l)),f((0,_.UO)(s)),f((0,_.h7)(t))},[f,O,g]),j=(0,o.useMemo)(()=>I?t.map(e=>({...e,..."checkboxProps"in e?{checkboxProps:{...e.checkboxProps,data:(0,l.jsx)(V,{onPress:S(e.id)})}}:{}})):t,[t,S,I]);return D?(0,l.jsx)($,{tagId:O,items:t}):y.length||j.length?(0,l.jsx)(T,{leftFilterPanelId:e,items:j,selectedKeys:s,disabledKeys:n,onSelectionChange:c,onSelectAll:d,onDeselectAll:u,footerActions:y,labelId:A,labelBubbleId:m,children:(0,r.H)(t)?null:(0,l.jsx)(E,{footerActions:y,isEditorAvailable:p})}):null},z=e=>{const{[w.fP.TAGS_GENERAL_AVAILABILITY]:t,[w.fP.CREATOR_MODE]:s,[w.fP.CREATOR_MODE_DEPENDENCIES]:o,[w.fP.CREATOR_MODE_AVAILABLE]:i}=(0,k.A)(e.tagId);return(0,n.A)(o,t?s&&i?(0,l.jsx)(B,{...e}):e.items.length?(0,l.jsx)(T,{...e}):null:null)},F=e=>e.tagId?(0,l.jsx)(z,{...e}):e.items.length?(0,l.jsx)(T,{...e}):null}}]);