"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[44068],{789581(t,n,e){e.d(n,{_9:()=>i,k8:()=>c,s$:()=>A,xl:()=>o,zn:()=>u});var l=e(774366),s=e(29472),a=e(571766),r=e(908920);const o=()=>(0,s.vB)(a.aC,null,null,l.A.POST,(0,r.ut)(),{},null,{fetchConfig:{getAllPostResponse:!0}}),i=()=>(0,s.vB)(a.aC,null,null,l.A.GET,(0,r.vm)(),{},null,{}),u=t=>(0,s.vB)(a.aC,null,null,l.A.POST,(0,r.yU)(t),{},null,{}),c=t=>(0,s.vB)(a.aC,null,null,l.A.POST,(0,r.lx)(t),{},null,{}),A=t=>(0,s.vB)(a.aC,null,null,l.A.DELETE,(0,r.tk)(t),{},null,{})},766768(t,n,e){e.d(n,{A:()=>a});var l=e(602086),s=e(947414);const a=(t=s.P1,n=s.P1)=>{(0,l.useEffect)(()=>(t(),n),[])}},294690(t,n,e){e.r(n),e.d(n,{default:()=>S});var l,s,a,r,o=e(274934),i=e(602086),u=e(977872),c=e(179102),A=e(83985),d=e(766768),C=e(789581),E=e(470070),T=e(271656);!function(t){t.CONFLICTS="conflicts",t.ENTRIES="entries",t.ID="id",t.SITE_ID="site_id",t.STATUS="status",t.ROLLBACK_TIMESTAMP="rollback_timestamp"}(l||(l={})),function(t){t.CONFIG="config",t.CONFIG_ID="config_id",t.CONFIG_TYPE="config_type",t.OPERATION="operation"}(s||(s={})),function(t){t.STAGED="STAGED",t.APPLIED="APPLIED"}(a||(a={})),function(t){t.UPDATE="UPDATE"}(r||(r={}));var f=e(712789),I=e(247816),O=e(505817),N=e(100978),_=e(309130);const h=(0,I.A)(N.A)`
  width: 350px;
  position: absolute;
  background: ${({theme:{themeName:t}})=>O.Ay[`desktop-color-neutral-01-${t}`]};
  z-index: 10000;
  border-radius: ${_.kc};
  top: ${_.Ln};
  right: ${_.Ln};
`,k=(0,I.A)(N.A)`
  padding: ${_.Ln};
  flex-direction: column;
  gap: ${_.kc};
`,x=(0,I.A)(N.A)`
  gap: ${_.kc};
`;var M=e(933253);const S=(0,i.memo)(()=>{const t=(0,u.wA)(),[n,e]=(0,i.useState)([]),{[l.ID]:s,[l.ROLLBACK_TIMESTAMP]:a}=n.at(0)||(0,T.A)(),r=(0,i.useCallback)(()=>{e([]),t((0,C.s$)(s)),t((0,f.sm)(s))},[t,s]),I=(0,i.useCallback)(()=>{e([]),t((0,C.k8)(s)),t((0,f.sm)(s))},[t,s]),O=(0,i.useCallback)(()=>{t((0,C._9)()).then(({data:n})=>{e(n),n.forEach(({[l.ID]:n})=>{t((0,f.fg)(n))})})},[t]);(0,d.A)(O);const N=(0,i.useMemo)(()=>a-Date.now(),[a]);return s&&N>0?(0,o.jsx)(h,{children:(0,o.jsxs)(k,{children:[(0,o.jsx)(c.A,{color:"text-1",weight:"bold",children:(0,o.jsx)(E.sA,{id:"COMMON_UNCONFIRMED_CHANGES_REVERT_TITLE"})}),(0,o.jsx)(c.A,{color:"text-2",children:(0,o.jsx)(E.sA,{id:"COMMON_UNCONFIRMED_CHANGES_REVERT_DESCRIPTION",values:{time:(0,o.jsx)(M.A,{durationMs:N,onRevert:r})}})}),(0,o.jsxs)(x,{children:[(0,o.jsx)(A.A,{type:"button",variant:"tertiary-neutral",onClick:r,children:(0,o.jsx)(E.sA,{id:"COMMON_ACTION_REVERT_NOW"})}),(0,o.jsx)(A.A,{type:"button",variant:"emphasis",onClick:I,children:(0,o.jsx)(E.sA,{id:"COMMON_ACTION_CONFIRM"})})]})]})}):null})},933253(t,n,e){e.d(n,{A:()=>o});var l=e(274934),s=e(602086),a=e(455425);const r=5*a.ti,o=({onRevert:t,durationMs:n})=>{const e=(0,s.useRef)(Date.now()),o=(0,s.useCallback)(()=>Math.max(0,(n??r)-(Date.now()-e.current)),[n]),[i,u]=(0,s.useState)(o);return(0,s.useEffect)(()=>{const t=setInterval(()=>{const n=o();u(n),0===n&&clearInterval(t)},250);return()=>{clearInterval(t)}},[o]),(0,s.useEffect)(()=>{0===i&&t()},[i,t]),(0,l.jsx)(l.Fragment,{children:`${String(Math.floor(i/a.ti)).padStart(2,"0")}:${String(Math.floor(i%a.ti/1e3)).padStart(2,"0")}`})}}}]);