/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements.
 * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */
(window.alerting_bundle_jsonpfunction=window.alerting_bundle_jsonpfunction||[]).push([[5],{39:function(n,e,t){"use strict";t.d(e,"a",(function(){return d}));var a=t(14),i=t.n(a),r=t(32),c=t(6),o=t(31),s=t(35);const d=n=>{const e=n.rRule.dtstart,t=i()(e).add(n.duration),a=Object(c.has)(n,"rRule.interval"),d={title:n.title,startDate:e,endDate:t.toISOString(),timezone:[n.rRule.tzid],recurring:a,categoryIds:n.categoryIds||[]};if(!a)return d;const l=n.rRule,y=u(l),b=l.freq,w=l.until?o.d.ON_DATE:l.count?o.d.AFTER_X:o.d.NEVER,j={frequency:y?"CUSTOM":b,interval:l.interval,ends:w};return y&&(j.customFrequency=b),l.until&&(j.until=l.until),l.count&&(j.count=l.count),b!==r.a.MONTHLY&&l.byweekday&&(j.byweekday=Object(s.a)(l.byweekday,i()(e))),b===r.a.MONTHLY&&(l.byweekday?j.bymonth="weekday":l.bymonthday&&(j.bymonth="day")),d.recurringSchedule=j,d},u=n=>{const e=n.freq;return!(!(n.interval&&n.interval>1)&&(!e||e!==r.a.DAILY||n.byweekday)&&!(e&&e===r.a.WEEKLY&&n.byweekday&&n.byweekday.length>1)&&(!e||e!==r.a.MONTHLY||!n.bymonthday))}},40:function(n,e,t){"use strict";t.d(e,"a",(function(){return r})),t(11);var a=t(13),i=t(12);const r=({size:n})=>Object(i.jsx)(a.EuiFlexGroup,{"data-test-subj":"center-justified-spinner",justifyContent:"center"},Object(i.jsx)(a.EuiFlexItem,{grow:!1},Object(i.jsx)(a.EuiLoadingSpinner,{size:n||"xl"})))},58:function(n,e,t){"use strict";t.r(e),t.d(e,"MaintenanceWindowsEditPage",(function(){return m})),t.d(e,"default",(function(){return m}));var a=t(11),i=t.n(a),r=t(17),c=t(13),o=t(36),s=t(33),d=t(29),u=t(41),l=t(48),y=t(1),b=t(0),w=t(15),j=t(30);var g=t(39);var E=t(40),O=t(12);const m=i.a.memo((()=>{const{navigateToMaintenanceWindows:n}=Object(s.c)();Object(o.a)(y.MAINTENANCE_WINDOW_DEEP_LINK_IDS.maintenanceWindowsEdit);const{maintenanceWindowId:e}=Object(r.useParams)(),{maintenanceWindow:t,isLoading:a,isError:i}=(n=>{const{http:e,notifications:{toasts:t}}=Object(j.a)().services,{isInitialLoading:a,isLoading:i,data:r,isError:c}=Object(w.useQuery)({queryKey:["getMaintenanceWindow",n],queryFn:async()=>{const t=await async function({http:n,maintenanceWindowId:e}){return(({r_rule:n,category_ids:e,...t})=>({...t,categoryIds:e,rRule:n}))(await n.get(`${y.INTERNAL_BASE_ALERTING_API_PATH}/rules/maintenance_window/${encodeURIComponent(e)}`))}({http:e,maintenanceWindowId:n});return Object(g.a)(t)},onError:()=>{t.addDanger(b.i18n.translate("xpack.alerting.getMaintenanceWindowFailure",{defaultMessage:"Unable to get maintenance window."}))},refetchOnWindowFocus:!1,retry:!1,cacheTime:0});return{maintenanceWindow:r,isLoading:i||a,isError:c}})(e);return i&&n(),!t||a?Object(O.jsx)(E.a,null):Object(O.jsx)(c.EuiPageSection,{restrictWidth:!0},Object(O.jsx)(u.b,{showBackButton:!0,title:d.hb}),Object(O.jsx)(c.EuiSpacer,{size:"xl"}),Object(O.jsx)(l.a,{initialValue:t,maintenanceWindowId:e,onCancel:n,onSuccess:n}))}));m.displayName="MaintenanceWindowsEditPage"}}]);