"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[55308],{784465(e,E,t){t.d(E,{$5:()=>o,gT:()=>s,kW:()=>r,uK:()=>R,uu:()=>O});var A=t(165126),_=t(516693),a=t(691189),C=t(887831),l=t(33453),n=t(801156);const O=(e={},E={})=>(0,a.t9)(l.A2,l.lT,e,{...E,idField:l.RR}),o=e=>(0,a.vB)(_.aC,null,null,C.A.POST,l.FC,{},e,{fetchConfig:{getAllPostData:!0}}),r=e=>(0,a.vB)(_.aC,null,null,C.A.PUT,l.AU.replace(l.w4,e[n.d5.ID]),{},(0,A.A)(e,[n.d5.ID]),{fetchConfig:{getAllPostData:!0}}),R=e=>(0,a.vB)(_.aC,null,null,C.A.DELETE,l._U.replace(l.w4,e[n.Xs.ID]),{},(0,A.A)(e,[n.Xs.ID]),{}),s=e=>(0,a.vB)(_.aC,null,null,C.A.POST,l.Qw.replace(l.w4,e[n.nr.MAC]),{},(0,A.A)(e,[n.nr.MAC]),{})},801156(e,E,t){var A,_,a,C,l;t.d(E,{Ko:()=>A,Xs:()=>C,d5:()=>a,iV:()=>_,nr:()=>l}),function(e){e._ID="_id",e.NAME="name",e.MEMBER_DEVICE_MACS="member_device_macs"}(A||(A={})),function(e){e.NAME="name",e.MEMBER_DEVICE_MACS="member_device_macs"}(_||(_={})),function(e){e.ID="id",e.NAME="name",e.DEVICE_MAC_ADDITIONS="device_mac_additions",e.DEVICE_MAC_REMOVALS="device_mac_removals"}(a||(a={})),function(e){e.ID="id"}(C||(C={})),function(e){e.MAC="mac",e.DEVICE_TAG_ADDITIONS="device_tag_additions",e.DEVICE_TAG_REMOVALS="device_tag_removals"}(l||(l={}))},33453(e,E,t){t.d(E,{A2:()=>_,AU:()=>r,FC:()=>O,Qw:()=>o,RR:()=>a,_U:()=>R,lT:()=>n,w4:()=>C});var A=t(771805);const _="deviceTags",a="_id",C=`:${a}:`,l=`${A.w}/device-tags`,n=l,O=l,o=`${l}/device-tag-assignment/${C}`,r=`${l}/${C}`,R=`/v2/api/device-tags/${C}`},659552(e,E,t){t.d(E,{_:()=>n});var A=t(801081),_=t(25553),a=t(87485),C=t(784465);const l=(0,_.uh)((0,C.uu)()),n=(0,A.Mz)(l,a.kh)},183970(e,E,t){var A;t.d(E,{k:()=>A}),function(e){e.CLIENTS="CLIENTS",e.USERS="USERS"}(A||(A={}))},906619(e,E,t){t.d(E,{A:()=>r});var A=t(296540),_=t(71479),a=t(822336),C=t(566723),l=t(939703),n=t(294303),O=t(311785);const o=(0,_.A)(n.A,(0,O.A)("color"))`
  border-radius: ${a.Ay["desktop-radius-infinity"]};
  background: ${({color:e,theme:{themeName:E}})=>(0,l.b_)(e||a.Ay[`desktop-color-ublue-06-${E}`],.1)};
  padding: 2px ${C.kc};
