"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/dns/records/dns-zone-sync"],{993:(e,n,s)=>{s.r(n),s.d(n,{default:()=>a});var o=s(245),t=s(739),c=s(247),l=s.n(c),r=s(246);const u=({onClose:e,isOpen:n,closeOnFormSuccess:s,closeUrl:c,...l})=>{const u=(0,t.useNavigate)(),[a,i]=(0,o.useState)(n),f=(0,o.useRef)(null),p=(0,o.useCallback)(((...n)=>{const s=e??(()=>u(c,{preventScrollReset:!0}));i(!1),f.current=setTimeout((()=>{s(...n),f.current=null}),300)}),[c,u,e]);(0,o.useEffect)((()=>()=>clearTimeout(f.current)),[]),(0,o.useEffect)((()=>{n?f.current&&clearTimeout(f.current):i(n)}),[n]);const d=(0,o.useMemo)((()=>{const{form:e}=l;if(e&&s){if((0,o.isValidElement)(e))return(0,o.cloneElement)(e,{onSuccess:()=>{e.props.onSuccess?.(),p()}});if("object"==typeof e)return{...e,onSuccess:()=>{e.onSuccess?.(),p()}}}return e}),[s,p,l]);return(0,o.jsx)(r.Drawer,{...l,form:d,onClose:p,isOpen:a})};u.propTypes={onClose:l().func,isOpen:l().bool,form:l().oneOfType([l().object,l().node]),closeOnFormSuccess:l().bool,closeUrl:l().string},u.defaultProps={onClose:void 0,form:void 0,isOpen:!0,closeOnFormSuccess:!0,closeUrl:".."};const a=u},1783:(e,n,s)=>{s.r(n),s.d(n,{default:()=>d});var o=s(458),t=s(774),c=s(246),l=s(770),r=s(993),u=s(959),a=s(90),i=s(245);const f=a.Locale.getTranslate("admin.controllers.dns.sync"),p=o.gql`
    mutation SyncDnsZone($input: SyncDnsZoneInput!) {
        syncDnsZone(input: $input) {
            task {
                id
            }
        }
    }
`,d=()=>{const[e]=(0,t.useMutation)(p);return(0,i.jsx)(r.default,{component:l.default,dataType:"dns-zone-sync",isOpen:!0,title:(0,i.jsx)(f,{content:"title"}),form:(0,i.jsx)(u.default,{applyButton:!1,mutation:e,onSubmit:({sync:e})=>({forced:"forced"===e}),submitButton:{"data-type":"dns-sync-apply"},values:{sync:"safe"},children:(0,i.jsx)(c.FormFieldRadioButtons,{label:(0,i.jsx)(f,{content:"type-option"}),name:"sync",options:[{value:"safe",label:(0,i.jsx)(f,{content:"safe"})},{value:"forced",label:(0,i.jsx)(f,{content:"force"})}]})})})}}}]);
//# sourceMappingURL=dns-zone-sync.js.map?11708274481c3f9e160d