/*! 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.indexLifecycleManagement_bundle_jsonpfunction=window.indexLifecycleManagement_bundle_jsonpfunction||[]).push([[1],Array(35).concat([function(e,t,a){"use strict";var i,l=function(){var e={};return function(t){if(void 0===e[t]){var a=document.querySelector(t);if(window.HTMLIFrameElement&&a instanceof window.HTMLIFrameElement)try{a=a.contentDocument.head}catch(e){a=null}e[t]=a}return e[t]}}(),s=[];function n(e){for(var t=-1,a=0;a1?t-1:0),i=1;i3?t.t-4:t.t:Array.isArray(e)?1:u(e)?2:m(e)?3:0}function o(e,t){return 2===n(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function r(e,t){return 2===n(e)?e.get(t):e[t]}function c(e,t,a){var i=n(e);2===i?e.set(t,a):3===i?(e.delete(t),e.add(a)):e[t]=a}function d(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function u(e){return q&&e instanceof Map}function m(e){return V&&e instanceof Set}function p(e){return e.i||e.u}function h(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=X(e);delete t[J];for(var a=Q(t),i=0;i1&&(e.set=e.add=e.clear=e.delete=x),Object.freeze(e),t&&s(e,(function(e,t){return f(t,!0)}),!0)),e}function x(){a(2)}function g(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function b(e){var t=Z[e];return t||a(18,e),t}function j(e,t){Z[e]||(Z[e]=t)}function y(){return B}function v(e,t){t&&(b("Patches"),e.o=[],e.v=[],e.s=t)}function O(e){M(e),e.p.forEach(_),e.p=null}function M(e){e===B&&(B=e.l)}function P(e){return B={p:[],l:B,h:e,_:!0,m:0}}function _(e){var t=e[J];0===t.t||1===t.t?t.j():t.O=!0}function w(e,t){t.m=t.p.length;var i=t.p[0],s=void 0!==e&&e!==i;return t.h.S||b("ES5").P(t,e,s),s?(i[J].M&&(O(t),a(4)),l(e)&&(e=k(t,e),t.l||L(t,e)),t.o&&b("Patches").g(i[J].u,e,t.o,t.v)):e=k(t,i,[]),O(t),t.o&&t.s(t.o,t.v),e!==H?e:void 0}function k(e,t,a){if(g(t))return t;var i=t[J];if(!i)return s(t,(function(l,s){return T(e,i,t,l,s,a)}),!0),t;if(i.A!==e)return t;if(!i.M)return L(e,i.u,!0),i.u;if(!i.R){i.R=!0,i.A.m--;var l=4===i.t||5===i.t?i.i=h(i.k):i.i;s(3===i.t?new Set(l):l,(function(t,s){return T(e,i,l,t,s,a)})),L(e,l,!1),a&&e.o&&b("Patches").F(i,a,e.o,e.v)}return i.i}function T(e,t,a,s,n,r){if(i(n)){var d=k(e,n,r&&t&&3!==t.t&&!o(t.D,s)?r.concat(s):void 0);if(c(a,s,d),!i(d))return;e._=!1}if(l(n)&&!g(n)){if(!e.h.K&&e.m<1)return;k(e,n),t&&t.A.l||L(e,n)}}function L(e,t,a){void 0===a&&(a=!1),e.h.K&&e._&&f(t,a)}function S(e,t){var a=e[J];return(a?p(a):e)[t]}function E(e,t){if(t in e)for(var a=Object.getPrototypeOf(e);a;){var i=Object.getOwnPropertyDescriptor(a,t);if(i)return i;a=Object.getPrototypeOf(a)}}function F(e){e.M||(e.M=!0,e.l&&F(e.l))}function C(e){e.i||(e.i=h(e.u))}function z(e,t,a){var i=u(t)?b("MapSet").$(t,a):m(t)?b("MapSet").C(t,a):e.S?function(e,t){var a=Array.isArray(e),i={t:a?1:0,A:t?t.A:y(),M:!1,R:!1,D:{},l:t,u:e,k:null,i:null,j:null,I:!1},l=i,s=ee;a&&(l=[i],s=te);var n=Proxy.revocable(l,s),o=n.revoke,r=n.proxy;return i.k=r,i.j=o,r}(t,a):b("ES5").J(t,a);return(a?a.A:y()).p.push(i),i}function A(e){return i(e)||a(22,e),function e(t){if(!l(t))return t;var a,i=t[J],o=n(t);if(i){if(!i.M&&(i.t<4||!b("ES5").N(i)))return i.u;i.R=!0,a=D(t,o),i.R=!1}else a=D(t,o);return s(a,(function(t,l){i&&r(i.u,t)===l||c(a,t,e(l))})),3===o?new Set(a):a}(e)}function D(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return h(e)}function I(){function e(e,t){var a=n[e];return a?a.enumerable=t:n[e]=a={configurable:!0,enumerable:t,get:function(){return ee.get(this[J],e)},set:function(t){ee.set(this[J],e,t)}},a}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][J];if(!i.M)switch(i.t){case 5:l(i)&&F(i);break;case 4:a(i)&&F(i)}}}function a(e){for(var t=e.u,a=e.k,i=Q(a),l=i.length-1;l>=0;l--){var s=i[l];if(s!==J){var n=t[s];if(void 0===n&&!o(t,s))return!0;var r=a[s],c=r&&r[J];if(c?c.u!==n:!d(r,n))return!0}}var u=!!t[J];return i.length!==Q(t).length+(u?0:1)}function l(e){var t=e.k;if(t.length!==e.u.length)return!0;var a=Object.getOwnPropertyDescriptor(t,t.length-1);if(a&&!a.get)return!0;for(var i=0;i1?a-1:0),s=1;s1?i-1:0),s=1;s=0;a--){var l=t[a];if(0===l.path.length&&"replace"===l.op){e=l.value;break}}a>-1&&(t=t.slice(a+1));var s=b("Patches").W;return i(e)?s(e,t):this.produce(e,(function(e){return s(e,t)}))},e}(),ie=new ae,le=ie.produce,se=ie.produceWithPatches.bind(ie),ne=ie.setAutoFreeze.bind(ie),oe=ie.setUseProxies.bind(ie),re=ie.applyPatches.bind(ie),ce=ie.createDraft.bind(ie),de=ie.finishDraft.bind(ie);t.Immer=ae,t.applyPatches=re,t.castDraft=function(e){return e},t.castImmutable=function(e){return e},t.createDraft=ce,t.current=A,t.default=le,t.enableAllPlugins=function(){I(),R(),N()},t.enableES5=I,t.enableMapSet=R,t.enablePatches=N,t.finishDraft=de,t.freeze=f,t.immerable=G,t.isDraft=i,t.isDraftable=l,t.nothing=H,t.original=function(e){return i(e)||a(23,e),e[J].u},t.produce=le,t.produceWithPatches=se,t.setAutoFreeze=ne,t.setUseProxies=oe},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(50);case"v8light":return a(52)}},function(e,t,a){var i=a(35),l=a(51);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmTimeline{overflow:hidden;width:100%}.ilmTimeline__phasesContainer{display:inline-block;margin-top:8px;width:100%}.ilmTimeline__phasesContainer__phase:first-child{padding-left:0;padding-right:8px}.ilmTimeline__phasesContainer__phase:last-child{padding-left:8px;padding-right:0}.ilmTimeline__phasesContainer__phase:only-child{padding-left:0;padding-right:0}.ilmTimeline__phasesContainer__phase{display:inline-block;padding-left:8px;padding-right:8px}.ilmTimeline__deleteIconContainer{background-color:#25262e;border-radius:50%;color:#98a2b3;margin-left:12px;padding:12px}.ilmTimeline__colorBar{border-radius:4px;display:inline-block;height:8px;margin-bottom:4px;margin-top:8px;width:100%}.ilmTimeline__hotPhase{width:var(--ilm-timeline-hot-phase-width)}.ilmTimeline__hotPhase__colorBar{background-color:#e7664c}.ilmTimeline__warmPhase{width:var(--ilm-timeline-warm-phase-width)}.ilmTimeline__warmPhase__colorBar{background-color:#d6bf57}.ilmTimeline__coldPhase{width:var(--ilm-timeline-cold-phase-width)}.ilmTimeline__coldPhase__colorBar{background-color:#6092c0}.ilmTimeline__frozenPhase{width:var(--ilm-timeline-frozen-phase-width)}.ilmTimeline__frozenPhase__colorBar{background-color:#ca8eae}",""]),e.exports=t},function(e,t,a){var i=a(35),l=a(53);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmTimeline{overflow:hidden;width:100%}.ilmTimeline__phasesContainer{display:inline-block;margin-top:8px;width:100%}.ilmTimeline__phasesContainer__phase:first-child{padding-left:0;padding-right:8px}.ilmTimeline__phasesContainer__phase:last-child{padding-left:8px;padding-right:0}.ilmTimeline__phasesContainer__phase:only-child{padding-left:0;padding-right:0}.ilmTimeline__phasesContainer__phase{display:inline-block;padding-left:8px;padding-right:8px}.ilmTimeline__deleteIconContainer{background-color:#f5f7fa;border-radius:50%;color:#69707d;margin-left:12px;padding:12px}.ilmTimeline__colorBar{border-radius:4px;display:inline-block;height:8px;margin-bottom:4px;margin-top:8px;width:100%}.ilmTimeline__hotPhase{width:var(--ilm-timeline-hot-phase-width)}.ilmTimeline__hotPhase__colorBar{background-color:#e7664c}.ilmTimeline__warmPhase{width:var(--ilm-timeline-warm-phase-width)}.ilmTimeline__warmPhase__colorBar{background-color:#d6bf57}.ilmTimeline__coldPhase{width:var(--ilm-timeline-cold-phase-width)}.ilmTimeline__coldPhase__colorBar{background-color:#6092c0}.ilmTimeline__frozenPhase{width:var(--ilm-timeline-frozen-phase-width)}.ilmTimeline__frozenPhase__colorBar{background-color:#ca8eae}",""]),e.exports=t},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(55);case"v8light":return a(57)}},function(e,t,a){var i=a(35),l=a(56);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".indexLifecycleManagement__phase__dataTierAllocation__controlSection{background-color:#25262e;padding:12px}",""]),e.exports=t},function(e,t,a){var i=a(35),l=a(58);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".indexLifecycleManagement__phase__dataTierAllocation__controlSection{background-color:#f5f7fa;padding:12px}",""]),e.exports=t},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(60);case"v8light":return a(62)}},function(e,t,a){var i=a(35),l=a(61);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmDataTierAllocationField{max-width:400px}",""]),e.exports=t},function(e,t,a){var i=a(35),l=a(63);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmDataTierAllocationField{max-width:400px}",""]),e.exports=t},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(65);case"v8light":return a(67)}},function(e,t,a){var i=a(35),l=a(66);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmSearchableSnapshotField{max-width:400px}",""]),e.exports=t},function(e,t,a){var i=a(35),l=a(68);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmSearchableSnapshotField{max-width:400px}",""]),e.exports=t},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(70);case"v8light":return a(72)}},function(e,t,a){var i=a(35),l=a(71);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmPhaseIcon{align-items:center;background-color:#25262e;border-radius:50%;display:flex;height:32px;justify-content:center;width:32px}.ilmPhaseIcon--disabled{height:16px;margin:8px;width:16px}.ilmPhaseIcon--delete{background-color:#343741}.ilmPhaseIcon__inner--hot{fill:#ff7e62}.ilmPhaseIcon__inner--warm{fill:#f1d86f}.ilmPhaseIcon__inner--cold{fill:#79aad9}.ilmPhaseIcon__inner--frozen{fill:#e4a6c7}.ilmPhaseIcon__inner--delete{fill:#98a2b3}.ilmPhaseIcon__inner--disabled{fill:#535966}",""]),e.exports=t},function(e,t,a){var i=a(35),l=a(73);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmPhaseIcon{align-items:center;background-color:#f5f7fa;border-radius:50%;display:flex;height:32px;justify-content:center;width:32px}.ilmPhaseIcon--disabled{height:16px;margin:8px;width:16px}.ilmPhaseIcon--delete{background-color:#d3dae6}.ilmPhaseIcon__inner--hot{fill:#ff7e62}.ilmPhaseIcon__inner--warm{fill:#f1d86f}.ilmPhaseIcon__inner--cold{fill:#79aad9}.ilmPhaseIcon__inner--frozen{fill:#e4a6c7}.ilmPhaseIcon__inner--delete{fill:#69707d}.ilmPhaseIcon__inner--disabled{fill:#98a2b3}",""]),e.exports=t},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(75);case"v8light":return a(77)}},function(e,t,a){var i=a(35),l=a(76);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmSettingsAccordion .ilmSettingsButton{color:#36a2ef;padding-bottom:8px;padding-top:8px}",""]),e.exports=t},function(e,t,a){var i=a(35),l=a(78);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmSettingsAccordion .ilmSettingsButton{color:#07c;padding-bottom:8px;padding-top:8px}",""]),e.exports=t},function(e,t,a){switch(window.__kbnThemeTag__){case"v8dark":return a(80);case"v8light":return a(82)}},function(e,t,a){var i=a(35),l=a(81);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmPhaseRequiredBadge{max-width:150px}.ilmPhaseTitle{min-width:100px}",""]),e.exports=t},function(e,t,a){var i=a(35),l=a(83);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);i(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},function(e,t,a){(t=a(36)(!1)).push([e.i,".ilmPhaseRequiredBadge{max-width:150px}.ilmPhaseTitle{min-width:100px}",""]),e.exports=t},function(e,t,a){"use strict";a.r(t),a.d(t,"renderApp",(function(){return Ga}));var i=a(6),l=a.n(i),s=a(33),n=a(24),o=a(25),r=a(29),c=a(26),d=a(16),u=a(30);const m=()=>Object(n.useKibana)();var p=a(27),h=a(37),f=a.n(h);const x={services:{}},g=Object(i.createContext)(x);var b=a(39),j=a.n(b),y=a(0);const v=({children:e,component:t,render:a,...s})=>{const n=Object(i.useMemo)((()=>{if(t)return e=>Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(O,null),Object(y.jsx)(t,e))}),[t]);if(n)return Object(y.jsx)(p.Route,f()({},s,{component:n}));if(a||"function"==typeof e){const t="function"==typeof e?e:a;return Object(y.jsx)(p.Route,f()({},s,{render:e=>Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(O,null),t(e))}))}return Object(y.jsx)(p.Route,s,Object(y.jsx)(O,null),e)},O=()=>{const{executionContext:e}=Object(i.useContext)(g).services,t=Object(p.useRouteMatch)();return function(e,t){j()((()=>(null==e||e.set(t),()=>{null==e||e.clear()})),[t])}(e,{type:"application",page:t.path,id:Object.keys(t.params).length>0?JSON.stringify(t.params):void 0}),null};var M=a(32);const P=({children:e,...t})=>Object(y.jsx)(p.Router,t,Object(y.jsx)(M.CompatRouter,null,e));var _=a(10);const w=({legacySwitch:e=!0,children:t})=>{const a=Object(p.useRouteMatch)();return e?Object(y.jsx)(p.Switch,null,t):Object(y.jsx)(M.Routes,null,i.Children.map(t,(e=>{if(l.a.isValidElement(e)&&e.type===v){var i;const s=Object(_.replace)(null==e?void 0:e.props.path,a.url+"/",""),n="function"==typeof(null==e?void 0:e.props.children)?null==e?void 0:e.props.children:null==e?void 0:e.props.render;return Object(y.jsx)(M.Route,{path:s,element:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(O,null),(null==e||null===(i=e.props)||void 0===i?void 0:i.component)&&Object(y.jsx)(e.props.component,null)||n&&n()||t)})}return e})))};var k=a(14),T=a(7),L=a(1),S=a(3),E=a(12),F=a(11);const C=e=>{let t="",a="";const i=/(\d+)(\w+)/.exec(e);return i&&(t=i[1],a=i[2]),{size:t,units:a}};var z=a(2),A=(a(43),a(8)),D=a(38);const I=(e={})=>{const{allocate:t,migrate:a}=e;return!1===(null==a?void 0:a.enabled)?"none":t&&(t.require&&Object.keys(t.require).length||t.include&&Object.keys(t.include).length||t.exclude&&Object.keys(t.exclude).length)?"node_attrs":"node_roles"},N=e=>{var t,a,i;const l=null==e||null===(t=e.phases)||void 0===t||null===(a=t.hot)||void 0===a||null===(i=a.actions)||void 0===i?void 0:i.rollover;return Boolean(l&&l.max_age===T.p.max_age&&l.max_docs===T.p.max_docs&&l.max_primary_shard_size===T.p.max_primary_shard_size&&l.max_primary_shard_docs===T.p.max_primary_shard_docs)};var R=a(28),U=a.n(R);const B=["hot","warm","cold","frozen","delete"],$=(e,t)=>{var a,i;return{min_age:null!==(a=t.phases)&&void 0!==a&&null!==(i=a[e])&&void 0!==i&&i.min_age?t.phases[e].min_age+t._meta[e].minAgeUnit:"0ms"}},q=(e,t)=>{let a;return a="micros"===t?parseInt(e,10)/1e3:"nanos"===t?parseInt(e,10)/1e6:U.a.duration(e,t).asMilliseconds(),a},V=e=>{var t;return 0===e.length?"":Boolean(null===(t=e[0])||void 0===t?void 0:t.snapshot_repository)?e[0].snapshot_repository:V(e.slice(1))},W="_meta.hot.customRollover.enabled",H="_meta.hot.isUsingDefaultRollover",G=e=>`_meta.${e}.downsample.enabled`,J={maxDocs:"phases.hot.actions.rollover.max_docs",maxAge:"phases.hot.actions.rollover.max_age",maxSize:"phases.hot.actions.rollover.max_size",maxPrimaryShardSize:"phases.hot.actions.rollover.max_primary_shard_size",maxPrimaryShardDocs:"phases.hot.actions.rollover.max_primary_shard_docs"},K="found-snapshots",Y=[{value:"gb",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.byteSizeUnits.gigabytesLabel",{defaultMessage:"gigabytes"})},{value:"mb",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.byteSizeUnits.megabytesLabel",{defaultMessage:"megabytes"})},{value:"b",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.byteSizeUnits.bytesLabel",{defaultMessage:"bytes"})},{value:"kb",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.byteSizeUnits.kilobytesLabel",{defaultMessage:"kilobytes"})},{value:"tb",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.byteSizeUnits.terabytesLabel",{defaultMessage:"terabytes"})},{value:"pb",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.byteSizeUnits.petabytesLabel",{defaultMessage:"petabytes"})}],Q=[{value:"d",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.timeUnits.daysLabel",{defaultMessage:"days"})},{value:"h",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.timeUnits.hoursLabel",{defaultMessage:"hours"})},{value:"m",text:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.timeUnits.minutesLabel",{defaultMessage:"minutes"})}],X=({dataTierAllocationType:e,allocationNodeAttribute:t},a={},i={},l)=>{var s,n;const{allocate:o,migrate:r,...c}=a,d={...c};if(o){const{include:e,exclude:t,require:a,number_of_replicas:i,...l}=o;Object(_.isEmpty)(l)||(d.allocate={...l})}switch(e){case"node_attrs":if(t){const[e,a]=t.split(":");d.allocate={...d.allocate,require:{[e]:a}}}else d.migrate=i.migrate;var u,m;Object(_.isEmpty)(null==i||null===(s=i.allocate)||void 0===s?void 0:s.include)||(d.allocate={...d.allocate,include:{...null==i||null===(u=i.allocate)||void 0===u?void 0:u.include}}),Object(_.isEmpty)(null==i||null===(n=i.allocate)||void 0===n?void 0:n.exclude)||(d.allocate={...d.allocate,exclude:{...null==i||null===(m=i.allocate)||void 0===m?void 0:m.exclude}});break;case"none":d.migrate={...null==i?void 0:i.migrate,enabled:!1}}return null!=l&&(d.allocate={...d.allocate,number_of_replicas:l}),d},Z={editPolicy:{shrinkLabel:z.i18n.translate("xpack.indexLifecycleMgmt.shrink.enableShrinkLabel",{defaultMessage:"Shrink index"}),shrinkCountLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.shrink.configureShardCountLabel",{defaultMessage:"Configure shard count"}),shrinkSizeLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.shrink.configureShardSizeLabel",{defaultMessage:"Configure shard size"}),rolloverOffsetsHotPhaseTiming:z.i18n.translate("xpack.indexLifecycleMgmt.rollover.rolloverOffsetsPhaseTimingDescription",{defaultMessage:"How long it takes to reach the rollover criteria in the hot phase can vary."}),searchableSnapshotInHotPhase:{searchableSnapshotDisallowed:{calloutTitle:z.i18n.translate("xpack.indexLifecycleMgmt.searchableSnapshot.disallowedCalloutTitle",{defaultMessage:"Searchable snapshot disabled"}),calloutBody:z.i18n.translate("xpack.indexLifecycleMgmt.searchableSnapshot.disallowedCalloutBody",{defaultMessage:"To use searchable snapshot in this phase you must disable searchable snapshot in the hot phase."})}},forceMergeEnabledFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.forcemerge.enableLabel",{defaultMessage:"Force merge data"}),readonlyEnabledFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.readonlyFieldLabel",{defaultMessage:"Make index read only"}),downsampleEnabledFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.downsampleFieldLabel",{defaultMessage:"Enable downsampling"}),downsampleIntervalFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.downsampleIntervalFieldLabel",{defaultMessage:"Downsampling interval"}),downsampleIntervalFieldUnitsLabel:z.i18n.translate("xpack.indexLifecycleMgmt.downsampleIntervalFieldUnitsLabel",{defaultMessage:"Downsampling interval units"}),maxNumSegmentsFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.forceMerge.numberOfSegmentsLabel",{defaultMessage:"Number of segments"}),indexPriorityFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.indexPriorityLabel",{defaultMessage:"Index priority"}),bestCompressionFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.forcemerge.bestCompressionLabel",{defaultMessage:"Compress stored fields"}),bestCompressionFieldHelpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.forceMerge.bestCompressionText",{defaultMessage:"Use higher compression for stored fields at the cost of slower performance."}),allocationTypeOptionsFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.dataTierAllocation.allocationFieldLabel",{defaultMessage:"Data tier options"}),allocationNodeAttributeFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.dataTierAllocation.nodeAllocationFieldLabel",{defaultMessage:"Select a node attribute"}),searchableSnapshotsRepoFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotRepoFieldLabel",{defaultMessage:"Snapshot repository"}),searchableSnapshotsStorageFieldLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotStorageFieldLabel",{defaultMessage:"Searchable snapshot storage"}),maxPrimaryShardSizeLabel:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.maximumPrimaryShardSizeLabel",{defaultMessage:"Maximum primary shard size"}),maxPrimaryShardDocsLabel:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.maximumPrimaryShardDocsLabel",{defaultMessage:"Maximum docs in the primary shard"}),maxPrimaryShardSizeUnitsLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.maximumPrimaryShardSizeAriaLabel",{defaultMessage:"Maximum shard size units"}),errors:{numberRequired:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.numberRequiredErrorMessage",{defaultMessage:"A number is required."}),numberGreatThan0Required:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.numberAboveZeroRequiredError",{defaultMessage:"Only numbers above 0 are allowed."}),integerRequired:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.integerRequiredError",{defaultMessage:"Only integers are allowed."}),maximumAgeRequiredMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.maximumAgeMissingError",{defaultMessage:"A maximum age is required."}),maximumSizeRequiredMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.maximumIndexSizeMissingError",{defaultMessage:"A maximum index size is required."}),maximumDocumentsRequiredMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.maximumDocumentsMissingError",{defaultMessage:"Maximum documents is required."}),maximumPrimaryShardSizeRequiredMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.maximumPrimaryShardSizeMissingError",{defaultMessage:"A maximum primary shard size is required"}),maximumPrimaryShardDocsRequiredMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.maximumPrimaryShardDocsMissingError",{defaultMessage:"Maximum documents in the primary shard is required"}),rollOverConfigurationCallout:{title:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.rolloverConfigurationError.title",{defaultMessage:"Invalid rollover configuration"}),body:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.rolloverConfigurationError.body",{defaultMessage:"A value for one of maximum primary shard size, maximum documents, maximum age or maximum index size is required."})},nonNegativeNumberRequired:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.nonNegativeNumberRequiredError",{defaultMessage:"Only non-negative numbers are allowed."}),policyNameContainsInvalidChars:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.errors.policyNameContainsInvalidCharsError",{defaultMessage:"A policy name cannot contain spaces or commas."}),policyNameAlreadyUsedErrorMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.policyNameAlreadyUsedError",{defaultMessage:"That policy name is already used."}),policyNameMustBeDifferentErrorMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.differentPolicyNameRequiredError",{defaultMessage:"The policy name must be different."}),policyNameRequiredMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.policyNameRequiredError",{defaultMessage:"A policy name is required."}),policyNameStartsWithUnderscoreErrorMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.policyNameStartsWithUnderscoreError",{defaultMessage:"A policy name cannot start with an underscore."}),policyNameTooLongErrorMessage:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.policyNameTooLongError",{defaultMessage:"A policy name cannot be longer than 255 bytes."}),searchableSnapshotRepoRequired:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotRepoRequiredError",{defaultMessage:"A snapshot repository name is required."})},titles:{hot:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.hotPhase.hotPhaseTitle",{defaultMessage:"Hot phase"}),warm:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.warmPhase.warmPhaseTitle",{defaultMessage:"Warm phase"}),cold:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.coldPhase.coldPhaseTitle",{defaultMessage:"Cold phase"}),frozen:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.frozenPhase.frozenPhaseTitle",{defaultMessage:"Frozen phase"}),delete:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.deletePhase.deletePhaseTitle",{defaultMessage:"Delete phase"})},descriptions:{hot:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.hotPhase.hotPhaseDescription",{defaultMessage:"Store your most recent, most frequently-searched data in the hot tier. The hot tier provides the best indexing and search performance by using the most powerful, expensive hardware."}),warm:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.warmPhase.warmPhaseDescription",{defaultMessage:"Move data to the warm tier when you are still likely to search it, but infrequently need to update it. The warm tier is optimized for search performance over indexing performance."}),cold:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.coldPhase.coldPhaseDescription",{defaultMessage:"Move data to the cold tier when you are searching it less often and don’t need to update it. The cold tier is optimized for cost savings over search performance."}),frozen:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.frozenPhase.frozenPhaseDescription",{defaultMessage:"Move data to the frozen tier for long term retention. The frozen tier provides the most cost-effective way store your data and still be able to search it."}),delete:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.deletePhase.deletePhaseDescription",{defaultMessage:"Delete data you no longer need."})}}},{numberGreaterThanField:ee,containsCharsField:te,emptyField:ae,startsWithField:ie}=r.fieldValidators,le=({than:e,message:t})=>a=>{if(a.value)return ee({than:e,message:t})({...a,value:parseInt(a.value,10)})},se=le({than:0,message:Z.editPolicy.errors.numberGreatThan0Required}),ne=le({than:-1,message:Z.editPolicy.errors.nonNegativeNumberRequired}),oe="ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE",re=Object.values(J),ce=({form:e,path:t})=>{const a=e.getFields();if(!re.some((e=>{var t;return Boolean(null===(t=a[e])||void 0===t?void 0:t.value)}))){const e={code:oe,message:""};switch(t){case J.maxAge:e.message=Z.editPolicy.errors.maximumAgeRequiredMessage;break;case J.maxDocs:e.message=Z.editPolicy.errors.maximumDocumentsRequiredMessage;break;case J.maxPrimaryShardSize:e.message=Z.editPolicy.errors.maximumPrimaryShardSizeRequiredMessage;break;case J.maxPrimaryShardDocs:e.message=Z.editPolicy.errors.maximumPrimaryShardDocsRequiredMessage;break;default:e.message=Z.editPolicy.errors.maximumSizeRequiredMessage}return e}re.forEach((e=>{var t;null===(t=a[e])||void 0===t||t.clearErrors(oe)}))},de=e=>{var t;if(!Number.isInteger(Number(null!==(t=e.value)&&void 0!==t?t:"")))return{message:Z.editPolicy.errors.integerRequired}},ue=e=>({formData:t})=>{if("warm"===e)return;const a=e=>{const a=t[`_meta.${e}.minAgeToMilliSeconds`];return{milli:a,esFormat:a>=0?t[`phases.${e}.min_age`]+t[`_meta.${e}.minAgeUnit`]:void 0}},i={warm:a("warm"),cold:a("cold"),frozen:a("frozen"),delete:a("delete")},l={greaterThanWarmPhase:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.minAgeSmallerThanWarmPhaseError",{defaultMessage:"Must be greater or equal than the warm phase value ({value})",values:{value:i.warm.esFormat}}),greaterThanColdPhase:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.minAgeSmallerThanColdPhaseError",{defaultMessage:"Must be greater or equal than the cold phase value ({value})",values:{value:i.cold.esFormat}}),greaterThanFrozenPhase:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.minAgeSmallerThanFrozenPhaseError",{defaultMessage:"Must be greater or equal than the frozen phase value ({value})",values:{value:i.frozen.esFormat}})};if("cold"===e)return i.warm.milli>=0&&i.cold.milli=0&&i.frozen.milli=0&&i.frozen.milli=0&&i.delete.milli=0&&i.delete.milli=0&&i.delete.milli({formData:t})=>{if("hot"===e)return;const a=e=>{const a=t[`_meta.${e}.downsample.fixedIntervalSize`],i=t[`_meta.${e}.downsample.fixedIntervalUnits`];return a&&i?{milliseconds:U.a.duration(a,i).asMilliseconds(),esFormat:a+i}:null},i={hot:a("hot"),warm:a("warm"),cold:a("cold")},l=(e,t)=>e>t&&e%t==0;if("warm"===e&&i.warm&&i.hot&&!l(i.warm.milliseconds,i.hot.milliseconds))return{message:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.downsamplePreviousIntervalWarmPhaseError",{defaultMessage:"Must be greater than and a multiple of the hot phase value ({value})",values:{value:i.hot.esFormat}})};if("cold"===e&&i.cold)if(i.warm){if(!l(i.cold.milliseconds,i.warm.milliseconds))return{message:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.downsamplePreviousIntervalColdPhaseWarmError",{defaultMessage:"Must be greater than and a multiple of the warm phase value ({value})",values:{value:i.warm.esFormat}})}}else if(i.hot&&!l(i.cold.milliseconds,i.hot.milliseconds))return{message:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.downsamplePreviousIntervalColdPhaseHotError",{defaultMessage:"Must be greater than and a multiple of the hot phase value ({value})",values:{value:i.hot.esFormat}})}},pe=Object.values(J),{emptyField:he,numberGreaterThanField:fe}=r.fieldValidators,xe={stringToNumber:e=>null!=e?parseInt(e,10):void 0},ge={label:Z.editPolicy.maxNumSegmentsFieldLabel,validations:[{validator:he(z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.forcemerge.numberOfSegmentsRequiredError",{defaultMessage:"A value for number of segments is required."}))},{validator:se}],serializer:xe.stringToNumber},be={snapshot_repository:{label:Z.editPolicy.searchableSnapshotsRepoFieldLabel,validations:[{validator:he(Z.editPolicy.errors.searchableSnapshotRepoRequired)}],helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshot.repositoryHelpText",{defaultMessage:"Each phase uses the same snapshot repository."})},storage:{label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshot.storageLabel",{defaultMessage:"Storage"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshot.storageHelpText",{defaultMessage:"Type of snapshot mounted for the searchable snapshot. This is an advanced option. Only change it if you know what you're doing."})}},je={label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.numberOfReplicasLabel",{defaultMessage:"Number of replicas"}),validations:[{validator:he(Z.editPolicy.errors.numberRequired)},{validator:ne}],serializer:xe.stringToNumber},ye={label:z.i18n.translate("xpack.indexLifecycleMgmt.shrink.numberOfPrimaryShardsLabel",{defaultMessage:"Number of primary shards"}),defaultValue:1,validations:[{validator:he(Z.editPolicy.errors.numberRequired)},{validator:fe({message:Z.editPolicy.errors.numberGreatThan0Required,than:0})}],serializer:xe.stringToNumber},ve={label:Z.editPolicy.maxPrimaryShardSizeLabel,validations:[{validator:he(Z.editPolicy.errors.numberRequired)},{validator:fe({message:Z.editPolicy.errors.numberGreatThan0Required,than:0})}],serializer:xe.stringToNumber},Oe=e=>({defaultValue:T.n[e],label:Z.editPolicy.indexPriorityFieldLabel,validations:[{validator:he(Z.editPolicy.errors.numberRequired)},{validator:ne}],serializer:xe.stringToNumber}),Me=(e,t)=>({defaultValue:t,fieldsToValidateOnChange:[],validations:[{validator:he(Z.editPolicy.errors.numberRequired)},{validator:ne},{validator:de},{validator:ue(e)}]}),Pe=(e,t=!0)=>{const a=["hot","warm","cold"];return(i=e,a.slice(a.indexOf(i)+(t?0:1))).map((e=>`_meta.${e}.downsample.fixedIntervalSize`));var i},_e=e=>({enabled:{defaultValue:!1,label:Z.editPolicy.downsampleEnabledFieldLabel,fieldsToValidateOnChange:Pe(e,!1)},fixedIntervalSize:{label:Z.editPolicy.downsampleIntervalFieldLabel,fieldsToValidateOnChange:Pe(e),validations:[{validator:he(Z.editPolicy.errors.numberRequired)},{validator:se},{validator:de},{validator:me(e)}]},fixedIntervalUnits:{defaultValue:"d",fieldsToValidateOnChange:Pe(e)}}),we=Object(i.createContext)(null),ke="phases.hot.actions.searchable_snapshot.snapshot_repository",Te="phases.cold.actions.searchable_snapshot.snapshot_repository",Le=({children:e})=>{const[t]=Object(o.useFormData)({watch:[ke,Te,W,H,G("hot"),G("warm"),G("cold")]}),a=Object(_.get)(t,H),i=Object(_.get)(t,W,!0),l={isUsingRollover:!1!==a||i,isUsingSearchableSnapshotInHotPhase:null!=Object(_.get)(t,ke),isUsingSearchableSnapshotInColdPhase:null!=Object(_.get)(t,Te),isUsingDownsampleInHotPhase:!!Object(_.get)(t,G("hot")),isUsingDownsampleInWarmPhase:!!Object(_.get)(t,G("warm")),isUsingDownsampleInColdPhase:!!Object(_.get)(t,G("cold"))};return Object(y.jsx)(we.Provider,{value:l},e)},Se=()=>{const e=Object(i.useContext)(we);if(!e)throw new Error("Cannot use configuration outside of configuration context");return e},Ee=Object(i.createContext)(null),Fe=()=>({hasErrors:!1,hot:{},warm:{},cold:{},frozen:{},delete:{},other:{}}),Ce=({children:e})=>{const[t,a]=Object(i.useState)(Fe),l=Object(o.useFormContext)(),{getErrors:s,isSubmitted:n}=l,r=Object(i.useCallback)(((e,t,i)=>{a((a=>({...a,hasErrors:!0,[e]:{...a[e],[t]:i}})))}),[a]),c=Object(i.useCallback)(((e,t)=>{s().length?a((a=>{const{[e]:{[t]:i,...l},hasErrors:s,...n}=a,o=Object.keys(l).length>0||Object.values(n).some((e=>Object.keys(e).length>0));return{...a,hasErrors:o,[e]:l}})):a(Fe)}),[s,a]);return Object(y.jsx)(Ee.Provider,{value:{errors:t,addError:r,clearError:c,isFormSubmitted:n}},e)},ze=()=>{const e=Object(i.useContext)(Ee);if(!e)throw new Error("useFormErrorsContext can only be used inside of FormErrorsProvider");return e},Ae=e=>{var t,a,i,l,s,n;const o=null==e||null===(t=e._meta)||void 0===t||null===(a=t.warm)||void 0===a?void 0:a.enabled,r=null==e||null===(i=e._meta)||void 0===i||null===(l=i.cold)||void 0===l?void 0:l.enabled,c=null==e||null===(s=e._meta)||void 0===s||null===(n=s.frozen)||void 0===n?void 0:n.enabled;return{hot:{isFinalDataPhase:!o&&!r&&!c},warm:{isFinalDataPhase:o&&!r&&!c},cold:{isFinalDataPhase:r&&!c},frozen:{isFinalDataPhase:c}}},De=Object(i.createContext)(null),Ie=({children:e})=>{const{deleteEnabled:t}=$e(),[a]=Object(o.useFormData)({watch:["_meta.warm.enabled","_meta.cold.enabled","_meta.frozen.enabled","_meta.delete.enabled"]});return Object(y.jsx)(De.Provider,{value:{...Ae(a),isDeletePhaseEnabled:t.value,setDeletePhaseEnabled:t.setValue}},e)},Ne=()=>{const e=Object(i.useContext)(De);if(!e)throw new Error("Cannot use phase timings outside of phase timings context");return e},Re=Object(i.createContext)(null),Ue={deleteEnabled:{path:"_meta.delete.enabled"},searchableSnapshotRepo:{path:"_meta.searchableSnapshot.repository"},warmMinAgeMilliSeconds:{path:"_meta.warm.minAgeToMilliSeconds"},coldMinAgeMilliSeconds:{path:"_meta.cold.minAgeToMilliSeconds"},frozenMinAgeMilliSeconds:{path:"_meta.frozen.minAgeToMilliSeconds"},deleteMinAgeMilliSeconds:{path:"_meta.delete.minAgeToMilliSeconds"},hotIsUsingShardSize:{path:"_meta.hot.shrink.isUsingShardSize"},warmIsUsingShardSize:{path:"_meta.warm.shrink.isUsingShardSize"}},Be=({children:e})=>Object(y.jsx)(o.UseMultiFields,{fields:Ue},(t=>Object(y.jsx)(Re.Provider,{value:t},e))),$e=()=>{const e=Object(i.useContext)(Re);if(!e)throw new Error("Cannot use global fields outside of global fields context");return e},qe=({form:e,children:t})=>Object(y.jsx)(o.Form,{form:e},Object(y.jsx)(Le,null,Object(y.jsx)(Ce,null,Object(y.jsx)(Be,null,Object(y.jsx)(Ie,null,t))))),Ve=e=>t=>t.startsWith(`phases.${e}`)||t.startsWith(`_meta.${e}`),We=Ve("hot"),He=Ve("warm"),Ge=Ve("cold"),Je=Ve("frozen"),Ke=Ve("delete"),Ye=e=>{const{path:t}=e,a=Object(i.useRef)(!1),l=Object(i.useMemo)((()=>{return We(e=t)?"hot":He(e)?"warm":Ge(e)?"cold":Je(e)?"frozen":Ke(e)?"delete":"other";var e}),[t]),{addError:s,clearError:n}=ze(),r=Object(i.useCallback)((e=>{a.current&&(e?s(l,t,e):n(l,t))}),[l,t,s,n]);return Object(i.useEffect)((()=>(a.current=!0,()=>{a.current=!1})),[]),Object(i.useEffect)((()=>()=>{!1===a.current&&n(l,t)}),[l,t,n]),Object(y.jsx)(o.UseField,f()({},e,{onError:r}))};var Qe=a(9),Xe=a(15);const Ze=({docPath:e,text:t})=>{const a=t||Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.learnMore",defaultMessage:"Learn more"});return Object(y.jsx)(L.EuiLink,{href:e,target:"_blank",external:!0},a)},et=()=>Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.optionalMessage",defaultMessage:" (optional)"}),tt=({policyName:e,close:t})=>{const[a,s]=Object(i.useState)(void 0),{validate:n,getErrors:r}=Object(o.useFormContext)(),[,c]=Object(o.useFormData)(),d=Object(i.useCallback)((async()=>{s(void 0);const e=await n(),t=r(),a=1===t.length&&t[0]===Z.editPolicy.errors.policyNameRequiredMessage;var i;s(e||a?{phases:{hot:(i=c()).phases.hot,warm:i.phases.warm,cold:i.phases.cold,frozen:i.phases.frozen,delete:i.phases.delete},_meta:i._meta}:null)}),[s,c,n,r]);let u;switch(Object(i.useEffect)((()=>{d()}),[d]),a){case void 0:u=Object(y.jsx)(L.EuiLoadingSpinner,null);break;case null:u=Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"policyRequestInvalidAlert",iconType:"warning",color:"danger",title:z.i18n.translate("xpack.indexLifecycleMgmt.policyJsonFlyout.validationErrorCallout.title",{defaultMessage:"Invalid policy"})},z.i18n.translate("xpack.indexLifecycleMgmt.policyJsonFlyout.validationErrorCallout.body",{defaultMessage:"To view the JSON for this policy address all validation errors."}));break;default:const t=`PUT _ilm/policy/${e||""}\n${JSON.stringify({policy:{...a}},null,2)}`;u=Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiText,null,Object(y.jsx)("p",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyJsonFlyout.descriptionText",defaultMessage:"This Elasticsearch request will create or update this index lifecycle policy."}))),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(L.EuiCodeBlock,{language:"json",isCopyable:!0,"data-test-subj":"policyRequestJson"},t))}return Object(y.jsx)(L.EuiFlyout,{maxWidth:480,onClose:t},Object(y.jsx)(L.EuiFlyoutHeader,null,Object(y.jsx)(L.EuiTitle,null,Object(y.jsx)("h2",null,e?Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyJsonFlyout.namedTitle",defaultMessage:"Request for '{policyName}'",values:{policyName:e}}):Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyJsonFlyout.unnamedTitle",defaultMessage:"Request"})))),Object(y.jsx)(L.EuiFlyoutBody,null,u),Object(y.jsx)(L.EuiFlyoutFooter,null,Object(y.jsx)(L.EuiButtonEmpty,{iconType:"cross",onClick:t,flush:"left","data-test-subj":"policyRequestClose"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyJsonFlyout.closeButtonLabel",defaultMessage:"Close"}))))},at=({children:e,switchProps:t,description:a,fieldNotices:s,...n})=>{var o;if(t&&"boolean"!=typeof t.checked&&"boolean"!=typeof t.initialValue)throw new Error("Must specify controlled, uncontrolled component. See SwitchProps interface!");const[r,c]=Object(i.useState)((()=>{var e;return null!==(e=null==t?void 0:t.initialValue)&&void 0!==e&&e})),d=Boolean(void 0===t||(null!==(o=null==t?void 0:t.checked)&&void 0!==o?o:r));return Object(y.jsx)(L.EuiDescribedFormGroup,f()({},n,{description:Object(y.jsx)(l.a.Fragment,null,a,Object(y.jsx)(L.EuiSpacer,{size:"m"}),(()=>{if(!t)return null;const{onChange:e,checked:a,initialValue:i,...l}=t;return Object(y.jsx)(L.EuiSwitch,f()({},l,{checked:d,onChange:t=>{const a=t.target.checked;c(a),e&&e(a)}}))})(),s)}),d?"function"==typeof e?e():e:null)},it=({switchProps:e,...t})=>Object(y.jsx)(Ye,{path:e.path},(a=>Object(y.jsx)(at,f()({},t,{switchProps:{...e,label:a.label,checked:a.value,onChange:a.setValue}})))),lt=e=>{const{title:t,body:a,resendRequest:i}=e;return Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"m"}),Object(y.jsx)(L.EuiCallOut,{"data-test-subj":e["data-test-subj"],iconType:"help",color:"warning",title:Object(y.jsx)(l.a.Fragment,null,t,Object(y.jsx)(L.EuiButtonIcon,{size:"s",color:"warning",onClick:i,iconType:"refresh","aria-label":e["aria-label"]}))},a))},st=({phaseName:e,durationInPhase:t})=>Object(y.jsx)(L.EuiFlexGroup,{alignItems:"center",justifyContent:"flexStart",gutterSize:"s"},Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiText,{size:"s"},Object(y.jsx)("strong",null,e))),Object(y.jsx)(L.EuiFlexItem,{grow:!1},"string"==typeof t?Object(y.jsx)(L.EuiText,{size:"s"},t):t));a(49);const nt=e=>null!=e,ot=(e,t)=>e/t*100,rt=(e,t)=>isFinite(e)?0===t?100:ot(e,t):100,ct={title:z.i18n.translate("xpack.indexLifecycleMgmt.timeline.title",{defaultMessage:"Policy summary"}),description:z.i18n.translate("xpack.indexLifecycleMgmt.timeline.description",{defaultMessage:"This policy moves data through the following phases."}),hotPhase:z.i18n.translate("xpack.indexLifecycleMgmt.timeline.hotPhaseSectionTitle",{defaultMessage:"Hot phase"}),warmPhase:z.i18n.translate("xpack.indexLifecycleMgmt.timeline.warmPhaseSectionTitle",{defaultMessage:"Warm phase"}),coldPhase:z.i18n.translate("xpack.indexLifecycleMgmt.timeline.coldPhaseSectionTitle",{defaultMessage:"Cold phase"}),frozenPhase:z.i18n.translate("xpack.indexLifecycleMgmt.timeline.frozenPhaseSectionTitle",{defaultMessage:"Frozen phase"}),deleteIcon:{toolTipContent:z.i18n.translate("xpack.indexLifecycleMgmt.timeline.deleteIconToolTipContent",{defaultMessage:"Policy deletes the index after lifecycle phases complete."})},foreverIcon:{ariaLabel:z.i18n.translate("xpack.indexLifecycleMgmt.timeline.foreverIconToolTipContent",{defaultMessage:"Forever"})}},dt=Object(i.memo)((({hasDeletePhase:e,isUsingRollover:t,...a})=>{const i={hot:{min_age:a.hotPhaseMinAge},warm:a.warmPhaseMinAge?{min_age:a.warmPhaseMinAge}:void 0,cold:a.coldPhaseMinAge?{min_age:a.coldPhaseMinAge}:void 0,frozen:a.frozenPhaseMinAge?{min_age:a.frozenPhaseMinAge}:void 0,delete:a.deletePhaseMinAge?{min_age:a.deletePhaseMinAge}:void 0},l=(s=i,B.reduce(((e,t,a)=>{var i;if("delete"===t)return e;if(!s[t])return e;const l=B.slice(a+1).find((e=>Boolean(s[e])));let n=1/0;if(l&&null!==(i=s[l])&&void 0!==i&&i.min_age){const{units:e,size:t}=C(s[l].min_age);n=q(t,e)}return{total:Math.max(e.total,n),phases:{...e.phases,[t]:Math.max(n-e.total,0)}}}),{total:0,phases:{hot:0,warm:s.warm?0:void 0,cold:s.cold?0:void 0,frozen:s.frozen?0:void 0}}));var s;const n=(e=>{const t=rt(e.phases.hot,e.total)+50,a=null!=e.phases.warm?rt(e.phases.warm,e.total)+50:0,i=null!=e.phases.cold?rt(e.phases.cold,e.total)+50:0,l=null!=e.phases.frozen?rt(e.phases.frozen,e.total)+50:0,s=t+a+i+l;return{hot:`${ot(t,s)}%`,warm:`${ot(a,s)}%`,cold:`${ot(i,s)}%`,frozen:`${ot(l,s)}%`}})(l),o=e=>l.phases[e]===1/0?Object(y.jsx)(bt,{color:"subdued","aria-label":ct.foreverIcon.ariaLabel}):null,{docLinks:r}=m().services;return Object(y.jsx)(L.EuiFlexGroup,{gutterSize:"s",direction:"column",responsive:!1},Object(y.jsx)(L.EuiFlexItem,null,Object(y.jsx)(L.EuiTitle,{size:"s"},Object(y.jsx)("h2",null,ct.title)),Object(y.jsx)(L.EuiText,{size:"s",color:"subdued"},ct.description," ",Object(y.jsx)(Ze,{docPath:r.links.elasticsearch.ilmPhaseTransitions,text:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.learnAboutTimingText",defaultMessage:"Learn about timing"})}))),Object(y.jsx)(L.EuiFlexItem,null,Object(y.jsx)("div",{className:"ilmTimeline",ref:e=>{var t,a,i;e&&(e.style.setProperty("--ilm-timeline-hot-phase-width",n.hot),e.style.setProperty("--ilm-timeline-warm-phase-width",null!==(t=n.warm)&&void 0!==t?t:null),e.style.setProperty("--ilm-timeline-cold-phase-width",null!==(a=n.cold)&&void 0!==a?a:null),e.style.setProperty("--ilm-timeline-frozen-phase-width",null!==(i=n.frozen)&&void 0!==i?i:null))}},Object(y.jsx)(L.EuiFlexGroup,{gutterSize:"none",alignItems:"flexStart",responsive:!1},Object(y.jsx)(L.EuiFlexItem,null,Object(y.jsx)("div",{className:"ilmTimeline__phasesContainer"},Object(y.jsx)("div",{"data-test-subj":"ilmTimelinePhase-hot",className:"ilmTimeline__phasesContainer__phase ilmTimeline__hotPhase"},Object(y.jsx)("div",{className:"ilmTimeline__colorBar ilmTimeline__hotPhase__colorBar"}),Object(y.jsx)(st,{phaseName:ct.hotPhase,durationInPhase:o("hot")})),nt(l.phases.warm)&&Object(y.jsx)("div",{"data-test-subj":"ilmTimelinePhase-warm",className:"ilmTimeline__phasesContainer__phase ilmTimeline__warmPhase"},Object(y.jsx)("div",{className:"ilmTimeline__colorBar ilmTimeline__warmPhase__colorBar"}),Object(y.jsx)(st,{phaseName:ct.warmPhase,durationInPhase:o("warm")})),nt(l.phases.cold)&&Object(y.jsx)("div",{"data-test-subj":"ilmTimelinePhase-cold",className:"ilmTimeline__phasesContainer__phase ilmTimeline__coldPhase"},Object(y.jsx)("div",{className:"ilmTimeline__colorBar ilmTimeline__coldPhase__colorBar"}),Object(y.jsx)(st,{phaseName:ct.coldPhase,durationInPhase:o("cold")})),nt(l.phases.frozen)&&Object(y.jsx)("div",{"data-test-subj":"ilmTimelinePhase-frozen",className:"ilmTimeline__phasesContainer__phase ilmTimeline__frozenPhase"},Object(y.jsx)("div",{className:"ilmTimeline__colorBar ilmTimeline__frozenPhase__colorBar"}),Object(y.jsx)(st,{phaseName:ct.frozenPhase,durationInPhase:o("frozen")})))),e&&Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)("div",{"data-test-subj":"ilmTimelinePhase-delete",className:"ilmTimeline__deleteIconContainer"},Object(y.jsx)(L.EuiIconTip,{type:"trash",content:ct.deleteIcon.toolTipContent})))))))})),ut=()=>{var e,t,a,i,l,s;const[n]=Object(o.useFormData)(),r=(e=>{var t;const{_meta:a}=e;return a?{hot:{min_age:void 0},warm:a.warm.enabled?$("warm",e):void 0,cold:a.cold.enabled?$("cold",e):void 0,frozen:null!==(t=a.frozen)&&void 0!==t&&t.enabled?$("frozen",e):void 0,delete:a.delete.enabled?$("delete",e):void 0}:{hot:{min_age:void 0}}})(n),{isUsingRollover:c}=Se();return Object(y.jsx)(dt,{hotPhaseMinAge:r.hot.min_age,warmPhaseMinAge:null===(e=r.warm)||void 0===e?void 0:e.min_age,coldPhaseMinAge:null===(t=r.cold)||void 0===t?void 0:t.min_age,frozenPhaseMinAge:null===(a=r.frozen)||void 0===a?void 0:a.min_age,deletePhaseMinAge:null===(i=r.delete)||void 0===i?void 0:i.min_age,isUsingRollover:c,hasDeletePhase:Boolean(null===(l=n._meta)||void 0===l||null===(s=l.delete)||void 0===s?void 0:s.enabled)})},mt={callout:{title:z.i18n.translate("xpack.indexLifecycleMgmt.policyErrorCalloutTitle",{defaultMessage:"This policy contains errors"}),body:z.i18n.translate("xpack.indexLifecycleMgmt.policyErrorCalloutDescription",{defaultMessage:"Please fix all errors before saving the policy."})}},pt=()=>{const{errors:{hasErrors:e},isFormSubmitted:t}=ze();return t&&e?Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"policyFormErrorsCallout",color:"danger",title:mt.callout.title},mt.callout.body),Object(y.jsx)(L.EuiSpacer,null)):null},ht=e=>Object(y.jsx)("svg",f()({viewBox:"0 0 16 16","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none"},e),Object(y.jsx)("defs",null),Object(y.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.44354 9.86928c-.47429.46802-1.12585.75702-1.84475.75702-1.45038 0-2.626143-1.17576-2.626143-2.62614S2.14841 5.37401 3.59879 5.37401c.71899 0 1.37049.28893 1.84473.75702l.00033-.00033.27438.27438L7.31327 8.0001l-.00001.00001.68777.68777.00001-.00002 1.86843 1.86844-.00078.0007c.65021.6442 1.54481 1.042 2.53251 1.042C14.3888 11.599 16 9.98772 16 8.00016s-1.6112-3.59879-3.5988-3.59879c-.9876 0-1.8822.39779-2.53249 1.04188l.00072.00073-.76518.76516.68777.68777.79978-.79975-.0002-.00017c.471-.44801 1.1082-.72298 1.8096-.72298 1.4504 0 2.6262 1.17577 2.6262 2.62615s-1.1758 2.62614-2.6262 2.62614c-.7012 0-1.3384-.2749-1.8094-.72282l.0002-.00024L8.68881 8.0001l.00278-.00277-.68777-.68777-.00278.00278-1.90297-1.90295-.0007.0007c-.64728-.62456-1.52806-1.00872-2.49858-1.00872C1.61124 4.40137 0 6.0126 0 8.00016 0 9.98772 1.61124 11.599 3.59879 11.599c.97055 0 1.85122-.3841 2.49844-1.0086l.00065.0006.80272-.8027-.68777-.68777-.76902.76901-.00027-.00026z"})),ft=z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseTiming.beforeDeleteDescription",{defaultMessage:"Delete data after this phase"}),xt=z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseTiming.foreverTimingDescription",{defaultMessage:"Keep data in this phase forever"}),gt=({phase:e})=>{const{isDeletePhaseEnabled:t,setDeletePhaseEnabled:a,[e]:i}=Ne();if(!i.isFinalDataPhase)return null;const l=t?"ilmEnableDeletePhaseButton":"ilmDisableDeletePhaseButton",s=[{id:"ilmDisableDeletePhaseButton",label:xt,iconType:ht},{id:"ilmEnableDeletePhaseButton",label:ft,iconType:"trash","data-test-subj":"enableDeletePhaseButton"}];return Object(y.jsx)(L.EuiFlexGroup,{alignItems:"center",gutterSize:"s",wrap:!0},Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiText,{size:"s",color:"subdued"},t?ft:xt)),Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiButtonGroup,{legend:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.deletePhase.buttonGroupLegend",{defaultMessage:"Enable or disable delete phase"}),options:s,idSelected:l,onChange:e=>{a("ilmEnableDeletePhaseButton"===e)},isIconOnly:!0})))},bt=e=>Object(y.jsx)(L.EuiIcon,f()({type:ht},e)),jt=Object(i.createContext)(null),yt=({value:e,children:t})=>Object(y.jsx)(jt.Provider,{value:e},t),vt=()=>{const e=Object(i.useContext)(jt);if(!e)throw new Error("useEditPolicyContext can only be called inside of EditPolicyContext!");return e};var Ot=a(13),Mt=a(17);const Pt=({policyName:e,indexTemplates:t,close:a})=>{const{services:{getUrlForApp:i}}=m();return Object(y.jsx)(L.EuiFlyout,{onClose:a},Object(y.jsx)(L.EuiFlyoutHeader,{hasBorder:!0},Object(y.jsx)(L.EuiTitle,{size:"m","data-test-subj":"indexTemplatesFlyoutHeader"},Object(y.jsx)("h2",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.indexTemplatesFlyout.headerText",defaultMessage:"Index templates that apply {policyName}",values:{policyName:e}})))),Object(y.jsx)(L.EuiFlyoutBody,null,Object(y.jsx)(L.EuiInMemoryTable,{pagination:!0,items:null!=t?t:[],columns:[{name:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.indexTemplatesTable.nameHeader",{defaultMessage:"Index template name"}),render:e=>{return Object(y.jsx)(L.EuiLink,{"data-test-subj":"indexTemplateLink",className:"eui-textBreakAll",href:(t=e,i("management",{path:`data/index_management${Object(Mt.getTemplateDetailsLink)(t)}`}))},e);var t}}]})),Object(y.jsx)(L.EuiFlyoutFooter,null,Object(y.jsx)(L.EuiButtonEmpty,{iconType:"cross",onClick:a,flush:"left"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.indexTemplatesFlyout.closeButtonLabel",defaultMessage:"Close"}))))},_t=()=>{var e;const{isNewPolicy:t,indices:a,indexTemplates:s,policyName:n,policy:o}=vt(),{services:{getUrlForApp:r}}=m(),[c,d]=Object(i.useState)(!1);if(t)return null;const u=a.length>0?Object(y.jsx)(L.EuiLink,{"data-test-subj":"linkedIndicesLink",external:!0,href:Object(Ot.b)(null!=n?n:"",r),target:"_blank"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.linkedIndices",defaultMessage:"{indicesCount, plural, one {# linked index} other {# linked indices}}",values:{indicesCount:a.length}})):null,p=s.length>0?Object(y.jsx)(L.EuiLink,{"data-test-subj":"linkedIndexTemplatesLink",onClick:()=>d(!c)},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.linkedIndexTemplates",defaultMessage:"{indexTemplatesCount, plural, one {# linked index template} other {# linked index templates}}",values:{indexTemplatesCount:s.length}})):null,h=u?Object(y.jsx)(l.a.Fragment,null,u,p?Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.andDependenciesLink",defaultMessage:" and {indexTemplatesLink}",values:{indexTemplatesLink:p}}):null):p,f=null==o||null===(e=o._meta)||void 0===e?void 0:e.managed;return Object(y.jsx)(l.a.Fragment,null,c&&Object(y.jsx)(Pt,{policyName:null!=n?n:"",indexTemplates:s,close:()=>d(!1)}),Object(y.jsx)(L.EuiText,{"data-test-subj":"editWarning"},f&&Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiCallOut,{title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicyModal.proceedWithCautionCallOutTitle",defaultMessage:"Editing a managed policy can break Kibana"}),color:"danger",iconType:"warning","data-test-subj":"editManagedPolicyCallOut"},Object(y.jsx)("p",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicyModal.proceedWithCautionCallOutDescription",defaultMessage:"Managed policies are critical for internal operations."}))),Object(y.jsx)(L.EuiSpacer,null)),Object(y.jsx)("p",null,Object(y.jsx)("strong",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.editingExistingPolicyMessage",defaultMessage:"You are editing an existing policy."})),h?Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.dependenciesMessage",defaultMessage:" Any changes you make will affect {dependenciesLinks} that {count, plural, one {is} other {are}} attached to this policy.",values:{dependenciesLinks:h,count:a.length+s.length}}):null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.saveAsNewMessage",defaultMessage:" Alternatively, you can save these changes in a new policy."}))))},wt=({close:e,selectedNodeAttrs:t})=>{const{data:a,isLoading:i,error:l,resendRequest:s}=Object(F.i)(t);let n;if(i)n=Object(y.jsx)(L.EuiSkeletonText,{lines:3});else if(l){const{statusCode:e,message:t}=l;n=Object(y.jsx)(L.EuiCallOut,{title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.nodeDetailsLoadingFailedTitle",defaultMessage:"Unable to load node attribute details"}),color:"danger"},Object(y.jsx)("p",null,t," (",e,")"),Object(y.jsx)(L.EuiButton,{onClick:s,iconType:"refresh",color:"danger"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.nodeDetailsReloadButton",defaultMessage:"Try again"})))}else n=Object(y.jsx)(L.EuiInMemoryTable,{items:a||[],columns:[{field:"nodeId",name:z.i18n.translate("xpack.indexLifecycleMgmt.nodeAttrDetails.idField",{defaultMessage:"ID"})},{field:"stats.name",name:z.i18n.translate("xpack.indexLifecycleMgmt.nodeAttrDetails.nameField",{defaultMessage:"Name"})},{field:"stats.host",name:z.i18n.translate("xpack.indexLifecycleMgmt.nodeAttrDetails.hostField",{defaultMessage:"Host"})}],pagination:!0,sorting:!0});return Object(y.jsx)(L.EuiPortal,null,Object(y.jsx)(L.EuiFlyout,{ownFocus:!0,onClose:e},Object(y.jsx)(L.EuiFlyoutBody,null,Object(y.jsx)(L.EuiTitle,null,Object(y.jsx)("h2",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.nodeAttrDetails.title",defaultMessage:"Nodes that contain the attribute {selectedNodeAttrs}",values:{selectedNodeAttrs:t}}))),Object(y.jsx)(L.EuiSpacer,{size:"s"}),n)))},kt={allocateToDataNodesOption:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.nodeAllocation.allocateToDataNodesOption",{defaultMessage:"Any data node"})},Tt=({phase:e,nodes:t,isLoading:a,isCloudEnabled:s,isUsingDeprecatedDataRoleConfig:n})=>{const r=`_meta.${e}.allocationNodeAttribute`,[d]=Object(o.useFormData)({watch:[r]}),{docLinks:u}=m().services,p=u.links.elasticsearch.shardAllocationSettings,h=Object(_.get)(d,r),[f,x]=Object(i.useState)(null),g=Object.keys(t).map((e=>({text:`${e} (${t[e].length})`,value:e})));g.sort(((e,t)=>e.value.localeCompare(t.value)));let b=[];if(!s||n){const e={text:kt.allocateToDataNodesOption,value:""};b.push(e)}return b=b.concat(g),Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiText,{size:"s"},Object(y.jsx)("p",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.nodeAllocation.customOption.description",defaultMessage:"Use node attributes to control shard allocation. {learnMoreLink}.",values:{learnMoreLink:Object(y.jsx)(Ze,{text:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.learnAboutShardAllocationLink",defaultMessage:"Learn about shard allocation"}),docPath:p})}}))),Object(y.jsx)(L.EuiSpacer,{size:"m"}),Object(y.jsx)(Ye,{path:`_meta.${e}.allocationNodeAttribute`,component:c.SelectField,componentProps:{helpText:h?Object(y.jsx)(L.EuiButtonEmpty,{size:"xs",style:{maxWidth:400},"data-test-subj":`${e}-viewNodeDetailsFlyoutButton`,flush:"left",onClick:()=>x(h)},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.viewNodeDetailsButton",defaultMessage:"View nodes with the selected attribute"})):void 0,euiFieldProps:{"data-test-subj":`${e}-selectedNodeAttrs`,options:b,hasNoInitialSelection:!1,isLoading:a}}}),f?Object(y.jsx)(wt,{selectedNodeAttrs:f,close:()=>x(null)}):null)};a(54);const Lt={inputDisplay:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.customOption.input",{defaultMessage:"Custom"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.customOption.helpText",{defaultMessage:"Move data based on node attributes."})},St={allocationOptions:{warm:{default:{input:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.warm.defaultOption.input",{defaultMessage:"Use warm nodes (recommended)"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.warm.defaultOption.helpText",{defaultMessage:"Move data to nodes in the warm tier."})},none:{inputDisplay:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.warm.noneOption.input",{defaultMessage:"Off"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.warm.noneOption.helpText",{defaultMessage:"Do not move data in the warm phase."})},custom:Lt},cold:{default:{input:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.cold.defaultOption.input",{defaultMessage:"Use cold nodes (recommended)"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.cold.defaultOption.helpText",{defaultMessage:"Move data to nodes in the cold tier."})},none:{inputDisplay:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.cold.noneOption.input",{defaultMessage:"Off"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.cold.noneOption.helpText",{defaultMessage:"Do not move data in the cold phase."})},custom:Lt},frozen:{default:{input:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.frozen.defaultOption.input",{defaultMessage:"Use frozen nodes (recommended)"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.frozen.defaultOption.helpText",{defaultMessage:"Move data to nodes in the frozen tier."})},none:{inputDisplay:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.frozen.noneOption.input",{defaultMessage:"Off"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.common.dataTierAllocation.frozen.noneOption.helpText",{defaultMessage:"Do not move data in the frozen phase."})},custom:Lt}}},Et=(e,t)=>[t?void 0:{"data-test-subj":"defaultDataAllocationOption",value:"node_roles",inputDisplay:St.allocationOptions[e].default.input,dropdownDisplay:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)("strong",null,St.allocationOptions[e].default.input),Object(y.jsx)(L.EuiText,{size:"s",color:"subdued"},Object(y.jsx)("p",null,St.allocationOptions[e].default.helpText)))},{"data-test-subj":"customDataAllocationOption",value:"node_attrs",inputDisplay:St.allocationOptions[e].custom.inputDisplay,dropdownDisplay:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)("strong",null,St.allocationOptions[e].custom.inputDisplay),Object(y.jsx)(L.EuiText,{size:"s",color:"subdued"},Object(y.jsx)("p",null,St.allocationOptions[e].custom.helpText)))},{"data-test-subj":"noneDataAllocationOption",value:"none",inputDisplay:St.allocationOptions[e].none.inputDisplay,dropdownDisplay:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)("strong",null,St.allocationOptions[e].none.inputDisplay),Object(y.jsx)(L.EuiText,{size:"s",color:"subdued"},Object(y.jsx)("p",null,St.allocationOptions[e].none.helpText)))}].filter(Boolean),Ft=e=>{const{phase:t,hasNodeAttributes:a,isCloudEnabled:i,isUsingDeprecatedDataRoleConfig:s,isLoading:n}=e,r=Boolean(i&&s),d=`_meta.${t}.dataTierAllocationType`,[u]=Object(o.useFormData)({watch:d}),m=Object(_.get)(u,d);return Object(y.jsx)("div",{"data-test-subj":`${t}-dataTierAllocationControls`},Object(y.jsx)(Ye,{path:d},(e=>(r&&"node_roles"===e.value&&e.setValue("node_attrs"),Object(y.jsx)(c.SuperSelectField,{field:e,euiFieldProps:{isLoading:n,hasDividers:!0,"data-test-subj":"dataTierSelect",options:Et(t,r)}})))),"node_attrs"===m&&a&&Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)("div",{className:"indexLifecycleManagement__phase__dataTierAllocation__controlSection"},Object(y.jsx)(Tt,e))))},Ct={data_hot:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.dataTierHotLabel",{defaultMessage:"hot"}),data_warm:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.dataTierWarmLabel",{defaultMessage:"warm"})},zt={warm:{title:z.i18n.translate("xpack.indexLifecycleMgmt.warmPhase.dataTier.willUseFallbackTierTitle",{defaultMessage:"No nodes assigned to the warm tier"}),body:e=>z.i18n.translate("xpack.indexLifecycleMgmt.warmPhase.dataTier.willUseFallbackTierDescription",{defaultMessage:"If no warm nodes are available, data is stored in the {tier} tier.",values:{tier:Ct[e]}})},cold:{title:z.i18n.translate("xpack.indexLifecycleMgmt.coldPhase.dataTier.willUseFallbackTierTitle",{defaultMessage:"No nodes assigned to the cold tier"}),body:e=>z.i18n.translate("xpack.indexLifecycleMgmt.coldPhase.dataTier.willUseFallbackTierDescription",{defaultMessage:"If no cold nodes are available, data is stored in the {tier} tier.",values:{tier:Ct[e]}})}},At=({phase:e,targetNodeRole:t})=>Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"willUseFallbackTierNotice",title:zt[e].title},zt[e].body(t)),Dt=z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.noCustomAttributesTitle",{defaultMessage:"No custom attributes defined"}),It=({docLinks:e})=>Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.defaultToDataNodesDescription",defaultMessage:"To allocate data to particular data nodes, {roleBasedGuidance} or configure custom node attributes in elasticsearch.yml.",values:{roleBasedGuidance:Object(y.jsx)(L.EuiLink,{href:e.links.elasticsearch.migrateIndexAllocationFilters,target:"_blank",external:!0},z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.defaultToDataNodesDescription.migrationGuidanceMessage",{defaultMessage:"use role-based allocation"}))}}),Nt=({phase:e,targetNodeRole:t})=>Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"willUseFallbackTierUsingNodeAttributesNotice",title:Dt},Object(y.jsx)("p",null,z.i18n.translate("xpack.indexLifecycleMgmt.dataTier.willUseFallbackTierUsingNodeAttributesDescription",{defaultMessage:"No {phase} nodes available. Data will be allocated to the {fallbackTier} tier.",values:{phase:e,fallbackTier:Ct[t]}})),Object(y.jsx)("p",null,It)),Rt={warm:{title:z.i18n.translate("xpack.indexLifecycleMgmt.warmPhase.dataTier.noTiersAvailableTitle",{defaultMessage:"No nodes assigned to the warm tier"}),body:z.i18n.translate("xpack.indexLifecycleMgmt.warmPhase.dataTier.noTiersAvailableBody",{defaultMessage:"To use role-based allocation, assign one or more nodes to the warm or hot tiers. Allocation will fail if there are no available nodes."})},cold:{title:z.i18n.translate("xpack.indexLifecycleMgmt.coldPhase.dataTier.noTiersAvailableTitle",{defaultMessage:"No nodes assigned to the cold tier"}),body:z.i18n.translate("xpack.indexLifecycleMgmt.coldPhase.dataTier.noTiersAvailableBody",{defaultMessage:"To use role-based allocation, assign one or more nodes to the cold, warm, or hot tiers. Allocation will fail if there are no available nodes."})}},Ut=({phase:e})=>Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"noTiersAvailableNotice",title:Rt[e].title,color:"warning"},Rt[e].body),Bt=()=>Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"noTiersAvailableUsingNodeAttributesNotice",title:Dt,color:"warning"},Object(y.jsx)("p",null,z.i18n.translate("xpack.indexLifecycleMgmt.dataTier.noTiersAvailableUsingNodeAttributesDescription",{defaultMessage:"Unable to allocate data: no available data nodes."})),Object(y.jsx)("p",null,It)),$t={body:{warm:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)("p",null,z.i18n.translate("xpack.indexLifecycleMgmt.warmPhase.dataTier.defaultAllocationNotAvailableDescription",{defaultMessage:"Data will be allocated to the warm tier."})),It),cold:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)("p",null,z.i18n.translate("xpack.indexLifecycleMgmt.coldPhase.dataTier.defaultAllocationNotAvailableDescription",{defaultMessage:"Data will be allocated to the cold tier."})),It)}},qt=({phase:e})=>Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"defaultToDataTiersNotice",style:{maxWidth:400},title:Dt,color:"primary"},$t.body[e]),Vt=({phase:e})=>Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"defaultToDataNodesNotice",style:{maxWidth:400},title:Dt,color:"primary"},Object(y.jsx)("p",null,z.i18n.translate("xpack.indexLifecycleMgmt.warmPhase.dataTier.defaultToDataNodesDescription",{defaultMessage:"Data will be allocated to any available data node."})),It),Wt={title:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.cloudDataTierCallout.title",{defaultMessage:"Migrate to data tiers"}),body:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.cloudDataTierCallout.body",{defaultMessage:"Migrate your Elastic Cloud deployment to use data tiers."}),linkText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.cloudDataTierCallout.linkToCloudDeploymentDescription",{defaultMessage:"View cloud deployment"})},Ht=({linkToCloudDeployment:e})=>Object(y.jsx)(L.EuiCallOut,{title:Wt.title,"data-test-subj":"cloudDataTierCallout"},Wt.body," ",Boolean(e)&&Object(y.jsx)(L.EuiLink,{href:e,external:!0},Wt.linkText)),Gt=({statusCode:e,message:t,onResendRequest:a})=>Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(L.EuiCallOut,{title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.nodeAttributesLoadingFailedTitle",defaultMessage:"Unable to load node data"}),color:"danger"},Object(y.jsx)("p",null,t," (",e,")"),Object(y.jsx)(L.EuiButton,{onClick:a,iconType:"refresh",color:"danger"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.nodeAttributesReloadButton",defaultMessage:"Try again"}))),Object(y.jsx)(L.EuiSpacer,{size:"xl"}));a(59);const Jt={title:z.i18n.translate("xpack.indexLifecycleMgmt.common.dataTier.title",{defaultMessage:"Data allocation"})},Kt=({phase:e,description:t})=>{var a;const{services:{cloud:i}}=m(),s=`_meta.${e}.dataTierAllocationType`,[n]=Object(o.useFormData)({watch:s}),r=Object(_.get)(n,s),{data:c,resendRequest:d,error:u,isLoading:p}=Object(F.j)(),{nodesByRoles:h,nodesByAttributes:f,isUsingDeprecatedDataRoleConfig:x}=c,g=Boolean(Object.keys(null!=f?f:{}).length),b=null!==(a=null==i?void 0:i.isCloudEnabled)&&void 0!==a&&a,j=null==i?void 0:i.deploymentUrl,v=((e,t)=>{var a;const i=E.c[e];return null!==(a=t.data)&&void 0!==a&&a.length?i[0]:i.find((e=>{var a;return Boolean(null===(a=t[e])||void 0===a?void 0:a.length)}))})(e,h),O=void 0===v,M=void 0!==v&&!((e,t)=>E.c[e][0]===t)(e,v);return Object(y.jsx)(L.EuiDescribedFormGroup,{title:Object(y.jsx)("h3",null,Jt.title),description:Object(y.jsx)(l.a.Fragment,null,t,p?Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"m"}),Object(y.jsx)(L.EuiLoadingSpinner,{"data-test-subj":"allocationLoadingSpinner",size:"xl"})):u&&Object(y.jsx)(Gt,{onResendRequest:d,message:u.message,statusCode:u.statusCode})),fullWidth:!0},Object(y.jsx)("div",{className:"ilmDataTierAllocationField"},Object(y.jsx)(Ft,{hasNodeAttributes:g,phase:e,nodes:f,isCloudEnabled:b,isUsingDeprecatedDataRoleConfig:x,isLoading:p}),!p&&(()=>{switch(r){case"node_roles":if(b)return null;if(O)return Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(Ut,{phase:e}));if(M)return Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(At,{phase:e,targetNodeRole:v}));break;case"node_attrs":if(!g)return x?Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(Vt,{phase:e})):O?Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(Bt,null)):M?Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(Nt,{phase:e,targetNodeRole:v})):Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(qt,{phase:e}));if(b&&x)return Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(Ht,{linkToCloudDeployment:j}));break;default:return null}})()))};var Yt=a(34);const Qt=({phase:e})=>{const{policy:t}=vt(),a=Object(i.useMemo)((()=>{var a,i;return null!=(null===(a=t.phases[e])||void 0===a||null===(i=a.actions)||void 0===i?void 0:i.forcemerge)}),[t,e]),{docLinks:s}=m().services;return Object(y.jsx)(at,{title:Object(y.jsx)("h3",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.forceMerge.enableText",defaultMessage:"Force merge"})),description:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.forceMerge.enableExplanationText",defaultMessage:"Reduce the number of segments in each index shard and clean up deleted documents."})," ",Object(y.jsx)(Ze,{docPath:s.links.elasticsearch.ilmForceMerge})),titleSize:"xs",fullWidth:!0,switchProps:{label:Z.editPolicy.forceMergeEnabledFieldLabel,"data-test-subj":`${e}-forceMergeSwitch`,initialValue:a}},Object(y.jsx)(Ye,{path:`phases.${e}.actions.forcemerge.max_num_segments`,component:c.NumericField,componentProps:{fullWidth:!1,euiFieldProps:{"data-test-subj":`${e}-selectedForceMergeSegments`,min:1}}}),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(Ye,{path:`_meta.${e}.bestCompression`},(t=>Object(y.jsx)(L.EuiFlexGroup,{alignItems:"center",gutterSize:"s"},Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiCheckbox,{label:t.label,checked:t.value,onChange:t.onChange,"data-test-subj":`${e}-bestCompression`,id:Object(Yt.v4)()})),Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiIconTip,{content:Z.editPolicy.bestCompressionFieldHelpText,position:"right"}))))))};function Xt(e){switch(e){case"warm":return z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseWarm.minimumAgeUnitsAriaLabel",{defaultMessage:"Units for timing of warm phase"});case"cold":return z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseCold.minimumAgeUnitsAriaLabel",{defaultMessage:"Units for timing of cold phase"});case"frozen":return z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseFrozen.minimumAgeUnitsAriaLabel",{defaultMessage:"Units for timing of frozen phase"});case"delete":return z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseDelete.minimumAgeUnitsAriaLabel",{defaultMessage:"Units for timing of delete phase"})}}function Zt(e){switch(e){case"warm":return z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseWarm.minimumAgeLabel",{defaultMessage:"Timing for warm phase"});case"cold":return z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseCold.minimumAgeLabel",{defaultMessage:"Timing for cold phase"});case"frozen":return z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseFrozen.minimumAgeLabel",{defaultMessage:"Timing for frozen phase"});case"delete":return z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.phaseDelete.minimumAgeLabel",{defaultMessage:"Timing for delete phase"})}}const ea={rolloverToolTipDescription:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.minimumAge.rolloverToolTipDescription",{defaultMessage:"Data age is calculated from rollover. Rollover is configured in the hot phase."}),minAgeUnitFieldSuffix:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.minimumAge.minimumAgeFieldSuffixLabel",{defaultMessage:"old"})},ta=({phase:e})=>{const t=`phases.${e}.min_age`,a=`_meta.${e}.minAgeUnit`,{isUsingRollover:s}=Se(),n=$e(),{setValue:r}=n[`${e}MinAgeMilliSeconds`],[c]=Object(o.useFormData)({watch:[t,a]}),d=Object(_.get)(c,t),u=Object(_.get)(c,a);return Object(i.useEffect)((()=>{if(void 0===d)return;const e=""===d.trim()?-1:q(d,u);r(e)}),[d,u,r]),Object(i.useEffect)((()=>()=>{r(-1)}),[r]),Object(y.jsx)(Ye,{path:t},(t=>{const{isInvalid:i,errorMessage:n}=Object(o.getFieldValidityAndErrorMessage)(t);return Object(y.jsx)(L.EuiFormRow,{fullWidth:!0,isInvalid:i,error:n},Object(y.jsx)(L.EuiFlexGroup,{gutterSize:"s",alignItems:"center",justifyContent:"spaceBetween",wrap:!0},Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiText,{className:"eui-textNoWrap",size:"xs"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.minimumAge.minimumAgeFieldLabel",defaultMessage:"Move data into phase when:"}))),Object(y.jsx)(L.EuiFlexItem,{grow:!0},Object(y.jsx)(L.EuiFlexGroup,{gutterSize:"s"},Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiFieldNumber,{style:{minWidth:50},compressed:!0,"aria-label":Zt(e),isInvalid:i,value:t.value,onChange:t.onChange,isLoading:t.isValidating,"data-test-subj":`${e}-selectedMinimumAge`,min:0})),Object(y.jsx)(L.EuiFlexItem,{grow:!0,style:{minWidth:165}},Object(y.jsx)(Ye,{path:a},(t=>{const{isInvalid:a}=Object(o.getFieldValidityAndErrorMessage)(t),i=Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)("div",{"data-test-subj":`${e}-rolloverMinAgeInputIconTip`}),Object(y.jsx)(L.EuiIconTip,{type:"iInCircle","aria-label":ea.rolloverToolTipDescription,content:ea.rolloverToolTipDescription})),n=s?[ea.minAgeUnitFieldSuffix,i]:[ea.minAgeUnitFieldSuffix],r=t.value;let c=Q;return r&&!c.some((e=>e.value===r))&&(c=[...Q,{value:r,text:r}]),Object(y.jsx)(L.EuiSelect,{compressed:!0,value:r,onChange:e=>{t.setValue(e.target.value)},isInvalid:a,append:n,"data-test-subj":`${e}-selectedMinimumAgeUnits`,"aria-label":Xt(e),options:c})})))))))}))},aa="phases.delete.actions.wait_for_snapshot.policy",ia=()=>{const{services:{docLinks:e,getUrlForApp:t}}=m(),{error:a,isLoading:i,data:s,resendRequest:n}=Object(F.l)(),[r]=Object(o.useFormData)({watch:aa}),d=Object(_.get)(r,aa),u=s.map((e=>({label:e,value:e}))),p=()=>t("management",{path:"data/snapshot_restore/add_policy"});let h;return a?h=Object(y.jsx)(lt,{resendRequest:n,"data-test-subj":"policiesErrorCallout","aria-label":z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.deletePhase.reloadPoliciesLabel",{defaultMessage:"Reload policies"}),title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesLoadedTitle",defaultMessage:"Unable to load existing policies"}),body:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesLoadedMessage",defaultMessage:"Refresh this field and enter the name of an existing snapshot policy."})}):0===s.length?h=Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"m"}),Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"noPoliciesCallout",color:"warning",title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedTitle",defaultMessage:"No snapshot policies found"})},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedMessage",defaultMessage:"{link} to automate the creation and deletion of cluster snapshots.",values:{link:Object(y.jsx)(L.EuiLink,{href:p(),target:"_blank"},z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedLink",{defaultMessage:"Create a snapshot lifecycle policy"}))}}))):d&&!s.includes(d)&&(h=Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"m"}),Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"customPolicyCallout",color:"warning",title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyTitle",defaultMessage:"Policy name not found"})},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyMessage",defaultMessage:"Enter the name of an existing snapshot policy, or {link} with this name.",values:{link:Object(y.jsx)(L.EuiLink,{href:p(),target:"_blank"},z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyLink",{defaultMessage:"create a new policy"}))}})))),Object(y.jsx)(L.EuiDescribedFormGroup,{title:Object(y.jsx)("h3",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.waitForSnapshotTitle",defaultMessage:"Wait for snapshot policy"})),description:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.waitForSnapshotDescription",defaultMessage:"Specify a snapshot policy to be executed before the deletion of the index. This ensures that a snapshot of the deleted index is available."})," ",Object(y.jsx)(Ze,{docPath:e.links.elasticsearch.ilmWaitForSnapshot})),titleSize:"xs",fullWidth:!0},Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(Ye,{path:aa,componentProps:{label:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.waitForSnapshotLabel",defaultMessage:"Snapshot policy name"}),Object(y.jsx)(et,null))}},(e=>{const t=e.value?[e.value]:[];return Object(y.jsx)(c.ComboBoxField,{field:{...e,value:t},euiFieldProps:{"data-test-subj":"snapshotPolicyCombobox",fullWidth:!1,options:u,singleSelection:{asPlainText:!0},isLoading:i,noSuggestions:!(!a&&0!==s.length),onCreateOption:t=>{e.setValue(t)},onChange:t=>{t.length>0?e.setValue(t[0].label):e.setValue("")}}})})),h))},la=({path:e,options:t,euiFieldProps:a})=>{const[l,s]=Object(i.useState)(!1);return Object(y.jsx)(Ye,{key:e,path:e},(e=>{var i,n;return Object(y.jsx)(L.EuiPopover,f()({button:Object(y.jsx)(L.EuiButtonEmpty,{size:"xs",color:"text",iconSide:"right",iconType:"arrowDown",onClick:()=>s((e=>!e)),"data-test-subj":"show-filters-button"},null!==(i=null===(n=t.find((t=>t.value===e.value)))||void 0===n?void 0:n.text)&&void 0!==i?i:`${e.value}`),ownFocus:!0,panelPaddingSize:"none",isOpen:l,closePopover:()=>s(!1)},a),t.map((t=>Object(y.jsx)(L.EuiFilterSelectItem,{key:t.value,checked:e.value===t.value?"on":void 0,onClick:()=>{return a=t.value,e.setValue(a),void s(!1);var a},"data-test-subj":`filter-option-${t.value}`},t.text))))}))},sa=({phase:e})=>{var t,a;const i=$e(),{setValue:s}=i[`${e}IsUsingShardSize`],{policy:n}=vt(),r=`_meta.${e}.shrink.isUsingShardSize`,[d]=Object(o.useFormData)({watch:[r]}),u=Object(_.get)(d,r),p=`phases.${e}.actions.shrink.${u?"max_primary_shard_size":"number_of_shards"}`,{docLinks:h}=m().services;return Object(y.jsx)(at,{title:Object(y.jsx)("h3",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.shrinkText",defaultMessage:"Shrink"})),description:Object(y.jsx)(L.EuiTextColor,{color:"subdued"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.shrinkIndexExplanationText",defaultMessage:"Shrink the index to a new index with fewer primary shards."})," ",Object(y.jsx)(Ze,{docPath:h.links.elasticsearch.ilmShrink})),titleSize:"xs",switchProps:{"data-test-subj":`${e}-shrinkSwitch`,label:Z.editPolicy.shrinkLabel,initialValue:Boolean(null===(t=n.phases[e])||void 0===t||null===(a=t.actions)||void 0===a?void 0:a.shrink)},fullWidth:!0},void 0===u?null:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiRadioGroup,{options:[{id:`${e}-configureShardCount`,label:Z.editPolicy.shrinkCountLabel,"data-test-subj":`${e}-configureShardCount`},{id:`${e}-configureShardSize`,label:Z.editPolicy.shrinkSizeLabel,"data-test-subj":`${e}-configureShardSize`}],idSelected:u?`${e}-configureShardSize`:`${e}-configureShardCount`,onChange:t=>s(t===`${e}-configureShardSize`)}),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(Ye,{path:p,key:p,component:c.NumericField,componentProps:{fullWidth:!1,euiFieldProps:{"data-test-subj":`${e}-primaryShard${u?"Size":"Count"}`,min:1,append:u?Object(y.jsx)(la,{path:`_meta.${e}.shrink.maxPrimaryShardSizeUnits`,options:Y,euiFieldProps:{"data-test-subj":`${e}-shrinkMaxPrimaryShardSizeUnits`,"aria-label":Z.editPolicy.maxPrimaryShardSizeUnitsLabel}}):null}}})))},na=({children:e})=>e(Object(F.m)()),oa=({field:e,isLoading:t,repos:a,noSuggestions:l,globalRepository:s})=>{const n=Object(i.useRef)(!1),{setValue:o}=e,{searchableSnapshotRepo:{setValue:r}}=$e();return Object(i.useEffect)((()=>{n.current&&o(Boolean(s.trim())?[s]:[]),n.current=!0}),[o,s]),Object(y.jsx)(c.ComboBoxField,{field:e,fullWidth:!1,euiFieldProps:{"data-test-subj":"searchableSnapshotCombobox",options:a.map((e=>({label:e,value:e}))),singleSelection:{asPlainText:!0},isLoading:t,noSuggestions:l,onCreateOption:e=>{r(e)},onChange:e=>{e.length>0?r(e[0].label):r("")}}})};a(64);const ra=({phase:e,canBeDisabled:t=!0})=>{const{services:{cloud:a,docLinks:s,getUrlForApp:n}}=m(),{policy:r,license:c,isNewPolicy:d}=vt(),{isUsingSearchableSnapshotInHotPhase:u}=Se(),p=`phases.${e}.actions.searchable_snapshot.snapshot_repository`,[h]=Object(o.useFormData)({watch:Ue.searchableSnapshotRepo.path}),f=Object(_.get)(h,Ue.searchableSnapshotRepo.path),x="cold"===e||"frozen"===e,g=!c.canUseSearchableSnapshot(),[b,j]=Object(i.useState)((()=>{var t,i,l;return Boolean(x&&d&&(null==a?void 0:a.isCloudEnabled)||(null===(t=r.phases[e])||void 0===t||null===(i=t.actions)||void 0===i||null===(l=i.searchable_snapshot)||void 0===l?void 0:l.snapshot_repository))})),v=s.links.elasticsearch.ilmSearchableSnapshot,O=s.links.elasticsearch.searchableSnapshotSharedCache,M=((e,t,a)=>{switch(e){case"hot":case"cold":return{title:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.fullyMountedSearchableSnapshotField.title",{defaultMessage:"Searchable snapshot"}),description:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.fullyMountedSearchableSnapshotField.description",defaultMessage:"Convert to a fully-mounted index that contains a complete copy of your data and is backed by a snapshot. You can reduce the number of replicas and rely on the snapshot for resiliency. {learnMoreLink}",values:{learnMoreLink:Object(y.jsx)(Ze,{docPath:t})}}),toggleLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.fullyMountedSearchableSnapshotField.toggleLabel",{defaultMessage:"Convert to fully-mounted index"})};case"frozen":return{title:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.partiallyMountedSearchableSnapshotField.title",{defaultMessage:"Searchable snapshot"}),description:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.frozenPhase.partiallyMountedSearchableSnapshotField.description",defaultMessage:"Convert to a partially-mounted index that caches the index metadata. Data is retrieved from the snapshot as needed to process search requests. This minimizes the index footprint while keeping all of your data fully searchable. {learnMoreLink}",values:{learnMoreLink:Object(y.jsx)(Ze,{docPath:a})}}),toggleLabel:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.partiallyMountedSearchableSnapshotField.toggleLabel",{defaultMessage:"Convert to partially-mounted index"})}}})(e,v,O);return Object(i.useEffect)((()=>{g&&j(!1)}),[g]),Object(y.jsx)(at,{"data-test-subj":`searchableSnapshotField-${e}`,switchProps:t?{checked:b,disabled:g,onChange:j,"data-test-subj":"searchableSnapshotToggle",label:M.toggleLabel}:void 0,title:Object(y.jsx)("h3",null,M.title),description:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiTextColor,{color:"subdued"},M.description)),fieldNotices:(()=>{let t;return"hot"===e&&u?t=Object(y.jsx)(L.EuiCallOut,{size:"s",title:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotCalloutBody",{defaultMessage:"Force merge, shrink, downsample and read only actions are not allowed when converting data to a fully-mounted index in this phase."}),"data-test-subj":"searchableSnapshotFieldsDisabledCallout"}):g&&(t=Object(y.jsx)(L.EuiCallOut,{"data-test-subj":"searchableSnapshotDisabledDueToLicense",title:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotLicenseCalloutTitle",{defaultMessage:"Enterprise license required"}),iconType:"questionInCircle"},z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotLicenseCalloutBody",{defaultMessage:"To create a searchable snapshot an enterprise license is required."}))),t?Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,null),t,Object(y.jsx)(L.EuiSpacer,null)):void 0})(),fullWidth:!0},g?Object(y.jsx)("div",null):()=>Object(y.jsx)(na,null,(({error:e,isLoading:t,resendRequest:a,data:i})=>{var s;const o=null!==(s=null==i?void 0:i.repositories)&&void 0!==s?s:[];let r;return t||(e?r=Object(y.jsx)(lt,{resendRequest:a,"data-test-subj":"repositoriesErrorCallout","aria-label":z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.reloadSnapshotRepositoriesLabel",{defaultMessage:"Reload snapshot repositories"}),title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.loadSnapshotRepositoriesErrorTitle",defaultMessage:"Unable to load snapshot repositories"}),body:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.loadSnapshotRepositoriesErrorBody",defaultMessage:"Refresh this field and enter the name of an existing snapshot repository."})}):0===o.length?r=Object(y.jsx)(L.EuiCallOut,{color:"warning",title:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.noSnapshotRepositoriesTitle",{defaultMessage:"No snapshot repositories found"})},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.noSnapshotRepositoriesFoundBody",defaultMessage:"{link} to use searchable snapshots.",values:{link:Object(y.jsx)(L.EuiLink,{href:n("management",{path:"data/snapshot_restore/add_repository"}),target:"_blank"},z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.createSearchableSnapshotLink",{defaultMessage:"Create a snapshot repository"}))}})):f&&!o.includes(f)&&(r=Object(y.jsx)(L.EuiCallOut,{title:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.noSnapshotRepositoriesWithNameTitle",{defaultMessage:"Repository name not found"}),color:"warning"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.noSnapshotRepositoryWithNameBody",defaultMessage:"Enter the name of an existing repository, or {link} with this name.",values:{link:Object(y.jsx)(L.EuiLink,{href:n("management",{path:"data/snapshot_restore/add_repository"}),target:"_blank"},z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.createSnapshotRepositoryLink",{defaultMessage:"create a new snapshot repository"}))}})))),Object(y.jsx)("div",{className:"ilmSearchableSnapshotField"},Object(y.jsx)(Ye,{path:p,defaultValue:f?[f]:[],component:oa,componentProps:{globalRepository:f,isLoading:t,repos:o,noSuggestions:!(!e&&0!==o.length)}}),r&&Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),r))})))},ca=({phase:e})=>{const{docLinks:t}=m().services;return Object(y.jsx)(it,{title:Object(y.jsx)("h3",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.readonlyTitle",defaultMessage:"Read only"})),description:Object(y.jsx)(L.EuiTextColor,{color:"subdued"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.readonlyDescription",defaultMessage:"Enable to make the index and index metadata read only, disable to allow writes and metadata changes."})," ",Object(y.jsx)(Ze,{docPath:t.links.elasticsearch.ilmReadOnly})),fullWidth:!0,titleSize:"xs",switchProps:{"data-test-subj":`${e}-readonlySwitch`,path:`_meta.${e}.readonlyEnabled`}},Object(y.jsx)("div",null))},da=({phase:e})=>{var t,a,i;const{policy:l}=vt(),s=null!=(null===(t=l.phases[e])||void 0===t||null===(a=t.actions)||void 0===a||null===(i=a.allocate)||void 0===i?void 0:i.number_of_replicas);return Object(y.jsx)(at,{title:Object(y.jsx)("h3",null,z.i18n.translate("xpack.indexLifecycleMgmt.numberOfReplicas.formRowTitle",{defaultMessage:"Replicas"})),description:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.numberOfReplicas.formRowDescription",{defaultMessage:"Set the number of replicas. Remains the same as the previous phase by default."}),switchProps:{"data-test-subj":`${e}-setReplicasSwitch`,label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.numberOfReplicas.switchLabel",{defaultMessage:"Set replicas"}),initialValue:s},fullWidth:!0},Object(y.jsx)(Ye,{path:`phases.${e}.actions.allocate.number_of_replicas`,component:c.NumericField,componentProps:{fullWidth:!1,euiFieldProps:{"data-test-subj":`${e}-selectedReplicaCount`,min:0}}}))},ua=({phase:e})=>{const{policy:t,isNewPolicy:a}=vt(),l=Object(i.useMemo)((()=>{var i,l,s;return a||!(null!==(i=t.phases[e])&&void 0!==i&&i.actions)||null!=(null===(l=t.phases[e])||void 0===l||null===(s=l.actions)||void 0===s?void 0:s.set_priority)}),[a,t.phases,e]),{docLinks:s}=m().services;return Object(y.jsx)(at,{title:Object(y.jsx)("h3",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.indexPriorityText",defaultMessage:"Index priority"})),description:Object(y.jsx)(L.EuiTextColor,{color:"subdued"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.warmPhase.indexPriorityExplanationText",defaultMessage:"Set the priority for recovering your indices after a node restart. Indices with higher priorities are recovered before indices with lower priorities."})," ",Object(y.jsx)(Ze,{docPath:s.links.elasticsearch.ilmSetPriority})),titleSize:"xs",fullWidth:!0,switchProps:{label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.indexPriority.indexPriorityEnabledFieldLabel",{defaultMessage:"Set index priority"}),"data-test-subj":`${e}-indexPrioritySwitch`,initialValue:l}},Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(Ye,{path:`phases.${e}.actions.set_priority.priority`,component:c.NumericField,euiFieldProps:{fullWidth:!1,"data-test-subj":`${e}-indexPriority`,min:0}}))},ma=({phase:e})=>{const t=`_meta.${e}.downsample.enabled`,a=`_meta.${e}.downsample.fixedIntervalSize`,i=`_meta.${e}.downsample.fixedIntervalUnits`;return Object(y.jsx)(it,{title:Object(y.jsx)("h3",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.downsampleTitle",defaultMessage:"Downsample"})),description:Object(y.jsx)(L.EuiTextColor,{color:"subdued"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.downsampleDescription",defaultMessage:"Roll up documents within a fixed interval to a single summary document. Reduces the index footprint by storing time series data at reduced granularity."})," "),fullWidth:!0,titleSize:"xs",switchProps:{"data-test-subj":`${e}-downsampleSwitch`,path:t}},Object(y.jsx)(Ye,{path:a,key:a,component:c.NumericField,componentProps:{fullWidth:!1,euiFieldProps:{"data-test-subj":`${e}-downsampleFixedInterval`,min:1,append:Object(y.jsx)(la,{path:i,options:Q,euiFieldProps:{"data-test-subj":`${e}-downsampleFixedIntervalUnits`,"aria-label":Z.editPolicy.downsampleIntervalFieldUnitsLabel}})}}}))};a(69);const pa=({enabled:e,phase:t})=>Object(y.jsx)("div",{className:`ilmPhaseIcon ilmPhaseIcon--${t} ${e?"":"ilmPhaseIcon--disabled"}`},e?Object(y.jsx)(L.EuiIcon,{className:`ilmPhaseIcon__inner--${t}`,type:"delete"===t?"trash":"checkInCircleFilled",size:"delete"===t?"m":"l"}):Object(y.jsx)(L.EuiIcon,{className:"ilmPhaseIcon__inner--disabled",type:"dot",size:"s"}));a(74),a(79);const ha=({phase:e})=>{const t=`_meta.${e}.enabled`,[a]=Object(o.useFormData)({watch:[t]}),i="hot"===e,l="delete"===e,{setDeletePhaseEnabled:s}=Ne(),n=Object(_.get)(a,t)||i,{errors:r}=ze(),d=Object.keys(r[e]).length>0;return Object(y.jsx)(L.EuiFlexGroup,{alignItems:"center",gutterSize:"s",justifyContent:"spaceBetween"},Object(y.jsx)(L.EuiFlexItem,{grow:!0},Object(y.jsx)(L.EuiFlexGroup,{alignItems:"center",gutterSize:"s",wrap:!0},!i&&!l&&Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(Ye,{path:t,component:c.ToggleField,componentProps:{euiFieldProps:{"data-test-subj":`enablePhaseSwitch-${e}`,showLabel:!1}}})),Object(y.jsx)(L.EuiFlexItem,{grow:!1,className:"ilmPhaseTitle"},Object(y.jsx)(L.EuiTitle,{size:"s"},Object(y.jsx)("h2",null,Z.editPolicy.titles[e]))),i&&Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiBadge,{className:"ilmPhaseRequiredBadge"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.phaseTitle.requiredBadge",defaultMessage:"Required"}))),l&&Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiButtonEmpty,{onClick:()=>s(!1),"data-test-subj":"disableDeletePhaseButton"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.deletePhase.removeDeletePhaseButtonLabel",defaultMessage:"Remove"}))),d&&Object(y.jsx)(L.EuiFlexItem,{grow:!1,"data-test-subj":`phaseErrorIndicator-${e}`},Object(y.jsx)(L.EuiIconTip,{type:"warning",color:"danger",content:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.phaseErrorIcon.tooltipDescription",defaultMessage:"This phase contains errors."})})))),!i&&n&&Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(ta,{phase:e})))},fa=({children:e,topLevelSettings:t,phase:a})=>{const i=`_meta.${a}.enabled`,[s]=Object(o.useFormData)({watch:[i]}),n="hot"===a,r="delete"===a,c=Object(_.get)(s,i)||n;return r&&!c?null:Object(y.jsx)(L.EuiTimelineItem,{icon:Object(y.jsx)(pa,{enabled:c,phase:a}),verticalAlign:"top","data-test-subj":`${a}-phase`},Object(y.jsx)(L.EuiSplitPanel.Outer,{color:"transparent",hasBorder:!0,grow:!0},Object(y.jsx)(L.EuiSplitPanel.Inner,{color:c?"transparent":"subdued"},Object(y.jsx)(ha,{phase:a})),Object(y.jsx)(L.EuiHorizontalRule,{margin:"none"}),Object(y.jsx)(L.EuiSplitPanel.Inner,null,Object(y.jsx)(L.EuiText,{color:"subdued",size:"s",style:{maxWidth:"50%"}},Z.editPolicy.descriptions[a]),c&&Object(y.jsx)(l.a.Fragment,null,t?Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,null),t):Object(y.jsx)(L.EuiSpacer,{size:"m"}),e?Object(y.jsx)(L.EuiAccordion,{id:`${a}-settingsSwitch`,className:"ilmSettingsAccordion",buttonContent:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.phaseSettings.buttonLabel",defaultMessage:"Advanced settings"}),buttonClassName:"ilmSettingsButton",extraAction:!r&&Object(y.jsx)(gt,{phase:a})},Object(y.jsx)(L.EuiSpacer,null),e):!r&&Object(y.jsx)(L.EuiFlexGroup,{justifyContent:"flexEnd"},Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(gt,{phase:a})))))))},xa=Object.values(J),ga=()=>Object(y.jsx)(L.EuiFlexGroup,{alignItems:"flexStart",gutterSize:"s"},Object(y.jsx)(L.EuiFlexItem,{style:{maxWidth:400}},Object(y.jsx)(Ye,{path:J.maxPrimaryShardSize,component:c.NumericField,componentProps:{euiFieldProps:{"data-test-subj":"hot-selectedMaxPrimaryShardSize",min:1,append:Object(y.jsx)(la,{path:"_meta.hot.customRollover.maxPrimaryShardSizeUnit",options:Y,euiFieldProps:{"data-test-subj":"hot-selectedMaxPrimaryShardSizeUnits","aria-label":Z.editPolicy.maxPrimaryShardSizeUnitsLabel}})}}}))),ba=()=>Object(y.jsx)(L.EuiFlexGroup,{alignItems:"flexStart",gutterSize:"s"},Object(y.jsx)(L.EuiFlexItem,{style:{maxWidth:400}},Object(y.jsx)(Ye,{path:J.maxPrimaryShardDocs,component:c.NumericField,componentProps:{euiFieldProps:{"data-test-subj":"hot-selectedMaxPrimaryShardDocs",min:1}}}))),ja=()=>Object(y.jsx)(L.EuiFlexGroup,{alignItems:"flexStart",gutterSize:"s"},Object(y.jsx)(L.EuiFlexItem,{style:{maxWidth:400}},Object(y.jsx)(Ye,{path:J.maxAge,component:c.NumericField,componentProps:{euiFieldProps:{"data-test-subj":"hot-selectedMaxAge",min:1,append:Object(y.jsx)(la,{path:"_meta.hot.customRollover.maxAgeUnit",options:Q,euiFieldProps:{"data-test-subj":"hot-selectedMaxAgeUnits","aria-label":z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.maximumAgeUnitsAriaLabel",{defaultMessage:"Maximum age units"})}})}}}))),ya=()=>Object(y.jsx)(L.EuiFlexGroup,{alignItems:"flexStart",gutterSize:"s"},Object(y.jsx)(L.EuiFlexItem,{style:{maxWidth:400}},Object(y.jsx)(Ye,{path:J.maxDocs,component:c.NumericField,componentProps:{euiFieldProps:{"data-test-subj":"hot-selectedMaxDocuments",min:1}}}))),va={deprecationMessage:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeDeprecationMessage",{defaultMessage:"Maximum index size is deprecated and will be removed in a future version. Use maximum primary shard size instead."}),maxSizeUnit:{ariaLabel:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeUnitsAriaLabel",{defaultMessage:"Maximum index size units"})}},Oa=()=>Object(y.jsx)(L.EuiFlexGroup,{alignItems:"flexStart",gutterSize:"s"},Object(y.jsx)(L.EuiFlexItem,{style:{maxWidth:400}},Object(y.jsx)(Ye,{path:J.maxSize,component:c.NumericField,componentProps:{euiFieldProps:{"data-test-subj":"hot-selectedMaxSizeStored",min:1,prepend:Object(y.jsx)(L.EuiIconTip,{type:"warning","aria-label":va.deprecationMessage,content:va.deprecationMessage}),append:Object(y.jsx)(la,{path:"_meta.hot.customRollover.maxStorageSizeUnit",options:Y,euiFieldProps:{"data-test-subj":"hot-selectedMaxSizeStoredUnits","aria-label":va.maxSizeUnit.ariaLabel}})}}}))),Ma=Object.values(J),Pa=()=>{const{license:e}=vt(),[t]=Object(o.useFormData)({watch:[H,...Ma]}),{isUsingRollover:a,isUsingDownsampleInHotPhase:s}=Se(),n=Object(_.get)(t,H),r=(()=>{const[e,t]=Object(i.useState)(!1),[a]=Object(o.useFormData)({watch:xa}),{getFields:l}=Object(o.useFormContext)();return Object(i.useEffect)((()=>{var e,a;const i=null!==(e=null===(a=Object(_.get)(l(),J.maxPrimaryShardSize))||void 0===a?void 0:a.errors)&&void 0!==e?e:[];t(i.some((e=>e.code===oe)))}),[l,a]),e})(),{docLinks:c}=m().services;return Object(y.jsx)(fa,{phase:"hot"},Object(y.jsx)(at,{title:Object(y.jsx)("h3",null,z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.rolloverFieldTitle",{defaultMessage:"Rollover"})),description:Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiTextColor,{color:"subdued"},Object(y.jsx)("p",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.hotPhase.rolloverDescriptionMessage",defaultMessage:"Start writing to a new index when the current index reaches a certain size, document count, or age. Enables you to optimize performance and manage resource usage when working with time series data."}))),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(L.EuiTextColor,{color:"subdued"},Object(y.jsx)("p",null,Object(y.jsx)("strong",null,z.i18n.translate("xpack.indexLifecycleMgmt.rollover.rolloverOffsetsPhaseTimingDescriptionNote",{defaultMessage:"Note: "})),Z.editPolicy.rolloverOffsetsHotPhaseTiming," ",Object(y.jsx)(Ze,{text:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.hotPhase.learnAboutRolloverLinkText",defaultMessage:"Learn more"}),docPath:c.links.elasticsearch.ilmRollover}))),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(Ye,{path:H},(e=>Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiText,{color:"default"},Object(y.jsx)(L.EuiSwitch,{label:e.label,checked:e.value,onChange:t=>e.setValue(t.target.checked),"data-test-subj":"useDefaultRolloverSwitch"})),Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.hotPhase.rolloverDefaultsTipContent",defaultMessage:"Roll over when an index is 30 days old or any primary shard reaches 50 gigabytes."}))))),fullWidth:!0},!1===n?Object(y.jsx)("div",{"aria-live":"polite",role:"region"},Object(y.jsx)(Ye,{path:"_meta.hot.customRollover.enabled"},(e=>Object(y.jsx)(L.EuiSwitch,{label:e.label,checked:e.value,onChange:t=>e.setValue(t.target.checked),"data-test-subj":"rolloverSwitch"}))),a&&Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"m"}),r&&Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiCallOut,{size:"s",title:Z.editPolicy.errors.rollOverConfigurationCallout.title,"data-test-subj":"rolloverSettingsRequired",color:"danger"},Object(y.jsx)("div",null,Z.editPolicy.errors.rollOverConfigurationCallout.body)),Object(y.jsx)(L.EuiSpacer,{size:"s"})),Object(y.jsx)(ga,null),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(ba,null),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(ja,null),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(ya,null),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(Oa,null))):Object(y.jsx)("div",null)),a&&Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(Qt,{phase:"hot"}),Object(y.jsx)(sa,{phase:"hot"}),e.canUseSearchableSnapshot()&&Object(y.jsx)(ra,{phase:"hot"}),Object(y.jsx)(ma,{phase:"hot"}),!s&&Object(y.jsx)(ca,{phase:"hot"})),Object(y.jsx)(ua,{phase:"hot"}))},_a={dataTierAllocation:{description:z.i18n.translate("xpack.indexLifecycleMgmt.warmPhase.dataTier.description",{defaultMessage:"Move data to nodes optimized for less-frequent, read-only access."})}},wa=()=>{const{isUsingSearchableSnapshotInHotPhase:e,isUsingDownsampleInHotPhase:t,isUsingDownsampleInWarmPhase:a}=Se();return Object(y.jsx)(fa,{phase:"warm"},Object(y.jsx)(da,{phase:"warm"}),!e&&Object(y.jsx)(sa,{phase:"warm"}),!e&&Object(y.jsx)(Qt,{phase:"warm"}),!e&&Object(y.jsx)(ma,{phase:"warm"}),!e&&!t&&!a&&Object(y.jsx)(ca,{phase:"warm"}),Object(y.jsx)(Kt,{description:_a.dataTierAllocation.description,phase:"warm"}),Object(y.jsx)(ua,{phase:"warm"}))},ka={dataTierAllocation:{description:z.i18n.translate("xpack.indexLifecycleMgmt.coldPhase.dataTier.description",{defaultMessage:"Move data to nodes optimized for less frequent, read-only access. Store data in the cold phase on less-expensive hardware."})}},Ta=()=>{const{isUsingSearchableSnapshotInHotPhase:e,isUsingDownsampleInHotPhase:t,isUsingDownsampleInWarmPhase:a,isUsingDownsampleInColdPhase:i}=Se();return Object(y.jsx)(fa,{phase:"cold",topLevelSettings:Object(y.jsx)(ra,{phase:"cold"})},Object(y.jsx)(da,{phase:"cold"}),!e&&Object(y.jsx)(ma,{phase:"cold"}),!e&&!t&&!a&&!i&&Object(y.jsx)(ca,{phase:"cold"}),Object(y.jsx)(Kt,{description:ka.dataTierAllocation.description,phase:"cold"}),Object(y.jsx)(ua,{phase:"cold"}))},La=()=>Object(y.jsx)(fa,{phase:"frozen",topLevelSettings:Object(y.jsx)(ra,{phase:"frozen",canBeDisabled:!1})}),Sa=()=>Object(y.jsx)(fa,{phase:"delete",topLevelSettings:Object(y.jsx)(ia,null)}),Ea="name",Fa=()=>{Object(i.useEffect)((()=>{window.scrollTo(0,0)}),[]);const[e,t]=Object(i.useState)(!1),{isNewPolicy:a,policy:s,existingPolicies:n,policyName:r,license:d}=vt(),{services:{cloud:u,docLinks:h}}=m(),[f,x]=Object(i.useState)(!1),g=a?"":r,b=d.canUseSearchableSnapshot(),j=Boolean(null==u?void 0:u.isCloudEnabled),v=Object(i.useMemo)((()=>{return e=a?void 0:s,t=>{const{_meta:a,...i}=t;return i.phases={hot:{actions:{}},...i.phases},Object(D.produce)(null!=e?e:T.o,(t=>{var l,s,n;Object(_.merge)(t,i);const o=Boolean((null===(l=a.hot)||void 0===l?void 0:l.isUsingDefaultRollover)||(null===(s=a.hot)||void 0===s?void 0:s.customRollover.enabled));var r,c;if(t.phases.hot&&(t.phases.hot.min_age=null!==(r=t.phases.hot.min_age)&&void 0!==r?r:"0ms",null!==(c=t.phases.hot)&&void 0!==c&&c.actions)){var d,u;const e=t.phases.hot.actions;if(o){var m,p,h,f,x,g,b,j,y,v,O,M,P,w,k,L,S,E;if(null!==(m=a.hot)&&void 0!==m&&m.isUsingDefaultRollover?e.rollover=Object(_.cloneDeep)(T.p):(e.rollover||(e.rollover={}),null!==(O=i.phases.hot.actions.rollover)&&void 0!==O&&O.max_age?e.rollover.max_age=`${e.rollover.max_age}${null===(L=a.hot)||void 0===L?void 0:L.customRollover.maxAgeUnit}`:delete e.rollover.max_age,"number"!=typeof(null===(M=i.phases.hot.actions.rollover)||void 0===M?void 0:M.max_docs)&&delete e.rollover.max_docs,null!==(P=i.phases.hot.actions.rollover)&&void 0!==P&&P.max_primary_shard_size?e.rollover.max_primary_shard_size=`${e.rollover.max_primary_shard_size}${null===(S=a.hot)||void 0===S?void 0:S.customRollover.maxPrimaryShardSizeUnit}`:delete e.rollover.max_primary_shard_size,"number"!=typeof(null===(w=i.phases.hot.actions.rollover)||void 0===w?void 0:w.max_primary_shard_docs)&&delete e.rollover.max_primary_shard_docs,null!==(k=i.phases.hot.actions.rollover)&&void 0!==k&&k.max_size?e.rollover.max_size=`${e.rollover.max_size}${null===(E=a.hot)||void 0===E?void 0:E.customRollover.maxStorageSizeUnit}`:delete e.rollover.max_size),null!==(p=i.phases.hot.actions)&&void 0!==p&&p.forcemerge?null!==(h=a.hot)&&void 0!==h&&h.bestCompression?e.forcemerge.index_codec="best_compression":delete e.forcemerge.index_codec:delete e.forcemerge,null!==(f=a.hot)&&void 0!==f&&f.bestCompression&&e.forcemerge&&(e.forcemerge.index_codec="best_compression"),null!==(x=a.hot)&&void 0!==x&&x.readonlyEnabled?e.readonly=null!==(v=e.readonly)&&void 0!==v?v:{}:delete e.readonly,null!==(g=i.phases.hot)&&void 0!==g&&null!==(b=g.actions)&&void 0!==b&&b.shrink)if(a.hot.shrink.isUsingShardSize){var F,C;delete e.shrink.number_of_shards,e.shrink.max_primary_shard_size=`${null===(F=e.shrink)||void 0===F?void 0:F.max_primary_shard_size}${null===(C=a.hot)||void 0===C?void 0:C.shrink.maxPrimaryShardSizeUnits}`}else delete e.shrink.max_primary_shard_size;else delete e.shrink;null!==(j=a.hot)&&void 0!==j&&null!==(y=j.downsample)&&void 0!==y&&y.enabled?e.downsample={...e.downsample,fixed_interval:`${a.hot.downsample.fixedIntervalSize}${a.hot.downsample.fixedIntervalUnits}`}:delete e.downsample}else delete e.rollover,delete e.forcemerge,delete e.readonly,delete e.shrink;null!==(d=i.phases.hot.actions)&&void 0!==d&&d.set_priority||delete e.set_priority,null!==(u=i.phases.hot.actions)&&void 0!==u&&u.searchable_snapshot?e.searchable_snapshot={...e.searchable_snapshot,snapshot_repository:a.searchableSnapshot.repository}:delete e.searchable_snapshot}if(a.warm.enabled){var z,A,D,I,N,R,U,B,$,q,V,W,H,G,J;t.phases.warm.actions=null!==(z=null===(A=t.phases.warm)||void 0===A?void 0:A.actions)&&void 0!==z?z:{};const l=t.phases.warm;var K;if(null!==(D=i.phases.warm)&&void 0!==D&&D.min_age&&(l.min_age=`${i.phases.warm.min_age}${a.warm.minAgeUnit}`),l.actions=X(a.warm,l.actions,null==e||null===(I=e.phases.warm)||void 0===I?void 0:I.actions,null===(N=i.phases.warm)||void 0===N||null===(R=N.actions)||void 0===R||null===(U=R.allocate)||void 0===U?void 0:U.number_of_replicas),null!==(B=i.phases.warm)&&void 0!==B&&null!==($=B.actions)&&void 0!==$&&$.forcemerge?a.warm.bestCompression?l.actions.forcemerge.index_codec="best_compression":delete l.actions.forcemerge.index_codec:delete l.actions.forcemerge,a.warm.readonlyEnabled?l.actions.readonly=null!==(K=l.actions.readonly)&&void 0!==K?K:{}:delete l.actions.readonly,null!==(q=i.phases.warm)&&void 0!==q&&null!==(V=q.actions)&&void 0!==V&&V.set_priority||delete l.actions.set_priority,null!==(W=i.phases.warm)&&void 0!==W&&null!==(H=W.actions)&&void 0!==H&&H.shrink)if(a.warm.shrink.isUsingShardSize){var Y,Q;delete l.actions.shrink.number_of_shards,l.actions.shrink.max_primary_shard_size=`${null===(Y=l.actions.shrink)||void 0===Y?void 0:Y.max_primary_shard_size}${null===(Q=a.warm)||void 0===Q?void 0:Q.shrink.maxPrimaryShardSizeUnits}`}else delete l.actions.shrink.max_primary_shard_size;else delete l.actions.shrink;null!==(G=a.warm)&&void 0!==G&&null!==(J=G.downsample)&&void 0!==J&&J.enabled?l.actions.downsample={...l.actions.downsample,fixed_interval:`${a.warm.downsample.fixedIntervalSize}${a.warm.downsample.fixedIntervalUnits}`}:delete l.actions.downsample}else delete t.phases.warm;if(a.cold.enabled){var Z,ee,te,ae,ie,le,se,ne,oe,re,ce,de,ue;t.phases.cold.actions=null!==(Z=null===(ee=t.phases.cold)||void 0===ee?void 0:ee.actions)&&void 0!==Z?Z:{};const l=t.phases.cold;var me;null!==(te=i.phases.cold)&&void 0!==te&&te.min_age&&(l.min_age=`${i.phases.cold.min_age}${a.cold.minAgeUnit}`),l.actions=X(a.cold,l.actions,null==e||null===(ae=e.phases.cold)||void 0===ae?void 0:ae.actions,null===(ie=i.phases.cold)||void 0===ie||null===(le=ie.actions)||void 0===le||null===(se=le.allocate)||void 0===se?void 0:se.number_of_replicas),l.actions.freeze&&delete l.actions.freeze,a.cold.readonlyEnabled?l.actions.readonly=null!==(me=l.actions.readonly)&&void 0!==me?me:{}:delete l.actions.readonly,null!==(ne=i.phases.cold)&&void 0!==ne&&null!==(oe=ne.actions)&&void 0!==oe&&oe.set_priority||delete l.actions.set_priority,null!==(re=i.phases.cold)&&void 0!==re&&null!==(ce=re.actions)&&void 0!==ce&&ce.searchable_snapshot?l.actions.searchable_snapshot={...l.actions.searchable_snapshot,snapshot_repository:a.searchableSnapshot.repository}:delete l.actions.searchable_snapshot,null!==(de=a.cold)&&void 0!==de&&null!==(ue=de.downsample)&&void 0!==ue&&ue.enabled?l.actions.downsample={...l.actions.downsample,fixed_interval:`${a.cold.downsample.fixedIntervalSize}${a.cold.downsample.fixedIntervalUnits}`}:delete l.actions.downsample}else delete t.phases.cold;if(null!==(n=a.frozen)&&void 0!==n&&n.enabled){var pe,he,fe,xe,ge;t.phases.frozen.actions=null!==(pe=null===(he=t.phases.frozen)||void 0===he?void 0:he.actions)&&void 0!==pe?pe:{};const e=t.phases.frozen;null!==(fe=i.phases.frozen)&&void 0!==fe&&fe.min_age&&(e.min_age=`${i.phases.frozen.min_age}${a.frozen.minAgeUnit}`),null!==(xe=i.phases.frozen)&&void 0!==xe&&null!==(ge=xe.actions)&&void 0!==ge&&ge.searchable_snapshot?e.actions.searchable_snapshot={...e.actions.searchable_snapshot,snapshot_repository:a.searchableSnapshot.repository}:delete e.actions.searchable_snapshot}else delete t.phases.frozen;if(a.delete.enabled){var be,je,ye,ve,Oe;const e=t.phases.delete;e.actions=null!==(be=e.actions)&&void 0!==be?be:{},e.actions.delete=null!==(je=e.actions.delete)&&void 0!==je?je:{},null!==(ye=i.phases.delete)&&void 0!==ye&&ye.min_age&&(e.min_age=`${i.phases.delete.min_age}${a.delete.minAgeUnit}`),null!==(ve=i.phases.delete)&&void 0!==ve&&null!==(Oe=ve.actions)&&void 0!==Oe&&Oe.wait_for_snapshot||delete e.actions.wait_for_snapshot}else delete t.phases.delete}))};var e}),[a,s]),O=Object(i.useMemo)((()=>(e=>t=>{var a,i,l,s,n,o,r,c,d,u,m,p,h;const{phases:{hot:f,warm:x,cold:g,frozen:b,delete:j}}=t;let y=V([null==f?void 0:f.actions.searchable_snapshot,null==g?void 0:g.actions.searchable_snapshot,null==b?void 0:b.actions.searchable_snapshot]);!y&&e&&(y=K);const v={hot:{isUsingDefaultRollover:N(t),customRollover:{enabled:Boolean(null==f||null===(a=f.actions)||void 0===a?void 0:a.rollover)},bestCompression:"best_compression"===(null==f||null===(i=f.actions)||void 0===i||null===(l=i.forcemerge)||void 0===l?void 0:l.index_codec),readonlyEnabled:Boolean(null==f||null===(s=f.actions)||void 0===s?void 0:s.readonly),shrink:{isUsingShardSize:Boolean(null==f||null===(n=f.actions.shrink)||void 0===n?void 0:n.max_primary_shard_size)},downsample:{enabled:Boolean(null==f||null===(o=f.actions)||void 0===o?void 0:o.downsample)}},warm:{enabled:Boolean(x),warmPhaseOnRollover:void 0===x||Boolean("0ms"===x.min_age),bestCompression:"best_compression"===(null==x||null===(r=x.actions)||void 0===r||null===(c=r.forcemerge)||void 0===c?void 0:c.index_codec),dataTierAllocationType:I(null==x?void 0:x.actions),readonlyEnabled:Boolean(null==x||null===(d=x.actions)||void 0===d?void 0:d.readonly),minAgeToMilliSeconds:-1,shrink:{isUsingShardSize:Boolean(null==x||null===(u=x.actions.shrink)||void 0===u?void 0:u.max_primary_shard_size)},downsample:{enabled:Boolean(null==x||null===(m=x.actions)||void 0===m?void 0:m.downsample)}},cold:{enabled:Boolean(g),dataTierAllocationType:I(null==g?void 0:g.actions),readonlyEnabled:Boolean(null==g||null===(p=g.actions)||void 0===p?void 0:p.readonly),minAgeToMilliSeconds:-1,downsample:{enabled:Boolean(null==g||null===(h=g.actions)||void 0===h?void 0:h.downsample)}},frozen:{enabled:Boolean(b),dataTierAllocationType:I(null==b?void 0:b.actions),minAgeToMilliSeconds:-1},delete:{enabled:Boolean(j),minAgeToMilliSeconds:-1},searchableSnapshot:{repository:y}};return Object(D.produce)({...t,_meta:v},(e=>{var t,a,i,l,s,n;if(null!==(t=e.phases.hot)&&void 0!==t&&null!==(a=t.actions)&&void 0!==a&&a.rollover){if(e.phases.hot.actions.rollover.max_size){const t=C(e.phases.hot.actions.rollover.max_size);e.phases.hot.actions.rollover.max_size=t.size,e._meta.hot.customRollover.maxStorageSizeUnit=t.units}if(e.phases.hot.actions.rollover.max_primary_shard_size){const t=C(e.phases.hot.actions.rollover.max_primary_shard_size);e.phases.hot.actions.rollover.max_primary_shard_size=t.size,e._meta.hot.customRollover.maxPrimaryShardSizeUnit=t.units}if(e.phases.hot.actions.rollover.max_age){const t=C(e.phases.hot.actions.rollover.max_age);e.phases.hot.actions.rollover.max_age=t.size,e._meta.hot.customRollover.maxAgeUnit=t.units}}if(null!==(i=e.phases.hot)&&void 0!==i&&null!==(l=i.actions.shrink)&&void 0!==l&&l.max_primary_shard_size){const t=C(e.phases.hot.actions.shrink.max_primary_shard_size);e.phases.hot.actions.shrink.max_primary_shard_size=t.size,e._meta.hot.shrink.maxPrimaryShardSizeUnits=t.units}if(null!==(s=e.phases.hot)&&void 0!==s&&null!==(n=s.actions.downsample)&&void 0!==n&&n.fixed_interval){const t=C(e.phases.hot.actions.downsample.fixed_interval);e._meta.hot.downsample.fixedIntervalUnits=t.units,e._meta.hot.downsample.fixedIntervalSize=t.size}if(e.phases.warm){var o,r,c,d,u;if(null!==(o=e.phases.warm.actions)&&void 0!==o&&null!==(r=o.allocate)&&void 0!==r&&r.require&&Object.entries(e.phases.warm.actions.allocate.require).forEach((t=>{e._meta.warm.allocationNodeAttribute=t.join(":")})),e.phases.warm.min_age){const t=C(e.phases.warm.min_age);e.phases.warm.min_age=t.size,e._meta.warm.minAgeUnit=t.units}if(null!==(c=e.phases.warm.actions.shrink)&&void 0!==c&&c.max_primary_shard_size){const t=C(e.phases.warm.actions.shrink.max_primary_shard_size);e.phases.warm.actions.shrink.max_primary_shard_size=t.size,e._meta.warm.shrink.maxPrimaryShardSizeUnits=t.units}if(null!==(d=e.phases.warm)&&void 0!==d&&null!==(u=d.actions.downsample)&&void 0!==u&&u.fixed_interval){const t=C(e.phases.warm.actions.downsample.fixed_interval);e._meta.warm.downsample.fixedIntervalUnits=t.units,e._meta.warm.downsample.fixedIntervalSize=t.size}}if(e.phases.cold){var m,p,h,f;if(null!==(m=e.phases.cold.actions)&&void 0!==m&&null!==(p=m.allocate)&&void 0!==p&&p.require&&Object.entries(e.phases.cold.actions.allocate.require).forEach((t=>{e._meta.cold.allocationNodeAttribute=t.join(":")})),e.phases.cold.min_age){const t=C(e.phases.cold.min_age);e.phases.cold.min_age=t.size,e._meta.cold.minAgeUnit=t.units}if(null!==(h=e.phases.cold)&&void 0!==h&&null!==(f=h.actions.downsample)&&void 0!==f&&f.fixed_interval){const t=C(e.phases.cold.actions.downsample.fixed_interval);e._meta.cold.downsample.fixedIntervalUnits=t.units,e._meta.cold.downsample.fixedIntervalSize=t.size}}if(e.phases.frozen&&e.phases.frozen.min_age){const t=C(e.phases.frozen.min_age);e.phases.frozen.min_age=t.size,e._meta.frozen.minAgeUnit=t.units}if(e.phases.delete&&e.phases.delete.min_age){const t=C(e.phases.delete.min_age);e.phases.delete.min_age=t.size,e._meta.delete.minAgeUnit=t.units}}))})(j)),[j]),M=Object(i.useMemo)((()=>({...s,name:g})),[s,g]),P=Object(i.useMemo)((()=>(e=>({_meta:{hot:{isUsingDefaultRollover:{defaultValue:!0,label:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.isUsingDefaultRollover",{defaultMessage:"Use recommended defaults"})},customRollover:{enabled:{defaultValue:!0,label:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.enableRolloverLabel",{defaultMessage:"Enable rollover"})},maxStorageSizeUnit:{defaultValue:"gb"},maxPrimaryShardSizeUnit:{defaultValue:"gb"},maxAgeUnit:{defaultValue:"d"}},bestCompression:{label:Z.editPolicy.bestCompressionFieldLabel},readonlyEnabled:{defaultValue:!1,label:Z.editPolicy.readonlyEnabledFieldLabel},shrink:{isUsingShardSize:{defaultValue:!1},maxPrimaryShardSizeUnits:{defaultValue:"gb"}},downsample:_e("hot")},warm:{enabled:{defaultValue:!1,label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.warmPhase.activateWarmPhaseSwitchLabel",{defaultMessage:"Activate warm phase"})},minAgeUnit:{defaultValue:"d"},minAgeToMilliSeconds:{defaultValue:-1,fieldsToValidateOnChange:["phases.warm.min_age","phases.cold.min_age","phases.frozen.min_age","phases.delete.min_age"]},bestCompression:{label:Z.editPolicy.bestCompressionFieldLabel},dataTierAllocationType:{label:Z.editPolicy.allocationTypeOptionsFieldLabel},allocationNodeAttribute:{label:Z.editPolicy.allocationNodeAttributeFieldLabel},readonlyEnabled:{defaultValue:!1,label:Z.editPolicy.readonlyEnabledFieldLabel},shrink:{isUsingShardSize:{defaultValue:!1},maxPrimaryShardSizeUnits:{defaultValue:"gb"}},downsample:_e("warm")},cold:{enabled:{defaultValue:!1,label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.coldPhase.activateColdPhaseSwitchLabel",{defaultMessage:"Activate cold phase"})},readonlyEnabled:{defaultValue:!1,label:Z.editPolicy.readonlyEnabledFieldLabel},minAgeUnit:{defaultValue:"d"},minAgeToMilliSeconds:{defaultValue:-1,fieldsToValidateOnChange:["phases.cold.min_age","phases.frozen.min_age","phases.delete.min_age"]},dataTierAllocationType:{label:Z.editPolicy.allocationTypeOptionsFieldLabel},allocationNodeAttribute:{label:Z.editPolicy.allocationNodeAttributeFieldLabel},downsample:_e("cold")},frozen:{enabled:{defaultValue:!1,label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.frozenPhase.activateFrozenPhaseSwitchLabel",{defaultMessage:"Activate frozen phase"})},minAgeUnit:{defaultValue:"d"},minAgeToMilliSeconds:{defaultValue:-1,fieldsToValidateOnChange:["phases.frozen.min_age","phases.delete.min_age"]},dataTierAllocationType:{label:Z.editPolicy.allocationTypeOptionsFieldLabel},allocationNodeAttribute:{label:Z.editPolicy.allocationNodeAttributeFieldLabel}},delete:{enabled:{defaultValue:!1,label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.deletePhase.activateWarmPhaseSwitchLabel",{defaultMessage:"Activate delete phase"})},minAgeUnit:{defaultValue:"d"},minAgeToMilliSeconds:{defaultValue:-1,fieldsToValidateOnChange:["phases.delete.min_age"]}},searchableSnapshot:{repository:{defaultValue:e?K:""}}},phases:{hot:{actions:{rollover:{max_age:{label:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.maximumAgeLabel",{defaultMessage:"Maximum age"}),validations:[{validator:ce},{validator:se},{validator:de}],fieldsToValidateOnChange:pe},max_docs:{label:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.maximumDocumentsLabel",{defaultMessage:"Maximum documents"}),validations:[{validator:ce},{validator:se},{validator:de}],serializer:xe.stringToNumber,fieldsToValidateOnChange:pe},max_primary_shard_size:{label:Z.editPolicy.maxPrimaryShardSizeLabel,validations:[{validator:ce},{validator:se}],fieldsToValidateOnChange:pe},max_primary_shard_docs:{label:Z.editPolicy.maxPrimaryShardDocsLabel,validations:[{validator:ce},{validator:se},{validator:de}],serializer:xe.stringToNumber,fieldsToValidateOnChange:pe},max_size:{label:z.i18n.translate("xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeLabel",{defaultMessage:"Maximum index size"}),validations:[{validator:ce},{validator:se}],fieldsToValidateOnChange:pe}},forcemerge:{max_num_segments:ge},shrink:{number_of_shards:ye,max_primary_shard_size:ve},set_priority:{priority:Oe("hot")},searchable_snapshot:be}},warm:{min_age:Me("warm"),actions:{allocate:{number_of_replicas:je},shrink:{number_of_shards:ye,max_primary_shard_size:ve},forcemerge:{max_num_segments:ge},set_priority:{priority:Oe("warm")}}},cold:{min_age:Me("cold"),actions:{allocate:{number_of_replicas:je},set_priority:{priority:Oe("cold")},searchable_snapshot:be}},frozen:{min_age:Me("frozen"),actions:{allocate:{number_of_replicas:je},set_priority:{priority:Oe("frozen")},searchable_snapshot:be}},delete:{min_age:Me("delete","365"),actions:{wait_for_snapshot:{policy:{label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.waitForSnapshot.snapshotPolicyFieldLabel",{defaultMessage:"Policy name (optional)"})}}}}}}))(j)),[j]),{form:w}=Object(o.useForm)({schema:P,defaultValue:M,deserializer:O,serializer:v}),[E]=Object(o.useFormData)({form:w,watch:Ea}),R=()=>a||f?Object(_.get)(E,Ea):g,U=Object(i.useMemo)((()=>(({policies:e,isClonedPolicy:t,originalPolicyName:a})=>[{validator:ae(Z.editPolicy.errors.policyNameRequiredMessage)},{validator:ie({message:Z.editPolicy.errors.policyNameStartsWithUnderscoreErrorMessage,char:"_"})},{validator:te({message:Z.editPolicy.errors.policyNameContainsInvalidChars,chars:[","," "]})},{validator:e=>{const t=e.value;if(window.TextEncoder&&(new window.TextEncoder).encode(t).length>255)return{message:Z.editPolicy.errors.policyNameTooLongErrorMessage}}},{validator:i=>{const l=i.value;return t&&l===a?{message:Z.editPolicy.errors.policyNameMustBeDifferentErrorMessage}:l!==a&&e.map((e=>e.name)).includes(l)?{message:Z.editPolicy.errors.policyNameAlreadyUsedErrorMessage}:void 0}}])({originalPolicyName:g,policies:n,isClonedPolicy:f})),[g,n,f]),B=Object(p.useHistory)(),$=()=>{B.push("/policies")};return Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiPageHeader,{pageTitle:Object(y.jsx)("span",{"data-test-subj":"policyTitle"},a?z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.createPolicyMessage",{defaultMessage:"Create policy"}):z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.editPolicyMessage",{defaultMessage:"Edit policy {originalPolicyName}",values:{originalPolicyName:g}})),bottomBorder:!0,rightSideItems:[Object(y.jsx)(L.EuiButtonEmpty,{href:h.links.elasticsearch.ilm,target:"_blank",iconType:"help"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.documentationLinkText",defaultMessage:"Documentation"}))]}),Object(y.jsx)(L.EuiSpacer,{size:"l"}),Object(y.jsx)(qe,{form:w},a?null:Object(y.jsx)(i.Fragment,null,Object(y.jsx)(_t,null),Object(y.jsx)(L.EuiSpacer,null),Object(y.jsx)(L.EuiFormRow,null,Object(y.jsx)(L.EuiSwitch,{"data-test-subj":"saveAsNewSwitch",style:{maxWidth:"100%"},checked:f,onChange:e=>{x(e.target.checked)},label:Object(y.jsx)("span",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.saveAsNewPolicyMessage",defaultMessage:"Save as new policy"}))}))),f||a?Object(y.jsx)(Ye,{path:Ea,config:{label:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.policyNameLabel",{defaultMessage:"Policy name"}),helpText:z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.validPolicyNameMessage",{defaultMessage:"A policy name cannot start with an underscore and cannot contain a comma or a space."}),validations:U},component:c.TextField,componentProps:{fullWidth:!1,euiFieldProps:{"data-test-subj":"policyNameField"}}}):null,Object(y.jsx)(L.EuiHorizontalRule,null),Object(y.jsx)(ut,null),Object(y.jsx)(L.EuiSpacer,{size:"l"}),Object(y.jsx)(L.EuiTimeline,{className:"ilmPhases"},Object(y.jsx)(Pa,null),Object(y.jsx)(wa,null),Object(y.jsx)(Ta,null),b&&Object(y.jsx)(La,null),Object(y.jsx)(Sa,null)),Object(y.jsx)(L.EuiHorizontalRule,null),Object(y.jsx)(pt,null),Object(y.jsx)(L.EuiFlexGroup,{justifyContent:"spaceBetween"},Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiFlexGroup,null,Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiButton,{"data-test-subj":"savePolicyButton",fill:!0,iconType:"check",iconSide:"left",disabled:!1===w.isValid||w.isSubmitting,onClick:async()=>{const{data:e,isValid:t}=await w.submit();t?await(async(e,t)=>{try{await Object(F.g)(e)}catch(t){const a=z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.saveErrorMessage",{defaultMessage:"Error saving lifecycle policy {lifecycleName}",values:{lifecycleName:e.name}});return Object(Xe.a)(t,a),!1}const a=Object(Qe.a)(e.phases);a.push(t?T.j:T.m),Object(Qe.c)(k.METRIC_TYPE.COUNT,a);const i=z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.successfulSaveMessage",{defaultMessage:'{verb} lifecycle policy "{lifecycleName}"',values:{verb:t?z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.createdMessage",{defaultMessage:"Created"}):z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.updatedMessage",{defaultMessage:"Updated"}),lifecycleName:e.name}});return A.c.addSuccess(i),!0})({...e,name:R()},a||f)&&$():A.c.addDanger(z.i18n.translate("xpack.indexLifecycleMgmt.editPolicy.formErrorsMessage",{defaultMessage:"Please fix the errors on this page."}))}},f?Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.saveAsNewButton",defaultMessage:"Save as new policy"}):Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.saveButton",defaultMessage:"Save policy"}))),Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiButtonEmpty,{"data-test-subj":"cancelTestPolicy",onClick:$},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.cancelButton",defaultMessage:"Cancel"}))))),Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiButtonEmpty,{onClick:()=>{t(!e)},"data-test-subj":"requestButton"},e?Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.hidePolicyJsonButton",defaultMessage:"Hide request"}):Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.showPolicyJsonButton",defaultMessage:"Show request"})))),e?Object(y.jsx)(tt,{policyName:R(),close:()=>t(!1)}):null))},Ca=({match:{params:{policyName:e}}})=>{var t;const{services:{breadcrumbService:a,license:l}}=m(),{error:s,isLoading:n,data:o,resendRequest:r}=Object(F.k)();if(Object(i.useEffect)((()=>{a.setBreadcrumbs("editPolicy")}),[a]),n)return Object(y.jsx)(L.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"subdued"},Object(y.jsx)(L.EuiEmptyPrompt,{title:Object(y.jsx)(L.EuiLoadingSpinner,{size:"xl"}),body:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.policiesLoading",defaultMessage:"Loading policies..."})}));if(s||!o){const{statusCode:e,message:t}=s||{statusCode:"",message:""};return Object(y.jsx)(L.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"danger"},Object(y.jsx)(L.EuiEmptyPrompt,{title:Object(y.jsx)("h2",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesLoadingFailedTitle",defaultMessage:"Unable to load existing lifecycle policies"})),body:Object(y.jsx)("p",null,t," (",e,")"),actions:Object(y.jsx)(L.EuiButton,{onClick:r,iconType:"refresh",color:"danger"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesReloadButton",defaultMessage:"Try again"}))}))}const c=((e,t="")=>{if(e&&e.length>0)return e.find((e=>e.name===t))})(o,Object(d.attemptToURIDecode)(e));return Object(y.jsx)(yt,{value:{isNewPolicy:!(null!=c&&c.policy),policyName:Object(d.attemptToURIDecode)(e),policy:null!==(t=null==c?void 0:c.policy)&&void 0!==t?t:T.o,existingPolicies:o,license:{canUseSearchableSnapshot:()=>l.hasAtLeast(E.a)},indices:c&&c.indices?c.indices:[],indexTemplates:c&&c.indexTemplates?c.indexTemplates:[]}},Object(y.jsx)(Fa,null))};const za=Object(i.createContext)({listAction:null,setListAction:()=>{}}),Aa=({children:e})=>{const[t,a]=Object(i.useState)(null);return Object(y.jsx)(za.Provider,{value:{listAction:t,setListAction:a}},e)},Da=()=>{const e=Object(i.useContext)(za);if(!e)throw new Error("usePolicyListContext can only be called inside of PolicyListContext!");return e},Ia={deleteEnabled:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.deletePolicyButtonText",{defaultMessage:"Delete policy"}),deleteDisabled:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.deletePolicyButtonDisabledTooltip",{defaultMessage:"You cannot delete a policy that is being used by an index"}),viewIndices:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.viewIndicesButtonText",{defaultMessage:"View indices linked to policy"}),addIndexTemplate:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.addPolicyToTemplateButtonText",{defaultMessage:"Add policy to index template"})},Na={badge:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.templateBadgeType.managedLabel",{defaultMessage:"Managed"}),badgeTooltip:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.templateBadgeType.managedDescription",{defaultMessage:"This policy is preconfigured and managed by Elastic; editing or deleting this policy might break Kibana."})},Ra=({policies:e})=>{const t=Object(p.useHistory)(),{services:{getUrlForApp:a}}=m(),[s,o]=function(e,t){const a=localStorage.getItem(e),[l,s]=Object(i.useState)(function(e,t){if(!e)return t;try{return JSON.parse(e)}catch(e){return t}}(a,t));return Object(i.useEffect)((()=>{localStorage.setItem(e,JSON.stringify(l))}),[e,l]),[l,s]}("ILM_SHOW_MANAGED_POLICIES_BY_DEFAULT",!1),{setListAction:r}=Da(),c=Object(i.useMemo)((()=>({box:{incremental:!0,"data-test-subj":"ilmSearchBar"},toolsRight:Object(y.jsx)(L.EuiFlexItem,{grow:!1},Object(y.jsx)(L.EuiSwitch,{id:"checkboxShowHiddenIndices","data-test-subj":"includeHiddenPoliciesSwitch",checked:s,onChange:e=>o(e.target.checked),label:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.hiddenPoliciesSwitchLabel",defaultMessage:"Include managed system policies"})}))})),[s,o]),d=Object(i.useMemo)((()=>s?e:e.filter((e=>{var t,a;return!(null!==(t=e.policy)&&void 0!==t&&null!==(a=t._meta)&&void 0!==a&&a.managed)}))),[e,s]),u=[{"data-test-subj":"policy-name",field:"name",name:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.headers.nameHeader",{defaultMessage:"Name"}),sortable:!0,render:(e,a)=>{var i,s;const o=null===(i=a.policy)||void 0===i||null===(s=i._meta)||void 0===s?void 0:s.managed;return Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(L.EuiLink,f()({className:"eui-textBreakAll","data-test-subj":"policyTablePolicyNameLink"},Object(n.reactRouterNavigate)(t,Object(Ot.e)(e),(()=>Object(Qe.c)(k.METRIC_TYPE.CLICK,T.f)))),e),o&&Object(y.jsx)(l.a.Fragment,null," ",Object(y.jsx)(L.EuiToolTip,{content:Na.badgeTooltip},Object(y.jsx)(L.EuiBadge,{color:"hollow","data-test-subj":"managedPolicyBadge"},Na.badge))))}},{"data-test-subj":"policy-indexTemplates",field:"indexTemplates",name:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.headers.indexTemplatesHeader",{defaultMessage:"Linked index templates"}),sortable:({indexTemplates:e})=>(null!=e?e:[]).length,render:(e,t)=>e&&e.length>0?Object(y.jsx)(L.EuiToolTip,{content:Ia.viewIndices,position:"left"},Object(y.jsx)(L.EuiButtonEmpty,{flush:"both","data-test-subj":"viewIndexTemplates",onClick:()=>r({selectedPolicy:t,actionType:"viewIndexTemplates"})},e.length)):"0"},{"data-test-subj":"policy-indices",field:"indices",name:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.headers.linkedIndicesHeader",{defaultMessage:"Linked indices"}),sortable:({indices:e})=>(null!=e?e:[]).length,render:(e,t)=>e&&e.length>0?Object(y.jsx)(L.EuiToolTip,{content:Ia.viewIndices,position:"left"},Object(y.jsx)(L.EuiLink,{href:Object(Ot.b)(t.name,a)},e.length)):"0"},{"data-test-subj":"policy-modifiedDate",field:"modifiedDate",name:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.headers.modifiedDateHeader",{defaultMessage:"Modified date"}),sortable:!0,render:e=>e?U()(e).format("MMM D, YYYY"):e},{actions:[{render:e=>Object(y.jsx)(L.EuiToolTip,{content:Ia.addIndexTemplate},Object(y.jsx)(L.EuiButtonIcon,{"data-test-subj":"addPolicyToTemplate",onClick:()=>r({selectedPolicy:e,actionType:"addIndexTemplate"}),iconType:"plusInCircle","aria-label":Ia.addIndexTemplate}))},{render:(e,t)=>Object(y.jsx)(L.EuiToolTip,{content:t?Ia.deleteEnabled:Ia.deleteDisabled},Object(y.jsx)(L.EuiButtonIcon,{"data-test-subj":"deletePolicy",onClick:()=>r({selectedPolicy:e,actionType:"deletePolicy"}),iconType:"trash","aria-label":Ia.deleteEnabled,disabled:!t})),enabled:e=>!(e=>Boolean(e.indices&&e.indices.length))(e)}],name:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.headers.actionsHeader",{defaultMessage:"Actions"})}];return Object(y.jsx)(L.EuiInMemoryTable,{tableCaption:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.captionText",{defaultMessage:"The table below contains {count, plural, one {# Index Lifecycle policy} other {# Index Lifecycle policies}} .",values:{count:e.length}}),pagination:!0,sorting:{sort:{field:"name",direction:"asc"}},search:c,tableLayout:"auto",items:d,columns:u,rowProps:e=>({"data-test-subj":`policyTableRow-${e.name}`})})};var Ua=a(4),Ba=a.n(Ua);class confirm_delete_ConfirmDelete extends i.Component{constructor(...e){super(...e),Ba()(this,"state",{isDeleteConfirmed:!1}),Ba()(this,"setIsDeleteConfirmed",(e=>{this.setState({isDeleteConfirmed:e})})),Ba()(this,"deletePolicy",(async()=>{const{policyToDelete:e,callback:t}=this.props,a=e.name;try{await Object(F.c)(a);const e=z.i18n.translate("xpack.indexLifecycleMgmt.confirmDelete.successMessage",{defaultMessage:"Deleted policy {policyName}",values:{policyName:a}});A.c.addSuccess(e)}catch(e){const t=z.i18n.translate("xpack.indexLifecycleMgmt.confirmDelete.errorMessage",{defaultMessage:"Error deleting policy {policyName}",values:{policyName:a}});Object(Xe.a)(e,t)}t&&t()})),Ba()(this,"isPolicyPolicy",!0)}render(){var e,t;const{policyToDelete:a,onCancel:i}=this.props,{isDeleteConfirmed:l}=this.state,s=null===(e=a.policy)||void 0===e||null===(t=e._meta)||void 0===t?void 0:t.managed,n=z.i18n.translate("xpack.indexLifecycleMgmt.confirmDelete.title",{defaultMessage:'Delete policy "{name}"',values:{name:a.name}});return Object(y.jsx)(L.EuiConfirmModal,{"data-test-subj":"deletePolicyModal",title:n,onCancel:i,onConfirm:this.deletePolicy,cancelButtonText:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.confirmDelete.cancelButton",defaultMessage:"Cancel"}),confirmButtonText:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.confirmDelete.deleteButton",defaultMessage:"Delete"}),buttonColor:"danger",confirmButtonDisabled:!!s&&!l},s?Object(y.jsx)(L.EuiCallOut,{title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.deletePolicyModal.proceedWithCautionCallOutTitle",defaultMessage:"Deleting a managed policy can break Kibana"}),color:"danger",iconType:"warning","data-test-subj":"deleteManagedPolicyCallOut"},Object(y.jsx)("p",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.deletePolicyModal.proceedWithCautionCallOutDescription",defaultMessage:"Managed policies are critical for internal operations. If you delete this managed policy, you can’t recover it."})),Object(y.jsx)(L.EuiCheckbox,{id:"confirmDeletePolicyCheckbox",label:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.deletePolicyModal.confirmDeleteCheckboxLabel",defaultMessage:"I understand the consequences of deleting a managed policy"}),checked:l,onChange:e=>this.setIsDeleteConfirmed(e.target.checked)})):Object(y.jsx)("div",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.confirmDelete.undoneWarning",defaultMessage:"You can't recover a deleted policy."})))}}const $a=({policy:e,onSuccess:t,onCancel:a})=>{const[s,n]=Object(i.useState)(!1),[o,r]=Object(i.useState)(""),[c,d]=Object(i.useState)(""),[u,p]=Object(i.useState)(""),{error:h,isLoading:f,data:x,resendRequest:g}=Object(F.h)(s),b=z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.title",{defaultMessage:'Add policy "{name}" to index template',values:{name:e.name}}),{docLinks:j}=m().services;return Object(y.jsx)(L.EuiConfirmModal,{"data-test-subj":"addPolicyToTemplateModal",title:b,onCancel:a,onConfirm:async()=>{const a=e.name;if(o)try{await Object(F.b)({policyName:a,templateName:o,aliasName:""===c?void 0:c},s);const e=z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.successMessage",{defaultMessage:"Added policy {policyName} to index template {templateName}",values:{policyName:a,templateName:o}});A.c.addSuccess(e),t(o)}catch(e){const t=z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.errorMessage",{defaultMessage:'Error adding policy "{policyName}" to index template {templateName}',values:{policyName:a,templateName:o}});Object(Xe.a)(e,t)}else p(z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.noTemplateSelectedErrorMessage",{defaultMessage:"You must select an index template."}))},cancelButtonText:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.cancelButton",{defaultMessage:"Cancel"}),confirmButtonText:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.confirmButton",{defaultMessage:"Add policy"}),confirmButtonDisabled:f||!!h||!x},Object(y.jsx)(L.EuiText,null,Object(y.jsx)("p",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.explanationText",defaultMessage:"This will apply the lifecycle policy to all indices which match the index template."})," ",Object(y.jsx)(Ze,{docPath:j.links.elasticsearch.indexTemplates,text:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.editPolicy.learnAboutIndexTemplatesLink",defaultMessage:"Learn about index templates"})}))),Object(y.jsx)(L.EuiSpacer,{size:"m"}),(()=>{let t=[];return x&&(t=x.map((({name:e})=>({label:e})))),Object(y.jsx)(L.EuiForm,null,Object(y.jsx)(L.EuiFormRow,null,Object(y.jsx)(L.EuiSwitch,{label:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.showLegacyTemplates",defaultMessage:"Show legacy index templates"}),checked:s,onChange:e=>{r(""),n(e.target.checked)}})),h?(()=>{const{statusCode:e="",message:t=""}=h;return Object(y.jsx)(i.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(L.EuiCallOut,{style:{maxWidth:400},title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.errorLoadingTemplatesTitle",defaultMessage:"Unable to load index templates"}),color:"danger"},Object(y.jsx)("p",null,t," (",e,")"),Object(y.jsx)(L.EuiButton,{isLoading:f,color:"danger",onClick:g},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.indexManagementTable.addLifecyclePolicyToTemplateConfirmModal.errorLoadingTemplatesButton",defaultMessage:"Try again"}))),Object(y.jsx)(L.EuiSpacer,{size:"s"}))})():Object(y.jsx)(l.a.Fragment,null,(()=>{var e,t,a;const l=null==x?void 0:x.find((e=>e.name===o)),s=null==l||null===(e=l.settings)||void 0===e||null===(t=e.index)||void 0===t||null===(a=t.lifecycle)||void 0===a?void 0:a.name;if(s)return Object(y.jsx)(i.Fragment,null,Object(y.jsx)(L.EuiSpacer,{size:"s"}),Object(y.jsx)(L.EuiCallOut,{style:{maxWidth:400},title:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.templateHasPolicyWarningTitle",defaultMessage:"Template already has policy"}),color:"warning"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.indexManagementTable.addLifecyclePolicyToTemplateConfirmModal.indexHasNoAliasesWarningMessage",defaultMessage:"This index template already has the policy {existingPolicyName} attached to it. Adding this policy will overwrite that configuration.",values:{existingPolicyName:s}})),Object(y.jsx)(L.EuiSpacer,{size:"s"}))})(),Object(y.jsx)(L.EuiFormRow,{isInvalid:!!u,error:u,label:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.chooseTemplateLabel",defaultMessage:"Index template"})},Object(y.jsx)(L.EuiComboBox,{isLoading:f,placeholder:z.i18n.translate("xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.chooseTemplateMessage",{defaultMessage:"Select an index template"}),options:t,selectedOptions:o?[{label:o}]:[],onChange:e=>{p(""),r(e.length>0?e[0].label:"")},singleSelection:{asPlainText:!0},isClearable:!0}))),(null===(a=e.policy.phases.hot)||void 0===a?void 0:a.actions.rollover)?Object(y.jsx)(L.EuiFormRow,{label:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.addLifecyclePolicyToTemplateConfirmModal.rolloverAliasLabel",defaultMessage:"Alias for rollover index"})},Object(y.jsx)(L.EuiFieldText,{value:c,onChange:e=>{d(e.target.value)}})):null);var a})())},qa=({updatePolicies:e})=>{const{listAction:t,setListAction:a}=Da();var i;return"viewIndexTemplates"===(null==t?void 0:t.actionType)?Object(y.jsx)(Pt,{policyName:t.selectedPolicy.name,indexTemplates:null!==(i=t.selectedPolicy.indexTemplates)&&void 0!==i?i:[],close:()=>{a(null)}}):"deletePolicy"===(null==t?void 0:t.actionType)?Object(y.jsx)(confirm_delete_ConfirmDelete,{policyToDelete:t.selectedPolicy,callback:()=>{e(),a(null)},onCancel:()=>{a(null)}}):"addIndexTemplate"===(null==t?void 0:t.actionType)?Object(y.jsx)($a,{policy:t.selectedPolicy,onSuccess:e=>{t.selectedPolicy.indexTemplates=[...t.selectedPolicy.indexTemplates||[],e],a(null)},onCancel:()=>a(null)}):null},Va=({policies:e,updatePolicies:t})=>{const a=Object(p.useHistory)(),s=Object(y.jsx)(L.EuiButton,f()({},Object(n.reactRouterNavigate)(a,Object(Ot.d)()),{fill:!0,iconType:"plusInCircle","data-test-subj":"createPolicyButton"}),Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.emptyPrompt.createButtonLabel",defaultMessage:"Create policy"}));return 0===e.length?Object(y.jsx)(L.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"subdued"},Object(y.jsx)(L.EuiEmptyPrompt,{iconType:"managementApp",title:Object(y.jsx)("h1",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.emptyPromptTitle",defaultMessage:"Create your first index lifecycle policy"})),body:Object(y.jsx)(i.Fragment,null,Object(y.jsx)("p",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.emptyPromptDescription",defaultMessage:" An index lifecycle policy helps you manage your indices as they age."}))),actions:s})):Object(y.jsx)(l.a.Fragment,null,Object(y.jsx)(qa,{updatePolicies:t}),Object(y.jsx)(L.EuiPageHeader,{pageTitle:Object(y.jsx)("span",{"data-test-subj":"ilmPageHeader"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.sectionHeading",defaultMessage:"Index Lifecycle Policies"})),description:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.sectionDescription",defaultMessage:"Manage your indices as they age. Attach a policy to automate when and how to transition an index through its lifecycle."}),bottomBorder:!0,rightSideItems:[s]}),Object(y.jsx)(L.EuiSpacer,{size:"l"}),Object(y.jsx)(Ra,{policies:e}))},Wa=()=>{const{services:{breadcrumbService:e}}=m(),{data:t,isLoading:a,error:l,resendRequest:s}=Object(F.k)();if(Object(i.useEffect)((()=>{e.setBreadcrumbs("policies")}),[e]),a)return Object(y.jsx)(L.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"subdued"},Object(y.jsx)(L.EuiEmptyPrompt,{title:Object(y.jsx)(L.EuiLoadingSpinner,{size:"xl"}),body:Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.policiesLoading",defaultMessage:"Loading policies..."})}));if(l){const{statusCode:e,message:t}=l||{statusCode:"",message:""};return Object(y.jsx)(L.EuiPageContent_Deprecated,{verticalPosition:"center",horizontalPosition:"center",color:"danger"},Object(y.jsx)(L.EuiEmptyPrompt,{title:Object(y.jsx)("h2",null,Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.policiesLoadingFailedTitle",defaultMessage:"Unable to load existing lifecycle policies"})),body:Object(y.jsx)("p",null,t," (",e,")"),actions:Object(y.jsx)(L.EuiButton,{onClick:s,iconType:"refresh",color:"danger"},Object(y.jsx)(S.FormattedMessage,{id:"xpack.indexLifecycleMgmt.policyTable.policiesReloadButton",defaultMessage:"Try again"}))}))}return Object(y.jsx)(Aa,null,Object(y.jsx)(Va,{policies:t||[],updatePolicies:s}))},Ha=({history:e})=>(Object(i.useEffect)((()=>Object(Qe.c)(k.METRIC_TYPE.LOADED,T.a)),[]),Object(y.jsx)(P,{history:e},Object(y.jsx)(w,null,Object(y.jsx)(p.Redirect,{exact:!0,from:"/",to:Ot.a.list}),Object(y.jsx)(v,{exact:!0,path:Ot.a.list,component:Wa}),Object(y.jsx)(v,{path:Ot.a.edit,component:Ca})))),Ga=(e,t,a,i,l,o,r,c,d,m)=>{const{getUrlForApp:p}=i;return Object(s.render)(Object(y.jsx)(n.RedirectAppLinks,{application:i,className:u.APP_WRAPPER_CLASS},Object(y.jsx)(t,null,Object(y.jsx)(n.KibanaThemeProvider,{theme$:r},Object(y.jsx)(n.KibanaContextProvider,{services:{cloud:m,breadcrumbService:l,license:o,getUrlForApp:p,docLinks:c,executionContext:d}},Object(y.jsx)(Ha,{history:a}))))),e),()=>Object(s.unmountComponentAtNode)(e)}}])]);