`,r=({children:e,color:E})=>A.createElement(o,{color:E},e)},137625(e,E,t){t.d(E,{A:()=>O});var A=t(296540),_=t(353899),a=t(132196),C=t(372737),l=t(566723),n=t(916537);const O=({children:e=null,title:E,titleValues:t,message:O,messageValues:o,handleConfirm:r=()=>null,handleClose:R=()=>null,handleCancel:s,isOpen:T,buttonVariant:c="primary",cancelButtonVariant:i="tertiary",cancelButtonMessage:M="COMMON_ACTION_CANCEL",buttonMessage:D="COMMON_ACTION_CONFIRM",buttonDisabled:d=!1,position:I="top",offset:m,showHeaderClose:S=!1,contentClassName:u="",body:L,titleBody:N,className:b,rootClose:f=!1,footerActions:g})=>{const p=(0,A.useCallback)(e=>{T&&(e.stopPropagation(),e.key===C.U.ENTER?r():e.key===C.U.ESCAPE&&R(!1))},[T,r,R]);(0,A.useEffect)(()=>(window.addEventListener("keydown",p,!0),()=>{window.removeEventListener("keydown",p,!0)}),[p]);const P=(0,A.useCallback)(()=>{R(!1),s?.()},[R,s]),v=(0,A.useCallback)(()=>{R(!1),r()},[R,r]),y=(0,A.useMemo)(()=>[{text:A.createElement(n.sA,{id:M}),variant:i,onClick:P},{text:A.createElement(n.sA,{id:D}),disabled:d,variant:c,onClick:v}],[D,c,M,i,P,v,d]),B=(0,A.useCallback)(()=>{R(!1)},[R]),h=a.AH`
    ${E?"":`margin-top: ${l.xO}`}
  `;return A.createElement(_.A,{title:E?A.createElement(n.sA,{id:E,values:t}):N||null,...O?{body:A.createElement(A.Fragment,null,A.createElement(n.sA,{id:O,values:o}),L)}:{body:L},position:I,portal:!0,offset:m,actions:g||y,showHeaderClose:S,contentClassName:a.AH`
        ${h}
        ${u}
      `,onRequestClose:B,isOpen:T,allowOverflow:!0,rootClose:f,className:b},e)}},312583(e,E,t){t.d(E,{A:()=>S});var A=t(296540),_=t(469733),a=t(429252),C=t.n(a),l=t(217439),n=t(592563),O=t(170121),o=t(249304),r=t(77247),R=t(684342),s=t(300047),T=t(580176),c=t(916537),i=t(198494),M=t(200826),D=t(742525),d=t(789768),I=t(67716),m=t(518089);const S=({leftFilterPageId:e,...E})=>{const t=(0,_.useDispatch)(),a=(0,A.useRef)(null),S=(0,r.A)(a),u=R.l[E.tableType],L=Boolean(u),N=(0,M.A)(E.tableType),b=(0,_.useSelector)(i.Bm),f=(0,A.useCallback)(()=>{const e=D.W2.tables?.[E.tableType],A=[...e?.initialColumns||[]],_=e?.columnOrder,a={[E.tableType]:{initialColumns:A,..._?{columnOrder:_}:{},initialColumnSnapshot:A.reduce((e,E)=>(e[String(E)]=!0,e),{...e?.initialColumnSnapshot||{}})}};L&&(a[E.tableType].columnSize=u,E.tableType===o.l.UNIFI_DEVICE&&R.t.forEach(e=>{a[e]={columnSize:u}})),t((0,d.zF)(a))},[t,E.tableType,L,u]),g=(0,A.useCallback)(()=>{t((0,T.Zi)(e))},[t,e]),p=(0,A.useMemo)(()=>{const e=C()([...D.W2.tables?.[E.tableType]?.initialColumns||[]].sort(),[...N?.initialColumns||[]].sort()),t=C()(D.W2.tables?.[E.tableType]?.columnOrder,N?.columnOrder);if(L){let A=!N?.columnSize||C()(u,N?.columnSize);if(E.tableType===o.l.UNIFI_DEVICE){const e=R.t.every(e=>!b[e]?.columnSize||C()(u,b[e]?.columnSize));A=A&&e}return e&&t&&A}return e&&t},[E.tableType,N,L,b,u]);return A.createElement(m.CW,{hasOverflow:S},A.createElement(m.kp,{ref:a},A.createElement(O.D,{variant:"small"},A.createElement(c.sA,{id:"COMMON_CUSTOMIZE_COLUMNS"})),A.createElement(s.A,{...E}),A.createElement(m.Ot,null,A.createElement(I.d$,null),A.createElement(n.A,{type:"button",onPress:f,isDisabled:p},A.createElement(l.A,{size:"medium",color:"inherit"},A.createElement(c.sA,{id:"COMMON_ACTION_RESTORE"}))),A.createElement(n.A,{type:"button",onPress:g},A.createElement(l.A,{size:"medium",color:"inherit"},A.createElement(c.sA,{id:"COMMON_ACTION_DONE"}))))))}},17441(e,E,t){t.d(E,{A:()=>C});var A=t(296540),_=t(713769),a=t(264863);const C=({children:e})=>A.createElement(a.A,null,A.createElement(_.y,null,e))},713769(e,E,t){t.d(E,{y:()=>C});var A=t(71479),_=t(566723),a=t(294303);const C=(0,A.A)(a.A)`
  flex-direction: column;
  gap: ${_.kc};
  margin: 0 0 ${_.Ln} ${_.kc};
`},264863(e,E,t){t.d(E,{A:()=>l});var A=t(296540),_=t(113851),a=t(362584),C=t(528552);const l=({children:e})=>{const{[a.A.IS_MAXIMIZED]:E}=(0,A.useContext)(C.A);return A.createElement(_.A,{isHidden:E},e)}},263963(e,E,t){t.d(E,{L_:()=>O,MS:()=>n,rn:()=>l});var A=t(296540),_=t(614476),a=t(916537);const C="{::}",l=(e,E)=>`${e}${C}${JSON.stringify(E??{})}`,n=(e,E)=>{if("string"!=typeof E)return;const[t,...A]=E.split(C);if(!t||!A.length)return E;let _={};try{_=Object.fromEntries(Object.entries(JSON.parse(A.join(C))).map(([E,t])=>[E,"string"==typeof t?n(e,t):t]))}catch{}return e.formatMessage({id:t},_)};function O(){const{formatMessage:e}=(0,a.tz)();return(0,A.useCallback)(E=>n({formatMessage:e},E),[e])}_.z.setErrorMap((e,E)=>e.message?{message:e.message}:e.code===_.z.ZodIssueCode.too_small&&"string"===e.type?{message:l("COMMON_MIN_CHARS",{min:Number(e.minimum)})}:e.code===_.z.ZodIssueCode.too_big&&"string"===e.type?{message:l("COMMON_MAX_CHARS",{name:l("COMMON_VALUE"),max:Number(e.maximum)})}:e.code===_.z.ZodIssueCode.invalid_type&&"array"===e.expected&&"undefined"===e.received?{message:l("COMMON_SELECT_AT_LEAST_ONE_ITEM")}:e.code===_.z.ZodIssueCode.too_small&&"array"===e.type?{message:l("COMMON_ADD_AT_LEAST_X_ITEMS",{min:Number(e.minimum)})}:e.code===_.z.ZodIssueCode.invalid_type&&"undefined"===e.received?{message:l("COMMON_VALIDATION_VALUE_REQUIRED")}:e.code===_.z.ZodIssueCode.invalid_type&&"number"===e.expected?{message:l("COMMON_VALIDATION_PLEASE_ENTER_A_NUMBER")}:{message:E.defaultError})},874098(e,E,t){t.d(E,{B8:()=>n,Gq:()=>O,MQ:()=>l,bn:()=>o});var A=t(801081),_=t(919952),a=t(108666);const C=e=>e[_.U.TAGS],l=(0,A.Mz)(C,e=>e[a.I.ID]),n=(0,A.Mz)(C,e=>e[a.I.VALUES]),O=(0,A.Mz)(C,e=>e[a.I.NAME]),o=(0,A.Mz)(C,e=>e[a.I.VALUE_ID])},60519(e,E,t){t.d(E,{As:()=>c,H2:()=>r,JQ:()=>l,Jc:()=>R,Qu:()=>n,cW:()=>s,lQ:()=>O,m7:()=>o,vs:()=>i,zp:()=>T});var A=t(801081),_=t(198494),a=t(792072),C=t(602021);const l=(0,A.Mz)(a.Y8,e=>e),n=(0,A.Mz)(_.Io,_.mn,_.aK,C.dK,C.IX,(e,E,t,A,_)=>e?E||t:A||_),O=(0,A.Mz)(_.Io,_.mn,_.aK,C.dK,C.IX,(e,E,t,A,_)=>e?E||t:A||_),o=(0,A.Mz)(_.Io,_.mn,_.aK,C.dK,C.IX,(e,E,t,A,_)=>e?E||t:A||_),r=(0,A.Mz)(_.Io,_.mn,_.aK,_.$7,C.dK,C.IX,(e,E,t,A,_,a)=>e?E||t||A:_||a),R=(0,A.Mz)(C.EL,e=>!e),s=R,T=R,c=R,i=R},893594(e,E,t){t.d(E,{A:()=>w});var A=t(296540),_=t(422969),a=t(469733),C=t(916537),l=t(726743),n=t(592563),O=t(71479),o=t(566723),r=t(294303);const R=(0,O.A)(r.A)`
  margin: ${o.YC} 0 0 ${o.kc};
  gap: ${o.kc};
  > button {
    width: fit-content;
  }
`,s=({isEditorAvailable:e,footerActions:E})=>e?A.createElement(R,null,E.map(({label:e,onPress:E})=>A.createElement(n.A,{key:e.toString(),type:"button",fontSize:"medium",onPress:E},e))):null;var T=t(472807),c=t(874098),i=t(217439),M=t(895),D=t(445535),d=t(906619);const I="TAGS_CREATOR_CONFIGURE_BUTTON_CLASSNAME",m=(0,O.A)("div")`
  .${I} {
    display: none;
  }
  [data-uic-component='Tree.Item']:hover {
    .${I} {
      display: block;
    }
  }
`,S=(0,O.A)(r.A)`
  align-items: center;
  gap: ${o.YC};
`,u=({leftFilterPanelId:e,items:E,selectedKeys:t,disabledKeys:_,onSelectionChange:a,onSelectAll:l,onDeselectAll:n,labelId:O,labelBubbleId:o,initialExpanded:r,children:R})=>A.createElement(m,null,A.createElement(D.A,{id:e,initialExpanded:r,label:A.createElement(S,null,A.createElement(C.sA,{id:O}),o?A.createElement(d.A,null,A.createElement(i.A,{size:"small",color:"ublue-06"},A.createElement(C.sA,{id:o}))):null)},A.createElement(M.A,{id:e,items:E,selectedKeys:t,disabledKeys:_,onSelectionChange:a,onSelectAll:l,onDeselectAll:n}),R));var L=t(709690),N=t(74750),b=t(349785),f=t(79786),g=t(895424),p=t(822336);const P=(0,O.A)(r.A)`
  background: ${({theme:{themeName:e}})=>p.Ay[`desktop-color-neutral-01-${e}`]};
  flex-direction: column;
  gap: ${o.kc};
  padding: ${o.kc};
`,v=(0,O.A)(r.A)`
  align-items: center;
  gap: ${o.YC};
  white-space: nowrap;
`;var y;!function(e){e.NAME="name",e.TAGS="tags"}(y||(y={}));var B=t(614476),h=t(263963),G=t(986905),V=t(760919);const K=({tagId:e,items:E})=>{const{[V.fP.CREATOR_MODE_HEADER_NEW_ID]:t,[V.fP.CREATOR_MODE_HEADER_EDIT_ID]:_,[V.fP.CREATOR_MODE_NOTICE_ID]:l,[V.fP.CREATOR_MODE_CREATE_ID]:n,[V.fP.CREATOR_MODE_REMOVE_ID]:O,[V.fP.CREATOR_MODE_CAN_DELETE]:o,[V.fP.CREATOR_MODE_CREATE_CALLBACK]:r,[V.fP.CREATOR_MODE_UPDATE_CALLBACK]:R,[V.fP.CREATOR_MODE_DELETE_CALLBACK]:s,[V.fP.CREATOR_MODE_CANCEL_CALLBACK]:T}=(0,G.A)(e),M=(0,a.useSelector)(c.B8),D=(0,a.useSelector)(c.Gq),d=(0,a.useSelector)(c.bn),I=(0,A.useMemo)(()=>({[y.NAME]:D||"",[y.TAGS]:M}),[D,M]),m=(0,A.useMemo)(()=>{return e=D,t=E.map(({title:e})=>e),B.z.object({[y.NAME]:B.z.string().refine(e=>e===e.trim(),{message:(0,h.rn)("COMMON_VALIDATION_NO_LEADING_TRAILING_SPACES")}).transform(e=>e.trim()).pipe(B.z.string().min(1).max(32)).refine(E=>!(e?t.filter(E=>E.toLowerCase()!==e.toLowerCase()):t).some(e=>e.toLowerCase()===E.toLowerCase()),{message:(0,h.rn)("COMMON_PLEASE_ENTER_UNIQUE_NAME")}),[y.TAGS]:B.z.array(B.z.string())});var e,t},[D,E]),{setValue:S,control:u,formState:p}=(0,f.m)({schema:m,defaultValues:I}),K=(0,b.FH)({control:u,name:y.NAME});(0,A.useEffect)(()=>{S(y.TAGS,M,{shouldDirty:!0,shouldValidate:!0})},[S,M]);const{isValid:k}=(0,b.lN)({control:u}),z=(0,A.useCallback)(()=>{r(K,M)},[r,K,M]),U=(0,A.useCallback)(()=>{R(d,K,M)},[R,d,K,M]),w=(0,A.useCallback)(e=>{s(e)},[s]),$=(0,A.useCallback)(()=>{(d?U:z)()},[d,z,U]),F=(0,A.useCallback)(()=>{w(d)},[w,d]),H=(0,A.useCallback)((e,E,t)=>A.createElement(N.A,{type:"button",width:t,size:"medium",onPress:$,variant:E,isDisabled:!p.isDirty||p.isSubmitting||!k},A.createElement(C.sA,{id:e})),[$,p.isDirty,p.isSubmitting,k]),x=(0,A.useCallback)((e,E)=>A.createElement(N.A,{type:"button",width:E,size:"medium",onPress:T,variant:"secondary-emphasis"},A.createElement(C.sA,{id:e})),[T]),W=(0,A.useCallback)(()=>A.createElement(N.A,{type:"button",width:"full",size:"medium",onPress:T,variant:"tertiary-neutral"},A.createElement(C.sA,{id:"COMMON_ACTION_CANCEL"})),[T]),Y=(0,A.useCallback)(()=>o?A.createElement(N.A,{type:"button",width:"full",size:"medium",onPress:F,variant:"tertiary-destructive"},A.createElement(C.sA,{id:O})):null,[F,O,o]);return A.createElement(P,null,A.createElement(i.A,{size:"small",color:"text-1",weight:"bold"},A.createElement(C.sA,{id:d?_:t})),A.createElement(g.A,{control:u,name:y.NAME,label:A.createElement(C.sA,{id:"COMMON_NAME"})}),A.createElement(v,null,A.createElement(L.A,{isActive:!0,size:"original"}),A.createElement(i.A,{size:"small",color:"text-3"},A.createElement(C.sA,{id:l,values:{count:M.length}}))),A.createElement(v,null,d?p.isDirty?A.createElement(A.Fragment,null,H("COMMON_ACTION_SAVE","emphasis",void 0),x("COMMON_CLOSE_EDITOR",void 0)):A.createElement(A.Fragment,null,x("COMMON_CLOSE_EDITOR","full"),Y()):A.createElement(A.Fragment,null,H(n,"secondary-emphasis","full"),W())))},k=({onPress:e})=>A.createElement(n.A,{className:I,fontSize:"medium",type:"button",onPress:e},A.createElement(C.sA,{id:"COMMON_CONFIGURE"})),z=({leftFilterPanelId:e,items:E,selectedKeys:t,disabledKeys:_,onSelectionChange:n,onSelectAll:O,onDeselectAll:o,labelId:r,labelBubbleId:R,tagId:i})=>{const M=(0,a.useDispatch)(),{formatMessage:D}=(0,C.tz)(),{[V.fP.CREATOR_MODE_CAN_CREATE]:d,[V.fP.CREATOR_MODE_CAN_DELETE]:I,[V.fP.CREATOR_MODE_CAN_EDIT]:m,[V.fP.CREATOR_MODE_TAG_META_CALLBACK]:S}=(0,G.A)(i),L=(0,a.useSelector)(c.MQ),N=(0,A.useMemo)(()=>d||I||m,[d,I,m]),b=(0,A.useCallback)(()=>{M((0,T.cF)(i))},[M,i]),f=(0,A.useMemo)(()=>d?[{label:D({id:"COMMON_CREATE_NEW"}),onPress:b}]:[],[D,b,d]),g=(0,A.useMemo)(()=>L===i,[L,i]),p=(0,A.useCallback)(e=>()=>{const{tagId:E,name:t,tags:A}=S(e);M((0,T.cF)(i)),M((0,T.nS)(A)),M((0,T.UO)(t)),M((0,T.h7)(E))},[M,i,S]),P=(0,A.useMemo)(()=>N?E.map(e=>({...e,..."checkboxProps"in e?{checkboxProps:{...e.checkboxProps,data:A.createElement(k,{onPress:p(e.id)})}}:{}})):E,[E,p,N]);return g?A.createElement(K,{tagId:i,items:E}):f.length||P.length?A.createElement(u,{leftFilterPanelId:e,items:P,selectedKeys:t,disabledKeys:_,onSelectionChange:n,onSelectAll:O,onDeselectAll:o,footerActions:f,labelId:r,labelBubbleId:R},(0,l.H)(E)?null:A.createElement(s,{footerActions:f,isEditorAvailable:d})):null},U=e=>{const{[V.fP.TAGS_GENERAL_AVAILABILITY]:E,[V.fP.CREATOR_MODE]:t,[V.fP.CREATOR_MODE_DEPENDENCIES]:a,[V.fP.CREATOR_MODE_AVAILABLE]:C}=(0,G.A)(e.tagId);return(0,_.A)(a,E?t&&C?A.createElement(z,{...e}):e.items.length?A.createElement(u,{...e}):null:null)},w=e=>e.tagId?A.createElement(U,{...e}):e.items.length?A.createElement(u,{...e}):null},760919(e,E,t){var A,_,a;t.d(E,{S:()=>A,dD:()=>a,fP:()=>_}),function(e){e.TAGS_GENERAL_AVAILABILITY_SELECTOR="tagsGeneralAvailabilitySelector",e.CREATOR_MODE="creatorMode",e.CREATOR_MODE_DEPENDENCIES="creatorModeDependencies",e.CREATOR_MODE_AVAILABILITY_SELECTOR="creatorModeAvailabilitySelector",e.CREATOR_MODE_CAN_CREATE_SELECTOR="creatorModeCanCreateSelector",e.CREATOR_MODE_CAN_DELETE_SELECTOR="creatorModeCanDeleteSelector",e.CREATOR_MODE_CAN_EDIT_SELECTOR="creatorModeCanEditSelector",e.CREATOR_MODE_CAN_ASSIGN_SELECTOR="creatorModeCanAssignSelector",e.CREATOR_MODE_FILTER="creatorModeFilter",e.CREATOR_MODE_TAG_META_CALLBACK="creatorModeTagMetaCallback",e.CREATOR_MODE_HEADER_NEW_ID="creatorModeHeaderNewId",e.CREATOR_MODE_HEADER_EDIT_ID="creatorModeHeaderEditId",e.CREATOR_MODE_NOTICE_ID="creatorModeNoticeId",e.CREATOR_MODE_CREATE_ID="creatorModeCreateId",e.CREATOR_MODE_REMOVE_ID="creatorModeRemoveId",e.CREATOR_MODE_CREATE_CALLBACK="creatorModeCreateCallback",e.CREATOR_MODE_UPDATE_CALLBACK="creatorModeUpdateCallback",e.CREATOR_MODE_DELETE_CALLBACK="creatorModeDeleteCallback",e.CREATOR_MODE_CANCEL_CALLBACK="creatorModeCancelCallback"}(A||(A={})),function(e){e.TAGS_GENERAL_AVAILABILITY="tagsGeneralAvailability",e.CREATOR_MODE="creatorMode",e.CREATOR_MODE_DEPENDENCIES="creatorModeDependencies",e.CREATOR_MODE_AVAILABLE="creatorModeAvailable",e.CREATOR_MODE_CAN_CREATE="creatorModeCanCreate",e.CREATOR_MODE_CAN_DELETE="creatorModeCanDelete",e.CREATOR_MODE_CAN_EDIT="creatorModeCanEdit",e.CREATOR_MODE_CAN_ASSIGN="creatorModeCanAssign",e.CREATOR_MODE_FILTER="creatorModeFilter",e.CREATOR_MODE_TAG_META_CALLBACK="creatorModeTagMetaCallback",e.CREATOR_MODE_HEADER_NEW_ID="creatorModeHeaderNewId",e.CREATOR_MODE_HEADER_EDIT_ID="creatorModeHeaderEditId",e.CREATOR_MODE_NOTICE_ID="creatorModeNoticeId",e.CREATOR_MODE_CREATE_ID="creatorModeCreateId",e.CREATOR_MODE_REMOVE_ID="creatorModeRemoveId",e.CREATOR_MODE_CREATE_CALLBACK="creatorModeCreateCallback",e.CREATOR_MODE_UPDATE_CALLBACK="creatorModeUpdateCallback",e.CREATOR_MODE_DELETE_CALLBACK="creatorModeDeleteCallback",e.CREATOR_MODE_CANCEL_CALLBACK="creatorModeCancelCallback"}(_||(_={})),function(e){e.TAG_ID="tagId",e.NAME="name",e.TAGS="tags"}(a||(a={}))},986905(e,E,t){t.d(E,{A:()=>b});var A=t(296540),_=t(469733),a=t(108666),C=t(71177),l=t(642597),n=t(592510),O=t(60519),o=t(516693),r=t(33453),R=t(659552),s=t(801156),T=t(784465),c=t(675359),i=t(742920),M=t(472807),D=t(370333),d=t(183970),I=t(861509),m=t(432680),S=t(874807),u=t(523275),L=t(413786),N=t(760919);const b=e=>{const E=(0,_.useDispatch)(),t=(0,_.useSelector)(R._),b=(0,_.useSelector)(I.y),f=(0,A.useCallback)(()=>{E((0,M.cF)(void 0)),E((0,M.nS)([])),E((0,M.UO)(void 0)),E((0,M.h7)(void 0))},[E]),{[N.S.TAGS_GENERAL_AVAILABILITY_SELECTOR]:g,[N.S.CREATOR_MODE]:p,[N.S.CREATOR_MODE_DEPENDENCIES]:P,[N.S.CREATOR_MODE_AVAILABILITY_SELECTOR]:v,[N.S.CREATOR_MODE_CAN_CREATE_SELECTOR]:y,[N.S.CREATOR_MODE_CAN_DELETE_SELECTOR]:B,[N.S.CREATOR_MODE_CAN_EDIT_SELECTOR]:h,[N.S.CREATOR_MODE_CAN_ASSIGN_SELECTOR]:G,[N.S.CREATOR_MODE_FILTER]:V,[N.S.CREATOR_MODE_TAG_META_CALLBACK]:K,[N.S.CREATOR_MODE_HEADER_NEW_ID]:k,[N.S.CREATOR_MODE_HEADER_EDIT_ID]:z,[N.S.CREATOR_MODE_NOTICE_ID]:U,[N.S.CREATOR_MODE_CREATE_ID]:w,[N.S.CREATOR_MODE_REMOVE_ID]:$,[N.S.CREATOR_MODE_CREATE_CALLBACK]:F,[N.S.CREATOR_MODE_UPDATE_CALLBACK]:H,[N.S.CREATOR_MODE_DELETE_CALLBACK]:x}=(0,A.useMemo)(()=>{switch(e){case a.a.DEVICES:{const e=()=>{f(),E((0,T.uu)())},A=({msg:e,details:t})=>{E((0,c.ox)({icon:i.C.danger,message:"COMMON_DEVICE_TAG_FAILED_SAVE",errorMessage:e,errorValues:t}))},_=(t,_)=>{E((0,T.$5)({[s.iV.NAME]:t,[s.iV.MEMBER_DEVICE_MACS]:_})).then(e=>{E({type:o.xk,meta:{model:r.A2,extend:!0,fetchTime:Date.now(),id:e[s.Ko._ID],idField:r.RR},payload:{data:e}})}).catch(A).finally(e)},a=(_,a,C)=>{const l=t.find(e=>e[s.Ko._ID]===_);E((0,T.kW)({[s.d5.ID]:_,[s.d5.NAME]:l?.[s.Ko.NAME]===a?null:a,...(({added:e,removed:E})=>({[s.d5.DEVICE_MAC_ADDITIONS]:e,[s.d5.DEVICE_MAC_REMOVALS]:E}))((0,D.qk)(l?.[s.Ko.MEMBER_DEVICE_MACS]||[],C))})).then(e=>{E({type:o.eC,meta:{model:r.A2,extend:!0,fetchTime:Date.now(),id:_,idField:r.RR},payload:{data:{...e,[s.Ko.NAME]:a}}})}).catch(A).finally(e)},l=t=>{E((0,T.uK)({[s.Xs.ID]:t})).then(()=>{E({type:o._7,meta:{model:r.A2,extend:!0,fetchTime:Date.now(),id:t,idField:r.RR}})}).catch(A).finally(e)};return{[N.S.TAGS_GENERAL_AVAILABILITY_SELECTOR]:O.JQ,[N.S.CREATOR_MODE]:!0,[N.S.CREATOR_MODE_DEPENDENCIES]:[(0,C.m)(void 0,{crudCacheStrategy:{type:n.e.CACHE}})],[N.S.CREATOR_MODE_AVAILABILITY_SELECTOR]:O.JQ,[N.S.CREATOR_MODE_CAN_CREATE_SELECTOR]:O.Qu,[N.S.CREATOR_MODE_CAN_DELETE_SELECTOR]:O.lQ,[N.S.CREATOR_MODE_CAN_EDIT_SELECTOR]:O.m7,[N.S.CREATOR_MODE_CAN_ASSIGN_SELECTOR]:O.H2,[N.S.CREATOR_MODE_FILTER]:({adopted:e,device_type:E})=>E===L.iU.MANAGED&&e,[N.S.CREATOR_MODE_TAG_META_CALLBACK]:e=>(({[s.Ko._ID]:e,[s.Ko.NAME]:E,[s.Ko.MEMBER_DEVICE_MACS]:t})=>({[N.dD.TAG_ID]:e,[N.dD.NAME]:E,[N.dD.TAGS]:t}))(t.find(E=>E[s.Ko._ID]===e)||{}),[N.S.CREATOR_MODE_HEADER_NEW_ID]:"COMMON_NEW_DEVICE_TAG",[N.S.CREATOR_MODE_HEADER_EDIT_ID]:"COMMON_MANAGE_TAG",[N.S.CREATOR_MODE_NOTICE_ID]:"COMMON_TAGS_NOTICE",[N.S.CREATOR_MODE_CREATE_ID]:"COMMON_CREATE_TAG",[N.S.CREATOR_MODE_REMOVE_ID]:"COMMON_REMOVE_TAG",[N.S.CREATOR_MODE_CREATE_CALLBACK]:(e,E)=>{_(e,E)},[N.S.CREATOR_MODE_UPDATE_CALLBACK]:(e,E,t)=>{a(e,E,t)},[N.S.CREATOR_MODE_DELETE_CALLBACK]:e=>{l(e)},[N.S.CREATOR_MODE_CANCEL_CALLBACK]:f}}case a.a.CLIENTS:{const e=()=>{f(),E((0,l.O$)())},t=({msg:e,details:t})=>{E((0,c.ox)({icon:i.C.danger,message:"COMMON_CLIENT_GROUP_FAILED_SAVE",errorMessage:e,errorValues:t}))},A=(A,_,a)=>{E((0,l.YH)({id:A,name:_,members:a,type:b.find(e=>e.id===A)?.type||d.k.CLIENTS})).catch(t).finally(e)},_=A=>{E((0,l.aX)(A)).then(()=>{E((0,m.rt)())}).catch(t).finally(e)};return{[N.S.TAGS_GENERAL_AVAILABILITY_SELECTOR]:S.qp,[N.S.CREATOR_MODE]:!0,[N.S.CREATOR_MODE_DEPENDENCIES]:[(0,l.O$)(void 0,{crudCacheStrategy:{type:n.e.CACHE}})],[N.S.CREATOR_MODE_AVAILABILITY_SELECTOR]:O.Jc,[N.S.CREATOR_MODE_CAN_CREATE_SELECTOR]:O.cW,[N.S.CREATOR_MODE_CAN_DELETE_SELECTOR]:O.zp,[N.S.CREATOR_MODE_CAN_EDIT_SELECTOR]:O.As,[N.S.CREATOR_MODE_CAN_ASSIGN_SELECTOR]:O.vs,[N.S.CREATOR_MODE_FILTER]:()=>!0,[N.S.CREATOR_MODE_TAG_META_CALLBACK]:e=>(({members:E,name:t})=>({[N.dD.TAG_ID]:e,[N.dD.NAME]:t,[N.dD.TAGS]:E}))(b.find(E=>E.id===e)||{}),[N.S.CREATOR_MODE_HEADER_NEW_ID]:"COMMON_NEW_CLIENT_GROUP",[N.S.CREATOR_MODE_HEADER_EDIT_ID]:"COMMON_MANAGE_GROUP",[N.S.CREATOR_MODE_NOTICE_ID]:"COMMON_GROUPS_NOTICE",[N.S.CREATOR_MODE_CREATE_ID]:"COMMON_CREATE_GROUP",[N.S.CREATOR_MODE_REMOVE_ID]:"COMMON_REMOVE_GROUP",[N.S.CREATOR_MODE_CREATE_CALLBACK]:(e,E)=>{A(void 0,e,E)},[N.S.CREATOR_MODE_UPDATE_CALLBACK]:(e,E,t)=>{A(e,E,t)},[N.S.CREATOR_MODE_DELETE_CALLBACK]:e=>{_(e)},[N.S.CREATOR_MODE_CANCEL_CALLBACK]:f}}default:return{[N.S.TAGS_GENERAL_AVAILABILITY_SELECTOR]:S.bx,[N.S.CREATOR_MODE]:!1,[N.S.CREATOR_MODE_DEPENDENCIES]:[],[N.S.CREATOR_MODE_AVAILABILITY_SELECTOR]:S.bx,[N.S.CREATOR_MODE_CAN_CREATE_SELECTOR]:S.bx,[N.S.CREATOR_MODE_CAN_DELETE_SELECTOR]:S.bx,[N.S.CREATOR_MODE_CAN_EDIT_SELECTOR]:S.bx,[N.S.CREATOR_MODE_CAN_ASSIGN_SELECTOR]:S.bx,[N.S.CREATOR_MODE_FILTER]:S.wE,[N.S.CREATOR_MODE_TAG_META_CALLBACK]:u.A,[N.S.CREATOR_MODE_HEADER_NEW_ID]:void 0,[N.S.CREATOR_MODE_HEADER_EDIT_ID]:void 0,[N.S.CREATOR_MODE_NOTICE_ID]:void 0,[N.S.CREATOR_MODE_CREATE_ID]:void 0,[N.S.CREATOR_MODE_REMOVE_ID]:void 0,[N.S.CREATOR_MODE_CREATE_CALLBACK]:S.P1,[N.S.CREATOR_MODE_UPDATE_CALLBACK]:S.P1,[N.S.CREATOR_MODE_DELETE_CALLBACK]:S.P1,[N.S.CREATOR_MODE_CANCEL_CALLBACK]:S.P1}}},[e,t,E,f,b]),W=(0,_.useSelector)(g),Y=(0,_.useSelector)(v),Q=(0,_.useSelector)(y),X=(0,_.useSelector)(B),Z=(0,_.useSelector)(h),J=(0,_.useSelector)(G);return(0,A.useMemo)(()=>({[N.fP.TAGS_GENERAL_AVAILABILITY]:W,[N.fP.CREATOR_MODE]:p,[N.fP.CREATOR_MODE_DEPENDENCIES]:P,[N.fP.CREATOR_MODE_AVAILABLE]:Y,[N.fP.CREATOR_MODE_CAN_CREATE]:Q,[N.fP.CREATOR_MODE_CAN_DELETE]:X,[N.fP.CREATOR_MODE_CAN_EDIT]:Z,[N.fP.CREATOR_MODE_CAN_ASSIGN]:J,[N.fP.CREATOR_MODE_FILTER]:V,[N.fP.CREATOR_MODE_TAG_META_CALLBACK]:K,[N.fP.CREATOR_MODE_HEADER_NEW_ID]:k,[N.fP.CREATOR_MODE_HEADER_EDIT_ID]:z,[N.fP.CREATOR_MODE_NOTICE_ID]:U,[N.fP.CREATOR_MODE_CREATE_ID]:w,[N.fP.CREATOR_MODE_REMOVE_ID]:$,[N.fP.CREATOR_MODE_CREATE_CALLBACK]:F,[N.fP.CREATOR_MODE_UPDATE_CALLBACK]:H,[N.fP.CREATOR_MODE_DELETE_CALLBACK]:x,[N.fP.CREATOR_MODE_CANCEL_CALLBACK]:f}),[W,p,P,Y,Q,X,Z,J,V,K,k,z,U,w,$,F,H,x,f])}}}]);