|
|
!function(s){function webpackJsonpCallback(o){for(var R,O,P=o[0],N=o[1],V=o[2],j=0,K=[];j<P.length;j++)O=P[j],Object.prototype.hasOwnProperty.call(_,O)&&_[O]&&K.push(_[O][0]),_[O]=0;for(R in N)Object.prototype.hasOwnProperty.call(N,R)&&(s[R]=N[R]);for(D&&D(o);K.length;)K.shift()();return S.push.apply(S,V||[]),checkDeferredModules()}function checkDeferredModules(){for(var s,o=0;o<S.length;o++){for(var R=S[o],O=!0,P=1;P<R.length;P++){var D=R[P];0!==_[D]&&(O=!1)}O&&(S.splice(o--,1),s=__webpack_require__(__webpack_require__.s=R[0]))}return s}var o={},_={28:0},S=[];function __webpack_require__(_){if(o[_])return o[_].exports;var S=o[_]={i:_,l:!1,exports:{}};return s[_].call(S.exports,S,S.exports,__webpack_require__),S.l=!0,S.exports}__webpack_require__.e=function requireEnsure(){return Promise.resolve()},__webpack_require__.m=s,__webpack_require__.c=o,__webpack_require__.d=function(s,o,_){__webpack_require__.o(s,o)||Object.defineProperty(s,o,{enumerable:!0,get:_})},__webpack_require__.r=function(s){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},__webpack_require__.t=function(s,o){if(1&o&&(s=__webpack_require__(s)),8&o)return s;if(4&o&&"object"==typeof s&&s&&s.__esModule)return s;var _=Object.create(null);if(__webpack_require__.r(_),Object.defineProperty(_,"default",{enumerable:!0,value:s}),2&o&&"string"!=typeof s)for(var S in s)__webpack_require__.d(_,S,function(o){return s[o]}.bind(null,S));return _},__webpack_require__.n=function(s){var o=s&&s.__esModule?function getDefault(){return s.default}:function getModuleExports(){return s};return __webpack_require__.d(o,"a",o),o},__webpack_require__.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},__webpack_require__.p="";var R=window.webpackJsonp=window.webpackJsonp||[],O=R.push.bind(R);R.push=webpackJsonpCallback,R=R.slice();for(var P=0;P<R.length;P++)webpackJsonpCallback(R[P]);var D=O;S.push([7652,1,0]),checkDeferredModules()}({1052:function(s,o,_){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.retrieveMLToolkitApp=o.mlModelsURL=o.mlModelsBaseURL=o.getSeverityColorFromColorRangeTable=void 0;var S=_(265),R=_(264),O=_(107),P=_(52),D=o.mlModelsURL="app/".concat(S.SPLUNKBASE_APPS.Machine_Learning_Toolkit.name,"/models");o.mlModelsBaseURL=(0,P.createITSIURL)(D);o.retrieveMLToolkitApp=()=>(0,R.retrieveApp)(S.SPLUNKBASE_APPS.Machine_Learning_Toolkit.name);o.getSeverityColorFromColorRangeTable=function getSeverityColorFromColorRangeTable(s){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[(0,O.getSeverityColor)(6),(0,O.getSeverityColor)(5),(0,O.getSeverityColor)(4),(0,O.getSeverityColor)(3),(0,O.getSeverityColor)(2)],_=o.length-1,S=100/o.length,R=Math.floor(s/S);return 100===s?o[_]:R>_||R<0?(0,O.getSeverityColor)(-1):o[R]}},1053:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=S(_(32)),N=S(_(15)),V=S(_(150)),j=S(_(70)),K=S(_(0)),W=S(_(35)),U=S(_(2)),Y=_(4),$=_(14),X=S(_(89)),Z=_(2539),Q=_(175),ee=_(57),te=S(_(2619)),ie=S(_(111)),ae=S(_(2620)),ne=S(_(47)),re=(0,U.default)(X.default)(R||(R=(0,P.default)(['\n\t& [data-test="toggle"] {\n\t\ttext-overflow: ellipsis;\n\t\toverflow: hidden;\n\t\twhite-space: nowrap;\n\t\tmax-width: ',"\n\t}\n"])),s=>"".concat(s.tooltipToggleWidth,"px")),se=U.default.h3(O||(O=(0,P.default)(["\n\tmax-width: 100%;\n"]))),le=N.default.View.extend({isReadOnly:!1,initialize:function initialize(s){if(!(s=s||{}).serviceModel)throw"Must provide serviceModel";this.servicesCollectionData=s.servicesCollectionData,this.serviceModel=s.serviceModel,this.showOverview=s.showOverview||!0,this.severityLabels=s.severityLabels,this.kpiCollection=this.serviceModel.get("kpis"),this.isBaseServiceTemplate=this.serviceModel.get("object_type")===Q.OBJECT_TYPE,this.initKPIDependencyCollection(),this.dispatcher=(0,j.default)({},N.default.Events),this.overviewView=new ae.default({collection:this.kpiCollection,serviceModel:this.serviceModel,dependentKpiCollection:this.dependentKpiCollection,severityLabels:this.severityLabels}),this.listenTo(this.overviewView,"set-tile-not-loading",this.triggerTileNotLoading),this.children={},this.filteredKpiCollection=new N.default.Collection,this.dependentFilteredKpiCollection=new N.default.Collection,N.default.View.prototype.initialize.apply(this,arguments)},initKPIDependencyCollection:function initKPIDependencyCollection(){if(this.dependentKpiCollection=new N.default.Collection,!this.isBaseServiceTemplate){this.serviceDependenciesIndexMap={},this.unOverloaded={};for(var s,o=this.serviceModel.get("services_depends_on"),_=o.length-1;_>=0;_--){this.serviceDependenciesIndexMap[o[_].serviceid]=_;for(var S=o[_].kpis_depending_on.length-1;S>=0;S--)o[_].hasOwnProperty("overloaded_urgencies")&&o[_].overloaded_urgencies.hasOwnProperty(o[_].kpis_depending_on[S])?s=o[_].overloaded_urgencies[o[_].kpis_depending_on[S]]:-1!==o[_].kpis_depending_on[S].indexOf(ee.HEALTH_SCORE_KPI_PREFIX)?s=ee.DEFAULT_SHKPI_URGENCY:(this.unOverloaded[o[_].kpis_depending_on[S]]=!0,s=ee.DEFAULT_KPI_URGENCY),this.dependentKpiCollection.add(new N.default.Model({id:o[_].kpis_depending_on[S],serviceId:o[_].serviceid,urgency:s,kpi_severity:"normal"}))}this.listenTo(this.dependentKpiCollection,"change:urgency",this._updateServiceDependencies),this.listenTo(this.serviceModel,"changeDependencies",this._reRenderDependencyTable)}},_addTitlesAndRenderDependencyTable:function _addTitlesAndRenderDependencyTable(){for(var s,o=this.servicesCollectionData.length-1;o>=0;o--)for(var _=this.servicesCollectionData[o].kpis.length-1;_>=0;_--)(s=this.dependentKpiCollection.get(this.servicesCollectionData[o].kpis[_]._key))&&(s.set("kpiTitle",this.servicesCollectionData[o].kpis[_].title),s.set("serviceTitle",this.servicesCollectionData[o].title));delete this.unOverloaded,this.renderDependencyTableView()},_reRenderDependencyTable:function _reRenderDependencyTable(){this.stopListening(this.overviewView,"set-tile-not-loading",this.triggerTileNotLoading),this.overviewView.remove(),this.initKPIDependencyCollection(),this.overviewView=new ae.default({collection:this.kpiCollection,serviceModel:this.serviceModel,dependentKpiCollection:this.dependentKpiCollection,severityLabels:this.severityLabels}),this.listenTo(this.overviewView,"set-tile-not-loading",this.triggerTileNotLoading),this._recalculateHealthScore(),this.showOverview&&this.$(".service-health-overview").append(this.overviewView.render().$el),this._addTitlesAndRenderDependencyTable()},_updateServiceDependencies:function _updateServiceDependencies(s){var o=this.serviceModel.get("services_depends_on"),_=this.serviceModel.get("services_depends_on")[this.serviceDependenciesIndexMap[s.get("serviceId")]];_.overloaded_urgencies=_.overloaded_urgencies||{},_.overloaded_urgencies[String(s.id)]=s.get("urgency"),this.serviceModel.set("services_depends_on",o),this.serviceModel.trigger("change"),this._recalculateHealthScore()},renderDependencyTableView:function renderDependencyTableView(){this.$(".service-health-dependent-kpi-importance-table").length&&(this.dependentFilteredKpiCollection.reset(),this.dependentKpiCollection.models.forEach(s=>{var o=new N.default.Model({id:s.get("id"),kpiTitle:s.get("kpiTitle"),serviceId:s.get("serviceId"),serviceTitle:s.get("serviceTitle"),kpi_severity:s.get("kpi_severity"),urgency:s.get("urgency")});this.dependentFilteredKpiCollection.add(o)}),this.listenTo(this.dependentFilteredKpiCollection,"change:kpi_severity",this._recalculateHealthScore),this.listenTo(this.dependentFilteredKpiCollection,"change:urgency",this._updateDependentUrgency),W.default.unmountComponentAtNode(this.$(".service-health-dependent-kpi-importance-table").get(0)),W.default.render(K.default.createElement(ne.default,null,K.default.createElement(te.default,{kpiCollection:this.dependentFilteredKpiCollection,isBaseServiceTemplate:this.isBaseServiceTemplate,isReadOnly:this.isReadOnly})),this.$(".service-health-dependent-kpi-importance-table").get(0)),this.children.loadingDependentKpisMessage.hide())},getKpiHealthScores:function getKpiHealthScores(){this.kpiToStatus={};var s={output_mode:"csv",exec_mode:"oneshot",search:"search `get_itsi_summary_index` `service_level_max_severity_event_only` earliest=-60m | stats latest(alert_severity) as latest_status latest(kpi) as kpi_name by itsi_service_id itsi_kpi_id "+"| search itsi_service_id=".concat(this.serviceModel.id)},o=D.default.Deferred();return(0,Z.retrieveJob)(s).then(s=>s.data).then(s=>{var _=s.split("\n");_.length<=1&&o.resolve();for(var S=1;S<_.length;++S){var R=_[S].split(","),O=R[1];this.kpiToStatus[O]=R[2]}this.overviewView.updateKpiToStatus(this.kpiToStatus),o.resolve()}).catch(s=>{o.reject(s)}),o},render:function render(){if(this.kpiCollection.length>0){var s=new ie.default({content:(0,Y.gettext)("Loading health score data..."),dataTestItsi:"service-health-view-loading-message",style:{marginTop:20},type:"info"});this.$el.html(s.render().$el),this.getKpiHealthScores().done(function(){this._renderData(),this._recalculateHealthScore()}.bind(this)).fail(function(){this.$el.text((0,Y.gettext)("Failed to load health score data."))}.bind(this))}else this.$el.text((0,Y.gettext)("You must create KPIs before configuring service health."));return this},_renderData:function _renderData(){this.$el.html('<div class="service-health-overview"></div><h3 class="first-service-health-table service-health-table-title" data-test-itsi="direct-kpi-service-health-table-title"></h3><div class="service-health-kpi-importance-table-loading-container"></div><div class="service-health-kpi-importance-table"></div><h3 class="second-service-health-table service-health-table-title" data-test-itsi="dependent-kpi-service-health-table-title">'+(0,Y.gettext)("Dependent KPIs")+'</h3><div class="service-health-dependent-kpi-importance-table-loading-container"></div><div class="service-health-dependent-kpi-importance-table"></div>'),this.children.loadingKpisMessage=new ie.default({content:(0,Y.gettext)("Loading KPIs importance..."),dataTestItsi:"service-health-view-loading-kpi-importance-message",style:{marginTop:20},type:"info"}),this.$el.find(".service-health-kpi-importance-table-loading-container").html(this.children.loadingKpisMessage.render().$el),this.children.loadingDependentKpisMessage=new ie.default({content:(0,Y.gettext)("Loading dependent KPIs importance..."),dataTestItsi:"service-health-view-loading-kpi-dependent-importance-message",style:{marginTop:20},type:"info"}),this.$el.find(".service-health-dependent-kpi-importance-table-loading-container").html(this.children.loadingDependentKpisMessage.render().$el),this.showOverview&&this.$(".service-health-overview").append(this.overviewView.render().$el),this.$(".service-health-kpi-importance-table").length&&(this.filteredKpiCollection.reset(),this.kpiCollection.models.forEach(s=>{var o=s.get("_key")||"";if(!o.startsWith(ee.HEALTH_SCORE_KPI_PREFIX)){var _=new N.default.Model({_key:o,title:s.get("title"),kpi_severity:"normal",urgency:s.get("urgency")});this.filteredKpiCollection.add(_)}}),this.listenTo(this.filteredKpiCollection,"change:kpi_severity",this._recalculateHealthScore),this.listenTo(this.filteredKpiCollection,"change:urgency",this._updateUrgency),W.default.unmountComponentAtNode(this.$(".service-health-kpi-importance-table").get(0)),W.default.render(K.default.createElement(ne.default,null,K.default.createElement(te.default,{isDependentKPIs:!1,kpiCollection:this.filteredKpiCollection,isBaseServiceTemplate:this.isBaseServiceTemplate,isReadOnly:this.isReadOnly})),this.$(".service-health-kpi-importance-table").get(0))),this.children.loadingKpisMessage.hide();var s=this.$el.find(".first-service-health-table");if(s.length){var o=this.serviceModel.get("title"),_=(0,$.sprintf)((0,Y.gettext)("KPIs of %s"),(0,V.default)(o));W.default.unmountComponentAtNode(s.get(0)),W.default.render(K.default.createElement(ne.default,null,K.default.createElement(re,{content:o.length<100?"":o,"data-test-itsi":"service-health-table-service-name",tooltipToggleWidth:"700"},K.default.createElement(se,{className:"service-health-table-service-name service-health-table-title","data-test-itsi":"direct-kpi-service-health-table-title"},_))),s.get(0))}this._addTitlesAndRenderDependencyTable()},triggerTileNotLoading:function triggerTileNotLoading(){this.trigger("set-tile-not-loading")},triggerTileLoading:function triggerTileLoading(){this.trigger("set-tile-loading")},_updateUrgency:function _updateUrgency(s){this.triggerTileLoading();var o=this.kpiCollection.filter(o=>o.get("_key")===s.get("_key"));o.length&&o[0].set("urgency",s.get("urgency"))},_updateDependentUrgency:function _updateDependentUrgency(s){this.triggerTileLoading();var o=this.dependentKpiCollection.filter(o=>o.get("id")===s.get("id"));o.length&&o[0].set("urgency",s.get("urgency"))},_recalculateHealthScore:function _recalculateHealthScore(){this.triggerTileLoading(),this.kpiToStatus={},this.filteredKpiCollection.models.forEach(s=>{"unknown"!==s.get("kpi_severity")&&(this.kpiToStatus[s.get("_key")]=s.get("kpi_severity"))}),this.dependentFilteredKpiCollection.each(function(s){this.kpiToStatus[s.id]=s.get("kpi_severity")}.bind(this)),this.overviewView.updateKpiToStatus(this.kpiToStatus),this.overviewView.render()},remove:function remove(){return this.overviewView.remove(),N.default.View.prototype.remove.apply(this,arguments)}});o.default=le;s.exports=o.default},1054:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=S(_(0)),N=S(_(2)),V=S(_(3)),j=S(_(51)),K=_(740),W=_(4),U=(0,N.default)(j.default)(R||(R=(0,P.default)(["\n margin: 0;\n font-weight: 500;\n"]))),Y=(0,N.default)(j.default)(O||(O=(0,P.default)(["\n margin-left: 20px;\n"])));function AIAnalysisInProgressMessage(s){var{title:o,message:_}=s;return D.default.createElement(D.default.Fragment,null,D.default.createElement(K.AILoadingCard,{"data-test":"thresholding-ai-analysis-in-progress-card",isLoading:!0},D.default.createElement(U,{"data-test-itsi":"thresholding-ai-analysis-in-progress-message"},o)),_&&D.default.createElement(Y,{"data-test-itsi":"thresholding-ai-analysis-in-progress-content"},_))}AIAnalysisInProgressMessage.propTypes={message:V.default.string,title:V.default.string},AIAnalysisInProgressMessage.defaultProps={message:"",title:(0,W.gettext)("AI analysis in progress")};o.default=AIAnalysisInProgressMessage;s.exports=o.default},1055:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q=S(_(60)),ee=S(_(7)),te=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),ie=S(_(3)),ae=S(_(2)),ne=S(_(33)),re=S(_(39)),se=_(740),le=S(_(704)),oe=S(_(720)),de=S(_(27)),ce=S(_(156)),he=S(_(64)),ue=S(_(247)),pe=S(_(24)),fe=S(_(51)),ge=S(_(131)),me=S(_(314)),ve=S(_(93)),ye=S(_(461)),_e=S(_(121)),Se=S(_(116)),be=_(14),Ee=_(4),Te=S(_(2550)),Ce=_(107),ke=_(110),xe=_(187),we=_(102),Re=_(501),Ie=_(57);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var Me=ae.default.div(R||(R=(0,ee.default)(["\n padding-left: 25px;\n"]))),Oe=(0,ae.default)(ve.default.Cell)(O||(O=(0,ee.default)(["\n display: flex;\n flex-wrap: wrap;\n gap: 0px 10px;\n"]))),Ae=ae.default.div(P||(P=(0,ee.default)(["\n display: flex;\n flex-wrap: wrap;\n gap: 0px 10px;\n"]))),Pe=(0,ae.default)(se.AIIcon)(D||(D=(0,ee.default)(["\n margin-right: 5px;\n"]))),De=(0,ae.default)(he.default)(N||(N=(0,ee.default)(["\n margin-top: 0px;\n margin-bottom: 10px;\n"]))),Le=(0,ae.default)(ue.default)(V||(V=(0,ee.default)(["\n padding-left: 20px;\n margin: 0px 0px 15px 0px;\n"]))),Ne=ae.default.div(j||(j=(0,ee.default)(["\n display: flex;\n"]))),Ve=(0,ae.default)(me.default)(K||(K=(0,ee.default)(["\n margin-top: 2px;\n margin-right: 4px;\n border-radius: 3px;\n color: ",";\n"])),s=>s.severityColor),je=ae.default.div(W||(W=(0,ee.default)(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n justify-items: center;\n margin-bottom: 10px;\n"]))),He=ae.default.div(U||(U=(0,ee.default)(["\n display: flex;\n flex-direction: row;\n gap: 16px;\n align-items: baseline;\n"]))),Be=(0,ae.default)(ye.default)(Y||(Y=(0,ee.default)(["\n margin-top: 15px;\n margin-bottom: 10px;\n"]))),Ke=(0,ae.default)(pe.default)($||($=(0,ee.default)(["\n margin-top: 10px;\n\n [data-test='content'] {\n flex-direction: column;\n }\n"]))),Fe=(0,ae.default)(ce.default)(X||(X=(0,ee.default)(["\n color: ",";\n"])),Se.default.linkColor),We=(0,ae.default)(de.default)(Z||(Z=(0,ee.default)(["\n margin-left: 12px;\n"]))),Ue=te.default.createElement(oe.default,null);function AISummaryTabContent(s){var o,_,S,{aiSummaryInfo:R,feedBackContent:O,handleGoToAISettings:P,handleGoToThresholdType:D,handleGoToThresholdLevels:N,showRedirectionControls:V,handleClearAIRecommendationError:j,shouldAllowRemoval:K}=s,{objectType:W,currentThreshold:U,recommendationError:Y,thresholdInfo:$,timeVariateThresholdsSpecification:X,isOutlierDetectionEnabled:Z,outlierDetectionAlgorithm:ee,aggregateThresholdsConfig:ie}=R,[ae,re]=(0,Re.getKpiRecommendationErrorMessage)(Y),[se,oe]=(0,te.useState)(1),de=null!=X&&X.policies?Object.keys(X.policies):[],renderSeverity=(s,o,_,S)=>te.default.createElement(Ne,{key:S,"data-test-itsi":"recommendation-ai-summary-threshold-level"},te.default.createElement(Ve,{size:1,severityColor:o,variant:"filled"}),te.default.createElement(fe.default,{"data-test-itsi":"recommendation-ai-summary-threshold-value"},"".concat((0,Ce.getSeverityLabel)(s)," ").concat(_.toFixed(2)))),ce=(0,te.useCallback)((s,o)=>{var{page:_}=o;oe(_)},[]);return te.default.createElement("div",null,(null==Y?void 0:Y.length)>0?te.default.createElement(Ke,(0,Q.default)({"data-test-itsi":"threshold-recommendation-error-message",appearance:"fill",type:"error"},K&&{onRequestRemove:j}),ae.length>0&&te.default.createElement(pe.default.Title,null,te.default.createElement("strong",null,ae)),re):te.default.createElement(te.default.Fragment,null,te.default.createElement(He,null,te.default.createElement(De,{"data-test-itsi":"recommendation-ai-summary-heading",level:3},te.default.createElement(Pe,{width:"24px",height:"24px"}),(0,Ee.gettext)("Recommendations summary")),te.default.createElement(Be,{"data-test-itsi":"recommendation-ai-summary-generated-date",as:"p",color:"muted"},(0,Ee.gettext)("Generated on")," ",_e.default.unix(null==$||null===(S=$.atRecommendationInfo)||void 0===S?void 0:S.lastRun).format("MMM DD YYYY, HH:mm A z").toString())),te.default.createElement(Me,null,te.default.createElement(He,null,te.default.createElement(De,{"data-test-itsi":"recommendation-ai-summary-threshold-type-header",level:3},(0,Ee.gettext)("Threshold type")),V&&te.default.createElement(Fe,{onClick:D,"data-test-itsi":"go-to-settings-clickable-link"},te.default.createElement(le.default,null)," ",(0,Ee.gettext)("Go to setting"))),te.default.createElement(Le,{"data-test-itsi":"recommendation-ai-summary-threshold-type-explanation-list"},te.default.createElement(ue.default.Item,{"data-test-itsi":"recommendation-ai-summary-threshold-type-explanation-list-item"},(()=>{var s;if((null==U?void 0:U.value)===we.THRESHOLD_TYPE_OPTIONS[0].value)return te.default.createElement(te.default.Fragment,null,te.default.createElement("b",null,(0,Ee.gettext)("Static thresholding"))," ",(0,Ee.gettext)("is selected,")," ",(0,be.sprintf)((0,Ee.gettext)("based on analysis of this %(object)s behavior over time."),{object:W===xe.OBJECT_TYPE?xe.OBJECT_NAMES.pluralLowerCase:Ie.KPI_OBJECT_NAMES.pluralLowerCase}));if((null==U?void 0:U.value)===we.THRESHOLD_TYPE_OPTIONS[1].value)return te.default.createElement(te.default.Fragment,null,te.default.createElement("b",null,(0,Ee.gettext)("Time-variant static thresholding"))," ",(0,Ee.gettext)("is selected,")," ",(0,be.sprintf)((0,Ee.gettext)("based on analysis of this %(object)s behavior over time."),{object:W===xe.OBJECT_TYPE?xe.OBJECT_NAMES.pluralLowerCase:Ie.KPI_OBJECT_NAMES.pluralLowerCase}));var o=we.ANALYSIS_WINDOW_OPTIONS.filter(s=>(null==s?void 0:s.value)===(null==$?void 0:$.adaptiveTrainingWindow))[0],_=null===(s=ke.POLICY_TYPES.find(s=>{var o;return(null==$||null===(o=$.atRecommendationInfo)||void 0===o?void 0:o.timePolicyType)===s.value}))||void 0===s?void 0:s.label.toLowerCase();return te.default.createElement(te.default.Fragment,null,te.default.createElement("b",null,(0,Ee.gettext)("Adaptive thresholding"))," ",(0,Ee.gettext)("is selected,")," ",(0,be.sprintf)((0,Ee.gettext)("with a %(days)s day analysis window using the %(algorithm)s algorithm."),{days:null==o?void 0:o.days,algorithm:_})," ",(0,be.sprintf)((0,Ee.gettext)("This setting automatically adjusts threshold values by analyzing historical %(object)s behavior, and the algorithm method calculates threshold values that fit your data's behavior"),{object:W===xe.OBJECT_TYPE?xe.OBJECT_NAMES.singularLowerCase:Ie.KPI_OBJECT_NAMES.singularLowerCase}))})()),U.value===we.THRESHOLD_TYPE_OPTIONS[2].value&&Z&&te.default.createElement(ue.default.Item,{"data-test-itsi":"recommendation-ai-summary-threshold-type-explanation-list-item"},te.default.createElement("b",null,(0,Ee.gettext)("Outlier exclusion is on"))," ",(0,Ee.gettext)("and")," ",te.default.createElement("b",null,(0,be.sprintf)((0,Ee.gettext)("uses %(outlierAlgo)s."),{outlierAlgo:we.OUTLIER_ALGORITHM_LABEL_MAP[ee].charAt(0).toLowerCase()+we.OUTLIER_ALGORITHM_LABEL_MAP[ee].slice(1)}))," ",(0,Ee.gettext)("Outlier exclusion defines data points to exclude from adaptive threshold calculations to avoid data skews."))),te.default.createElement(He,null,te.default.createElement(De,{"data-test-itsi":"recommendation-ai-summary-threshold-levels-header",level:3},(0,Ee.gettext)("Threshold levels")),V&&te.default.createElement(Fe,{onClick:N,"data-test-itsi":"go-to-settings-clickable-link"},te.default.createElement(le.default,null)," ",(0,Ee.gettext)("Go to setting"))),te.default.createElement(Le,{"data-test-itsi":"recommendation-ai-summary-threshold-level-explanation-list"},!(0,ne.default)($.atRecommendationInfo)&&U.value!==we.THRESHOLD_TYPE_OPTIONS[0].value&&te.default.createElement(ue.default.Item,{"data-test-itsi":"recommendation-ai-summary-threshold-level-explanation-list-item"},te.default.createElement("b",null,(0,be.sprintf)((0,Ee.gettext)("%(description)s is detected with %(confidence)s confidence (confidence score = %(score)s%%)."),{description:$.atRecommendationInfo.timePolicyDesc.charAt(0).toUpperCase()+$.atRecommendationInfo.timePolicyDesc.slice(1).toLowerCase(),confidence:$.atRecommendationInfo.confidenceLevel.toLowerCase(),score:(100*$.atRecommendationInfo.confidenceScore).toFixed(2)}))," ",(0,Ee.gettext)("This setting describes your data's patterns and are reflected in the recommendation."))),(0,ne.default)($.atRecommendationInfo)||U.value===we.THRESHOLD_TYPE_OPTIONS[0].value?!(0,ne.default)(ie)&&te.default.createElement("div",{"data-test-itsi":"recommendation-ai-summary-thresholds-container"},te.default.createElement(Ae,{"data-test-itsi":"recommendation-ai-summary-thresholds-level"},null==ie?void 0:ie.thresholdLevels.map((s,o)=>renderSeverity(s.severityLabel,s.severityColor,s.thresholdValue,o))),te.default.createElement(De,{"data-test-itsi":"recommendation-ai-summary-thresholds-base-severity-header",level:3},(0,Ee.gettext)("Base severity")),te.default.createElement(Ne,{"data-test-itsi":"recommendation-ai-summary-thresholds-base-severity"},te.default.createElement(Ve,{size:1,severityColor:null==ie?void 0:ie.baseSeverityColor,variant:"filled"}),te.default.createElement(fe.default,{"data-test-itsi":"recommendation-ai-summary-base-severity-text"},(0,Ce.getSeverityLabel)(null==ie?void 0:ie.baseSeverityLabel)))):te.default.createElement("div",{"data-test-itsi":"recommendation-ai-summary-time-policy-container"},te.default.createElement(je,null,te.default.createElement(De,{"data-test-itsi":"recommendation-ai-summary-time-policy-header",level:3},(0,Ee.gettext)("Time policies")),te.default.createElement(ge.default,{alwaysShowLastPageLink:!0,current:se,"data-test-itsi":"recommendation-ai-summary-time-policy-paginator",onChange:ce,totalPages:Math.ceil(de.length/5)})),te.default.createElement(ve.default,{stripeRows:!0,"data-test-itsi":"recommendation-ai-summary-time-policy-table"},te.default.createElement(ve.default.Head,null,te.default.createElement(ve.default.HeadCell,{"data-test-itsi":"recommendation-ai-summary-policy-title-head-cell",width:320},(0,Ee.gettext)("Policy title")),te.default.createElement(ve.default.HeadCell,{"data-test-itsi":"recommendation-ai-summary-base-severity-head-cell"},(0,Ee.gettext)("Base severity")),te.default.createElement(ve.default.HeadCell,{"data-test-itsi":"recommendation-ai-summary-threshold-levels-head-cell"},(0,Ee.gettext)("Threshold levels"))),te.default.createElement(ve.default.Body,null,(_=(o=5*(se-1))+5,de.slice(o,_).map(s=>{var o=X.policies[s],_=(0,ke.getAdornmentUnitStr)(o&&o.policy_type),S="kpi"===W?o.aggregate_thresholds:o.entity_thresholds;return te.default.createElement(ve.default.Row,{"data-test-itsi":"recommendation-ai-summary-time-policy-table-row",key:s},te.default.createElement(ve.default.Cell,{"data-test-itsi":"recommendation-ai-summary-time-policy-table-policy-title-cell"},o.title),te.default.createElement(ve.default.Cell,null,te.default.createElement(Ne,null,te.default.createElement(Ve,{size:1,severityColor:S.baseSeverityColor,variant:"filled"}),te.default.createElement(fe.default,{"data-test-itsi":"recommendation-ai-summary-base-severity-text"},(0,Ce.getSeverityLabel)(S.baseSeverityLabel)))),te.default.createElement(Oe,null,S.thresholdLevels.map((s,S)=>"static"===o.policy_type.toLowerCase()?renderSeverity(s.severityLabel,s.severityColor,s.thresholdValue,S):function renderSeverityForAdaptivePolicy(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"normal",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#99D18B",_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,S=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",R=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return te.default.createElement(Ne,{key:R,"data-test-itsi":"recommendation-ai-summary-threshold-level"},te.default.createElement(Ve,{size:1,severityColor:o,variant:"filled"}),te.default.createElement(fe.default,{"data-test-itsi":"recommendation-ai-summary-threshold-value"},"".concat((0,Ce.getSeverityLabel)(s)," ").concat(_.toFixed(2)).concat(S)))}(s.severityLabel,s.severityColor,s.dynamicParam,_,S))))}))))),!(0,ne.default)(O)&&te.default.createElement(te.default.Fragment,null,te.default.createElement(Te.default,{componentName:W===xe.OBJECT_NAMES.singularLowerCase?"AssistedEntityThresholding":"AssistedKpiThresholding",thumbsUpActionName:"Recommendation Thumbs Up",thumbsDownActionName:"Recommendation Thumbs Down",metadata:O,feedbackText:(0,Ee.gettext)("Were these recommendations helpful?")}),V&&te.default.createElement(We,{appearance:"secondary","data-test-itsi":"kpi-recommendation-regenerate-recommendation-button",icon:Ue,label:(0,Ee.gettext)("Regenerate"),onClick:P})))))}AISummaryTabContent.propTypes={aiSummaryInfo:ie.default.object.isRequired,feedBackContent:ie.default.object,showRedirectionControls:ie.default.bool,handleGoToAISettings:ie.default.func,handleGoToThresholdType:ie.default.func,handleGoToThresholdLevels:ie.default.func,handleClearAIRecommendationError:ie.default.func,shouldAllowRemoval:ie.default.bool},AISummaryTabContent.defaultProps={feedBackContent:{},handleGoToAISettings:re.default,handleGoToThresholdType:re.default,handleGoToThresholdLevels:re.default,showRedirectionControls:!0,handleClearAIRecommendationError:re.default,shouldAllowRemoval:!1};o.default=AISummaryTabContent;s.exports=o.default},1056:function(s,o,_){(()=>{"use strict";var o={n:s=>{var _=s&&s.__esModule?()=>s.default:()=>s;return o.d(_,{a:_}),_},d:(s,_)=>{for(var S in _)o.o(_,S)&&!o.o(s,S)&&Object.defineProperty(s,S,{enumerable:!0,get:_[S]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},S={};o.r(S),o.d(S,{default:()=>W});const R=_(0);var O=o.n(R);const P=_(104);var D=o.n(P);const N=_(106);function i(s,o){if(null==s)return{};var _,S,R=function l(s,o){if(null==s)return{};var _,S,R={},O=Object.keys(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||(R[_]=s[_]);return R}(s,o);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||Object.prototype.propertyIsEnumerable.call(s,_)&&(R[_]=s[_])}return R}var V=new Map;V.set("outlined",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{d:"M11.6633 6.5511C12.0538 6.16058 12.0538 5.52741 11.6633 5.13689C11.2728 4.74636 10.6396 4.74636 10.2491 5.13689L4.44666 10.9393C3.86088 11.5251 3.86088 12.4748 4.44666 13.0606L10.2491 18.8631C10.6396 19.2536 11.2728 19.2536 11.6633 18.8631C12.0538 18.4725 12.0538 17.8394 11.6633 17.4489L7.17893 12.9645H18.9897C19.542 12.9645 19.9897 12.5168 19.9897 11.9645C19.9897 11.4122 19.542 10.9645 18.9897 10.9645H7.24993L11.6633 6.5511Z"}))}));var j=["default","outlined"],K=function e(s){return"default"===s||s&&!function e(s){return j.indexOf(s)>=0}(s)?"outlined":s};const W=function e(s){var o=s.children,_=s.variant,S=void 0===_?"default":_,P=i(s,["children","variant"]),j=K(S),W="arrowleft-".concat(j),U=(0,R.useContext)(N.IconContext),Y=V.get(j);if(U&&Y){var $=U.toRender;if((0,U.addIcon)(W,Y()),!$)return null}return O().createElement(D(),P,o,U?O().createElement("use",{href:"#".concat(W)}):!!Y&&Y())};s.exports=S})()},1057:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=S(_(35)),D=S(_(0)),N=S(_(94)),V=S(_(37)),j=S(_(95)),K=S(_(153)),W=S(_(56)),U=S(_(770)),Y=S(_(91)),$=_(14),X=_(4),Z=_(85),Q=S(_(162)),ee=_(73),te=_(29),ie=_(61),ae=_(87),ne=_(78),re=_(110),se=_(141),le=_(102),oe=_(57),de=_(2648),ce=S(_(47)),he=S(_(155)),ue=S(_(258)),pe=S(_(2439)),fe=S(_(77)),ge=S(_(2649)),me=S(_(2651)),ve=S(_(2652)),ye=S(_(2440)),_e=S(_(2441)),Se=S(_(2656)),be=S(_(2657)),Ee=S(_(2658));_(2661);var Te=he.default.extend({dataTestItsi:"kpi-search-and-calculate-modal",isWide:!0,initialize:function initialize(s){if((s=s||{}).backdrop="static",!s.kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel.clone(),!s.serviceModel)throw"Must provide serviceModel";he.default.prototype.initialize.apply(this,arguments),this.isNestedModalShown=!1,this.featureFlags=s.featureFlags,this.serviceModel=s.serviceModel,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.currentStep=s.initialStep||1,this.metricsUtilsInstance=new pe.default,this.handleUpdateKpiModel=s.handleUpdateKpiModel,this.step1=new ve.default({kpiModel:this.kpiModel,serviceModel:this.serviceModel,metricsUtilsInstance:this.metricsUtilsInstance}),this.step2=new _e.default({kpiModel:this.kpiModel,serviceModel:this.serviceModel,metricsUtilsInstance:this.metricsUtilsInstance}),this.step3=new ye.default({kpiModel:this.kpiModel}),this.step4=new Se.default({kpiModel:this.kpiModel,serviceModel:this.serviceModel}),this.step5=new Ee.default({kpiModel:this.kpiModel,serviceModel:this.serviceModel,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping}),this.steps=[this.step1,this.step2,this.step3,this.step4,this.step5],s.showFTRSteps&&(this.step0=new me.default({kpiModel:this.kpiModel,serviceModel:this.serviceModel}),this.steps.unshift(this.step0),this.step6=new be.default({kpiModel:this.kpiModel,serviceModel:this.serviceModel,aggregateThresholdModel:this.kpiModel.getThresholdSettingModel(re.KPI_THRESHOLD_TYPES.AGGREGATE),entityThresholdModel:this.kpiModel.getThresholdSettingModel(re.KPI_THRESHOLD_TYPES.ENTITY),featureFlags:this.featureFlags}),this.steps.push(this.step6)),this.flashMessagesCollection=new O.default.Collection,this.flashMessages=new ue.default({collection:this.flashMessagesCollection}),this.generatedSearchView=new ge.default({kpiModel:this.kpiModel});var o="change:threshold_field change:aggregate_statop change:entity_statop change:base_search change:metric change:fill_gaps change:search_alert_earliest change:search_alert_earliest_custom_val change:alert_period change:entity_id_fields change:entity_breakdown_id_fields";this.listenTo(this.kpiModel,o,(0,N.default)(function(s,o){((0,W.default)(s.changed,"metric")||o&&"string"==typeof o&&o.replace(/\s+/g,""))&&s.gatherSearchClause({service:this.serviceModel})}.bind(this),ae.DEFAULT_DEBOUNCE_DELAY)),this.listenTo(this.kpiModel,"change:title",function(s){(0,W.default)(s.changed,"title")&&(this.setModalTitle(this.kpiModel.get("title")),this.updateModalTitle())}.bind(this)),this.hasValidationSearchExecuted=!1,this.hasValidationSearchResults=!1,this.listenTo(this.kpiModel,"change:base_search change:search_type change:metric",()=>{this.resetKpiValidationFlags()}),this.listenTo(this.kpiModel.get("datamodel"),"change:datamodel change:field change:object",()=>{this.resetKpiValidationFlags()}),this.listenTo(this.kpiModel,"change:is_entity_breakdown change:is_service_entity_filter change:datamodel_filter",function(s){s.gatherSearchClause({service:this.serviceModel})}.bind(this)),this.kpiModel.get("search")&&this.kpiModel.getSummaryIndexEarliest(),this.children.cancelButton=new fe.default({dataTestItsi:"kpi-modal-cancel-button",onClick:this._onCancel.bind(this),label:(0,X.gettext)("Cancel")}),this.children.backButton=new fe.default({dataTestItsi:"kpi-modal-back-button",label:(0,X.gettext)("Back"),onClick:this._onBack.bind(this),style:{marginLeft:10}}),this.children.nextButton=new fe.default({appearance:"primary",dataTestItsi:"kpi-modal-next-button",label:(0,X.gettext)("Next"),onClick:this._onNext.bind(this),style:{marginLeft:10}}),this.children.finishButton=new fe.default({dataTestItsi:"kpi-modal-finish-button",label:(0,X.gettext)("Finish"),onClick:this._onFinish.bind(this),style:{marginLeft:10}})},resetKpiValidationFlags:function resetKpiValidationFlags(){this.hasValidationSearchExecuted=!1,this.hasValidationSearchResults=!1,this.resetKpiHasResultsModel()},_showKpiChangeWarning:function _showKpiChangeWarning(s){this._toggleButtons(!0,!0),this.isNestedModalShown=!0,(0,R.default)('[data-test-itsi="'.concat(this.dataTestItsi,'"]').concat(de.SUI_SELECTORS.modal)).fadeOut();var o=R.default.Deferred(),recordWarningAccept=()=>{this._warningFieldsSuppressed=this._warningFieldsSuppressed||{},(0,V.default)(this.kpiModel.getWatchedAttrs({humanReadable:!1}),s=>{this._warningFieldsSuppressed[s]=!0})},onNestedModalClose=()=>{this.isNestedModalShown=!1,(0,R.default)('[data-test-itsi="'.concat(this.dataTestItsi,'"]').concat(de.SUI_SELECTORS.modal)).fadeIn()},_=(0,R.default)('<div class="service-save-modal-container"></div>');return P.default.unmountComponentAtNode(_.get(0)),P.default.render(D.default.createElement(ce.default,null,D.default.createElement(Q.default,{title:(0,X.gettext)("Warning: possible unsafe change"),modalDataTestItsi:"kpi-search-and-calculate-nested-confirm-modal",cancelButtonDataTestItsi:"service-possible-unsafe-changes-no-button",primaryButtonDataTestItsi:"service-possible-unsafe-changes-yes-button",primaryButtonLabel:(0,X.gettext)("Yes"),secondaryButtonLabel:(0,X.gettext)("No"),open:!0,showCancel:!0,closeOnClickAway:!1,modalStyles:ie.CONFIRMATION_MODAL_STYLE,primaryButtonClicked:()=>{this._toggleButtons(!1),recordWarningAccept(),onNestedModalClose(),o.resolve()},secondaryButtonClicked:()=>{this._toggleButtons(!1),onNestedModalClose(),o.reject()}},s)),_.get(0)),o.promise()},_advanceStep:function _advanceStep(){if(this.currentStep+1<1||this.currentStep+1>this.steps.length)throw"Invalid step forward";this._removeChildViewsForCurrentStep(this.steps[this.currentStep-1]),this.currentStep++,this.renderStep()},_toggleButtons:function _toggleButtons(s){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s?(o&&(this.children.cancelButton.disable(),(0,R.default)('[data-test-itsi="'.concat(this.dataTestItsi,'"]').concat(de.SUI_SELECTORS.modalHeaderCloseButton)).css("display","none")),this.children.backButton.disable(),this.children.nextButton.disable(),this.children.finishButton.disable()):(this.children.cancelButton.enable(),1!==this.currentStep&&this.children.backButton.enable(),this.children.nextButton.enable(),this.children.finishButton.enable(),(0,R.default)('[data-test-itsi="'.concat(this.dataTestItsi,'"]').concat(de.SUI_SELECTORS.modalHeaderCloseButton)).css("display","block"))},resetKpiHasResultsModel:function resetKpiHasResultsModel(){this._toggleButtons(!1),this.onProgressChange(0),this.cleanupSearchJob()},cleanupSearchJob:function cleanupSearchJob(){(0,ne.cleanSearchJobSubscriptions)(this.searchJob,this.subscription,this.progressSubscription)},_warningIfSearchReturnNoResults:function _warningIfSearchReturnNoResults(){var s;return this.hasValidationSearchExecuted&&this.hasValidationSearchResults||this.featureFlags&&!this.featureFlags[se.featureFlagsStanzas.KPI_SECURITY_CHECK]||!this.isSearchStep()||this.kpiModel.get("search_type")===oe.KPI_SEARCH_TYPES.SHARED_BASE?Promise.resolve():this.hasValidationSearchExecuted&&!this.hasValidationSearchResults?Promise.reject(oe.KPI_VALIDATION_NO_RESULTS_MARKER):(this._toggleButtons(!0,!1),new Promise((o,_)=>{this.onProgressChange(1),this.searchJob=Y.default.create({id:(0,ne.createUniqueSearchId)("kpi-search-calculate-has-result-modal-search"),cancelOnUnload:!0,search:this.kpiModel.get("search"),earliest_time:oe.KPI_VALIDATION_EARLIEST_TIME_RANGE,latest_time:"now"},{app:(0,ee.getShortAppName)(!0),owner:Z.username}),this.subscription=this.searchJob.getResults({offset:0,count:oe.KPI_VALIDATION_RESULTS_COUNT}).subscribe({next:o=>{s=o},error:()=>{this.hasValidationSearchExecuted=!0,this.hasValidationSearchResults=!1,this._toggleButtons(!1),_(oe.KPI_VALIDATION_SEARCH_ERROR_MARKER)},complete:()=>{this._toggleButtons(!1),this.hasValidationSearchExecuted=!0;var S=!(!s||!Array.isArray(s.results))&&s.results.length>0;S?(o(S),this.hasValidationSearchResults=!0):(_(oe.KPI_VALIDATION_NO_RESULTS_MARKER),this.hasValidationSearchResults=!1)}}),this.progressSubscription=this.searchJob.getProgress().subscribe({next:s=>{var o=(0,K.default)(s,["content","doneProgress"],0);this.onProgressChange((0,te.roundNumber)(100*o,1))}})}))},onProgressChange:function onProgressChange(s){100===s&&(this.removeProgressBarTimeout&&clearTimeout(this.removeProgressBarTimeout),this.removeProgressBarTimeout=setTimeout(()=>{this.onProgressChange(0)},oe.KPI_VALIDATION_PROGRESS_HIDE_DELAY));var o=(0,R.default)('[data-test-itsi="'.concat(this.dataTestItsi,'"] .search-results-progress-bar-container'));P.default.unmountComponentAtNode(o.get(0)),P.default.render(D.default.createElement(ce.default,null,s>0&&D.default.createElement(D.default.Fragment,null,D.default.createElement("span",{"data-test-itsi":"kpi-search-preview-results-progress-text"},(0,$.sprintf)((0,X.gettext)("Validating search... %(percentage)s%% complete"),{percentage:s})),D.default.createElement(U.default,{"data-test-itsi":"kpi-search-preview-results-progress-bar",percentage:s,tooltip:(0,$.sprintf)((0,X.gettext)("%(percentage)s%% complete."),{percentage:s})}))),o.get(0))},_warnIfKpiChanged:function _warnIfKpiChanged(){var s=R.default.Deferred(),o=function(o,_){if(o)return s.resolve().promise();var S=this.kpiModel.getWatchedAttrs({humanReadable:!1});if(0===(0,j.default)(S,function(s){return!(0,W.default)(this._warningFieldsSuppressed||{},s)}.bind(this)).length)return s.resolve().promise();var R=this.kpiModel.getWatchedAttrs({humanReadable:!0}).join("; "),O=(0,$.sprintf)((0,X.gettext)("The following has changed: %s."),R),P=(0,X.gettext)("Continuing this change will cause features that use historical data (such as adaptive thresholding and anomaly detection) to produce incorrect results. Consider cloning this KPI instead."),D=(0,X.gettext)("Are you sure you want to continue?"),N=[O,"backfillInProgress"===_?(0,X.gettext)("However, there exists an unfinished backfill operation using the previous KPI definition."):(0,X.gettext)("There is some data that exists in the summary index in last 180 days which might not be consistent with this new KPI definition."),P,D].join(" ");return this._showKpiChangeWarning(N)}.bind(this),_=function(o){return console.log("ERROR: problems performing KPI/data consistency check: "+o),this.flashMessagesCollection.reset(),s.resolve().promise()}.bind(this);return this.kpiModel.isConsistentWithSummarizedData().then(o,_)},_attemptStepChange:function _attemptStepChange(){Promise.all([this._warnIfKpiChanged(),this._warningIfSearchReturnNoResults()]).then(s=>{var[,o]=s;"boolean"==typeof o&&!o&&this.isSearchStep()&&"function"==typeof this.step1.setSearchReturnsResults&&this.step1.setSearchReturnsResults(),this._advanceStep(),this.onProgressChange(0)}).catch(s=>{"string"==typeof s&&s===oe.KPI_VALIDATION_NO_RESULTS_MARKER&&this.isSearchStep()&&"function"==typeof this.step1.setSearchReturnsNoResults&&(this.step1.setSearchReturnsNoResults(),this.kpiModel.get("skip_kpi_validation")&&(this._advanceStep(),this.onProgressChange(0)))}).finally(()=>{this.reEnableButton()})},_onCancel:function _onCancel(){this.cleanupSearchJob(),this._removeStepChildReactViews(),this.hide(),this.remove()},_onBack:function _onBack(){if(this.currentStep-1<1||this.currentStep-1>this.steps.length)throw"Invalid step back";this._removeChildViewsForCurrentStep(this.steps[this.currentStep-1]),this.currentStep--,this.flashMessagesCollection.reset(),this.renderStep()},_onNext:function _onNext(){this.children.nextButton.disable();var s=function(){this.flashMessagesCollection.reset()}.bind(this),o=function(s){this.reEnableButton();var o=[];if(s&&Array.isArray(s)&&s.length>0&&(o=o.concat(s.filter(s=>s!==oe.KPI_VALIDATION_FAILED_MARKER))),o.length>0){var _=o.join(" ");this.flashMessagesCollection.reset([{dataTestItsi:"kpi-search-calculate-next-validation-error-message",html:_,type:"error"}])}}.bind(this);this.steps[this.currentStep-1].validate(!0).done(s,this._attemptStepChange.bind(this)).fail(o)},reEnableButton:function reEnableButton(){this.currentStep<this.steps.length&&!this.isNestedModalShown&&this.children.nextButton.enable()},_onFinish:function _onFinish(){this.children.finishButton.disable(),this.cleanUpBeforeSave();for(var s=[],o=0;o<this.steps.length;++o)s.push(this.steps[o].validate(!0));var _=function(){5===this.steps.length?(this.trigger("kpichanged",this.kpiModel),this.handleUpdateKpiModel&&this.handleUpdateKpiModel(this.kpiModel)):this.trigger("kpicreated",this.kpiModel),this.hide(),this.remove()}.bind(this),S=function(s){var o=[];if(s&&Array.isArray(s)&&s.length>0&&(o=o.concat(s.filter(s=>s!==oe.KPI_VALIDATION_FAILED_MARKER&&s!==oe.KPI_VALIDATION_NO_RESULTS_MARKER))),s&&s===oe.KPI_VALIDATION_NO_RESULTS_MARKER&&this.isSearchStep()&&this.step1&&"function"==typeof this.step1.setSearchReturnsNoResults&&(this.step1.setSearchReturnsNoResults(),this.kpiModel.get("skip_kpi_validation")&&_()),o.length>0){var S=o.join(" ");this.flashMessagesCollection.reset([{dataTestItsi:"kpi-search-calculate-finish-validation-error-message",html:S,type:"error"}])}(0,R.default)('[data-test-itsi="'.concat(this.dataTestItsi,'"] .kpi-invalid-backfill-time'))&&(0,R.default)('[data-test-itsi="${this.dataTestItsi}"] .kpi-invalid-backfill-time').remove(),this.children.finishButton.enable()}.bind(this);R.default.when.apply(R.default,s).then(this._warnIfKpiChanged.bind(this)).then(this._warningIfSearchReturnNoResults.bind(this)).done(_).fail(S)},onCloseCallback:function onCloseCallback(){this.cleanupSearchJob(),this._removeStepChildReactViews()},_removeChildViewsForCurrentStep:function _removeChildViewsForCurrentStep(s){"function"==typeof s.removeChildReactViews&&s.removeChildReactViews()},_removeStepChildReactViews:function _removeStepChildReactViews(){(0,V.default)(this.steps,function(s){this._removeChildViewsForCurrentStep(s)}.bind(this))},cleanUpBeforeSave:function cleanUpBeforeSave(){this.kpiModel.get("search_type")===oe.KPI_SEARCH_TYPES.METRIC||this.kpiModel.get("is_metric")||this.kpiModel.unset("metric",{silent:!0}),this.kpiModel.unset("is_metric",{silent:!0}),this.kpiModel.get("search_alert_earliest")===le.ALERT_EARLIEST.CUSTOM&&parseInt(this.kpiModel.get("search_alert_earliest_custom_val"),10)<=le.ALERT_EARLIEST.HR_24&&this.kpiModel.set("search_alert_earliest",this.kpiModel.get("search_alert_earliest_custom_val")),this.kpiModel.unset("search_alert_earliest_custom_val")},_handleValidateCallbacks:function _handleValidateCallbacks(s,o){var _=s,S=0,R=[];return function(s){if(S++,s&&s.length>0&&(R=R.concat(s)),S===_){var O=R;if(O.length>0){var P=O.join(" ");this.flashMessagesCollection.reset([{dataTestItsi:"kpi-search-calculate-callback-validation-error-message",html:P,type:"error"}])}else o()}}.bind(this)},isSearchStep:function isSearchStep(){return 5===this.steps.length&&1===this.currentStep||7===this.steps.length&&2===this.currentStep},renderStep:function renderStep(s){if(this.currentStep<1||this.currentStep>this.steps.length)throw"Invalid step";var o=s?(0,R.default)('<div class="step-content"></div>'):(0,R.default)('[data-test-itsi="'.concat(this.dataTestItsi,'"] .step-content'));o.children().detach(),o.append(this.steps[this.currentStep-1].render().$el);var _=(0,$.sprintf)((0,X.gettext)("Step %s of %s: %s"),this.currentStep,this.steps.length,this.steps[this.currentStep-1].getSubTitle());if(this.setModalSubTitle(_),s||this.updateModalSubTitle(),1===this.currentStep?this.children.backButton.disable():this.children.backButton.enable(),this.currentStep===this.steps.length?this.children.nextButton.disable():this.children.nextButton.enable(),s)return o},hide:function hide(){he.default.prototype.hide.apply(this,arguments),this.cleanupSearchJob()},render:function render(){this.setModalTitle(this.kpiModel.get("title")),this.appendToFooter((0,R.default)('<div class="search-results-progress-bar-container"></div>'));var s=(0,R.default)('<div class="kpi-search-and-calculate-modal-footer-buttons-container"></div>');s.append(this.children.cancelButton.render().$el),s.append(this.children.backButton.render().$el),s.append(this.children.nextButton.render().$el),s.append(this.children.finishButton.render().$el),this.appendToFooter(s),this.appendToBody(this.flashMessages.render().$el);var o=this.renderStep(!0);return this.appendToBody(o),this.appendToBody(this.generatedSearchView.render().$el),he.default.prototype.render.apply(this,arguments),this},remove:function remove(){this.generatedSearchView.remove();for(var s=0;s<this.steps.length;++s)this.steps[s].remove();return he.default.prototype.remove.apply(this,arguments)}});o.default=Te;s.exports=o.default},1079:function(s,o,_){(o=_(36)(!1)).push([s.i,".service-health-overview {\n\theight: 32px;\n\tmargin-bottom: 10px;\n\tmargin-left: 20px;\n}\n\n.service-health-loading-text {\n\tfont-size: large;\n}\n\n.overview-health-score-value {\n\tpadding-right: 15px;\n\tdisplay: inline;\n}\n\n.overview-health-score-text {\n\tpadding-right: 5px;\n\tdisplay: inline;\n}\n\n.overall-trigger-health-container {\n\theight: 16px;\n\tfont-size: large;\n}\n\n.overall-trigger-count-container {\n\theight: 40px;\n\tfont-size: large;\n}\n\n.service-health-table-title {\n\tfont-size: 16px;\n}\n\n.first-service-health-table,\n.second-service-health-table {\n\tmargin-top: 20px;\n}\n.second-service-health-table {\n\tline-height: 46px; /* Matches the height of first-service-health-table with/without its Tooltip */\n}\n\n",""]),s.exports=o},1080:function(s,o,_){(o=_(36)(!1)).push([s.i,'/* Main container of the section */\n.settings-content-view {\n\twidth: auto; /* Override fixed width of 600px */\n\tpadding: 20px;\n}\n/* Targets the custom help blocks of the page */\n.settings-content-view .overall-trigger-health-help-block {\n\tdisplay: inline-block;\n\tmargin-left: 10px;\n}\n/* Section titles */\n.settings-tab-title {\n\tmargin-bottom: 16px;\n}\n/* Fixes the width issues between control group widths */\n.general-settings-control div[data-test="control-group"] {\n\twidth: 540px;\n}\n.health-score-content {\n\tdisplay: flex;\n\twidth: 100%;\n}\n.service-health-tile-container {\n\twidth: 25%;\n\tmargin: 16px 0 0 40px;\n}\n.severity-tile-text-large {\n\tpadding-top: 24px;\n}\n.severity-tile-title {\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\twhite-space: nowrap;\n\tmax-width: 153px;\n}\n.service-health-overview { /* the overview view is not rendered in the Settings tab */\n\tdisplay: none;\n}\n.service-health-table-service-name {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\twhite-space: nowrap;\n\tmax-width: 94%;\n}\n.kpi-severity-importance-table-container {\n\twidth: 75%;\n\tpadding-right: 20px;\n}\n.health-score-title-sub-section {\n\tmargin-top: 20px;\n}\n.health-score-header {\n\tmargin-top: 20px;\n}\n/* Targets the Simulated Health Score label */\n.service-health-tile-header > .text-label-control-group > label {\n\tfloat: none;\n\tmargin: 10px 0;\n\tfont-size: 16px;\n\tfont-family: inherit;\n\tfont-weight: 500;\n\tline-height: 20px;\n\ttext-transform: none;\n\tcolor: #3c444d; /* theme.textColor */\n\ttext-rendering: optimizelegibility;\n}\n.health-score-title-description {\n\tfont-size: 14px;\n\tfont-weight: 400;\n\tline-height: 16px;\n}',""]),s.exports=o},1081:function(s,o,_){(o=_(36)(!1)).push([s.i,'.service-definition-generated-search-preview {\n\tpadding: 5px;\n\tmargin: 5px;\n\tborder: 1px solid #c3cbd4; /* theme.borderColor */\n\tfont-family: "Droid Sans Mono", "Consolas", "Monaco", "Courier New", Courier, monospace;\n\tcursor: pointer;\n\tmax-height: 100px;\n\toverflow-y: auto;\n}\n',""]),s.exports=o},1082:function(s,o,_){(o=_(36)(!1)).push([s.i,".filter-outer-container {\n\tdisplay: inline-block;\n\tline-height: 30px;\n\tpadding: 0;\n\tflex-grow: 1;\n}\n.filter-container {\n\tdisplay: none;\n}\n.select-field-control {\n\tdisplay: inline-block;\n\tmargin-right: 10px;\n}\n.kpi-filter-item {\n\tmargin-bottom: 10px;\n\twhite-space: nowrap;\n}\n.kpi-filter-item .control-dispatcher-wrapper-inline:last-of-type {\n\tmargin-left: 10px;\n}",""]),s.exports=o},1083:function(s,o,_){(o=_(36)(!1)).push([s.i,".backfill-status-label {\n\twidth: 100px;\n\tdisplay: inline-block;\n\ttext-align: right;\n}\n.backfill-status-text {\n\tdisplay: inline-block;\n\tmargin-left: 20px;\n}",""]),s.exports=o},1084:function(s,o,_){(o=_(36)(!1)).push([s.i,".backfill-enable-status {\n\tdisplay: inline-block;\n\tvertical-align: top;\n}\n.kpi-invalid-backfill-time {\n\tmargin-left: 60px;\n}",""]),s.exports=o},1085:function(s,o,_){(o=_(36)(!1)).push([s.i,'[data-test-itsi="kpi-search-and-calculate-modal"] [data-test="header"] [data-test="title"] {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\tpadding-right: 50px;\n\twhite-space: nowrap;\n}\n[data-test-itsi="kpi-search-and-calculate-modal"] > [data-test="body"] {\n\theight: 520px;\n}\n[data-test-itsi="kpi-search-and-calculate-modal"] .step-content {\n\tmax-height: 480px;\n\toverflow-y: auto;\n\tpadding: 3px 3px 3px 3px; /* Fixes the box-shadow highlight on focus */\n}\n[data-test-itsi="kpi-search-and-calculate-modal"] .step-content div .gather-step-datamodel-helper {\n\tmargin-left: 142px;\n\tline-height: 26px;\n\tpadding: 5px 5px 5px 0;\n}\n[data-test-itsi="kpi-search-and-calculate-modal"] .collapsible-panel-placeholder {\n\tbackground: white;\n\tposition: absolute;\n\tbottom: 73px;\n\tleft: 0;\n\tright: 0;\n\tz-index: 30;\n}\n[data-test-itsi="kpi-search-and-calculate-modal"] > [data-test="footer"] .alert-error {\n\tfloat: left;\n\twidth: 450px;\n\tmargin-left: 10px;\n\tdisplay: block;\n}\n/* Applies to the Filters Control Group */\n[data-test-itsi="kpi-search-and-calculate-modal"] .kpi-filter-view {\n\tdisplay: inline-block;\n}\n/* Applies to the Filters Control Group label */\n[data-test-itsi="kpi-search-and-calculate-modal"] .kpi-filter-view .filter-label {\n\tdisplay: inline-block;\n}\n[data-test-itsi="kpi-search-and-calculate-modal"] .kpi-metric-selector-container,\n[data-test-itsi="kpi-search-and-calculate-modal"] .data-model-selector-dropdown-container {\n\tmargin-bottom: 10px;\n}\n.search-results-progress-bar-container {\n\tdisplay: inline-block;\n\tflex-grow: 1;\n\tpadding-right: 20px;\n}\n[data-test-itsi="kpi-search-and-calculate-modal"] .kpi-search-and-calculate-modal-footer-buttons-container {\n\tdisplay: inline-block;\n}',""]),s.exports=o},1086:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-anomaly-panel-trending-analysis-description-anomalies-info {\n\tpadding-bottom: 20px;\n}\n\n.kpi-anomaly-panel-trending-analysis-description-preview-info {\n\tpadding-bottom: 10px;\n}",""]),s.exports=o},1087:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-anomaly-panel-cohesive-analysis-description-anomalies-info {\n\tpadding-bottom: 20px;\n}\n\n.kpi-anomaly-panel-cohesive-analysis-description-preview-info {\n\tpadding-bottom: 10px;\n}\n\n.kpi-anomaly-panel-cohesive-analysis-description {\n\tpadding-bottom: 10px;\n}",""]),s.exports=o},1088:function(s,o,_){(o=_(36)(!1)).push([s.i,'.kpi-anomaly-panel-upper-section {\n\tbackground-color: #ffffff; /* theme.backgroundColor */\n\tpadding: 15px 20px 30px 20px;\n}\n\n.kpi-anomaly-panel-analysis-window-config-container {\n\tdisplay: inline-block;\n\tvertical-align: top;\n}\n\n.kpi-anomaly-panel-analysis-window-config-container div[data-test="controls"] {\n\tdisplay: block;\n\tmargin-right: 10px;\n}\n\n.kpi-anomaly-panel-analysis-container {\n\tdisplay: flex;\n\twidth: 100%;\n}\n\n.anomaly-detection-container-title {\n\tmargin-top: -10px;\n}\n\n.kpi-anomaly-panel-analysis-container-read-only {\n\twidth: 100%;\n}\n\n.kpi-anomaly-panel-ad-config .slider-container {\n\tpadding-right: 15px;\n\tpadding-left: 8px;\n}\n\n.kpi-anomaly-panel-trending-analysis-container {\n\tmargin-right: 20px;\n}\n.kpi-anomaly-panel-trending-analysis-container,\n.kpi-anomaly-panel-cohesive-analysis-container {\n\twidth: 50%;\n}\n\n/* SWC.control-group still used */\n.kpi-anomaly-panel-trending-analysis-container > .control-group,\n.kpi-anomaly-panel-cohesive-analysis-container > .control-group {\n\tmargin: 12px 0 12px 0;\n}\n\n.kpi-anomaly-panel-trending-analysis-config-result-label,\n.kpi-anomaly-panel-cohesive-analysis-config-result-label {\n\tdisplay: inline-block;\n\tmin-width: 176px; /* Min width to have align with the control group below */\n\tvertical-align: top;\n\tline-height: 40px;\n}\n\n.kpi-anomaly-panel-trending-analysis-config-result-pane,\n.kpi-anomaly-panel-cohesive-analysis-config-result-pane {\n\tdisplay: inline-block;\n}\n\n.kpi-anomaly-panel-config-result-pane-alert {\n\tpadding-right: 0; /*Over-ride alert right padding*/\n}\n\n.kpi-anomaly-panel-analysis-config-result {\n\tdisplay: inline-block;\n\tvertical-align: top;\n\tmax-width: 325px;\n\tmargin-bottom: 12px;\n}\n\n.kpi-anomaly-panel-trending-analysis-config .slider-container,\n.kpi-anomaly-panel-cohesive-analysis-config .slider-container {\n\tflex-grow: 1;\n\tmin-width: 215px;\n}\n.kpi-anomaly-panel-trending-analysis-config-result-processing {\n\tmargin-top: 10px;\n}\n.kpi-anomaly-panel-cohesive-analysis-config-result-processing {\n\tpadding-bottom: 8px;\n\tmargin-bottom: 16px;\n}\n.kpi-anomaly-panel-config-container {\n\tdisplay: block;\n\tvertical-align: top;\n}\n\n/* SWC.control-label still used */\n.kpi-anomaly-panel-config-container .control-label {\n\tvertical-align: top;\n\tpadding-top: 8px;\n}\n\n.kpi-anomaly-panel-explanation-container {\n\tdisplay: inline-block;\n\tmax-width: 100%;\n\tvertical-align: top;\n\tpadding-bottom: 20px;\n}\n\n/* SWC.control-label still used */\n.kpi-anomaly-panel-upper-section .control-label,\n.kpi-anomaly-panel-lower-section .control-group,\n.kpi-anomaly-panel-lower-section .control-label {\n\tdisplay: inline-block;\n}\n\n/* SWC.controls still used */\n.kpi-anomaly-panel-upper-section .controls,\n.kpi-anomaly-panel-lower-section .controls {\n\tdisplay: inline-block;\n\tmargin-left: 10px;\n}\n\n.kpi-anomaly-panel-upper-section .kpi-anomaly-show-training-preview,\n.kpi-anomaly-panel-upper-section .kpi-anomaly-show-tuning-window {\n\tmargin-top: 10px;\n}\n\n.kpi-anomaly-panel-lower-section {\n\tpadding-top: 15px;\n\tpadding-bottom: 10px;\n\tpadding-left: 20px;\n\tbackground-color: #FFFFFF; /* theme.backgroundColor */\n}\n\n.show-training-data-link {\n\tdisplay: inline-block;\n\tmargin-left: 20px;\n}\n\n.kpi-anomaly-search-preview-controls-container {\n\tmargin-bottom: 10px;\n}\n\n.kpi-anomaly-panel-lower-section .kpi-anomaly-sensitivity-text-input {\n\tdisplay: inline-block;\n\twidth: 36px !important;\n\tpadding-right: 0 !important;\n}\n\n.kpi-anomaly-panel-lower-section .kpi-anomaly-sensitivity-slider-container {\n\tmargin-bottom: 10px;\n}\n\n/* SWC.checkbox still used */\n.kpi-anomaly-panel-lower-section .control label.checkbox {\n\tpadding-bottom: 0;\n}\n\n.kpi-ad-tooltip-description {\n\ttext-align: left;\n\tpadding-left: 5px;\n}\n\n.tooltip-inner {\n\tmax-width: 290px;\n\twidth: auto;\n\tfont-size: 12px;\n}',""]),s.exports=o},1089:function(s,o,_){(o=_(36)(!1)).push([s.i,".side-bar-layout-table {\n\twidth: 100%;\n}\n.sidebar-layout-header {\n\theight: 80px;\n\tpadding-left: 20px;\n\tborder-bottom: 1px solid #c3cbd4; /* theme.borderColor */\n\tfont-size: 20px;\n\tline-height: 80px;\n}\n\n.sidebar-layout-sidebar-td {\n\twidth: 250px;\n\tvertical-align: top;\n\tborder-right: 1px solid #c3cbd4; /* theme.borderColor */\n}\n\n.sidebar-layout-main-td {\n\tvertical-align: top;\n}\n\n.sidebar-layout-main {\n\twidth: 100%;\n}\n",""]),s.exports=o},1090:function(s,o,_){(o=_(36)(!1)).push([s.i,'[data-test-itsi="add-service-dependency-modal"] .sidebar-layout-main-td,\n[data-test-itsi="kpi-clone-modal"] .sidebar-layout-main-td {\n\tpadding-left: 20px;\n}\n[data-test-itsi="add-service-dependency-modal"] .sidebar-layout-sidebar-td,\n[data-test-itsi="kpi-clone-modal"] .sidebar-layout-sidebar-td {\n\tborder-right: none;\n}\n.kpi-main-list,\n.service-list {\n\toverflow-y: auto;\n}\n.kpi-main-list {\n\theight: 460px;\n}\n.sidebar-layout-sidebar-td {\n\tmax-width: 250px;\n}',""]),s.exports=o},1091:function(s,o,_){(o=_(36)(!1)).push([s.i,".sidebar-layout-sidebar-td {\n\tmin-width: 250px;\n}\n\n.kpi-list-view .collection-list-item {\n\tpadding-top: 10px;\n\tpadding-left: 20px;\n\tposition: relative;\n}\n\n.kpi-list-view .collection-list-item .kpi-list-row-indicator-icons {\n\tdisplay: inline;\n\tposition: absolute;\n\tright: 35px;\n}\n\n.kpi-list-view .collection-list-item .kpi-list-row-indicator-icons .kpi-list-row-lock-icon-container {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n\tpadding: 0 5px;\n}\n\n.kpi-list-view .collection-list-item .kpi-list-row-indicator-icons .kpi-list-row-custom-threshold-window-icon-container {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n\tpadding: 0 5px 0 10px;\n}\n\n.kpi-list-view .collection-list-row-content {\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\tmax-width: 190px;\n\tdisplay: inline-block;\n}\n.kpi-list-view .collection-list-row-content.short-item-lock-icon {\n\tmax-width: 175px;\n}",""]),s.exports=o},1092:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-drift-panel {\n\tmargin-top: 2px;\n}\n",""]),s.exports=o},1093:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-main-content .three-column-view {\n\tpadding: 10px 20px 10px 20px;\n}\n.kpi-main-content .three-column-view .title-view {\n\tfont-size: 14px;\n}\n.kpi-main-content .three-column-view .summary-view {\n\toverflow: hidden;\n}\n.kpi-main-content .summary-view .field-title,\n.kpi-main-content .three-column-view .field-title {\n\ttext-decoration: underline;\n}\n.kpi-main-content .three-column-view .summary {\n\tpadding-right: 10px;\n}",""]),s.exports=o},1094:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-thresholding-panel-upper-section,\n.thresholding-alert-on-control {\n\tpadding: 10px 0 0 20px;\n}\n\n.thresholding-timezone-warning {\n\tbackground-color: #f2f4f5; /* theme.backgroundColorHover */\n}\n\n.thresholding-timezone-warning > .alert {\n\tmargin-bottom: 0;\n}\n\n.kpi-thresholding-panel-custom-threshold-window-content {\n\tmargin-bottom: 10px;\n\tpadding: 5px 0;\n}\n\n.kpi-thresholding-panel-custom-threshold-window-content.hide {\n\tdisplay: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.kpi-thresholding-panel-custom-threshold-window-content .kpi-thresholding-panel-custom-threshold-window-status {\n\tdisplay: inline-block;\n\tmargin-right: 15px;\n}\n\n.kpi-thresholding-panel-custom-threshold-window-content .kpi-thresholding-panel-custom-threshold-window-link {\n\tdisplay: inline-block;\n}\n\n.kpi-thresholding-panel-upper-section.fixed {\n\tposition: fixed;\n\ttop: 0;\n\tz-index: 419;\n}\n\n.kpi-thresholding-panel-lower-section {\n\tpadding: 0 0 20px 20px;\n}\n\n.thresolding-adaptive-thresholding-controls {\n\tdisplay: flex;\n}\n\n.thresholding-enable-time-policy-control,\n.thresholding-enable-adaptive-thresholding,\n.thresholding-adaptive-thresholding-training {\n\tpadding-right: 25px;\n}\n\n.thresholding-adaptive-thresholding-explanation {\n\tdisplay: inline-block;\n\tline-height: 20px;\n\tmargin-bottom: 15px;\n}\n\n.thresholding-default-container {\n\tmargin-top: 20px;\n}\n\n.thresholding-template-selector-control-container {\n\tpadding-top: 8px;\n}\n\n.thresholding-configure-preview-service {\n\tdisplay: inline-block;\n}\n\n.thresholding-template-radio-control {\n\tmargin-bottom: 15px;\n}\n\n.thresholding-configure-settings {\n\tpadding-top: 10px;\n}\n\n.thresholding-configure-settings > .kpi-alerting-options,\n.thresholding-configure-settings > .kpi-alerting-custom-rules {\n\tdisplay: block;\n\tpadding: 10px 0 0 20px;\n}\n\n.thresholding-configure-settings > .kpi-alerting-custom-rules > .kpi-alerting-custom-rule {\n\tpadding-bottom: 10px;\n}\n\n.thresholding-configure-settings > .kpi-alerting-add-rule {\n\tpadding: 10px 0 0 20px;\n}\n\n.enable-disable-time-policies,\n.enable-disable-adaptive-thresholding {\n\tvertical-align: baseline !important;\n}\n\n.thresholding-configure-aggregate-entity-toggle {\n\tmargin-bottom: 10px;\n}\n\n.thresholding-default-preview-container {\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.thresholding-default-preview {\n\tpadding-bottom: 20px;\n}\n",""]),s.exports=o},1095:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-thresholding-panel {\n\tmargin-top: 2px;\n}\n",""]),s.exports=o},1096:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-anomaly-panel {\n\tmargin-top: 2px;\n}",""]),s.exports=o},1097:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-main-content {\n\tmargin: 15px 0 0 15px;\n\tmax-width: 1400px;\n}\n\n.kpi-main-content .collapsible-panel-layout {\n\tmargin: 5px 25px 60px 0;\n}\n",""]),s.exports=o},1098:function(s,o,_){(o=_(36)(!1)).push([s.i,".sidebar-layout-header {\n\tdisplay: none;\n}\n.kpi-no-selection {\n\tmargin-top: 10px;\n\tmargin-left: 10px;\n\tpadding-top: 3px;\n}",""]),s.exports=o},1099:function(s,o,_){(o=_(36)(!1)).push([s.i,".read-only .kpi-thresholding-panel-custom-threshold-window-content .kpi-thresholding-panel-custom-threshold-window-status {\n\tmargin-bottom: 10px;\n}\n.kpi-thresholding-panel-lower-section.read-only {\n\tpadding: 0 0 20px 0;\n}\n.read-only .thresholding-configure-settings > .kpi-alerting-options {\n\tpadding: 0 0 0 20px;\n}",""]),s.exports=o},1100:function(s,o,_){(o=_(36)(!1)).push([s.i,".kpi-info-container {\n\tpadding: 15px;\n\tpadding-top: 5px;\n}\n\n.kpi-info-container .kpi-search-calculate-info {\n\twidth: 800px;\n}\n\n.kpi-info-container .kpi-info-container-subheader {\n\tpadding-left: 15px;\n}\n\n.kpi-info-container .kpi-thresholding-info .time-variant-thresholding-view {\n\tmargin-left: 0;\n}\n\n.kpi-anomaly-detection-info .form-horizontal {\n\tmargin-top: 20px;\n}\n\n/* SWC.control-label still used */\n.kpi-anomaly-detection-info .form-horizontal .control-label {\n\twidth: 230px;\n}\n\n/* SWC.controls still used */\n.kpi-anomaly-detection-info .form-horizontal .controls {\n\tmargin-left: 250px;\n}\n\n.kpi-search-info-container .summary-view .control-group,\n.kpi-entity-info-container .summary-view .control-group,\n.kpi-calculation-info-container .summary-view .control-group,\n.kpi-units-info-container .summary-view .control-group,\n.kpi-backfill-info-container .summary-view .control-group {\n\tmargin-left: 80px;\n}\n",""]),s.exports=o},1101:function(s,o,_){(o=_(36)(!1)).push([s.i,".entity-rule-item-value {\n\tfont-weight: bold;\n}\n.entity-rule-and-join,\n.entity-rule-group-or-join {\n\tmargin-left: 5px;\n}\n.entity-rule-group-or-join {\n\tmargin-bottom: 13px;\n}\n.rules-container .inline-text-control {\n\tmargin-right: 5px;\n}",""]),s.exports=o},1102:function(s,o,_){(o=_(36)(!1)).push([s.i,".specify-entity-rules-main-view {\n\tpadding-bottom: 0px;\n}",""]),s.exports=o},1225:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(16)),P=S(_(17)),D=S(_(21)),N=S(_(19)),V=S(_(20)),j=S(_(8)),K=S(_(7)),W=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),U=S(_(3)),Y=S(_(2)),$=S(_(39)),X=S(_(27)),Z=S(_(44)),Q=S(_(34)),ee=S(_(24)),te=S(_(100)),ie=S(_(66)),ae=S(_(83)),ne=S(_(219)),re=_(4),se=_(126),le=_(96),oe=_(618);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,N.default)(o),(0,D.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,N.default)(s).constructor):o.apply(s,_))}_(28);var de=(0,Y.default)(te.default)(R||(R=(0,K.default)(["\n\twidth: 600px;\n"]))),ce=function(s){function BaseServiceTemplateSearchAndCalculateModal(s){var o;(0,O.default)(this,BaseServiceTemplateSearchAndCalculateModal);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];o=_callSuper(this,BaseServiceTemplateSearchAndCalculateModal,[s,...S]),(0,j.default)(o,"handleRequestClose",()=>{o.setState({isModalOpen:!1}),o.props.handleCloseModal()}),(0,j.default)(o,"generateSelectOptions",s=>s.map(s=>W.default.createElement(ie.default.Option,{"data-test-itsi":"base-search-select-option",label:s.label,value:s.value,key:s.value}))),(0,j.default)(o,"getSelectedBaseSearchMetrics",s=>{var _=s;return _||(_=o.props.baseSearchSelectItems[0].value),o.props.savedBaseSearchCollection.findWhere({_key:_}).get("metrics").map((function(s){return{value:s.id||s.get("_key"),label:s.get("title")}}))}),(0,j.default)(o,"handleBaseSearchChange",(s,_)=>{var{value:S}=_,R=o.getSelectedBaseSearchMetrics(S);o.setState({baseSearchValue:S,metricsList:R,metricsValue:R[0].value}),o.props.handleUpdateKpiModel(S,R[0].value,o.state.titleValue,o.state.descriptionValue,o.props.kpiModel)}),(0,j.default)(o,"handleMetricChange",(s,_)=>{var{value:S}=_;o.setState({metricsValue:S}),o.props.handleUpdateKpiModel(o.state.baseSearchValue,S,o.state.titleValue,o.state.descriptionValue,o.props.kpiModel)}),(0,j.default)(o,"handleTitleChange",(s,_)=>{var{value:S}=_;o.props.handleUpdateKpiModel(o.state.baseSearchValue,o.state.metricsValue,S,o.state.descriptionValue,o.props.kpiModel),o.setState({titleValue:S})}),(0,j.default)(o,"handleDescriptionChange",(s,_)=>{var{value:S}=_;o.props.handleUpdateKpiModel(o.state.baseSearchValue,o.state.metricsValue,o.state.titleValue,S,o.props.kpiModel),o.setState({descriptionValue:S})}),(0,j.default)(o,"save",()=>{var s=o.props.validateModelEntries(o.props.kpiModel,o.props.isNew);s?o.props.kpiModel.get("title")?"not-unique-kpi-title"===s?o.setState({invalidKPITitle:se.ALREADY_EXISTING_TITLE_MESSAGE}):o.setState({errorMessage:s}):o.setState({invalidKPITitle:se.NO_EMPTY_TITLE_MESSAGE}):(o.setState({invalidKPITitle:""}),o.props.isNew?o.props.createKpi(o.props.kpiModel):o.props.editAndSaveKpi(o.props.kpiModel),o.handleRequestClose())}),(0,j.default)(o,"getHelpLink",s=>W.default.createElement(Q.default,{"data-test-itsi":"service-template-kpi-edit-base-search-link",to:s,openInNewContext:!0},(0,re.gettext)("Edit Base Search"))),(0,j.default)(o,"getBaseSearchUrl",()=>{var s=o.state.baseSearchValue;if(s)return(0,oe.uiEditURL)(s)});var P=o.props.isNew;o.props.isNew&&o.props.isExampleKpi&&(P=!1);var D=P?o.getSelectedBaseSearchMetrics():o.getSelectedBaseSearchMetrics(o.props.currentKpiSearchValuesObject.base_search_id);return o.state={isModalOpen:o.props.isModalOpen,baseSearchValue:P?o.props.baseSearchSelectItems[0].value:o.props.currentKpiSearchValuesObject.base_search_id,metricsList:D,metricsValue:P?D[0].value:o.props.currentKpiSearchValuesObject.base_search_metric,titleValue:P?"":o.props.currentKpiSearchValuesObject.title,descriptionValue:P?"":o.props.currentKpiSearchValuesObject.description,errorMessage:""},P&&o.props.handleUpdateKpiModel(o.state.baseSearchValue,o.state.metricsValue,o.state.titleValue,o.state.descriptionValue,o.props.kpiModel),o}return(0,V.default)(BaseServiceTemplateSearchAndCalculateModal,s),(0,P.default)(BaseServiceTemplateSearchAndCalculateModal,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(s){s.isModalOpen!==this.props.isModalOpen&&this.setState({isModalOpen:s.isModalOpen})}},{key:"render",value:function render(){var{invalidKPITitle:s}=this.state,o=this.generateSelectOptions(this.props.baseSearchSelectItems),_=this.generateSelectOptions(this.state.metricsList);return W.default.createElement("div",(0,le.createITSITestHook)(this.constructor.name),W.default.createElement(de,{"data-test-itsi":"base-service-template-search-and-calculate-modal",onRequestClose:this.handleRequestClose,open:this.state.isModalOpen},W.default.createElement(te.default.Header,{title:this.props.isNew?(0,re.gettext)("New KPI"):(0,re.gettext)("Edit KPI"),onRequestClose:this.handleRequestClose}),W.default.createElement(te.default.Body,null,this.state.errorMessage&&W.default.createElement(ee.default,{"data-test-itsi":"create-service-template-kpi-error-message",type:"error"},this.state.errorMessage),W.default.createElement(Z.default,{"data-test-itsi":"create-service-template-kpi-title-control-group",error:!!s,help:s,label:(0,re.gettext)("Title"),required:!0},W.default.createElement(ae.default,{"data-test-itsi":"create-service-template-kpi-title-text",error:!!s,value:this.state.titleValue,onChange:this.handleTitleChange,placeholder:(0,re.gettext)("required")})),W.default.createElement(Z.default,{"data-test-itsi":"create-service-template-kpi-description-control-group",label:(0,re.gettext)("Description")},W.default.createElement(ne.default,{"data-test-itsi":"create-service-template-kpi-description-text-area",value:this.state.descriptionValue,onChange:this.handleDescriptionChange,placeholder:(0,re.gettext)("optional")})),W.default.createElement(Z.default,{"data-test-itsi":"service-template-kpi-base-search-control-group",help:this.getHelpLink(this.getBaseSearchUrl()),label:(0,re.gettext)("Base Search"),tooltip:(0,re.gettext)("Select a base search. Ad hoc and data model searches cannot be used for service template KPIs.")},W.default.createElement(ie.default,{"data-test-itsi":"base-search-select",filter:!0,value:this.state.baseSearchValue,onChange:this.handleBaseSearchChange},o)),W.default.createElement(Z.default,{"data-test-itsi":"service-template-kpi-base-search-metric-control-group",label:(0,re.gettext)("Metric"),tooltip:(0,re.gettext)("Metric from the selected base search to associate with this KPI.")},W.default.createElement(ie.default,{"data-test-itsi":"base-search-metric-select",filter:!0,value:this.state.metricsValue,onChange:this.handleMetricChange},_))),W.default.createElement(te.default.Footer,null,W.default.createElement(X.default,{"data-test-itsi":"base-service-template-search-and-calculate-modal-cancel-button",onClick:this.handleRequestClose,label:(0,re.gettext)("Cancel")}),W.default.createElement(X.default,{appearance:"primary","data-test-itsi":this.props.isNew?"base-service-template-search-and-calculate-modal-save-create-button":"base-service-template-search-and-calculate-modal-save-edit-button",onClick:this.save,label:this.props.isNew?(0,re.gettext)("Create"):(0,re.gettext)("Save")}))))}}])}(W.Component);(0,j.default)(ce,"propTypes",{savedBaseSearchCollection:U.default.object.isRequired,baseSearchSelectItems:U.default.array.isRequired,validateModelEntries:U.default.func.isRequired,createKpi:U.default.func,editAndSaveKpi:U.default.func,handleUpdateKpiModel:U.default.func.isRequired,isModalOpen:U.default.bool,isNew:U.default.bool.isRequired,isExampleKpi:U.default.bool,currentKpiSearchValuesObject:U.default.object,kpiModel:U.default.object.isRequired,handleCloseModal:U.default.func}),(0,j.default)(ce,"defaultProps",{isModalOpen:!1,isExampleKpi:!1,currentKpiSearchValuesObject:{},createKpi:$.default,editAndSaveKpi:$.default,handleCloseModal:$.default});o.default=ce;s.exports=o.default},1226:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(37)),O=S(_(15)),P=S(_(2677));_(2678);var D=O.default.View.extend({template:P.default,initialize:function initialize(s){this.label=s.label||"",this.sidebarContent=s.sidebarContent instanceof Array?s.sidebarContent:[s.sidebarContent],this.mainContent=s.mainContent instanceof Array?s.mainContent:[s.mainContent],this._firstRender=!0},render:function render(){return this.$el.html(this.template),this.$(".sidebar-layout-header").text(this.label),(0,R.default)(this.sidebarContent,function(s){this.$(".sidebar-layout-sidebar").append(s)}.bind(this)),(0,R.default)(this.mainContent,function(s){this.$(".sidebar-layout-main").append(s)}.bind(this)),this}});o.default=D;s.exports=o.default},1454:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(1053)).default.extend({isReadOnly:!0});o.default=R;s.exports=o.default},1455:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(17)),O=S(_(16)),P=S(_(21)),D=S(_(19)),N=S(_(20)),V=S(_(8)),j=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),K=S(_(3)),W=S(_(44)),U=S(_(103)),Y=_(4);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,D.default)(o),(0,P.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,D.default)(s).constructor):o.apply(s,_))}_(28);var $=function(s){function BackfillToggleControl(s){var o;(0,O.default)(this,BackfillToggleControl);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,BackfillToggleControl,[s,...S]),(0,V.default)(o,"handleClick",(s,_)=>{var{onChange:S}=o.props,R=!_.value;o.setState({isSelected:R}),S(R)}),(0,V.default)(o,"render",()=>{var{isReadOnly:s,size:_,tooltipContent:S}=o.props,{isSelected:R}=o.state;return j.default.createElement(W.default,{"data-test-itsi":"service-backfill-control-group",label:(0,Y.gettext)("Backfill"),tooltip:S},j.default.createElement(U.default,{"data-test-itsi":"backfill-control-switch",value:!!R,appearance:"toggle",selected:!!R,onClick:o.handleClick,size:_,disabled:s},R?null:(0,Y.gettext)("No Backfill")))}),o.state={isSelected:o.props.enabled},o}return(0,N.default)(BackfillToggleControl,s),(0,R.default)(BackfillToggleControl)}(j.Component);(0,V.default)($,"propTypes",{onChange:K.default.func.isRequired,enabled:K.default.bool,isReadOnly:K.default.bool,size:K.default.string,tooltipContent:K.default.string}),(0,V.default)($,"defaultProps",{enabled:!1,size:"small",isReadOnly:!1,tooltipContent:(0,Y.gettext)("If enabled, the summary index will be backfilled if necessary. Backfilling can only be done once.")});o.default=$;s.exports=o.default},1456:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(7)),P=S(_(0)),D=S(_(3)),N=S(_(39)),V=S(_(2)),j=S(_(44)),K=_(4),W=S(_(2624));_(28);var U={backfillEnabled:D.default.bool.isRequired,backfillEarliest:D.default.string.isRequired,onTimePickerSelection:D.default.func.isRequired,setInputValidity:D.default.func},Y={setInputValidity:N.default},$=V.default.span(R||(R=(0,O.default)(["\n\tpadding-left: 7px;\n\tpadding-top: 6px;\n"])));function BackfillStatusControl(s){return P.default.createElement("div",null,s.backfillEnabled?P.default.createElement(j.default,{"data-test-itsi":"service-settings-backfill-with-control-group",label:(0,K.gettext)("Backfill with")},P.default.createElement(W.default,{onTimePickerSelection:s.onTimePickerSelection,setInputValidity:s.setInputValidity,backfillEnabled:s.backfillEnabled,currentSetBackfillPeriod:s.backfillEarliest}),P.default.createElement($,{"data-test-itsi":"backfill-time-text"},(0,K.gettext)("of data"))):P.default.createElement("span",null))}BackfillStatusControl.propTypes=U,BackfillStatusControl.defaultProps=Y;o.default=BackfillStatusControl;s.exports=o.default},1457:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q,ee,te,ie,ae,ne,re,se,le,oe,de,ce,he,ue,pe,fe,ge,me,ve,ye,_e,Se,be,Ee,Te,Ce,ke,xe=S(_(8)),we=S(_(7)),Re=_interopRequireWildcard(_(0)),Ie=_(46),Me=_(48),Oe=S(_(3)),Ae=S(_(2)),Pe=S(_(81)),De=S(_(33)),Le=S(_(37)),Ne=S(_(69)),Ve=S(_(63)),je=S(_(39)),He=_interopRequireWildcard(_(337)),Be=_(322),Ke=_(740),Fe=S(_(1123)),We=S(_(720)),Ue=S(_(1056)),Ge=S(_(704)),Ye=S(_(2634)),qe=S(_(27)),ze=S(_(575)),$e=S(_(427)),Je=S(_(44)),Xe=S(_(2635)),Ze=S(_(2636)),Qe=S(_(266)),et=S(_(156)),tt=S(_(348)),it=S(_(64)),at=S(_(34)),nt=S(_(24)),rt=S(_(282)),st=S(_(51)),lt=S(_(369)),ot=S(_(2637)),dt=S(_(66)),ct=S(_(633)),ht=S(_(1609)),ut=S(_(103)),pt=S(_(121)),ft=S(_(83)),gt=S(_(219)),mt=S(_(461)),vt=_(22),yt=_(14),_t=_(4),St=S(_(670)),bt=_(61),Et=_(452),Tt=_(110),Ct=_(67),kt=_(763),xt=_(764),wt=_(517),Rt=_(57),It=_(145),Mt=_(306),Ot=_(102),At=_(501),Pt=S(_(2638)),Dt=S(_(2639));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,xe.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var Lt=(0,Ae.default)(Ke.AIIcon)(R||(R=(0,we.default)(["\n margin-right: 5px;\n"]))),Nt=Ae.default.div(O||(O=(0,we.default)(["\n padding: 16px;\n"]))),Vt=(0,Ae.default)(dt.default)(P||(P=(0,we.default)(["\n width: 220px !important;\n"]))),jt=(0,Ae.default)(Qe.default)(D||(D=(0,we.default)(["\n margin-left: 14px;\n margin-right: 14px;\n"]))),Ht=Ae.default.div(N||(N=(0,we.default)(["\n display: flex;\n flex-wrap: wrap;\n gap: 16px;\n"]))),Bt=Ae.default.div(V||(V=(0,we.default)(["\n display: flex;\n flex-direction: column;\n"]))),Kt=(0,Ae.default)(st.default)(j||(j=(0,we.default)(["\n margin: 0px;\n"]))),Ft=(0,Ae.default)(Je.default)(K||(K=(0,we.default)(["\n [data-test='controls'] {\n align-items: center;\n }\n\n max-width: 1190px;\n"]))),Wt=(0,Ae.default)(qe.default)(W||(W=(0,we.default)(["\n margin-top: 11px;\n"]))),Ut=(0,Ae.default)(rt.default)(U||(U=(0,we.default)(["\n flex-basis: 40;\n max-width: 80px;\n"]))),Gt=Ae.default.div(Y||(Y=(0,we.default)(["\n display: flex;\n flex-direction: column;\n gap: 10px;\n flex-wrap: wrap;\n margin-left: 4px;\n"]))),Yt=Ae.default.div($||($=(0,we.default)(["\n margin-left: 4px;\n"]))),qt=Ae.default.div(X||(X=(0,we.default)(["\n width: fit-content;\n align-items: center;\n display: flex;\n gap: 5px;\n flex-wrap: wrap;\n"]))),zt=(0,Ae.default)(it.default)(Z||(Z=(0,we.default)(["\n margin: 0px;\n"]))),$t=(0,Ae.default)(Je.default)(Q||(Q=(0,we.default)(["\n margin-bottom: 0px;\n div {\n justify-content: flex-start;\n }\n & [data-test='controls'] [data-test='paragraph'] {\n margin: 0px;\n }\n"]))),Jt=(0,Ae.default)(ze.default)(ee||(ee=(0,we.default)(["\n max-width: 720px;\n width: 720px;\n & [data-test='toggle'] {\n background-color: ",";\n }\n"])),vt.variables.successColorL50),Xt=(0,Ae.default)(qe.default)(te||(te=(0,we.default)(["\n align-self: flex-start;\n flex-grow: 0;\n margin-left: 10px;\n"]))),Zt=(0,Ae.default)(nt.default)(ie||(ie=(0,we.default)(["\n width: fit-content;\n"]))),Qt=(0,Ae.default)($e.default.Column)(ae||(ae=(0,we.default)(["\n padding: 8px 0px 8px 24px;\n width: 0px;\n max-width: 200px;\n margin-right: 0px !important;\n"]))),ei=(0,Ae.default)($e.default.Column)(ne||(ne=(0,we.default)(["\n padding: 8px 0px 8px 24px;\n width: 0px;\n max-width: 400px;\n margin-right: 0px !important;\n"]))),ti=(0,Ae.default)($e.default.Column)(re||(re=(0,we.default)(["\n padding: 8px 0px 8px 24px;\n margin-right: 0px !important;\n"]))),ii=(0,Ae.default)($e.default.Column)(se||(se=(0,we.default)(["\n padding: 8px 0px 8px 24px;\n font-weight: bold;\n margin-right: 0px !important;\n"]))),ai=(0,Ae.default)($e.default.Row)(le||(le=(0,we.default)(["\n margin-bottom: 0px !important;\n margin-top: 0px !important;\n"]))),ni=(0,Ae.default)(nt.default)(oe||(oe=(0,we.default)(["\n margin-bottom: 0px;\n padding: 0px;\n\n > div {\n padding: 0px 10px;\n }\n"]))),ri=Ae.default.div(de||(de=(0,we.default)(["\n display: flex;\n flex-direction: column;\n"]))),si=Ae.default.div(ce||(ce=(0,we.default)(["\n display: flex;\n"]))),li=(0,Ae.default)(st.default)(he||(he=(0,we.default)(["\n margin-top: 2px;\n"]))),oi=Ae.default.div(ue||(ue=(0,we.default)(["\n padding: 10px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n"]))),di=(0,Ae.default)(qe.default)(pe||(pe=(0,we.default)(["\n margin-top: 4px;\n margin-left: 4px;\n"]))),ci=(0,Ae.default)(qe.default)(fe||(fe=(0,we.default)(["\n margin-top: 20px;\n margin-left: 4px;\n margin-bottom: 4px;\n"]))),hi=Ae.default.div(ge||(ge=(0,we.default)(["\n margin-top: 20px;\n"]))),ui=(0,Ae.default)(Je.default)(me||(me=(0,we.default)(["\n margin-top: 20px;\n"]))),pi=(0,Ae.default)(St.default)(ve||(ve=(0,we.default)(["\n margin-left: 4px;\n margin-right: 20px;\n"]))),fi=(0,Ae.default)(at.default)(ye||(ye=(0,we.default)(["\n margin-top: 8px;\n"]))),gi=(0,Ae.default)(gt.default)(_e||(_e=(0,we.default)(["\n width: 100% !important;\n"]))),mi=Ae.default.div(Se||(Se=(0,we.default)(["\n display: flex;\n align-items: center;\n"]))),vi=(0,Ae.default)(st.default)(be||(be=(0,we.default)(["\n margin-right: 16px;\n margin-top: 8px;\n"]))),yi=Ae.default.div(Ee||(Ee=(0,we.default)(["\n display: flex;\n gap: 10px;\n"]))),_i=(0,Ae.default)(st.default)(Te||(Te=(0,we.default)(["\n color: ",";\n padding-top: 7px;\n"])),vt.variables.textGray),Si=(0,Ae.default)(qe.default)(Ce||(Ce=(0,we.default)(["\n width: 90px;\n flex-grow: 0;\n"]))),bi=(0,Ae.default)(et.default)(ke||(ke=(0,we.default)(["\n color: ",";\n cursor: pointer;\n margin-bottom: 10px;\n margin-left: 14px;\n"])),vt.variables.linkColor),Ei=(0,He.makeCreateToast)(He.default),Ti=Re.default.createElement(Ge.default,null),Ci=Re.default.createElement(Ue.default,null),ki=Re.default.createElement(Xe.default,null),xi=Re.default.createElement(Ze.default,null),wi=Re.default.createElement(We.default,null),Ri=Re.default.createElement(Ye.default,null),Ii=Re.default.createElement(Fe.default,null);function BaseConfigurationTabBar(s){var{aiRecommendationsSearchRetrieveAction:o,appsData:_,handleApplySettingToggle:S,isApplyingAdaptiveThresholds:R,isDefaultEntityThresholdView:O,isPerEntityThresholdEnabled:P,isRecommendationUnlinked:D,isRecommendationConfigured:N,thresholdData:V,handleGoToKpiSettings:j,handleThresholdTypeChange:K,handleThresholdDataUpdate:W,handleUpdateAdaptiveThresholding:U,handleRevertAIThresholdSettings:Y,selectedThresholdTemplate:$,previousThresholdTemplate:X,isReadOnly:Z,selectedObject:Q,hadCopyKPIToEntityThresholds:ee,openAIThresholdingControls:te,handleAllEntityThresholdToDefaultClicked:ie,thresholdTemplateCollection:ae,previewServiceCache:ne,serviceTemplateKey:re,kpiThresholdTemplateResetAction:se,kpiThresholdTemplateCreateAction:le,kpiThresholdTemplateApiStatus:oe,unlinkAIRecommendation:de,handleRedirectToEntityModal:ce}=s,{updateKpiData:he,selectedKpiModel:ue,isServiceTemplate:pe,handleServiceTemplateKpiChange:fe,previewServiceKey:ge}=(0,Re.useContext)(Mt.ThresholdingContext),[me,ve]=(0,Re.useState)((0,At.getThresholdType)(V)),[ye,_e]=(0,Re.useState)(V.adaptiveTrainingWindow),[Se,be]=(0,Re.useState)(V.isOutlierDetectionEnabled),[Ee,Te]=(0,Re.useState)(V.outlierDetectionAlgorithm),[Ce,ke]=(0,Re.useState)(V.outlierDetectionSensitivity),[xe,we]=(0,Re.useState)(!1),[Ie,Me]=(0,Re.useState)(!1),[Oe,Ae]=(0,Re.useState)(""),[je,He]=(0,Re.useState)([]),[Ke,Fe]=(0,Re.useState)(!1),[We,Ue]=(0,Re.useState)(!1),[Ge,Ye]=(0,Re.useState)(""),[ze,Xe]=(0,Re.useState)(""),[Ze,Qe]=(0,Re.useState)(!1),[et,rt]=(0,Re.useState)(!1),[gt,vt]=(0,Re.useState)("forward"),[St,Et]=(0,Re.useState)(te?"ai":"base");(0,Re.useEffect)(()=>{ve((0,At.getThresholdType)(V)),_e(V.adaptiveTrainingWindow),be(V.isOutlierDetectionEnabled),Te(V.outlierDetectionAlgorithm),ke(V.outlierDetectionSensitivity)},[V.isTimeVariateThresholds,V.isAdaptiveThresholdsEnabled,V.adaptiveTrainingWindow,V.isOutlierDetectionEnabled,V.outlierDetectionAlgorithm]),(0,Re.useEffect)(()=>{if(ae){var s=[];(0,Le.default)(ae.models,o=>{s.push({value:o.get("_key"),label:o.get("title")})}),He(s)}},[ae,null==ae?void 0:ae.length]);var kt=(0,Re.useCallback)((s,o)=>{var{value:_}=o;ve(_),K(_)},[K]),Mi=(0,Re.useCallback)((s,o)=>{var{value:_}=o;_e(_),W({adaptiveTrainingWindow:_})},[W]),Oi=(0,Re.useCallback)(()=>{be(s=>(W({isOutlierDetectionEnabled:!s}),!s))},[W]),Ai=(0,Re.useCallback)((s,o)=>{var{value:_}=o;Te(_),W({outlierDetectionAlgorithm:_})},[W]),Pi=(0,Re.useCallback)((s,o)=>{var{value:_}=o;_&&(ke(_),W({outlierDetectionSensitivity:_}))},[W]),Di=(0,Re.useCallback)(()=>{vt("base"===St?"forward":"backward"),Et("base"===St?"sub":"base"),Ae(""),Fe(!1),Ue(!1),Ye(""),Xe(""),Me(!1)},[St]);(0,Re.useEffect)(()=>{oe!==xt.KPI_THRESHOLD_TEMPLATE_CREATE_STATUS.SUCCESS&&oe!==xt.KPI_THRESHOLD_TEMPLATE_CREATE_STATUS.ERROR||(oe===xt.KPI_THRESHOLD_TEMPLATE_CREATE_STATUS.SUCCESS?ae.fetch().done(s=>{var o=s.find(s=>s.title===Ge);ae.add(o);var _="";o&&(_=o._key),_&&(ue.set("kpi_threshold_template_id",_),he(ue),rt(!1),Ei({type:Be.TOAST_TYPES.SUCCESS,message:(0,_t.gettext)("Threshold template successfully saved"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1}),"sub"===St&&Di(),se())}):Ei({type:Be.TOAST_TYPES.ERROR,message:(0,_t.gettext)("Threshold templated failed to save"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1}))},[oe]);var Li=(0,Re.useCallback)(()=>{var s=_objectSpread({},V);s.isCopyKPIToEntityThresholdsEnabled=!0,he(s),ue.set("adaptive_thresholding_copy_kpi_to_entity",!0)},[he,ue,V]),Ni=V.isTimeVariateThresholds?(0,_t.gettext)("time-variant"):(0,_t.gettext)("static"),Vi=(0,Re.useCallback)(s=>{Ae(s),ae.get(s).get("_immutable",!1)?Fe(!0):Fe(!1),Me(!1),Ue(!1)},[ae]),ji=(0,Re.useCallback)((s,o)=>{var{value:_}=o;Ye(_),Qe(!1)},[Ye]),Hi=(0,Re.useCallback)((s,o)=>{var{value:_}=o;Xe(_)},[Xe]),Bi=(0,Re.useCallback)(s=>{ue.set("adaptive_thresholds_is_enabled",(null==s?void 0:s.adaptive_thresholds_is_enabled)||!1),ue.set("adaptive_thresholding_training_window",(null==s?void 0:s.adaptive_thresholding_training_window)||"-7d"),ue.set("time_variate_thresholds",(null==s?void 0:s.time_variate_thresholds)||!1),ue.set("aggregate_outlier_detection_enabled",(null==s?void 0:s.aggregate_outlier_detection_enabled)||!1),ue.set("outlier_detection_algo",(null==s?void 0:s.outlier_detection_algo)||"stdev"),ue.set("outlier_detection_sensitivity",(null==s?void 0:s.outlier_detection_sensitivity)||.1),ue.get("adaptive_thresholding_copy_kpi_to_entity",!1)&&(ue.set("adaptive_thresholding_copy_kpi_to_entity",!1),Ei({type:Be.TOAST_TYPES.WARNING,message:(0,_t.gettext)("Copy adaptive thresholds to entity settings unlinked"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1}))},[ue]),Ki=(0,Re.useCallback)(s=>{var o=ae.get(s);if(o){var _=o.get("time_variate_thresholds_specification"),S=ue.get("time_variate_thresholds_specification");if(S.set(S.parse({policies:JSON.parse(JSON.stringify(_.get("policies")))})),Bi(JSON.parse(JSON.stringify(o.toJSON()))),ue.set("kpi_threshold_template_id",s),pe){var R=ne&&ne[ge],O=(0,Ne.default)(R.kpis,s=>ue.get("title")===s.title);fe(O,ue,re)}else he(ue);"base"!==St&&Di(),N&&de(),Ei({type:Be.TOAST_TYPES.SUCCESS,message:(0,_t.gettext)("Threshold template successfully linked"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1})}},[ae,ue,Bi,pe,St,N,ne,ge,fe,re,he,Di,de]),Fi=(0,Re.useCallback)(()=>{""===Oe?Me(!0):Ki(Oe)},[Oe,Ki]),Wi=(0,Re.useCallback)(()=>{Ae(X.id),Ki(X.id)},[Ki,null==X?void 0:X.id]),Ui=(0,Re.useCallback)(()=>{if(!We){var s=ae.get(Oe);if(s){var o=(0,Ct.getCurrentTimeInFormat)("z"),_=(0,Ct.getUserTimezoneOffset)("sec"),S="".concat(s.get("title").slice(0,-12)," (").concat(o,") (").concat((0,Ct.convertUserTimeZoneOffsetToTimeZoneString)(_),")");Ye(S),Xe(s.get("description",""))}}Ue(!We)},[We,ae,Oe]),Gi=(0,Re.useCallback)(()=>{var s=ae.pluck("title");if(""===Ge||s.includes(Ge))Qe(!0);else{var o,_=(o=JSON.parse(JSON.stringify(ae.get(Oe).toJSON()))).time_variate_thresholds&&o.time_variate_thresholds_specification&&o.time_variate_thresholds_specification.policies||{};if(o.time_variate_thresholds){o.time_variate_thresholds_specification.policies=(s=>{var o=(0,Pe.default)(s),_=Object.keys(s);if(_.length){var S=(0,Ct.getUserTimezoneOffset)("sec"),R=(0,Ct.convertUserTimeZoneOffsetToTimeZoneString)(S),O=(0,Ct.getCurrentTimeInFormat)("z");_.forEach(s=>{"default_policy"!==s&&(o[s].title="".concat(o[s].title.slice(0,-12)," (").concat(O,") (").concat(R,")"),o[s].time_blocks=(0,Tt.convertTimeBlocksToUtcTz)(o[s].time_blocks,S))})}return o})(_);var S=o.time_variate_thresholds_specification.policies,R=ue.get("time_variate_thresholds_specification");R.set(R.parse({policies:JSON.parse(JSON.stringify(S))})),Bi(o),delete o._key,delete o._immutable,delete o.mod_source,delete o._is_from_conf}o=_objectSpread(_objectSpread({},o),{title:Ge,description:ze}),rt(!0),le(o)}},[ae,Ge,ze,le,Oe,ue,Bi]),Yi=(0,Re.useCallback)(()=>We?et?(0,_t.gettext)("Saving..."):(0,_t.gettext)("Clone and apply"):(0,_t.gettext)("Apply"),[We,et]),qi=(0,Re.useCallback)(()=>{var s=Ot.KPI_ALERTING_TYPE_READ_ONLY_TEXT.custom;return V.kpiCustomAlertRules.forEach((o,_)=>{var S=V.kpiCustomAlertRules[_].change_from.length;0===_?(s+=(0,yt.sprintf)((0,_t.gettext)(", when KPI severity changes to %(changeTo)s from"),{changeTo:V.kpiCustomAlertRules[0].change_to}),V.kpiCustomAlertRules[_].change_from.forEach((o,_)=>{s+=_===S-1?(0,yt.sprintf)((0,_t.gettext)(" or %(severity)s,"),{severity:o}):(0,yt.sprintf)((0,_t.gettext)(" %(severity)s,"),{severity:o})})):(s+=(0,yt.sprintf)((0,_t.gettext)(" and when KPI severity changes to %(changeTo)s from"),{changeTo:o.change_to}),o.change_from.forEach((o,_)=>{s+=_===S-1?(0,yt.sprintf)((0,_t.gettext)(" or %(severity)s,"),{severity:o}):(0,yt.sprintf)((0,_t.gettext)(" %(severity)s,"),{severity:o})}))}),(0,yt.sprintf)((0,_t.gettext)("%(alertString)s"),{alertString:s.replace(/,\s*$/,".")})},[V.kpiCustomAlertRules]),zi=(0,Re.useCallback)(()=>{Et("ai"),vt("forward")},[]),$i=(0,Re.useCallback)(()=>{Et("base"),vt("backward")},[]),Ji=(0,Re.useCallback)(()=>{var s=ue.get("recommendation_training_window"),_=ue.get("recommendation_start_date")?pt.default.unix(ue.get("recommendation_start_date")):pt.default.unix((0,pt.default)().subtract(s.match(/\d+/g)[0],"days").unix()),S=_.clone(),R=s.match(/\d+/g)[0];S.add(R,"days");var O={search:(0,It.getRecommendedThresholdSearchForKPIs)([ue.get("_key")],null,ue.get("threshold_direction"),ue.get("keep_recommended_policy_static"),s,ue.get("recommendation_allow_negative_value"),ue.get("recommendation_threshold_sensitivity")),earliest:"-".concat((0,pt.default)().diff(_,"day"),"d"),latest:(0,pt.default)().isSame(S,"day")?"now":"-".concat((0,pt.default)().diff(S,"day"),"d")};ue.set("did_load_recommendation",!0),ue.set("recommendation_in_progress",!0),ue.set("recommendation_error_type",""),o(O)},[o,ue]),Xi=(0,Re.useCallback)(()=>{we(s=>!s)},[]),Zi=(0,Re.useCallback)(()=>{j(!1)},[j]),Qi=Re.default.createElement(qt,null,Re.default.createElement(Lt,{width:"24px",height:"24px"}),Re.default.createElement(Bt,null,Re.default.createElement(mt.default,{as:"strong",weight:"bold",color:"active"},(0,_t.gettext)("AI thresholding")),Re.default.createElement(Kt,null,(0,_t.gettext)("Let Splunk AI generate your threshold settings. Algorithms analyze historical data to recommend optimal threshold values."))),Re.default.createElement(qe.default,{"data-test-itsi":"thresholding-generate-ai-recommendation-button",label:(0,_t.gettext)("Get recommendations"),onClick:zi})),ea="";Ze&&(ea=""!==Ge?(0,_t.gettext)("A template with this title already exists."):(0,_t.gettext)("This is a required field."));var ta,ia,aa,na,ra,sa,la,oa,da,ca,ha,ua=Re.default.createElement(ri,null,Re.default.createElement(mt.default,{as:"strong",weight:"bold",color:"active"},(0,_t.gettext)("Threshold template")),(0,_t.gettext)("Select a template to apply to your KPI threshold settings and default settings for entity threshold. Customized entities will not be affected.")),pa=(0,Re.useCallback)(()=>Re.default.createElement(pi,{value:Oe,error:Ie,onValueChange:Vi,filter:!0,data:je,selectorDataTestItsi:"kpi-threshold-template-select",selectorOptionDataTestItsi:"kpi-threshold-template-select-option"}),[Vi,Ie,je,Oe]);return Re.default.createElement(Nt,null,Z?Re.default.createElement($e.default,{"data-test-itsi":"base-configuration-read-only-view"},!(0,De.default)($)&&!P&&Re.default.createElement(ai,{"data-test-itsi":"selected-threshold-template-read-only-row"},Re.default.createElement(Qt,{"data-test-itsi":"threshold-template-read-only-title"},(0,_t.gettext)("Linked threshold template")),Re.default.createElement(ei,null,Re.default.createElement(at.default,{"data-test-itsi":"base-configuration-selected-threshold-template-link",to:(0,wt.uiEditURL)($.id),openInNewContext:!0},$.get("title"))),Re.default.createElement(ti,null,Re.default.createElement(ni,{type:"info","data-test-itsi":"threshold-template-read-only-message"},Ot.THRESHOLD_TEMPLATE_READONLY_VIEW_MESSAGE))),(O||"kpi"===Q.type)&&(null==V?void 0:V.isCopyKPIToEntityThresholdsEnabled)&&Re.default.createElement(ai,{"data-test-itsi":"copy-kpi-to-entity-read-only-row"},Re.default.createElement(Qt,{"data-test-itsi":"copy-kpi-to-entity-read-only-title"},(0,_t.gettext)("Copy/paste thresholds")),Re.default.createElement(ei,null,Re.default.createElement(li,null,(0,_t.gettext)("Adaptive thresholding applies KPI aggregate thresholds to Entity thresholds Default settings.")))),O&&Re.default.createElement(ai,{"data-test-itsi":"apply-global-settings-read-only-row"},Re.default.createElement(Qt,{"data-test-itsi":"apply-global-settings-read-only-title"},(0,_t.gettext)("Entity threshold settings")),Re.default.createElement(ii,{"data-test-itsi":"apply-global-settings-read-only-value"},P?(0,_t.gettext)("Custom"):(0,_t.gettext)("Global"))),V.isKpiAlertingEnabled&&"kpi"===Q.type&&Re.default.createElement(ai,{"data-test-itsi":"kpi-alerting-read-only-row"},Re.default.createElement(Qt,{"data-test-itsi":"kpi-alerting-read-only-title"},(0,_t.gettext)("Alerting")),Re.default.createElement(ii,{"data-test-itsi":"kpi-alerting-read-only-value"},V.isKpiCustomAlertingEnabled?qi():Ot.KPI_ALERTING_TYPE_READ_ONLY_TEXT.all)),Re.default.createElement(ai,{"data-test-itsi":"thresholding-type-read-only-row"},Re.default.createElement(Qt,{"data-test-itsi":"thresholding-type-read-only-title"},(0,_t.gettext)("Thresholding type")),O&&(0,At.getThresholdType)(V)===Ot.THRESHOLD_TYPE_OPTIONS[2].value?Re.default.createElement(ii,{"data-test-itsi":"thresholding-type-read-only-value"},Ot.THRESHOLD_TYPE_OPTIONS[1].label):Re.default.createElement(ii,{"data-test-itsi":"thresholding-type-read-only-value"},Ot.THRESHOLD_TYPE_OPTIONS.filter(s=>s.value===(0,At.getThresholdType)(V))[0].label)),!O&&V.isAdaptiveThresholdsEnabled&&Re.default.createElement(ai,{"data-test-itsi":"training-window-read-only-row"},Re.default.createElement(Qt,{"data-test-itsi":"training-window-read-only-title"},(0,_t.gettext)("Training window")),Re.default.createElement(ii,{"data-test-itsi":"training-window-read-only-value"},Ot.ANALYSIS_WINDOW_OPTIONS.filter(s=>s.value===V.adaptiveTrainingWindow)[0].label)),(0,At.getThresholdType)(V)===Ot.THRESHOLD_TYPE_OPTIONS[2].value&&!O&&V.isOutlierDetectionEnabled&&Re.default.createElement(ai,{"data-test-itsi":"outlier-detection-read-only-row"},Re.default.createElement(Qt,{"data-test-itsi":"outlier-method-read-only-title"},(0,_t.gettext)("Outlier calculation method")),Re.default.createElement(ii,{"data-test-itsi":"outlier-method-read-only-value"},Ot.OUTLIER_ALGORITHM_LABEL_MAP[V.outlierDetectionAlgorithm])),(0,At.getThresholdType)(V)===Ot.THRESHOLD_TYPE_OPTIONS[2].value&&!O&&V.isOutlierDetectionEnabled&&Re.default.createElement(ai,{"data-test-itsi":"outlier-value-read-only-row"},Re.default.createElement(Qt,{"data-test-itsi":"outlier-value-read-only-title"},(0,_t.gettext)("Outlier trigger value")),Re.default.createElement(ii,{"data-test-itsi":"outlier-value-read-only-value"},(0,_t.gettext)(V.outlierDetectionSensitivity)))):Re.default.createElement(ht.default,{activePanelId:St,transition:gt},Re.default.createElement(ht.default.Panel,{panelId:"base"},(oa=Re.default.createElement(lt.default,{value:me,onChange:kt,"data-test-itsi":"base-configuration-thresholding-type-radio-list"},[...Ot.THRESHOLD_TYPE_OPTIONS].reverse().map(s=>Re.default.createElement(lt.default.Option,{value:s.value,key:s.value,"data-test-itsi":"base-configuration-".concat(s.value,"-threshold-type-option")},Re.default.createElement(Bt,null,Re.default.createElement(mt.default,{as:"strong",weight:"bold",color:"active","data-test-itsi":"base-configuration-".concat(s.value,"-threshold-type-option-title")},s.label),Re.default.createElement(Kt,null,s.description))))),da=Re.default.createElement(qt,null,Re.default.createElement(ot.default,{width:"24px",height:"24px"}),Re.default.createElement(Bt,null,Re.default.createElement(mt.default,{as:"strong",weight:"bold",color:"active"},(0,_t.gettext)("Threshold template")),Re.default.createElement(Kt,null,(0,_t.gettext)("Select a template to apply to your")," ",Re.default.createElement("b",null,(0,_t.gettext)("KPI threshold settings"))," ",(0,_t.gettext)("and")," ",Re.default.createElement("b",null,(0,_t.gettext)("default settings for entity thresholds.")))),Re.default.createElement(qe.default,{"data-test-itsi":"thresholding-apply-threshold-template-button",onClick:Di,label:(0,_t.gettext)("Apply template")})),ca=Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(it.default,{level:4},(0,_t.gettext)("Adaptive thresholding settings")),Re.default.createElement(Ht,null,Re.default.createElement(Je.default,{"data-test-itsi":"adaptive-training-window-control-group",label:(0,_t.gettext)("Training window"),labelPosition:"top",required:!0,tooltip:Ot.AT_TRAINING_WINDOW_TOOLTIP},Re.default.createElement(Vt,{"data-test-itsi":"adaptive-training-window-select",value:ye,onChange:Mi},Rt.KPI_TIME_PRESETS.map(s=>Re.default.createElement(dt.default.Option,{"data-test-itsi":"adaptive-training-window-select-option",label:s.label,value:s.value,key:s.value})))),Re.default.createElement(Je.default,{"data-test-itsi":"outlier-exclusion-switch-control-group",label:(0,_t.gettext)("Outlier exclusion"),labelPosition:"top",tooltip:Ot.ENABLE_OUTLIER_EXCLUSION_TOOLTIP},Re.default.createElement(ut.default,{"data-test-itsi":"outlier-exclusion-switch-control",onClick:Oi,selected:Se,appearance:"toggle"})),Se&&Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(Je.default,{"data-test-itsi":"outlier-exclusion-algo-select-control-group",label:(0,_t.gettext)("Outlier method/algorithm"),labelPosition:"top",tooltip:Ot.OUTLIER_METHOD_TOOLTIP},Re.default.createElement(Vt,{"data-test-itsi":"outlier-exclusion-algo-select-control",value:Ee,onChange:Ai},(0,Ve.default)(Ot.OUTLIER_ALGORITHM_LABEL_MAP).map(s=>Re.default.createElement(dt.default.Option,{"data-test-itsi":"outlier-exclusion-algo-select-option",label:Ot.OUTLIER_ALGORITHM_LABEL_MAP[s],value:s,key:s})))),Re.default.createElement(Je.default,{"data-test-itsi":"outlier-exclusion-sensitivity-control-group",label:(0,_t.gettext)("Trigger outlier threshold"),labelPosition:"top",tooltip:Ot.OUTLIER_METHOD_SENSITIVITY_TOOLTIP},Re.default.createElement(ct.default,{"data-test-itsi":"outlier-sensitivity-slider-control",min:.1,max:30,step:.5,onChange:Pi,value:Ce,inline:!0}),Re.default.createElement(Ut,{"data-test-itsi":"outlier-sensitivity-number-control",inline:!0,min:.1,max:30,step:.5,value:Ce,onChange:Pi}))),!P&&Re.default.createElement(Je.default,{"data-test-itsi":"preview-adaptive-threshold-control-group",label:" ",labelPosition:"top"},Re.default.createElement(Wt,{"data-test-itsi":"preview-adaptive-threshold-button-control",label:R?(0,_t.gettext)("Applying adaptive thresholds..."):(0,_t.gettext)("Update adaptive thresholding"),onClick:U,disabled:R})))),ha=N||D,Re.default.createElement(Gt,null,!ha&&(0,De.default)($)&&(0,De.default)(X)&&!O&&Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(zt,{"data-test-itsi":"thresholding-start-with-title",level:3},(0,_t.gettext)("Start with...")),Qi,"kpi"===Q.type&&da),N&&(ia="entity"===Q.type,aa=Ot.ANALYSIS_WINDOW_OPTIONS.filter(s=>s.value===ue.get(ia?"entity_recommendation_training_window":"recommendation_training_window"))[0].label,na=ue.get(ia?"entity_keep_recommended_policy_static":"keep_recommended_policy_static")?Ot.RECOMMENDATION_APPLY_AS_OPTIONS[1].label:Ot.RECOMMENDATION_APPLY_AS_OPTIONS[0].label,ra=Ot.THRESHOLD_CONFIGURATION_OPTIONS.filter(s=>s.value===ue.get(ia?"entity_threshold_direction":"threshold_direction"))[0].label,sa=ue.has(ia?"entity_recommendation_threshold_sensitivity":"recommendation_threshold_sensitivity")?Ot.RECOMMENDATION_THRESHOLD_SENSITIVITY_OPTIONS.filter(s=>s.value===ue.get(ia?"entity_recommendation_threshold_sensitivity":"recommendation_threshold_sensitivity"))[0].label:(0,_t.gettext)("No sensitivity configured"),void 0!==(la=ia?null==V||null===(ta=V.atRecommendationInfo)||void 0===ta?void 0:ta.lastRun:ue.has("threshold_recommendation_summary")&&ue.get("threshold_recommendation_summary").lastRun)?Re.default.createElement(Zt,{"data-test-itsi":"ai-recommendation-generated-success-message",appearance:"fill",type:"success"},Re.default.createElement("div",null,Re.default.createElement(nt.default.Title,{"data-test-itsi":"ai-recommendation-generated-success-message-title"},Re.default.createElement(mt.default,{as:"strong",weight:"bold",color:"active"},(0,_t.gettext)("AI thresholding recommendations successfully completed on")," ",pt.default.unix(la).format("DD MMM YYYY.").toString())),Re.default.createElement(Jt,{title:xe?(0,_t.gettext)("Collapse details"):(0,_t.gettext)("Expand details"),onChange:Xi,open:xe},Re.default.createElement(oi,null,Re.default.createElement(st.default,null,(0,_t.gettext)("The options selected to configure AI thresholding are below. You must click")," ",Re.default.createElement("b",null,(0,_t.gettext)("Regenerate"))," ",(0,_t.gettext)("to change the previously selected inputs and re-run thresholding recommendations.")),Re.default.createElement(zt,{"data-test-itsi":"ai-recommendation-configuration-summary",level:4},(0,_t.gettext)("AI thresholding inputs")),Re.default.createElement($t,{"data-test-itsi":"ai-configuration-summary-analysis-window",label:(0,_t.gettext)("Analysis window"),labelWidth:bt.LABEL_WIDTHS.LongPlus,help:Ot.RECOMMENDATION_THRESHOLD_ANALYSIS_WINDOW_TOOLTIP},Re.default.createElement(st.default,null,aa," ",(0,_t.gettext)("starting on")," ",pt.default.unix(ue.get(ia?"entity_recommendation_start_date":"recommendation_start_date")).format("ddd, DD MMM YYYY").toString())),Re.default.createElement($t,{"data-test-itsi":"ai-configuration-summary-threshold-type",label:(0,_t.gettext)("Threshold type"),labelWidth:bt.LABEL_WIDTHS.LongPlus,help:Ot.RECOMMENDATION_THRESHOLD_APPLY_AS_TOOLTIP},Re.default.createElement(st.default,null,na)),Re.default.createElement($t,{"data-test-itsi":"ai-configuration-summary-threshold-direction",label:(0,_t.gettext)("Threshold direction"),labelWidth:bt.LABEL_WIDTHS.LongPlus,help:Ot.RECOMMENDATION_THRESHOLD_DIRECTION_TOOLTIP},Re.default.createElement(st.default,null,ra)),Re.default.createElement($t,{"data-test-itsi":"ai-configuration-summary-keep-value-positive",label:(0,_t.gettext)("Positive thresholds only"),labelWidth:bt.LABEL_WIDTHS.LongPlus,help:Ot.RECOMMENDATION_THRESHOLD_ALLOW_NEGATIVE_VALUE_TOOLTIP},Re.default.createElement(st.default,null,ue.get(ia?"entity_recommendation_allow_negative_value":"recommendation_allow_negative_value")?(0,_t.gettext)("Off"):(0,_t.gettext)("On"))),Re.default.createElement($t,{"data-test-itsi":"ai-configuration-summary-analysis-window",label:(0,_t.gettext)("Threshold sensitivity"),labelWidth:bt.LABEL_WIDTHS.LongPlus,help:Ot.RECOMMENDATION_THRESHOLD_SENSITIVITY_TOOLTIP},Re.default.createElement(st.default,null,sa))))),Re.default.createElement(Xt,{appearance:"secondary","data-test-itsi":"kpi-recommendation-regenerate-recommendation-button",icon:wi,label:(0,_t.gettext)("Regenerate"),onClick:zi})):Qi),D&&Re.default.createElement(Zt,{"data-test-itsi":"ai-recommendation-unlinked-message",appearance:"fill",type:"warning"},Re.default.createElement("div",null,Re.default.createElement(nt.default.Title,{"data-test-itsi":"ai-recommendation-unlinked-message-title"},Re.default.createElement(mt.default,{as:"strong",weight:"bold",color:"active"},(0,_t.gettext)("AI thresholding unlinked"))),Re.default.createElement(st.default,{"data-test-itsi":"ai-recommendation-unlinked-message-description"},(0,_t.gettext)("You made changes and now your settings do not match the previous AI recommended thresholding settings."))),Re.default.createElement(Xt,{appearance:"secondary","data-test-itsi":"kpi-recommendation-revert-changes-button",icon:Ri,label:(0,_t.gettext)("Revert changes"),onClick:Y})),!(0,De.default)($)&&("kpi"===Q.type||O)&&Re.default.createElement(Zt,{appearance:"fill",type:"success"},Re.default.createElement("div",null,Re.default.createElement(nt.default.Title,null,Re.default.createElement(mt.default,{as:"strong",weight:"bold",color:"active"},(0,_t.gettext)("Threshold template applied"))),Re.default.createElement("div",{"data-test-itsi":"base-configuration-applied-threshold-template-title"},$.attributes.title)),Re.default.createElement(Xt,{"data-test-itsi":"base-configuration-change-linked-template-button",label:(0,_t.gettext)("Swap template"),onClick:Di}),Re.default.createElement(Xt,{"data-test-itsi":"base-configuration-selected-threshold-template-link",label:(0,_t.gettext)("View template"),to:(0,wt.uiEditURL)($.id),openInNewContext:!0})),!(0,De.default)(X)&&(0,De.default)($)&&("kpi"===Q.type||O)&&Re.default.createElement(Zt,{appearance:"fill",type:"warning"},Re.default.createElement("div",null,Re.default.createElement(nt.default.Title,null,Re.default.createElement(mt.default,{as:"strong",weight:"bold",color:"active"},(0,_t.gettext)("Threshold template unlinked"))),(0,_t.gettext)("You made changes and now your settings do not match the previous selected threshold template: "),X.attributes.title),Re.default.createElement(Xt,{"data-test-itsi":"base-configuration-revert-linked-template-button",icon:Ri,label:(0,_t.gettext)("Revert changes"),onClick:Wi})),(O||"kpi"===Q.type)&&((null==V?void 0:V.isCopyKPIToEntityThresholdsEnabled)||ee)&&Re.default.createElement(Ft,{"data-test-itsi":"base-configuration-copy-kpi-to-entity-group",label:(0,_t.gettext)("Copy/paste thresholds"),labelPosition:"top",controlsLayout:"none"},Re.default.createElement(si,null,Re.default.createElement(li,null,(0,_t.gettext)("Adaptive thresholding applies KPI aggregate thresholds to Entity thresholds Default settings.")),null!=V&&V.isCopyKPIToEntityThresholdsEnabled?Re.default.createElement("div",null,Re.default.createElement(jt,{"data-test-itsi":"base-configuration-copy-kpi-to-entity-linked-chip",icon:ki},(0,_t.gettext)("Linked"))):Re.default.createElement("div",null,Re.default.createElement(jt,{"data-test-itsi":"base-configuration-copy-kpi-to-entity-unlinked-chip",icon:xi},(0,_t.gettext)("Unlinked"))),!(null!=V&&V.isCopyKPIToEntityThresholdsEnabled)&&ee&&Re.default.createElement("div",null,Re.default.createElement(qe.default,{"data-test-itsi":"base-configuration-copy-kpi-to-entity-relink-button",label:(0,_t.gettext)("Re-link"),onClick:Li})))),O?Re.default.createElement(Re.default.Fragment,null,Re.default.createElement("div",null,Re.default.createElement(zt,{level:4},(0,_t.gettext)("Threshold type")),Re.default.createElement(yi,null,Re.default.createElement(st.default,{type:"info","data-test-itsi":"entity-threshold-threshold-type-info-message"},(0,_t.gettext)("Thresholding type is set to")," ",Re.default.createElement("strong",null,Ni,". "),(0,_t.gettext)("Default settings for entity thresholds always match threshold type in KPI thresholds.")),Re.default.createElement(bi,{"data-test-itsi":"kpi-thresholding-redirect-from-entity-thresholding",onClick:Zi},Ti,(0,_t.gettext)(" Go to settings")))),Re.default.createElement("div",null,Re.default.createElement(zt,{level:4},(0,_t.gettext)("Prevent custom thresholds?")),Re.default.createElement(yi,null,Re.default.createElement(ut.default,{"data-test-itsi":"base-configuration-entity-apply-all-settings-switch",onClick:S,selected:!P,appearance:"toggle"},P?(0,_t.gettext)("Off"):(0,_t.gettext)("On")),Re.default.createElement(_i,null,(0,_t.gettext)("All entities will be forced to use default settings when this toggle is on. Turn off if you want to set custom thresholds for one or more entities.")))),Re.default.createElement("div",null,Re.default.createElement(zt,{level:4},(0,_t.gettext)("Revert all to default settings?")),Re.default.createElement(yi,null,Re.default.createElement(Si,{"data-test-itsi":"entity-thresholding-revert-to-default-button",icon:Ii,onClick:ie},(0,_t.gettext)("Revert all")),Re.default.createElement(_i,null,(0,_t.gettext)("Click")," ",Re.default.createElement("strong",null,(0,_t.gettext)("Revert all"))," ",(0,_t.gettext)("to change all custom entity thresholds back to default settings."))))):Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(zt,{"data-test-itsi":"thresholding-create-custom-settings-title",level:3},!ha&&(0,De.default)($)&&(0,De.default)(X)?(0,_t.gettext)("...or create custom settings"):(0,_t.gettext)("Settings")),oa,me===Ot.THRESHOLD_TYPE_OPTIONS[2].value&&ca,(!(0,De.default)($)||!(0,De.default)(X)||ha)&&Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(tt.default,null),Re.default.createElement(zt,{"data-test-itsi":"thresholding-more-options-title",level:3},(0,_t.gettext)("More options")),ha&&(0,De.default)($)&&da,(!(0,De.default)($)||!(0,De.default)(X))&&!N&&Qi))))),Re.default.createElement(ht.default.Panel,{panelId:"sub"},Re.default.createElement(di,{icon:Ci,"data-test-itsi":"base-configuration-apply-template-button",label:(0,_t.gettext)("Back"),onClick:Di,disabled:et}),Re.default.createElement(hi,null,ua),Re.default.createElement(ui,{"data-test-itsi":"kpi-threshold-template-select-control-group",label:(0,_t.gettext)("Threshold template"),labelPosition:"top",error:Ie,help:Ie?(0,_t.gettext)("This is a required field"):"",required:!0},pa(),""!==Oe&&Re.default.createElement(fi,{"data-test-itsi":"kpi-threshold-template-link",to:(0,wt.uiEditURL)(Oe),openInNewContext:!0},(0,_t.gettext)("View template"))),Ke&&Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(nt.default,{appearance:"fill",type:"info","data-test-itsi":"kpi-threshold-template-timezone-info-message"},(0,yt.sprintf)((0,_t.gettext)("The timezone of this template is in UTC and does not match your local timezone settings (%(localTimezone)s)."),{localTimezone:(0,Ct.getCurrentTimeInFormat)("z")})),Re.default.createElement(mi,null,Re.default.createElement(vi,{"data-test-itsi":"kpi-threshold-template-timezone-paragraph"},(0,_t.gettext)("Do you want to clone this template and apply it in your local timezone?")),Re.default.createElement(ut.default,{"data-test-itsi":"kpi-threshold-template-clone-switch",value:We,selected:We,appearance:"toggle",onClick:Ui},We?(0,_t.gettext)("Yes"):(0,_t.gettext)("No"))),We&&Re.default.createElement(Re.default.Fragment,null,Re.default.createElement(ui,{"data-test-itsi":"kpi-threshold-template-clone-title-control-group",label:(0,_t.gettext)("Threshold template title"),error:Ze,help:ea,required:!0},Re.default.createElement(ft.default,{"data-test-itsi":"kpi-threshold-template-clone-title-text",value:Ge,onChange:ji,placeholder:(0,_t.gettext)("required")})),Re.default.createElement(ui,{label:(0,_t.gettext)("Description")},Re.default.createElement(gi,{"data-test-itsi":"kpi-threshold-template-clone-description-text",inline:!0,onChange:Hi,placeholder:(0,_t.gettext)("optional"),value:ze,name:"description"})))),Re.default.createElement(ci,{"data-test-itsi":"kpi-thresholding-link-threshold-template-modal-apply-button",disabled:et,label:Yi(),error:Ie,onClick:We?Gi:Fi})),Re.default.createElement(ht.default.Panel,{panelId:"ai"},Re.default.createElement(Yt,null,"kpi"===Q.type?Re.default.createElement(Dt.default,{appsData:_,isReadOnly:Z,handleGoBack:$i,triggerRecommendationSearch:Ji}):Re.default.createElement(Pt.default,{appsData:_,isReadOnly:Z,handleGoBack:$i,handleRedirectToEntityModal:ce})))))}BaseConfigurationTabBar.propTypes={appsData:Oe.default.object,aiRecommendationsSearchRetrieveAction:Oe.default.func.isRequired,isApplyingAdaptiveThresholds:Oe.default.bool,isDefaultEntityThresholdView:Oe.default.bool,isRecommendationUnlinked:Oe.default.bool,isPerEntityThresholdEnabled:Oe.default.bool,isRecommendationConfigured:Oe.default.bool,handleThresholdDataUpdate:Oe.default.func.isRequired,handleApplySettingToggle:Oe.default.func,handleGoToKpiSettings:Oe.default.func,handleRevertAIThresholdSettings:Oe.default.func,handleThresholdTypeChange:Oe.default.func.isRequired,handleUpdateAdaptiveThresholding:Oe.default.func,selectedThresholdTemplate:Oe.default.object,previousThresholdTemplate:Oe.default.object,thresholdData:Oe.default.object.isRequired,isReadOnly:Oe.default.bool,selectedObject:Oe.default.object.isRequired,hadCopyKPIToEntityThresholds:Oe.default.bool,openAIThresholdingControls:Oe.default.bool,handleAllEntityThresholdToDefaultClicked:Oe.default.func,thresholdTemplateCollection:Oe.default.object.isRequired,previewServiceCache:Oe.default.object,serviceTemplateKey:Oe.default.string,kpiThresholdTemplateResetAction:Oe.default.func.isRequired,kpiThresholdTemplateCreateAction:Oe.default.func.isRequired,kpiThresholdTemplateApiStatus:Oe.default.string.isRequired,unlinkAIRecommendation:Oe.default.func,handleRedirectToEntityModal:Oe.default.func},BaseConfigurationTabBar.defaultProps={appsData:{},isApplyingAdaptiveThresholds:!1,isDefaultEntityThresholdView:!1,isRecommendationUnlinked:!1,isPerEntityThresholdEnabled:!1,isRecommendationConfigured:!1,selectedThresholdTemplate:{},previousThresholdTemplate:null,handleApplySettingToggle:je.default,handleGoToKpiSettings:je.default,handleRevertAIThresholdSettings:je.default,handleUpdateAdaptiveThresholding:je.default,isReadOnly:!1,hadCopyKPIToEntityThresholds:!1,openAIThresholdingControls:!1,handleAllEntityThresholdToDefaultClicked:je.default,previewServiceCache:{},serviceTemplateKey:"",unlinkAIRecommendation:je.default,handleRedirectToEntityModal:je.default};o.default=(0,Ie.connect)(s=>({kpiThresholdTemplateApiStatus:s.kpiThresholdTemplate.apiStatus,previewEntitiesThresholdsRecommendationSearchStatus:s.serviceDefinition.previewEntitiesThresholdsRecommendationSearchStatus,previewEntitiesThresholdsRecommendationResults:s.serviceDefinition.previewEntitiesThresholdsRecommendationResults,kpiEntitiesConfigApiErrorMessage:s.services.kpiEntitiesConfigApiErrorMessage,kpiEntitiesConfigApiStatus:s.services.kpiEntitiesConfigApiStatus,previewEntitiesThresholdsRecommendationSearchErrorMessage:s.serviceDefinition.previewEntitiesThresholdsRecommendationSearchErrorMessage}),s=>(0,Me.bindActionCreators)({aiRecommendationsSearchRetrieveAction:Et.healthAnalyticsConsoleRecommendationsSearchRetrieve,kpiThresholdTemplateResetAction:kt.kpiThresholdTemplateReset,kpiThresholdTemplateCreateAction:kt.kpiThresholdTemplateCreate},s))(BaseConfigurationTabBar);s.exports=o.default},1458:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(0)),O=S(_(3)),P=S(_(39)),D=S(_(27)),N=S(_(218)),V=S(_(2640)),j=S(_(203)),K=S(_(83)),W=_(4),U=_(102),Y=R.default.createElement(D.default,{"data-test-itsi":"entity-side-panel-advanced-filters-button",icon:R.default.createElement(V.default,null)});function EntityAdvancedFilter(s){var{handleClickAdvancedFiltering:o,handleEntityFilterChange:_}=s,handleFilterItemClick=s=>()=>o(s);return R.default.createElement(R.default.Fragment,null,R.default.createElement(K.default,{"data-test-itsi":"entity-side-panel-filter-text",canClear:!0,appearance:"search",onChange:_,placeholder:(0,W.gettext)("Search entities...")}),R.default.createElement(N.default,{"data-test-itsi":"entity-side-panel-advanced-filter-dropdown",toggle:Y},R.default.createElement(j.default,{"data-test-itsi":"entity-side-panel-advanced-filter-menu"},R.default.createElement(j.default.Heading,{title:!0,"data-test-itsi":"entity-side-panel-advanced-filter-menu-heading"},(0,W.gettext)("Filter entities with...")),U.ENTITY_FILTER_OPTIONS.map(s=>R.default.createElement(j.default.Item,{"data-test-itsi":"entity-side-panel-advanced-filter-".concat(s.value.split("_").join("-"),"-menu-item"),key:s.value,onClick:handleFilterItemClick(s)},s.label)))))}EntityAdvancedFilter.propTypes={handleClickAdvancedFiltering:O.default.func,handleEntityFilterChange:O.default.func},EntityAdvancedFilter.defaultProps={handleClickAdvancedFiltering:P.default,handleEntityFilterChange:P.default};o.default=EntityAdvancedFilter;s.exports=o.default},1459:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.DriftDetectionPackageIcon=DriftDetectionPackageIcon,o.default=void 0;var R=S(_(0)),O=S(_(3));function DriftDetectionPackageIcon(s){var{viewBox:o,width:_,height:S,fill:O}=s;return R.default.createElement("svg",{"data-test-itsi":"drift-detection-package-icon",viewBox:o,width:_,height:S,fill:O},R.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M55.8631 27.0469V50.5952C55.8631 50.8105 55.7377 51.0257 55.5585 51.1333L35.7606 62.5219L35.6352 62.5936C35.6173 62.6115 35.5994 62.6115 35.5815 62.6115C35.3127 62.7371 34.9902 62.7371 34.7394 62.5936L34.5781 62.5039L35.1694 62.2887V38.9735L55.8631 27.0469Z",fill:"#ACB1BB"}),R.default.createElement("g",{opacity:"0.4"},R.default.createElement("mask",{id:"mask0_5576_132766",maskUnits:"userSpaceOnUse",x:"34",y:"27",width:"22",height:"36"},R.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M55.8631 27.0469V50.5952C55.8631 50.8105 55.7377 51.0257 55.5585 51.1333L35.7606 62.5219L35.6352 62.5936C35.6173 62.6115 35.5994 62.6115 35.5815 62.6115C35.3127 62.7371 34.9902 62.7371 34.7394 62.5936L34.5781 62.5039L35.1694 62.2887V38.9735L55.8631 27.0469Z",fill:"#34343A"})),R.default.createElement("g",{mask:"url(#mask0_5576_132766)"},R.default.createElement("path",{d:"M45.6515 46.4699L35.1523 38.9731L36.2273 33.521L56.9211 29.127L65.7719 34.2742C66.399 34.6509 66.399 35.5655 65.7719 35.9242L47.5686 46.452C46.9773 46.7927 46.2428 46.8106 45.6515 46.4699Z",fill:"black"}))),R.default.createElement("path",{d:"M14.457 50.5773V27.0469L35.1508 38.9735V62.3425C35.1508 62.5757 34.9 62.7192 34.6849 62.6116L14.7616 51.1154C14.5824 51.0077 14.457 50.8105 14.457 50.5773Z",fill:"#CFCFCE"}),R.default.createElement("g",{opacity:"0.1"},R.default.createElement("mask",{id:"mask1_5576_132766",maskUnits:"userSpaceOnUse",x:"14",y:"27",width:"22",height:"36"},R.default.createElement("path",{d:"M14.457 50.5773V27.0469L35.1508 38.9735V62.3425C35.1508 62.5757 34.9 62.7192 34.6849 62.6116L14.7616 51.1154C14.5824 51.0077 14.457 50.8105 14.457 50.5773Z",fill:"#40404A"})),R.default.createElement("g",{mask:"url(#mask1_5576_132766)"},R.default.createElement("path",{d:"M15.4954 35.2606L24.4359 30.1133L45.1475 35.1171V42.0399L35.7234 47.4742C35.1321 47.8149 34.4154 47.8149 33.8242 47.4742C30.8321 45.7524 21.4975 40.372 15.5134 36.9285C14.8684 36.5519 14.8684 35.6372 15.4954 35.2606Z",fill:"black"}))),R.default.createElement("path",{d:"M55.864 27.0454L35.1523 15.1367V38.9541V38.972L55.864 27.0454Z",fill:"#B8B8B8"}),R.default.createElement("path",{opacity:"0.3",d:"M55.864 27.0454L35.1523 15.1367V38.9541V38.972L55.864 27.0454Z",fill:"url(#paint0_linear_5576_132766)"}),R.default.createElement("path",{d:"M35.1508 38.972V15.1367L14.457 27.0454L35.1508 38.972Z",fill:"#ACB1BB"}),R.default.createElement("path",{opacity:"0.4",d:"M35.1508 38.972V15.1367L14.457 27.0454L35.1508 38.972Z",fill:"url(#paint1_linear_5576_132766)"}),R.default.createElement("path",{opacity:"0.1",d:"M35.1508 38.972V15.1367L14.457 27.0454L35.1508 38.972Z",fill:"url(#paint2_linear_5576_132766)"}),R.default.createElement("path",{d:"M35.1699 15.1377L45.2212 9.3268C45.4183 9.21919 45.6512 9.21919 45.8303 9.3268L65.6999 20.8409C65.897 20.9665 65.897 21.2534 65.6999 21.379L55.8458 27.0464L35.1699 15.1377Z",fill:"#E2E3E2"}),R.default.createElement("path",{d:"M4.54992 32.7501L14.4578 27.0469L35.1695 38.9735L25.1003 44.7664C24.9033 44.8741 24.6883 44.8741 24.4912 44.7664C22.4845 43.6186 10.9462 36.9648 4.54992 33.2882C4.33492 33.1626 4.33492 32.8757 4.54992 32.7501Z",fill:"#E2E3E2"}),R.default.createElement("path",{d:"M35.0078 38.9735L55.7016 27.0469L65.5199 32.7501C65.717 32.8757 65.717 33.1626 65.5199 33.2882L45.6861 44.7664C45.4891 44.8741 45.2561 44.8741 45.077 44.7664L35.0078 38.9735Z",fill:"#E2E3E2"}),R.default.createElement("path",{d:"M4.54992 20.8051L24.4733 9.3268C24.6703 9.21919 24.9033 9.21919 25.0824 9.3268L35.1516 15.1197L14.4578 27.0464C14.4578 27.0464 8.11534 23.4056 4.54992 21.3431C4.33492 21.2176 4.33492 20.9306 4.54992 20.8051Z",fill:"#E2E3E2"}),R.default.createElement("path",{d:"M4.54992 20.8051L24.4733 9.3268C24.6703 9.21919 24.9033 9.21919 25.0824 9.3268L35.1516 15.1197L14.4578 27.0464C14.4578 27.0464 8.11534 23.4056 4.54992 21.3431C4.33492 21.2176 4.33492 20.9306 4.54992 20.8051Z",fill:"url(#paint3_linear_5576_132766)"}),R.default.createElement("defs",null,R.default.createElement("linearGradient",{id:"paint0_linear_5576_132766",x1:"44.897",y1:"22.43",x2:"36.4645",y2:"40.9062",gradientUnits:"userSpaceOnUse"},R.default.createElement("stop",{stopOpacity:"0"}),R.default.createElement("stop",{offset:"1"})),R.default.createElement("linearGradient",{id:"paint1_linear_5576_132766",x1:"26.7063",y1:"23.9679",x2:"35.4907",y2:"37.2729",gradientUnits:"userSpaceOnUse"},R.default.createElement("stop",{stopOpacity:"0"}),R.default.createElement("stop",{offset:"1"})),R.default.createElement("linearGradient",{id:"paint2_linear_5576_132766",x1:"29.6613",y1:"32.446",x2:"33.844",y2:"42.2153",gradientUnits:"userSpaceOnUse"},R.default.createElement("stop",{stopOpacity:"0"}),R.default.createElement("stop",{offset:"1"})),R.default.createElement("linearGradient",{id:"paint3_linear_5576_132766",x1:"28.4292",y1:"33.0509",x2:"18.7278",y2:"16.3757",gradientUnits:"userSpaceOnUse"},R.default.createElement("stop",{offset:"1.61469e-07",stopOpacity:"0.2"}),R.default.createElement("stop",{offset:"1",stopOpacity:"0"}))))}DriftDetectionPackageIcon.propTypes={viewBox:O.default.string,width:O.default.string,height:O.default.string,fill:O.default.string},DriftDetectionPackageIcon.defaultProps={viewBox:"0 0 86 99",width:"120px",height:"180px",fill:"none"};o.default=DriftDetectionPackageIcon},1460:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q,ee,te,ie=S(_(8)),ae=S(_(7)),ne=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),re=S(_(3)),se=S(_(2)),le=S(_(33)),oe=S(_(254)),de=S(_(99)),ce=S(_(39)),he=S(_(1614)),ue=S(_(583)),pe=S(_(27)),fe=S(_(427)),ge=S(_(44)),me=S(_(64)),ve=S(_(247)),ye=S(_(24)),_e=S(_(100)),Se=S(_(282)),be=S(_(51)),Ee=S(_(550)),Te=S(_(66)),Ce=S(_(113)),ke=S(_(75)),xe=_(22),we=_(4),Re=_(78),Ie=_(67),Me=_(726),Oe=_(627),Ae=_(979),Pe=_(1187),De=S(_(1615)),Le=_(774),Ne=_(1753),Ve=_(1188);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,ie.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var je=(0,se.default)(ye.default)(R||(R=(0,ae.default)(["\n padding-left: 20px;\n"]))),He=(0,se.default)(_e.default)(O||(O=(0,ae.default)(["\n width: 1200px;\n"]))),Be=se.default.div(P||(P=(0,ae.default)(["\n margin: 0 0 30px 0;\n text-align: center;\n"]))),Ke=(0,se.default)(ue.default)(D||(D=(0,ae.default)(["\n color: ",";\n"])),xe.variables.accentColorL10),Fe=se.default.div(N||(N=(0,ae.default)(["\n display: flex;\n align-items: center;\n margin: 20px 20px 5px 0px;\n"]))),We=(0,se.default)(Te.default)(V||(V=(0,ae.default)(["\n width: 75%;\n"]))),Ue=(0,se.default)(fe.default.Column)(j||(j=(0,ae.default)(["\n border-right: ",";\n"])),xe.variables.border),Ge=(0,se.default)(ve.default)(K||(K=(0,ae.default)(["\n padding: 0;\n"]))),Ye=(0,se.default)(ve.default.Item)(W||(W=(0,ae.default)(["\n align-items: center;\n display: flex;\n"]))),qe=(0,se.default)(_e.default)(U||(U=(0,ae.default)(["\n width: 600px;\n"]))),ze=se.default.div(Y||(Y=(0,ae.default)(["\n padding-right: 10px;\n"]))),$e=(0,se.default)(Te.default)($||($=(0,ae.default)(["\n width: 128px;\n"]))),Je=(0,se.default)(me.default)(X||(X=(0,ae.default)(["\n margin: 0;\n max-width: 200px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"]))),Xe=se.default.div(Z||(Z=(0,ae.default)(["\n padding-left: 10px;\n"]))),Ze=(0,se.default)(_e.default.Body)(Q||(Q=(0,ae.default)(["\n padding-top: 0;\n"]))),Qe=se.default.div(ee||(ee=(0,ae.default)(["\n padding-right: 10px;\n"]))),et=(0,se.default)(_e.default.Footer)(te||(te=(0,ae.default)(["\n display: flex;\n justify-content: space-between;\n text-align: left;\n"]))),tt={aggregation_span:null,aggregation_function:"max",lookback_period:null,threshold_direction:null,tolerance_in_percent:null},it={maxWidth:500},at={width:20};function DriftDetectionConfigurationModal(s){var{driftConfiguration:o,isModalOpen:_,kpiId:S,kpiTitle:R,onSaveKpiChanges:O,linkedServices:P,handleCloseModal:D,alertPeriod:N}=s,[V,j]=(0,ne.useState)(P.length>0&&P[0].value),[K,W]=(0,ne.useState)(S),[U,Y]=(0,ne.useState)((0,le.default)(o)?tt:o),[$,X]=(0,ne.useState)(!1),[Z,Q]=(0,ne.useState)(Oe.DRIFT_DETECTION_TIME_SELECTOR_OPTIONS[0].value),[ee,te]=(0,ne.useState)((0,Ie.getDaysAgoFromStartOfDay)(Oe.DRIFT_DETECTION_TIME_SELECTOR_OPTIONS[0].value)),[ie,ae]=(0,ne.useState)(_),[re,se]=(0,ne.useState)(Le.KPI_SEARCH_RETRIEVE_STATUS.READY),[ce,ue]=(0,ne.useState)([]),[ve,ye]=(0,ne.useState)(""),[xe,nt]=(0,ne.useState)(Me.DRIFT_DETECTION_SEARCH_RETRIEVE_STATUS.READY),[rt,st]=(0,ne.useState)({}),[lt,ot]=(0,ne.useState)("");(0,ne.useEffect)(()=>{ae(_)},[_]),(0,ne.useEffect)(()=>{P&&P.length>0&&!V&&j(P[0].value)},[P]);var getBaseKpiData=()=>{if(K){var s=(0,Ve.getKpiBaseCustomSpan)(K,U.aggregation_span,U.aggregation_function),o={id:(0,Re.createUniqueSearchId)("drift-kpi-configuration-modal-search"),search:s,earliest_time:U.lookback_period,latest_time:"now"},_=Object.assign({},o),S=(0,Ne.retrieveKpiSearchJob)(_);se(Le.KPI_SEARCH_RETRIEVE_STATUS.IN_PROGRESS),S.getResults({count:0,offset:0}).subscribe({next:s=>{null!=s&&s.results&&(ue(s.results),se(Le.KPI_SEARCH_RETRIEVE_STATUS.SUCCESS))},error:s=>{se(Le.KPI_SEARCH_RETRIEVE_STATUS.ERROR),ye(s)}})}},runDriftDetectionAlgorithm=()=>{var s=Object.assign({},U,{kpiId:K,alertPeriod:N}),o=(0,Pe.getDriftDetectionSearch)(s),_={id:(0,Re.createUniqueSearchId)("run-drift-detection-algo-search"),earliest_time:U.lookback_period,latest_time:"now",search:o},S=Object.assign({},_),R=(0,Ae.retrieveDriftDetectionSearchJob)(S);nt(Me.DRIFT_DETECTION_SEARCH_RETRIEVE_STATUS.IN_PROGRESS),R.getResults({count:0,offset:0}).subscribe({next:s=>{null!=s&&s.results&&(st(s),nt(Me.DRIFT_DETECTION_SEARCH_RETRIEVE_STATUS.SUCCESS))},error:s=>{ot(s),nt(Me.DRIFT_DETECTION_SEARCH_RETRIEVE_STATUS.ERROR)}})};(0,ne.useEffect)(()=>{!(0,le.default)(o)&&_&&(getBaseKpiData(),runDriftDetectionAlgorithm())},[ee,K,_]);var dt,handleClickPreviewButton=()=>{Object.values(U).some(s=>null==s)?X(!0):(getBaseKpiData(),runDriftDetectionAlgorithm())},handleSelectedServiceChange=(s,o)=>{var{value:_}=o;j(_);var S=P.find(s=>s.value===_);W(null==S?void 0:S.kpi._key)},handleCloseDriftModal=()=>{ae(!1),D()},handleTimeChange=(s,o)=>{var{value:_}=o;Q(_),te((0,Ie.getDaysAgoFromStartOfDay)(_))},handleAggregationSpanChange=(s,o)=>{var{value:_}=o;Y(_objectSpread(_objectSpread({},U),{},{aggregation_span:_}))},handleAggregationFunctionChange=(s,o)=>{var{value:_}=o;Y(_objectSpread(_objectSpread({},U),{},{aggregation_function:_}))},handleLookbackChange=(s,o)=>{var{value:_}=o;Y(_objectSpread(_objectSpread({},U),{},{lookback_period:_}));var S=Math.abs(parseInt(_,10));S&&(Q(S),te((0,Ie.getDaysAgoFromStartOfDay)(S)))},handleThresholdDirectionChange=(s,o)=>{var{value:_}=o;Y(_objectSpread(_objectSpread({},U),{},{threshold_direction:_}))},handleTolerancePercentChange=(s,o)=>{var{value:_}=o;Y(_objectSpread(_objectSpread({},U),{},{tolerance_in_percent:_}))},handleSaveDriftSettings=()=>{Object.values(U).some(s=>null==s)?X(!0):(O(U),ae(!1))},handleDeleteDriftFromKpi=()=>{O({}),ae(!1)},getDriftSettings=s=>{var o=s?"top":"left";return ne.default.createElement(Qe,null,ne.default.createElement(ge.default,{"data-test-itsi":"drift-detection-settings-modal-aggregation-period-container",error:$&&(0,oe.default)(U.aggregation_span),help:(0,we.gettext)("Time frame over which data is collected"),label:(0,we.gettext)("Data aggregation period"),labelPosition:o,required:!0},ne.default.createElement(Te.default,{"data-test-itsi":"drift-detection-settings-modal-select-time",error:$&&(0,oe.default)(U.aggregation_span),onChange:handleAggregationSpanChange,placeholder:(0,we.gettext)("Select an option..."),value:U.aggregation_span},Oe.DRIFT_DETECTION_TIME_PERIOD_VALUES.map(s=>ne.default.createElement(Te.default.Option,{"data-test-itsi":"drift-detection-settings-modal-select-time-option",key:"".concat(s.label,"-").concat(s.value),label:s.label,value:s.value})))),ne.default.createElement(ge.default,{"data-test-itsi":"drift-detection-settings-modal-function-container",help:(0,we.gettext)("Statistical method used to summarize KPI data"),label:(0,we.gettext)("Function"),labelPosition:o,required:!0},ne.default.createElement(Ee.default,{"data-test-itsi":"drift-detection-settings-modal-function-selector",onChange:handleAggregationFunctionChange,style:it,value:U.aggregation_function},Oe.DRIFT_DETECTION_FUNCTIONS.map(s=>ne.default.createElement(Ee.default.Option,{key:s.value,"data-test-itsi":"drift-detection-settings-modal-function-option",value:s.value,label:s.label})))),ne.default.createElement(ge.default,{"data-test-itsi":"drift-detection-settings-modal-lookback-container",error:$&&(0,oe.default)(U.lookback_period),help:(0,we.gettext)("Calculate drift for KPI data within this time period"),label:(0,we.gettext)("Look back period"),labelPosition:o,required:!0},ne.default.createElement(Te.default,{"data-test-itsi":"drift-detection-settings-modal-select-lookback",error:$&&(0,oe.default)(U.lookback_period),onChange:handleLookbackChange,placeholder:(0,we.gettext)("Select an option..."),value:U.lookback_period},Oe.DRIFT_DETECTION_LOOKBACK_PERIOD_OPTIONS.map(s=>ne.default.createElement(Te.default.Option,{"data-test-itsi":"drift-detection-settings-modal-select-lookback-option",key:"".concat(s.label,"-").concat(s.value),label:s.label,value:s.value})))),ne.default.createElement(ge.default,{"data-test-itsi":"drift-detection-settings-modal-tolerance-container",controlsLayout:"fillJoin",error:$&&((0,oe.default)(U.tolerance_in_percent)||(0,oe.default)(U.threshold_direction)),help:(0,we.gettext)("The direction and degree of change"),label:(0,we.gettext)("Drift tolerance %"),labelPosition:o,required:!0},ne.default.createElement(We,{"data-test-itsi":"drift-detection-settings-modal-select-tolerance-direction",error:$&&(0,oe.default)(U.threshold_direction),onChange:handleThresholdDirectionChange,placeholder:(0,we.gettext)("Select an option..."),value:U.threshold_direction},Oe.DRIFT_DETECTION_TOLERANCE_DIRECTION_OPTIONS.map(s=>ne.default.createElement(Te.default.Option,{"data-test-itsi":"drift-detection-settings-modal-select-tolerance-direction-option",key:"".concat(s.label,"-").concat(s.value),label:s.label,value:s.value}))),ne.default.createElement(Se.default,{"data-test-itsi":"drift-detection-settings-modal-select-tolerance-value",error:$&&((0,oe.default)(U.tolerance_in_percent)||(0,de.default)(U.tolerance_in_percent)),inline:!0,max:100,min:1,onChange:handleTolerancePercentChange,style:at,value:U.tolerance_in_percent})),s&&ne.default.createElement(ge.default,{help:(0,we.gettext)("Click this button to update the chart"),label:"",labelPosition:"top"},ne.default.createElement(pe.default,{"data-test-itsi":"drift-detection-settings-modal-preview-button",onClick:handleClickPreviewButton,label:(0,we.gettext)("Preview drift")})))};return(dt=!(0,le.default)(o))?ne.default.createElement(He,{"data-test-itsi":"drift-detection-settings-modal",onRequestClose:handleCloseDriftModal,open:ie},ne.default.createElement(_e.default.Header,{"data-test-itsi":"drift-detection-settings-modal-header",onRequestClose:handleCloseDriftModal,title:(0,we.gettext)("Configure drift detection")}),ne.default.createElement(Ze,null,ne.default.createElement(fe.default,null,ne.default.createElement(fe.default.Row,null,ne.default.createElement(Ue,{span:3},P.length>0&&ne.default.createElement(ze,null,ne.default.createElement(me.default,{"data-test-itsi":"drift-detection-modal-service-selector-header",level:3},(0,we.gettext)("Preview service")),ne.default.createElement(Te.default,{"data-test-itsi":"drift-detection-modal-service-selector",value:V,onChange:handleSelectedServiceChange},P.map(s=>ne.default.createElement(Te.default.Option,{"data-test-itsi":"drift-detection-modal-service-selector-option",label:s.label,value:s.value,key:"select-option-".concat(s.value)})))),ne.default.createElement(me.default,{level:3},(0,we.gettext)("Settings")),getDriftSettings(dt)),ne.default.createElement(fe.default.Column,{"data-test-itsi":"drift-detection-settings-modal-chart-column",span:9},ne.default.createElement(Fe,null,ne.default.createElement(Je,{"data-test-itsi":"drift-detection-modal-kpi-title",level:3},R),ne.default.createElement(Xe,null,ne.default.createElement($e,{"data-test-itsi":"drift-detection-settings-modal-preview-time-range-picker",value:Z,onChange:handleTimeChange},Oe.DRIFT_DETECTION_TIME_SELECTOR_OPTIONS.map(s=>ne.default.createElement(Te.default.Option,{"data-test-itsi":"drift-detection-settings-modal-time-range-picker-option",label:s.label,value:s.value,key:String(s.value)}))))),ne.default.createElement("div",null,re===Le.KPI_SEARCH_RETRIEVE_STATUS.ERROR&&ne.default.createElement(je,{type:"error"},ve),re===Le.KPI_SEARCH_RETRIEVE_STATUS.IN_PROGRESS&&ne.default.createElement(Be,null,(0,we.gettext)("Loading chart..."),ne.default.createElement(ke.default,{"data-test-itsi":"drift-detection-settings-modal-chart-wait-spinner",size:"medium"})),re===Le.KPI_SEARCH_RETRIEVE_STATUS.SUCCESS&&(ce.length>0?ne.default.createElement(De.default,{baseKpiData:ce,driftAlgorithmStatus:xe,driftAlgorithmResults:rt,showHistoryTable:!0}):ne.default.createElement(je,{type:"warning"},(0,we.gettext)("No KPI results returned by the search"))),xe===Me.DRIFT_DETECTION_SEARCH_RETRIEVE_STATUS.ERROR&&ne.default.createElement(je,{type:"error"},lt),re!==Le.KPI_SEARCH_RETRIEVE_STATUS.IN_PROGRESS&&xe===Me.DRIFT_DETECTION_SEARCH_RETRIEVE_STATUS.IN_PROGRESS&&ne.default.createElement(Be,null,(0,we.gettext)("Loading drift recommendations "),ne.default.createElement(ke.default,{"data-test-itsi":"drift-detection-settings-modal-drift-wait-spinner",size:"medium"}))))))),ne.default.createElement(et,null,ne.default.createElement("div",null,ne.default.createElement(pe.default,{"data-test-itsi":"drift-detection-settings-modal-delete-button",appearance:"destructive",label:(0,we.gettext)("Delete"),onClick:handleDeleteDriftFromKpi})),ne.default.createElement("div",null,ne.default.createElement(pe.default,{"data-test-itsi":"drift-detection-settings-modal-cancel-button",appearance:"secondary",onClick:handleCloseDriftModal,label:(0,we.gettext)("Cancel")}),ne.default.createElement(pe.default,{"data-test-itsi":"drift-detection-settings-modal-save-button",appearance:"primary",label:(0,we.gettext)("Apply"),onClick:handleSaveDriftSettings})))):ne.default.createElement(qe,{"data-test-itsi":"drift-detection-settings-modal",onRequestClose:handleCloseDriftModal,open:ie},ne.default.createElement(_e.default.Header,{"data-test-itsi":"drift-detection-settings-modal-header",onRequestClose:handleCloseDriftModal,title:(0,we.gettext)("Configure drift detection")}),ne.default.createElement(_e.default.Body,null,getDriftSettings(),ne.default.createElement("div",{"data-test-itsi":"drift-detection-settings-modal-automated-actions-container"},ne.default.createElement(be.default,null,(0,we.gettext)("You will be alerted when drift is detected on the following pages:")),ne.default.createElement(Ge,null,ne.default.createElement(Ye,null,ne.default.createElement(Ke,null),ne.default.createElement(Ce.default,null,(0,we.gettext)("Alerts and Episodes: ")),(0,we.gettext)("create a notable event when drift is detected")),ne.default.createElement(Ye,null,ne.default.createElement(Ke,null),ne.default.createElement(Ce.default,null,(0,we.gettext)("Service analyzer: ")),(0,we.gettext)("This icon"),ne.default.createElement(he.default,null),(0,we.gettext)("will display on KPIs when drift is detected")),ne.default.createElement(Ye,null,ne.default.createElement(Ke,null),ne.default.createElement(Ce.default,null,(0,we.gettext)("Configuration assistant:")),(0,we.gettext)("receive steps to troubleshoot KPIs when drift is detected"))))),ne.default.createElement(_e.default.Footer,null,ne.default.createElement(pe.default,{"data-test-itsi":"drift-detection-settings-modal-cancel-button",appearance:"secondary",onClick:handleCloseDriftModal,label:(0,we.gettext)("Cancel")}),ne.default.createElement(pe.default,{"data-test-itsi":"drift-detection-settings-modal-save-button",appearance:"primary",label:(0,we.gettext)("Apply"),onClick:handleSaveDriftSettings})))}DriftDetectionConfigurationModal.propTypes={driftConfiguration:re.default.object.isRequired,isModalOpen:re.default.bool.isRequired,kpiId:re.default.string.isRequired,kpiTitle:re.default.string.isRequired,onSaveKpiChanges:re.default.func.isRequired,linkedServices:re.default.array,handleCloseModal:re.default.func,alertPeriod:re.default.number},DriftDetectionConfigurationModal.defaultProps={linkedServices:[],handleCloseModal:ce.default,alertPeriod:1};o.default=DriftDetectionConfigurationModal;s.exports=o.default},1461:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1083),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},1462:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),N=S(_(3)),V=S(_(2)),j=S(_(140)),K=S(_(201)),W=S(_(39)),U=S(_(233)),Y=S(_(314)),$=S(_(27)),X=S(_(44)),Z=S(_(231)),Q=S(_(66)),ee=_(4),te=_(61),ie=_(110);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var ae=(0,V.default)(Y.default)(R||(R=(0,P.default)(["\n color: ",";\n"])),s=>s.color),ne=(0,V.default)($.default)(O||(O=(0,P.default)(["\n margin-left: 10px;\n"]))),re=D.default.createElement(U.default,{screenReaderText:(0,ee.gettext)("Remove KPI alerting rule")});function KpiAlertingCustomRule(s){var o,{availableSeverityValues:_,fromSeverityValues:S,onClickRemoveRule:R,toSeverityValue:O,onUpdateToSeverity:P,updateRule:N}=s,[V,W]=(0,D.useState)(O),[U,Y]=(0,D.useState)(S),getSeverityObject=s=>ie.THRESHOLDS.find(o=>o.value===s),$=(0,D.useCallback)((s,o)=>{var{value:_}=o;P(V,_),W(_)},[P,V]),se=(0,D.useCallback)((s,o)=>{var{values:_}=o;N(V,_),Y(_)},[V,N]),le=(0,D.useCallback)(()=>{R(V)},[R,V]);return D.default.createElement(D.default.Fragment,null,D.default.createElement(X.default,{controlsLayout:"none","data-test-itsi":"kpi-alerting-change-to-control-group",label:(0,ee.gettext)("KPI severity changes to"),labelWidth:te.LABEL_WIDTHS.LongPlus},D.default.createElement(Q.default,{"data-test-itsi":"kpi-alerting-change-to-select",value:V,onChange:$},((o=(0,j.default)(_)).includes(V)||o.push(V),o.map(s=>{var o,_=getSeverityObject(s),S=(o=_.boxFilledColor,D.default.createElement(ae,{color:o,variant:"filled"}));return D.default.createElement(Q.default.Option,{"data-test-itsi":"kpi-alerting-severity-select-option",icon:_.boxFilledColor?S:null,label:_.label,value:_.value,key:_.value})})))),D.default.createElement(X.default,{"data-test-itsi":"kpi-alerting-change-from-control-group",label:(0,ee.gettext)("from"),labelWidth:te.LABEL_WIDTHS.LongPlus,labelFor:"kpi-alerting-change-from-multiselect"},D.default.createElement(Z.default,{"data-test-itsi":"kpi-alerting-change-from-multiselect",inputId:"kpi-alerting-change-from-multiselect",values:U,onChange:se,inline:!0},(0,K.default)(ie.THRESHOLDS,[getSeverityObject(V)]).map(s=>D.default.createElement(Z.default.Option,{"data-test-itsi":"kpi-alerting-multiselect-option",label:s.label,value:s.value,key:s.value}))),D.default.createElement(ne,{appearance:"pill","data-test-itsi":"kpi-alerting-rule-remove-button",icon:re,onClick:le})))}KpiAlertingCustomRule.propTypes={availableSeverityValues:N.default.array.isRequired,fromSeverityValues:N.default.array.isRequired,onClickRemoveRule:N.default.func,toSeverityValue:N.default.string.isRequired,onUpdateToSeverity:N.default.func,updateRule:N.default.func},KpiAlertingCustomRule.defaultProps={onClickRemoveRule:W.default,onUpdateToSeverity:W.default,updateRule:W.default};o.default=KpiAlertingCustomRule;s.exports=o.default},1463:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=_(45),N=S(_(15)),V=S(_(0)),j=S(_(35)),K=S(_(2)),W=S(_(37)),U=S(_(33)),Y=S(_(118)),$=S(_(44)),X=S(_(113)),Z=S(_(89)),Q=S(_(75)),ee=S(_(91)),te=_(4),ie=_(14),ae=_(1025),ne=_(73),re=_(61),se=_(78),le=_(67),oe=_(163),de=S(_(88)),ce=S(_(77)),he=S(_(111)),ue=S(_(47)),pe=_(188),fe=S(_(2664)),ge=S(_(2667)),me=S(_(2668)),ve=S(_(2671)),ye=S(_(1199)),_e=S(_(2672)),Se=S(_(2673)),be=S(_(2674)),Ee=S(_(2675));_(2676);var Te=(0,K.default)(Q.default)(R||(R=(0,P.default)(["\n\tmargin-right: 5px;\n"]))),Ce=(0,K.default)(Z.default)(O||(O=(0,P.default)(["\n\tmargin-left: 5px;\n"]))),ke={COHESIVE_NOT_MIN_ENTITIES:(0,te.gettext)("Not enough entities to run the cohesive analysis."),COHESIVE_NOT_MAX_ENTITIES:(0,te.gettext)("Too many entities to run the cohesive analysis."),INSUFFICIENT_DATA:(0,te.gettext)("Insufficient data to produce recommendation."),NO_RECOMMENDATION:(0,te.gettext)("No recommendation.")},xe=(0,D.template)(Se.default,null,{variable:"vars"}),we=(0,D.template)(be.default,null,{variable:"vars"}),Re=(0,D.template)(Ee.default,null,{variable:"vars"}),Ie=V.default.createElement(V.default.Fragment,null,V.default.createElement("svg",{width:"285px",height:"76px",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","data-test-itsi":"kpi-ad-cohesive-tooltip"},V.default.createElement("title",null,"cohesive-image"),V.default.createElement("desc",null,"Created with Sketch."),V.default.createElement("defs",null),V.default.createElement("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},V.default.createElement("g",{id:"cohesive-image-tooltip",transform:"translate(-22.000000, -7.000000)"},V.default.createElement("g",{id:"cohesive-image",transform:"translate(10.000000, 0.000000)"},V.default.createElement("g",{id:"image",transform:"translate(10.000000, 7.000000)"},V.default.createElement("path",{d:"M101.5,13.5 L101.5,36.5",id:"Line",stroke:pe.backgroundColor,strokeLinecap:"square",strokeDasharray:"2"}),V.default.createElement("path",{d:"M134.5,34.5 L134.5,45.5",id:"Line-Copy-6",stroke:pe.backgroundColor,strokeLinecap:"square",strokeDasharray:"2"}),V.default.createElement("path",{d:"M68.5,12.5 L68.5,43.5",id:"Line-Copy-5",stroke:pe.backgroundColor,strokeLinecap:"square",strokeDasharray:"2"}),V.default.createElement("g",{id:"Group-7",transform:"translate(0.000000, 33.000000)",strokeLinecap:"square",strokeOpacity:"0.7",stroke:pe.backgroundColor},V.default.createElement("polyline",{id:"Line",points:"3.5 21.5 37.3138313 12.5268731 70.1353536 19.2911773 102.990545 3.58832829 135.812066 18.5664304 169.150422 11.0773793 202.522449 19.2911773 240.46537 17.0549034"}),V.default.createElement("polyline",{id:"Line-Copy",points:"3.5 23.5 37.3138313 11.5268731 70.1353536 14.2911773 102.990545 9.58832829 135.812066 20.5664304 169.150422 11.0773793 202.522449 21.2911773 239.693391 22.0727684"}),V.default.createElement("polyline",{id:"Line-Copy-2",points:"3.5 16.5 37.3138313 16.5268731 70.1353536 12.2911773 102.990545 19.5883283 135.812066 13.5664304 169.150422 14.0773793 202.522449 24.2911773 239.693391 25.1606853"}),V.default.createElement("polyline",{id:"Line-Copy-3",points:"3.5 19.5 37.3138313 19.5268731 70.1353536 15.2911773 102.990545 22.5883283 135.812066 16.5664304 169.150422 17.0773793 202.522449 27.2911773 240.07938 18.2128722"}),V.default.createElement("polyline",{id:"Line-Copy-4",points:"3.5 18.5 37.3138313 22.5268731 70.1353536 14.2911773 102.990545 15.5883283 135.812066 15.5664304 169.150422 23.0773793 202.522449 22.2911773 240.46537 22.0727684"})),V.default.createElement("g",{id:"Group-5"},V.default.createElement("polyline",{id:"Line",stroke:pe.infoColor,strokeWidth:"2",strokeLinecap:"square",points:"3.5 48.5 37.5 38.5 68.9425236 6.03977872 102.840452 7.6444144 135.334325 32.716847 168.429936 49.9666805 201.926706 53.9782698 238.535422 47.3529761"}),V.default.createElement("g",{id:"alert",transform:"translate(96.000000, 2.000000)"},V.default.createElement("g",{id:"Group-2"},V.default.createElement("circle",{id:"Oval",fill:pe.errorColor,cx:"6",cy:"6",r:"6"}),V.default.createElement("text",{id:"!",fontFamily:"Roboto-Bold, Roboto",fontSize:"9",fontWeight:"bold",fill:pe.backgroundColor},V.default.createElement("tspan",{x:"4.80000019",y:"9"},"!")))),V.default.createElement("g",{id:"alert",transform:"translate(62.000000, 0.000000)"},V.default.createElement("g",{id:"Group-2"},V.default.createElement("circle",{id:"Oval",fill:pe.errorColor,cx:"6",cy:"6",r:"6"}),V.default.createElement("text",{id:"!",fontFamily:"Roboto-Bold, Roboto",fontSize:"9",fontWeight:"bold",fill:pe.backgroundColor},V.default.createElement("tspan",{x:"4.80000019",y:"9"},"!"))))),V.default.createElement("g",{id:"good",transform:"translate(129.000000, 27.000000)"},V.default.createElement("g",null,V.default.createElement("circle",{id:"Oval",fill:pe.successColor,cx:"6",cy:"6",r:"6"}),V.default.createElement("polyline",{id:"Line",stroke:pe.backgroundColor,strokeWidth:"1.5",strokeLinecap:"square",points:"3.5 6.5 5.5 8.5 8.15163777 4.30905335"})))),V.default.createElement("path",{d:"M156,12 L166,12",id:"Line",stroke:pe.infoColor,strokeWidth:"1.5",strokeLinecap:"square"}),V.default.createElement("path",{d:"M156,29 L166,29",id:"Line-Copy-2",stroke:pe.backgroundColor,strokeWidth:"1.5",strokeLinecap:"square"}),V.default.createElement("text",{id:"Anomalous-entity",fontFamily:"Roboto-Regular, Roboto",fontSize:"11",fontWeight:"normal",fill:pe.backgroundColor},V.default.createElement("tspan",{x:"170",y:"16"},(0,te.gettext)("Anomalous entity"))),V.default.createElement("text",{id:"Non-anomalous-entity",fontFamily:"Roboto-Regular, Roboto",fontSize:"11",fontWeight:"normal",fill:pe.backgroundColor},V.default.createElement("tspan",{x:"170",y:"33"},(0,te.gettext)("Non-anomalous entities"))))))),V.default.createElement("div",{className:"kpi-ad-tooltip-description","data-test-itsi":"kpi-ad-cohesive-tooltip-description"},V.default.createElement("span",null,(0,te.gettext)("Entity Cohesion Anomaly Detection compares the behavior of each entity contributing to the KPI value. If any entity diverges from the common behavior, an anomaly is flagged.")))),Me=V.default.createElement(V.default.Fragment,null,V.default.createElement("svg",{width:"285px",height:"76px",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","data-test-itsi":"kpi-ad-trending-tooltip"},V.default.createElement("title",null,"trending-image"),V.default.createElement("desc",null,"Created with Sketch."),V.default.createElement("defs",null),V.default.createElement("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},V.default.createElement("g",{id:"trending-image-tooltip",transform:"translate(-17.000000, -7.000000)"},V.default.createElement("g",{id:"trending-image",transform:"translate(5.000000, 0.000000)"},V.default.createElement("g",{id:"image"},V.default.createElement("path",{d:"M79.5,53.5 L79.5,64.5",id:"Line",stroke:pe.backgroundColor,strokeLinecap:"square",strokeDasharray:"2"}),V.default.createElement("path",{d:"M113.5,14.5 L113.5,49.5570946",id:"Line",stroke:pe.backgroundColor,strokeLinecap:"square",strokeDasharray:"2"}),V.default.createElement("path",{d:"M145.5,19.5 L146.5,63.5570946",id:"Line-Copy-5",stroke:pe.backgroundColor,strokeLinecap:"square",strokeDasharray:"2"}),V.default.createElement("polyline",{id:"Line",stroke:pe.backgroundColor,strokeWidth:"1.5",strokeLinecap:"square",strokeDasharray:"3",points:"13.5 69.5 47.3138313 60.5268731 80.1353536 67.2911773 112.990545 51.5883283 145.812066 66.5664304 179.150422 59.0773793 212.522449 67.2911773 245.211442 67.2087461"}),V.default.createElement("polyline",{id:"Line-Copy",stroke:pe.infoColor,strokeWidth:"1.5",strokeLinecap:"square",points:"13.5 66.5 47.3138313 63.5268731 80.1353536 51.2911773 112.990545 12.5883283 145.812066 15.5664304 179.150422 61.0773793 212.522449 64.2911773 244.885398 61.6660027"}),V.default.createElement("g",{id:"alert",transform:"translate(107.000000, 7.000000)"},V.default.createElement("g",{id:"Group-2"},V.default.createElement("circle",{id:"Oval",fill:pe.errorColor,cx:"6",cy:"6",r:"6"}),V.default.createElement("text",{id:"!",fontFamily:"Roboto-Bold, Roboto",fontSize:"9",fontWeight:"bold",fill:pe.backgroundColor},V.default.createElement("tspan",{x:"4.80000019",y:"9"},"!")))),V.default.createElement("g",{id:"good",transform:"translate(73.000000, 44.000000)"},V.default.createElement("g",null,V.default.createElement("circle",{id:"Oval",fill:pe.successColor,cx:"6",cy:"6",r:"6"}),V.default.createElement("polyline",{id:"Line",stroke:pe.backgroundColor,strokeWidth:"1.5",strokeLinecap:"square",points:"3.5 6.5 5.5 8.5 8.15163777 4.30905335"}))),V.default.createElement("g",{id:"alert",transform:"translate(140.000000, 9.000000)"},V.default.createElement("g",{id:"Group-2"},V.default.createElement("circle",{id:"Oval",fill:pe.errorColor,cx:"6",cy:"6",r:"6"}),V.default.createElement("text",{id:"!",fontFamily:"Roboto-Bold, Roboto",fontSize:"9",fontWeight:"bold",fill:pe.backgroundColor},V.default.createElement("tspan",{x:"4.80000019",y:"9"},"!"))))),V.default.createElement("path",{d:"M216,16 L225,16",id:"Line",stroke:pe.infoColor,strokeWidth:"1.5",strokeLinecap:"square"}),V.default.createElement("path",{d:"M216,33 L226,33",id:"Line-Copy-2",stroke:pe.backgroundColor,strokeWidth:"1.5",strokeLinecap:"square",strokeDasharray:"3"}),V.default.createElement("text",{id:"KPI-Value",fontFamily:"Roboto-Regular, Roboto",fontSize:"11",fontWeight:"normal",fill:pe.backgroundColor},V.default.createElement("tspan",{x:"230",y:"20"},(0,te.gettext)("KPI Value"))),V.default.createElement("text",{id:"KPI-Trend",fontFamily:"Roboto-Regular, Roboto",fontSize:"11",fontWeight:"normal",fill:pe.backgroundColor},V.default.createElement("tspan",{x:"230",y:"37"},(0,te.gettext)("KPI Trend"))))))),V.default.createElement("div",{className:"kpi-ad-tooltip-description","data-test-itsi":"kpi-ad-trending-tooltip-description"},V.default.createElement("span",null,(0,te.gettext)("Trending Anomaly Detection compares the aggregated value of the KPI to its historical trend. If the value diverges from the trend too much, an anomaly is flagged.")))),Oe=function renderControlGroup(s,o,_,S,R){s.length>0&&(j.default.unmountComponentAtNode(s.get(0)),j.default.render(V.default.createElement(ue.default,null,V.default.createElement($.default,{"data-test-itsi":o,label:_,labelWidth:re.LABEL_WIDTHS.Massive},V.default.createElement(X.default,{"data-test-itsi":S},R))),s.get(0)))},Ae=N.default.View.extend({tagName:"div",className:"kpi-anomaly-content-panel",currPageLabelWidth:re.LABEL_WIDTHS.ExtraLong,initialize:function initialize(s){if(s=s||{},this.isReadOnly=s.isReadOnly||!1,!s.kpiModel)throw"Must provide kpiModel";if(this.model=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.serviceModel=s.serviceModel,this.isTabView=s.isTabView||!1,this._trendingAnomaliesExpected=.1,this._cohesiveAnomaliesExpected=.1,this._cohesiveKpiEntityMinLimit=4,this._analysisNew=!0,this._analysisModel=new N.default.Model({earliestTime:"-7d",latestTime:"now",trending:!1,cohesive:!1}),this._trendingResultsModel=new N.default.Model({freshAnalysis:!0,fractionAnomaliesDetected:0,analysisTimeWindow:""}),this._cohesiveResultsModel=new N.default.Model({freshAnalysis:!0,entitiesAnalyzed:0,entitiesWithAnomalies:0,averageAnomaliesPerEntity:0,fractionAnomaliesDetected:0,analysisTimeWindow:""}),this.listenTo(this._analysisModel,"change:trending change:cohesive",this._checkOverallAnalysisStatus),N.default.View.prototype.initialize(this,arguments),this.children||(this.children={}),this.children.analyzeButton=new ce.default({appearance:"primary",dataTestItsi:"analyze-kpi-data-button",label:(0,te.gettext)("Analyze KPI Data"),onClick:this.onAnalyze.bind(this)});var o=(0,te.gettext)("Run KPI Analysis to get recommendation");this.children.trendingMessageView=new he.default({content:o,dataTestItsi:"kpi-anomaly-panel-trending-info-message",style:{marginBottom:0},type:"info"}),this.children.cohesiveMessageView=new he.default({content:this.model.get("is_entity_breakdown")?o:(0,te.gettext)("Enable split by entities from Search and Calculate section and Save the KPI, in order to be able to enable Cohesive Anomaly Detection."),dataTestItsi:"kpi-anomaly-panel-cohesive-info-message",style:{marginBottom:0},type:this.model.get("is_entity_breakdown")?"info":"error"})},onAnalyze:function onAnalyze(){this._analysisNew?this._toggleAnalysisResults("processing"):this._toggleAnalysisResults("redo")},_checkOverallAnalysisStatus:function _checkOverallAnalysisStatus(){this._analysisModel.get("trending")&&this._analysisModel.get("cohesive")&&this._enableAnalysisButton()},_enableAnalysisButton:function _enableAnalysisButton(){var s;null===(s=this.children)||void 0===s||s.analyzeButton.enable()},_disableAnalysisButton:function _disableAnalysisButton(){var s;null===(s=this.children)||void 0===s||s.analyzeButton.disable()},_toggleAnalysisResults:function _toggleAnalysisResults(s){if(!(0,U.default)(s)&&s){var o=(0,te.gettext)("Analyzing KPI..."),_=(0,te.gettext)("Analyzing KPI. Depending on the number of entities, this might take a few minutes...");if("processing"!==s&&"redo"!==s)throw"Invalid mode passed in while toggling the analysis process";if(this._disableAnalysisButton(),"processing"===s){this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-start").toggle(),this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-processing").toggle();var S=this.$(".kpi-anomaly-panel-trending-analysis-config-result-processing");if(j.default.unmountComponentAtNode(S.get(0)),j.default.render(V.default.createElement(ue.default,null,V.default.createElement(Te,{"data-test-itsi":"trending-wait-spinner"}),o),S.get(0)),this.model.get("is_entity_breakdown")){this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-start").toggle(),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-processing").toggle();var R=this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-processing");j.default.unmountComponentAtNode(R.get(0)),j.default.render(V.default.createElement(ue.default,null,V.default.createElement(Te,{"data-test-itsi":"cohesive-wait-spinner"}),_),R.get(0))}this._analysisNew=!1}else if("redo"===s){this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-start").hide(),this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-end").hide(),this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-processing *").show();var O=this.$(".kpi-anomaly-panel-trending-analysis-config-result-processing");if(j.default.unmountComponentAtNode(O.get(0)),j.default.render(V.default.createElement(ue.default,null,V.default.createElement(Te,{"data-test-itsi":"trending-wait-spinner"}),o),O.get(0)),this.model.get("is_entity_breakdown")){this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-start").hide(),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-end").hide(),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-processing *").show();var P=this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-processing");j.default.unmountComponentAtNode(P.get(0)),j.default.render(V.default.createElement(ue.default,null,V.default.createElement(Te,{"data-test-itsi":"cohesive-wait-spinner"}),_),P.get(0))}this._disposeAll(),(0,oe.safeRemoveView)(this,this._trendingAnalysisBreakdownViewPanel),(0,oe.safeRemoveView)(this,this._cohesiveAnalysisBreakdownViewPanel),this._analysisModel.set({trending:!1,cohesive:!1})}this._dispatchKpiAnomalyDetectionSearches()}},_findSearchAnalysisTimeWindow:function _findSearchAnalysisTimeWindow(s){return le.ALGORITHM_TIME_PERIOD_SELECT_LIST.filter((function(o){return o.value===s}))[0].label},_dispatchKpiAnomalyDetectionSearches:function _dispatchKpiAnomalyDetectionSearches(){var s=this.model.id,o=this._analysisModel.get("earliestTime");this._trendingAnomalyDetectionSearchJobSid=null,(0,se.cleanSearchJobSubscriptions)(this._trendingAnomalyDetectionSearchJob,this._trendingAnomalyDetectionSearchSubscription),this._trendingAnomalyDetectionSearchJob=ee.default.create({id:(0,se.createUniqueSearchId)("trending-ad-analysis"),earliest_time:o,latest_time:"now",cache:600,status_buckets:500,sample_ratio:null,search:"`get_itsi_summary_index` itsi_kpi_id=".concat(s," ")+"indexed_is_service_aggregate::1 indexed_is_service_max_severity_event::0 | fields - _raw | table alert_value, itsi_kpi_id,_time",time_format:"%s.%Q",auto_cancel:300},{app:(0,ne.getShortAppName)(!0)}),this._trendingAnomalyDetectionSearchSidSubscription=this._trendingAnomalyDetectionSearchJob.getSid().subscribe(s=>{this._trendingAnomalyDetectionSearchJobSid=s}),this._trendingAnomalyDetectionSearchSubscription=this._trendingAnomalyDetectionSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{var o;this._checkTrendingDataSufficiency(null==s||null===(o=s.results)||void 0===o?void 0:o.length)},error:()=>{this._showSearchJobErrorMessageForAnalysis(ae.MAD_ALGORITHM_TYPES.TRENDING)}}),this.model.get("is_entity_breakdown")?(this._cohesiveAnomalyDetectionSearchJobSid=null,(0,se.cleanSearchJobSubscriptions)(this._cohesiveAnomalyDetectionSearchJob,this._cohesiveAnomalyDetectionSearchSubscription),this._cohesiveAnomalyDetectionSearchJob=ee.default.create({id:(0,se.createUniqueSearchId)("cohesive-ad-analysis"),earliest_time:o,latest_time:"now",cache:600,status_buckets:500,sample_ratio:null,search:"`get_itsi_summary_index` itsi_kpi_id=".concat(s," ")+'indexed_is_service_aggregate::0 indexed_is_service_max_severity_event::0 | `escape_entity_key` | eval entity_id=if(entity_key=="N/A", entity_title, entity_key) | fields - _raw | table alert_value, itsi_kpi_id, _time, entity_id',time_format:"%s.%Q",auto_cancel:300},{app:(0,ne.getShortAppName)(!0)}),this._cohesiveAnomalyDetectionSearchSidSubscription=this._cohesiveAnomalyDetectionSearchJob.getSid().subscribe(s=>{this._cohesiveAnomalyDetectionSearchJobSid=s}),this._cohesiveAnomalyDetectionSearchSubscription=this._cohesiveAnomalyDetectionSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{var o;this._checkCohesiveDataSufficiency(null==s||null===(o=s.results)||void 0===o?void 0:o.length)},error:()=>{this._showSearchJobErrorMessageForAnalysis(ae.MAD_ALGORITHM_TYPES.COHESIVE)}})):this._analysisModel.set({cohesive:!0})},_checkTrendingDataSufficiency:function _checkTrendingDataSufficiency(s){s<1440/this.model.get("alert_period")?this._showTrendingInsufficientData(ke.INSUFFICIENT_DATA,(0,te.gettext)("At least 24 hours of service data is required. Enable backfill for the KPI or try again in a day.")):this._runTrendingLoadJobSearchJob()},_checkCohesiveDataSufficiency:function _checkCohesiveDataSufficiency(s){var o=1440/this.model.get("alert_period"),_=this._analysisModel.get("earliestTime"),S=(0,te.gettext)("At least 24 hours of service data is required. Enable backfill for the KPI or try again in a day.");s&&s>0?((0,se.cleanSearchJobSubscriptions)(this._cohesiveEntityCountLoadJobSearchJob,this._cohesiveEntityCountLoadJobSearchSubscription),this._cohesiveEntityCountLoadJobSearchJob=ee.default.create({id:(0,se.createUniqueSearchId)("cohesive-ad-entity-count"),earliest_time:_,latest_time:"now",cache:600,status_buckets:0,sample_ratio:null,search:"| loadjob ".concat(this._cohesiveAnomalyDetectionSearchJobSid," | stats count by entity_id | sort - count"),time_format:"%s.%Q",auto_cancel:90},{app:(0,ne.getShortAppName)(!0)}),this._cohesiveEntityCountLoadJobSearchSubscription=this._cohesiveEntityCountLoadJobSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{var _;if(this._cohesiveResultsModel.set("entitiesAnalyzed",null==s||null===(_=s.results)||void 0===_?void 0:_.length),this._checkCohesiveKpiEntityMinLimit()){var R=[];if(s.results.length===this._cohesiveResultsModel.get("entitiesAnalyzed")){R=s.results.slice(0,this._cohesiveKpiEntityMinLimit);var O=!1;(0,W.default)(R,s=>{parseInt(s.count,10)<o&&(O=!0)}),O?this._showCohesiveInsufficientData(ke.INSUFFICIENT_DATA,S):this._checkCohesiveKpiEntityLimit()}else this._showCohesiveInsufficientData(ke.COHESIVE_NOT_MIN_ENTITIES,(0,ie.sprintf)((0,te.gettext)("Minimum entities required is %s, but found %s."),this._cohesiveKpiEntityMinLimit,this._cohesiveResultsModel.get("entitiesAnalyzed")))}},error:()=>{this._showSearchJobErrorMessageForAnalysis(ae.MAD_ALGORITHM_TYPES.COHESIVE)}})):this._showCohesiveInsufficientData(ke.INSUFFICIENT_DATA,S)},_checkCohesiveKpiEntityMinLimit:function _checkCohesiveKpiEntityMinLimit(){return!(this._cohesiveResultsModel.get("entitiesAnalyzed")<this._cohesiveKpiEntityMinLimit)||(this._showCohesiveInsufficientData(ke.COHESIVE_NOT_MIN_ENTITIES,(0,ie.sprintf)((0,te.gettext)("Minimum entities required is %s, but found %s."),this._cohesiveKpiEntityMinLimit,this._cohesiveResultsModel.get("entitiesAnalyzed"))),!1)},_showCohesiveInsufficientData:function _showCohesiveInsufficientData(s,o){this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-processing",this.$el).hide(),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-start",this.$el).empty().show(),this.children.cohesiveMessageView=new he.default({content:V.default.createElement("div",null,s,V.default.createElement(Ce,{"data-test-itsi":"kpi-anomaly-panel-cohesive-analysis-error-tooltip",content:o})),dataTestItsi:"kpi-anomaly-panel-cohesive-error-message",style:{marginBottom:0},type:"error"}),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-start",this.$el).append(this.children.cohesiveMessageView.render().$el),this._analysisModel.set({cohesive:!0})},_showTrendingInsufficientData:function _showTrendingInsufficientData(s,o){this.$(".kpi-anomaly-panel-trending-analysis-config-result-processing",this.$el).hide(),this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-start",this.$el).empty().show(),this.children.trendingMessageView=new he.default({content:V.default.createElement("div",null,s,V.default.createElement(Ce,{"data-test-itsi":"kpi-anomaly-panel-trending-analysis-error-tooltip",content:o})),dataTestItsi:"kpi-anomaly-panel-trending-error-message",style:{marginBottom:0},type:"error"}),this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-start",this.$el).append(this.children.trendingMessageView.render().$el),this._analysisModel.set({trending:!0})},_checkCohesiveKpiEntityLimit:function _checkCohesiveKpiEntityLimit(){var s=this._analysisModel.get("earliestTime");(0,se.cleanSearchJobSubscriptions)(this._cohesiveRestKpiEntityLimitSearchJob,this._cohesiveRestKpiEntityLimitSearchSubscription),this._cohesiveRestKpiEntityLimitSearchJob=ee.default.create({id:(0,se.createUniqueSearchId)("cohesive-ad-kpi-entity-limit"),earliest_time:s,latest_time:"now",cache:600,status_buckets:500,sample_ratio:null,search:"| rest servicesNS/nobody/SA-ITSI-MetricAD/configs/conf-mad/cohesive splunk_server=local | fields metrics_maximum",time_format:"%s.%Q",auto_cancel:90},{app:(0,ne.getShortAppName)(!0)}),this._cohesiveRestKpiEntityLimitSearchSubscription=this._cohesiveRestKpiEntityLimitSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{var o;if(0===(null==s||null===(o=s.results)||void 0===o?void 0:o.length))this._showCohesiveInsufficientData(ke.NO_RECOMMENDATION,(0,te.gettext)("The per KPI entity count limit for anomaly detection is not set in mad.conf."));else{var _=parseInt(s.results[0].metrics_maximum,10);_?this._cohesiveKpiEntityMinLimit<=this._cohesiveResultsModel.get("entitiesAnalyzed")&&this._cohesiveResultsModel.get("entitiesAnalyzed")<=_?this._runCohesiveLoadJobSearchJob():this._showCohesiveInsufficientData(ke.COHESIVE_NOT_MAX_ENTITIES,(0,ie.sprintf)((0,te.gettext)("Cohesive analysis can be done with maximum %s entities, but found %s."),_,this._cohesiveResultsModel.get("entitiesAnalyzed"))):this._showCohesiveInsufficientData(ke.NO_RECOMMENDATION,(0,te.gettext)("The per KPI entity count limit for anomaly detection is not set in mad.conf."))}},error:()=>{this._showSearchJobErrorMessageForAnalysis(ae.MAD_ALGORITHM_TYPES.COHESIVE)}})},_showSearchJobErrorMessageForAnalysis:function _showSearchJobErrorMessageForAnalysis(s){var o=(0,te.gettext)("One or more Splunk searches ran to perform the analysis timed out, or was cancelled, or failed with error(s).");if(s)switch(s){case ae.MAD_ALGORITHM_TYPES.COHESIVE:this._showCohesiveInsufficientData(ke.NO_RECOMMENDATION,o);break;case ae.MAD_ALGORITHM_TYPES.TRENDING:this._showTrendingInsufficientData(ke.NO_RECOMMENDATION,o);break;default:var _=(0,te.gettext)("There is not enough data to make the recommendation at this time.");this._showCohesiveInsufficientData(ke.INSUFFICIENT_DATA,_),this._showTrendingInsufficientData(ke.INSUFFICIENT_DATA,_)}},_renderTrendingSummary:function _renderTrendingSummary(){this._trendingAnomalyDetectionLoadjobPostProcessSearchSubscription=this._trendingAnomalyDetectionLoadjobSearchJob.getResults({search:"where sensitivity_".concat(this._trendingAdSettingsModel.get("sensitivity"),"=1"),offset:0,count:0}).subscribe({next:s=>{this._trendingAlertTrueResultCount=s.results.length,this._checkRecommendation(ae.MAD_ALGORITHM_TYPES.TRENDING);var o=this._findSearchAnalysisTimeWindow(this._analysisModel.get("earliestTime"));this._trendingResultsModel.set({fractionAnomaliesDetected:this._trendingAlertTrueResultCount/this._trendingAlertTotalResultCount,analysisTimeWindow:o}),!0===this._trendingResultsModel.get("freshAnalysis")&&this._renderAnalysisBreakdown(ae.MAD_ALGORITHM_TYPES.TRENDING),this._analysisModel.set({trending:!0})},error:()=>{this._showSearchJobErrorMessageForAnalysis(ae.MAD_ALGORITHM_TYPES.TRENDING)}})},_runTrendingLoadJobSearchJob:function _runTrendingLoadJobSearchJob(){var s=this.model.get("alert_period"),o=this.model.id,_=this._analysisModel.get("earliestTime");(0,se.cleanSearchJobSubscriptions)(this._trendingAnomalyDetectionLoadjobSearchJob,this._trendingAnomalyDetectionLoadjobSearchSubscription),this._trendingAnomalyDetectionLoadjobSearchJob=ee.default.create({id:(0,se.createUniqueSearchId)("trending-ad-mad-analysis"),earliest_time:_,latest_time:"now",cache:600,status_buckets:0,sample_ratio:null,search:"| loadjob ".concat(this._trendingAnomalyDetectionSearchJobSid," | reverse | mad trending alert_value span=")+s+"m itsi_kpi_id="+o+' | naccum algorithm=trending | foreach sensitivity_* [eval <<FIELD>>=if (<<FIELD>>=="true", 1, 0)]',time_format:"%s.%Q",auto_cancel:300},{app:(0,ne.getShortAppName)(!0)}),this._trendingAnomalyDetectionLoadjobSearchSubscription=this._trendingAnomalyDetectionLoadjobSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{var o;this._trendingAlertTotalResultCount=null==s||null===(o=s.results)||void 0===o?void 0:o.length,this._trendingResultsModel.set("freshAnalysis",!0),this._renderTrendingSummary(),this.listenTo(this._trendingAdSettingsModel,"change:sensitivity",()=>{this._trendingResultsModel.set("freshAnalysis",!1),this._renderTrendingSummary()})},error:()=>{this._showSearchJobErrorMessageForAnalysis(ae.MAD_ALGORITHM_TYPES.TRENDING)}})},_renderCohesiveSummary:function _renderCohesiveSummary(){(0,se.cleanSearchJobSubscriptions)(this._cohesiveAnomalyDetectionLoadjobPostProcessSearchJob,this._cohesiveAnomalyDetectionLoadjobPostProcessSearchSubscription),this._cohesiveAnomalyDetectionLoadjobPostProcessSearchJob=ee.default.create({id:(0,se.createUniqueSearchId)("cohesive-ad-mad-analysis-alert"),earliest_time:this._analysisModel.get("earliestTime"),latest_time:"now",cache:600,status_buckets:0,sample_ratio:null,search:"| loadjob ".concat(this._cohesiveAnomalyDetectionLoadjobSearchJobSid)+" | where sensitivity_"+this._cohesiveAdSettingsModel.get("sensitivity")+"=1 | stats count by entity_id",time_format:"%s.%Q",auto_cancel:90},{app:(0,ne.getShortAppName)(!0)}),this._cohesiveAnomalyDetectionLoadjobPostProcessSearchSubscription=this._cohesiveAnomalyDetectionLoadjobPostProcessSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{var o;this._cohesiveResultsModel.set("entitiesWithAnomalies",null==s||null===(o=s.results)||void 0===o?void 0:o.length);var _={};if(s.results&&(_.rows=s.results.map(s=>Object.values(s))),0===this._cohesiveResultsModel.get("entitiesWithAnomalies")){this._cohesiveAlertTrueResultCount=0,this._cohesiveResultsModel.set("averageAnomaliesPerEntity",0),this._checkRecommendation(ae.MAD_ALGORITHM_TYPES.COHESIVE);var S=this._findSearchAnalysisTimeWindow(this._analysisModel.get("earliestTime"));this._cohesiveResultsModel.set({fractionAnomaliesDetected:this._cohesiveAlertTrueResultCount/this._cohesiveAlertTotalResultCount,analysisTimeWindow:S}),!0===this._cohesiveResultsModel.get("freshAnalysis")&&this._renderAnalysisBreakdown(ae.MAD_ALGORITHM_TYPES.COHESIVE),this._analysisModel.set({cohesive:!0})}else{if(this._cohesiveAlertTrueResultCount=0,_.rows&&_.rows.length>0){(0,W.default)(s.results,function(s){this._cohesiveAlertTrueResultCount+=parseInt(s.count)}.bind(this));var R=this._cohesiveResultsModel.get("averageAnomaliesPerEntity");this._cohesiveResultsModel.set("averageAnomaliesPerEntity",R/_.rows.length)}this._checkRecommendation(ae.MAD_ALGORITHM_TYPES.COHESIVE),S=this._findSearchAnalysisTimeWindow(this._analysisModel.get("earliestTime")),this._cohesiveResultsModel.set({fractionAnomaliesDetected:this._cohesiveAlertTrueResultCount/this._cohesiveAlertTotalResultCount,analysisTimeWindow:S}),!0===this._cohesiveResultsModel.get("freshAnalysis")&&this._renderAnalysisBreakdown(ae.MAD_ALGORITHM_TYPES.COHESIVE),this._analysisModel.set({cohesive:!0})}},error:()=>{this._showSearchJobErrorMessageForAnalysis(ae.MAD_ALGORITHM_TYPES.COHESIVE)}})},_runCohesiveLoadJobSearchJob:function _runCohesiveLoadJobSearchJob(){var s=this.model.get("alert_period"),o=this.model.id,_=this._analysisModel.get("earliestTime");this._cohesiveAnomalyDetectionLoadjobSearchJobSid=null,(0,se.cleanSearchJobSubscriptions)(this._cohesiveAnomalyDetectionLoadjobSearchJob,this._cohesiveAnomalyDetectionLoadjobSearchSubscription,this._cohesiveAnomalyDetectionLoadjobSearchSidSubscription),this._cohesiveAnomalyDetectionLoadjobSearchJob=ee.default.create({id:(0,se.createUniqueSearchId)("cohesive-ad-mad-analysis"),earliest_time:_,latest_time:"now",cache:600,status_buckets:0,sample_ratio:null,search:"| loadjob ".concat(this._cohesiveAnomalyDetectionSearchJobSid," | reverse ")+"| mad cohesive alert_value group_by=entity_id span="+s+"m itsi_kpi_id="+o+' | naccum algorithm=cohesive group_by=entity_id | foreach sensitivity_* [eval <<FIELD>>=if (<<FIELD>>=="true", 1, 0)]',time_format:"%s.%Q",auto_cancel:300},{app:(0,ne.getShortAppName)(!0)}),this._cohesiveAnomalyDetectionLoadjobSearchSidSubscription=this._cohesiveAnomalyDetectionLoadjobSearchJob.getSid().subscribe(s=>{this._cohesiveAnomalyDetectionLoadjobSearchJobSid=s}),this._cohesiveAnomalyDetectionLoadjobSearchSubscription=this._cohesiveAnomalyDetectionLoadjobSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{var o;this._cohesiveAlertTotalResultCount=null==s||null===(o=s.results)||void 0===o?void 0:o.length,this._cohesiveResultsModel.set("freshAnalysis",!0),this._renderCohesiveSummary(),this.listenTo(this._cohesiveAdSettingsModel,"change:sensitivity",()=>{this._cohesiveResultsModel.set("freshAnalysis",!1),this._renderCohesiveSummary()})},error:()=>{this._showSearchJobErrorMessageForAnalysis(ae.MAD_ALGORITHM_TYPES.COHESIVE)}})},_disposeAll:function _disposeAll(){this.disposeAllTrendingSearchJobs(),this.disposeAllCohesiveSearchJobs()},disposeAllTrendingSearchJobs:function disposeAllTrendingSearchJobs(){(0,se.cleanSearchJobSubscriptions)(this._trendingAnomalyDetectionLoadjobSearchJob,this._trendingAnomalyDetectionLoadjobSearchSubscription,this._trendingAnomalyDetectionLoadjobPostProcessSearchSubscription),(0,se.cleanSearchJobSubscriptions)(this._trendingAnomalyDetectionSearchJob,this._trendingAnomalyDetectionSearchSubscription,null,null,this._trendingAnomalyDetectionSearchSidSubscription)},disposeAllCohesiveSearchJobs:function disposeAllCohesiveSearchJobs(){(0,se.cleanSearchJobSubscriptions)(this._cohesiveAnomalyDetectionLoadjobPostProcessSearchJob,this._cohesiveAnomalyDetectionLoadjobPostProcessSearchSubscription),(0,se.cleanSearchJobSubscriptions)(this._cohesiveAnomalyDetectionLoadjobSearchJob,this._cohesiveAnomalyDetectionLoadjobSearchSubscription,null,null,this._cohesiveAnomalyDetectionLoadjobSearchSidSubscription),(0,se.cleanSearchJobSubscriptions)(this._cohesiveRestKpiEntityLimitSearchJob,this._cohesiveRestKpiEntityLimitSearchSubscription),(0,se.cleanSearchJobSubscriptions)(this._cohesiveEntityCountLoadJobSearchJob,this._cohesiveEntityCountLoadJobSearchSubscription,null,null,this._cohesiveAnomalyDetectionSearchSidSubscription),(0,se.cleanSearchJobSubscriptions)(this._cohesiveAnomalyDetectionSearchJob,this._cohesiveAnomalyDetectionSearchSubscription)},_checkRecommendation:function _checkRecommendation(s){if(!((0,U.default)(s)||s!==ae.MAD_ALGORITHM_TYPES.TRENDING&&s!==ae.MAD_ALGORITHM_TYPES.COHESIVE)){var o,_,S=(0,te.gettext)("Check the Analysis Breakdown for more information."),R=!0,O=!0;switch(s){case ae.MAD_ALGORITHM_TYPES.TRENDING:if(!(0,Y.default)(this._trendingAlertTotalResultCount)||!(0,Y.default)(this._trendingAlertTrueResultCount))return;this.$(".kpi-anomaly-panel-trending-analysis-config-result-processing",this.$el).hide(),this._trendingAlertTrueResultCount/this._trendingAlertTotalResultCount<this._trendingAnomaliesExpected?_=(0,te.gettext)("Recommended"):(R=!1,_=(0,te.gettext)("Not Recommended")),this.$(".kpi-anomaly-panel-trending-analysis-config-result-end",this.$el).empty(),this.children.trendingMessageView=new he.default({content:V.default.createElement("div",null,_,V.default.createElement(Ce,{"data-test-itsi":R?"kpi-anomaly-panel-trending-result-recommended-tooltip":"kpi-anomaly-panel-trending-result-not-recommended-tooltip",content:S})),dataTestItsi:"kpi-anomaly-panel-trending-error-message",style:{marginBottom:0},type:R?"success":"error"}),this.$(".kpi-anomaly-panel-trending-analysis-config-result-end",this.$el).append(this.children.trendingMessageView.render().el),this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-end",this.$el).show();break;case ae.MAD_ALGORITHM_TYPES.COHESIVE:if(!(0,Y.default)(this._cohesiveAlertTotalResultCount)||!(0,Y.default)(this._cohesiveAlertTrueResultCount))return;this._cohesiveAlertTrueResultCount/this._cohesiveAlertTotalResultCount<this._cohesiveAnomaliesExpected?o=(0,te.gettext)("Recommended"):(O=!1,o=(0,te.gettext)("Not Recommended")),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-processing",this.$el).hide(),this.children.cohesiveMessageView=new he.default({content:V.default.createElement("div",null,o,V.default.createElement(Ce,{"data-test-itsi":R?"kpi-anomaly-panel-cohesive-result-recommended-tooltip":"kpi-anomaly-panel-cohesive-result-not-recommended-tooltip",content:S})),dataTestItsi:"kpi-anomaly-panel-trending-error-message",style:{marginBottom:0},type:O?"success":"error"}),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-end",this.$el).empty(),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-end",this.$el).append(this.children.cohesiveMessageView.render().el),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-end",this.$el).show();break;default:console.log("Unknown AD algorithm!")}}},render:function render(){var s;(this.$el.html(xe),this.$(".kpi-anomaly-panel-explanation-container").text((0,te.gettext)("ITSI Anomaly Detection learns the normal patterns of KPIs continuously in real-time, triggering a notable event when a KPI departs from its expected behavior. Certain types of data are not suitable for use with anomaly detection because they produce too many false positives. We recommend that you analyze the KPI data first to check its compatibility with ITSI's anomaly detection algorithms.")),this.isTabView&&this.$(".kpi-anomaly-panel-explanation-container").prepend('<h2 class="anomaly-detection-container-title">'.concat((0,te.gettext)("Anomaly detection"),"</h2>")),this.isReadOnly)?(this.$(".kpi-anomaly-panel-analysis-container-read-only").append('<div class="anomaly-detection-container"></div><div class="trending-algorithm-container"></div><div class="cohesion-anomaly-container"></div><div class="cohesion-algorithm-container"></div>'),Oe(this.$(".anomaly-detection-container"),"anomaly-detection-control-group",(0,te.gettext)("Enable Trending Anomaly Detection"),"anomaly-detection-value",this.model.get("anomaly_detection_is_enabled")?(0,te.gettext)("Yes"):(0,te.gettext)("No")),Oe(this.$(".trending-algorithm-container"),"algorithm-sensitivity-control-group",(0,te.gettext)("Trending Algorithm Sensitivity"),"algorithm-sensitivity-value",this.model.get("trending_ad").get("sensitivity")),Oe(this.$(".cohesion-anomaly-container"),"cohesion-anomaly-control-group",(0,te.gettext)("Enable Entity Cohesion Anomaly Detection"),"cohesion-anomaly-value",this.model.get("cohesive_anomaly_detection_is_enabled")?(0,te.gettext)("Yes"):(0,te.gettext)("No")),Oe(this.$(".cohesion-algorithm-container"),"cohesion-anomaly-sensitivity-control-group",(0,te.gettext)("Entity Cohesion Algorithm Sensitivity"),"cohesion-anomaly-sensitivity-value",this.model.get("cohesive_ad").get("sensitivity")),this.$(".kpi-anomaly-panel-analysis-container").remove()):((0,oe.safeRemoveView)(this,this.analysisTimeWindow),this.analysisTimeWindow=new de.default({controlType:"SyntheticSelect",controlOptions:{dataTestItsi:"kpi-anomaly-earliest-select",items:le.ALGORITHM_TIME_PERIOD_SELECT_LIST,model:this._analysisModel,modelAttribute:"earliestTime"},dataTestItsi:"kpi-anomaly-earliest-control-group",inline:!0,label:(0,te.gettext)("Analysis Time Window"),labelWidth:this.currPageLabelWidth}),(0,oe.safeRemoveView)(this,this.trendingAnalysisHeading),this.trendingAnalysisHeading=new ye.default({dataTestItsi:"trending-anomaly-detection-text-label",label:(0,te.gettext)("Trending Anomaly Detection"),tooltip:Me}),(0,oe.safeRemoveView)(this,this.cohesiveAnalysisHeading),this.cohesiveAnalysisHeading=new ye.default({dataTestItsi:"cohesion-anomaly-detection-text-label",label:(0,te.gettext)("Entity Cohesion Anomaly Detection"),tooltip:Ie}),(0,oe.safeRemoveView)(this,this.trendingAnalysisConfig),this.trendingAnalysisConfig=new de.default({controlType:"SyntheticRadio",controlOptions:{dataTestItsi:"anomaly-detection-status-radio",items:[{label:(0,te.gettext)("Yes"),value:!0},{label:(0,te.gettext)("No"),value:!1}],model:this.model,modelAttribute:"anomaly_detection_is_enabled"},dataTestItsi:"kpi-anomaly-detection-status-control-group",label:(0,te.gettext)("Enable Trending AD Algorithm"),labelWidth:this.currPageLabelWidth}),this._trendingAdSettingsModel=this.model.get("trending_ad"),(0,oe.safeRemoveView)(this,this.trendingSensitivity),this._trendingAdSettingsModel.fetchMadSettings().done(function(){this.trendingSensitivity=new de.default({controlType:"Number",controlOptions:{dataTestItsi:"trending-algorithm-sensitivity-number-control",listenForModelChanges:!0,max:this._trendingAdSettingsModel.get("sensitivity_max")||10,min:this._trendingAdSettingsModel.get("sensitivity_min")||0,model:this._trendingAdSettingsModel,modelAttribute:"sensitivity",placeholder:(0,te.gettext)("required")},dataTestItsi:"trending-algorithm-sensitivity-control-group",label:(0,te.gettext)("Algorithm Sensitivity"),labelWidth:this.currPageLabelWidth,required:!0,tooltip:(0,te.gettext)("Sensitivity to variance in data.")}),(0,oe.safeRemoveView)(this,this.trendingSensitivitySlider),this.trendingSensitivitySlider=new _e.default({dataTestItsi:"trending-sensitivity-slider",max:this._trendingAdSettingsModel.get("sensitivity_max")||10,min:this._trendingAdSettingsModel.get("sensitivity_min")||0,model:this._trendingAdSettingsModel,modelAttribute:"sensitivity",step:1}),this.$(".kpi-anomaly-panel-trending-analysis-config",this.$el).append(this.trendingSensitivity.render().el),this.trendingSensitivity.$el.find('[data-test="controls"]').prepend(this.trendingSensitivitySlider.render().el)}.bind(this)),(0,oe.safeRemoveView)(this,this.cohesiveAnalysisConfig),this.cohesiveAnalysisConfig=new de.default({controlType:"SyntheticRadio",controlOptions:{dataTestItsi:"cohesive-anomaly-detection-status-radio",items:[{label:(0,te.gettext)("Yes"),value:!0},{label:(0,te.gettext)("No"),value:!1}],model:this.model,modelAttribute:"cohesive_anomaly_detection_is_enabled"},dataTestItsi:"cohesive-anomaly-detection-status-control-group",label:(0,te.gettext)("Enable Cohesive AD Algorithm"),labelWidth:this.currPageLabelWidth}),this._cohesiveAdSettingsModel=this.model.get("cohesive_ad"),this._cohesiveAdSettingsModel.fetchMadSettings().done(function(){(0,oe.safeRemoveView)(this,this.cohesiveSensitivity),this.cohesiveSensitivity=new de.default({controlType:"Number",controlOptions:{dataTestItsi:"cohesive-algorithm-sensitivity-number-control",listenForModelChanges:!0,max:this._cohesiveAdSettingsModel.get("sensitivity_max"),min:this._cohesiveAdSettingsModel.get("sensitivity_min")||0,model:this._cohesiveAdSettingsModel,modelAttribute:"sensitivity",placeholder:(0,te.gettext)("required")},dataTestItsi:"cohesive-algorithm-sensitivity-control-group",label:(0,te.gettext)("Algorithm Sensitivity"),labelWidth:this.currPageLabelWidth,required:!0,tooltip:(0,te.gettext)("Sensitivity to variance in data.")}),(0,oe.safeRemoveView)(this,this.cohesiveSensitivitySlider),this.cohesiveSensitivitySlider=new _e.default({dataTestItsi:"cohesive-sensitivity-slider",max:this._cohesiveAdSettingsModel.get("sensitivity_max")||10,min:this._cohesiveAdSettingsModel.get("sensitivity_min")||0,model:this._cohesiveAdSettingsModel,modelAttribute:"sensitivity",step:1}),this.model.get("is_entity_breakdown")&&(this.$(".kpi-anomaly-panel-cohesive-analysis-config",this.$el).append(this.cohesiveSensitivity.render().el),this.cohesiveSensitivity.$el.find('[data-test="controls"]').prepend(this.cohesiveSensitivitySlider.render().el))}.bind(this)),this.$(".kpi-anomaly-panel-analysis-window-config-container",this.$el).append(this.analysisTimeWindow.render().el),this.$(".kpi-anomaly-panel-analysis-window-config-container",this.$el).append(null===(s=this.children)||void 0===s?void 0:s.analyzeButton.render().$el),this.$(".kpi-anomaly-panel-trending-analysis-container",this.$el).prepend(this.trendingAnalysisHeading.render().el),this.$(".kpi-anomaly-panel-trending-analysis-config-result-label",this.$el).text((0,te.gettext)("Algorithm Analysis Result")),this.$(".kpi-anomaly-panel-trending-analysis-config-result-pane-start",this.$el).append(this.children.trendingMessageView.render().$el),this.$(".kpi-anomaly-panel-trending-analysis-config",this.$el).append(this.trendingAnalysisConfig.render().el),this.$(".kpi-anomaly-panel-cohesive-analysis-container",this.$el).prepend(this.cohesiveAnalysisHeading.render().el),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-label",this.$el).text((0,te.gettext)("Algorithm Analysis Result")),this.$(".kpi-anomaly-panel-cohesive-analysis-config-result-pane-start",this.$el).append(this.children.cohesiveMessageView.render().$el),this.model.get("is_entity_breakdown")?this.$(".kpi-anomaly-panel-cohesive-analysis-config",this.$el).append(this.cohesiveAnalysisConfig.render().el):(this.$(".kpi-anomaly-panel-cohesive-analysis-config",this.$el).append(this.cohesiveAnalysisConfig.render().el),this.cohesiveAnalysisConfig.disable()),this.listenTo(this.model,"change:anomaly_detection_is_enabled change:cohesive_anomaly_detection_is_enabled",this._setKpiAnomalyDetectionAlerting),this.$(".kpi-anomaly-panel-analysis-container-read-only").remove());return this},_renderAnalysisBreakdown:function _renderAnalysisBreakdown(s){if(!((0,U.default)(s)||s!==ae.MAD_ALGORITHM_TYPES.TRENDING&&s!==ae.MAD_ALGORITHM_TYPES.COHESIVE))switch(s){case ae.MAD_ALGORITHM_TYPES.TRENDING:this.$(".kpi-anomaly-panel-trending-analysis-preview-container").html(""),this.$(".kpi-anomaly-panel-trending-analysis-preview-container").html(we),(0,oe.safeRemoveView)(this,this._trendingAnalysisBreakdownViewPanel),this._trendingAnalysisBreakdownViewPanel=new ge.default({ContentView:fe.default,contentViewOptions:{searchJob:this._trendingAnomalyDetectionLoadjobSearchJob,el:this.$(".kpi-anomaly-trending-search-preview-chart"),percAnomaliesExpected:this._trendingAnomaliesExpected,algorithmType:s,trendingResultsModel:this._trendingResultsModel,trendingAdSettingsModel:this._trendingAdSettingsModel}}),this.$(".kpi-anomaly-panel-trending-analysis-preview-container").html(this._trendingAnalysisBreakdownViewPanel.render().$el);break;case ae.MAD_ALGORITHM_TYPES.COHESIVE:this.$(".kpi-anomaly-panel-cohesive-analysis-preview-container").html(""),this.$(".kpi-anomaly-panel-cohesive-analysis-preview-container").html(Re),(0,oe.safeRemoveView)(this,this._cohesiveAnalysisBreakdownViewPanel),this._cohesiveAnalysisBreakdownViewPanel=new ve.default({ContentView:me.default,contentViewOptions:{el:this.$(".kpi-anomaly-cohesive-search-preview-chart"),percAnomaliesExpected:this._cohesiveAnomaliesExpected,algorithmType:s,earliestTime:this._analysisModel.get("earliestTime"),parentSearchSid:this._cohesiveAnomalyDetectionLoadjobSearchJobSid,cohesiveResultsModel:this._cohesiveResultsModel,cohesiveAdSettingsModel:this._cohesiveAdSettingsModel}}),this.$(".kpi-anomaly-panel-cohesive-analysis-preview-container").html(this._cohesiveAnalysisBreakdownViewPanel.render().$el);break;default:console.log("Unknown AD algorithm!"),this._analysisModel.set({trending:!0}),this._analysisModel.set({cohesive:!0})}},_setKpiAnomalyDetectionAlerting:function _setKpiAnomalyDetectionAlerting(){this.model.get("anomaly_detection_is_enabled")||this.model.get("cohesive_anomaly_detection_is_enabled")?this.model.set({anomaly_detection_alerting_enabled:!0}):this.model.set({anomaly_detection_alerting_enabled:!1})},remove:function remove(){this._disposeAll(),(0,oe.safeRemoveView)(this,this.analysisTimeWindow),(0,oe.safeRemoveView)(this,this.trendingAnalysisHeading),(0,oe.safeRemoveView)(this,this.cohesiveAnalysisHeading),(0,oe.safeRemoveView)(this,this.trendingAnalysisConfig),(0,oe.safeRemoveView)(this,this.cohesiveAnalysisConfig),(0,oe.safeRemoveView)(this,this.children.cohesiveMessageView),(0,oe.safeRemoveView)(this,this.children.trendingMessageView),(0,oe.safeRemoveView)(this,this.children.analyzeButton),(0,oe.safeRemoveView)(this,this._trendingAnalysisBreakdownViewPanel),(0,oe.safeRemoveView)(this,this._cohesiveAnalysisBreakdownViewPanel),(0,oe.safeRemoveView)(this,this.trendingSensitivitySlider),(0,oe.safeRemoveView)(this,this.trendingSensitivity),(0,oe.safeRemoveView)(this,this.cohesiveSensitivitySlider),(0,oe.safeRemoveView)(this,this.cohesiveSensitivity)}});o.default=Ae;s.exports=o.default},1464:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=_(188),D=O.default.View.extend({initialize:function initialize(s){this.data=s.data,this.time=s.time},hideZeroDots:function hideZeroDots(s){R.default.each(s.series,(function(o){R.default.each(s.series[o].data,(function(){0===this.y&&this.graphic&&this.graphic.hide()}))}))},render:function render(){this.$el.highcharts({title:{text:""},tooltip:{formatter:function formatter(){var s="<b>"+this.x+"</b>";return s+='<br/><span style="color:'+this.series.color+'">●</span>',s+=this.series.name+":"+this.y,-1!==this.series.name.indexOf("Anomaly")?0!==this.y&&s:s}},chart:{events:{redraw:function(){this.hideZeroDots(this.$el.highcharts())}.bind(this)}},xAxis:{categories:this.time,labels:{enabled:!0,align:"left",rotation:45,formatter:function formatter(){return this.value.split(", ")[0]}},tickInterval:40,tickLength:4,showLastLabel:!1,showFirstLabel:!0},yAxis:{title:{text:""},labels:{enabled:!1},min:0,plotLines:[{value:0,width:1,color:P.textColor}]},legend:{align:"center",verticalAlign:"bottom",borderWidth:0},credits:{enabled:!1},plotOptions:{series:{events:{legendItemClick:function legendItemClick(){return!1}}}},series:this.data.toJSON()},this.hideZeroDots)}});o.default=D;s.exports=o.default},1465:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(8)),O=S(_(15)),P=S(_(37)),D=S(_(0)),N=S(_(35)),V=_(4),j=_(141),K=_(57),W=S(_(2684)),U=S(_(805)),Y=S(_(1223)),$=S(_(47)),X=S(_(2685)),Z=S(_(2686)),Q=S(_(2688)),ee=S(_(2689)),te=S(_(2705));function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,R.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}_(2707);var ie=O.default.View.extend({initialize:function initialize(s){if(s=s||{},this.options=s,!s.kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.showDriftDetectionPanel=!1,s.featureFlags&&(this.showDriftDetectionPanel=s.featureFlags[j.featureFlagsStanzas.DRIFT_DETECTION]||!1),this.hideAnomalyDetectionPanel=s.hideAnomalyDetectionPanel||!1,this.hideRecommendedThresholding=s.hideRecommendedThresholding||!1,this.serviceTemplate=s.serviceTemplate,this.baseSearchCache=s.baseSearchCache||{},this.sdDispatcher=s.sdDispatcher,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.serviceModel=s.serviceModel,this.linkedServices=s.linkedServices,this.childViews={},this.showUnlinkWarning=this.serviceModel.get("object_type")===K.OBJECT_TYPE&&this.kpiModel.get("base_service_template_id"),this.showUnlinkWarning?this.setupServiceDefinitionHeader():this.setupHeader(),this.setupPanelViews();this.listenTo(this.kpiModel,"change:title",function(s,o){o&&o.replace(/\s+/g,"")&&s.isValid()&&s.gatherSearchClause({service:this.serviceModel})}.bind(this))},setupHeader:function setupHeader(){this.childViews.kpiTitleControl=new U.default({dataTestItsi:"kpi-title-text-control",model:this.kpiModel,modelAttribute:"title",clickToEdit:!0,placeholder:(0,V.gettext)("KPI title")}),this.childViews.kpiDescriptionControl=new U.default({dataTestItsi:"kpi-description-text-control",model:this.kpiModel,modelAttribute:"description",clickToEdit:!0,placeholder:(0,V.gettext)("KPI description")})},setupServiceDefinitionHeader:function setupServiceDefinitionHeader(){this.childViews.kpiTitleControl=new X.default({dataTestItsi:"kpi-title-text-control",model:this.kpiModel,modelAttribute:"title",clickToEdit:!0,placeholder:(0,V.gettext)("KPI title"),serviceTemplate:this.serviceTemplate,serviceModel:this.serviceModel,sdDispatcher:this.sdDispatcher}),this.childViews.kpiDescriptionControl=new U.default({dataTestItsi:"kpi-description-text-control",model:this.kpiModel,modelAttribute:"description",clickToEdit:!0,placeholder:(0,V.gettext)("KPI description")})},setupPanelViews:function setupPanelViews(){this.kpiSearchPanel=new Q.default(_objectSpread({kpiModel:this.kpiModel,serviceModel:this.serviceModel,baseSearchCache:this.baseSearchCache,serviceTemplateTitle:this.serviceTemplate?this.serviceTemplate.get("title"):""},this.options)),this.kpiThresholdingPanel=new ee.default(_objectSpread({kpiModel:this.kpiModel,linkedServices:this.linkedServices,serviceModel:this.serviceModel,serviceTemplateTitle:this.serviceTemplate?this.serviceTemplate.get("title"):""},this.options)),this.kpiAnomalyDetectionPanel=new te.default({kpiModel:this.kpiModel,serviceModel:this.serviceModel}),this.kpiDriftPanel=new Z.default(_objectSpread({kpiModel:this.kpiModel,linkedServices:this.linkedServices,serviceModel:this.serviceModel,serviceTemplateTitle:this.serviceTemplate?this.serviceTemplate.get("title"):""},this.options));var s=[this.kpiSearchPanel,this.kpiThresholdingPanel,...this.showDriftDetectionPanel?[this.kpiDriftPanel]:[],...this.hideAnomalyDetectionPanel?[]:[this.kpiAnomalyDetectionPanel]];this.childViews.centerLayout=new Y.default({panels:s})},render:function render(){if(this.$el.html(""),this.childViews.kpiTitleControl&&this.$el.append(this.childViews.kpiTitleControl.render().$el),this.childViews.kpiDescriptionControl&&this.$el.append(this.childViews.kpiDescriptionControl.render().$el),this.kpiModel.get("anomaly_detection_is_enabled")){this.$el.append('<div class="kpi-anomaly-detection-deprecation-notice"></div>');var s=this.$el.find(".kpi-anomaly-detection-deprecation-notice");N.default.render(D.default.createElement($.default,null,D.default.createElement(W.default,null)),s.get(0))}return this.childViews.centerLayout&&this.$el.append(this.childViews.centerLayout.render().$el),this},remove:function remove(){return(0,P.default)(this.childViews,function(s){s&&s instanceof O.default.View&&(this.stopListening(s),s.remove())}.bind(this)),O.default.View.prototype.remove.apply(this,arguments)}});o.default=ie;s.exports=o.default},1466:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V=S(_(7)),j=S(_(32)),K=S(_(15)),W=S(_(33)),U=S(_(0)),Y=S(_(35)),$=S(_(2)),X=S(_(37)),Z=S(_(27)),Q=S(_(427)),ee=S(_(34)),te=S(_(24)),ie=S(_(113)),ae=_(4),ne=_(14),re=_(265),se=_(264),le=_(627),oe=S(_(1459)),de=S(_(1460)),ce=_(57),he=S(_(47)),ue=[{label:(0,ae.gettext)("Data aggregation period"),value:"aggregation_span",description:(0,ae.gettext)("Time frame over which data is collected"),labelDataTestItsi:"kpi-drift-aggregation-span-label",valueDataTestItsi:"kpi-drift-aggregation-span-value",descriptionDataTestItsi:"kpi-drift-aggregation-span-description",staticContentDataTestItsi:"kpi-drift-aggregation-span-static-content"},{label:(0,ae.gettext)("Data aggregation function"),value:"aggregation_function",description:(0,ae.gettext)("Statistical method used to summarize KPI data"),labelDataTestItsi:"kpi-drift-aggregation-function-label",valueDataTestItsi:"kpi-drift-aggregation-function-value",descriptionDataTestItsi:"kpi-drift-aggregation-function-description",staticContentDataTestItsi:"kpi-drift-aggregation-function-static-content"},{label:(0,ae.gettext)("Look back period"),value:"lookback_period",description:(0,ae.gettext)("Time frame over which data is analyzed to evaluate trends and patterns"),labelDataTestItsi:"kpi-drift-lookback-label",valueDataTestItsi:"kpi-drift-lookback-value",descriptionDataTestItsi:"kpi-drift-lookback-description",staticContentDataTestItsi:"kpi-drift-lookback-static-content"},{label:(0,ae.gettext)("Drift tolerance"),value:"threshold_direction",description:(0,ae.gettext)("Percentage that a KPI can deviate from the baseline and be considered normal"),labelDataTestItsi:"kpi-drift-threshold-setting-label",valueDataTestItsi:"kpi-drift-threshold-setting-value",descriptionDataTestItsi:"kpi-drift-threshold-setting-description",staticContentDataTestItsi:"kpi-drift-threshold-setting-static-content"}],pe=(0,$.default)(Z.default)(R||(R=(0,V.default)(["\n\tfloat: right;\n"]))),fe=(0,$.default)(ee.default)(O||(O=(0,V.default)(["\n\tmargin-left: 5px;\n"]))),ge=(0,$.default)(ie.default)(P||(P=(0,V.default)(["\n\tmax-width: 100%;\n\toverflow-wrap: anywhere;\n"]))),me=$.default.div(D||(D=(0,V.default)(["\n\tdisplay: flex;\n"]))),ve=$.default.div(N||(N=(0,V.default)(["\n\tmargin-top: 20px;\n"]))),ye=K.default.View.extend({initialize:function initialize(s){var o;if(s=s||{},this.options=s,!s.kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.serviceModel=s.serviceModel,this.isReadOnly=s.isReadOnly||!1,this.isDriftConfigurationModalOpen=!1;var _=!1,S=!0;(0,X.default)(re.PYTHON_SCIENTIFIC_APP_NAMES,o=>{s.appsData&&s.appsData[o]&&s.appsData[o].isInstalled&&(_=!0,s.appsData[o].isDisabled||(S=!1))}),this.isPSCInstalled=_,this.isPSCDisabled=S;var R=[];s.linkedServices&&s.linkedServices.forEach(s=>{var o=s.kpis.find(s=>s.title===this.kpiModel.get("title"));R.push({label:s.title,value:s._key,kpi:o})}),this.linkedServices=R,this.linkedServiceKpi=this.linkedServices.length>0?null===(o=this.linkedServices[0].kpi)||void 0===o?void 0:o._key:null,K.default.View.prototype.initialize.apply(this,arguments)},getLabelForConfigOption:function getLabelForConfigOption(s,o){var _,S,R;switch(o){case"aggregation_span":return(null===(_=le.DRIFT_DETECTION_TIME_PERIOD_VALUES.find(o=>o.value===s))||void 0===_?void 0:_.label)||"";case"aggregation_function":return(null===(S=le.DRIFT_DETECTION_FUNCTIONS.find(o=>o.value===s))||void 0===S?void 0:S.longLabel)||"";case"lookback_period":return(null===(R=le.DRIFT_DETECTION_LOOKBACK_PERIOD_OPTIONS.find(o=>o.value===s))||void 0===R?void 0:R.label)||"";case"threshold_direction":var O,P=this.kpiModel.get("drift_detection_configuration"),D=(null===(O=le.DRIFT_DETECTION_TOLERANCE_DIRECTION_OPTIONS.find(o=>o.value===s))||void 0===O?void 0:O.label)||"";return(0,ne.sprintf)("%(toleranceDirection)s %(tolerancePercent)d%%",{toleranceDirection:D,tolerancePercent:P.tolerance_in_percent});default:return""}},handleSaveDriftSettings:function handleSaveDriftSettings(s){(0,W.default)(s)?(this.kpiModel.set("has_drift_detection_enabled",!1),this.kpiModel.set("drift_detection_configuration",s)):(this.kpiModel.set("has_drift_detection_enabled",!0),this.kpiModel.set("drift_detection_configuration",s)),this.isDriftConfigurationModalOpen=!1,this.getContentToShow()},handleOpenDriftModal:function handleOpenDriftModal(){this.isDriftConfigurationModalOpen=!0,this.getContentToShow()},getDriftSettingsModal:function getDriftSettingsModal(s){var o=s?this.kpiModel.get("drift_detection_configuration",{}):{};return U.default.createElement(de.default,{driftConfiguration:o,isModalOpen:this.isDriftConfigurationModalOpen,onSaveKpiChanges:this.handleSaveDriftSettings.bind(this),kpiId:this.linkedServiceKpi?this.linkedServiceKpi:this.kpiModel.get("_key"),kpiTitle:this.kpiModel.get("title"),linkedServices:this.linkedServices})},getNoDriftConfiguredContent:function getNoDriftConfiguredContent(){return U.default.createElement(me,null,U.default.createElement(oe.default,null),U.default.createElement(ve,{"data-test-itsi":"drift-panel-no-configuration-text-container"},U.default.createElement("div",{"data-test-itsi":"drift-panel-description"},(0,ae.gettext)("Drift detection monitors your KPI time series data for unusual behavior to prevent inaccurate configurations and alert for potential issues.")),U.default.createElement("div",null,U.default.createElement(te.default,{"data-test-itsi":"drift-panel-no-configuration-message",type:"info"},(0,ne.sprintf)((0,ae.gettext)("Drift detection has not been set up for %(kpiTitle)s"),{kpiTitle:this.kpiModel.get("title")}))),!this.isReadOnly&&U.default.createElement(Z.default,{"data-test-itsi":"drift-panel-edit-configuration-button",onClick:this.handleOpenDriftModal.bind(this)},(0,ae.gettext)("Configure drift detection"))),this.getDriftSettingsModal(!1))},getDriftConfiguredContent:function getDriftConfiguredContent(s){return U.default.createElement(U.default.Fragment,null,!this.isReadOnly&&U.default.createElement(pe,{"data-test-itsi":"drift-panel-edit-configuration-button",onClick:this.handleOpenDriftModal.bind(this)},(0,ae.gettext)("Edit")),U.default.createElement(Q.default,{"data-test-itsi":"drift-panel-configuration-details-container"},ue.map(o=>U.default.createElement(Q.default.Row,{key:o.value},U.default.createElement(Q.default.Column,{"data-test-itsi":o.labelDataTestItsi,span:3},o.label),U.default.createElement(Q.default.Column,{"data-test-itsi":o.valueDataTestItsi,span:3},U.default.createElement(ge,{"data-test-itsi":o.staticContentDataTestItsi},this.getLabelForConfigOption(s[o.value],o.value))),U.default.createElement(Q.default.Column,{"data-test-itsi":o.descriptionDataTestItsi,span:6},o.description)))),this.getDriftSettingsModal(!0))},getContentToShow:function getContentToShow(){var s=this.$el.find(".drift-detection-panel-content-container").length>0?this.$el.find(".drift-detection-panel-content-container"):(0,j.default)('<div class="drift-detection-panel-content-container"></div>');Y.default.unmountComponentAtNode(s.get(0));var o=this.kpiModel.get("drift_detection_configuration"),_=!this.isPSCInstalled||this.isPSCDisabled,S=this.isPSCInstalled?"warning":"error",R=this.isPSCInstalled?ce.DRIFT_PSC_DISABLED_MESSAGE:ce.DRIFT_PSC_NOT_INSTALLED_MESSAGE;return Y.default.render(U.default.createElement(he.default,null,_&&U.default.createElement(te.default,{type:S,"data-test-itsi":"drift-detection-install-psc-".concat(S,"-message")},U.default.createElement("div",null,R," ",!this.isPSCInstalled&&U.default.createElement(U.default.Fragment,null,(0,ae.gettext)("Download the app for "),U.default.createElement(fe,{"data-test-itsi":"drift-detection-psc-app-install-link-linux",to:(0,se.getSplunkBaseURL)(re.SPLUNKBASE_APPS.Python_Scientific_Linux.id),openInNewContext:!0},(0,ae.gettext)("Linux 64-bit")),(0,ae.gettext)(", "),U.default.createElement(fe,{"data-test-itsi":"drift-detection-psc-app-install-link-windows",to:(0,se.getSplunkBaseURL)(re.SPLUNKBASE_APPS.Python_Scientific_Windows.id),openInNewContext:!0},(0,ae.gettext)("Windows 64-bit")),(0,ae.gettext)(", "),U.default.createElement(fe,{"data-test-itsi":"drift-detection-psc-app-install-link-mac-intel",to:(0,se.getSplunkBaseURL)(re.SPLUNKBASE_APPS.Python_Scientific_Mac_Intel.id),openInNewContext:!0},(0,ae.gettext)("Mac Intel")),(0,ae.gettext)(", or "),U.default.createElement(fe,{"data-test-itsi":"drift-detection-psc-app-install-link-mac-arm",to:(0,se.getSplunkBaseURL)(re.SPLUNKBASE_APPS.Python_Scientific_Mac_Apple_Silicon.id),openInNewContext:!0},(0,ae.gettext)("Mac Apple Silicon"))),this.isPSCInstalled&&this.isPSCDisabled&&U.default.createElement(fe,{"data-test-itsi":"drift-detection-psc-app-enable-link",to:(0,se.manageAppsURL)({search:re.PYTHON_SCIENTIFIC_APP_NAME_PREFIX}),openInNewContext:!0},(0,ae.gettext)("Enable the app here")))),!_&&(this.kpiModel.get("has_drift_detection_enabled")&&o&&!(0,W.default)(o)?this.getDriftConfiguredContent(o):this.getNoDriftConfiguredContent())),s.get(0)),s},render:function render(){return this.$el.html(""),this.$el.append(this.getContentToShow()),this}});o.default=ye;s.exports=o.default},1467:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(8)),O=S(_(7)),P=S(_(32)),D=S(_(15)),N=S(_(150)),V=S(_(69)),j=S(_(38)),K=S(_(1197)),W=S(_(0)),U=S(_(35)),Y=S(_(2)),$=S(_(44)),X=S(_(113)),Z=_(4),Q=_(14),ee=_(554),te=_(61),ie=_(136),ae=_(804),ne=_(175),re=_(57),se=_(145),le=S(_(1192)),oe=S(_(77)),de=S(_(47)),ce=S(_(557)),he=S(_(1057)),ue=S(_(1225)),pe=S(_(598)),fe=S(_(1201));_(1468);var ge,me,ve=S(_(111));function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,R.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var ye=(0,Y.default)($.default)(ge||(ge=(0,O.default)(["\n\tmargin-bottom: 0;\n"]))),_e=(0,Y.default)(X.default)(me||(me=(0,O.default)(["\n\tmax-width: 100%;\n\toverflow-wrap: anywhere;\n"]))),Se=D.default.View.extend({attributes:{"data-test-itsi":"summary-view"},className:"summary-view",tagName:"div",initialize:function initialize(s){if(!(s=s||{}).kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.baseSearchCache=s.baseSearchCache||{},this.serviceModel=s.serviceModel,D.default.View.prototype.initialize.apply(this,arguments)},render:function render(){return this.$el.html(""),this.renderSummaryItems(),this},renderSummaryItems:function renderSummaryItems(){throw"Must override renderSummaryItems"}}),be=D.default.View.extend({initialize:function initialize(s){this.featureFlags=s.featureFlags,this.kpiModel=s.kpiModel,this.serviceModel=s.serviceModel,this.initialStep=s.initialStep,this.isReadOnly=s.isReadOnly,this.baseSearchSelectItems=s.baseSearchSelectItems,this.isModalOpen=s.isModalOpen,this.savedBaseSearchCollection=s.savedBaseSearchCollection,this.validateModelEntriesCallback=s.validateModelEntriesCallback,this.handleUpdateKpiModelCallback=s.handleUpdateKpiModelCallback,this.serviceTemplate=s.serviceTemplate,this.sdDispatcher=s.sdDispatcher,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.children={},this.children.editKPIButton=new oe.default({dataTestItsi:"kpi-search-panel-edit-button",label:(0,Z.gettext)("Edit"),onClick:this._onClickEdit.bind(this)}),D.default.View.prototype.initialize.apply(this,arguments),this.editAndSaveKpi=this.editAndSaveKpi.bind(this),this.handleAcceptToUnlink=this.handleAcceptToUnlink.bind(this)},render:function render(){return this.$el.html(this.children.editKPIButton.render().$el),this},_onClickEdit:function _onClickEdit(){this.serviceModel.get("object_type")===re.OBJECT_TYPE&&this.serviceTemplate&&this.kpiModel.get("base_service_template_id")?this._showUnlinkWarningModal():this._showEditModal()},_showUnlinkWarningModal:function _showUnlinkWarningModal(){var s=(0,P.default)('<div class="unlink-warning-modal"></div>'),o=(0,Z.gettext)("Edit KPI Search");U.default.unmountComponentAtNode(s.get(0)),U.default.render(W.default.createElement(de.default,null,W.default.createElement(pe.default,{modalTitleSubstring:o,serviceTitle:this.serviceModel.get("title"),serviceTemplateTitle:this.serviceTemplate.get("title"),serviceTemplateUrl:this.serviceTemplate.getEditUrl(),isModalOpen:!0,handleAcceptToUnlink:this.handleAcceptToUnlink})),s.get(0))},handleAcceptToUnlink:function handleAcceptToUnlink(){this.sdDispatcher.trigger("unsetBaseServiceTemplateId",this.serviceModel),this.sdDispatcher.trigger("unlink"),this._showEditModal()},_showEditModal:function _showEditModal(){if(this.serviceModel.get("object_type")===ne.OBJECT_TYPE){var s={base_search_id:this.kpiModel.get("base_search_id"),base_search_metric:this.kpiModel.get("base_search_metric"),title:this.kpiModel.get("title"),description:this.kpiModel.get("description")},o=function(){var o=(0,P.default)('<div class="edit-service-template-kpi-modal"></div>');U.default.unmountComponentAtNode(o.get(0)),U.default.render(W.default.createElement(de.default,null,W.default.createElement(ue.default,{savedBaseSearchCollection:this.savedBaseSearchCollection,baseSearchSelectItems:this.baseSearchSelectItems,validateModelEntries:this.validateModelEntriesCallback,handleUpdateKpiModel:this.handleUpdateKpiModelCallback,isModalOpen:this.isModalOpen,isNew:!1,editAndSaveKpi:this.editAndSaveKpi,currentKpiSearchValuesObject:s,kpiModel:this.kpiModel.clone()})),o.get(0))}.bind(this);this.modal=o()}else this.modal=new he.default({featureFlags:this.featureFlags,kpiModel:this.kpiModel,serviceModel:this.serviceModel,initialStep:this.initialStep,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping}),this.listenToOnce(this.modal,"kpichanged",function(s){var o=(0,j.default)(this.kpiModel.parse(s.toJSON()),["aggregate_thresholds","entity_thresholds","time_variate_thresholds_specification","skip_kpi_validation"]);this.kpiModel.set(o),this.kpiModel.trigger("change:time_variate_thresholds")}.bind(this)),(0,P.default)("body").append(this.modal.render().el),this.modal.show()},editAndSaveKpi:function editAndSaveKpi(s){var o=(0,j.default)(this.kpiModel.parse(s.toJSON()),["aggregate_thresholds","entity_thresholds","time_variate_thresholds_specification","skip_kpi_validation"]);this.kpiModel.set(o),this.kpiModel.trigger("change:time_variate_thresholds")}}),Ee=D.default.View.extend({tagName:"div",initialize:function initialize(s){if(s=s||{},this.options=s,!s.kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";if(this.serviceModel=s.serviceModel,!s.title)throw"Must provide title";this.baseSearchCache=s.baseSearchCache||{},this.featureFlags=s.featureFlags,this.initialStep=s.initialStep,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping;var o=s.title,_=!!s.showEditControl,S=D.default.View.extend({tagName:"div",className:"title-view",render:function render(){return this.$el.text(o),this}});if(!s.SummaryView)throw"Must provide summary view";var R=s.SummaryView;this.summaryView=new R({baseSearchCache:this.baseSearchCache,kpiModel:this.kpiModel,serviceModel:this.serviceModel});var O=[{view:new S({kpiModel:this.kpiModel,serviceModel:this.serviceModel}),width:250},{view:this.summaryView,flex:2}];_&&O.push({view:new be(_objectSpread({featureFlags:this.featureFlags,kpiModel:this.kpiModel,serviceModel:this.serviceModel,initialStep:this.initialStep},this.options)),width:30}),this.layout=new le.default({align:"stretch",items:O}),this.listenTo(this.kpiModel,"change",this.onChangeAttribute),D.default.View.prototype.initialize.apply(arguments)},onChangeAttribute:function onChangeAttribute(){this.summaryView.render()},render:function render(){return this.$el.html(this.layout.render().$el),this.options.dataTestItsi&&this.$el.attr("data-test-itsi",this.options.dataTestItsi),this}}),getInnerContentHTML=s=>({__html:s}),Te=function renderControlGroup(s){var o=(0,P.default)("<div></div>");U.default.unmountComponentAtNode(o.get(0));var _=s.content;return s.isContentHTML&&(_=W.default.createElement("div",{dangerouslySetInnerHTML:getInnerContentHTML(s.content)})),U.default.render(W.default.createElement(de.default,null,W.default.createElement(ye,{"data-test-itsi":s.controlGroupDataTestItsi,label:s.controlGroupLabel,labelWidth:te.LABEL_WIDTHS.Massive},W.default.createElement(_e,{"data-test-itsi":s.labelDataTestItsi},_))),o.get(0)),o},Ce=D.default.View.extend({initialize:function initialize(s){if(s=s||{},this.options=s,!s.kpiModel)throw"Must provide kpiModel";var o=this;if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.featureFlags=s.featureFlags,this.serviceModel=s.serviceModel,this.baseSearchCache=s.baseSearchCache||{},this.baseSearchSelectItems=s.baseSearchSelectItems,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.isModalOpen=s.isModalOpen,this.savedBaseSearchCollection=s.savedBaseSearchCollection,this.isBaseServiceTemplate=this.serviceModel.get("object_type")===ne.OBJECT_TYPE;var _=!this.isBaseServiceTemplate;this.sourceView=new Ee(_objectSpread({featureFlags:this.featureFlags,baseSearchCache:this.baseSearchCache,kpiModel:s.kpiModel,title:(0,Z.gettext)("Source"),serviceModel:s.serviceModel,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping,initialStep:1,showEditControl:!0,className:"three-column-view source-three-column-view",dataTestItsi:"source-three-column-view",SummaryView:Se.extend({renderSummaryItems:function renderSummaryItems(){var s=this.kpiModel.get("search_type"),o=this.kpiModel.get("metric");if("datamodel"===s){var _=this.kpiModel.get("datamodel");_.validate()?this.$el.text((0,Z.gettext)("Not configured")):(this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-data-model-field",labelDataTestItsi:"kpi-source-data-model-value",controlGroupLabel:(0,Z.gettext)("Data model"),content:_.get("datamodel")})),this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-data-model-object-field",labelDataTestItsi:"kpi-source-data-model-object-value",controlGroupLabel:(0,Z.gettext)("Data model object"),content:_.get("object")})),this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-data-model-field-field",labelDataTestItsi:"kpi-source-data-model-field-value",controlGroupLabel:(0,Z.gettext)("Data model field"),content:_.get("field")})))}else if("metric"===s)this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-metric-search-field",labelDataTestItsi:"kpi-source-metric-search-value",controlGroupLabel:(0,Z.gettext)("Search"),content:(0,Z.gettext)("Metrics search")})),this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-metrics-index-field",labelDataTestItsi:"kpi-source-metrics-index-value",controlGroupLabel:(0,Z.gettext)("Metrics index"),content:(0,N.default)(o.metric_index)})),this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-metric-name-field",labelDataTestItsi:"kpi-source-metric-name-value",controlGroupLabel:(0,Z.gettext)("Metric name"),content:(0,N.default)(o.metric_name)}));else if("adhoc"===s)this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-adhoc-search-field",labelDataTestItsi:"kpi-source-adhoc-search-value",controlGroupLabel:(0,Z.gettext)("Search"),content:(0,N.default)(this.kpiModel.get("base_search")),isContentHTML:!0})),this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-threshold-field-field",labelDataTestItsi:"kpi-source-threshold-field-value",controlGroupLabel:(0,Z.gettext)("Threshold field"),content:(0,N.default)(this.kpiModel.get("threshold_field"))}));else if(this.kpiModel.get("base_search_id")&&!this.isFetching){var successHandler=s=>{if(s){var _=(0,V.default)(s.metrics.models,function(s){return s.get("_key")===this.kpiModel.get("base_search_metric")}.bind(this));this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-base-search-field",labelDataTestItsi:"kpi-source-base-search-value",controlGroupLabel:(0,Z.gettext)("Base search"),content:(0,N.default)(s.title)})),s.is_metric?(this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-base-search-metrics-index-field",labelDataTestItsi:"kpi-source-base-search-metrics-index-value",controlGroupLabel:(0,Z.gettext)("Base search metrics index"),content:(0,N.default)(o.metric_index)})),this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-base-search-metric-name-field",labelDataTestItsi:"kpi-source-base-search-metric-name-value",controlGroupLabel:(0,Z.gettext)("Base search metric name"),content:(0,N.default)(o.metric_name)})),null!=_&&_.get("title")&&this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-base-search-metric-title-field",labelDataTestItsi:"kpi-source-base-search-metric-title-value",controlGroupLabel:(0,Z.gettext)("Metric"),content:(0,N.default)(_.get("title"))}))):(this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-base-search-search-field",labelDataTestItsi:"kpi-source-base-search-search-value",controlGroupLabel:(0,Z.gettext)("Search"),content:(0,N.default)(this.kpiModel.get("base_search")),isContentHTML:!0})),this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-base-search-threshold-field-field",labelDataTestItsi:"kpi-source-base-search-threshold-field-value",controlGroupLabel:(0,Z.gettext)("Threshold field"),content:(0,N.default)(this.kpiModel.get("threshold_field"))})))}};if(this.kpiModel.get("base_search_id")in this.baseSearchCache)successHandler(this.baseSearchCache[this.kpiModel.get("base_search_id")]);else{var S=new fe.default({_key:this.kpiModel.get("base_search_id")});this.isFetching=!0,this.loadingMessage=new ve.default({content:(0,Z.gettext)("Loading KPI base search information..."),dataTestItsi:"kpi-source-base-search-field-info-message",style:{marginLeft:"".concat(te.LABEL_WIDTHS.Massive+20,"px")},type:"info"}),this.$el.append(this.loadingMessage.render().$el),S.fetch().done(s=>{this.loadingMessage&&(this.loadingMessage.hide(),this.loadingMessage.remove()),this.isFetching=!1,this.baseSearchCache[this.kpiModel.get("base_search_id")]=s,successHandler(s)}).fail(()=>{this.isFetching=!1,this.$el.append(Te({controlGroupDataTestItsi:"kpi-source-base-search-field-fetch-error",labelDataTestItsi:"kpi-source-base-search-value-fetch-error",controlGroupLabel:(0,Z.gettext)("Base search"),content:(0,Z.gettext)("Could not retrieve the KPI base search information. Try refreshing the page.")}))})}}}})},this.options));var S=(0,ae.getAggregationOperations)("all");this.calculationView=new Ee(_objectSpread({featureFlags:this.featureFlags,kpiModel:s.kpiModel,title:(0,Z.gettext)("Calculation"),serviceModel:s.serviceModel,initialStep:3,showEditControl:_,className:"three-column-view calculation-three-column-view",dataTestItsi:"calculation-three-column-view",SummaryView:Se.extend({renderSummaryItems:function renderSummaryItems(){var s,o,_=this.kpiModel.get("aggregate_statop");0===_.indexOf("perc")&&(o=_.substr(4),s={value:_,label:(0,Q.sprintf)((0,Z.gettext)("Percentile (%s)"),o)});var R,O=this.kpiModel.get("entity_statop");if(0===O.indexOf("perc")&&(o=O.substr(4),R={value:O,label:(0,Q.sprintf)((0,Z.gettext)("Percentile (%s)"),o)}),!s||!R)for(var P=0;P<S.length&&(_===S[P].value&&(s=S[P]),O===S[P].value&&(R=S[P]),!s||!R);++P);if(s){var D,V=s.label,j=R.label,K=this.kpiModel.get("alert_period"),W=this.kpiModel.get("search_alert_earliest"),U=(0,N.default)(this.kpiModel.get("threshold_field")),Y=this.kpiModel.get("fill_gaps");D=this.kpiModel.get("is_entity_breakdown")?(0,Q.sprintf)((0,Z.gettext)('Calculating <span class="field-title">%s</span> of %s per entity as entity value, <span class="field-title">%s</span> of entity value as aggregate over the last <span class="field-title">%s minute(s)</span> every <span class="field-title">%s minute(s)</span>.'),j,U,V,W,K):(0,Q.sprintf)((0,Z.gettext)('Calculating <span class="field-title">%s</span> of %s as aggregate over the last <span class="field-title">%s minute(s)</span> every <span class="field-title">%s minute(s)</span>.'),V,U,W,K),D+="null_value"===Y?" "+(0,Q.sprintf)((0,Z.gettext)("Fill gaps in data with Null values and use a %s threshold level for them"),(0,ie.getSeverityLabel)(this.kpiModel.get("gap_severity")).toLowerCase()):"custom_value"===Y?" "+(0,Q.sprintf)((0,Z.gettext)("Fill gaps in data with custom value of %s"),this.kpiModel.get("gap_custom_alert_value")):" "+(0,Z.gettext)("Fill gaps in data with the last available value of data"),D+=".",this.$el.append(Te({controlGroupDataTestItsi:"calculation-field",labelDataTestItsi:"calculation-value",controlGroupLabel:(0,Z.gettext)("Calculation"),content:D,isContentHTML:!0}))}else this.$el.text((0,Z.gettext)("Not configured"))}})},this.options)),this.entityView=new Ee(_objectSpread({featureFlags:this.featureFlags,kpiModel:s.kpiModel,title:(0,Z.gettext)("Entities"),serviceModel:s.serviceModel,initialStep:2,showEditControl:_,className:"three-column-view entities-three-column-view",dataTestItsi:"entities-three-column-view",SummaryView:Se.extend({renderSummaryItems:function renderSummaryItems(){if(this.kpiModel.get("is_entity_breakdown")||this.kpiModel.get("is_service_entity_filter")){if(this.kpiModel.get("is_entity_breakdown")&&this.$el.append(Te({controlGroupDataTestItsi:"entity-split-by-field-field",labelDataTestItsi:"entity-split-by-field-value",controlGroupLabel:(0,Z.gettext)("Entity Split Field(s)"),content:this.kpiModel.get("entity_breakdown_id_fields")})),this.kpiModel.get("is_service_entity_filter")&&this.serviceModel.getNumEntityRules()>0){this.$el.append(Te({controlGroupDataTestItsi:"entity-id-fields-field",labelDataTestItsi:"entity-id-fields-value",controlGroupLabel:(0,Z.gettext)("Data filtered by service entities in field"),content:this.kpiModel.get("entity_id_fields")}));for(var s=this.serviceModel.get("entity_rules"),o=[],_=0;_<s.length;++_)for(var S=s.at(_).get("rule_items").pluck("field"),R=0;R<S.length;++R)o.push((0,N.default)(S[R]));o=(0,K.default)(o),this.$el.append(Te({controlGroupDataTestItsi:"services-matches-entities-field",labelDataTestItsi:"services-matches-entities-value",controlGroupLabel:(0,Z.gettext)("Service matches entities on fields"),content:o.join(", ")}))}}else this.$el.append(Te({controlGroupDataTestItsi:"not-filtering-entities-field",labelDataTestItsi:"not-filtering-entities-value",controlGroupLabel:(0,Z.gettext)("Entities"),content:(0,Z.gettext)("This KPI is not filtered by or monitoring any entities.")}));return this}})},this.options)),this.unitView=new Ee(_objectSpread({featureFlags:this.featureFlags,kpiModel:s.kpiModel,title:(0,Z.gettext)("Unit and Monitoring Lag"),serviceModel:s.serviceModel,initialStep:4,showEditControl:_,className:"three-column-view unit-three-column-view",dataTestItsi:"unit-three-column-view",SummaryView:Se.extend({renderSummaryItems:function renderSummaryItems(){this.$el.append(Te({controlGroupDataTestItsi:"unit-monitoring-lag-unit-field",labelDataTestItsi:"unit-monitoring-lag-unit-value",controlGroupLabel:(0,Z.gettext)("Unit"),content:this.kpiModel.get("unit")||(0,Z.gettext)("None")})),this.$el.append(Te({controlGroupDataTestItsi:"unit-monitoring-lag-lag-field",labelDataTestItsi:"unit-monitoring-lag-lag-value",controlGroupLabel:(0,Z.gettext)("Monitoring Lag"),content:this.kpiModel.get("alert_lag")}))}})},this.options)),this.isBaseServiceTemplate||(this.backfillView=new Ee(_objectSpread({featureFlags:this.featureFlags,kpiModel:s.kpiModel,title:(0,Z.gettext)("Backfill"),serviceModel:s.serviceModel,initialStep:5,showEditControl:_,className:"three-column-view backfill-three-column-view",dataTestItsi:"backfill-three-column-view",SummaryView:Se.extend({renderSummaryItems:function renderSummaryItems(){!1===this.kpiModel.get("backfill_enabled")?this.$el.append(Te({controlGroupDataTestItsi:"backfill-field-not-configured-control-group",labelDataTestItsi:"backfill-value-not-configured",controlGroupLabel:(0,Z.gettext)("Backfill"),content:(0,Z.gettext)("Backfill has not been configured.")})):(this.$el.append(Te({controlGroupDataTestItsi:"backfill-field-waiting-control-group",labelDataTestItsi:"backfill-value-waiting",controlGroupLabel:(0,Z.gettext)("Backfill"),content:se.BACKFILL_STATUSES.WAITING})),o._checkBackfillProgress())}})},this.options))),D.default.View.prototype.initialize.apply(this,arguments)},_checkIfBackfillIsNeeded:function _checkIfBackfillIsNeeded(s){this._checkBackfillProgress(s)},_renderBackfillControls:function _renderBackfillControls(s,o){var _,S=this.kpiModel.get("_key"),R=this.kpiModel.get("backfill_earliest_time");if(s)_=ce.default.renderBackfillStatus(o,R),this._hideEditOnBackfillView();else{var O=(0,ee.createRangeLabel)(R,"now").toLowerCase();_=(0,Q.sprintf)((0,Z.gettext)("Backfill has been configured for %(timeLabel)s of data."),{timeLabel:O}),this.serviceKpiBackfillMapping[S]?this._hideEditOnBackfillView():this._showEditOnBackfillView()}this.backfillView.summaryView.$el.html(Te({controlGroupDataTestItsi:"backfill-field-control-group",labelDataTestItsi:"backfill-value",controlGroupLabel:(0,Z.gettext)("Backfill"),content:_}))},_checkBackfillProgress:function _checkBackfillProgress(s){this.kpiModel._cachedBackfillProgressStatus&&void 0!==this.kpiModel._cachedBackfillProgressStatus.progress&&void 0!==this.kpiModel._cachedBackfillProgressStatus.status?this._renderBackfillControls(this.kpiModel._cachedBackfillProgressStatus.progress,this.kpiModel._cachedBackfillProgressStatus.status,s):ce.default.getBackfillDataForKpi(this.kpiModel.get("_key")).done((o,_)=>{this._renderBackfillControls(o,_,s)})},_hideEditOnBackfillView:function _hideEditOnBackfillView(){this.backfillView&&this.backfillView.layout&&this.backfillView.layout.items&&this.backfillView.layout.items.length>=3&&this.backfillView.layout.items[2].view&&this.backfillView.layout.items[2].view.children&&this.backfillView.layout.items[2].view.children.editKPIButton&&this.backfillView.layout.items[2].view.children.editKPIButton.hide()},_showEditOnBackfillView:function _showEditOnBackfillView(){this.backfillView&&this.backfillView.layout&&this.backfillView.layout.items&&this.backfillView.layout.items.length>=3&&this.backfillView.layout.items[2].view&&this.backfillView.layout.items[2].view.children&&this.backfillView.layout.items[2].view.children.editKPIButton&&this.backfillView.layout.items[2].view.children.editKPIButton.show()},render:function render(){return this.$el.html(""),this.$el.append(this.sourceView.render().$el),this.$el.append(this.entityView.render().$el),this.$el.append(this.calculationView.render().$el),this.$el.append(this.unitView.render().$el),this.isBaseServiceTemplate||(this.$el.append(this.backfillView.render().$el),this.isReadOnly||(this.kpiModel.get("backfill_enabled")&&this.serviceKpiBackfillMapping&&this.serviceKpiBackfillMapping[this.kpiModel.get("_key")]?this._hideEditOnBackfillView():this._showEditOnBackfillView())),this}});o.default=Ce;s.exports=o.default},1468:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1093),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},1469:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y=S(_(7)),$=_(46),X=_(45),Z=S(_(81)),Q=S(_(94)),ee=S(_(201)),te=S(_(37)),ie=S(_(69)),ae=S(_(153)),ne=S(_(33)),re=S(_(62)),se=S(_(50)),le=S(_(32)),oe=S(_(15)),de=S(_(0)),ce=S(_(35)),he=S(_(2)),ue=_(4),pe=_(14),fe=_(22),ge=_(85),me=_(125),ve=S(_(266)),ye=S(_(34)),_e=S(_(24)),Se=S(_(51)),be=S(_(770)),Ee=S(_(89)),Te=S(_(461)),Ce=S(_(75)),ke=S(_(91)),xe=S(_(121)),we=_(376),Re=_(265),Ie=_(73),Me=_(29),Oe=_(108),Ae=_(61),Pe=_(126),De=_(78),Le=_(107),Ne=_(110),Ve=_(141),je=_(67),He=_(345),Be=_(175),Ke=_(57),Fe=_(102),We=_(142),Ue=_(293),Ge=_(114),Ye=_(294),qe=_(723),ze=_(517),$e=_(145),Je=S(_(162)),Xe=S(_(2690)),Ze=S(_(2691)),Qe=S(_(474)),et=S(_(88)),tt=S(_(288)),it=S(_(77)),at=S(_(559)),nt=S(_(694)),rt=S(_(111)),st=S(_(800)),lt=S(_(689)),ot=S(_(635)),dt=S(_(2432)),ct=S(_(2380)),ht=S(_(1743)),ut=S(_(47)),pt=S(_(1446)),ft=S(_(1470)),gt=S(_(1471)),mt=S(_(1448)),vt=S(_(2702)),yt=S(_(1222)),_t=S(_(1823)),St=S(_(2551)),bt=S(_(2555)),Et=S(_(2703)),Tt=S(_(2554));_(1472);var Ct=(0,we.getStore)(),kt=(0,he.default)(Te.default)(R||(R=(0,Y.default)(["\n\tcolor: ",";\n"])),fe.variables.contentColorMuted),xt=he.default.span(O||(O=(0,Y.default)(["\n\tfont-weight: ",";\n"])),fe.variables.fontWeightBold),wt=he.default.img(P||(P=(0,Y.default)(["\n\tdisplay: block;\n\tmargin-left: auto;\n\tmargin-right: auto;\n"]))),Rt=(0,he.default)(Ce.default)(D||(D=(0,Y.default)(["\n\tvertical-align: middle;\n\tmargin-right: 5px;\n"]))),It=he.default.span(N||(N=(0,Y.default)(["\n padding: 6px 0;\n min-width: calc(100vw - 20px * 4);\n"]))),Mt=(0,he.default)(Se.default)(V||(V=(0,Y.default)(["\n\tfont-size: 20px;\n\ttext-align: center;\n\tfont-weight: bold;\n\tmargin-top: 20px;\n\tmargin-bottom: 30px;\n"]))),Ot=(0,he.default)(Se.default)(j||(j=(0,Y.default)(["\n\ttext-align: center;\n\tmargin-top: -10px;\n"]))),At=(0,he.default)(ve.default)(K||(K=(0,Y.default)(["\n\tmargin-right: 5px;"]))),Pt=(0,he.default)(_e.default)(W||(W=(0,Y.default)(["\n margin: 20px 0 0;\n"]))),Dt=he.default.div(U||(U=(0,Y.default)(["\n\tmax-width: 60ch;\n\tword-wrap: break-word;\n"]))),Lt=de.default.createElement(Dt,null,(0,pe.sprintf)((0,ue.gettext)("Indicates that the KPI is linked to an active %(objectName)s"),{objectName:Ye.OBJECT_NAMES.singular})),Nt=de.default.createElement(It,null,de.default.createElement(Rt,{"data-test-itsi":"load-recommendation-wait-spinner",size:"medium"})," ",(0,ue.gettext)("Checking for KPI data in the selected time range...")),Vt=oe.default.View.extend({kpiTimePresetsList:[{value:"-7d",label:(0,ue.gettext)("7 days")},{value:"-14d",label:(0,ue.gettext)("14 days")},{value:"-30d",label:(0,ue.gettext)("30 days")},{value:"-60d",label:(0,ue.gettext)("60 days")}],KpiSingleThresholdingView:yt.default,KpiTimeVariantThresholdingView:_t.default,currPageLabelWidth:Ae.LABEL_WIDTHS.Massive,compiledTemplate:(0,X.template)(Et.default,null,{variable:"vars"}),initialize:function initialize(s){var o,_,S,R;if(!(s=s||{}).service)throw"Must provide service";if(this.service=s.service,this.linkedServices=s.linkedServices,this.featureFlags=s.featureFlags,this.appsData=s.appsData,this.isServiceTemplate=this.service.get("object_type")===Be.OBJECT_TYPE,this.canWriteOnGlobalTeam=null===(o=s)||void 0===o||null===(o=o.permissions)||void 0===o?void 0:o.canWriteOnGlobalTeam,this.previewServiceCache=null===(_=s)||void 0===_?void 0:_.previewServiceCache,this.thresholdTemplateCollection=null===(S=s)||void 0===S?void 0:S.thresholdTemplateCollection,this.userTimezoneObject=null===(R=s)||void 0===R||null===(R=R.userData)||void 0===R?void 0:R.timezone,this.hasNoLinkedServicesState=!!this.linkedServices&&0===this.linkedServices.length,this.showAtConfigMessage=!1,this.configMessageAlreadySeen=!1,this.handleConfigChangeDismiss=()=>{this.configMessageAlreadySeen=!0},this.hideRecommendedThresholding=s.hideRecommendedThresholding,!s.kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,this.isServiceTemplate||s.featureFlags&&!s.featureFlags[Ve.featureFlagsStanzas.ENTITY_LEVEL_AT]){var O;O=this.kpiModel.get("is_recommended_time_policies")?Ne.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED:!this.kpiModel.get("is_threshold_template_option_selected",!1)&&!this.kpiModel.get("kpi_threshold_template_id")||this.kpiModel.get("kpi_threshold_template_id")===Ne.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM?Ne.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM:Ne.KPI_THRESHOLD_TEMPLATE_TYPES.TEMPLATE,this.radioControlModel=new oe.default.Model({value:O}),this.selectItems=[],this._handleThresholdConfigTabChange=this._handleThresholdConfigTabChange.bind(this),this._onEnableDisableAlerting=this._onEnableDisableAlerting.bind(this),this._onOutlierDetectionSettingsChange=this._onOutlierDetectionSettingsChange.bind(this),this.getCurrentRules=this.getCurrentRules.bind(this),this.getAvailableSeveritiesForDropdown=this.getAvailableSeveritiesForDropdown.bind(this),this.handleKpiAlertingOptionChange=this.handleKpiAlertingOptionChange.bind(this),this.addOrUpdateRuleToKpiModel=this.addOrUpdateRuleToKpiModel.bind(this),this.removeRuleFromKpiModel=this.removeRuleFromKpiModel.bind(this),this.removeAndAddRuleToKpiModel=this.removeAndAddRuleToKpiModel.bind(this),this._configSettingsModel=new oe.default.Model({threshold_config_is_aggregate:!0,adaptive_thresholds_is_enabled:this.kpiModel.get("adaptive_thresholds_is_enabled"),adaptive_thresholding_training_window:this.kpiModel.get("adaptive_thresholding_training_window"),kpiConfigView:s.kpiConfigView||!1}),this.trainingRecommendationIcon=new at.default({dataTestItsi:"kpi-thresholding-adaptive-training-time-recommender-icon",style:{marginRight:"5px"},type:"starsparklesdouble"}),this.kpiTrainingEarliestTimePicker=new et.default({controlType:"SyntheticSelect",controlOptions:{dataTestItsi:"kpi-adaptive-training-time-select",items:this.kpiTimePresetsList,model:this._configSettingsModel,modelAttribute:"adaptive_thresholding_training_window",style:{width:"100%"}},dataTestItsi:"kpi-adaptive-training-time-control-group",label:(0,ue.gettext)("Training window"),labelWidth:Ae.LABEL_WIDTHS.Plus,tooltip:(0,ue.gettext)("Select the time window over which the KPI adaptive thresholding training should run.")}),this.timeVariantRecommendationIcon=new at.default({dataTestItsi:"kpi-thresholding-time-policies-recommender-icon",style:{marginRight:"5px"},type:"starsparklesdouble"}),this.outlierRecommendationIcon=new at.default({dataTestItsi:"kpi-thresholding-outlier-exclusion-recommender-icon",style:{marginRight:"5px"},type:"starsparklesdouble"}),this.outlierAlgoRecommendationIcon=new at.default({dataTestItsi:"kpi-thresholding-outlier-exclusion-algo-recommender-icon",style:{marginRight:"5px"},type:"starsparklesdouble"}),this.outlierSensitivityRecommendationIcon=new at.default({dataTestItsi:"kpi-thresholding-outlier-exclusion-sensitivity-recommender-icon",style:{marginRight:"5px"},type:"starsparklesdouble"});var P=this.createSwitchControl(this.kpiModel.get("time_variate_thresholds"),"enable-disable-time-policies",this.handleTimeVariantControlChange.bind(this),(0,ue.gettext)("Enable Time Policies"),(0,ue.gettext)("Enable thresholds that can vary based on time of day."),"kpi-thresholding-time-policies-control-switch","kpi-thresholding-time-policies-control-group");this.enableTimeVariantControl=P.mountNode,this.timeVariantEnableDisableControlDomRef=P.reactDomRef,this.aggregateEntityConfigureControl=this.createThresholdControlTabs(),this.adaptiveRecommendationIcon=new at.default({dataTestItsi:"kpi-thresholding-adaptive-thresholding-recommender-icon",style:{marginRight:"5px"},type:"starsparklesdouble"});var D=this.createSwitchControl(this._configSettingsModel.get("adaptive_thresholds_is_enabled"),"enable-disable-adaptive-thresholding",this.handleAdaptiveThresholdControlChange.bind(this),(0,ue.gettext)("Enable Adaptive Thresholding"),(0,ue.gettext)("Allow for time varying thresholds to update periodically."),"kpi-thresholding-adaptive-thresholding-control-switch","kpi-thresholding-adaptive-thresholding-control-group");this.enableAdaptiveThresholdControl=D.mountNode,this.adaptiveThresholdEnableDisableControlDomRef=D.reactDomRef,this.isPreviewKpiModelReady=!1,this.isRecommendedThresholdSearchInProgress=!1,this.showRecommendationIcon=!1,this.recommendationResponse={},this.loadingMask=new nt.default,this.loadingMaskHandler=s=>s?this.loadingMask.show(s):this.loadingMask.hide(),this.listenTo(this.kpiModel,"change:time_variate_thresholds",function(){this._toggleTimeVariantThresholdingView(),this._setThresholdingTemplateState(),this.kpiModel.get("time_variate_thresholds")?this.singleThresholdingPreviewChart&&(this.singleThresholdingPreviewChart.remove(),this.singleThresholdingPreviewChart=null):this._renderSingleThresholdingPreviewChart()}.bind(this));var N=this.kpiModel.get("time_variate_thresholds_specification");this.listenTo(N,"change",function(s,o){if(o&&o.changeManifest){(0,te.default)(["levels","baseSeverity","removePolicy","addPolicy","addTimeBlock","title","policy_type"],function(s){if(o.changeManifest[s])return this.showAtConfigMessage=!0,this._renderApplyATControls(),void(this.kpiModel.get("did_load_recommendation")&&!this.kpiModel.get("was_recommendation_modified")&&this.kpiModel.set("was_recommendation_modified",!0))}.bind(this))}}.bind(this)),this.listenTo(this.kpiModel,"change:adaptive_thresholds_is_enabled",(function(){this.kpiModel.get("adaptive_thresholds_is_enabled")||this._changePoliciesToStatic(),this._toggleAdaptiveThresholdingControls()})),this.listenTo(N,"applyat",()=>this.isServiceTemplate&&this._repaint()),this.listenTo(this.kpiModel,"change:kpi_threshold_template_id",this._changeThresholdTemplate),this.listenTo(this.kpiModel,"change:is_entity_breakdown",this._toggleAggregateEntitySelector),this.listenTo(this.kpiModel,"change:search",this._toggleTimeVariantThresholdingView),this.listenTo(this.kpiModel,"change:aggregate_outlier_detection_enabled change:outlier_detection_algo change:outlier_detection_sensitivity",()=>{this.kpiModel.get("did_load_recommendation")&&!this.kpiModel.get("was_recommendation_modified")&&this.kpiModel.set("was_recommendation_modified",!0),this.showAtConfigMessage=!0,this._renderApplyATControls()}),this.listenTo(this._configSettingsModel,"change:adaptive_thresholds_is_enabled",function(){this.kpiModel.set("adaptive_thresholds_is_enabled",this._configSettingsModel.get("adaptive_thresholds_is_enabled"))}.bind(this)),this.listenTo(this._configSettingsModel,"change:adaptive_thresholding_training_window",function(){this.kpiModel.set("adaptive_thresholding_training_window",this._configSettingsModel.get("adaptive_thresholding_training_window")),this.showAtConfigMessage=!0,this._renderApplyATControls()}.bind(this)),this.listenTo(this._configSettingsModel,"change:threshold_config_is_aggregate",this._toggleThresholdingConfigSettings);var V="change:adaptive_thresholds_is_enabled change:adaptive_thresholding_training_window change:time_variate_thresholds change:time_variate_thresholds_specification";this.listenTo(this.kpiModel,V,(function(){this.kpiModel.get("did_load_recommendation")&&!this.kpiModel.get("was_recommendation_modified")&&this.kpiModel.set("was_recommendation_modified",!0)})),this.singleThresholdingSummaryIndexCheckComplete=!1,this.singleThresholdingUseRawSearch=!0;var j=[this.kpiModel.getThresholdSettingModel(Ne.KPI_THRESHOLD_TYPES.AGGREGATE),this.kpiModel.getThresholdSettingModel(Ne.KPI_THRESHOLD_TYPES.ENTITY)];j.forEach(s=>this.listenTo(s,"change",this._renderSingleThresholdingPreviewChart)),this.checkSingleThresholdingShouldUseRawSearch(),this.children={},this.children.documentationLink=new it.default({dataTestItsi:"threshold-timezones-external-link",icon:"external",isLink:!0,label:(0,ue.gettext)("Learn more"),openInNewContext:!0,to:(0,Oe.makeDocsURL)(Oe.DOCS_PAGES.ITSI_THRESHOLD_TZ)}),this.isServiceTemplate&&(this.singleThresholdingView=new this.KpiSingleThresholdingView({kpiModel:this.kpiModel,service:this.service,configSettingsModel:this._configSettingsModel,aggregateThresholdModel:this.kpiModel.getThresholdSettingModel(Ne.KPI_THRESHOLD_TYPES.AGGREGATE),entityThresholdModel:this.kpiModel.getThresholdSettingModel(Ne.KPI_THRESHOLD_TYPES.ENTITY)}),this.previewKpiModel=this.kpiModel,this.previewServiceModel=this.service,this.stopListening(this.previewKpiModel,"change"),this.listenTo(this.previewKpiModel,"change",this._onKPIChange),this.previewModel=new oe.default.Model({serviceId:""}),this.listenTo(this.previewModel,"change:serviceId",this._onSelectService))}oe.default.View.prototype.initialize.apply(this,arguments)},createSwitchControl:function createSwitchControl(s,o,_,S,R,O,P){var D,N=(0,le.default)('<div class="'.concat(o,'"></div>')).css({display:"inline-block","vertical-align":"middle"});return ce.default.unmountComponentAtNode(N.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(st.default,{controlGroupDataTestItsi:P,dataTestItsi:O,enabled:s,hasControlGroup:!0,onChange:_,size:"medium",label:S,labelWidth:this.currPageLabelWidth,tooltip:R,ref:s=>{D=s}})),N.get(0)),{mountNode:N,reactDomRef:D}},handleTimeVariantControlChange:function handleTimeVariantControlChange(s){this.kpiModel.set({time_variate_thresholds:s}),this.renderRadioControl()},handleAdaptiveThresholdControlChange:function handleAdaptiveThresholdControlChange(s){this._configSettingsModel.set({adaptive_thresholds_is_enabled:s})},createThresholdControlTabs:function createThresholdControlTabs(){var s=(0,le.default)('<div class="threshold-config-tabs-container"></div>');return ce.default.unmountComponentAtNode(s.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(bt.default,{handleTabChange:this._handleThresholdConfigTabChange,showRecommendationIcon:this.showRecommendationIcon})),s.get(0)),s},_handleThresholdConfigTabChange:function _handleThresholdConfigTabChange(s){s===Ne.KPI_THRESHOLD_TYPES.AGGREGATE?this._configSettingsModel.set({threshold_config_is_aggregate:!0}):this._configSettingsModel.set({threshold_config_is_aggregate:!1})},_onKPIChange:function _onKPIChange(){this.hasNoLinkedServicesState||this.kpiModel.trigger("change")},_populateThresholdTemplatePicker:function _populateThresholdTemplatePicker(){var s=[];this.thresholdTemplateCollection&&((0,te.default)(this.thresholdTemplateCollection.models,(function(o){s.push({value:o.get("_key"),label:o.get("title")})})),this.selectItems=s,this.renderRadioControl())},_generateTemplate:function _generateTemplate(){var s={owner:Ge.USERS.DEFAULT_ADMIN,can_write:!0,perms:{write:[],read:[]},modifiable:!0,can_share_app:!0,can_share_global:!0,sharing:Ue.PERMISSIONS.APP,can_share_user:!0,can_change_perms:!0},o=this.kpiModel.get("adaptive_thresholding_training_window"),_=this.kpiModel.get("adaptive_thresholds_is_enabled"),S=this.kpiModel.get("time_variate_thresholds"),R=this.kpiModel.get("time_variate_thresholds_specification"),O=this.kpiModel.get("aggregate_outlier_detection_enabled"),P=this.kpiModel.get("outlier_detection_algo"),D=this.kpiModel.get("outlier_detection_sensitivity");return new pt.default({title:"",description:"",acl:s,sec_grp:We.GLOBAL_TEAM_KEY,adaptive_thresholding_training_window:o,time_variate_thresholds:S,adaptive_thresholds_is_enabled:_,time_variate_thresholds_specification:R,aggregate_outlier_detection_enabled:O,outlier_detection_algo:P,outlier_detection_sensitivity:D})},_exportTemplate:function _exportTemplate(){if(this.canWriteOnGlobalTeam){var s=this._generateTemplate(),o=function(s){var o=this.thresholdTemplateCollection.pluck("title");return(0,X.contains)(o,s)?{isValid:!1,message:(0,ue.gettext)("A template with this title already exists.")}:""===s.replace(/\s+/g,"")?{isValid:!1,message:(0,ue.gettext)("Title field is required.")}:{isValid:!0,message:""}}.bind(this),_=new jt({model:{savedPage:s,validate:o},objectNameSingular:s.objectNameSingular,onHiddenRemove:!0});_.render(),_.on("exportcomplete",s=>{this.thresholdTemplateCollection.fetch({data:{fields:He.DEFAULT_FIELDS_FOR_KPI_CONFIG}}).done(()=>{this._populateThresholdTemplatePicker();var o=s.id;this.kpiModel.set("kpi_threshold_template_id",o,{silent:!0}),this.radioControlModel.set("value",Ne.KPI_THRESHOLD_TEMPLATE_TYPES.TEMPLATE),this.renderRadioControl(),this._applyThresholdTemplate(o),this._setThresholdingTemplateState()}).fail(()=>{})})}},updateThresholdInKpiModel:function updateThresholdInKpiModel(s){if(this.kpiModel.unset("kpi_threshold_template_id"),s.isTimeVariateThresholds){var o=new ot.default((0,Z.default)(s.timeVariateThresholdsSpecification),{parse:!0});this.kpiModel.set({time_variate_thresholds_specification:o})}else if(s.thresholdType===Ne.KPI_THRESHOLD_TYPES.ENTITY){var _=new lt.default(JSON.parse(JSON.stringify((0,Z.default)(s.entityThresholdsConfig))),{parse:!0});this.kpiModel.set({entity_thresholds:_})}else{var S=new lt.default(JSON.parse(JSON.stringify((0,Z.default)(s.aggregateThresholdsConfig))),{parse:!0});this.kpiModel.set({aggregate_thresholds:S})}},render:function render(){if(!this.isServiceTemplate&&this.featureFlags&&this.featureFlags[Ve.featureFlagsStanzas.ENTITY_LEVEL_AT])return ce.default.unmountComponentAtNode(this.$el.get(0)),ce.default.render(de.default.createElement($.Provider,{store:Ct},de.default.createElement(Qe.default,null,de.default.createElement(Ze.default,{appsData:this.appsData,kpiModel:this.kpiModel,thresholdTemplateCollection:this.thresholdTemplateCollection,canWriteOnGlobalTeam:this.canWriteOnGlobalTeam,generateTemplate:this._generateTemplate.bind(this),updateThresholdInKpiModel:this.updateThresholdInKpiModel.bind(this)}))),this.$el.get(0)),this;var s=new rt.default({content:(0,ue.gettext)("Loading thresholding info..."),dataTestItsi:"kpi-thresholding-content-view-loading-message",style:{marginLeft:20},type:"info"});return(0,le.default)("body").append(this.loadingMask.render().el),this.$el.html(s.render().$el),this._renderKpiThresholdingContentView(),this._populateThresholdTemplatePicker(),this},_populateServiceSelector:function _populateServiceSelector(){for(var s=[],o=0;o<this.linkedServices.length;++o){var _=this.linkedServices[o];s.push({label:_.title,value:_._key})}this.serviceSelector=new et.default({controlType:"SyntheticSelect",controlOptions:{dataTestItsi:"kpi-thresholding-preview-service-select",items:s,model:this.previewModel,modelAttribute:"serviceId",style:{width:300},truncate:!0,typeAheadFilter:!0},dataTestItsi:"kpi-thresholding-preview-service-control-group",label:(0,ue.gettext)("Preview Service"),labelWidth:this.currPageLabelWidth}),s.length>0?(this.previewModel.set("serviceId",s[0].value),this.$(".thresholding-configure-preview-service").append(this.serviceSelector.render().$el)):this._renderNoServiceState()},_renderError:function _renderError(s,o){this._clearTimeVariantThresholdingView();var _=new rt.default({content:o,dataTestItsi:s,type:"error"});this.$(".thresholding-configure-error-state").html(_.render().$el),this.$(".thresholding-configure-error-state").show(),this.$(".thresholding-configure-aggregate-entity-toggle").hide(),this.$(".thresholding-default-container").hide(),this.$(".thresholding-configure-preview-service").hide(),this.$(".thresholding-time-policy-container").hide()},_renderNoServiceState:function _renderNoServiceState(){this.hasNoLinkedServicesState=!0,this._renderError("thresholding-configure-at-least-one-service-error-message",(0,ue.gettext)("At least one service must be linked to the service template to enable the preview."))},_renderNewKPIState:function _renderNewKPIState(){this.stopListening(this.previewKpiModel,"change"),this._renderError("thresholding-configure-no-kpi-yet-error-message",(0,ue.gettext)("Threshold previews cannot be displayed until this KPI is created in the linked services. After saving the service template and propagating the changes, threshold previews will appear here."))},_onSelectService:function _onSelectService(){var s=this.previewModel.get("serviceId");if(this.previewServiceModel&&this.previewServiceModel._key===s)this._updateKpiModel(this.previewServiceModel),this._repaint();else{var o=this.previewServiceCache&&this.previewServiceCache[s];o?(this.previewServiceModel=o,this._updateKpiModel(this.previewServiceCache[s]),this.isPreviewKpiModelReady=!0,this._repaint()):(this.previewServiceModel=new tt.default({_key:s}),this.previewServiceModel.fetch().done(function(){this.previewServiceCache&&(this.previewServiceCache[s]=this.previewServiceModel),this._updateKpiModel(this.previewServiceModel),this.isPreviewKpiModelReady=!0,this._repaint()}.bind(this)).fail((function(){})))}},_updateKpiModel:function _updateKpiModel(s){this.stopListening(this.previewKpiModel,"change"),this.previewKpiModel=(0,ie.default)(s.get("kpis").models,function(s){return this.kpiModel.get("title")===s.get("title")}.bind(this)),this.previewKpiModel&&(this.listenTo(this.previewKpiModel,"change",this._onKPIChange),this.listenTo(this.previewKpiModel.get("aggregate_thresholds"),"change",(function(){this._renderSingleThresholdingPreviewChart()})))},_clearTimeVariantThresholdingView:function _clearTimeVariantThresholdingView(){this.timeVariantThresholdingView&&this.timeVariantThresholdingView.remove()},handleRadioChange:function handleRadioChange(s){s===Ne.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM?(this.kpiModel.unset("kpi_threshold_template_id"),this.kpiModel.unset("is_threshold_template_option_selected"),this.kpiModel.set("is_recommended_time_policies",!1),this.kpiModel.set("was_recommendation_modified",!1),this.kpiModel.set("did_load_recommendation",!1),this.kpiModel.unset("keep_recommended_policy_static"),this.kpiModel.unset("recommendation_apply_to_value"),this.kpiModel.unset("recommendation_start_date"),this.kpiModel.unset("recommendation_training_window"),this.kpiModel.unset("threshold_direction"),this._removeRecommendedInfoViewAndRecommendationIcons()):s===Ne.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED?(this.kpiModel.set("is_recommended_time_policies",!0),this.kpiModel.unset("is_threshold_template_option_selected"),this.kpiModel.unset("kpi_threshold_template_id"),this.kpiModel.unset("keep_recommended_policy_staticc",Fe.RECOMMENDATION_APPLY_AS_OPTIONS[0].value),this.kpiModel.set("recommendation_apply_to_value",Fe.RECOMMENDATION_APPLY_TO_OPTIONS[0].value),this.kpiModel.set("recommendation_start_date",(0,xe.default)().subtract(Fe.ANALYSIS_WINDOW_OPTIONS[1].days,"days").unix()),this.kpiModel.set("recommendation_training_window",Fe.ANALYSIS_WINDOW_OPTIONS[1].value),this.kpiModel.set("threshold_direction",Fe.THRESHOLD_CONFIGURATION_OPTIONS[0].value)):(this.kpiModel.set("is_threshold_template_option_selected",!0),this.kpiModel.set("is_recommended_time_policies",!1),this.kpiModel.set("was_recommendation_modified",!1),this.kpiModel.set("did_load_recommendation",!1),this.kpiModel.unset("keep_recommended_policy_static"),this.kpiModel.unset("recommendation_apply_to_value"),this.kpiModel.unset("recommendation_start_date"),this.kpiModel.unset("recommendation_training_window"),this.kpiModel.unset("threshold_direction"),this._removeRecommendedInfoViewAndRecommendationIcons()),this.radioControlModel.set("value",s),s!==Ne.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED&&this.$(".thresholding-recommendation-error-container").get(0).children.length&&this._renderKpiThresholdingContentView()},handleSelectChange:function handleSelectChange(s){this.kpiModel.set("kpi_threshold_template_id",s)},handleApplyAsValueChange:function handleApplyAsValueChange(s){this.kpiModel.set("keep_recommended_policy_static",s),this.kpiModel.set("did_load_recommendation",!1)},handleApplyToValueChange:function handleApplyToValueChange(s){this.kpiModel.set("recommendation_apply_to_value",s),this.kpiModel.set("did_load_recommendation",!1)},handleAnalysisWindowChange:function handleAnalysisWindowChange(s){this.kpiModel.set("recommendation_training_window",s),this.kpiModel.set("did_load_recommendation",!1)},handleAnalysisWindowStartDateChange:function handleAnalysisWindowStartDateChange(s){this.kpiModel.set("recommendation_start_date",s),this.kpiModel.set("did_load_recommendation",!1)},handleThresholdConfigChange:function handleThresholdConfigChange(s){this.kpiModel.set("threshold_direction",s),this.kpiModel.set("did_load_recommendation",!1)},cleanupRecommendedThresholdsSearchJob:function cleanupRecommendedThresholdsSearchJob(){(0,De.cleanSearchJobSubscriptions)(this.searchJob,this.subscription,this.progressSubscription)},cleanupKPIThresholdDataSearchDataJob:function cleanupKPIThresholdDataSearchDataJob(){(0,De.cleanSearchJobSubscriptions)(this.KPIThresholdDataSearchJob,this.KPIThresholdDataSearchSubscription)},_createKPIThresholdDataSearchDataJob:function _createKPIThresholdDataSearchDataJob(){var s;this.cleanupKPIThresholdDataSearchDataJob();var o=xe.default.unix(this.kpiModel.get("recommendation_start_date")),_=o.clone(),S=this.kpiModel.get("recommendation_training_window").match(/\d+/g)[0];_.add(S,"days");var R=(0,$e.getMetricIndexEarliestTimeSearchForKPIData)([this.kpiModel.get("_key")]),O={id:(0,De.createUniqueSearchId)("kpi-thresholding-data-search"),search:R,earliest_time:"-".concat((0,xe.default)().diff(o,"day"),"d"),latest_time:(0,xe.default)().isSame(_,"day")?"now":"-".concat((0,xe.default)().diff(_,"day"),"d"),autostart:!0,auto_cancel:300},P={app:(0,Ie.getShortAppName)(!0),owner:ge.username};return this.KPIThresholdDataSearchJob=ke.default.create(O,P),new Promise((o,_)=>{this.KPIThresholdDataSearchSubscription=this.KPIThresholdDataSearchJob.getResults().subscribe({next:o=>{s=o},error:s=>{_(s)},complete:()=>{o(s)}})})},_createRecommendedThresholdsSearchJob:function _createRecommendedThresholdsSearchJob(){var s,o=xe.default.unix(this.kpiModel.get("recommendation_start_date")),_=o.clone(),S=this.kpiModel.get("recommendation_training_window").match(/\d+/g)[0];_.add(S,"days");var R=(0,$e.getRecommendedThresholdSearchForKPIs)([this.kpiModel.get("_key")],null,this.kpiModel.get("threshold_direction")),O={id:(0,De.createUniqueSearchId)("kpi-recommended-thresholds-search"),search:R,earliest_time:"-".concat((0,xe.default)().diff(o,"day"),"d"),latest_time:(0,xe.default)().isSame(_,"day")?"now":"-".concat((0,xe.default)().diff(_,"day"),"d"),autostart:!0,auto_cancel:300},P={app:(0,Ie.getShortAppName)(!0),owner:ge.username};return this.searchJob=ke.default.create(O,P),new Promise((o,_)=>{this.subscription=this.searchJob.getResults().subscribe({next:o=>{s=o},error:s=>{_(s)},complete:()=>{this._onThresholdRecommendationProgress(100,!0),o(s)}}),this.progressSubscription=this.searchJob.getProgress().subscribe({next:s=>{var o=(0,ae.default)(s,["content","doneProgress"],0);o>0&&this._onThresholdRecommendationProgress((0,Me.roundNumber)(100*o,1))}})})},_handleLoadRecommendationsConfirmationModalSearchJobStatusHandler:function _handleLoadRecommendationsConfirmationModalSearchJobStatusHandler(s,o){var _=arguments.length>2&&void 0!==arguments[2]&&arguments[2],S=(0,ue.gettext)("Loading recommendations will cause all existing threshold settings to be overwritten. Are you sure you want to load recommendations?");ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(Je.default,{hideCloseButton:!_,disablePrimaryClick:!_,disableCancelClick:!_,modalDataTestItsi:"load-recommendations-modal",cancelButtonDataTestItsi:"load-recommendations-modal-cancel-button",primaryButtonDataTestItsi:"load-recommendations-modal-confirm-button",showCancel:_,open:!0,title:(0,ue.gettext)("Load Recommendations"),primaryButtonLabel:(0,ue.gettext)("Confirm"),primaryButtonClicked:this._handleLoadRecommendations.bind(this)}," ",_&&S,s)),o.get(0))},_handleLoadRecommendations:function _handleLoadRecommendations(){this.isRecommendedThresholdSearchInProgress=!0,this._renderKpiThresholdingContentView(),this._onThresholdRecommendationProgress(1),this.cleanupRecommendedThresholdsSearchJob(),this.recommendedThresholdsSearchPromise=this._createRecommendedThresholdsSearchJob();var s=le.default.Deferred();this.recommendedThresholdsSearchPromise.then(o=>{var _,S;if(this.isRecommendedThresholdSearchInProgress=!1,!o||(0,ne.default)(o.results)||(0,ne.default)(o.fields)){var R="";o.messages&&(R=o.messages[0].text);var O=(0,pe.sprintf)((0,ue.gettext)("Recommendation failed to be generated. No results returned. %(searchMsg)s"),{searchMsg:R});return this._handleLoadRecommendationsErrorMessage(O),void s.reject()}if(o.results[0][Fe.RECOMMENDATION_FIELD]!==Fe.KPI_RECOMMENDATIONS.SUCCESSFUL&&o.results[0][Fe.RECOMMENDATION_FIELD]!==Fe.KPI_NO_RECOMMENDATIONS.NO_PATTERN.type)return this._handleLoadRecommendationsNoRecommendation(o.results[0][Fe.RECOMMENDATION_FIELD]),void s.reject();var P=o.fields.findIndex(s=>(0,re.default)(s.name,"Threshold Direction")),D=null!==(_=o.results)&&void 0!==_&&_.length?o.results[0][o.fields[P].name]:this.kpiModel.get("threshold_direction");if(this.recommendationResponse=o,o.results[0][Fe.RECOMMENDATION_FIELD]===Fe.KPI_NO_RECOMMENDATIONS.NO_PATTERN.type)return this.kpiModel.set({time_variate_thresholds:!1,aggregate_outlier_detection_enabled:!1,threshold_direction:D,threshold_recommendations:o.results}),this._configSettingsModel.set({adaptive_thresholds_is_enabled:!1}),void s.resolve(o);var N=o.fields.findIndex(s=>(0,re.default)(s.name,"Sensitivity")),V=Fe.OUTLIER_DEFAULT_DETECTION_SENSITIVITY;null!==(S=o.results)&&void 0!==S&&S.length&&(V=o.results[0][o.fields[N].name]===Fe.OUTLIER_NO_RECOMMENDATION?o.results[0][o.fields[N].name]:Number(o.results[0][o.fields[N].name])),V!==Fe.OUTLIER_NO_RECOMMENDATION?this.kpiModel.set({time_variate_thresholds:!0,aggregate_outlier_detection_enabled:!0,outlier_detection_algo:Fe.OUTLIER_RECOMMENDATION_DETECTION_ALGORITHM,outlier_detection_sensitivity:V,threshold_direction:D,threshold_recommendations:o.results}):this.kpiModel.set({time_variate_thresholds:!0,aggregate_outlier_detection_enabled:!1,threshold_direction:D,threshold_recommendations:o.results}),this._configSettingsModel.set({adaptive_thresholds_is_enabled:!0,adaptive_thresholding_training_window:this.kpiModel.get("recommendation_training_window")}),this.showAtConfigMessage=!0,this.recommendationResponse=o,s.resolve(o)}).catch(o=>{this.isRecommendedThresholdSearchInProgress=!1;var _=(0,pe.sprintf)((0,ue.gettext)("Error encountered while loading recommendations. %(error)s"),{error:o});this._handleLoadRecommendationsErrorMessage(_),s.reject(o)})},_showLoadRecommendationsConfirmModal:function _showLoadRecommendationsConfirmModal(){var s=this.kpiModel.get("recommendation_training_window").match(/\d+/g)[0],o=this.$(".thresholding-confirmation-dialog");ce.default.unmountComponentAtNode(o.get(0)),this._handleLoadRecommendationsConfirmationModalSearchJobStatusHandler(Nt,o,!1),this._createKPIThresholdDataSearchDataJob().then(_=>{var S=_.results.length?Math.ceil((new Date-1e3*Number(_.results[0].earliest_data_time))/864e5):0,R=S<Number(s)&&de.default.createElement(Pt,{type:"warning",appearance:"fill"},(0,pe.sprintf)((0,ue.gettext)("You have only %(data_range)d days of summary data for this KPI."),{data_range:S}));this._handleLoadRecommendationsConfirmationModalSearchJobStatusHandler(R,o,!0)}).catch(()=>{var s=de.default.createElement(Pt,{type:"error",appearance:"fill"},(0,ue.gettext)("Unable to identify KPI data for the number of days selected. Update the analysis window and try again."));this._handleLoadRecommendationsConfirmationModalSearchJobStatusHandler(s,o,!0)})},generateSeverityModel:function generateSeverityModel(s){var o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,S=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,R=new lt.default({},{parse:!0}),O=[],P=function _loop(s){var R=Array.isArray(N)?N:[N],P=Le.DEFAULT_SEVERITY_LEVELS.find(o=>o.severityLabel===s);if(P)for(var D of R){var V=void 0;V=o?{severityLabel:P.severityLabel,severityValue:P.severityValue,severityColor:P.severityColor,severityColorLight:P.severityColorLight,thresholdValue:D*S+_,dynamicParam:D}:{severityLabel:P.severityLabel,severityValue:P.severityValue,severityColor:P.severityColor,severityColorLight:P.severityColorLight,dynamicParam:0,thresholdValue:D},O.push(V)}};for(var[D,N]of Object.entries(s))P(D);if(o){O.sort((s,o)=>s.dynamicParam-o.dynamicParam);for(var V=0;V<O.length;V++)R.addThreshold(O[V])}else{O.sort((s,o)=>s.thresholdValue-o.thresholdValue);for(var j=0;j<O.length;j++)R.addThreshold(O[j])}if(this.kpiModel.get("threshold_direction")!==Fe.THRESHOLD_CONFIGURATION_OPTIONS[2].value){var K=Le.DEFAULT_SEVERITY_LEVELS[5];R.updateBaseSeverity({baseSeverityLabel:K.severityLabel,baseSeverityValue:K.severityValue,baseSeverityColor:K.severityColor,baseSeverityColorLight:K.severityColorLight},!0)}return R},_populateThresholdConfigFromRecommendations:function _populateThresholdConfigFromRecommendations(){if(this.recommendationResponse.results){var s=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Cron Expression")),o=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Duration")),_=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Thresholds")),S=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Algorithm")),R=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Confidence")),O=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Score")),P=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Time Policy")),D=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Mean")),N=this.recommendationResponse.fields.findIndex(s=>(0,re.default)(s.name,"Std"));if(this.recommendationResponse.results[0][Fe.RECOMMENDATION_FIELD]===Fe.KPI_NO_RECOMMENDATIONS.NO_PATTERN.type){var V=this.recommendationResponse.results[0][this.recommendationResponse.fields[_].name].replace(/'/g,'"'),j=JSON.parse(V),K=this.generateSeverityModel(j,!1);this.listenTo(K,"change",this._renderSingleThresholdingPreviewChart),this.kpiModel.set({aggregate_thresholds:K})}else{for(var W=this.kpiModel.get("time_variate_thresholds_specification"),U=new ht.default({_key:Ne.DEFAULT_POLICY_KEY,title:(0,ue.gettext)("Default"),time_blocks:[]}),Y=new ct.default([U]),$=0;$<this.recommendationResponse.results.length;$++){var X=(0,Me.generateUUID)(),Z=[[this.recommendationResponse.results[$][this.recommendationResponse.fields[s].name],parseInt(this.recommendationResponse.results[$][this.recommendationResponse.fields[o].name],10)]],Q=(0,je.getUserTimezoneOffset)("sec"),ee=(0,Ne.getPolicyTitleFromTimeBlock)(Z,Q),te=this.recommendationResponse.results[$][this.recommendationResponse.fields[_].name].replace(/'/g,'"'),ie=JSON.parse(te),ae=parseFloat(this.recommendationResponse.results[$][this.recommendationResponse.fields[D].name],0),ne=parseFloat(this.recommendationResponse.results[$][this.recommendationResponse.fields[N].name],0),se=this.generateSeverityModel(ie,!0,ae,ne),le=new ht.default({_key:X,title:ee,aggregate_thresholds:se,policy_type:this.recommendationResponse.results[$][this.recommendationResponse.fields[S].name],time_blocks:Z});Y.push(le)}W.set(W.parse({policies:JSON.parse(JSON.stringify(Y))}))}this.kpiModel.set({did_load_recommendation:!0}),this.kpiModel.set({was_recommendation_modified:!1}),this.showRecommendationIcon=!0,this._renderKpiThresholdingContentView(),this._loadRecommendedInfoView(this.recommendationResponse.results[0][this.recommendationResponse.fields[R].name],this.recommendationResponse.results[0][this.recommendationResponse.fields[O].name],this.recommendationResponse.results[0][this.recommendationResponse.fields[P].name],this.recommendationResponse.results[0][this.recommendationResponse.fields[S].name],this.kpiModel.toJSON())}},_loadRecommendedInfoView:function _loadRecommendedInfoView(s,o,_,S,R){var O=this.$(".thresholding-recommendation-info-container");ce.default.unmountComponentAtNode(O.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(Xe.default,{confidenceLevel:s,confidenceScore:o,timePolicyDesc:_,timePolicyType:S,kpiObj:R})),O.get(0))},_removeRecommendedInfoViewAndRecommendationIcons:function _removeRecommendedInfoViewAndRecommendationIcons(){var s=this.$(".thresholding-recommendation-info-container");ce.default.unmountComponentAtNode(s.get(0)),this.timeVariantRecommendationIcon.remove(),this.trainingRecommendationIcon.remove(),this.adaptiveRecommendationIcon.remove(),this.outlierRecommendationIcon.remove(),this.outlierAlgoRecommendationIcon.remove(),this.outlierSensitivityRecommendationIcon.remove()},_onThresholdRecommendationProgress:function _onThresholdRecommendationProgress(s,o){o&&(this.removeProgressBarTimeout&&clearTimeout(this.removeProgressBarTimeout),this.removeProgressBarTimeout=setTimeout(()=>{this._onThresholdRecommendationProgress(0),this._populateThresholdConfigFromRecommendations()},500));var _=this.$(".thresholding-recommendation-progress-control");ce.default.unmountComponentAtNode(_.get(0)),ce.default.render(de.default.createElement(ut.default,null,s>0&&de.default.createElement(de.default.Fragment,null,de.default.createElement(xt,{"data-test-itsi":"kpi-thresholding-recommendation-progress-text"},(0,pe.sprintf)((0,ue.gettext)("Loading recommended threshold configuration based on an analysis of your KPI..."))),de.default.createElement(be.default,{"data-test-itsi":"kpi-thresholding-recommendation-progress-bar",percentage:s,tooltip:(0,pe.sprintf)((0,ue.gettext)("%(percentage)s%% complete."),{percentage:s})}))),_.get(0))},_handleLoadRecommendationsNoRecommendation:function _handleLoadRecommendationsNoRecommendation(s){switch(s){case Fe.KPI_NO_RECOMMENDATIONS.CONSTANT_KPI.type:this._handleLoadRecommendationsErrorMessage((0,ue.gettext)("We detected a constant value in your data and are unable to recommend threshold values and settings."));break;case Fe.KPI_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.type:this._handleNoRecommendationInsufficientDataMessage();break;case Fe.KPI_NO_RECOMMENDATIONS.PATTERN_SWITCH.type:this._handleLoadRecommendationsErrorMessage((0,ue.gettext)("We could not detect a consistent pattern in your data. It appears that there is more than one pattern."));break;default:this._handleLoadRecommendationsErrorMessage((0,pe.sprintf)((0,ue.gettext)("No recommendations available due to unknown reason: %(reasonCode)s"),{reasonCode:s}))}},_handleNoRecommendationInsufficientDataMessage(){var s=this.$(".thresholding-recommendation-error-container");this._onThresholdRecommendationProgress(0),this.renderRadioControl(),ce.default.unmountComponentAtNode(s.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(wt,{src:(0,me.createStaticURL)("".concat(Fe.STATIC_IMAGES_BASE_URL).concat("disk.svg")),"data-test-itsi":"no-recommendation-insufficient-data-image"}),de.default.createElement(Mt,{"data-test-itsi":"no-recommendation-insufficient-data-header"},(0,ue.gettext)("Insufficient Data")),de.default.createElement(Ot,{"data-test-itsi":"no-recommendation-insufficient-data-msg"},(0,ue.gettext)("Your KPI does not have enough data for our system to produce targeted recommendations for the options you previously selected.")),de.default.createElement(Ot,{"data-test-itsi":"no-recommendation-insufficient-data-try-again-msg"},(0,ue.gettext)("Choose different options and try again."))),s.get(0))},_handleLoadRecommendationsErrorMessage:function _handleLoadRecommendationsErrorMessage(s){var o=this.$(".thresholding-recommendation-error-container");this._onThresholdRecommendationProgress(0),this.renderRadioControl(),ce.default.unmountComponentAtNode(o.get(0)),ce.default.render(de.default.createElement(ut.default,null,s&&de.default.createElement(Pt,{appearance:"fill",type:"error",onRequestRemove:this._renderKpiThresholdingContentView.bind(this)},s)),o.get(0))},_renderCustomThresholdWindowStatus:function _renderCustomThresholdWindowStatus(){var s=this.$(".kpi-thresholding-panel-custom-threshold-window-status");ce.default.unmountComponentAtNode(s.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(At,{"data-test-itsi":"kpi-thresholding-panel-custom-threshold-window-active-status-chip"},(0,ue.gettext)("Active")),de.default.createElement(Ee.default,{contentRelationship:"label",content:Lt,"data-test-itsi":"kpi-thresholding-panel-custom-threshold-window-active-status-tooltip"})),s.get(0));var o=this.kpiModel.get("active_custom_threshold_window");if(o){var _=this.$(".kpi-thresholding-panel-custom-threshold-window-link");ce.default.unmountComponentAtNode(_.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(ye.default,{"data-test-itsi":"view-custom-threshold-windows-link",openInNewContext:!0,to:(0,qe.uiEditURL)({id:o})},(0,pe.sprintf)((0,ue.gettext)("View %(objectName)s"),{objectName:Ye.OBJECT_NAMES.singular}))),_.get(0))}},renderRadioControl:function renderRadioControl(){if(this.$(".thresholding-template-radio-control").length>0){var s=!1,o=!0,_=this.featureFlags&&this.featureFlags[Ve.featureFlagsStanzas.ENTITY_LEVEL_AT];(0,te.default)(Re.PYTHON_SCIENTIFIC_APP_NAMES,_=>{this.appsData&&this.appsData[_]&&this.appsData[_].isInstalled&&(s=!0,this.appsData[_].isDisabled||(o=!1))}),this.radioControlModel.get("value")===Ne.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDATION&&(!this.kpiModel.has("keep_recommended_policy_staticc")||this.kpiModel.set("keep_recommended_policy_static",Fe.RECOMMENDATION_APPLY_AS_OPTIONS[0].value),!this.kpiModel.has("recommendation_apply_to_value")||this.kpiModel.set("recommendation_apply_to_value",Fe.RECOMMENDATION_APPLY_TO_OPTIONS[0].value),!this.kpiModel.has("recommendation_training_window")||this.kpiModel.set("recommendation_training_window",Fe.ANALYSIS_WINDOW_OPTIONS[1].value),!this.kpiModel.has("recommendation_start_date")||this.kpiModel.set("recommendation_start_date",(0,xe.default)().subtract(Fe.ANALYSIS_WINDOW_OPTIONS[1].days,"days").unix()),!this.kpiModel.has("threshold_direction")||this.kpiModel.set("threshold_direction",Fe.THRESHOLD_CONFIGURATION_OPTIONS[0].value)),ce.default.unmountComponentAtNode(this.$(".thresholding-template-radio-control").get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(vt.default,{analysisWindowValue:this.kpiModel.get("recommendation_training_window"),analysisWindowStartDate:this.kpiModel.get("recommendation_start_date"),canWriteOnGlobalTeam:this.canWriteOnGlobalTeam,exportAction:this._exportTemplate.bind(this),hasTimeVariateThresholds:this.kpiModel.get("time_variate_thresholds"),hideRecommendedThresholding:this.hideRecommendedThresholding,isPSCDisabled:o,isPSCInstalled:s,isRecommendedThresholdSearchInProgress:this.isRecommendedThresholdSearchInProgress,onAnalysisWindowChange:this.handleAnalysisWindowChange.bind(this),onAnalysisWindowStartDateChange:this.handleAnalysisWindowStartDateChange.bind(this),onApplyAsValueChange:this.handleApplyAsValueChange.bind(this),onApplyToValueChange:this.handleApplyToValueChange.bind(this),onLoadRecommendationsClick:this._showLoadRecommendationsConfirmModal.bind(this),onRadioChange:this.handleRadioChange.bind(this),onSelectChange:this.handleSelectChange.bind(this),onThresholdConfigChange:this.handleThresholdConfigChange.bind(this),radioValue:this.radioControlModel.get("value"),recommendationApplyAsValue:this.kpiModel.get("keep_recommended_policy_static"),recommendationApplyToValue:this.kpiModel.get("recommendation_apply_to_value"),selectValue:this.kpiModel.get("kpi_threshold_template_id"),selectOptions:this.selectItems,showEntityLevelAdaptiveThresholding:_,thresholdConfigValue:this.kpiModel.get("threshold_direction")})),this.$(".thresholding-template-radio-control").get(0))}},_renderAdaptiveThresholdingExplanation:function _renderAdaptiveThresholdingExplanation(){var s=this.$(".thresholding-adaptive-thresholding-explanation");s.length&&(ce.default.unmountComponentAtNode(s.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(kt,{"data-test-itsi":"thresholding-adaptive-thresholding-explanation",as:"span",variant:"smallBody",weight:400},(0,ue.gettext)("Adaptive Thresholding runs everyday around midnight and updates the thresholding for the KPI based on the settings below. Once updated, old thresholds cannot be recovered."))),s.get(0)))},_renderApplyATControls:function _renderApplyATControls(){var s=this.$(".thresholding-apply-adaptive-thresholding"),o=this.kpiModel;this.isServiceTemplate&&(o=this.previewKpiModel),o&&s.length&&ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(Tt.default,{kpiModel:o,thresholdSpec:this.kpiModel.get("time_variate_thresholds_specification"),configSettingsModel:this._configSettingsModel,featureFlags:this.featureFlags,showAtConfigMessage:this.showAtConfigMessage&&!this.configMessageAlreadySeen,onConfigChangeDismiss:this.handleConfigChangeDismiss,loadingMaskHandler:this.loadingMaskHandler})),s.get(0))},_removeApplyAtControls:function _removeApplyAtControls(){var s=this.$(".thresholding-apply-adaptive-thresholding");s.length&&ce.default.unmountComponentAtNode(s.get(0))},_renderKpiThresholdingContentView:function _renderKpiThresholdingContentView(){if(this.$el.html(this.compiledTemplate({canWriteOnGlobalTeam:this.canWriteOnGlobalTeam,isServiceTemplate:this.isServiceTemplate},{variable:"vars"})),this.service.get("object_type")===Ke.OBJECT_TYPE&&(0,$e.hasActiveCustomThresholdWindow)(this.kpiModel.toJSON())?(this._renderCustomThresholdWindowStatus(),this.$(".kpi-thresholding-panel-custom-threshold-window-content").removeClass("hide")):this.$(".kpi-thresholding-panel-custom-threshold-window-content").addClass("hide"),this.renderRadioControl(),!this.isRecommendedThresholdSearchInProgress){var s=this.kpiModel.get("kpi_threshold_template_id");if(s&&s!==Ne.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM&&this.thresholdTemplateCollection){var o=this.thresholdTemplateCollection.filter(o=>o.get("_key")===s);if(o&&!o.length){var _=new pt.default({_key:s});_.fetch().done(()=>{this._renderControlsFromTemplate(_)})}else this._renderControlsFromTemplate(o[0])}this._renderTrainingControls(),this.showRecommendationIcon&&(this.aggregateEntityConfigureControl=this.createThresholdControlTabs()),this.$(".thresholding-configure-aggregate-entity-toggle").append(this.aggregateEntityConfigureControl),this._toggleAggregateEntitySelector(),this._toggleThresholdingConfigSettings(),this.isServiceTemplate||(this.$(".thresholding-configure-error-state").hide(),this.singleThresholdingView&&this.singleThresholdingView.remove(),this._renderSingleThresholdingPreviewChart(),this.singleThresholdingView=new this.KpiSingleThresholdingView({kpiModel:this.kpiModel,service:this.service,configSettingsModel:this._configSettingsModel,aggregateThresholdModel:this.kpiModel.getThresholdSettingModel(Ne.KPI_THRESHOLD_TYPES.AGGREGATE),entityThresholdModel:this.kpiModel.getThresholdSettingModel(Ne.KPI_THRESHOLD_TYPES.ENTITY)}),this.$(".thresholding-default-settings").html("")),this.$(".thresholding-default-settings").html(this.singleThresholdingView.render().$el),this._toggleTimeVariantThresholdingView(),this.isServiceTemplate&&this._populateServiceSelector(),this._setThresholdingTemplateState()}return this},_renderSingleThresholdingPreviewChart:(0,Q.default)((function(){var s;this.isServiceTemplate||!this.singleThresholdingSummaryIndexCheckComplete||null!==(s=this.kpiModel)&&void 0!==s&&s.get("time_variate_thresholds")||(this.singleThresholdingPreviewChart||(this.singleThresholdingPreviewChart=new St.default({kpiModel:this.kpiModel,configSettingsModel:this._configSettingsModel,getTimeInIso:!0,useRawSearch:this.singleThresholdingUseRawSearch})),this.$(".thresholding-default-preview").html(""),this.$(".thresholding-default-preview").html(this.singleThresholdingPreviewChart.render().$el))})),checkSingleThresholdingShouldUseRawSearch:function checkSingleThresholdingShouldUseRawSearch(){this.summaryIndexSearchJobDetails&&(0,De.cleanSearchJobSubscriptions)(this.summaryIndexSearchJobDetails.searchJob,this.summaryIndexSearchJobDetails.subscription),this.summaryIndexSearchJobDetails=(0,Ne.checkSummaryIndexForKpiData)(this.kpiModel.get("_key"),"single-thresholding-preview"),this.summaryIndexSearchJobDetails&&Promise.all([this.summaryIndexSearchJobDetails.promise]).then(s=>{this.singleThresholdingUseRawSearch=!s.length||(0,Ne.checkShouldUseRawSearch)(s[0]),this.singleThresholdingSummaryIndexCheckComplete=!0,this._renderSingleThresholdingPreviewChart()}).catch(()=>{this.singleThresholdingUseRawSearch=!0,this.singleThresholdingSummaryIndexCheckComplete=!0,this._renderSingleThresholdingPreviewChart()})},_renderControlsFromTemplate:function _renderControlsFromTemplate(s){this._configSettingsModel.set("adaptive_thresholding_training_window",s.get("adaptive_thresholding_training_window"),{silent:!0}),this._configSettingsModel.set("adaptive_thresholds_is_enabled",s.get("adaptive_thresholds_is_enabled"),{silent:!0}),this._toggleAdaptiveThresholdingControls(),this._setThresholdingTemplateState()},_setThresholdingTemplateState:function _setThresholdingTemplateState(){var s=this.kpiModel.get("kpi_threshold_template_id");s&&s!==Ne.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM?this._disableAllThresholdControls():this._enableAllThresholdControls(),this.renderRadioControl();var o=this.featureFlags&&this.featureFlags[Ve.featureFlagsStanzas.AT_OUTLIER_REMOVAL];!this.isServiceTemplate&&o&&this._configSettingsModel.get("adaptive_thresholds_is_enabled")&&this._renderOutlierDetectionControls()},_disableAllThresholdControls:function _disableAllThresholdControls(){this.timeVariantEnableDisableControlDomRef.toggleSwitchControl(!1,this.kpiModel.get("time_variate_thresholds")),this.adaptiveThresholdEnableDisableControlDomRef.toggleSwitchControl(!1,this._configSettingsModel.get("adaptive_thresholds_is_enabled")),this.kpiTrainingEarliestTimePicker.disable()},_enableAllThresholdControls:function _enableAllThresholdControls(){this.timeVariantEnableDisableControlDomRef.toggleSwitchControl(!0,this.kpiModel.get("time_variate_thresholds")),this.adaptiveThresholdEnableDisableControlDomRef.toggleSwitchControl(!0,this._configSettingsModel.get("adaptive_thresholds_is_enabled")),this.kpiTrainingEarliestTimePicker.enable(),this._toggleAdaptiveThresholdingControls()},remove:function remove(){return this.cleanupKPIThresholdDataSearchDataJob(),this.summaryIndexSearchJobDetails&&(0,De.cleanSearchJobSubscriptions)(this.summaryIndexSearchJobDetails.searchJob,this.summaryIndexSearchJobDetails.subscription),this.singleThresholdingPreviewChart&&this.singleThresholdingPreviewChart.remove(),this.singleThresholdingView&&this.singleThresholdingView.remove(),this.timeVariantThresholdingView&&this.timeVariantThresholdingView.remove(),this.serviceSelector&&this.serviceSelector.remove(),this._removeApplyAtControls(),oe.default.View.prototype.remove.apply(this,arguments)},_applyThresholdTemplate:function _applyThresholdTemplate(s){var o=this.thresholdTemplateCollection.get(s),_=o.get("time_variate_thresholds_specification"),S=this.kpiModel.get("time_variate_thresholds_specification");S.set(S.parse({policies:JSON.parse(JSON.stringify(_.get("policies")))})),this.kpiModel.set("kpi_threshold_template_id",s),this._configSettingsModel.set("adaptive_thresholding_training_window",o.get("adaptive_thresholding_training_window")),this.kpiModel.set("time_variate_thresholds",o.get("time_variate_thresholds")),this.kpiModel.get("time_variate_thresholds")&&this._renderTimeVariantThresholdView(),this._configSettingsModel.set("adaptive_thresholds_is_enabled",o.get("adaptive_thresholds_is_enabled")),this.kpiModel.set("aggregate_outlier_detection_enabled",o.get("aggregate_outlier_detection_enabled")),this.kpiModel.set("outlier_detection_algo",o.get("outlier_detection_algo")),this.kpiModel.set("outlier_detection_sensitivity",o.get("outlier_detection_sensitivity")),this._toggleAdaptiveThresholdingControls(),this._setThresholdingTemplateState()},_changeThresholdTemplate:function _changeThresholdTemplate(s,o,_){if(!o)return this._setThresholdingTemplateState(),void this._renderTimeVariantThresholdView();if(!_||!_.isExport&&!_.isApply){var S=new rt.default({appearance:"fill",content:de.default.createElement("div",null,(0,ue.gettext)("The threshold time policies will be applied in UTC. If you want the threshold time policies to be applied in your local timezone, clone this template using your timezone and then apply it.")," ",de.default.createElement(ye.default,{"data-test-itsi":"clone-kpi-threshold-template-link",openInNewContext:!0,to:ze.uiListerURL},(0,ue.gettext)("Clone Threshold Template")),"."),dataTestItsi:"kpi-threshold-template-apply-info-message",style:{marginTop:20},type:"info"}),R=this.thresholdTemplateCollection.get(o),O=(0,le.default)('<div class="apply-thresholding-react-modal-container"></div>');ce.default.unmountComponentAtNode(O.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(Je.default,{modalDataTestItsi:"apply-threshold-template-modal",cancelButtonDataTestItsi:"threshold-template-modal-cancel-button",primaryButtonDataTestItsi:"threshold-template-modal-apply-button",showCancel:!0,open:!0,modalStyles:Ae.CONFIRMATION_MODAL_STYLE,title:(0,ue.gettext)("Apply Threshold Template"),primaryButtonLabel:(0,ue.gettext)("Apply"),primaryButtonClicked:(()=>{this.kpiModel.get("is_entity_breakdown")&&this._configSettingsModel.set("threshold_config_is_aggregate",!0),this._applyThresholdTemplate(o)}).bind(this),secondaryButtonClicked:(()=>{var o=s.previous("kpi_threshold_template_id");s.set("kpi_threshold_template_id",o,{silent:!0}),this.renderRadioControl()}).bind(this)},de.default.createElement("span",{"data-test-itsi":"threshold-template-modal-apply-message"},(0,ue.gettext)("All existing threshold settings will be discarded. Are you sure you want to apply template?"),R.get("_immutable")&&S.getComponent()))),O.get(0))}},_toggleAggregateEntitySelector:function _toggleAggregateEntitySelector(){this.kpiModel.get("is_entity_breakdown")?this.aggregateEntityConfigureControl.show():(this._configSettingsModel.set("threshold_config_is_aggregate",!0),this.aggregateEntityConfigureControl.hide())},_renderTrainingControls:function _renderTrainingControls(){this.$(".thresholding-enable-time-policy-control").append(this.enableTimeVariantControl),this.$(".thresholding-enable-adaptive-thresholding").append(this.enableAdaptiveThresholdControl),this._renderAdaptiveThresholdingExplanation(),this.$(".thresholding-adaptive-thresholding-training").append(this.kpiTrainingEarliestTimePicker.render().$el),this._toggleAdaptiveThresholdingControls(),this.showRecommendationIcon&&(this.$('.thresholding-enable-time-policy-control [data-test-itsi="kpi-thresholding-time-policies-control-group"] label[data-test="label"]').prepend(this.timeVariantRecommendationIcon.render().$el),this.$('.thresholding-enable-adaptive-thresholding [data-test-itsi="kpi-thresholding-adaptive-thresholding-control-group"] label[data-test="label"]').prepend(this.adaptiveRecommendationIcon.render().$el),this.$('.thresholding-adaptive-thresholding-training [data-test-itsi="kpi-adaptive-training-time-control-group"] label[data-test="label"]').prepend(this.trainingRecommendationIcon.render().$el)),this.$(".kpi-thresholding-panel-config-container",this.$el).css("visibility","visible")},_changePoliciesToStatic:function _changePoliciesToStatic(){this.timeVariantThresholdingView&&this.timeVariantThresholdingView.remove();for(var s=this.kpiModel.get("time_variate_thresholds_specification").get("policies"),o=0;o<s.length;++o)s.at(o).set("policy_type","static");this._renderTimeVariantThresholdView()},_toggleAdaptiveThresholdingControls:function _toggleAdaptiveThresholdingControls(){this.kpiModel.get("time_variate_thresholds")?(this.adaptiveThresholdEnableDisableControlDomRef.toggleSwitchControl(!0,this._configSettingsModel.get("adaptive_thresholds_is_enabled")),this.kpiModel.get("adaptive_thresholds_is_enabled")?(this.kpiTrainingEarliestTimePicker.$el.show(),this.$(".thresholding-adaptive-thresholding-explanation").show(),this.$(".thresholding-enable-outlier-detection").show(),this.$(".thresholding-apply-adaptive-thresholding").show()):(this.kpiTrainingEarliestTimePicker.$el.hide(),this.$(".thresholding-adaptive-thresholding-explanation").hide(),this.$(".thresholding-enable-outlier-detection").hide(),this.$(".thresholding-apply-adaptive-thresholding").hide())):(this.adaptiveThresholdEnableDisableControlDomRef.toggleSwitchControl(!1,this._configSettingsModel.get("adaptive_thresholds_is_enabled")),this.kpiTrainingEarliestTimePicker.$el.hide(),this.$(".thresholding-adaptive-thresholding-explanation").hide(),this.$(".thresholding-enable-outlier-detection").hide(),this.$(".thresholding-apply-adaptive-thresholding").hide())},_onOutlierDetectionSettingsChange:function _onOutlierDetectionSettingsChange(s,o){var _={aggregate_outlier_detection_enabled:this.kpiModel.get("aggregate_outlier_detection_enabled")||!1,outlier_detection_algo:this.kpiModel.get("outlier_detection_algo")||Fe.OUTLIER_DEFAULT_DETECTION_ALGORITHM,outlier_detection_sensitivity:this.kpiModel.get("outlier_detection_sensitivity")||Fe.OUTLIER_DEFAULT_DETECTION_SENSITIVITY};Ke.TOGGLE_OUTLIER_TYPES[o]&&(_[Ke.TOGGLE_OUTLIER_TYPES[o]]=s),this.kpiModel.set(_)},_createKpiAlertingSwitchControl:function _createKpiAlertingSwitchControl(){var s=this.kpiModel.get("aggregate_thresholds_alert_enabled"),o=(0,le.default)("<div></div>").css({display:"inline-block","vertical-align":"top"});return ce.default.unmountComponentAtNode(o.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(ft.default,{enabled:s,onChange:this._onEnableDisableAlerting,size:"medium",isEntityBreakDown:this.kpiModel.get("is_entity_breakdown")})),o.get(0)),s&&(this.$(".kpi-alerting-options").show(),this.$(".kpi-alerting-options").html(this._createKpiAlertingOptions())),o},_renderOutlierDetectionControls:function _renderOutlierDetectionControls(){var s=this.kpiModel.get("aggregate_outlier_detection_enabled"),o=this.kpiModel.get("outlier_detection_algo"),_=this.kpiModel.get("outlier_detection_sensitivity"),S=this.radioControlModel.get("value")===Ne.KPI_THRESHOLD_TEMPLATE_TYPES.TEMPLATE,R=this.$(".thresholding-enable-outlier-detection").css({display:"inline-block","vertical-align":"top"});return ce.default.unmountComponentAtNode(R.get(0)),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(mt.default,{enabled:s,algo:o,sensitivity:_,onChange:this._onOutlierDetectionSettingsChange,size:"medium",controlsDisabled:S,showRecommendationIcon:this.showRecommendationIcon})),R.get(0)),this.showRecommendationIcon&&(this.$('.thresholding-enable-outlier-detection [data-test-itsi="kpi-outlier-detection-control-group"] label[data-test="label"]').prepend(this.outlierRecommendationIcon.render().$el),this.$('.thresholding-enable-outlier-detection [data-test-itsi="kpi-outlier-detection-algo-control-group"] label[data-test="label"]').prepend(this.outlierAlgoRecommendationIcon.render().$el),this.$('.thresholding-enable-outlier-detection [data-test-itsi="kpi-outlier-detection-sensitivity-control-group"] label[data-test="label"]').prepend(this.outlierSensitivityRecommendationIcon.render().$el)),R},_createKpiAlertingOptions:function _createKpiAlertingOptions(){var s=(0,le.default)("<div></div>");ce.default.unmountComponentAtNode(s.get(0));var o=this.kpiModel.get("aggregate_thresholds_custom_alert_rules"),_=2;return o&&this.kpiModel.get("aggregate_thresholds_custom_alert_enabled")&&0!==o.length||(_=1),ce.default.render(de.default.createElement(ut.default,null,de.default.createElement(gt.default,{selectedAdvancedOption:_,getCurrentRules:this.getCurrentRules,getAvailableSeverityValues:this.getAvailableSeveritiesForDropdown,handleKpiAlertingOptionChange:this.handleKpiAlertingOptionChange,addOrUpdateRuleToKpiModel:this.addOrUpdateRuleToKpiModel,removeRuleFromKpiModel:this.removeRuleFromKpiModel,removeAndAddRuleToKpiModel:this.removeAndAddRuleToKpiModel})),s.get(0)),s},handleKpiAlertingOptionChange:function handleKpiAlertingOptionChange(s){2===s?(this.kpiModel.set({aggregate_thresholds_custom_alert_enabled:!0}),this.addOrUpdateRuleToKpiModel("critical",["high","medium","low","normal","info"]),this.$(".kpi-alerting-custom-rules").show(),this.$(".kpi-alerting-add-rule").show()):(this.kpiModel.set({aggregate_thresholds_custom_alert_rules:[],aggregate_thresholds_custom_alert_enabled:!1}),this.$(".kpi-alerting-custom-rules").hide(),this.$(".kpi-alerting-add-rule").hide())},getCurrentRules:function getCurrentRules(){return this.kpiModel.get("aggregate_thresholds_custom_alert_rules")},getAvailableSeveritiesForDropdown:function getAvailableSeveritiesForDropdown(){var s=(0,Ne.getSortedThresholdValues)(),o=(0,se.default)(s,(function(s){return s.value})),_=(0,se.default)(this.kpiModel.get("aggregate_thresholds_custom_alert_rules"),(function(s){return s.change_to}));return(0,ee.default)(o,_)},addOrUpdateRuleToKpiModel:function addOrUpdateRuleToKpiModel(s,o){var _=JSON.parse(JSON.stringify(this.kpiModel.get("aggregate_thresholds_custom_alert_rules")));(0,ie.default)(_,(function(_){return _.change_to===s&&(_.change_from=o,!0)}))||_.push({change_to:s,change_from:o}),this.kpiModel.set({aggregate_thresholds_custom_alert_rules:_})},removeAndAddRuleToKpiModel:function removeAndAddRuleToKpiModel(s,o){this.removeRuleFromKpiModel(s),this.addOrUpdateRuleToKpiModel(o,[])},removeRuleFromKpiModel:function removeRuleFromKpiModel(s){var o=this.kpiModel.get("aggregate_thresholds_custom_alert_rules").filter(o=>o.change_to!==s);this.kpiModel.set({aggregate_thresholds_custom_alert_rules:o})},_onEnableDisableAlerting:function _onEnableDisableAlerting(s){s?(this.kpiModel.set({aggregate_thresholds_alert_enabled:!0}),this.$(".kpi-alerting-options").show(),this.$(".kpi-alerting-options").html(this._createKpiAlertingOptions())):(this.kpiModel.set({aggregate_thresholds_alert_enabled:!1}),this.$(".kpi-alerting-options").hide(),this.$(".kpi-alerting-custom-rules").hide())},_toggleThresholdingConfigSettings:function _toggleThresholdingConfigSettings(){var s=this.service.get("object_type"),o=s===Ke.OBJECT_TYPE||s===Be.OBJECT_TYPE,_=this.featureFlags&&this.featureFlags[Ve.featureFlagsStanzas.AT_OUTLIER_REMOVAL];this._renderSingleThresholdingPreviewChart(),o&&this._configSettingsModel.get("threshold_config_is_aggregate")?(this.$(".thresholding-configure-settings").show(),this._renderApplyATControls(),this.$(".kpi-alerting-enable-disable-control").html(this._createKpiAlertingSwitchControl()),!this.isServiceTemplate&&_&&this._renderOutlierDetectionControls(),this._toggleAdaptiveThresholdingControls()):this.$(".thresholding-configure-settings").hide()},_toggleTimeVariantThresholdingView:function _toggleTimeVariantThresholdingView(){this.hasNoLinkedServicesState||(this.kpiModel.get("time_variate_thresholds")?(this._renderTimeVariantThresholdView(),this.$(".thresholding-time-policy-container").show(),this.$(".thresholding-default-container").hide()):(this._configSettingsModel.set("adaptive_thresholds_is_enabled",!1),this.$(".thresholding-time-policy-container").hide(),this.timeVariantThresholdingView&&this.timeVariantThresholdingView.remove(),this.$(".thresholding-default-container").show()),this._toggleAdaptiveThresholdingControls())},_repaint:function _repaint(){this.kpiModel.get("time_variate_thresholds")?(this._renderTimeVariantThresholdView(),this._renderApplyATControls()):this._renderAggregateThresholdView()},_renderTimeVariantThresholdView:(0,Q.default)((function(){this.$(".thresholding-configure-error-state").hide(),this.timeVariantThresholdingView&&this.timeVariantThresholdingView.remove();var s=this.kpiModel.get("kpi_threshold_template_id"),o=s&&s!==Ne.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM,_=this.kpiModel,S=this.service;if(this.isServiceTemplate){if(_=this.previewKpiModel,S=this.previewServiceModel,!this.previewKpiModel)return void this._renderNewKPIState();if(this.previewServiceModel.get("object_type")===Be.OBJECT_TYPE)return void this._renderNoServiceState()}this.timeVariantThresholdingView=new this.KpiTimeVariantThresholdingView({kpiModel:_,service:S,configSettingsModel:this._configSettingsModel,timeVariantThresholdModel:this.kpiModel.get("time_variate_thresholds_specification"),disableAllControls:o,previewMode:this.isServiceTemplate,isServiceTemplate:this.isServiceTemplate,isPreviewKpiModelReady:this.isPreviewKpiModelReady,featureFlags:this.featureFlags}),this.$(".thresholding-time-policy-container").html(""),this.$(".thresholding-time-policy-container").append(this.timeVariantThresholdingView.render().$el),this._setThresholdingTemplateState()})),_renderAggregateThresholdView:(0,Q.default)((function(){this.$(".thresholding-configure-error-state").hide(),this.singleThresholdingView&&this.singleThresholdingView.remove(),this.previewKpiModel?(this._renderSingleThresholdingPreviewChart(),this.singleThresholdingView=new this.KpiSingleThresholdingView({kpiModel:this.previewKpiModel,service:this.previewServiceModel,configSettingsModel:this._configSettingsModel,aggregateThresholdModel:this.kpiModel.getThresholdSettingModel(Ne.KPI_THRESHOLD_TYPES.AGGREGATE),entityThresholdModel:this.kpiModel.getThresholdSettingModel(Ne.KPI_THRESHOLD_TYPES.ENTITY)}),this.$(".thresholding-default-settings").html(""),this.$(".thresholding-default-settings").html(this.singleThresholdingView.render().$el)):this._renderNewKPIState()}))}),jt=dt.default.extend({initialize:function initialize(){dt.default.prototype.initialize.apply(this,arguments),this.children.titleField=new et.default({controlType:"Text",controlOptions:{dataTestItsi:"threshold-template-title-text",modelAttribute:"title",model:this.model.working},dataTestItsi:"kpi-threshold-template-title-control-group",label:(0,ue.gettext)("Title"),required:!0});var s=this;this.model.savedPage.on("change:title",(function(){s.trigger("exportcomplete",this)}))},onSaveEditTitleSave:function onSaveEditTitleSave(){var s=this.model.working.get("title"),o=this.model.validate(s);o.isValid?dt.default.prototype.onSaveEditTitleSave.apply(this,arguments):this.children.titleField.error(Pe.NO_EMPTY_TITLE_MESSAGE)}});o.default=Vt;s.exports=o.default},1470:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(17)),D=S(_(16)),N=S(_(21)),V=S(_(19)),j=S(_(20)),K=S(_(8)),W=S(_(7)),U=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),Y=S(_(3)),$=S(_(39)),X=S(_(2)),Z=S(_(44)),Q=S(_(113)),ee=S(_(103)),te=_(4),ie=_(61);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,V.default)(o),(0,N.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,V.default)(s).constructor):o.apply(s,_))}_(28);var ae=(0,X.default)(Q.default)(R||(R=(0,W.default)(["\n\tpadding-left: 0;\n"]))),ne=(0,X.default)(ee.default)(O||(O=(0,W.default)(["\n\tpadding: 0;\n\tdisplay: inline-block;\n\tvertical-align: bottom;\n"]))),re=function(s){function KpiAlertingToggleControl(s){var o;(0,D.default)(this,KpiAlertingToggleControl);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,KpiAlertingToggleControl,[s,...S]),(0,K.default)(o,"handleClick",(s,_)=>{var S=!_.value;o.setState({isSelected:S}),o.props.onChange(S)}),(0,K.default)(o,"render",()=>{var{isReadOnly:s,size:_,tooltipContent:S}=o.props,R=!!o.state.isSelected;return U.default.createElement(U.Fragment,null,U.default.createElement(Z.default,{"data-test-itsi":s?"kpi-alerting-read-only-control-group":"kpi-alerting-control-group",label:(0,te.gettext)("Enable KPI Alerting"),labelWidth:ie.LABEL_WIDTHS.Massive,tooltip:s?null:S},s?U.default.createElement(ae,{"data-test-itsi":"kpi-alerting-read-only-value"},R?(0,te.gettext)("Yes"):(0,te.gettext)("No")):U.default.createElement(ne,{"data-test-itsi":"kpi-alerting-control-switch",value:R,appearance:"toggle",selected:R,onClick:o.handleClick,size:_})))}),o.state={isSelected:o.props.enabled},o}return(0,j.default)(KpiAlertingToggleControl,s),(0,P.default)(KpiAlertingToggleControl)}(U.Component);(0,K.default)(re,"propTypes",{onChange:Y.default.func.isRequired,enabled:Y.default.bool,isReadOnly:Y.default.bool,size:Y.default.string,tooltipContent:Y.default.string}),(0,K.default)(re,"defaultProps",{enabled:!1,onChange:$.default,size:"small",isReadOnly:!1,tooltipContent:(0,te.gettext)("If enabled, the KPI generates alerts for changes in severity.")});o.default=re;s.exports=o.default},1471:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V=S(_(17)),j=S(_(16)),K=S(_(21)),W=S(_(19)),U=S(_(20)),Y=S(_(8)),$=S(_(7)),X=S(_(3)),Z=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),Q=S(_(2)),ee=S(_(27)),te=S(_(369)),ie=S(_(113)),ae=S(_(283)),ne=_(22),re=_(4),se=S(_(2701));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,W.default)(o),(0,K.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,W.default)(s).constructor):o.apply(s,_))}_(28);var le=(0,Q.default)(ee.default)(R||(R=(0,$.default)(["\n\tcolor: ",";\n\tmargin-top: 10px;\n"])),ne.variables.linkColor),oe=(0,Q.default)(ie.default)(O||(O=(0,$.default)(["\n\tpadding-left: 0;\n"]))),de=(0,Q.default)(te.default)(P||(P=(0,$.default)(["\n\tdisplay: block!important;\n"]))),ce=(0,Q.default)(te.default.Option)(D||(D=(0,$.default)(["\n\tdisplay: inline-flex;\n\tpadding-right: 20px;\n"]))),he=(0,Q.default)(te.default.Option)(N||(N=(0,$.default)(["\n\tdisplay: inline-flex;\n\tposition: absolute;\n"]))),ue=Z.default.createElement(ae.default,null),pe=function(s){function KpiAlertingAdvancedOptionsView(s){var o;(0,j.default)(this,KpiAlertingAdvancedOptionsView);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,KpiAlertingAdvancedOptionsView,[s,...S]),(0,Y.default)(o,"shouldShowRules",s=>2===s),(0,Y.default)(o,"handleOptionChange",(s,_)=>{var{value:S}=_,R={value:S};o.props.handleKpiAlertingOptionChange(S),R.showRules=o.shouldShowRules(S),o.setState(R)}),(0,Y.default)(o,"onClickAddRule",()=>{var s=o.props.getAvailableSeverityValues();0!==s.length&&(o.props.addOrUpdateRuleToKpiModel(s[0],[]),s=o.props.getAvailableSeverityValues(),o.setState({availableSeverityValues:s}))}),(0,Y.default)(o,"onClickRemoveRule",s=>{o.props.removeRuleFromKpiModel(s),o.setState({availableSeverityValues:o.props.getAvailableSeverityValues()})}),(0,Y.default)(o,"updateRule",(s,_)=>{o.props.addOrUpdateRuleToKpiModel(s,_);var S=o.props.getAvailableSeverityValues();o.setState({availableSeverityValues:S})}),(0,Y.default)(o,"onUpdateToSeverity",(s,_)=>{o.props.removeAndAddRuleToKpiModel(s,_);var S=o.props.getAvailableSeverityValues();o.setState({availableSeverityValues:S})}),(0,Y.default)(o,"generateRules",()=>{var{addOrUpdateRuleToKpiModel:s,getAvailableSeverityValues:_,getCurrentRules:S,isReadOnly:R}=o.props,O=[],P=S();return P&&0!==P.length&&P.forEach(S=>{O.push(Z.default.createElement(se.default,{getAvailableSeverityValues:_,addOrUpdateRuleToKpiModel:s,updateRule:o.updateRule,toSeverity:S.change_to,fromSeverityValues:S.change_from,key:S.change_to,removeRuleFromKpiModel:o.onClickRemoveRule,onUpdateToSeverity:o.onUpdateToSeverity,isReadOnly:R}))}),O}),(0,Y.default)(o,"render",()=>{var{availableSeverityValues:s,showRules:_,value:S}=o.state,R=o.generateRules(),O=s.length>0,P=(0,re.gettext)("Trigger a notable event for ALL KPI severity changes"),D=(0,re.gettext)("Trigger a notable event for specific changes");return Z.default.createElement(Z.Fragment,null,o.props.isReadOnly?Z.default.createElement(Z.Fragment,null,Z.default.createElement(oe,{"data-test-itsi":"kpi-alerting-advanced-options-view"},1===S?P:D),_&&R):Z.default.createElement(Z.Fragment,null,Z.default.createElement(de,{"data-test-itsi":"kpi-alerting-options-radio",value:S,onChange:o.handleOptionChange},Z.default.createElement(ce,{"data-test-itsi":"all-option",value:1},P),Z.default.createElement(he,{"data-test-itsi":"custom-option",value:2},D)),_&&R,_&&O&&Z.default.createElement(le,{"data-test-itsi":"add-kpi-alerting-rule-button",icon:ue,label:(0,re.gettext)("Add rule"),appearance:"pill",onClick:o.onClickAddRule})))}),o.state={value:o.props.selectedAdvancedOption,showRules:o.shouldShowRules(o.props.selectedAdvancedOption),availableSeverityValues:o.props.getAvailableSeverityValues()},o}return(0,U.default)(KpiAlertingAdvancedOptionsView,s),(0,V.default)(KpiAlertingAdvancedOptionsView)}(Z.Component);(0,Y.default)(pe,"propTypes",{selectedAdvancedOption:X.default.number.isRequired,getCurrentRules:X.default.func.isRequired,getAvailableSeverityValues:X.default.func.isRequired,handleKpiAlertingOptionChange:X.default.func.isRequired,addOrUpdateRuleToKpiModel:X.default.func.isRequired,removeRuleFromKpiModel:X.default.func.isRequired,removeAndAddRuleToKpiModel:X.default.func.isRequired,isReadOnly:X.default.bool}),(0,Y.default)(pe,"defaultProps",{isReadOnly:!1});o.default=pe;s.exports=o.default},1472:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1094),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},1824:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(15)),O=_(4),P=R.default.View.extend({tagName:"div",className:"step-wizard-step",initialize:function initialize(s){return s=s||{},this.value=s.value||this.cid,this},showPreviousButton:!0,showNextButton:!0,previousLabel:"",nextLabel:(0,O.gettext)("Save & Next"),saveLabel:(0,O.gettext)("Save & Exit"),enabled:!0,visible:!0,label:(0,O.gettext)("Step"),value:"",dispatcher:null,activate:function activate(){return this},deactivate:function deactivate(){return this},validate:function validate(){throw"Extenders of BaseStepView must overload the validate method."},save:function save(){throw"Extenders of BaseStepView must overload the save method."},setEventDispatcher:function setEventDispatcher(s){this.dispatcher=s},stepForward:function stepForward(){this.dispatcher&&this.dispatcher.trigger("stepforward",this)},showErrorMessage:function showErrorMessage(s){this.dispatcher&&this.dispatcher.trigger("customerror",this,s)},clearErrorMessage:function clearErrorMessage(){this.dispatcher&&this.dispatcher.trigger("clearerror",this)}});o.default=P;s.exports=o.default},1838:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D=S(_(16)),N=S(_(17)),V=S(_(21)),j=S(_(19)),K=S(_(20)),W=S(_(8)),U=S(_(7)),Y=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),$=S(_(3)),X=S(_(2)),Z=S(_(64)),Q=_(4),ee=_(107),te=_(78),ie=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,j.default)(o),(0,V.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,j.default)(s).constructor):o.apply(s,_))}_(28);var ae=(0,X.default)(Z.default)(R||(R=(0,U.default)(["\n\tfont-size: 55px;\n\tmax-width: 300px;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\ttext-align: center;\n\tfont-weight: bold;\n\tmargin: auto;\n\tcolor: ",";\n"])),s=>s.color),ne=X.default.div(O||(O=(0,U.default)(["\n\tbackground: ",";\n\tpadding: 84px 50px;\n"])),s=>s.background),re=X.default.div(P||(P=(0,U.default)(["\n\tmargin: 0px auto;\n"]))),se=function(s){function PredictiveAnalyticsWidget(s){var o;(0,D.default)(this,PredictiveAnalyticsWidget);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return(o=_callSuper(this,PredictiveAnalyticsWidget,[s,...S])).state={},o}return(0,K.default)(PredictiveAnalyticsWidget,s),(0,N.default)(PredictiveAnalyticsWidget,[{key:"render",value:function render(){var{color:s,widgetSeverity:o}=this.props,_="<div></div>",S=this.props.data;switch(S&&!isNaN(S)&&(S=parseFloat(this.props.data).toFixed(2)),this.props.searchProgress){case te.SEARCH_PROGRESS.NOT_STARTED:_=this.props.initialWidgetContent?ie.SEARCH_PROGRESS_ELEMENTS.getSearchInfoElement(this.props.initialWidgetContent):ie.SEARCH_PROGRESS_ELEMENTS.getSearchInfoElement();break;case te.SEARCH_PROGRESS.IN_PROGRESS:_=ie.SEARCH_PROGRESS_ELEMENTS.getSearchInProgressElement();break;case te.SEARCH_PROGRESS.ERROR:_=Y.default.createElement(re,null,ie.SEARCH_PROGRESS_ELEMENTS.getErrorMessageElement(this.props.errorMessage));break;case te.SEARCH_PROGRESS.NO_RESULTS:_=ie.SEARCH_PROGRESS_ELEMENTS.getNoResultsElement((0,Q.gettext)("No results found."));break;case te.SEARCH_PROGRESS.COMPLETED:_=Y.default.createElement(ne,{background:o},Y.default.createElement(ae,{"data-test-itsi":"pa-widget-heading",level:4,color:s},String(S)))}return _}}])}(Y.Component);(0,W.default)(se,"propTypes",{widgetSeverity:$.default.string,color:$.default.string,data:$.default.oneOfType([$.default.string,$.default.number]),searchProgress:$.default.number.isRequired,errorMessage:$.default.string,initialWidgetContent:$.default.string}),(0,W.default)(se,"defaultProps",{widgetSeverity:(0,ee.getSeverityColor)(6),color:"#FFFFFF",data:"",errorMessage:"",initialWidgetContent:""});o.default=se;s.exports=o.default},1839:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q=S(_(8)),ee=S(_(7)),te=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),ie=_(46),ae=_(48),ne=S(_(3)),re=S(_(2)),se=S(_(69)),le=S(_(33)),oe=S(_(62)),de=S(_(39)),ce=S(_(159)),he=S(_(446)),ue=S(_(671)),pe=S(_(1026)),fe=S(_(266)),ge=S(_(44)),me=S(_(64)),ve=S(_(34)),ye=S(_(313)),_e=S(_(89)),Se=S(_(75)),be=_(4),Ee=_(14),Te=S(_(865)),Ce=_(61),ke=_(78),xe=_(110),we=_(294),Re=_(723),Ie=_(141),Me=_(452),Oe=_(763),Ae=_(102),Pe=_(501),De=_(306),Le=S(_(2633)),Ne=S(_(2646)),Ve=S(_(2647)),je=S(_(2662)),He=_(443),Be=_(384),Ke=_(57),Fe=_(145),We=S(_(1463)),Ue=S(_(598));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,Q.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var Ge=(0,re.default)(ue.default)(R||(R=(0,ee.default)(["\n margin-left: 8px;\n font-size: 15px;\n"]))),Ye=(0,re.default)(pe.default)(O||(O=(0,ee.default)(["\n margin-left: 8px;\n font-size: 15px;\n color: ",";\n"])),Ce.baseEnterpriseTheme.warningColor),qe=(0,re.default)(_e.default)(P||(P=(0,ee.default)(["\n line-height: 35px;\n"]))),ze=(0,re.default)(me.default)(D||(D=(0,ee.default)(["\n display: flex;\n margin: 0px;\n"]))),$e=re.default.div(N||(N=(0,ee.default)(["\n margin-top: 15px;\n max-width: 1400px;\n"]))),Je=re.default.div(V||(V=(0,ee.default)(["\n margin-left: 15px;\n"]))),Xe=re.default.div(j||(j=(0,ee.default)(["\n margin-top: 15px;\n"]))),Ze=re.default.div(K||(K=(0,ee.default)(["\n padding: 15px 20px 30px 20px;\n"]))),Qe=(0,re.default)(ge.default)(W||(W=(0,ee.default)(["\n margin-bottom: 0px;\n margin-left: -135px;\n"]))),et=(0,re.default)(fe.default)(U||(U=(0,ee.default)(["\n margin-right: 5px;\n"]))),tt=re.default.div(Y||(Y=(0,ee.default)(["\n max-width: 60ch;\n word-wrap: break-word;\n"]))),it=(0,re.default)(ve.default)($||($=(0,ee.default)(["\n margin-left: 15px;\n"]))),at=re.default.div(X||(X=(0,ee.default)(["\n display: flex;\n flex-direction: row;\n width: 1000px;\n"]))),nt=(0,re.default)(Se.default)(Z||(Z=(0,ee.default)(["\n padding: 20px;\n text-align: center;\n"]))),rt=te.default.createElement(tt,null,(0,Ee.sprintf)((0,be.gettext)("Indicates that the KPI is linked to an active %(objectName)s"),{objectName:we.OBJECT_NAMES.singular}));function KpiConfigurationContainer(s){var{appsData:o,baseSearchSelectItems:_,featureFlags:S,handleUpdateKpiModelCallback:R,hideAnomalyDetectionPanel:O,isReadOnly:P,kpiEntitiesData:D,kpiEntitiesConfigApiStatus:N,kpiEntitiesConfigData:V,linkedServices:j,previewSelectedServiceApiStatus:K,previewSelectedService:W,previewServiceCache:U,savedBaseSearchCollection:Y,sdDispatcher:$,serviceKpiBackfillMapping:X,serviceKpiEntitiesConfigRetrieveAction:Z,serviceKpiEntitiesRetrieveAction:Q,serviceModel:ee,servicesRetrieveOneAction:ie,serviceTemplate:ae,thresholdTemplateCollection:ne,validateModelEntriesCallback:re}=s,{kpiData:de,updateKpiData:ue,selectedKpiModel:pe,isServiceTemplate:fe,handleEntityRecommendationError:ge,handleServiceTemplateKpiChange:me,previewServiceKey:ve,setIsServiceTemplateNewKpi:Se,setPreviewServiceKey:Ce}=(0,te.useContext)(De.ThresholdingContext),Me=ee.get("_key"),Oe=S[Ie.featureFlagsStanzas.DRIFT_DETECTION]||!1,He=(0,Pe.getKpiConfigurationTabs)(Oe,!O,de.isEntityBreakdown),[tt,st]=(0,te.useState)(!1),[lt,ot]=(0,te.useState)(Ae.KPI_CONFIGURATION_TABS[0].value),[dt,ct]=(0,te.useState)(!0),[ht,ut]=(0,te.useState)(!1),[pt,ft]=(0,te.useState)(de.name),[gt,mt]=(0,te.useState)(!1),[vt,yt]=(0,te.useState)({key:pe.get("_key"),title:pe.get("name"),type:"kpi"}),[_t,St]=(0,te.useState)(fe),bt=(0,te.useRef)(null),Et=(0,te.useCallback)((s,o)=>{var{selectedTabId:_}=o;ot(_),ut(!1)},[]),Tt=(0,te.useCallback)(s=>{ot(Ae.KPI_CONFIGURATION_TABS[1].value),ut(!!s)},[]);(0,te.useEffect)(()=>{(()=>{if(!bt.current)return"";var s=new We.default({kpiModel:pe,serviceModel:ee,isReadOnly:P,isTabView:!0}).render();bt.current.innerHTML="",bt.current.appendChild(s.el)})()});var Ct=(0,te.useCallback)((s,o)=>{s.get("is_entity_breakdown")&&(s.get("is_entity_level_thresholding")&&Z(o),Q({kpiId:o,earliest:"-48h",latest:"now"}))},[Z,Q]);(0,te.useEffect)(()=>{if(_t&&K===Be.SERVICES_RETRIEVE_ONE_STATUS.SUCCESS&&!(0,le.default)(pe)){U[ve]=W;var s=(0,se.default)(W.kpis,s=>pe.get("title")===s.title);s?(me(s,pe,Me),Ct(pe,s._key),Se(!1)):(ue(pe),Se(!0)),St(!1)}},[K]);var kt=(0,te.useCallback)((s,o)=>{var _=U&&U[s];if(_){var S=(0,se.default)(_.kpis,s=>o.get("title")===s.title);S?(me(S,o,Me),Ct(o,S._key),Se(!1)):(ue(o),Se(!0)),St(!1)}else St(!0),ie(s)},[Ct,me,U,Me,ie,Se,ue]);(0,te.useEffect)(()=>{(0,le.default)(pe)||(yt({key:pe.get("_key"),title:pe.get("name"),type:"kpi"}),fe?kt(ve,pe):Ct(pe,pe.get("_key")))},[]),(0,te.useEffect)(()=>{N===Be.SERVICE_KPI_ENTITIES_CONFIG_RETRIEVE_STATUS.SUCCESS&&V.length>0&&!(0,le.default)(pe)&&pe.get("is_entity_level_thresholding")&&ge(V)},[ge,N,V,D.results,pe]);var xt=(0,te.useCallback)((s,o)=>{var{value:_}=o;Ce(_),kt(_,pe)},[pe,Ce,kt]);(0,te.useEffect)(()=>{var s=(0,xe.checkSummaryIndexForKpiData)(de._key,"kpi-thresholding-preview");return st(!0),s.promise.then(s=>{var o=!s||(0,xe.checkShouldUseRawSearch)(s);ct(o),st(!1)}).catch(()=>{ct(!0),st(!1)}),()=>{var o;o=s,(0,ke.cleanSearchJobSubscriptions)(null==o?void 0:o.searchJob,null==o?void 0:o.subscription)}},[de._key]);var wt=(0,te.useCallback)(()=>{pt!==de.name&&ft(de.name),mt(!1)},[pt,de]),Rt=(0,te.useCallback)(()=>{var s=_objectSpread({},de);s.name=pt,ue(s),pe.set("title",pt),$.trigger("unsetBaseServiceTemplateId",ee),$.trigger("unlink"),mt(!1)},[de,pe,ee,$,pt,ue]),It=(0,te.useCallback)(()=>{var s=["renderBoundaryMax","renderBoundaryMin","search"],o=Object.keys(pe.changed);return(0,ce.default)(o,o=>!(0,oe.default)(s,o))||pe.get("linked_kpi_thresholds_updated")},[pe]);return te.default.createElement($e,null,te.default.createElement(he.default,null),te.default.createElement(Je,null,te.default.createElement(ze,{level:1},ee.get("object_type")===Ke.OBJECT_TYPE&&pe.get("base_service_template_id")&&(It()?te.default.createElement(qe,{"data-test-itsi":"service-template-icon-unlocked-tooltip",contentRelationship:"label",content:(0,Ee.sprintf)((0,be.gettext)("This setting has been changed. Its value is no longer synced with the %s service template, even though the service is still linked."),null==ae?void 0:ae.get("title"))},te.default.createElement(Ye,{"data-test-itsi":"service-template-icon-unlocked"})):te.default.createElement(qe,{"data-test-itsi":"search-and-calculate-collapsible-linked-to-st-icon-tooltip",contentRelationship:"label",content:(0,Ee.sprintf)((0,be.gettext)("KPI linked to service template %(serviceTemplateName)s."),{serviceTemplateName:null==ae?void 0:ae.get("title")})},te.default.createElement(Ge,{"data-test-itsi":"search-and-calculate-collapsible-linked-to-st-icon"}))),te.default.createElement(Qe,{"data-test-itsi":"kpi-configuration-title-control-group",hideLabel:!0,label:(0,be.gettext)("KPI title")},te.default.createElement(Te.default,{dataTestItsi:"kpi-title-text-control",type:"title",textWidth:750,allowEmptyText:!1,placeholder:(0,be.gettext)("KPI title"),labelTooltip:pe.get("title"),isReadOnly:P,value:pt,originalValue:pe.get("title"),primaryButtonLabel:(0,be.gettext)("Done"),onInputChange:(s,o)=>{var{value:_}=o;ft(_)},onChange:(s,o)=>{if(s!==o)if(ee.get("object_type")===Ke.OBJECT_TYPE&&ae&&pe.get("base_service_template_id"))mt(!0);else{var _=_objectSpread({},de);_.name=s,ue(_),pe.set("title",s)}}}))),te.default.createElement("div",null,te.default.createElement(Qe,{"data-test-itsi":"kpi-configuration-description-control-group",hideLabel:!0,label:(0,be.gettext)("KPI description")},te.default.createElement(Te.default,{dataTestItsi:"kpi-description-text-control",textWidth:750,allowEmptyText:!0,placeholder:(0,be.gettext)("KPI description"),labelTooltip:pe.get("description"),isReadOnly:P,value:de.description,originalValue:pe.get("description"),primaryButtonLabel:(0,be.gettext)("Done"),onInputChange:(s,o)=>{var{value:_}=o,S=_objectSpread({},de);S.description=_,ue(S)},onChange:(s,o)=>{s!==o&&pe.set("description",s)}}))),ee.get("object_type")===Ke.OBJECT_TYPE&&(0,Fe.hasActiveCustomThresholdWindow)(pe.toJSON())&&te.default.createElement("div",null,te.default.createElement(et,{"data-test-itsi":"kpi-thresholding-panel-custom-threshold-window-active-status-chip"},(0,be.gettext)("Active")),te.default.createElement(_e.default,{contentRelationship:"label",content:rt,"data-test-itsi":"kpi-thresholding-panel-custom-threshold-window-active-status-tooltip"}),pe.get("active_custom_threshold_window")&&te.default.createElement(it,{"data-test-itsi":"view-custom-threshold-windows-link",openInNewContext:!0,to:(0,Re.uiEditURL)({id:pe.get("active_custom_threshold_window")})},(0,Ee.sprintf)((0,be.gettext)("View %(objectName)s"),{objectName:we.OBJECT_NAMES.singular})))),tt?te.default.createElement(te.default.Fragment,null,te.default.createElement(nt,{"data-test-itsi":"kpi-thresholding-view-container-wait-spinner",size:"large"}),(0,be.gettext)("Loading KPI...")):te.default.createElement(Xe,null,te.default.createElement(ye.default,{activeTabId:lt,onChange:Et,"data-test-itsi":"kpi-configuration-tab-bar"},He.map(s=>te.default.createElement(ye.default.Tab,{key:s.value,label:s.label,tabId:s.value,"data-test-itsi":"kpi-configuration-".concat(s.value.split("_").join("-"),"-tab")}))),lt===Ae.KPI_CONFIGURATION_TABS[0].value&&te.default.createElement(Ze,null,te.default.createElement(Ve.default,{baseSearchSelectItems:_,featureFlags:S,handleUpdateKpiModelCallback:R,isReadOnly:P,savedBaseSearchCollection:Y,sdDispatcher:$,serviceKpiBackfillMapping:X,serviceModel:ee,serviceTemplate:ae,validateModelEntriesCallback:re})),lt===Ae.KPI_CONFIGURATION_TABS[1].value&&te.default.createElement(Ze,null,_t?te.default.createElement(at,null,te.default.createElement(nt,{size:"large"})):te.default.createElement(je.default,{appsData:o,isReadOnly:P,handleSelectedServiceChange:xt,linkedServices:j,openToThresholdLevelsTab:ht,previewServiceCache:U,selectedKpi:vt,serviceTemplateKey:Me,thresholdTemplateCollection:ne,useRawSearch:dt})),lt===Ae.KPI_CONFIGURATION_TABS[2].value&&te.default.createElement(Le.default,{handleGoToKpiSettings:Tt,appsData:o,thresholdTemplateCollection:ne,useRawSearch:dt,isReadOnly:P,handleSelectedServiceChange:xt,linkedServices:j}),lt===Ae.KPI_CONFIGURATION_TABS[3].value&&te.default.createElement(Ze,null,te.default.createElement("div",{"data-test-itsi":"kpi-anomaly-content-panel-container",ref:bt})),lt===Ae.KPI_CONFIGURATION_TABS[4].value&&te.default.createElement(Ze,null,te.default.createElement(Ne.default,{appsData:o,isReadOnly:P,linkedServices:j}))),gt&&te.default.createElement(Ue.default,{modalTitleSubstring:(0,be.gettext)("Edit KPI Search"),serviceTitle:ee.get("title"),serviceTemplateTitle:ae.get("title"),serviceTemplateUrl:ae.getEditUrl(),isModalOpen:!0,handleDeclineToUnlink:wt,handleAcceptToUnlink:Rt}))}KpiConfigurationContainer.propTypes={appsData:ne.default.object.isRequired,baseSearchSelectItems:ne.default.array,featureFlags:ne.default.object.isRequired,handleUpdateKpiModelCallback:ne.default.func,hideAnomalyDetectionPanel:ne.default.bool.isRequired,isReadOnly:ne.default.bool.isRequired,kpiEntitiesData:ne.default.object.isRequired,kpiEntitiesConfigApiStatus:ne.default.string.isRequired,kpiEntitiesConfigData:ne.default.array.isRequired,linkedServices:ne.default.array,previewSelectedServiceApiStatus:ne.default.string.isRequired,previewSelectedService:ne.default.object,previewServiceCache:ne.default.object,sdDispatcher:ne.default.object,savedBaseSearchCollection:ne.default.object,serviceKpiBackfillMapping:ne.default.object,serviceKpiEntitiesConfigRetrieveAction:ne.default.func.isRequired,serviceKpiEntitiesRetrieveAction:ne.default.func.isRequired,serviceModel:ne.default.object.isRequired,servicesRetrieveOneAction:ne.default.func.isRequired,serviceTemplate:ne.default.object,thresholdTemplateCollection:ne.default.object.isRequired,validateModelEntriesCallback:ne.default.func},KpiConfigurationContainer.defaultProps={baseSearchSelectItems:[],handleUpdateKpiModelCallback:de.default,linkedServices:[],previewSelectedService:{},previewServiceCache:{},savedBaseSearchCollection:{},sdDispatcher:{},serviceKpiBackfillMapping:{},serviceTemplate:{},validateModelEntriesCallback:de.default};o.default=(0,ie.connect)(s=>({recommendationSearchSid:s.healthAnalyticsConsole.recommendationSearchSid,recommendationSearchStatus:s.healthAnalyticsConsole.recommendationSearchStatus,recommendationSearchErrorMessage:s.healthAnalyticsConsole.recommendationSearchErrorMessage,recommendationResults:s.healthAnalyticsConsole.recommendationResults,kpiEntitiesData:s.services.kpiEntitiesData,kpiEntitiesConfigApiStatus:s.services.kpiEntitiesConfigApiStatus,previewSelectedServiceApiStatus:s.services.apiStatus,previewSelectedService:s.services.selectedService,kpiEntitiesConfigData:s.services.kpiEntitiesConfigData,kpiThresholdTemplateApiStatus:s.kpiThresholdTemplate.apiStatus}),s=>(0,ae.bindActionCreators)({serviceKpiEntitiesConfigRetrieveAction:He.serviceKpiEntitiesConfigRetrieve,serviceKpiEntitiesRetrieveAction:He.serviceKpiEntitiesRetrieve,servicesRetrieveOneAction:He.servicesRetrieveOne,healthAnalyticsConsoleRecommendationsResultsRetrieveAction:Me.healthAnalyticsConsoleRecommendationsResultsRetrieve,healthAnalyticsConsoleRecommendationsSearchResetAction:Me.healthAnalyticsConsoleRecommendationsSearchReset,kpiThresholdTemplateResetAction:Oe.kpiThresholdTemplateReset,kpiThresholdTemplateCreateAction:Oe.kpiThresholdTemplateCreate},s))(KpiConfigurationContainer);s.exports=o.default},1840:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1090),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2611:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(15)),O=_(52),P=R.default.Router.extend({ServiceView:new R.default.View,initialize:function initialize(s){s=s||{},this.cachedServiceBaseModel=s.serviceBaseModel,this.configurationLayoutViewOptions=s.configurationLayoutViewOptions||{},R.default.View.prototype.initialize.apply(this,arguments)},page:function page(){R.default.View.prototype.page.apply(this,arguments),this.handleHash()},navigate:function navigate(s){(0,O.updateURL)(s)}});o.default=P;s.exports=o.default},2612:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(37)),O=S(_(15)),P=_(57),D=S(_(1031)),N=O.default.View.extend({tabLayoutDataTestItsi:"base-service-view-tab-layout",events:{kpiselected:"_onKpiSelected"},initialize:function initialize(s){if(O.default.View.prototype.initialize.apply(this,arguments),!s.model)throw"Must provide model option";this.modelClone=s.model,this.tabToShow=s.tabToShow,this.childViews={},this.childViews.tabViews=new D.default({dataTestItsi:this.tabLayoutDataTestItsi,tabShownCallback:this.onTabShown.bind(this),tabToShow:this.tabToShow,tabs:[]})},getUrlString:function getUrlString(s,o){var _=null,S="new";this.modelClone.isNew()||(S=this.modelClone.id);var R="serviceId="+S+"&tab="+s;return s===P.SERVICE_DEFINITION_TABS.KPI&&o&&(_=o)&&(R+="&kpiId="+_),R},remove:function remove(){return(0,R.default)(this.childViews,(function(s){s.remove()})),O.default.View.prototype.remove.apply(this,arguments)},onTabShown:function onTabShown(s){this.trigger("tabactivated",s)},getUrl:function getUrl(s){return this.getUrlString(s,this.kpiTab.getContentView().getSelectedKpiId())},_onKpiSelected:function _onKpiSelected(){this.trigger("kpiselected")}});o.default=N;s.exports=o.default},2613:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=S(_(276)),P=O.default.extend({dataTestItsi:"base-service-entities-tab",initialize:function initialize(s){(s=s||{}).tabLabel=(0,R.gettext)("Entities"),O.default.prototype.initialize.apply(this,arguments)}});o.default=P;s.exports=o.default},2614:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(45),O=S(_(37)),P=S(_(95)),D=_(14),N=_(4),V=S(_(7658)),j=S(_(111)),K=S(_(2381)),W=S(_(7660)),U=S(_(7663));_(7664);var Y=(0,R.template)(U.default,null,{variable:"vars"}),$=V.default.extend({tagName:"div",className:V.default.prototype.className+" service-definition-entities-content-view",_onDismiss:function _onDismiss(){this.$(".show-warning-message-container").css({display:"none"})},initialize:function initialize(s){if(s=s||{},this.serviceTemplate=s.serviceTemplate,!s.service)throw"Must pass service object to ServiceDefinitionEntitiesContentView";this._setupHeader(s.service),V.default.prototype.initialize.apply(this,arguments),this.children={},this.children.fillInWarningMessage=new j.default({appearance:"fill",content:this.serviceTemplate?(0,D.sprintf)((0,N.gettext)("Provide values for all empty entity rules coming from the %s service template to filter the service to a specific set of entities."),this.serviceTemplate.get("title")):"",dataTestItsi:"fill-in-warning-message",onRequestRemove:this._onDismiss.bind(this),style:{marginTop:10},type:"warning"})},_rulesChanged:function _rulesChanged(s,o){var _=0===o.length;this.service.unset("entity_rules",{silent:!_}),_?(this.service.set("entity_rules",new K.default,{silent:!_}),this.service.get("kpis").each((function(s){"shared_base"!==s.get("search_type")&&s.set("is_service_entity_filter",!1)}))):this.service.set("entity_rules",o),this.matchedEntitiesView&&this.matchedEntitiesView.refresh()},_setupHeader:function _setupHeader(s){var o=this._isBlankRuleType(s);this.showWarningMessage=!!this.serviceTemplate&&o,this.entityRulesHeader=Y({entityRulesDescription:(0,N.gettext)("Entity Rules allow for the optional, dynamic filtering of KPIs and can help in root cause analysis. A service need not define any Entity Rules and is not limited to only the entities matching Entity Rules."),showWarningMessage:this.showWarningMessage},{variable:"vars"})},_isBlankRuleType:function _isBlankRuleType(s){if(!s.get("base_service_template_id"))return!1;var o=s.get("entity_rules").models,_=!1;return o.length&&(0,O.default)(o,function(s){var o=s.get("rule_items").models;if(o.length&&(0,P.default)(o,function(s){return"notmatchesblank"===s.get("rule_type")||"matchesblank"===s.get("rule_type")}.bind(this)).length)return void(_=!0)}.bind(this)),_},initEntityRulesView:function initEntityRulesView(){this.specifyEntityRulesView=new W.default({rulesContainerModel:this.service,ruleFieldsBlockList:["services"],serviceTemplateTitle:this.serviceTemplate?this.serviceTemplate.get("title"):""})},addWarningMessage:function addWarningMessage(){this.showWarningMessage&&this.$el.find(".show-warning-message-container").append(this.children.fillInWarningMessage.render().$el)},refreshModel:function refreshModel(){this._setupHeader(this.service),this.$(".entity-description-header").html(""),this.$(".entity-description-header").replaceWith(this.entityRulesHeader),V.default.prototype.refreshModel.apply(this,arguments),this.addWarningMessage()},render:function render(){return V.default.prototype.render.apply(this,arguments),this.addWarningMessage(),this}});o.default=$;s.exports=o.default},2615:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(15)),O=_(46),P=S(_(0)),D=S(_(35)),N=_(4),V=_(376),j=S(_(2616)),K=S(_(474)),W=S(_(47)),U=(0,V.getStore)(),Y=R.default.View.extend({attributes:{"data-test-itsi":"matched-entities-view"},tagName:"div",className:"matched-entities-view",initialize:function initialize(s){if(s=s||{},this.options=s,!s.service)throw"Must provide service";this.service=s.service,R.default.View.prototype.initialize.apply(this,arguments)},renderTable:function renderTable(){this.$el.html('<div data-test-itsi="matched-entities-table-container"></div>');var s=this.$el.find('[data-test-itsi="matched-entities-table-container"]'),o=this.options.noDataText||(0,N.gettext)("No entities currently matched. They will be automatically added to the service when created.");s.length&&(D.default.unmountComponentAtNode(s.get(0)),D.default.render(P.default.createElement(W.default,null,P.default.createElement(O.Provider,{store:U},P.default.createElement(K.default,null,P.default.createElement(j.default,{noDataText:o,entityFilter:this.service.get("entity_rules").toJSON()})))),s.get(0)))},refresh:function refresh(){this.renderTable()},remove:function remove(){return R.default.View.prototype.remove.apply(this,arguments)},render:function render(){return this.refresh(),this}});o.default=Y;s.exports=o.default},2616:function(s,o,_){"use strict";var S=this&&this.__createBinding||(Object.create?function(s,o,_,S){void 0===S&&(S=_);var R=Object.getOwnPropertyDescriptor(o,_);R&&!("get"in R?!o.__esModule:R.writable||R.configurable)||(R={enumerable:!0,get:function(){return o[_]}}),Object.defineProperty(s,S,R)}:function(s,o,_,S){void 0===S&&(S=_),s[S]=o[_]}),R=this&&this.__setModuleDefault||(Object.create?function(s,o){Object.defineProperty(s,"default",{enumerable:!0,value:o})}:function(s,o){s.default=o}),O=this&&this.__importStar||function(s){if(s&&s.__esModule)return s;var o={};if(null!=s)for(var _ in s)"default"!==_&&Object.prototype.hasOwnProperty.call(s,_)&&S(o,s,_);return R(o,s),o},P=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(o,"__esModule",{value:!0}),o.cellData=o.columnsData=void 0;const D=O(_(0)),N=P(_(94)),V=P(_(150)),j=P(_(1593)),K=P(_(50)),W=_(48),U=_(46),Y=P(_(2)),$=P(_(24)),X=P(_(131)),Z=P(_(93)),Q=_(4),ee=_(14),te=P(_(448)),ie=P(_(721)),ae=_(29),ne=_(41),re=_(130),se=_(87),le=_(581),oe=_(449),de=_(187),ce=_(481),he=_(403),ue=P(_(2468));o.columnsData=[{dataTestItsi:"matched-entities-body-table-title-column-header",name:(0,Q.gettext)("Title"),sortable:!0},{dataTestItsi:"matched-entities-body-table-aliases-column-header",name:(0,Q.gettext)("Aliases")},{dataTestItsi:"matched-entities-body-table-info-column-header",name:(0,Q.gettext)("Info")},{dataTestItsi:"matched-entities-body-table-types-column-header",name:(0,Q.gettext)("Entity Types")}],o.cellData=[{dataTestItsi:"matched-entities-body-table-title-cell"},{dataTestItsi:"matched-entities-body-table-aliases-cell"},{dataTestItsi:"matched-entities-body-table-info-cell"},{dataTestItsi:"matched-entities-body-table-types-cell"}];const pe=Y.default.div`
|
|
|
`;o.default=(0,U.connect)(s=>({entitiesApiStatus:s.entities.apiStatus,entitiesCountApiStatus:s.entities.entitiesCountApiStatus,entitiesTotalCount:s.entities.entitiesCountData.count,entityTypes:s.entityTypes.data,entityTypesApiStatus:s.entityTypes.apiStatus,entitiesObjectsArr:s.entities.data}),s=>(0,W.bindActionCreators)({entitiesFromItsiFilterRetrieveAction:le.entitiesFromItsiFilterRetrieve,entitiesCountFromItsiFilterRetrieveAction:le.entitiesCountFromItsiFilterRetrieve,entityTypesRetrieveAction:ce.entityTypesRetrieve},s))((function MatchedEntitiesTable({entitiesApiStatus:s,entitiesCountApiStatus:_,entitiesCountFromItsiFilterRetrieveAction:S,entitiesFromItsiFilterRetrieveAction:R,entitiesTotalCount:O,entityTypesApiStatus:P,entityTypesRetrieveAction:W,entityTypes:U,entitiesObjectsArr:Y,entityFilter:le,noDataText:ce}){const[me,ve]=(0,D.useState)(1),[ye,_e]=(0,D.useState)(!1),[Se,be]=(0,D.useState)({}),[Ee,Te]=(0,D.useState)("asc"),[Ce,ke]=(0,D.useState)(10),xe=O||0,we=(0,N.default)(()=>{const s={count:Ce,offset:(me-1)*Ce,sort_dir:Ee,sort_key:"identifying_name"};R(le,de.ITSI_FILTER_MODE.ADVANCED,s)},se.DEFAULT_DEBOUNCE_DELAY),Re=(0,N.default)(()=>{S(le,de.ITSI_FILTER_MODE.ADVANCED)},se.DEFAULT_DEBOUNCE_DELAY);(0,D.useEffect)(()=>{we(),Re(),W({fetchParams:{fields:"identifying_name,_key,_title"},mode:de.ITSI_FILTER_MODE.SIMPLE})},[]),(0,D.useEffect)(()=>{we()},[me,Ce,Ee]),(0,D.useEffect)(()=>{we(),Re()},[JSON.stringify(le)]);const getAliases=s=>s?s.values instanceof Array?(0,V.default)(s.values.join(", ")):(0,V.default)(s.values):"",getTypes=s=>{if(P===he.ENTITY_TYPES_RETRIEVE_STATUS.IN_PROGRESS)return(0,Q.gettext)("Loading...");if(!U||!s)return"";s instanceof Array||(s=[s]);const o=(0,j.default)(U,s,({_key:s},o)=>s===o);return(0,V.default)((0,K.default)(o,"title").join(", "))},handleRowClick=(s,o)=>{_e(!0),be(o)},handleSort=()=>{Te("asc"===Ee?"desc":"asc")},Ie=(0,ee.sprintf)((0,ae.ungettext)("%(totalCount)d Entity","%(totalCount)d Entities",xe),{totalCount:xe}),Me=_===ne.READY||_===oe.ENTITIES_COUNT_FROM_ITSI_FILTER_RETRIEVE_STATUS.IN_PROGRESS,Oe=s===ne.READY||s===oe.ENTITIES_FROM_ITSI_FILTER_RETRIEVE_STATUS.IN_PROGRESS||P===ne.READY||P===he.ENTITY_TYPES_RETRIEVE_STATUS.IN_PROGRESS;if(!Oe&&!Me&&!xe)return D.default.createElement($.default,{"data-test-itsi":"matched-entities-table-no-matches-message"},ce);const Ae=Math.ceil(xe/Ce);return D.default.createElement(D.default.Fragment,null,Me?null:D.default.createElement(pe,null,D.default.createElement("div",{"data-test-itsi":"matched-entities-body-table-count"},Ie),Ae>1&&D.default.createElement(fe,null,D.default.createElement(te.default,{telemetryNamespace:"Matched Entities Table",appearance:"pill",itemsPerPage:Ce||0,itemsPerPageOptions:re.LOW_NUMBERS_COUNTS_PER_PAGE_OPTIONS.map(s=>s.value),onItemsPerPageChange:s=>{ve(1),ke(s)}}),D.default.createElement(X.default,{"data-test-itsi":"matched-entities-body-table-paginator",current:me,onChange:(s,{page:o})=>{ve(o)},totalPages:Ae}))),Oe?D.default.createElement(ge,{"data-test-itsi":"matched-entities-loading-message",type:"info"},(0,Q.gettext)("Loading entities...")):D.default.createElement(D.default.Fragment,null,D.default.createElement(Z.default,{"data-test-itsi":"matched-entities-table",stripeRows:!0},D.default.createElement(Z.default.Head,{"data-test-itsi":"matched-entities-table-head"},o.columnsData.map(s=>{const o=s.sortable?{onSort:handleSort,sortDir:Ee,sortKey:"identifying_name"}:{};return D.default.createElement(Z.default.HeadCell,Object.assign({"data-test-itsi":s.dataTestItsi,key:s.dataTestItsi},o),s.name)})),D.default.createElement(Z.default.Body,null,Y.map(s=>{const _=s._key;return D.default.createElement(Z.default.Row,{"data-test-itsi":"matched-entities-body-row",data:s,key:_,onClick:handleRowClick},D.default.createElement(Z.default.Cell,{"data-test-itsi":o.cellData[0].dataTestItsi,key:`${_}-${s.title}-entity-title-cell`},D.default.createElement(ie.default,{dataTestItsi:"matched-entities-body-table-info",tooltipDataTestItsi:"matched-entities-body-table-info-tooltip",maxWidth:300,value:s.title})),D.default.createElement(Z.default.Cell,{"data-test-itsi":o.cellData[1].dataTestItsi,key:`${_}-${s.title}-entity-alias-cell`},D.default.createElement(ie.default,{dataTestItsi:"matched-entities-body-table-alias",tooltipDataTestItsi:"matched-entities-body-table-alias-tooltip",maxWidth:300,value:getAliases(s.identifier)})),D.default.createElement(Z.default.Cell,{"data-test-itsi":o.cellData[2].dataTestItsi,key:`${_}-${s.title}-entity-info-cell`},D.default.createElement(ie.default,{dataTestItsi:"matched-entities-body-table-info",tooltipDataTestItsi:"matched-entities-body-table-info-tooltip",maxWidth:300,value:getAliases(s.informational)})),D.default.createElement(Z.default.Cell,{"data-test-itsi":o.cellData[3].dataTestItsi,key:`${_}-${s.title}-entity-types-cell`},D.default.createElement(ie.default,{dataTestItsi:"matched-entities-body-table-types",tooltipDataTestItsi:"matched-entities-body-table-types-tooltip",maxWidth:300,value:getTypes(s.entity_type_ids)})))}))),D.default.createElement(ue.default,{"data-test-itsi":"entity-container-modal",isOpen:ye,closeModal:()=>{_e(!1),be({})},entityTypes:U,selectedEntity:Se,entitiesApiStatus:oe.ENTITIES_UPDATE_STATUS.SUCCESS,errorMessage:"",readOnlyView:!0,canUserCreateEntity:!1})))}))},2617:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=_(57),P=S(_(276)),D=P.default.extend({dataTestItsi:"base-service-settings-tab",initialize:function initialize(s){(s=s||{}).tabId=O.SERVICE_DEFINITION_TABS.SETTINGS,s.tabLabel=(0,R.gettext)("Settings"),P.default.prototype.initialize.call(this,s)}});o.default=D;s.exports=o.default},2618:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=S(_(32)),N=S(_(15)),V=_(45),j=S(_(0)),K=S(_(35)),W=S(_(50)),U=S(_(2)),Y=_(4),$=S(_(44)),X=S(_(34)),Z=S(_(24)),Q=_(52),ee=_(192),te=_(175),ie=_(145),ae=_(274),ne=_(163),re=S(_(1199)),se=S(_(1777)),le=S(_(1430)),oe=S(_(47)),de=S(_(896)),ce=S(_(1053)),he=S(_(1454)),ue=S(_(800)),pe=S(_(2623)),fe=S(_(2625)),ge=S(_(2627)),me=S(_(2629));_(2630);var ve=(0,U.default)(Z.default)(R||(R=(0,P.default)(["\n\tmargin-left: 140px;\n\tmargin-bottom: 10px;\n\tdiv[data-test='content'] {\n\t\tflex-wrap: wrap;\n\t}\n"]))),ye=(0,U.default)(X.default)(O||(O=(0,P.default)(["\n\tmargin-left: 5px;\n\tmargin-right: 5px;\n"]))),_e={},Se=N.default.View.extend({ServiceHealthView:ce.default,tagName:"div",className:"settings-content-view",compiledTemplate:(0,V.template)(me.default,null,{variable:"vars"}),initialize:function initialize(s){if(!(s=s||{}).service)throw"Must provide service";this.serviceModelClone=s.service,this.teamsCollectionData=s.teamsCollectionData,this.servicesCollectionData=s.servicesCollectionData,this.tagsData=s.tagsData,this.serviceTemplate=s.serviceTemplate,this.sdDispatcher=s.sdDispatcher,this.isReadOnly=s.isReadOnly||!1,this.isReadOnly&&(this.ServiceHealthView=he.default),this.severityLabels=s.severityLabels,this.healthScoreKPI=null,this.enableDisableAttribute=this.serviceModelClone.has("enabled"),this.setBackfillNeededStatus=this._setBackfillNeededStatus.bind(this),this.setBackfillEarliestTime=this._setBackfillEarliestTime.bind(this),this.setBackfillEnabledStatus=this._setBackfillEnabledStatus.bind(this),this.setCalculateByEntityEnabledStatus=this._setCalculateByEntityEnabledStatus.bind(this),this.updateTags=this._updateTags.bind(this),this.isBaseServiceTemplate=this.serviceModelClone.get("object_type")===te.OBJECT_TYPE,this.listenTo(this.serviceModelClone,"on_sec_grp_title_update",this._renderSecurityGroupsDropdownControl),this.listenTo(this.serviceModelClone,"change",this._renderHealthScoreCalculateByEntityControl),this.serviceModelClone.fetchSecurityGroupTitle(),N.default.View.prototype.initialize.apply(this,arguments)},securityGroupDetails:function securityGroupDetails(){(0,Q.redirect)((0,ae.uiEditURL)(this.serviceModelClone.get("sec_grp"),!0))},render:function render(){return this.$el.html(this.compiledTemplate({gettext:Y.gettext,isBaseServiceTemplate:this.isBaseServiceTemplate},{variable:"vars"})),this.$el.addClass("form-horizontal"),this.enableDisableAttribute&&this._renderEnableDisableControl(),this._renderServiceTagsControl(this.tagsData),this.healthScoreKPI=this._fetchHealthScoreKPI(),this.isBaseServiceTemplate||(this._renderHealthScoreBackfillControl(),this._renderSecurityGroupsDropdownControl()),this._renderHealthScoreCalculateByEntityControl(),this._renderHealthScoreContent(),this},_updateTile:function _updateTile(){this.tileView.model.set({color:this.healthModel.get("health_severity_color"),value:this.healthModel.get("health_score")}),(0,ne.safeRemoveView)(this,this.tileView),(0,D.default)(".service-health-tile",this.$el).append(this.tileView.render().$el)},setTileLoading:function setTileLoading(){(0,D.default)(".service-health-tile",this.$el).css("position","relative"),this.tileView.setTileLoading()},setTileNotLoading:function setTileNotLoading(){(0,D.default)(".service-health-tile",this.$el).removeAttr("position"),this.tileView.setTileNotLoading()},_renderHealthScoreContent:function _renderHealthScoreContent(){(0,ne.safeRemoveView)(this,this.healthScoreContentView),this.healthScoreContentView=new this.ServiceHealthView({serviceModel:this.serviceModelClone,servicesCollectionData:this.servicesCollectionData,showOverview:!1,severityLabels:this.severityLabels}),this.listenTo(this.healthScoreContentView,"set-tile-loading",this.setTileLoading),this.listenTo(this.healthScoreContentView,"set-tile-not-loading",this.setTileNotLoading),this.$(".kpi-severity-importance-table-container",this.$el).append(this.healthScoreContentView.render().$el),this.healthModel=this.healthScoreContentView.overviewView.healthModel,this.listenTo(this.healthModel,"change",this._updateTile),(0,ne.safeRemoveView)(this,this.healthTileHeaderView),this.healthTileHeaderView=new re.default({dataTestItsi:"simulated-health-score-text-label-control",label:(0,Y.gettext)("Simulated Health Score"),tooltip:(0,Y.gettext)("Range: Critical 0-20, High 20-40, Medium 40-60, Low 60-80, Normal 80-100")}),this.$(".service-health-tile-header",this.$el).append(this.healthTileHeaderView.render().$el),this.$(".health-score-title-description",this.$el).text((0,Y.gettext)("Tweak the importance of each of the KPIs and see how that reflects on the simulated Service Health Score.")),(0,ne.safeRemoveView)(this,this.tileView);var s=new se.default({label:this.isBaseServiceTemplate?(0,Y.gettext)("Example Service"):this.serviceModelClone.get("title")});this.tileView=new le.default({hasSparkline:!1,model:s,tileSize:ee.TILE_SIZES.LARGE.value}),this.$(".service-health-tile",this.$el).append(this.tileView.render().$el)},_createTeamsDependencyWarning:function _createTeamsDependencyWarning(){var s=(0,D.default)('<div class="teams-dependency-warning-container"></div>');return K.default.unmountComponentAtNode(s.get(0)),K.default.render(j.default.createElement(oe.default,null,j.default.createElement(ve,{"data-test-itsi":"security-group-change-warning-message",type:"warning"},(0,Y.gettext)("Changing a service's team may break service dependencies. Ask your Splunk administrator to"),j.default.createElement(ye,{"data-test-itsi":"service-def-review-logs-link",openInNewContext:!0,to:(0,ae.getTeamsDependencyURL)()},(0,Y.gettext)("review the logs")),(0,Y.gettext)("after saving the change."))),s.get(0)),s},_renderSecurityGroupsDropdownControl:function _renderSecurityGroupsDropdownControl(){(0,ne.safeRemoveView)(this,this.securityGroupsDropdown),this.securityGroupsDropdown=new de.default({help:j.default.createElement(X.default,{"data-test-itsi":"service-teams-help-link",openInNewContext:!0,onClick:this.securityGroupDetails.bind(this)},(0,Y.gettext)("View Details")),isReadOnly:this.isReadOnly,retainSecurityGroup:!0,teamsCollectionData:this.teamsCollectionData,securableObjectModel:this.serviceModelClone}),(0,D.default)(".security-group-dropdown-control",this.$el).html(this.securityGroupsDropdown.render().$el),this.isReadOnly||(0,D.default)(".security-group-dropdown-control",this.$el).append(this._createTeamsDependencyWarning())},_renderServiceTagsControl:function _renderServiceTagsControl(s){_e=this.isBaseServiceTemplate?this.serviceModelClone.get("template_tags")||[]:this.serviceModelClone.get("service_tags")||{};var o=s,_=(0,D.default)("<div></div>").css({display:"inline-block","vertical-align":"middle"});K.default.unmountComponentAtNode(_.get(0)),K.default.render(j.default.createElement(oe.default,null,j.default.createElement(ge.default,{allServiceTags:o,existingTags:_e,isReadOnly:this.isReadOnly,updateTags:this.updateTags})),_.get(0)),this.$(".service-tags-input-control").append(_)},_renderEnableDisableControl:function _renderEnableDisableControl(){var s=1===this.serviceModelClone.get("enabled"),o=(0,D.default)("<div></div>").css({display:"inline-block"});K.default.unmountComponentAtNode(o.get(0)),K.default.render(j.default.createElement(oe.default,null,j.default.createElement($.default,{"data-test-itsi":"service-status-control-group",label:(0,Y.gettext)("Status")},j.default.createElement(ue.default,{dataTestItsi:"service-status-control-switch",enabled:s,showEnableDisableLabel:!0,onChange:this.onEnableDisable.bind(this),size:"medium",isReadOnly:this.isReadOnly}))),o.get(0)),this.$(".service-enable-disable-control").append(o)},_renderHealthScoreBackfillControl:function _renderHealthScoreBackfillControl(){var s=(0,D.default)("<div></div>").css({display:"table"});K.default.unmountComponentAtNode(s.get(0)),K.default.render(j.default.createElement(oe.default,null,j.default.createElement(pe.default,{kpiModel:this.healthScoreKPI,isReadOnly:this.isReadOnly,setBackfillEnabled:this.setBackfillEnabledStatus,setBackfillNeededStatus:this.setBackfillNeededStatus,setEarliestTime:this.setBackfillEarliestTime})),s.get(0)),this.$(".service-health-score-backfill-control").append(s)},_renderHealthScoreCalculateByEntityControl:function _renderHealthScoreCalculateByEntityControl(){var s=(0,D.default)("<div></div>").css({display:"table"});K.default.unmountComponentAtNode(s.get(0)),K.default.render(j.default.createElement(oe.default,null,j.default.createElement(fe.default,{serviceModel:this.serviceModelClone,serviceTemplate:this.serviceTemplate?this.serviceTemplate:null,sdDispatcher:this.sdDispatcher?this.sdDispatcher:null,isReadOnly:this.isReadOnly,setCalculateByEntityEnabled:this.setCalculateByEntityEnabledStatus})),s.get(0)),this.$(".service-health-score-calculate-by-entity-control").html(s)},_fetchHealthScoreKPI:function _fetchHealthScoreKPI(){var s=this.serviceModelClone.get("kpis"),o=(0,ie.getServiceHealthKpiId)(this.serviceModelClone.get("_key"));return s.get(o)},_setBackfillNeededStatus:function _setBackfillNeededStatus(s){this.healthScoreKPI._checkSummarizedDataCache.backfillNeeded=s},_setBackfillEarliestTime:function _setBackfillEarliestTime(s){this.healthScoreKPI.set({backfill_earliest_time:s})},_setBackfillEnabledStatus:function _setBackfillEnabledStatus(s){this.healthScoreKPI.set({backfill_enabled:s})},_setCalculateByEntityEnabledStatus:function _setCalculateByEntityEnabledStatus(s){this.serviceModelClone.set({is_healthscore_calculate_by_entity_enabled:s})},_updateTags:function _updateTags(s,o){var _,S;s&&(_=(0,W.default)(s,s=>s.toLocaleLowerCase())),o&&(S=(0,W.default)(o,s=>s.toLocaleLowerCase())),this.isBaseServiceTemplate?this.serviceModelClone.set({template_tags:_}):this.serviceModelClone.set({service_tags:{tags:_,template_tags:S}})},onEnableDisable:function onEnableDisable(s){var o=s?1:0;this.serviceModelClone.set({enabled:o})},refreshModel:function refreshModel(){this.render()}});o.default=Se;s.exports=o.default},2619:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N=S(_(7)),V=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),j=S(_(3)),K=S(_(15)),W=S(_(2)),U=S(_(24)),Y=S(_(131)),$=S(_(93)),X=S(_(113)),Z=_(4),Q=_(14),ee=S(_(721)),te=S(_(735)),ie=S(_(1427)),ae=_(110),ne=_(29),re=_(130);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var se=[{dataTestItsi:"service-health-table-kpi-title-column-header",label:(0,Z.gettext)("KPI Title")},{dataTestItsi:"service-health-table-simulated-severity-column-header",label:(0,Z.gettext)("Simulated Severity")},{dataTestItsi:"service-health-table-importance-column-header",label:(0,Z.gettext)("Importance")}],le=[{dataTestItsi:"service-health-table-dependent-kpi-title-column-header",label:(0,Z.gettext)("KPI Title")},{dataTestItsi:"service-health-table-dependent-service-title-column-header",label:(0,Z.gettext)("Service")},{dataTestItsi:"service-health-table-dependent-simulated-severity-column-header",label:(0,Z.gettext)("Simulated Severity")},{dataTestItsi:"service-health-table-dependent-importance-column-header",label:(0,Z.gettext)("Importance")}],oe=[{dataTestItsi:"service-health-table-kpi-title-cell",stringValueDataTestItsi:"service-health-table-kpi-title",stringValueTooltipDataTestItsi:"service-health-table-kpi-title-tooltip"},{dataTestItsi:"service-health-table-simulated-severity-title-cell",stringValueDataTestItsi:"service-health-table-simulated-severity-title",stringValueTooltipDataTestItsi:"service-health-table-simulated-severity-title-tooltip"},{dataTestItsi:"service-health-table-importance-cell",stringValueDataTestItsi:"service-health-table-importance",stringValueTooltipDataTestItsi:"service-health-table-importance-tooltip"}],de=[{dataTestItsi:"service-health-table-dependent-kpi-title-cell",stringValueDataTestItsi:"service-health-table-dependent-kpi-title",stringValueTooltipDataTestItsi:"service-health-table-dependent-kpi-title-tooltip"},{dataTestItsi:"service-health-table-dependent-service-title-cell",stringValueDataTestItsi:"service-health-table-dependent-service-title",stringValueTooltipDataTestItsi:"service-health-table-dependent-service-title-tooltip"},{dataTestItsi:"service-health-table-dependent-simulated-severity-title-cell",stringValueDataTestItsi:"service-health-table-dependent-simulated-severity-title",stringValueTooltipDataTestItsi:"service-health-table-dependent-simulated-severity-title-tooltip"},{dataTestItsi:"service-health-table-dependent-importance-cell",stringValueDataTestItsi:"service-health-table-dependent-importance-cell",stringValueTooltipDataTestItsi:"service-health-table-dependent-importance-cell-tooltip"}],ce=(0,W.default)($.default.Cell)(R||(R=(0,N.default)(["\n width: 400px;\n"]))),he=(0,W.default)($.default.Cell)(O||(O=(0,N.default)(["\n width: 160px;\n"]))),ue=W.default.div(P||(P=(0,N.default)(["\n display: flex;\n margin-bottom: 10px;\n"]))),pe=W.default.div(D||(D=(0,N.default)(["\n flex-grow: 1;\n"]))),fe=re.COUNTS_PER_PAGE_MODAL[0];function ImportanceTable(s){var{isBaseServiceTemplate:o,isDependentKPIs:_,isReadOnly:S,kpiCollection:R}=s,O=R.length,[P,D]=(0,V.useState)(1),N=_?le:se,j=_?de:oe,K=_?"service-health-dependent-kpis-importance-table":"service-health-kpis-importance-table",W=_?"service-health-dependent-kpis-importance-paginator":"service-health-kpis-importance-paginator";if(!O){var re=_?o?(0,Z.gettext)("This service template doesn't have any dependent KPIs."):(0,Z.gettext)("This service doesn't have any dependent KPIs."):o?(0,Z.gettext)("No KPIs found in this service template."):(0,Z.gettext)("No KPIs found in this service."),ge=_?"service-health-dependent-no-kpis-message":"service-health-no-kpis-message";return V.default.createElement(U.default,{"data-test-itsi":ge,type:"info"},re)}var me=P*fe-fe,ve=P*fe,ye=Math.ceil(O/fe);return V.default.createElement(V.default.Fragment,null,V.default.createElement(ue,null,V.default.createElement("div",{"data-test-itsi":"".concat(K,"-count")},(0,Q.sprintf)((0,ne.ungettext)("%d KPI","%d KPIs",O),O)),V.default.createElement(pe,null),ye>1&&V.default.createElement(Y.default,{current:P,"data-test-itsi":W,onChange:(s,o)=>{var{page:_}=o;D(_)},totalPages:ye})),V.default.createElement($.default,{"data-test-itsi":K,stripeRows:!0},V.default.createElement($.default.Head,null,N.map(s=>V.default.createElement($.default.HeadCell,{"data-test-itsi":s.dataTestItsi,key:s.dataTestItsi},s.label))),V.default.createElement($.default.Body,null,R.filter((s,o)=>me<=o&&o<ve).map((s,o)=>{var R=parseInt(s.get("urgency"),10);return V.default.createElement($.default.Row,{"data-test-itsi":"".concat(K,"-row"),key:"".concat(s.get("_key"),"-").concat(o)},_?V.default.createElement(V.default.Fragment,null,V.default.createElement($.default.Cell,{"data-test-itsi":j[0].dataTestItsi,key:"".concat(j[0].dataTestItsi,"-").concat(s.get("kpiTitle"),"-").concat(s.get("serviceTitle"),"-kpi-title")},V.default.createElement(ee.default,{dataTestItsi:j[0].stringValueDataTestItsi,maxWidth:350,tooltipDataTestItsi:j[0].stringValueTooltipDataTestItsi,value:s.get("kpiTitle")})),V.default.createElement($.default.Cell,{"data-test-itsi":j[1].dataTestItsi,key:"".concat(j[1].dataTestItsi,"-").concat(s.get("kpiTitle"),"-").concat(s.get("serviceTitle"),"-service-title")},V.default.createElement(ee.default,{dataTestItsi:j[1].stringValueDataTestItsi,maxWidth:350,tooltipDataTestItsi:j[1].stringValueTooltipDataTestItsi,value:s.get("serviceTitle")})),V.default.createElement(he,{"data-test-itsi":j[2].dataTestItsi,key:"".concat(j[2].dataTestItsi,"-").concat(s.get("kpiTitle"),"-").concat(s.get("serviceTitle"),"-severity")},V.default.createElement(te.default,{dataTestItsi:"dependent-kpi-severity-select",options:(0,ae.getImportanceValues)(),updateValueInParent:o=>{s.set("kpi_severity",o)},value:s.get("kpi_severity"),valueType:"string"})),V.default.createElement(ce,{"data-test-itsi":j[3].dataTestItsi,key:"".concat(j[3].dataTestItsi,"-").concat(s.get("kpiTitle"),"-").concat(s.get("serviceTitle"),"-urgency")},S?V.default.createElement(X.default,{"data-test-itsi":"health-score-dependent-importance-static-content"},R):V.default.createElement(ie.default,{dataTestItsi:"health-score-dependent-importance-slider",disabled:S,initialValue:R,max:11,min:0,onChange:o=>{s.set("urgency",o)},step:1}))):V.default.createElement(V.default.Fragment,null,V.default.createElement($.default.Cell,{"data-test-itsi":j[0].dataTestItsi,key:"".concat(j[0].dataTestItsi,"-").concat(s.get("title"),"-kpi-title")},V.default.createElement(ee.default,{dataTestItsi:j[0].stringValueDataTestItsi,maxWidth:700,tooltipDataTestItsi:j[0].stringValueTooltipDataTestItsi,value:s.get("title")})),V.default.createElement(he,{"data-test-itsi":j[1].dataTestItsi,key:"".concat(j[1].dataTestItsi,"-").concat(s.get("title"),"-health-score")},V.default.createElement(te.default,{dataTestItsi:"direct-kpi-severity-select",options:(0,ae.getImportanceValues)(),updateValueInParent:o=>{s.set("kpi_severity",o)},value:s.get("kpi_severity"),valueType:"string"})),V.default.createElement(ce,{"data-test-itsi":j[2].dataTestItsi,key:"".concat(j[2].dataTestItsi,"-").concat(s.get("title"),"-urgency")},S?V.default.createElement(X.default,{"data-test-itsi":"health-score-direct-importance-static-content"},R):V.default.createElement(ie.default,{dataTestItsi:"health-score-direct-importance-slider",disabled:S,initialValue:R,max:11,min:0,onChange:o=>{s.set("urgency",o)},step:1}))))}))))}ImportanceTable.propTypes={isBaseServiceTemplate:j.default.bool,isDependentKPIs:j.default.bool,isReadOnly:j.default.bool,kpiCollection:j.default.instanceOf(K.default.Collection).isRequired},ImportanceTable.defaultProps={isBaseServiceTemplate:!1,isDependentKPIs:!0,isReadOnly:!1};o.default=ImportanceTable;s.exports=o.default},2620:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(15)),O=_(45),P=S(_(94)),D=_(4),N=_(87),V=_(107),j=_(1762),K=S(_(2429)),W=S(_(2621));_(2622);var U=(0,O.template)(W.default,null,{variable:"vars"}),Y=R.default.View.extend({initialize:function initialize(s){this.serviceModel=s.serviceModel,this.collection=s&&s.collection,this.kpiToStatus=s&&s.kpiToStatus||{},this.dependentKpiCollection=s&&s.dependentKpiCollection,this.severityLabels=s.severityLabels,this.totalKpis=0,this.totalTriggers=0,this.healthModel=new R.default.Model,this.listenTo(this.collection,"add remove reset change",this.getDataAndShow),this.listenTo(this.collection,"change:urgency",function(s){s.gatherSearchClause({service:this.serviceModel})}.bind(this))},updateKpiToStatus:function updateKpiToStatus(s){this.kpiToStatus=s},getDataAndShow:(0,P.default)((function(){this.render()}),N.DEFAULT_DEBOUNCE_DELAY),getHealthData:function getHealthData(){var s=[],o=!1;if(this.collection.each(function(_){this.kpiToStatus[_.id]?s.push({urgency:_.get("urgency"),severity_name:this.kpiToStatus[_.id]}):o=!0}.bind(this)),this.dependentKpiCollection.each(function(_){this.kpiToStatus[_.id]?s.push({urgency:_.get("urgency"),severity_name:this.kpiToStatus[_.id]}):o=!0}.bind(this)),0===s.length)return o&&(this.healthModel.set({health_score:"N/A",health_severity_name:"unknown",health_severity_color:(0,V.getSeverityColor)(-1)}),this.trigger("set-tile-not-loading")),Promise.resolve();var _={severity_urgency_list:JSON.stringify(s)};return this.failedHealthScoreCalculation=!1,(0,j.retrieveHealthScore)(_).then(s=>s.data).then(s=>{this.healthModel.set(s.data),this.trigger("set-tile-not-loading")}).catch(()=>{this.failedHealthScoreCalculation=!0})},render:function render(){return this.$el.html('<div class="service-health-loading-text">'+(0,D.gettext)("Calculating health score...")+"</div>"),this.getHealthData().then(()=>{if(this.failedHealthScoreCalculation)this.$el.text((0,D.gettext)("Could not calculate health score."));else{this.$el.html(U({gettext:D.gettext,totalKpis:this.totalKpis||0,totalTriggers:this.totalTriggers||0,healthScore:this.healthModel.get("health_score")},{variables:"vars"}));var s=new K.default({model:this.healthModel,modelStatusAttribute:"health_severity_name",modelColorAttribute:"health_severity_color",severityLabels:this.severityLabels});this.$(".overview-latest-status").append(s.render().el)}}).catch(()=>{this.$el.text((0,D.gettext)("Could not calculate health score."))}),this}});o.default=Y;s.exports=o.default},2621:function(s,o){s.exports='<% if (vars.healthScore !== undefined && vars.healthScore !== null && vars.healthScore !== "") { %>\n\t<div class="overall-trigger-health-container" data-test-itsi="overall-trigger-health-container">\n\t\t<div class="overview-health-score pull-left inline-group">\n\t\t\t<div class="overview-health-score-text" data-test-itsi="overview-health-score-text"><%- vars.gettext("Composite Score") %>:</div>\n\t\t\t<div class="overview-health-score-value" data-test-itsi="overview-health-score-value"><%= vars.healthScore %></div>\n\t\t</div>\n\t\t<div class="overview-latest-status"></div>\n\t</div>\n\t<span class="help-block overall-trigger-health-help-block">\n\t\t<%- vars.gettext("Range: Critical 0-20, High 20-40, Medium 40-60, Low 60-80, Normal 80-100") %>\n\t</span>\n<% } %>'},2622:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1079),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2623:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V=S(_(17)),j=S(_(16)),K=S(_(21)),W=S(_(19)),U=S(_(20)),Y=S(_(8)),$=S(_(7)),X=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),Z=S(_(3)),Q=S(_(2)),ee=_(4),te=_(14),ie=_(554),ae=S(_(24)),ne=S(_(75)),re=_(145),se=_(29),le=_(67),oe=S(_(1455)),de=S(_(1456)),ce=S(_(557));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,W.default)(o),(0,K.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,W.default)(s).constructor):o.apply(s,_))}_(28);var he=(0,Q.default)(ne.default)(R||(R=(0,$.default)(["\n\tvertical-align: middle;\n\tmargin-right: 5px;\n"]))),ue=Q.default.div(O||(O=(0,$.default)(["\n\tpadding: 6px 140px;\n"]))),pe=(0,Q.default)(ae.default)(P||(P=(0,$.default)(["\n\tmargin-left: 140px;\n"]))),fe=(0,Q.default)(ae.default)(D||(D=(0,$.default)(["\n\tmargin-left: 57px;\n"]))),ge=(0,Q.default)(ae.default)(N||(N=(0,$.default)(["\n\tmargin-left: 140px;\n"]))),me={CHECK:re.BACKFILL_STATUSES.WAITING,UNAVAILABLE:re.BACKFILL_STATUSES.NOT_AVAILABLE,CONFIGURED:(0,ee.gettext)("Backfill has been configured for %(timeLabel)s of data.")},ve=0,ye=1,_e=2,Se=3,be=4,Ee=(0,ee.gettext)("It is advised that you first backfill the KPIs in this service and all dependent services for at least the time range selected here."),Te=(0,ee.gettext)("Enabling backfill for a KPI does not mean backfill has completed. Wait for a successful backfill completion message for all KPIs before backfilling the service health score."),Ce=(0,ee.gettext)("Please choose a date that is earlier than the current date."),ke=function(s){function HealthScoreBackfillControlView(s){var o;(0,j.default)(this,HealthScoreBackfillControlView);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,HealthScoreBackfillControlView,[s,...S]),(0,Y.default)(o,"componentDidMount",()=>{o.checkBackfillProgress()}),(0,Y.default)(o,"checkBackfillProgress",()=>{ce.default.fetchKpiBackfillRequests(o.props.kpiModel.get("_key")).done(s=>{if(s&&s[0]&&s[0].status)o.renderBackfillStatus(s[0].status),o.setState({renderStatus:ye});else if(!s)if(o.props.kpiModel.get("backfill_enabled")){var _=(0,ie.createRangeLabel)(o.state.backfillEarliest,"now").toLowerCase();o.setState({renderStatus:Se,backfillStatus:(0,te.sprintf)(me.CONFIGURED,{timeLabel:_})})}else o.setState({renderStatus:_e})})}),(0,Y.default)(o,"checkIfBackfillPeriodIsValid",s=>{var _=parseInt(o.earliestTimeonKPI,10),S=(new Date).getTime()/1e3-(0,le.relativeToSeconds)(s),R=!1;return(isNaN(_)||S<_)&&(R=!0),o.props.setBackfillNeededStatus(R),R}),(0,Y.default)(o,"getEarliestTimeAndCheckBackfillNeeded",()=>{o.setState({isBackfillEarliestInProgress:!0}),o.props.kpiModel.getSummaryIndexEarliest().done(s=>{o.earliestTimeonKPI=s;var _=o.props.kpiModel.get("backfill_earliest_time");if(o.checkIfBackfillPeriodIsValid(_)||_===re.BACKFILL_TIME_PERIOD_EARLIEST_INVALID_TIME)o.props.setBackfillNeededStatus(!0),o.setState({renderStatus:_e,isBackfillEarliestInProgress:!1});else{o.props.setBackfillNeededStatus(!1);var S=_.slice(1,_.length-1);o.setState({renderStatus:ve,backfillStatus:me.UNAVAILABLE,isBackfillEarliestInProgress:!1,backfillNotNeededMessage:(0,te.sprintf)((0,ee.gettext)("You already have %s day(s) of data in the summary index. Select a larger time range."),S)})}}).fail((s,_)=>{o.setState({renderStatus:be,backfillStatus:_})})}),(0,Y.default)(o,"onEnableDisableBackfill",s=>{s&&o.getEarliestTimeAndCheckBackfillNeeded(),o.props.setBackfillEnabled(s),o.setState({backfillEnabled:s,renderStatus:_e})}),(0,Y.default)(o,"setInputValidity",s=>{o.setState({inputIsValid:s})}),(0,Y.default)(o,"onTimePickerSelection",s=>{o.props.setEarliestTime(s);var _=o.checkIfBackfillPeriodIsValid(s),S=s.slice(1,s.length-1);_||s===re.BACKFILL_TIME_PERIOD_EARLIEST_INVALID_TIME?o.setState({renderStatus:_e,isBackfillEarliestInProgress:!1,backfillEarliest:s}):o.setState({renderStatus:ve,backfillStatus:me.UNAVAILABLE,isBackfillEarliestInProgress:!1,backfillNotNeededMessage:(0,te.sprintf)((0,ee.gettext)("You already have %s day(s) of data in the summary index. Select a larger time range."),S),backfillEarliest:s})}),(0,Y.default)(o,"renderBackfillState",()=>X.default.createElement(de.default,{backfillEnabled:o.state.backfillEnabled,backfillEarliest:o.state.backfillEarliest,onTimePickerSelection:o.onTimePickerSelection,setInputValidity:o.setInputValidity})),(0,Y.default)(o,"renderBackfillStatus",s=>{var _=o.state.backfillEarliest||o.props.kpiModel.get("backfill_earliest_time"),S=ce.default.renderBackfillStatus(s,_);o.setState({backfillStatus:S})}),(0,Y.default)(o,"getWaitingMessage",()=>X.default.createElement(ue,null,X.default.createElement(he,{"data-test-itsi":"backfill-status-wait-spinner"})," ",(0,ee.gettext)("Determining backfill status..."))),(0,Y.default)(o,"render",()=>{var s=o.getWaitingMessage();return X.default.createElement(X.Fragment,null,X.default.createElement("div",null,(o.state.renderStatus===_e||o.state.renderStatus===ve)&&X.default.createElement(X.Fragment,null,X.default.createElement("div",null,X.default.createElement(oe.default,{enabled:o.state.backfillEnabled,onChange:o.onEnableDisableBackfill,size:"medium",isReadOnly:o.props.isReadOnly})),o.renderBackfillState()),o.state.renderStatus!==_e&&o.state.renderStatus!==ve&&X.default.createElement("div",{"data-test-itsi":"service-backfill-status-message"},o.state.backfillStatus)),o.state.renderStatus===ve&&o.state.backfillNotNeededMessage&&X.default.createElement(pe,{"data-test-itsi":"backfill-not-needed-error-message",type:"error"},o.state.backfillNotNeededMessage),o.state.isBackfillEarliestInProgress&&s,!o.state.inputIsValid&&X.default.createElement(fe,{"data-test-itsi":"backfill-validation-error-message",type:"error"},Ce),o.state.backfillEnabled&&(o.state.renderStatus===_e||o.state.renderStatus===ve)&&X.default.createElement(ge,{"data-test-itsi":"backfill-warning-message",type:"warning"},X.default.createElement("div",null,Ee,X.default.createElement("br",null),Te)))}),o.state={backfillEnabled:(0,se.normalizeBoolean)(o.props.kpiModel.get("backfill_enabled")),backfillStatus:me.CHECK,renderStatus:ve,backfillEarliest:o.props.kpiModel.get("backfill_earliest_time"),inputIsValid:!0,isBackfillEarliestInProgress:!1,backfillNotNeededMessage:""},o}return(0,U.default)(HealthScoreBackfillControlView,s),(0,V.default)(HealthScoreBackfillControlView)}(X.Component);(0,Y.default)(ke,"propTypes",{kpiModel:Z.default.object.isRequired,setBackfillEnabled:Z.default.func.isRequired,setBackfillNeededStatus:Z.default.func.isRequired,setEarliestTime:Z.default.func.isRequired,isReadOnly:Z.default.bool}),(0,Y.default)(ke,"defaultProps",{isReadOnly:!1});o.default=ke;s.exports=o.default},2624:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(16)),P=S(_(17)),D=S(_(21)),N=S(_(19)),V=S(_(20)),j=S(_(8)),K=S(_(7)),W=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),U=S(_(3)),Y=S(_(69)),$=S(_(99)),X=S(_(50)),Z=S(_(39)),Q=S(_(2)),ee=S(_(121)),te=S(_(576)),ie=S(_(66)),ae=_(85),ne=_(554),re=_(4),se=_(145),le=_(96);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,N.default)(o),(0,D.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,N.default)(s).constructor):o.apply(s,_))}_(28);var oe=Q.default.div(R||(R=(0,K.default)(["\n\tdisplay: inline-block;\n\tvertical-align: middle;\n"]))),de=function(s){function BackfillTimePicker(s){var o;(0,O.default)(this,BackfillTimePicker);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,BackfillTimePicker,[s,...S]),(0,j.default)(o,"componentDidMount",()=>{if(o.props.currentSetBackfillPeriod&&o.props.backfillEnabled){var s=(0,Y.default)(se.BACKFILL_TIME_PERIOD_SELECT_LIST,s=>s.value===o.props.currentSetBackfillPeriod);if((0,$.default)(s)){var _,S,R=o.convertRangeToDate(o.props.currentSetBackfillPeriod);o.props.currentSetBackfillPeriod===se.BACKFILL_TIME_PERIOD_EARLIEST_INVALID_TIME?(_=se.BACKFILL_TIME_PERIOD_EARLIEST_INVALID_TIME,S=!1):(_=(0,ne.createRangeLabel)(o.props.currentSetBackfillPeriod,"now").toLowerCase(),S=!0),o.setState({datePickerVisible:!0,datePickerSelection:R,selectedTimeRange:o.props.currentSetBackfillPeriod,customSelectedLabel:_,inputIsValid:S})}else o.setState({selectedTimeRange:o.props.currentSetBackfillPeriod})}}),(0,j.default)(o,"convertRangeToDate",s=>{var o=s.slice(1,s.length-1);return ee.default.newSplunkTime().subtract(parseInt(o),"day").format("YYYY-MM-DD").toString()}),(0,j.default)(o,"convertDateToTimeRange",s=>{var o=ee.default.newSplunkTime();return ee.default.newSplunkTime({time:s,format:"YYYY-MM-DD"}).diff(o,"days")+"d"}),(0,j.default)(o,"setTimeSelection",(s,_)=>{var{value:S}=_,R=S;if("custom"===S){R=o.convertDateToTimeRange(o.defaultCustomDateSelected);var O=(0,ne.createRangeLabel)(R,"now").toLowerCase();o.setState({customSelectedLabel:O,datePickerVisible:!0,selectedTimeRange:R,inputIsValid:!0,datePickerSelection:o.defaultCustomDateSelected})}else o.setState({selectedTimeRange:S,datePickerVisible:!1,inputIsValid:!0,datePickerSelection:o.defaultCustomDateSelected});o.props.setInputValidity(!0),o.props.onTimePickerSelection(R)}),(0,j.default)(o,"handleCustomTimeSelection",(s,_)=>{var{value:S}=_,R=ee.default.newSplunkTime(),O=ee.default.newSplunkTime({time:S,format:"YYYY-MM-DD"}).isBefore(R,"day");if(O){var P=o.convertDateToTimeRange(S);o.props.onTimePickerSelection(P);var D=(0,ne.createRangeLabel)(P,"now").toLowerCase();o.setState({datePickerSelection:S,selectedTimeRange:P,customSelectedLabel:D,inputIsValid:O})}else o.props.onTimePickerSelection(se.BACKFILL_TIME_PERIOD_EARLIEST_INVALID_TIME),o.setState({selectedTimeRange:"",datePickerSelection:S,inputIsValid:O,customSelectedLabel:(0,re.gettext)("invalid time range")});o.props.setInputValidity(O)}),(0,j.default)(o,"renderBackfillSelection",()=>W.default.createElement(ie.default,{"data-test-itsi":"backfill-time-select",inline:!0,value:o.state.selectedTimeRange,placeholder:o.state.customSelectedLabel,onChange:o.setTimeSelection},(0,X.default)(se.BACKFILL_TIME_PERIOD_SELECT_LIST,s=>W.default.createElement(ie.default.Option,{"data-test-itsi":"backfill-time-select-option",key:s.value,label:s.label,value:s.value})))),(0,j.default)(o,"renderDatePicker",()=>W.default.createElement(te.default,{"data-test-itsi":"backfill-time-picker-date-control",locale:ae.locale,value:o.state.datePickerSelection,onChange:o.handleCustomTimeSelection,error:!o.state.inputIsValid})),o.defaultCustomTimeRange="-1d",o.defaultCustomDateSelected=o.convertRangeToDate(o.defaultCustomTimeRange),o.state={selectedTimeRange:se.BACKFILL_TIME_PERIOD_SELECT_LIST[0].value,datePickerVisible:!1,customSelectedLabel:(0,re.gettext)("Custom backfill date"),datePickerSelection:o.defaultCustomDateSelected,inputIsValid:!0},o}return(0,V.default)(BackfillTimePicker,s),(0,P.default)(BackfillTimePicker,[{key:"render",value:function render(){return W.default.createElement(oe,(0,le.createITSITestHook)(this.constructor.name),this.renderBackfillSelection(),this.state.datePickerVisible&&this.renderDatePicker())}}])}(W.Component);(0,j.default)(de,"propTypes",{onTimePickerSelection:U.default.func.isRequired,backfillEnabled:U.default.bool,currentSetBackfillPeriod:U.default.string,setInputValidity:U.default.func}),(0,j.default)(de,"defaultProps",{backfillEnabled:!1,currentSetBackfillPeriod:"-7d",setInputValidity:Z.default});o.default=de;s.exports=o.default},2625:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(17)),P=S(_(16)),D=S(_(21)),N=S(_(19)),V=S(_(20)),j=S(_(8)),K=S(_(7)),W=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),U=S(_(3)),Y=S(_(39)),$=S(_(2)),X=_(29),Z=S(_(2626));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,N.default)(o),(0,D.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,N.default)(s).constructor):o.apply(s,_))}_(28);var Q=$.default.div(R||(R=(0,K.default)(["\n\tdisplay: table-cell;\n\tvertical-align: middle;\n"]))),ee=function(s){function HealthScoreCalculateByEntityControlView(s){var o;(0,P.default)(this,HealthScoreCalculateByEntityControlView);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,HealthScoreCalculateByEntityControlView,[s,...S]),(0,j.default)(o,"componentDidMount",()=>{o.props.isReadOnly?o.resetState():o.checkIfAtleastOneKPIHasSplitByEntity()}),(0,j.default)(o,"resetState",()=>{var s=o.props.isReadOnly;o.setState({isReadOnly:s})}),(0,j.default)(o,"checkIfAtleastOneKPIHasSplitByEntity",()=>{var s=o.props.serviceModel.get("kpis").some((function(s){return s.get("is_entity_breakdown")}));o.setState({isReadOnly:!s})}),(0,j.default)(o,"onEnableDisableCalculateByEntity",s=>{o.props.setCalculateByEntityEnabled(s),o.setState({calculateByEntityEnabled:s})}),(0,j.default)(o,"setInputValidity",s=>{o.setState({inputIsValid:s})}),(0,j.default)(o,"render",()=>W.default.createElement(W.Fragment,null,W.default.createElement("div",null,W.default.createElement(W.Fragment,null,W.default.createElement(Q,null,W.default.createElement(Z.default,{serviceModel:o.props.serviceModel,serviceTemplate:o.props.serviceTemplate?o.props.serviceTemplate:null,sdDispatcher:o.props.sdDispatcher?o.props.sdDispatcher:null,enabled:o.state.calculateByEntityEnabled,onChange:o.onEnableDisableCalculateByEntity,size:"medium",isReadOnly:o.state.isReadOnly})))))),o.state={calculateByEntityEnabled:(0,X.normalizeBoolean)(o.props.serviceModel.get("is_healthscore_calculate_by_entity_enabled"))},o}return(0,V.default)(HealthScoreCalculateByEntityControlView,s),(0,O.default)(HealthScoreCalculateByEntityControlView)}(W.Component);(0,j.default)(ee,"propTypes",{serviceModel:U.default.object.isRequired,serviceTemplate:U.default.object,sdDispatcher:U.default.object,setCalculateByEntityEnabled:U.default.func,isReadOnly:U.default.bool}),(0,j.default)(ee,"defaultProps",{serviceTemplate:null,sdDispatcher:null,setCalculateByEntityEnabled:Y.default,isReadOnly:!1});o.default=ee;s.exports=o.default},2626:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N=S(_(17)),V=S(_(16)),j=S(_(21)),K=S(_(19)),W=S(_(20)),U=S(_(8)),Y=S(_(7)),$=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),X=S(_(3)),Z=S(_(2)),Q=S(_(44)),ee=S(_(34)),te=S(_(671)),ie=S(_(103)),ae=S(_(89)),ne=_(4),re=_(14),se=_(108),le=_(57),oe=S(_(598));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,K.default)(o),(0,j.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,K.default)(s).constructor):o.apply(s,_))}_(28);var de=(0,Z.default)(ie.default)(R||(R=(0,Y.default)(["\n padding: 0;\n\tdisplay: inline-block;\n\tvertical-align: bottom;\n"]))),ce=(0,Z.default)(ae.default)(O||(O=(0,Y.default)(["\n\tpadding-left: 2px\n"]))),he=(0,Z.default)(te.default)(P||(P=(0,Y.default)(["\n\tmargin: 2px;\n\tpadding-top: 6px;\n"]))),ue=Z.default.div(D||(D=(0,Y.default)(["\n display: inline-block;\n\tmargin-left: 10px;\n\tmargin-top: 5px;\n"]))),pe=function(s){function CalculateByEntityToggleControl(s){var o;(0,V.default)(this,CalculateByEntityToggleControl);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,CalculateByEntityToggleControl,[s,...S]),(0,U.default)(o,"handleClick",(s,_)=>{var{serviceModel:S}=o.props;o.value=_,S.get("object_type")===le.OBJECT_TYPE&&S.get("base_service_template_id")?o.setState({showUnlinkWarningModal:!0}):o.switchValueHandler()}),(0,U.default)(o,"switchValueHandler",()=>{var s=!o.value.value;o.setState({isSelected:s}),o.props.onChange(s)}),(0,U.default)(o,"_showUnlinkWarningModal",()=>{var{serviceModel:s,serviceTemplate:_}=o.props;if(o.state.showUnlinkWarningModal){var S=(0,ne.gettext)("Update Include Entities");return $.default.createElement("div",{className:"unlink-warning-modal","data-test-itsi":"calculate-by-entity-toggle-control-container"},$.default.createElement(oe.default,{modalTitleSubstring:S,serviceTitle:s.get("title"),serviceTemplateTitle:_.get("title"),serviceTemplateUrl:_.getEditUrl(),isModalOpen:!0,handleAcceptToUnlink:o.handleAcceptToUnlink.bind(o),handleDeclineToUnlink:o.handleDeclineToUnlink.bind(o)}))}}),(0,U.default)(o,"handleAcceptToUnlink",()=>{var{sdDispatcher:s}=o.props;s.trigger("unsetBaseServiceTemplateId",o.props.serviceModel),s.trigger("unlink"),o.switchValueHandler()}),(0,U.default)(o,"handleDeclineToUnlink",()=>{o.setState({showUnlinkWarningModal:!1})}),(0,U.default)(o,"render",()=>{var s=!!o.state.isSelected,_=o._showUnlinkWarningModal(),{isReadOnly:S,serviceModel:R,serviceTemplate:O,size:P,tooltipContent:D}=o.props;return $.default.createElement(Q.default,{"data-test-itsi":"calculate-by-entity-toggle-control-group",label:(0,ne.gettext)("Include Entities"),tooltip:D},$.default.createElement(de,{"data-test-itsi":"calculate-by-entity-control-switch",value:s,appearance:"toggle",selected:s,onClick:o.handleClick,size:P,disabled:S},!S&&R.get("object_type")===le.OBJECT_TYPE&&!!R.get("base_service_template_id")&&$.default.createElement(ce,{content:(0,re.sprintf)((0,ne.gettext)("KPI linked to service template %(title)s."),{title:O.get("title","")}),"data-test-itsi":"calculate-by-entity-toggle-from-service-locked-tooltip"},$.default.createElement(he,{"data-test-itsi":"calculate-by-entity-toggle-from-service-locked-icon"}))),$.default.createElement(ue,null,$.default.createElement(ee.default,{"data-test-itsi":"kpi-importance-more-info-link",openInNewContext:!0,to:(0,se.makeDocsURL)(se.DOCS_PAGES.ITSI_KPI_IMPORTANCE)},(0,ne.gettext)("More Info"))),_)}),o.state={isSelected:o.props.enabled,showUnlinkWarningModal:!1},o}return(0,W.default)(CalculateByEntityToggleControl,s),(0,N.default)(CalculateByEntityToggleControl)}($.Component);(0,U.default)(pe,"propTypes",{serviceModel:X.default.object.isRequired,serviceTemplate:X.default.object,sdDispatcher:X.default.object,onChange:X.default.func.isRequired,enabled:X.default.bool,isReadOnly:X.default.bool,size:X.default.string,tooltipContent:X.default.string}),(0,U.default)(pe,"defaultProps",{serviceTemplate:null,sdDispatcher:null,enabled:!0,size:"small",isReadOnly:!1,tooltipContent:(0,ne.gettext)("Service health score calculation accounts for the severity levels of individual entities if at least one KPI is split by entity")});o.default=pe;s.exports=o.default},2627:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(16)),P=S(_(17)),D=S(_(21)),N=S(_(19)),V=S(_(20)),j=S(_(8)),K=S(_(7)),W=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),U=S(_(3)),Y=S(_(2)),$=S(_(486)),X=S(_(37)),Z=S(_(95)),Q=S(_(62)),ee=S(_(86)),te=S(_(50)),ie=S(_(594)),ae=S(_(349)),ne=S(_(732)),re=S(_(172)),se=S(_(725)),le=S(_(311)),oe=S(_(582)),de=S(_(1026)),ce=S(_(44)),he=S(_(231)),ue=_(22),pe=_(14),fe=_(4),ge=_(96),me=_(2628);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,N.default)(o),(0,D.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,N.default)(s).constructor):o.apply(s,_))}_(28);var ve=(0,fe.gettext)("Tags with a lock icon come from a service template but can be removed. Tags are case insensitive and will not be added if an existing tag in a different case already exists. All tags will be converted to lower case upon save."),ye=(0,Y.default)(de.default)(R||(R=(0,K.default)(["\n\tcolor: ",";\n"])),ue.variables.warningColor),_e=W.default.createElement(ye,{"data-test-itsi":"service-tags-icon-unlocked"}),Se=function(s){function ServiceTagsControlView(s){var o;(0,O.default)(this,ServiceTagsControlView);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,ServiceTagsControlView,[s,...S]),(0,j.default)(o,"handleServiceTagChange",(s,_)=>{var{values:S}=_,{currentTagsNames:R,currentTagsService:O,currentTagsFromTemplate:P}=o.state,{updateTags:D}=o.props,N=(0,te.default)(R,s=>(0,se.default)(s)),V=(0,Z.default)(S,s=>!o.hasSpecialCharInInput(s)),j=(0,te.default)(V,s=>(0,se.default)(s)),K=(0,oe.default)(V,s=>(0,se.default)(s)),W=(0,Z.default)(N,s=>!j.includes(s)),U=(0,Z.default)(K,s=>!N.includes((0,se.default)(s)));(0,X.default)(W,s=>{O=(0,ie.default)(O,o=>(0,se.default)(o)===(0,se.default)(s)),P=(0,ie.default)(P,o=>(0,se.default)(o)===(0,se.default)(s))});var Y=O.concat(U);D(Y,P),o.setState({currentTagsNames:K,currentTagsService:Y,currentTagsFromTemplate:P,tagsToRender:R}),o.handleFetch("",K)}),(0,j.default)(o,"handleServiceTemplateTagChange",(s,_)=>{var{values:S}=_,{currentTagsNames:R,currentTemplateTags:O}=o.state,{updateTags:P}=o.props,D=(0,te.default)(R,s=>(0,se.default)(s)),N=(0,Z.default)(S,s=>!o.hasSpecialCharInInput(s)),V=(0,te.default)(N,s=>(0,se.default)(s)),j=(0,oe.default)(N,s=>(0,se.default)(s)),K=(0,Z.default)(D,s=>!V.includes(s)),W=(0,Z.default)(j,s=>!D.includes((0,se.default)(s)));(0,X.default)(K,s=>{O=(0,ie.default)(O,o=>(0,se.default)(o)===(0,se.default)(s))});var U=O.concat(W);P(U),o.setState({currentTagsNames:j,currentTemplateTags:U,tagsToRender:R}),o.handleFetch("",j)}),(0,j.default)(o,"handleFetch",(s,_)=>{var{allServiceTags:S}=o.props,R=(0,te.default)(_,s=>(0,se.default)(s)),O=(0,Z.default)(S,s=>!(0,Q.default)(R,(0,se.default)(s))).filter(o=>(0,Q.default)((0,se.default)(o),(0,se.default)(s))),P=(0,ae.default)(O),D=P>10?10:P;o.setState({count:D,fullCount:P,filteredTags:O})}),(0,j.default)(o,"hasSpecialCharInInput",s=>new RegExp("[=\"'/\\\\!@$^*,.?;|]+|\\s+$").test(s)),(0,j.default)(o,"handleFilterChange",(s,_)=>{var{keyword:S}=_,{currentTagsNames:R}=o.state,O=o.hasSpecialCharInInput(S);o.handleFetch(S,R),o.setState({keyword:S,inputContainsSpecialChar:O})}),(0,j.default)(o,"renderMultiselectOptions",()=>{var{filteredTags:s}=o.state,_=(0,ne.default)(s,0,10);return(0,re.default)(_,s=>(0,se.default)(s))}),(0,j.default)(o,"renderFooter",()=>{var{count:s,fullCount:_,inputContainsSpecialChar:S}=o.state,R=null;return S?R=(0,fe.gettext)("Tags cannot contain trailing spaces or the following characters:")+" "+me.TAGS_RESTRICTED_CHARS:_>0&&(R=(0,pe.sprintf)((0,fe.gettext)("Showing %(subtotal)d of %(total)d tags"),{subtotal:s,total:_})),R}),(0,j.default)(o,"renderTag",s=>{var{currentTagsFromTemplate:_}=o.state,S=!o.isServiceTemplate&&_.includes(s);return s?W.default.createElement(he.default.Option,{"data-test-itsi":"service-tags-multiselect-option",label:s,value:s,key:s,icon:S&&_e}):null}),o.state={count:0,currentTagsNames:[],currentTagsService:[],currentTagsFromTemplate:[],currentTemplateTags:[],filteredTags:[],fullCount:0,keyword:"",inputContainsSpecialChar:!1,tagsToRender:[]},o.isServiceTemplate=(0,ee.default)(s.existingTags),o}return(0,V.default)(ServiceTagsControlView,s),(0,P.default)(ServiceTagsControlView,[{key:"componentDidMount",value:function componentDidMount(){var s,o,_,S,{existingTags:R}=this.props;this.isServiceTemplate?(_=R,S=(0,re.default)(R,s=>(0,se.default)(s))):(s=R.tags||[],o=R.template_tags||[],S=(0,re.default)((0,$.default)(s,o),s=>(0,se.default)(s))),this.setState({currentTagsNames:S,currentTagsService:s,currentTagsFromTemplate:o,currentTemplateTags:_,tagsToRender:S}),this.handleFetch("",S)}},{key:"render",value:function render(){var{currentTagsNames:s,inputContainsSpecialChar:o,tagsToRender:_}=this.state,{isReadOnly:S}=this.props,R=this.renderMultiselectOptions(),O=(0,te.default)((0,le.default)(_,R),s=>this.renderTag(s)),P=this.renderFooter();return W.default.createElement("div",(0,ge.createITSITestHook)(this.constructor.name),W.default.createElement(ce.default,{"data-test-itsi":"service-tags-control-group",label:(0,fe.gettext)("Tags"),tooltip:ve},W.default.createElement(he.default,{allowNewValues:!0,controlledFilter:!0,inline:!0,"data-test-itsi":"service-tags-multiselect",disabled:S,defaultPlacement:"below",error:o,footerMessage:P,onChange:this.isServiceTemplate?this.handleServiceTemplateTagChange:this.handleServiceTagChange,onFilterChange:this.handleFilterChange,values:s},O)))}}])}(W.Component);Se.propTypes={allServiceTags:U.default.arrayOf(U.default.string),existingTags:U.default.oneOfType([U.default.array,U.default.object]).isRequired,isReadOnly:U.default.bool.isRequired,updateTags:U.default.func.isRequired},Se.defaultProps={allServiceTags:[]};o.default=Se;s.exports=o.default},2628:function(s,o,_){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.TAGS_RESTRICTED_CHARS=void 0;o.TAGS_RESTRICTED_CHARS="\\ / | \" ' * ! @ ? . , ; $ ^"},2629:function(s,o){s.exports='<h3 class="settings-tab-title" data-test-itsi="general-settings-title"><%- vars.gettext("General") %></h3>\n<div class="service-enable-disable-control general-settings-control"></div>\n<div class="security-group-dropdown-control general-settings-control"></div>\n<div class="service-tags-input-control general-settings-control"></div>\n<div class="health-score-header">\n <h3 class="settings-tab-title" data-test-itsi="service-health-score-title"><%- vars.gettext("Service Health Score") %></h3>\n <% if (!vars.isBaseServiceTemplate) {%>\n <div class="service-health-score-backfill-control general-settings-control" data-test-itsi="service-health-score-backfill-control"></div>\n <% } %>\n <div class="service-health-score-calculate-by-entity-control general-settings-control"></div>\n</div>\n<div class="health-score-title-sub-section">\n <h3 class="settings-tab-title" data-test-itsi="health-score-calculation-title"><%- vars.gettext("Health Score Calculation") %></h3>\n <div class="health-score-title-description" data-test-itsi="health-score-title-description"></div>\n</div>\n<div class="health-score-content">\n <div class="kpi-severity-importance-table-container"></div>\n <div class="service-health-tile-container" data-test-itsi="service-health-tile-container">\n <div class="service-health-tile-header" data-test-itsi="service-health-tile-header"></div>\n <div class="service-health-tile"></div>\n </div>\n</div>'},2630:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1080),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2631:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=_(57),P=S(_(276)),D=P.default.extend({dataTestItsi:"base-service-kpis-tab",initialize:function initialize(s){(s=s||{}).tabId=O.SERVICE_DEFINITION_TABS.KPI,s.tabLabel=(0,R.gettext)("KPIs"),P.default.prototype.initialize.apply(this,arguments)}});o.default=D;s.exports=o.default},2632:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(236)),P=S(_(15)),D=S(_(0)),N=S(_(35)),V=_(46),j=S(_(38)),K=_(4),W=_(376),U=_(141),Y=_(57),$=S(_(1839)),X=_(306),Z=S(_(474)),Q=S(_(688)),ee=S(_(1226)),te=S(_(557)),ie=S(_(2679)),ae=S(_(1465)),ne=S(_(1057)),re=S(_(1053));_(2708);var se=(0,W.getStore)(),le=P.default.View.extend({KpiMainContentView:ae.default,ServiceHealthView:re.default,initialize:function initialize(s){s=s||{},this.featureFlags=s.featureFlags,this.entityATEnabled=this.featureFlags[U.featureFlagsStanzas.ENTITY_LEVEL_AT],this.appsData=s.appsData,this.permissions=s.permissions,this.thresholdTemplateCollection=s.thresholdTemplateCollection,this.userData=s.userData,this.readOnly=s.readOnly,this.serviceTemplate=s.serviceTemplate,this.sdDispatcher=s.sdDispatcher,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.hideAnomalyDetectionPanel=s.hideAnomalyDetectionPanel,this.hideRecommendedThresholding=s.hideRecommendedThresholding,this.severityLabels=s.severityLabels,this.kpiToShow=s.kpiToShow,this.baseSearchCache={},this.previewServiceCache={},this.kpiCollection=this.serviceObj.get("kpis"),this.clonedKpiCollection=this.serviceObj.get("kpis").primarykpis.clone(),!this.kpiToShow&&this.kpiCollection&&this.kpiCollection.primarykpis&&this.kpiCollection.primarykpis.length&&(this.kpiToShow=this.kpiCollection.primarykpis.models[0].get("_key")),this._buildKpiListView(),this._bindKpiCollectionEvents(),this.sdDispatcher&&this.listenTo(this.sdDispatcher,"unlink",this.refreshModel),P.default.View.prototype.initialize.apply(this,arguments)},_buildKpiListView:function _buildKpiListView(){this.kpiListView&&this.kpiListView.remove(),this.kpiListView=new ie.default({service:this.serviceObj,collection:this.kpiCollection,readOnly:this.readOnly,serviceTemplate:this.serviceTemplate,sdDispatcher:this.sdDispatcher}),this.listenTo(this.kpiListView,"collectionview:rowselected",this._onKpiSelected),this.listenTo(this.kpiListView,"newkpi",this._onNewKPI)},_resetKpiCollection:function _resetKpiCollection(){this.kpiCollection&&this.stopListening(this.kpiCollection),this.kpiCollection=this.serviceObj.get("kpis"),this.serviceKpiBackfillMapping=te.default.getKpiBackfillStatus(this.serviceObj),this._bindKpiCollectionEvents()},_bindKpiCollectionEvents:function _bindKpiCollectionEvents(){this.listenTo(this.kpiCollection,"change add",this._onKPIChanged),this.listenTo(this.kpiCollection,"remove",this._onKPIDeleted)},selectKpi:function selectKpi(s){this.kpiListView.selectItem(s)},_onKpiSelected:function _onKpiSelected(s,o){this.mainContent&&this.mainContent.remove();var _=o.model;_._cachedBackfillProgressStatus=_._cachedBackfillProgressStatus||{},!0===_.get("backfill_enabled")&&(this.kpiBackfillReqDfd=te.default.getBackfillDataForKpi(_.id),this.kpiBackfillReqDfd.done((s,o)=>{_._cachedBackfillProgressStatus={progress:s,status:o}})),this._renderOnKpiSelected(_)},handleUpdateKpiModel:function handleUpdateKpiModel(s,o){var _=(0,j.default)(s.parse(o.toJSON()),["aggregate_thresholds","entity_thresholds","time_variate_thresholds_specification","skip_kpi_validation"]);s.set(_),s.trigger("change:time_variate_thresholds"),this._renderOnKpiSelected(s)},_renderOnKpiSelected:function _renderOnKpiSelected(s){var o;s.get("type")!==Y.KPI_TYPES.SERVICE_HEALTH?this.entityATEnabled?(o=(0,R.default)('<div data-test-itsi="kpi-main-content"></div>'),N.default.unmountComponentAtNode(o.get(0)),N.default.render(D.default.createElement(V.Provider,{store:se},D.default.createElement(Z.default,null,D.default.createElement(X.ThresholdingProvider,{kpiModel:s,originalKpiCollection:this.clonedKpiCollection,serviceKey:this.serviceObj.get("_key")},D.default.createElement($.default,{appsData:this.appsData,featureFlags:this.featureFlags,hideAnomalyDetectionPanel:this.hideAnomalyDetectionPanel||!1,isReadOnly:this.readOnly||!1,sdDispatcher:this.sdDispatcher,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping,serviceModel:this.serviceObj,serviceTemplate:this.serviceTemplate,thresholdTemplateCollection:this.thresholdTemplateCollection,previewServiceCache:this.previewServiceCache,handleUpdateKpiModelCallback:this.handleUpdateKpiModel.bind(this)})))),o.get(0))):this.mainContent=new this.KpiMainContentView({featureFlags:this.featureFlags,appsData:this.appsData,kpiModel:s,serviceModel:this.serviceObj,readOnly:this.readOnly,hideAnomalyDetectionPanel:this.hideAnomalyDetectionPanel,hideRecommendedThresholding:this.hideRecommendedThresholding,serviceTemplate:this.serviceTemplate,sdDispatcher:this.sdDispatcher,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping,permissions:this.permissions,previewServiceCache:this.previewServiceCache,baseSearchCache:this.baseSearchCache,thresholdTemplateCollection:this.thresholdTemplateCollection,userData:this.userData}):this.mainContent=new this.ServiceHealthView({serviceModel:this.serviceObj,severityLabels:this.severityLabels}),this.$mainContentEl.html(""),o?this.$mainContentEl.append(o):this.$mainContentEl.append(this.mainContent.render().$el),this.$el.trigger("kpiselected",this,s.id)},_onKPIDeleted:function _onKPIDeleted(){delete this.mainContent,this.renderNoSelection(),this.serviceObj.trigger("change",this.serviceObj)},_onNewKPI:function _onNewKPI(s,o){this._performNewKpi(s,o)},_performNewKpi:function _performNewKpi(s,o){var _,S={service:this.serviceObj,parse:!0};if(o)delete(_=o.toJSON())._key;else{var P=this.kpiCollection.primarykpis.length+1;_={title:this.serviceObj.get("title")+" KPI "+P}}_._key=this.serviceObj.generateKpiId();var D=new Q.default(_,S),N=function(){var o=new ne.default({featureFlags:this.featureFlags,kpiModel:D,serviceModel:this.serviceObj,showFTRSteps:!0,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping});this.listenToOnce(o,"kpicreated",function(o){D.set(D.parse(o.toJSON())),this.kpiCollection.add(D),this.clonedKpiCollection.add(D),s.selectItem(D.id)}.bind(this)),(0,R.default)("body").append(o.render().el),o.show()}.bind(this);(0,O.default)(o)?D.gatherSearchClause({service:this.serviceObj}).always(function(){N()}.bind(this)):N()},getSelectedKpiId:function getSelectedKpiId(){var s=this.kpiListView.getSelected();return s&&s.length>0?s[0].model.id:null},_onKPIChanged:function _onKPIChanged(){this.serviceObj.trigger("change")},refreshModel:function refreshModel(){var s=null;if(this.kpiListView){var o=this.kpiListView.getSelected();o&&o.length>0&&(s=o[0].model.id)}this._resetKpiCollection(),this._buildKpiListView(),this.render(),s&&this.kpiListView.selectItem(s)},renderNoSelection:function renderNoSelection(){this.$mainContentEl.html('<div class="kpi-no-selection" data-test-itsi="kpi-no-selection">'+(0,K.gettext)("Create your first KPI or clone a KPI from the left side panel.")+"</div>")},render:function render(){this.$mainContentEl=(0,R.default)("<div ".concat(!this.entityATEnabled&&'class="kpi-main-content"',' data-test-itsi="kpi-main-content"></div>')),this.kpiToShow||this.renderNoSelection();var s=new ee.default({sidebarContent:this.kpiListView.render().$el,mainContent:this.$mainContentEl});return this.$el.html(s.render().$el),this.kpiToShow&&this.selectKpi(this.kpiToShow),this},remove:function remove(){return this.kpiListView&&this.kpiListView.remove(),this.mainContent&&this.mainContent.remove(),P.default.View.prototype.remove.apply(this,arguments)}});o.default=le;s.exports=o.default},2633:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q,ee,te,ie,ae,ne,re,se,le,oe,de,ce,he,ue,pe,fe=S(_(8)),ge=S(_(7)),me=_interopRequireWildcard(_(0)),ve=_(46),ye=S(_(3)),_e=S(_(2)),Se=S(_(484)),be=S(_(140)),Ee=S(_(81)),Te=S(_(94)),Ce=S(_(33)),ke=S(_(99)),xe=S(_(485)),we=S(_(39)),Re=S(_(38)),Ie=S(_(147)),Me=_(740),Oe=_interopRequireWildcard(_(337)),Ae=_(322),Pe=S(_(704)),De=S(_(27)),Le=S(_(976)),Ne=S(_(718)),Ve=S(_(266)),je=S(_(615)),He=S(_(304)),Be=S(_(267)),Ke=S(_(156)),Fe=S(_(44)),We=S(_(348)),Ue=S(_(64)),Ge=S(_(24)),Ye=S(_(51)),qe=S(_(383)),ze=S(_(66)),$e=S(_(113)),Je=S(_(103)),Xe=S(_(313)),Ze=S(_(89)),Qe=S(_(75)),et=S(_(116)),tt=_(125),it=_(14),at=_(4),nt=_(29),rt=_(87),st=_(130),lt=_(110),ot=_(617),dt=_(555),ct=_(102),ht=_(501),ut=S(_(1054)),pt=S(_(1055)),ft=S(_(1457)),gt=S(_(1458)),mt=S(_(2641)),vt=S(_(2642)),yt=S(_(815)),_t=_(306),St=S(_(706)),bt=_(384);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,fe.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var Et=me.default.createElement(Me.AIIcon,{width:"20px",height:"20px"}),Tt=me.default.createElement(Pe.default,null),Ct=me.default.createElement(Ne.default,null),kt=me.default.createElement(Le.default,null),xt=_e.default.div(R||(R=(0,ge.default)(["\n padding: 7px;\n"]))),wt=(0,_e.default)(De.default)(O||(O=(0,ge.default)(["\n width: 100%;\n"]))),Rt=(0,_e.default)(je.default)(P||(P=(0,ge.default)(["\n color: ",";\n margin-right: 10px;\n"])),et.default.successColor),It=(0,_e.default)(He.default)(D||(D=(0,ge.default)(["\n color: ",";\n"])),et.default.errorColor),Mt=(0,_e.default)(Be.default)(N||(N=(0,ge.default)(["\n color: ",";\n"])),et.default.warningColor),Ot=(0,_e.default)(Ke.default)(V||(V=(0,ge.default)(["\n color: ",";\n"])),et.default.linkColor),At=(0,_e.default)(Ke.default)(j||(j=(0,ge.default)(["\n color: ",";\n cursor: pointer;\n margin-bottom: 10px;\n margin-left: 14px;\n"])),et.default.linkColor),Pt=_e.default.div(K||(K=(0,ge.default)(["\n display: flex;\n padding: 5px;\n gap: 5px;\n"]))),Dt=_e.default.div(W||(W=(0,ge.default)(["\n display: flex;\n padding: 5px;\n flex-wrap: wrap;\n"]))),Lt=_e.default.div(U||(U=(0,ge.default)(["\n display: flex;\n"]))),Nt=_e.default.div(Y||(Y=(0,ge.default)(["\n display: flex;\n flex-direction: column;\n gap: 10px;\n margin-left: 20px;\n margin-top: 20px;\n"]))),Vt=_e.default.div($||($=(0,ge.default)(["\n display: flex;\n gap: 10px;\n"]))),jt=(0,_e.default)(De.default)(X||(X=(0,ge.default)(["\n max-width: 97px;\n"]))),Ht=(0,_e.default)(We.default)(Z||(Z=(0,ge.default)(["\n margin-left: 20px;\n margin-top: 20px;\n width: 400px;\n"]))),Bt=_e.default.div(Q||(Q=(0,ge.default)(["\n margin-left: 10px;\n padding-top: 15px;\n width: 100%;\n"]))),Kt=(0,_e.default)(Ge.default)(ee||(ee=(0,ge.default)(["\n margin-left: 25px;\n\n [data-test='content'] {\n display: block;\n }\n"]))),Ft=_e.default.div(te||(te=(0,ge.default)(["\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"]))),Wt=_e.default.img(ie||(ie=(0,ge.default)(["\n display: block;\n margin-left: auto;\n margin-right: auto;\n"]))),Ut=(0,_e.default)(Ye.default)(ae||(ae=(0,ge.default)(["\n text-align: center;\n margin-top: 20px;\n margin-bottom: 30px;\n"]))),Gt=_e.default.div(ne||(ne=(0,ge.default)(["\n width: ",";\n float: left;\n min-height: ",";\n box-sizing: border-box;\n border-right: 1px solid ",";\n"])),s=>"".concat(s.panelWidth,"px"),dt.DASHBOARD_HEIGHT,et.default.borderLightColor),Yt=_e.default.div(re||(re=(0,ge.default)(["\n min-height: ",";\n display: flex;\n flex-direction: ",";\n justify-content: flex-start;\n align-items: center;\n flex-wrap: wrap;\n border-bottom: 1px solid ",";\n padding-top: ",";\n"])),s=>s.folded?"800px":"40px",s=>s.folded?"column":"row",s=>s.folded?"transparent":et.default.borderLightColor,s=>s.folded?"10px":"0px"),qt=(0,_e.default)(Ke.default)(se||(se=(0,ge.default)(["\n align-items: center;\n display: flex;\n flex-direction: ",";\n width: 100%;\n min-height: ",";\n padding-left: 5px;\n"])),s=>s.folded?"column":"row",s=>s.folded?"800px":"100%"),zt=(0,_e.default)($e.default)(le||(le=(0,ge.default)(["\n align-items: center;\n"]))),$t=(0,_e.default)(Xe.default)(oe||(oe=(0,ge.default)(["\n width: 100%;\n"]))),Jt=(0,_e.default)(Qe.default)(de||(de=(0,ge.default)(["\n justify-content: center;\n padding-top: 10px;\n width: 200px;\n"]))),Xt=(0,_e.default)(Ze.default)(ce||(ce=(0,ge.default)(["\n margin-left: 5px;\n"]))),Zt=(0,_e.default)(Fe.default)(he||(he=(0,ge.default)(["\n margin: 0px;\n padding: 7px;\n"]))),Qt=(0,_e.default)(qe.default)(ue||(ue=(0,ge.default)(["\n overflow: auto;\n height: 600px;\n width: 100%;\n"]))),ei=_e.default.div(pe||(pe=(0,ge.default)(["\n padding: 5px;\n border-top: 1px dotted ",";\n color: ",";\n"])),et.default.borderColor,et.default.textGray),ti=(0,Oe.makeCreateToast)(Oe.default),ii=me.default.createElement(It,{"data-test-itsi":"entity-thresholding-error-icon"}),ai=me.default.createElement(Mt,{"data-test-itsi":"base-configuration-tab-warning-icon",variant:"filled"}),ni={entity_key:"entity_default_configuration",entity_title:(0,at.gettext)("Default settings")};function EntityThresholdingControlsContainer(s){var{handleGoToKpiSettings:o,appsData:_,kpiEntitiesConfigApiStatus:S,kpiEntitiesConfigData:R,thresholdTemplateCollection:O,useRawSearch:P,isReadOnly:D,kpiEntitiesData:N,kpiEntitiesApiStatus:V,linkedServices:j,handleSelectedServiceChange:K}=s,{hadCopyKPIToEntityThresholds:W,handleEntityRecommendationUpdate:U,isServiceTemplate:Y,isServiceTemplateNewKpi:$,kpiData:X,recommendedThresholds:Z,selectedKpiModel:Q,setHadCopyKPIToEntityThresholds:ee,updateKpiData:te,updateThresholdInKpiModel:ie,previewServiceKey:ae}=(0,me.useContext)(_t.ThresholdingContext),[ne,re]=(0,me.useState)(1300),[se,le]=(0,me.useState)(!1),[oe,de]=(0,me.useState)({}),[ce,he]=(0,me.useState)({}),[ue,pe]=(0,me.useState)(!1),[fe,ge]=(0,me.useState)(X.isCopyKPIToEntityThresholdsEnabled),[ve,ye]=(0,me.useState)({key:ni.entity_key,title:ni.entity_title,type:"entity"}),[_e,we]=(0,me.useState)({entity_title:ve.title,entity_key:ve.key,itsi_kpi_id:X._key}),[Me,Oe]=(0,me.useState)(!1),[Pe,De]=(0,me.useState)(!1),[Le,Ne]=(0,me.useState)(null),[je,He]=(0,me.useState)(ct.THRESHOLDING_TABS[1].value),[Be,Ke]=(0,me.useState)(!0),[Ge,qe]=(0,me.useState)([]),[Ze,Qe]=(0,me.useState)([]),[et,It]=(0,me.useState)(""),[Mt,ri]=(0,me.useState)([]),[si,li]=(0,me.useState)(!1),[oi,di]=(0,me.useState)(Q.get("is_entity_level_thresholding")||!1),[ci,hi]=(0,me.useState)({onboardNewEntities:!!Y||Q.get("onboarding_new_entities_enabled")}),[ui,pi]=(0,me.useState)(ct.ENTITY_RECOMMENDATION_PANELS.filter(s=>"entity_thresholds"===s.value)[0]),[fi,gi]=(0,me.useState)(!1),[mi,vi]=(0,me.useState)([]),[yi,_i]=(0,me.useState)(!1),[Si,bi]=(0,me.useState)(null),[Ei,Ti]=(0,me.useState)(!1),Ci=(0,me.useRef)(null),getEntitiesBatch=(s,o,_)=>_.slice(s,o);(0,me.useEffect)(()=>{var handleResize=()=>{var s=Ci.current&&Ci.current.offsetWidth?Ci.current.offsetWidth:0;s>774&&re(s)};return handleResize(),window.addEventListener("resize",handleResize),()=>{window.removeEventListener("resize",handleResize)}},[Ci]);var ki=(0,me.useCallback)(s=>{if(!oi||"entity_default_configuration"===ve.key)return{};var o=Q.get("entity_threshold_configuration")||{},_=Q.get("entity_threshold_delete_filter")||{},S={};if(Q.get("is_entity_recommendation_pending")&&!(0,Ce.default)(Z)&&(S=Object.values(Z[0]).filter(o=>s===o.entity_title),!(0,Ce.default)(S)))return S[0].recommendation_in_progress=!0,(0,ht.formatEntityData)(S[0]);if("kpi"in _)return{};if("entities"in _&&-1!==_.entities.findIndex(o=>o.name===s))return{};if(s in o)return(0,ht.formatEntityData)(o[s]);var O=R.length?R.findIndex(o=>s===o.entity_title):-1;return-1!==O?(0,ht.formatEntityData)(R[O]):{}},[oi,ve.key,Q,Z,R]);(0,me.useEffect)(()=>{if(V===bt.SERVICE_KPI_ENTITIES_RETRIEVE_STATUS.SUCCESS&&(oi&&(S===bt.SERVICE_KPI_ENTITIES_CONFIG_RETRIEVE_STATUS.SUCCESS||S===bt.SERVICE_KPI_ENTITIES_CONFIG_RETRIEVE_STATUS.ERROR)||!oi)){var s=(O=Q.get("entity_threshold_configuration")||{},P=Q.get("entity_threshold_delete_filter")||{},N.results.map(s=>{if(!oi||"kpi"in P||"entities"in P&&-1!==P.entities.findIndex(o=>o.name===s.entity_title))return _objectSpread(_objectSpread({},s),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[2].value,showError:!1});if(s in O)return _objectSpread(_objectSpread({},s),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[3].value,showError:!1});if(Q.get("is_entity_recommendation_pending"))return _objectSpread(_objectSpread({},s),{},{threshold_Type:ct.ENTITY_FILTER_OPTIONS[0].value,showError:!1});var o=R.length?R.findIndex(o=>s.entity_title===o.entity_title):-1;if(-1!==o){var _,S,D=R[o];return(null==D||null===(_=D.recommendation_error_type)||void 0===_?void 0:_.length)>0||null!=D&&D.is_recommended_time_policies?_objectSpread(_objectSpread({},s),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[0].value,show_error:(null==D||null===(S=D.recommendation_error_type)||void 0===S?void 0:S.length)>0}):_objectSpread(_objectSpread({},s),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[3].value,show_error:!1})}return _objectSpread(_objectSpread({},s),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[2].value,show_error:!1})}));qe(s);var o=(0,ht.filterEntities)(s,et,Mt);Qe(o);var _=getEntitiesBatch(0,st.DEFAULT_PAGINATED_BATCH_SIZE,o);vi(_),Ke(!1)}var O,P},[V,S]);var xi=(0,me.useCallback)((s,o)=>{var _,S;if((0,Ce.default)(o)||null!=o&&o.isRecommendationInProgress||(null==o||null===(_=o.recommendationError)||void 0===_?void 0:_.length)>0){var R={};return Object.keys(s.timeVariateThresholdsSpecification.policies).forEach(o=>{R[o]=(0,Re.default)(s.timeVariateThresholdsSpecification.policies[o],"aggregate_thresholds"),R[o].policy_type="static"}),_objectSpread(_objectSpread({},s),{},{timeVariateThresholdsSpecification:{policies:R},entity_title:ve.title,isAdaptiveThresholdsEnabled:!1,thresholdType:lt.KPI_THRESHOLD_TYPES.ENTITY,rawSearch:s.searchTimeSeriesEntities})}return _objectSpread(_objectSpread({},(0,Ee.default)(o)),{},{alertPeriod:s.alertPeriod,baseSearch:s.baseSearch,entityStatop:s.entityStatop,searchTimeSeriesEntities:s.searchTimeSeriesEntities,entityBreakdownIdFields:s.entityBreakdownIdFields,thresholdField:s.thresholdField,thresholdType:lt.KPI_THRESHOLD_TYPES.ENTITY,rawSearch:s.searchTimeSeriesEntities,searchAlertEarliest:s.searchAlertEarliest,is_entity_breakdown:null===(S=s.tempKpiData)||void 0===S?void 0:S.is_entity_breakdown,_key:s._key})},[ve]),wi=(0,me.useCallback)(s=>{Ne(O.get(s)),ti({type:Ae.TOAST_TYPES.WARNING,message:(0,at.gettext)("Threshold template unlinked"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1})},[O]);(0,me.useEffect)(()=>{var s,o=ki(null==ve?void 0:ve.title),_=xi(X,o);de(o),he(_),Oe((null==o||null===(s=o.recommendationError)||void 0===s?void 0:s.length)>0||(null==o?void 0:o.isRecommendedTimePoliciesEnabled)||Q.get("is_entity_recommendation_pending")&&(null==o?void 0:o.isRecommendationInProgress)||!1),De((null==o?void 0:o.isAdaptiveThresholdsEnabled)&&!(null!=o&&o.isRecommendedTimePoliciesEnabled)&&o.isRecommendationModified),le("entity_default_configuration"===(null==ve?void 0:ve.key)),we({entity_title:ve.title,entity_key:ve.key,itsi_kpi_id:X._key})},[ve]),(0,me.useEffect)(()=>{var s;(0,Ce.default)(oe)||null==oe||!oe.isAdaptiveThresholdsEnabled||se||null==oe||!oe.isRecommendedTimePoliciesEnabled||(0,Ce.default)(oe.atRecommendationInfo)&&(null!=oe&&oe.isRecommendationInProgress||!((null==oe||null===(s=oe.recommendationError)||void 0===s?void 0:s.length)>0))?He(ct.THRESHOLDING_TABS[1].value):He(ct.THRESHOLDING_TABS[0].value)},[null==ve?void 0:ve.title,se]);var Ri,Ii,Mi,Oi,Ai=(0,me.useCallback)((s,o)=>{var{selectedTabId:_}=o;He(_)},[]),Pi=(0,me.useCallback)(()=>{var s=Q.get("entity_threshold_delete_filter")||{};s.entities="entities"in s?[...s.entities,{key:oe._key,name:ve.title}]:[{key:oe._key,name:ve.title}],Q.set("entity_threshold_delete_filter",s),de({}),he(xi(X,{}))},[oe._key,xi,X,ve.title,Q]),Di=(0,me.useCallback)(()=>{var s=Q.get("entity_threshold_delete_filter")||{};s.kpi=X._key,s=(0,Re.default)(s,"entities"),Q.set("entity_threshold_delete_filter",s)},[X._key,Q]),Li=(0,me.useCallback)(()=>{di(s=>(Q.set("is_entity_level_thresholding",!s),Q.set("is_recommended_time_policies_for_entities",!s),s&&Di(),!s)),U({})},[Di,U,Q]),Ni=(0,me.useCallback)((s,o,_,S)=>{s.isTimeVariateThresholds?(s.timeVariateThresholdsSpecification=(0,Ee.default)(S.timeVariateThresholdsSpecification),o[ve.title]=_objectSpread(_objectSpread({},_),{},{time_variate_thresholds_specification:S.timeVariateThresholdsSpecification})):(o[ve.title]=_objectSpread(_objectSpread({},_),{},{entity_thresholds:S.entityThresholdsConfig}),s.entityThresholdsConfig=(0,Ee.default)(S.entityThresholdsConfig))},[ve.title]),Vi=(0,me.useCallback)(()=>{ee(!0),ti({type:Ae.TOAST_TYPES.WARNING,message:(0,at.gettext)("Copy adaptive thresholds to entity settings unlinked"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1})},[ee]),ji=(0,me.useCallback)(s=>{if(se){var o,_=_objectSpread({},X);null!==(o=s.timeVariateThresholdsSpecification)&&void 0!==o&&o.policies&&Object.keys(s.timeVariateThresholdsSpecification.policies).forEach(o=>{_.timeVariateThresholdsSpecification.policies[o].entity_thresholds=s.timeVariateThresholdsSpecification.policies[o].entity_thresholds}),s.entityThresholdsConfig&&(_.entityThresholdsConfig=s.entityThresholdsConfig,he(_objectSpread(_objectSpread({},ce),{entityThresholdsConfig:s.entityThresholdsConfig}))),_.isCopyKPIToEntityThresholdsEnabled&&(Vi(),_.isCopyKPIToEntityThresholdsEnabled=!1,Q.set("adaptive_thresholding_copy_kpi_to_entity",!1),he(_objectSpread(_objectSpread({},ce),{isCopyKPIToEntityThresholdsEnabled:!1}))),""!==_.thresholdTemplateId&&(wi(_.thresholdTemplateId),_.thresholdTemplateId=""),ie(_,ce.thresholdType),te(_)}else if((0,Ce.default)(oe)){var S=(0,ht.getEntityThresholdingObject)(X,ve),O=(0,ht.formatEntityData)(S),P=Q.get("entity_threshold_configuration")||{};Ni(O,P,S,s),de(O),Q.set("entity_threshold_configuration",P),he(xi(X,O)),qe(s=>{var o=s.findIndex(s=>s.entity_title===ve.title),_=(0,be.default)(s);return _[o]=_objectSpread(_objectSpread({},_[o]),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[3].value}),_})}else{var D,N,V=(0,Ee.default)(ce),j=Q.get("entity_threshold_configuration")||{},K={};if(ve.title in j)K=j[ve.title];else{var W=R.findIndex(s=>ve.title===s.entity_title);K=R[W]}null!==(D=K)&&void 0!==D&&D.is_recommended_time_policies?(De(!0),Oe(!1),K.is_recommended_time_policies=!1,K.was_recommendation_modified=!0):(null===(N=K)||void 0===N||null===(N=N.recommendation_error_type)||void 0===N?void 0:N.length)>0&&(Oe(!1),K.recommendation_error_type=""),Ni(V,j,K,s),Q.set("entity_threshold_configuration",j),he(V),qe(s=>{var o=s.findIndex(s=>s.entity_title===ve.title),_=(0,be.default)(s);return _[o]=_objectSpread(_objectSpread({},_[o]),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[3].value}),_})}},[se,oe,X,ie,ce,te,ve,Q,Ni,xi,wi,R,Vi]),Hi=(0,me.useCallback)(()=>{var s=R.findIndex(s=>ve.title===s.entity_title),o=R[s],_=(0,ht.formatEntityData)(o),S=xi(X,_),O=Q.get("entity_threshold_configuration")||{};o.is_recommended_time_policies=!0,o.was_recommendation_modified=!1,Oe(!0),De(!1);var P=(0,Ie.default)(S,"timeVariateThresholdsSpecification");Ni(S,O,o,P),Q.set("entity_threshold_configuration",O),de(_),he(S),qe(s=>{var o=s.findIndex(s=>s.entity_title===ve.title),_=(0,be.default)(s);return _[o]=_objectSpread(_objectSpread({},_[o]),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[0].value}),_})},[xi,X,R,ve.title,Q,Ni]),Bi=(0,me.useCallback)(s=>{var o,_=Q.get("entity_threshold_configuration")||{},S={};if((0,Ce.default)(oe))S=(0,ht.getEntityThresholdingObject)(X,ve);else if(ve.title in _)S=_[ve.title];else{var O=R.findIndex(s=>ve.title===s.entity_title);S=R[O]}null!==(o=S)&&void 0!==o&&o.is_recommended_time_policies&&(Oe(!1),De(!0),S.is_recommended_time_policies=!1,S.was_recommendation_modified=!0),"adaptiveTrainingWindow"in s?_[ve.title]=_objectSpread(_objectSpread({},S),{},{adaptive_thresholding_training_window:s.adaptiveTrainingWindow}):"isOutlierDetectionEnabled"in s?_[ve.title]=_objectSpread(_objectSpread({},S),{},{aggregate_outlier_detection_enabled:s.isOutlierDetectionEnabled}):"outlierDetectionAlgorithm"in s?_[ve.title]=_objectSpread(_objectSpread({},S),{},{outlier_detection_algo:s.outlierDetectionAlgorithm}):"outlierDetectionSensitivity"in s&&(_[ve.title]=_objectSpread(_objectSpread({},S),{},{outlier_detection_sensitivity:s.outlierDetectionSensitivity})),(0,Ce.default)(oe)?(de(S),he(xi(X,(0,ht.formatEntityData)(_[ve.title])))):he(o=>_objectSpread(_objectSpread({},o),s)),qe(s=>{var o=s.findIndex(s=>s.entity_title===ve.title),_=(0,be.default)(s);return _[o]=_objectSpread(_objectSpread({},_[o]),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[3].value}),_}),Q.set("entity_threshold_configuration",_)},[Q,oe,ve,X,R,xi]),Ki=(0,me.useCallback)(s=>{var o,_,S=Q.get("entity_threshold_configuration")||{},O=(0,Ee.default)(ce),P={};if((0,Ce.default)(oe))P=(0,ht.getEntityThresholdingObject)(X,ve),O=xi(X,(0,ht.formatEntityData)(P));else if(ve.title in S)P=S[ve.title];else{var D=R.findIndex(s=>ve.title===s.entity_title);P=R[D]}if(null!==(o=P)&&void 0!==o&&o.is_recommended_time_policies?(De(!0),Oe(!1),P.is_recommended_time_policies=!1,P.was_recommendation_modified=!0):(null===(_=P)||void 0===_||null===(_=_.recommendation_error_type)||void 0===_?void 0:_.length)>0&&(Oe(!1),P.recommendation_error_type=""),s===ct.THRESHOLD_TYPE_OPTIONS[0].value)O.isTimeVariateThresholds=!1,O.isAdaptiveThresholdsEnabled=!1,S[ve.title]=_objectSpread(_objectSpread({},P),{},{time_variate_thresholds:!1,adaptive_thresholds_is_enabled:!1});else if(s===ct.THRESHOLD_TYPE_OPTIONS[2].value)O.isTimeVariateThresholds=!0,O.isAdaptiveThresholdsEnabled=!0,S[ve.title]=_objectSpread(_objectSpread({},P),{},{time_variate_thresholds:!0,adaptive_thresholds_is_enabled:!0});else{O.isTimeVariateThresholds=!0,O.isAdaptiveThresholdsEnabled=!1;var N=O.timeVariateThresholdsSpecification.policies;Object.keys(N).forEach(s=>{N[s].policy_type="static"}),S[ve.title]=_objectSpread(_objectSpread({},P),{},{time_variate_thresholds:!0,adaptive_thresholds_is_enabled:!1,time_variate_thresholds_specification:{policies:(0,Ee.default)(N)}})}(0,Ce.default)(oe)&&de(O),he(O),qe(s=>{var o=s.findIndex(s=>s.entity_title===ve.title),_=(0,be.default)(s);return _[o]=_objectSpread(_objectSpread({},_[o]),{},{threshold_type:ct.ENTITY_FILTER_OPTIONS[3].value}),_}),Q.set("entity_threshold_configuration",S)},[oe,Q,ce,ve,X,xi,R]),Fi=null!=X&&X.thresholdTemplateId?O.get(X.thresholdTemplateId):{},Wi=(0,me.useCallback)(()=>{ge(s=>!s);var s=_objectSpread({},X);s.isCopyKPIToEntityThresholdsEnabled=!fe,Q.set("adaptive_thresholding_copy_kpi_to_entity",!fe),te(s),ie(s,lt.KPI_THRESHOLD_TYPES.ENTITY)},[fe,X,Q,te,ie]),Ui=(0,me.useCallback)(()=>{var s=_objectSpread({},X);if(X.isTimeVariateThresholds){var o=(0,xe.default)(X.timeVariateThresholdsSpecification.policies,s=>{var o=(0,Ee.default)(s.aggregate_thresholds);return(0,Se.default)(_objectSpread({},s),{entity_thresholds:o})});s.timeVariateThresholdsSpecification={policies:o}}else s.entityThresholdsConfig=(0,Ee.default)(X.aggregateThresholdsConfig);""!==s.thresholdTemplateId&&(wi(s.thresholdTemplateId),s.thresholdTemplateId=""),te(s),ie(s,lt.KPI_THRESHOLD_TYPES.ENTITY),ti({type:Ae.TOAST_TYPES.SUCCESS,message:(0,at.gettext)("Copy settings were successful"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1});var _=ki(null==ve?void 0:ve.title),S=xi(s,_);de(_),he(S)},[ki,xi,wi,X,null==ve?void 0:ve.title,te,ie]),Gi=(0,me.useCallback)((s,o)=>{var{selectedTabId:_}=o;if(_===ni.entity_title)ye({key:ni.entity_key,title:ni.entity_title,type:"entity"});else{var S,R=null===(S=N.results)||void 0===S?void 0:S.find(s=>s.entity_key===_||s.entity_title===_);ye({key:R.entity_key,title:R.entity_title,type:"entity"})}},[N]),Yi=(0,me.useCallback)(()=>{li(!0)},[]),qi=(0,me.useCallback)(s=>{li(!1),Q.get("is_entity_level_thresholding")&&(s&&ye({key:s.entity_key,title:s.entity_title,type:"entity"}),di(!0),hi(s=>_objectSpread(_objectSpread({},s),{},{onboardNewEntities:!!Y||Q.get("onboarding_new_entities_enabled")})))},[Y,Q]),zi=(0,Te.default)((s,o)=>{var{value:_}=o;It(_);var S=(0,ht.filterEntities)(Ge,_,Mt,oi);Qe(S);var R=getEntitiesBatch(0,st.DEFAULT_PAGINATED_BATCH_SIZE,S);vi(R)},rt.DEFAULT_DEBOUNCE_DELAY),$i=(0,me.useCallback)(s=>{var o=[s],_=(0,ht.filterEntities)(Ge,et,o,oi);Qe(_);var S=getEntitiesBatch(0,st.DEFAULT_PAGINATED_BATCH_SIZE,_);vi(S),ri(o)},[Ge,et,oi]),handleRemoveAdvancedFiltering=(s,o)=>{var{value:_}=o,S=Mt.filter(s=>s.value!==_),R=(0,ht.filterEntities)(Ge,et,S,oi);Qe(R);var O=getEntitiesBatch(0,st.DEFAULT_PAGINATED_BATCH_SIZE,R);vi(O),ri(S)},Ji=(0,me.useCallback)(s=>{var o=ct.ENTITY_RECOMMENDATION_PANELS.find(o=>o.value===s);o&&pi(o),gi(s&&"recommend_thresholding"===s),li(!0)},[]),Xi=(0,Te.default)(()=>{if(mi.length){var s=mi.length,o=s+st.DEFAULT_PAGINATED_BATCH_SIZE,_=(0,Ee.default)(Ze);if(s<=_.length){var S=getEntitiesBatch(s,o,_),R=mi.concat(S);_i(!1),vi(R)}else _i(!1)}else _i(!1)},rt.DEFAULT_DEBOUNCE_DELAY),Zi=(0,me.useCallback)(()=>{He(ct.THRESHOLDING_TABS[1].value),Ti(!0)},[]),Qi=(0,me.useCallback)(()=>{He(ct.THRESHOLDING_TABS[1].value),Ei&&Ti(!1)},[Ei]),ea=(0,me.useCallback)(()=>{He(ct.THRESHOLDING_TABS[2].value)},[]),ta=(0,me.useCallback)(()=>{o(!0)},[o]),ia=se||!Me||ce&&(0,ke.default)(ce.atRecommendationInfo);return me.default.createElement(me.default.Fragment,null,me.default.createElement(Lt,null,me.default.createElement(Gt,{"data-test-itsi":"entity-configuration-side-panel",folded:ue,minHeight:dt.DASHBOARD_HEIGHT,panelWidth:ue?"60px":dt.DASHBOARD_PANEL_WIDTH_UNFOLDED},me.default.createElement(Yt,{folded:ue},me.default.createElement(qt,{"data-test-itsi":"entity-side-panel-toggle-button",onClick:()=>{pe(!ue)},folded:ue},ue?Ct:kt,me.default.createElement($e.default,{"data-test-itsi":"entity-side-panel-header"},ue?(0,at.gettext)("Expand"):(0,at.gettext)("Collapse")))),ue?null:me.default.createElement("div",null,Y&&!(0,Ce.default)(X)&&me.default.createElement(me.default.Fragment,null,me.default.createElement(Zt,{"data-test-itsi":"entity-thresholding-preview-service-control-group",label:(0,at.gettext)("Preview service"),labelPosition:"top"},me.default.createElement(ze.default,{"data-test-itsi":"entity-thresholding-service-select",value:ae,onChange:K,disabled:$},j.map(s=>me.default.createElement(ze.default.Option,{label:s.title,value:s._key,key:s._key})))),me.default.createElement(We.default,null)),me.default.createElement(xt,null,me.default.createElement(wt,{"data-test-itsi":"ai-thresholding-settings-item",icon:Et,label:(0,at.gettext)("AI thresholding"),inline:!1,onClick:Yi,disabled:0===Ge.length})),me.default.createElement(We.default,null),Be?me.default.createElement(Jt,{"data-test-itsi":"entity-side-panel-entities-waiting-spinner"}):me.default.createElement(me.default.Fragment,null,me.default.createElement($t,{"data-test-itsi":"entity-side-panel-default-settings-tabbar",layout:"vertical",activeTabId:ve.title,onChange:Gi},me.default.createElement(Xe.default.Tab,{"data-test-itsi":"kpi-thresholding-kpis-entities-entity-title-item",label:ni.entity_title,tabId:ni.entity_title})),me.default.createElement(We.default,null),me.default.createElement(Pt,null,me.default.createElement(gt.default,{handleClickAdvancedFiltering:$i,handleEntityFilterChange:zi})),me.default.createElement(Dt,null,Mt.map(s=>me.default.createElement(Ve.default,{"data-test-itsi":"entity-side-panel-".concat(s.value.split("_").join("-"),"-filter-chip"),key:s.value,value:s.value,onRequestRemove:handleRemoveAdvancedFiltering},s.label))),me.default.createElement("div",null,me.default.createElement($e.default,{"data-test-itsi":"entity-side-panel-entity-count"},(0,it.sprintf)((0,nt.ungettext)("%(entityCount)d Entity","%(entityCount)d Entities",Ze.length||0),{entityCount:Ze.length||0}),me.default.createElement(Xt,{"data-test-itsi":"entity-side-panel-entity-count-tooltip",content:(0,at.gettext)("Entities that sent data in the last 48 hours.")}))),me.default.createElement(Qt,{"data-test-itsi":"entity-side-panel-entities-scroll-container",elementRef:s=>{bi(s)},onScroll:()=>{Si.scrollTop+Si.clientHeight>=.75*Si.scrollHeight&&(null==mi?void 0:mi.length)!==(null==Ze?void 0:Ze.length)&&(_i(!0),Xi())}},me.default.createElement($t,{"data-test-itsi":"entity-side-panel-entities-tabbar",layout:"vertical",activeTabId:ve.title,onChange:Gi},mi.map(s=>me.default.createElement(Xe.default.Tab,{"data-test-itsi":"kpi-thresholding-kpis-entities-entity-title-item",key:"N/A"!==s.entity_key?s.entity_key:s.entity_title,tabId:s.entity_title,label:s.entity_title,icon:s.show_error?ii:null}))),yi?me.default.createElement(ei,{"data-test-itsi":"entity-side-panel-entities-scroll-loading-text"},(0,at.gettext)("Loading...")):"")))),me.default.createElement(Bt,{"data-test-itsi":"entity-thresholding-controls-container",ref:Ci},me.default.createElement(mt.default,{selectedEntity:ve,isDefaultEntityThresholdView:se,onEntityThresholdToDefaultClicked:Pi,handleAllEntityThresholdToDefaultClicked:Di,isEntityUsingDefaultSetting:(0,Ce.default)(oe),isReadOnly:D||Q.get("is_entity_recommendation_pending")||Y&&!se,isEntityRecommendationConfigured:Me}),$?me.default.createElement(Ft,null,me.default.createElement(Wt,{src:(0,tt.createStaticURL)("".concat(ct.STATIC_IMAGES_BASE_URL).concat("no_dashboard.svg")),"data-test-itsi":"no-chart-preview-image"}),me.default.createElement(Ut,{"data-test-itsi":"no-chart-preview-image"},(0,at.gettext)("Threshold previews will be displayed after saving the service template and propagating the changes to linked services."))):me.default.createElement(St.default,{isEntityLevelPreview:!0,entityData:_e,thresholdData:ce,getTimeInIso:!0,isDefaultEntityThresholdView:se,useKpiThresholdsForEntities:(0,Ce.default)(oe)||(null==oe?void 0:oe.isRecommendationInProgress),showBorder:!1,showTitle:!1,svgWidth:ne,useRawSearch:P,isReadOnly:D||Q.get("is_entity_recommendation_pending")||Y&&!se}),oi||se?me.default.createElement("div",null,!se&&null!=oe&&oe.isRecommendationInProgress?me.default.createElement("div",null,Q.get("is_entity_recommendation_pending")?me.default.createElement(ut.default,{title:(0,at.gettext)("AI analysis pending - process will start after you click save.")}):me.default.createElement(ut.default,{message:(0,at.gettext)("We are analyzing the data for this entity to configure the most optimal thresholding configuration. Check back later.")})):me.default.createElement(me.default.Fragment,null,me.default.createElement(Xe.default,{activeTabId:je,onChange:Ai,"data-test-itsi":"entity-thresholding-configuration-tab-bar"},ct.THRESHOLDING_TABS.reduce((s,o)=>("alert_rules"===o.value||o.value===ct.THRESHOLDING_TABS[0].value&&ia||s.push(me.default.createElement(Xe.default.Tab,{key:o.value,label:ve.key===ni.entity_key&&o.defaultLabel?o.defaultLabel:o.label,icon:o.value===ct.THRESHOLDING_TABS[1].value&&(Pe||(0,Ce.default)(Fi)&&!(0,Ce.default)(Le))?ai:"",tabId:o.value,"data-test-itsi":"entity-thresholding-".concat(o.value.split("_").join("-"),"-tab")})),s),[])),je===ct.THRESHOLDING_TABS[0].value&&!ia&&me.default.createElement(pt.default,{aiSummaryInfo:{objectType:"entity",currentThreshold:ct.THRESHOLD_TYPE_OPTIONS.filter(s=>s.value===(0,ht.getThresholdType)(ce))[0],recommendationError:oe.recommendationError,thresholdInfo:{adaptiveTrainingWindow:oe.adaptiveTrainingWindow,atRecommendationInfo:oe.atRecommendationInfo},timeVariateThresholdsSpecification:oe.timeVariateThresholdsSpecification,aggregateThresholdsConfig:oe.entityThresholdsConfig},feedBackContent:(Oi={adaptive_thresholding_training_window:ce.adaptiveTrainingWindow,itsi_kpi_id:X._key,entity_title_hash:(0,ot.md5KeyGenerator)([ve.title]),entity_key:ve.key},Q.get("entity_threshold_direction")&&(Oi.threshold_direction=Q.get("entity_threshold_direction")),null!==(Ri=ce.atRecommendationInfo)&&void 0!==Ri&&Ri.confidenceScore&&(Oi.score=ce.atRecommendationInfo.confidenceScore),null!==(Ii=ce.atRecommendationInfo)&&void 0!==Ii&&Ii.timePolicyDesc&&(Oi.score=ce.atRecommendationInfo.timePolicyDesc),null!==(Mi=ce.atRecommendationInfo)&&void 0!==Mi&&Mi.lastRun&&(Oi.last_run=ce.atRecommendationInfo.lastRun),{recommendationInfo:Oi}),handleGoToAISettings:Zi,handleGoToThresholdType:Qi,handleGoToThresholdLevels:ea,shouldAllowRemoval:!1}),je===ct.THRESHOLDING_TABS[1].value&&me.default.createElement(ft.default,{appsData:_,isDefaultEntityThresholdView:se,isPerEntityThresholdEnabled:oi,handleApplySettingToggle:Li,previousThresholdTemplate:Le,thresholdData:ce,handleThresholdTypeChange:Ki,handleThresholdDataUpdate:Bi,handleAllEntityThresholdToDefaultClicked:Di,handleGoToKpiSettings:o,handleRevertAIThresholdSettings:Hi,openAIThresholdingControls:Ei,selectedThresholdTemplate:Fi,isRecommendationUnlinked:Pe,isRecommendationConfigured:Me,isReadOnly:D||Q.get("is_entity_recommendation_pending")&&(null==oe?void 0:oe.isRecommendationInProgress)&&!se||Y&&!se,selectedObject:ve,hadCopyKPIToEntityThresholds:W,thresholdTemplateCollection:O,handleRedirectToEntityModal:Ji}),je===ct.THRESHOLDING_TABS[2].value&&me.default.createElement(me.default.Fragment,null,!D&&se&&me.default.createElement(me.default.Fragment,null,me.default.createElement(Nt,null,me.default.createElement(Ue.default,{"data-test-itsi":"copy-threshold-settings-heading",level:4},(0,at.gettext)("Copy threshold settings")),me.default.createElement(Vt,null,me.default.createElement(Ye.default,{"data-test-itsi":"kpi-threshold-template-save-copy-paste-text"},(0,at.gettext)("Do you want to copy the "),me.default.createElement("strong",null,(0,at.gettext)("time policy settings")),(0,at.gettext)(" for KPI thresholds and paste to the below controls?")),me.default.createElement(At,{"data-test-itsi":"kpi-thresholding-redirect-from-entity-thresholding",onClick:ta},Tt," ",(0,at.gettext)("Go to KPI threshold levels"))),me.default.createElement(Vt,null,me.default.createElement(jt,{"data-test-itsi":"kpi-thresholding-copy-paste-threshold-modal-copy-paste-button",onClick:Ui},(0,at.gettext)("Copy once")),X.isAdaptiveThresholdsEnabled&&me.default.createElement(Je.default,{"data-test-itsi":"kpi-thresholding-copy-paste-always-copy-checkbox",onClick:Wi,selected:fe},(0,at.gettext)("Always copy time policies after they are updated by adaptive thresholding")))),me.default.createElement(Ht,null)),me.default.createElement(yt.default,{isEntityLevelPreview:!0,thresholdObj:ce,entityData:_e,onThresholdUpdate:ji,isDefaultEntityThresholdView:se,isEntityLevelThreshold:!(0,Ce.default)(oe),width:ne,height:500,isReadOnly:D||Q.get("is_entity_recommendation_pending")&&(null==oe?void 0:oe.isRecommendationInProgress)&&!se||Y&&!se,showPreviewChart:!$})))):me.default.createElement(me.default.Fragment,null,me.default.createElement(Fe.default,{label:(0,at.gettext)("Global settings"),"data-test-itsi":"entity-global-settings-control-group"},me.default.createElement(zt,null,me.default.createElement(Rt,{height:"10px",width:"10px",variant:"filled"})," ",(0,at.gettext)("Active"))),me.default.createElement(Kt,{type:"info","data-test-itsi":"entity-threshold-threshold-type-info-message"},(0,at.gettext)("Global threshold settings are"),me.default.createElement("strong",null,(0,at.gettext)(" active ")),(0,at.gettext)(" in the "),me.default.createElement("strong",null,(0,at.gettext)("Default settings"),"."),!D&&(0,at.gettext)(" To adjust threshold levels for this entity, you must adjust the default threshold levels or switch off global settings. "),!D&&me.default.createElement(Ot,{onClick:()=>{ye({key:ni.entity_key,title:ni.entity_title,type:"entity"})},"data-test-itsi":"go-to-settings-clickable-link"},(0,at.gettext)("Go to setting")),D&&me.default.createElement(me.default.Fragment,null,(0,at.gettext)(" All entities have"),me.default.createElement("strong",null,(0,at.gettext)(" ".concat((0,ht.getThresholdType)(ce)===ct.THRESHOLD_TYPE_OPTIONS[2].value?ct.THRESHOLD_TYPE_OPTIONS[1].label:ct.THRESHOLD_TYPE_OPTIONS.filter(s=>s.value===(0,ht.getThresholdType)(ce))[0].label," "))),(0,at.gettext)("applied")))))),me.default.createElement(vt.default,{isOpen:si,handleEntityThresholdingModalClose:qi,useRawSearch:P,toggleFeatures:ci,pageToOpenOn:ui,entityData:V!==bt.SERVICE_KPI_ENTITIES_RETRIEVE_STATUS.SUCCESS?[]:fi?Ge.filter(s=>s.entity_title===ve.title):Ge,appsData:_}))}EntityThresholdingControlsContainer.propTypes={handleGoToKpiSettings:ye.default.func,appsData:ye.default.object.isRequired,kpiEntitiesConfigData:ye.default.array.isRequired,thresholdTemplateCollection:ye.default.object.isRequired,useRawSearch:ye.default.bool.isRequired,isReadOnly:ye.default.bool,kpiEntitiesApiStatus:ye.default.string.isRequired,kpiEntitiesConfigApiStatus:ye.default.string.isRequired,kpiEntitiesData:ye.default.object.isRequired,handleSelectedServiceChange:ye.default.func.isRequired,linkedServices:ye.default.array},EntityThresholdingControlsContainer.defaultProps={handleGoToKpiSettings:we.default,isReadOnly:!1,linkedServices:[]};o.default=(0,ve.connect)(s=>({kpiEntitiesData:s.services.kpiEntitiesData,kpiEntitiesApiStatus:s.services.kpiEntitiesApiStatus,kpiEntitiesConfigApiStatus:s.services.kpiEntitiesConfigApiStatus,kpiEntitiesConfigData:s.services.kpiEntitiesConfigData}),null)(EntityThresholdingControlsContainer);s.exports=o.default},2634:function(s,o,_){(()=>{"use strict";var o={n:s=>{var _=s&&s.__esModule?()=>s.default:()=>s;return o.d(_,{a:_}),_},d:(s,_)=>{for(var S in _)o.o(_,S)&&!o.o(s,S)&&Object.defineProperty(s,S,{enumerable:!0,get:_[S]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},S={};o.r(S),o.d(S,{default:()=>W});const R=_(0);var O=o.n(R);const P=_(104);var D=o.n(P);const N=_(106);function i(s,o){if(null==s)return{};var _,S,R=function l(s,o){if(null==s)return{};var _,S,R={},O=Object.keys(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||(R[_]=s[_]);return R}(s,o);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||Object.prototype.propertyIsEnumerable.call(s,_)&&(R[_]=s[_])}return R}var V=new Map;V.set("outlined",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{d:"M8.66331 6.5511C9.05383 6.16058 9.05383 5.52741 8.66331 5.13689C8.27278 4.74636 7.63962 4.74636 7.24909 5.13689L3.44666 8.93931C2.86088 9.5251 2.86088 10.4748 3.44666 11.0606L7.24909 14.8631C7.63962 15.2536 8.27278 15.2536 8.66331 14.8631C9.05383 14.4725 9.05383 13.8394 8.66331 13.4489L6.21445 11H16C17.2671 11 18.1271 11.4163 18.6679 11.9571C19.2181 12.5073 19.5 13.2474 19.5 14C19.5 14.7526 19.2181 15.4927 18.6679 16.0429C18.1271 16.5837 17.2671 17 16.0001 17H12C11.4477 17 11 17.4477 11 18C11 18.5523 11.4477 19 12 19H16.0001C17.733 19 19.123 18.4163 20.0822 17.4571C21.0319 16.5073 21.5 15.2474 21.5 14C21.5 12.7526 21.0319 11.4927 20.0821 10.5429C19.1229 9.58369 17.7329 9 16 9H6.21441L8.66331 6.5511Z"}))}));var j=["default","outlined"],K=function e(s){return"default"===s||s&&!function e(s){return j.indexOf(s)>=0}(s)?"outlined":s};const W=function e(s){var o=s.children,_=s.variant,S=void 0===_?"default":_,P=i(s,["children","variant"]),j=K(S),W="arrowturnbackleft-".concat(j),U=(0,R.useContext)(N.IconContext),Y=V.get(j);if(U&&Y){var $=U.toRender;if((0,U.addIcon)(W,Y()),!$)return null}return O().createElement(D(),P,o,U?O().createElement("use",{href:"#".concat(W)}):!!Y&&Y())};s.exports=S})()},2635:function(s,o,_){(()=>{"use strict";var o={n:s=>{var _=s&&s.__esModule?()=>s.default:()=>s;return o.d(_,{a:_}),_},d:(s,_)=>{for(var S in _)o.o(_,S)&&!o.o(s,S)&&Object.defineProperty(s,S,{enumerable:!0,get:_[S]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},S={};o.r(S),o.d(S,{default:()=>W});const R=_(0);var O=o.n(R);const P=_(104);var D=o.n(P);const N=_(106);function u(s,o){if(null==s)return{};var _,S,R=function i(s,o){if(null==s)return{};var _,S,R={},O=Object.keys(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||(R[_]=s[_]);return R}(s,o);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||Object.prototype.propertyIsEnumerable.call(s,_)&&(R[_]=s[_])}return R}var V=new Map;V.set("outlined",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{d:"M18.1828 9.35346C19.1592 8.37715 19.1592 6.79424 18.1828 5.81793C17.2065 4.84162 15.6236 4.84162 14.6473 5.81793L11.4644 8.99991C10.4881 9.97622 10.4881 11.5591 11.4644 12.5354C11.8549 12.926 11.8549 13.5591 11.4644 13.9497C11.0739 14.3402 10.4407 14.3402 10.0502 13.9497C8.29284 12.1923 8.29284 9.34305 10.0502 7.58569L13.2331 4.40371C14.9905 2.64635 17.8397 2.64635 19.5971 4.40371C21.3544 6.16107 21.3544 9.01031 19.5971 10.7677L18.7722 11.5926C18.3297 12.0351 17.8097 12.3889 17.2406 12.6379C17.1787 11.9601 17.0108 11.2902 16.7368 10.655C16.9628 10.5245 17.1718 10.3645 17.3579 10.1784L18.1828 9.35346Z"}),O().createElement("path",{d:"M12.5356 15.0001C13.5119 14.0238 13.5119 12.4409 12.5356 11.4646C12.1451 11.074 12.1451 10.4409 12.5356 10.0503C12.9261 9.65982 13.5593 9.65982 13.9498 10.0503C15.7072 11.8077 15.7072 14.6569 13.9498 16.4143L10.7679 19.5962C9.01056 21.3536 6.16132 21.3536 4.40396 19.5962C2.6466 17.8388 2.6466 14.9896 4.40396 13.2322L5.22885 12.4073C5.67118 11.965 6.19088 11.6113 6.75979 11.3623C6.82166 12.0401 6.98961 12.7101 7.26364 13.3452C7.03786 13.4757 6.82906 13.6356 6.64307 13.8216L5.81817 14.6464C4.84186 15.6228 4.84186 17.2057 5.81817 18.182C6.79448 19.1583 8.37739 19.1583 9.3537 18.182L12.5356 15.0001Z"}))})),V.set("filled",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{d:"M19.597 10.7677C21.3544 9.01031 21.3544 6.16107 19.597 4.40371C17.8397 2.64635 14.9904 2.64635 13.2331 4.40371L10.0501 7.58586C8.29279 9.34322 8.29279 12.1925 10.0501 13.9498C10.4407 14.3403 11.0738 14.3403 11.4644 13.9498C11.8549 13.5593 11.8549 12.9261 11.4644 12.5356C10.488 11.5593 10.488 9.97639 11.4644 9.00008L11.4654 8.99983L11.4757 8.98951C12.452 8.0132 14.0349 8.0132 15.0112 8.98951C16.0782 10.0565 16.6593 11.4253 16.7546 12.8211C17.5144 12.579 18.2065 12.1582 18.7722 11.5926L19.597 10.7677Z"}),O().createElement("path",{d:"M13.3467 17.0171L13.9498 16.4141C15.7072 14.6567 15.7072 11.8075 13.9498 10.0501C13.5593 9.6596 12.9261 9.6596 12.5356 10.0501C12.1451 10.4406 12.1451 11.0738 12.5356 11.4643C13.5119 12.4406 13.5119 14.0236 12.5356 14.9999L12.4838 15.0516C11.5046 15.9863 9.95305 15.9724 8.99076 15.0101C7.92379 13.9432 7.34266 12.5743 7.2474 11.1785C6.48724 11.4205 5.79473 11.8414 5.22885 12.4073L4.40396 13.2322C2.6466 14.9895 2.6466 17.8388 4.40396 19.5961C6.16132 21.3535 9.01056 21.3535 10.7679 19.5961L13.3267 17.0373C13.3334 17.0306 13.3401 17.0239 13.3467 17.0171Z"}))}));var j=["default","outlined","filled"],K=function e(s){return"default"===s||s&&!function e(s){return j.indexOf(s)>=0}(s)?"outlined":s};const W=function e(s){var o=s.children,_=s.variant,S=void 0===_?"default":_,P=u(s,["children","variant"]),j=K(S),W="chain-".concat(j),U=(0,R.useContext)(N.IconContext),Y=V.get(j);if(U&&Y){var $=U.toRender;if((0,U.addIcon)(W,Y()),!$)return null}return O().createElement(D(),P,o,U?O().createElement("use",{href:"#".concat(W)}):!!Y&&Y())};s.exports=S})()},2636:function(s,o,_){(()=>{"use strict";var o={n:s=>{var _=s&&s.__esModule?()=>s.default:()=>s;return o.d(_,{a:_}),_},d:(s,_)=>{for(var S in _)o.o(_,S)&&!o.o(s,S)&&Object.defineProperty(s,S,{enumerable:!0,get:_[S]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},S={};o.r(S),o.d(S,{default:()=>W});const R=_(0);var O=o.n(R);const P=_(104);var D=o.n(P);const N=_(106);function u(s,o){if(null==s)return{};var _,S,R=function c(s,o){if(null==s)return{};var _,S,R={},O=Object.keys(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||(R[_]=s[_]);return R}(s,o);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||Object.prototype.propertyIsEnumerable.call(s,_)&&(R[_]=s[_])}return R}var V=new Map;V.set("outlined",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{d:"M18.536 11.8281C18.3571 12.007 18.1668 12.1677 17.9676 12.3102L16.5171 10.8598C16.7347 10.7454 16.9389 10.5968 17.1218 10.4139L18.1824 9.35322C19.1587 8.37691 19.1587 6.79399 18.1824 5.81768C17.2061 4.84137 15.6232 4.84137 14.6469 5.81768L13.5862 6.87834C13.4033 7.06125 13.2547 7.26545 13.1403 7.48296L11.6899 6.03255C11.8324 5.83329 11.9931 5.64305 12.172 5.46413L13.2327 4.40347C14.99 2.64611 17.8393 2.64611 19.5966 4.40347C21.354 6.16083 21.354 9.01007 19.5966 10.7674L18.536 11.8281Z"}),O().createElement("path",{d:"M5.70711 4.2924C5.31659 3.90188 4.68342 3.90188 4.2929 4.2924C3.90237 4.68293 3.90237 5.31609 4.2929 5.70662L18.2929 19.7066C18.6834 20.0971 19.3166 20.0971 19.7071 19.7066C20.0976 19.3161 20.0976 18.6829 19.7071 18.2924L5.70711 4.2924Z"}),O().createElement("path",{d:"M5.46462 12.1714C5.64352 11.9925 5.83375 11.8318 6.03298 11.6893L7.48339 13.1397C7.2659 13.2541 7.06172 13.4027 6.87883 13.5856L5.81817 14.6463C4.84186 15.6226 4.84186 17.2055 5.81817 18.1818C6.79448 19.1581 8.37739 19.1581 9.3537 18.1818L10.4144 17.1212C10.5973 16.9383 10.7459 16.7341 10.8603 16.5166L12.3107 17.967C12.1682 18.1663 12.0075 18.3565 11.8286 18.5354L10.7679 19.596C9.01056 21.3534 6.16132 21.3534 4.40396 19.596C2.6466 17.8387 2.6466 14.9894 4.40396 13.2321L5.46462 12.1714Z"}))})),V.set("filled",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{d:"M11.8276 18.536C12.2648 18.0988 12.5932 17.5941 12.8128 17.0555L6.94417 11.1868C6.4055 11.4065 5.90079 11.7349 5.46364 12.172L4.40298 13.2327C2.64562 14.99 2.64562 17.8393 4.40298 19.5966C6.16034 21.354 9.00958 21.354 10.7669 19.5966L11.8276 18.536Z"}),O().createElement("path",{d:"M12.1715 5.46462C11.7347 5.90148 11.4064 6.40583 11.1867 6.9441L17.056 12.8134C17.5943 12.5937 18.0986 12.2654 18.5355 11.8286L19.5962 10.7679C21.3535 9.01056 21.3535 6.16132 19.5962 4.40396C17.8388 2.6466 14.9896 2.6466 13.2322 4.40396L12.1715 5.46462Z"}),O().createElement("path",{d:"M5.70711 4.29289C5.31659 3.90237 4.68342 3.90237 4.2929 4.29289C3.90237 4.68342 3.90237 5.31658 4.2929 5.7071L18.2921 19.7063L18.2929 19.7071C18.6834 20.0976 19.3166 20.0976 19.7071 19.7071C20.0976 19.3166 20.0976 18.6834 19.7071 18.2929L5.70711 4.29289Z"}))}));var j=["default","outlined","filled"],K=function e(s){return"default"===s||s&&!function e(s){return j.indexOf(s)>=0}(s)?"outlined":s};const W=function e(s){var o=s.children,_=s.variant,S=void 0===_?"default":_,P=u(s,["children","variant"]),j=K(S),W="chainslashed-".concat(j),U=(0,R.useContext)(N.IconContext),Y=V.get(j);if(U&&Y){var $=U.toRender;if((0,U.addIcon)(W,Y()),!$)return null}return O().createElement(D(),P,o,U?O().createElement("use",{href:"#".concat(W)}):!!Y&&Y())};s.exports=S})()},2637:function(s,o,_){(()=>{"use strict";var o={n:s=>{var _=s&&s.__esModule?()=>s.default:()=>s;return o.d(_,{a:_}),_},d:(s,_)=>{for(var S in _)o.o(_,S)&&!o.o(s,S)&&Object.defineProperty(s,S,{enumerable:!0,get:_[S]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},S={};o.r(S),o.d(S,{default:()=>W});const R=_(0);var O=o.n(R);const P=_(104);var D=o.n(P);const N=_(106);function u(s,o){if(null==s)return{};var _,S,R=function i(s,o){if(null==s)return{};var _,S,R={},O=Object.keys(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||(R[_]=s[_]);return R}(s,o);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||Object.prototype.propertyIsEnumerable.call(s,_)&&(R[_]=s[_])}return R}var V=new Map;V.set("outlined",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3.5C4 2.67157 4.67157 2 5.5 2H13.9645C14.8927 2 15.783 2.36875 16.4393 3.02513L18.9749 5.56066C19.6313 6.21704 20 7.10728 20 8.03553V20.5C20 21.3284 19.3284 22 18.5 22H5.5C4.67157 22 4 21.3284 4 20.5V3.5ZM6 4V20H18V8.03553C18 7.8507 17.9659 7.66938 17.9011 7.5H16C15.1716 7.5 14.5 6.82843 14.5 6V4.09886C14.3306 4.03411 14.1493 4 13.9645 4H6Z"}),O().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 11C8 10.4477 8.44772 10 9 10H15C15.5523 10 16 10.4477 16 11C16 11.5523 15.5523 12 15 12H9C8.44772 12 8 11.5523 8 11ZM8 15C8 14.4477 8.44772 14 9 14H15C15.5523 14 16 14.4477 16 15C16 15.5523 15.5523 16 15 16H9C8.44772 16 8 15.5523 8 15Z"}))})),V.set("filled",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3.5C4 2.67157 4.67157 2 5.5 2H13.9645C14.8927 2 15.783 2.36875 16.4393 3.02513L18.9749 5.56066C19.6313 6.21704 20 7.10728 20 8.03553V20.5C20 21.3284 19.3284 22 18.5 22H5.5C4.67157 22 4 21.3284 4 20.5V3.5ZM8.5 10C7.94772 10 7.5 10.4477 7.5 11C7.5 11.5523 7.94772 12 8.5 12H15.4393C15.9916 12 16.4393 11.5523 16.4393 11C16.4393 10.4477 15.9916 10 15.4393 10H8.5ZM8.5 14C7.94772 14 7.5 14.4477 7.5 15C7.5 15.5523 7.94772 16 8.5 16H15.4393C15.9916 16 16.4393 15.5523 16.4393 15C16.4393 14.4477 15.9916 14 15.4393 14H8.5Z"}))}));var j=["default","outlined","filled"],K=function e(s){return"default"===s||s&&!function e(s){return j.indexOf(s)>=0}(s)?"outlined":s};const W=function e(s){var o=s.children,_=s.variant,S=void 0===_?"default":_,P=u(s,["children","variant"]),j=K(S),W="report-".concat(j),U=(0,R.useContext)(N.IconContext),Y=V.get(j);if(U&&Y){var $=U.toRender;if((0,U.addIcon)(W,Y()),!$)return null}return O().createElement(D(),P,o,U?O().createElement("use",{href:"#".concat(W)}):!!Y&&Y())};s.exports=S})()},2638:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j=S(_(8)),K=S(_(7)),W=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),U=S(_(3)),Y=S(_(2)),$=S(_(37)),X=S(_(39)),Z=S(_(1056)),Q=S(_(704)),ee=S(_(27)),te=S(_(64)),ie=S(_(34)),ae=S(_(24)),ne=S(_(51)),re=S(_(121)),se=_(4),le=_(265),oe=_(264),de=_(57),ce=_(102),he=_(306),ue=S(_(705));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,j.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var pe=(0,Y.default)(te.default)(R||(R=(0,K.default)(["\n margin-top: 20px;\n margin-bottom: 0px;\n"]))),fe=Y.default.div(O||(O=(0,K.default)(["\n margin-top: 5px;\n margin-bottom: 5px;\n display: inline-flex;\n align-self: center;\n gap 10px;\n"]))),ge=(0,Y.default)(ae.default)(P||(P=(0,K.default)(["\n margin-top: 14px;\n div[data-test='content'] {\n flex-wrap: wrap;\n }\n"]))),me=(0,Y.default)(ee.default)(D||(D=(0,K.default)(["\n height: fit-content;\n"]))),ve=(0,Y.default)(ae.default)(N||(N=(0,K.default)(["\n margin-bottom: 0px;\n"]))),ye=(0,Y.default)(ie.default)(V||(V=(0,K.default)(["\n margin-left: 5px;\n"]))),_e=W.default.createElement(Z.default,null),Se=W.default.createElement(Q.default,null);function EntityThresholdingRecommendationControls(s){var o,_,{appsData:S,isReadOnly:R,handleGoBack:O,handleRedirectToEntityModal:P}=s,{selectedKpiModel:D}=(0,W.useContext)(he.ThresholdingContext),[N,V]=(0,W.useState)({thresholdConfigValue:D.get("entity_threshold_direction")||ce.ENTITY_THRESHOLD_CONFIGURATION_OPTIONS[0].value,analysisWindowValue:D.get("entity_recommendation_training_window")||ce.ANALYSIS_WINDOW_OPTIONS[2].value,analysisWindowStartDate:D.get("entity_recommendation_start_date")||(0,re.default)().subtract(ce.ANALYSIS_WINDOW_OPTIONS[2].days,"days").unix(),recommendationApplyAsValue:!!D.get("entity_keep_recommended_policy_static"),onboardNewEntities:D.get("onboarding_new_entities_enabled"),allowNegativeValue:!!D.get("entity_recommendation_allow_negative_value"),thresholdSensitivity:D.get("entity_recommendation_threshold_sensitivity")||"0",configureAllSomeEntities:"one"}),[j,K]=(0,W.useState)(!0),[U,Y]=(0,W.useState)(""),X=(0,W.useCallback)(()=>{D.set("did_load_recommendation",!1),D.set("entity_recommendation_training_window",N.analysisWindowValue),D.set("entity_recommendation_start_date",N.analysisWindowStartDate),D.set("entity_keep_recommended_policy_static",N.recommendationApplyAsValue),D.set("entity_threshold_direction",N.thresholdConfigValue),D.set("entity_recommendation_allow_negative_value",N.allowNegativeValue),D.set("entity_recommendation_threshold_sensitivity",N.thresholdSensitivity)},[N.analysisWindowStartDate,N.analysisWindowValue,N.recommendationApplyAsValue,N.thresholdConfigValue,N.allowNegativeValue,N.thresholdSensitivity,D]),Z=(0,W.useCallback)(()=>{j?(X(),"all"===N.configureAllSomeEntities?P("recommend_thresholding"):"custom"===N.configureAllSomeEntities?P("select_entities"):P("recommend_thresholding")):Y("You must remove errors to proceed")},[N,X,P,j]),Q=(0,W.useCallback)((function(s,o){var _=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];_?(V(_=>_objectSpread(_objectSpread({},_),{},{[s]:o})),K(!0)):K(!1)}),[]);return W.default.createElement(W.default.Fragment,null,W.default.createElement(ee.default,{"data-test-itsi":"ai-recommendation-back-to-thresholding-button",label:(0,se.gettext)("Back"),icon:_e,onClick:O}),W.default.createElement(pe,{"data-test-itsi":"ai-thresholding-header",level:3},(0,se.gettext)("AI thresholding")),W.default.createElement(ne.default,null,(0,se.gettext)("Let AI generate your threshold settings. Algorithms analyze historical data to recommend optimal threshold values.")),(o=!1,_=!0,(0,$.default)(le.PYTHON_SCIENTIFIC_APP_NAMES,s=>{S&&S[s]&&S[s].isInstalled&&(o=!0,S[s].isDisabled||(_=!1))}),o&&!_||R?W.default.createElement(W.default.Fragment,null,W.default.createElement(ue.default,{isKpiRecommendation:!1,isReadOnly:R,showInModelStyle:!1,onRecommendationControlsChange:Q,recommendationSettingsObject:N}),!R&&W.default.createElement(fe,null,W.default.createElement(me,{"data-test-itsi":"ai-recommendation-run-analysis-button",label:(0,se.gettext)("Preview recommendations"),icon:Se,onClick:Z}),U.length>0&&W.default.createElement(ve,{"data-test-itsi":"kpi-recommendation-modal-footer-error-message",type:"error"},(0,se.gettext)("You must remove errors to proceed")))):W.default.createElement(ge,{appearance:"fill",type:"error","data-test-itsi":"kpi-thresholding-install-psc-error-message"},W.default.createElement(ae.default.Title,null,(0,se.gettext)("Missing software")),W.default.createElement("div",null,!o&&W.default.createElement(W.default.Fragment,null,de.AT_RECOMMENDATION_PSC_NOT_INSTALLED_MESSAGE," ",(0,se.gettext)("Install app for"),W.default.createElement(ye,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-linux",to:(0,oe.getSplunkBaseURL)(le.SPLUNKBASE_APPS.Python_Scientific_Linux.id),openInNewContext:!0},(0,se.gettext)("Linux 64-bit")),",",W.default.createElement(ye,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-windows",to:(0,oe.getSplunkBaseURL)(le.SPLUNKBASE_APPS.Python_Scientific_Windows.id),openInNewContext:!0},(0,se.gettext)("Windows 64-bit")),",",W.default.createElement(ye,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-mac-intel",to:(0,oe.getSplunkBaseURL)(le.SPLUNKBASE_APPS.Python_Scientific_Mac_Intel.id),openInNewContext:!0},(0,se.gettext)("Mac Intel")),", ".concat((0,se.gettext)("or")),W.default.createElement(ye,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-mac-arm",to:(0,oe.getSplunkBaseURL)(le.SPLUNKBASE_APPS.Python_Scientific_Mac_Apple_Silicon.id),openInNewContext:!0},(0,se.gettext)("Mac Apple Silicon"))),o&&_&&W.default.createElement(W.default.Fragment,null,de.AT_RECOMMENDATION_PSC_DISABLED_MESSAGE," ",W.default.createElement(ie.default,{"data-test-itsi":"kpi-thresholding-psc-app-enable-link",to:(0,oe.manageAppsURL)({search:le.PYTHON_SCIENTIFIC_APP_NAME_PREFIX}),openInNewContext:!0},(0,se.gettext)("Enable the app here.")))))))}EntityThresholdingRecommendationControls.propTypes={appsData:U.default.object.isRequired,handleGoBack:U.default.func,isReadOnly:U.default.bool,handleRedirectToEntityModal:U.default.func.isRequired},EntityThresholdingRecommendationControls.defaultProps={handleGoBack:X.default,isReadOnly:!1};o.default=EntityThresholdingRecommendationControls;s.exports=o.default},2639:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U=S(_(8)),Y=S(_(7)),$=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),X=_(46),Z=_(48),Q=S(_(3)),ee=S(_(2)),te=S(_(37)),ie=S(_(39)),ae=S(_(1056)),ne=S(_(704)),re=S(_(27)),se=S(_(64)),le=S(_(34)),oe=S(_(24)),de=S(_(51)),ce=S(_(75)),he=S(_(121)),ue=_(14),pe=_(4),fe=_(265),ge=_(264),me=_(57),ve=_(145),ye=_(803),_e=_(519),Se=_(102),be=_(306),Ee=S(_(705));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,U.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var Te=(0,ee.default)(oe.default)(R||(R=(0,Y.default)(["\n margin-bottom: 20px;\n"]))),Ce=ee.default.strong(O||(O=(0,Y.default)(["\n display: block;\n margin-bottom: 15px;\n"]))),ke=(0,ee.default)(ce.default)(P||(P=(0,Y.default)(["\n margin-right: 5px;\n"]))),xe=(0,ee.default)(se.default)(D||(D=(0,Y.default)(["\n margin-top: 20px;\n margin-bottom: 0px;\n"]))),we=ee.default.div(N||(N=(0,Y.default)(["\n margin-top: 5px;\n margin-bottom: 5px;\n display: inline-flex;\n align-self: center;\n gap 10px;\n"]))),Re=(0,ee.default)(oe.default)(V||(V=(0,Y.default)(["\n margin-top: 14px;\n div[data-test='content'] {\n display: block;\n }\n"]))),Ie=(0,ee.default)(re.default)(j||(j=(0,Y.default)(["\n height: fit-content;\n"]))),Me=(0,ee.default)(oe.default)(K||(K=(0,Y.default)(["\n margin-bottom: 0px;\n"]))),Oe=(0,ee.default)(le.default)(W||(W=(0,Y.default)(["\n margin-left: 5px;\n"]))),Ae=$.default.createElement(ae.default,null),Pe=$.default.createElement(ne.default,null);function KpiThresholdingRecommendationControls(s){var{appsData:o,isReadOnly:_,handleGoBack:S,thresholdRecommendationKPIDataAvailabilitySearchRetrieveAction:R,thresholdRecommendationKPIDataAvailabilitySearchStatus:O,thresholdRecommendationKPIDataAvailabilitySearchResults:P,triggerRecommendationSearch:D}=s,{kpiData:N,selectedKpiModel:V}=(0,$.useContext)(be.ThresholdingContext),j=(0,$.useCallback)(()=>({analysisWindowValue:V.get("recommendation_training_window")||Se.ANALYSIS_WINDOW_OPTIONS[1].value,analysisWindowStartDate:V.get("recommendation_start_date")||(0,he.default)().subtract(Se.ANALYSIS_WINDOW_OPTIONS[1].days,"days").unix(),allowNegativeValue:!!V.get("recommendation_allow_negative_value"),recommendationApplyAsValue:!!V.get("keep_recommended_policy_static"),thresholdConfigValue:V.get("threshold_direction")||Se.THRESHOLD_CONFIGURATION_OPTIONS[0].value,thresholdSensitivity:V.get("recommendation_threshold_sensitivity")||"0"}),[V]),[K,W]=(0,$.useState)(!1),[U,Y]=(0,$.useState)(0),[X,Z]=(0,$.useState)(!1),[Q,ee]=(0,$.useState)(j()),[ie,ae]=(0,$.useState)(!0),[ne,se]=(0,$.useState)(""),ce=(0,$.useCallback)(()=>{V.set("did_load_recommendation",!1),V.set("recommendation_training_window",Q.analysisWindowValue),V.set("recommendation_start_date",Q.analysisWindowStartDate),V.set("recommendation_allow_negative_value",Q.allowNegativeValue),V.set("keep_recommended_policy_static",Q.recommendationApplyAsValue),V.set("threshold_direction",Q.thresholdConfigValue),V.set("recommendation_threshold_sensitivity",Q.thresholdSensitivity)},[Q.allowNegativeValue,Q.analysisWindowStartDate,Q.analysisWindowValue,Q.recommendationApplyAsValue,Q.thresholdConfigValue,Q.thresholdSensitivity,V]),ye=(0,$.useCallback)(()=>{ce(),D()},[D,ce]);(0,$.useEffect)(()=>{if(K&&O===_e.THRESHOLD_RECOMMENDATION_KPI_DATA_AVAILABILITY_SEARCH_RETRIEVE_STATUS.SUCCESS){var s=P.results,o=Q.analysisWindowValue.match(/\d+/g)[0],_=s.length?Math.ceil((new Date-1e3*Number(s[0].earliest_data_time))/864e5):0;_<Number(o)?(Y(_),Z(!1)):ye()}},[O]);var De=(0,$.useCallback)(()=>{if(ie){var s=Q.analysisWindowValue,o=he.default.unix(Q.analysisWindowStartDate),_=o.clone(),S=s.match(/\d+/g)[0];_.add(S,"days");var O={search:(0,ve.getMetricIndexEarliestTimeSearchForKPIData)([N._key]),earliest:"-".concat((0,he.default)().diff(o,"day"),"d"),latest:(0,he.default)().isSame(_,"day")?"now":"-".concat((0,he.default)().diff(_,"day"),"d")};R(O),Z(!0),se(""),W(!0)}else se("You must remove errors to proceed")},[ie,N._key,Q.analysisWindowStartDate,Q.analysisWindowValue,R]),Le=(0,$.useCallback)((function(s,o){var _=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"analysisWindowValue"!==s&&"analysisWindowStartDate"!==s||!K||W(!1),_?(ee(_=>_objectSpread(_objectSpread({},_),{},{[s]:o})),ae(!0)):ae(!1)}),[K]);return $.default.createElement($.default.Fragment,null,$.default.createElement(re.default,{"data-test-itsi":"ai-recommendation-back-to-thresholding-button",label:(0,pe.gettext)("Back"),icon:Ae,onClick:S}),$.default.createElement(xe,{"data-test-itsi":"ai-thresholding-header",level:3},(0,pe.gettext)("AI thresholding")),$.default.createElement(de.default,null,(0,pe.gettext)("Let AI generate your threshold settings. Algorithms analyze historical data to recommend optimal threshold values.")),(()=>{var s=!1,S=!0;if((0,te.default)(fe.PYTHON_SCIENTIFIC_APP_NAMES,_=>{o&&o[_]&&o[_].isInstalled&&(s=!0,o[_].isDisabled||(S=!1))}),!(s&&!S)&&!_)return $.default.createElement(Re,{appearance:"fill",type:"error","data-test-itsi":"kpi-thresholding-install-psc-error-message"},$.default.createElement(oe.default.Title,null,(0,pe.gettext)("Missing software")),$.default.createElement("div",null,!s&&$.default.createElement($.default.Fragment,null,me.AT_RECOMMENDATION_PSC_NOT_INSTALLED_MESSAGE," ",(0,pe.gettext)("Install app for"),$.default.createElement(Oe,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-linux",to:(0,ge.getSplunkBaseURL)(fe.SPLUNKBASE_APPS.Python_Scientific_Linux.id),openInNewContext:!0},(0,pe.gettext)("Linux 64-bit")),",",$.default.createElement(Oe,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-windows",to:(0,ge.getSplunkBaseURL)(fe.SPLUNKBASE_APPS.Python_Scientific_Windows.id),openInNewContext:!0},(0,pe.gettext)("Windows 64-bit")),",",$.default.createElement(Oe,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-mac-intel",to:(0,ge.getSplunkBaseURL)(fe.SPLUNKBASE_APPS.Python_Scientific_Mac_Intel.id),openInNewContext:!0},(0,pe.gettext)("Mac Intel")),", ".concat((0,pe.gettext)("or")),$.default.createElement(Oe,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-mac-arm",to:(0,ge.getSplunkBaseURL)(fe.SPLUNKBASE_APPS.Python_Scientific_Mac_Apple_Silicon.id),openInNewContext:!0},(0,pe.gettext)("Mac Apple Silicon"))),s&&S&&$.default.createElement($.default.Fragment,null,me.AT_RECOMMENDATION_PSC_DISABLED_MESSAGE," ",$.default.createElement(le.default,{"data-test-itsi":"kpi-thresholding-psc-app-enable-link",to:(0,ge.manageAppsURL)({search:fe.PYTHON_SCIENTIFIC_APP_NAME_PREFIX}),openInNewContext:!0},(0,pe.gettext)("Enable the app here.")))));if(K&&X)return $.default.createElement($.default.Fragment,null,$.default.createElement(ke,{"data-test-itsi":"kpi-recommendation-modal-wait-spinner"}),(0,pe.gettext)("Checking for KPI data in the selected time range..."));var R=Se.ANALYSIS_WINDOW_OPTIONS.filter(s=>s.value===Q.analysisWindowValue)[0].days;return $.default.createElement($.default.Fragment,null,$.default.createElement(Ee.default,{isKpiRecommendation:!0,isReadOnly:_,showInModelStyle:!1,onRecommendationControlsChange:Le,recommendationSettingsObject:Q}),K&&$.default.createElement($.default.Fragment,null,$.default.createElement(Te,{appearance:"fill","data-test-itsi":"threshold-recommendation-less-data-warning-message",type:"warning"},(0,ue.sprintf)((0,pe.gettext)("Your analysis window is set to %(analysisWindow)s days and you only have %(availableData)d days of summary data for this KPI."),{analysisWindow:R,availableData:U})," ",(0,pe.gettext)("Setting an analysis window that is greater than the amount of available data may misconfigure thresholding recommendations.")),$.default.createElement(Ce,null,(0,pe.gettext)("Do you want to continue with the current settings?"))),!_&&$.default.createElement(we,null,$.default.createElement(Ie,{"data-test-itsi":"ai-recommendation-run-analysis-button",label:(0,pe.gettext)("Load recommendations"),icon:Pe,onClick:K?ye:De}),ne.length>0&&$.default.createElement(Me,{"data-test-itsi":"kpi-recommendation-modal-footer-error-message",type:"error"},(0,pe.gettext)("You must remove errors to proceed"))))})())}KpiThresholdingRecommendationControls.propTypes={appsData:Q.default.object.isRequired,handleGoBack:Q.default.func,thresholdRecommendationKPIDataAvailabilitySearchRetrieveAction:Q.default.func.isRequired,thresholdRecommendationKPIDataAvailabilitySearchStatus:Q.default.string.isRequired,thresholdRecommendationKPIDataAvailabilitySearchResults:Q.default.object.isRequired,triggerRecommendationSearch:Q.default.func.isRequired,isReadOnly:Q.default.bool},KpiThresholdingRecommendationControls.defaultProps={handleGoBack:ie.default,isReadOnly:!1};o.default=(0,X.connect)(s=>({thresholdRecommendationKPIDataAvailabilitySearchStatus:s.serviceDefinition.thresholdRecommendationKPIDataAvailabilitySearchStatus,thresholdRecommendationKPIDataAvailabilitySearchResults:s.serviceDefinition.thresholdRecommendationKPIDataAvailabilitySearchResults}),s=>(0,Z.bindActionCreators)({thresholdRecommendationKPIDataAvailabilitySearchRetrieveAction:ye.thresholdRecommendationKPIDataAvailabilitySearchRetrieve},s))(KpiThresholdingRecommendationControls);s.exports=o.default},2640:function(s,o,_){(()=>{"use strict";var o={n:s=>{var _=s&&s.__esModule?()=>s.default:()=>s;return o.d(_,{a:_}),_},d:(s,_)=>{for(var S in _)o.o(_,S)&&!o.o(s,S)&&Object.defineProperty(s,S,{enumerable:!0,get:_[S]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},S={};o.r(S),o.d(S,{default:()=>W});const R=_(0);var O=o.n(R);const P=_(104);var D=o.n(P);const N=_(106);function u(s,o){if(null==s)return{};var _,S,R=function i(s,o){if(null==s)return{};var _,S,R={},O=Object.keys(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||(R[_]=s[_]);return R}(s,o);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||Object.prototype.propertyIsEnumerable.call(s,_)&&(R[_]=s[_])}return R}var V=new Map;V.set("outlined",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.55069 3C1.28764 3 0.590045 4.46562 1.38652 5.44589L7.0002 12.355V19.3981C7.0002 20.6869 8.51808 21.3756 9.48796 20.527L12.488 17.902C12.8135 17.6171 13.0002 17.2057 13.0002 16.7731V12.355L18.6139 5.44589C19.4104 4.46562 18.7128 3 17.4497 3H2.55069ZM8.66437 11.2316L3.60117 5H16.3992L11.336 11.2316C11.1188 11.499 11.0002 11.833 11.0002 12.1775V16.5462L9.0002 18.2962V12.1775C9.0002 11.833 8.88162 11.499 8.66437 11.2316Z"}),O().createElement("path",{d:"M20 15C20 14.4477 19.5523 14 19 14C18.4477 14 18 14.4477 18 15V17H16C15.4477 17 15 17.4477 15 18C15 18.5523 15.4477 19 16 19H18V21C18 21.5523 18.4477 22 19 22C19.5523 22 20 21.5523 20 21V19H22C22.5523 19 23 18.5523 23 18C23 17.4477 22.5523 17 22 17H20V15Z"}))})),V.set("filled",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{d:"M1.23125 5.45349C0.428924 4.47427 1.12558 3.00281 2.39152 3.00281H17.3793C18.6453 3.00281 19.3419 4.47426 18.5396 5.45348L12.8855 12.3542V16.9697C12.8855 17.4082 12.6936 17.8248 12.3602 18.1097L9.36024 20.6748C8.38686 21.507 6.88546 20.8153 6.88546 19.5347V12.3542L1.23125 5.45349Z"}),O().createElement("path",{d:"M20 15C20 14.4477 19.5523 14 19 14C18.4477 14 18 14.4477 18 15V17H16C15.4477 17 15 17.4477 15 18C15 18.5523 15.4477 19 16 19H18V21C18 21.5523 18.4477 22 19 22C19.5523 22 20 21.5523 20 21V19H22C22.5523 19 23 18.5523 23 18C23 17.4477 22.5523 17 22 17H20V15Z"}))}));var j=["default","outlined","filled"],K=function e(s){return"default"===s||s&&!function e(s){return j.indexOf(s)>=0}(s)?"outlined":s};const W=function e(s){var o=s.children,_=s.variant,S=void 0===_?"default":_,P=u(s,["children","variant"]),j=K(S),W="filterplus-".concat(j),U=(0,R.useContext)(N.IconContext),Y=V.get(j);if(U&&Y){var $=U.toRender;if((0,U.addIcon)(W,Y()),!$)return null}return O().createElement(D(),P,o,U?O().createElement("use",{href:"#".concat(W)}):!!Y&&Y())};s.exports=S})()},2641:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V=S(_(7)),j=S(_(0)),K=S(_(3)),W=S(_(2)),U=S(_(39)),Y=S(_(27)),$=S(_(266)),X=S(_(956)),Z=S(_(218)),Q=S(_(64)),ee=S(_(34)),te=S(_(203)),ie=S(_(373)),ae=S(_(89)),ne=_(4),re=_(108),se=(0,W.default)(Q.default)(R||(R=(0,V.default)(["\n align-items: center;\n display: flex;\n gap: 14px;\n width: fit-content;\n margin-bottom: 20px;\n margin-top: 10px;\n"]))),le=W.default.div(O||(O=(0,V.default)(["\n display: flex;\n justify-content: start;\n width: 85%;\n"]))),oe=(0,W.default)(ee.default)(P||(P=(0,V.default)(["\n margin-left: 10px;\n"]))),de=(0,W.default)($.default)(D||(D=(0,V.default)(["\n [data-test='label'] {\n overflow: visible;\n }\n"]))),ce=(0,W.default)(Q.default)(N||(N=(0,V.default)(["\n margin-top: 0px;\n"]))),he=j.default.createElement(X.default,null),ue=j.default.createElement(ie.default,null);function EntityThresholdingControlsHeader(s){var{selectedEntity:o,isDefaultEntityThresholdView:_,onEntityThresholdToDefaultClicked:S,isEntityUsingDefaultSetting:R,isReadOnly:O,isEntityRecommendationConfigured:P}=s,getDefaultSettingHeaderToggle=()=>j.default.createElement(Y.default,{"data-test-itsi":"entity-thresholding-header-button",icon:he});return j.default.createElement(j.default.Fragment,null,j.default.createElement(le,null,j.default.createElement(ce,{"data-test-itsi":"entity-thresholding-heading",level:2},(0,ne.gettext)("Entity thresholds")),j.default.createElement(oe,{"data-test-itsi":"entity-thresholding-learn-more-link",to:(0,re.makeDocsURL)(re.DOCS_PAGES.ITSI_ENTITY_ADAPTIVE_THRESHOLDING),openInNewContext:!0},(0,ne.gettext)("Entity documentation"))),j.default.createElement(se,{"data-test-itsi":"entity-thresholding-header-title",level:3},o.title,_&&O?null:_?j.default.createElement(ae.default,{"data-test-itsi":"entity-thresholding-header-default-setting-tooltip",content:(0,ne.gettext)("Default settings apply to all entities not explicitly customized.")}):R?j.default.createElement(ae.default,{"data-test-itsi":"entity-thresholding-header-entity-with-default-setting-tooltip",content:(0,ne.gettext)("The threshold settings for this entity match the default settings")},j.default.createElement(de,{"data-test-itsi":"entity-thresholding-header-entity-with-default-setting-chip"},(0,ne.gettext)("Uses default settings"))):!_&&P?j.default.createElement(j.default.Fragment,null,j.default.createElement(ae.default,{"data-test-itsi":"entity-thresholding-header-entity-with-recommended-setting-tooltip",content:(0,ne.gettext)("The threshold settings for this entity are configured by Splunk AI.")},j.default.createElement(de,{"data-test-itsi":"entity-thresholding-header-entity-with-recommended-setting-chip",icon:ue},(0,ne.gettext)("Uses AI thresholding"))),!O&&j.default.createElement(Z.default,{toggle:getDefaultSettingHeaderToggle()},j.default.createElement(te.default,{"data-test-itsi":"entity-thresholding-header-entity-with-recommended-settings-menu"},j.default.createElement(te.default.Item,{"data-test-itsi":"entity-thresholding-header-entity-with-recommended-settings-menu-item",onClick:S},(0,ne.gettext)("Revert to default settings"))))):j.default.createElement(j.default.Fragment,null,j.default.createElement(ae.default,{"data-test-itsi":"entity-thresholding-header-entity-with-custom-settings-tooltip",content:(0,ne.gettext)("The threshold settings for this entity do not match the default settings")},j.default.createElement(de,{"data-test-itsi":"entity-thresholding-header-entity-with-custom-settings-chip"},(0,ne.gettext)("Uses custom settings"))),!O&&j.default.createElement(Z.default,{toggle:getDefaultSettingHeaderToggle()},j.default.createElement(te.default,{"data-test-itsi":"entity-thresholding-header-entity-with-custom-settings-menu"},j.default.createElement(te.default.Item,{"data-test-itsi":"entity-thresholding-header-entity-with-custom-settings-menu-item",onClick:S},(0,ne.gettext)("Revert to default settings")))))))}EntityThresholdingControlsHeader.propTypes={selectedEntity:K.default.object.isRequired,isDefaultEntityThresholdView:K.default.bool,isEntityUsingDefaultSetting:K.default.bool,onEntityThresholdToDefaultClicked:K.default.func,isReadOnly:K.default.bool,isEntityRecommendationConfigured:K.default.bool},EntityThresholdingControlsHeader.defaultProps={isDefaultEntityThresholdView:!1,isEntityUsingDefaultSetting:!1,onEntityThresholdToDefaultClicked:U.default,isReadOnly:!1,isEntityRecommendationConfigured:!1};o.default=EntityThresholdingControlsHeader;s.exports=o.default},2642:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$=S(_(133)),X=S(_(8)),Z=S(_(7)),Q=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),ee=S(_(3)),te=S(_(2)),ie=S(_(81)),ae=S(_(94)),ne=S(_(33)),re=S(_(37)),se=S(_(121)),le=S(_(266)),oe=S(_(348)),de=S(_(24)),ce=S(_(100)),he=S(_(383)),ue=S(_(103)),pe=S(_(116)),fe=_(14),ge=_(4),me=S(_(34)),ve=_(29),ye=_(87),_e=_(130),Se=_(67),be=_(102),Ee=_(501),Te=S(_(705)),Ce=S(_(1458)),ke=S(_(2643)),xe=S(_(2644)),we=_(306),Re=_(264),Ie=_(57),Me=_(265);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _toPropertyKey(s){var o=function _toPrimitive(s,o){if("object"!=typeof s||!s)return s;var _=s[Symbol.toPrimitive];if(void 0!==_){var S=_.call(s,o||"default");if("object"!=typeof S)return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===o?String:Number)(s)}(s,"string");return"symbol"==typeof o?o:o+""}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,X.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var Oe=(0,te.default)(de.default)(R||(R=(0,Z.default)(["\n margin-top: 14px;\n div[data-test='content'] {\n display: block;\n }\n"]))),Ae=(0,te.default)(me.default)(O||(O=(0,Z.default)(["\n margin-left: 5px;\n"]))),Pe=(0,te.default)(ce.default.Body)(P||(P=(0,Z.default)(["\n padding: ",";\n"])),s=>s.padding),De=(0,te.default)(ce.default)(D||(D=(0,Z.default)(["\n width: "," !important;\n color: unset;\n"])),s=>s.width),Le=(0,te.default)(de.default)(N||(N=(0,Z.default)(["\n [data-test='content'] {\n display: flex;\n flex-direction: column;\n }\n margin-bottom: 24px;\n"]))),Ne=te.default.div(V||(V=(0,Z.default)(["\n display: inline-flex;\n gap: 5px;\n padding: 5px 0px 5px 0px;\n"]))),Ve=te.default.div(j||(j=(0,Z.default)(["\n display: flex;\n padding: 5px;\n flex-wrap: wrap;\n"]))),je=(0,te.default)(ue.default)(K||(K=(0,Z.default)(["\n padding-left: 5px;\n"]))),He=(0,te.default)(oe.default)(W||(W=(0,Z.default)(["\n margin: 5px 0px 5px 0px;\n"]))),Be=(0,te.default)(he.default)(U||(U=(0,Z.default)(["\n overflow: auto;\n height: 375px;\n width: 100%;\n"]))),Ke=te.default.div(Y||(Y=(0,Z.default)(["\n padding: 5px;\n border-top: 1px dotted ",";\n color: ",";\n"])),pe.default.borderColor,pe.default.textGray);function EntityThresholdingRecommendationModal(s){var{entityData:o,isOpen:_,handleEntityThresholdingModalClose:S,useRawSearch:R,toggleFeatures:O,pageToOpenOn:P,appsData:D}=s,{isServiceTemplate:N,selectedKpiModel:V}=(0,Q.useContext)(we.ThresholdingContext),[j,K]=(0,Q.useState)({thresholdConfigValue:V.get("entity_threshold_direction")||be.ENTITY_THRESHOLD_CONFIGURATION_OPTIONS[0].value,analysisWindowValue:V.get("entity_recommendation_training_window")||be.ANALYSIS_WINDOW_OPTIONS[2].value,analysisWindowStartDate:V.get("entity_recommendation_start_date")||(0,se.default)().subtract(be.ANALYSIS_WINDOW_OPTIONS[2].days,"days").unix(),recommendationApplyAsValue:!!V.get("entity_keep_recommended_policy_static"),onboardNewEntities:!!N||V.get("onboarding_new_entities_enabled"),allowNegativeValue:!!V.get("entity_recommendation_allow_negative_value"),thresholdSensitivity:V.get("entity_recommendation_threshold_sensitivity")||"0",configureAllSomeEntities:"all"}),[W,U]=(0,Q.useState)(!0),[Y,X]=(0,Q.useState)((0,ne.default)(P)?be.ENTITY_RECOMMENDATION_PANELS.filter(s=>"entity_thresholds"===s.value)[0]:P),[Z,ee]=(0,Q.useState)(!0),[te,oe]=(0,Q.useState)(!1),[de,he]=(0,Q.useState)(""),[ue,pe]=(0,Q.useState)(!1),[Fe,We]=(0,Q.useState)({}),[Ue,Ge]=(0,Q.useState)(!1),[Ye,qe]=(0,Q.useState)({}),[ze,$e]=(0,Q.useState)(o),[Je,Xe]=(0,Q.useState)(""),[Ze,Qe]=(0,Q.useState)([]),[et,tt]=(0,Q.useState)([]),[it,at]=(0,Q.useState)(!1),[nt,rt]=(0,Q.useState)(null),st=!1,lt=!0;(0,re.default)(Me.PYTHON_SCIENTIFIC_APP_NAMES,s=>{D&&D[s]&&D[s].isInstalled&&(st=!0,D[s].isDisabled||(lt=!1))});var ot=st&&!lt,getEntitiesBatch=(s,o,_)=>_.slice(s,o);(0,Q.useEffect)(()=>{K(s=>_objectSpread(_objectSpread({},s),{},{onboardNewEntities:O.onboardNewEntities}))},[O]),(0,Q.useEffect)(()=>{(0,ne.default)(P)||P===Y||X(P)},[P]),(0,Q.useEffect)(()=>{$e(o);var s=getEntitiesBatch(0,_e.DEFAULT_PAGINATED_BATCH_SIZE,o);tt(s),Xe(""),Qe([])},[_]);var dt,ct=(0,Q.useCallback)(s=>{oe(s)},[]),ht=(0,Q.useCallback)(s=>{(0,ne.default)(s)&&ue&&pe(!1),he(s)},[ue]),ut=(0,Q.useCallback)((s,o)=>{"thresholdConfigValue"===s?K(s=>_objectSpread(_objectSpread({},s),{},{thresholdConfigValue:o})):"analysisWindowValue"===s?K(s=>_objectSpread(_objectSpread({},s),{},{analysisWindowValue:o})):"analysisWindowStartDate"===s?K(s=>_objectSpread(_objectSpread({},s),{},{analysisWindowStartDate:o})):"recommendationApplyAsValue"===s?K(s=>_objectSpread(_objectSpread({},s),{},{recommendationApplyAsValue:o})):"onboardNewEntities"===s?K(s=>_objectSpread(_objectSpread({},s),{},{onboardNewEntities:o})):"configureAllSomeEntities"===s?K(s=>_objectSpread(_objectSpread({},s),{},{configureAllSomeEntities:o})):"allowNegativeValue"===s?K(s=>_objectSpread(_objectSpread({},s),{},{allowNegativeValue:o})):"thresholdSensitivity"===s&&K(s=>_objectSpread(_objectSpread({},s),{},{thresholdSensitivity:o}))},[]),pt=(0,ae.default)((s,_)=>{var{value:S}=_;Xe(S);var R=(0,Ee.filterEntities)(o,S,Ze);$e(R);var O=getEntitiesBatch(0,_e.DEFAULT_PAGINATED_BATCH_SIZE,R);tt(O)},ye.DEFAULT_DEBOUNCE_DELAY),ft=(0,Q.useCallback)(s=>{var _=[s],S=(0,Ee.filterEntities)(o,Je,_);$e(S);var R=getEntitiesBatch(0,_e.DEFAULT_PAGINATED_BATCH_SIZE,S);tt(R),Qe(_)},[o,Je]),handleRemoveAdvancedFiltering=(s,_)=>{var{value:S}=_,R=Ze.filter(s=>s.value!==S),O=(0,Ee.filterEntities)(o,Je,R);$e(O);var P=getEntitiesBatch(0,_e.DEFAULT_PAGINATED_BATCH_SIZE,O);tt(P),Qe(R)},gt=(0,Q.useCallback)(()=>ze.filter(s=>Ye[s.entity_title]),[ze,Ye]),mt=(0,ae.default)(()=>{if(et.length){var s=et.length,o=s+_e.DEFAULT_PAGINATED_BATCH_SIZE,_=(0,ie.default)(ze);if(s<=_.length){var S=getEntitiesBatch(s,o,_),R=et.concat(S);at(!1),tt(R)}else at(!1)}else at(!1)},ye.DEFAULT_DEBOUNCE_DELAY),handleScrollElMount=s=>{rt(s)},onScroll=()=>{nt.scrollTop+nt.clientHeight>=.75*nt.scrollHeight&&(null==et?void 0:et.length)!==(null==ze?void 0:ze.length)&&(at(!0),mt())},vt=(0,Q.useCallback)((function(){var s=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];te&&oe(!1),S("custom"===j.configureAllSomeEntities?gt()[0]:o[0]),K(s=>_objectSpread(_objectSpread({},s),{},{thresholdConfigValue:V.get("entity_threshold_direction")||be.ENTITY_THRESHOLD_CONFIGURATION_OPTIONS[0].value,analysisWindowValue:V.get("entity_recommendation_training_window")||be.ANALYSIS_WINDOW_OPTIONS[2].value,analysisWindowStartDate:V.get("entity_recommendation_start_date")||(0,se.default)().subtract(be.ANALYSIS_WINDOW_OPTIONS[2].days,"days").unix(),recommendationApplyAsValue:!!V.get("entity_keep_recommended_policy_static"),allowNegativeValue:!!V.get("entity_recommendation_allow_negative_value"),thresholdSensitivity:V.get("entity_recommendation_threshold_sensitivity")||"0",configureAllSomeEntities:"all",onboardNewEntities:!!N||V.get("onboarding_new_entities_enabled")})),s&&V.unset("entity_threshold_configuration"),X(be.ENTITY_RECOMMENDATION_PANELS.filter(s=>"entity_thresholds"===s.value)[0])}),[o,j.configureAllSomeEntities,gt,S,te,N,V]),yt=(0,Q.useCallback)(()=>{V.set("is_entity_level_thresholding",!0),V.set("is_recommended_time_policies_for_entities",!0),V.set("entity_threshold_direction",j.thresholdConfigValue),V.set("entity_recommendation_training_window",j.analysisWindowValue),V.set("entity_recommendation_start_date",j.analysisWindowStartDate),V.set("entity_keep_recommended_policy_static",j.recommendationApplyAsValue),V.set("entity_recommendation_allow_negative_value",j.allowNegativeValue),V.set("entity_recommendation_threshold_sensitivity",j.thresholdSensitivity),V.set("did_load_recommendation",!0),V.set("is_entity_recommendation_pending",!0),V.set("onboarding_new_entities_enabled",j.onboardNewEntities),vt(!1),V.set("is_entity_recommendation_async_job_required",!0)},[j.analysisWindowStartDate,j.analysisWindowValue,j.onboardNewEntities,j.recommendationApplyAsValue,j.thresholdConfigValue,j.allowNegativeValue,j.thresholdSensitivity,vt,V]),onClickSelectAll=()=>{if("some"!==Ue&&Ue)qe({}),Ge(!1);else{var s=ze.reduce((s,o)=>_objectSpread(_objectSpread({},s),{},{[o.entity_title]:!0}),{});qe(s),Ge(!0)}},onClickEntity=(s,o)=>{var{value:_}=o;if(_ in Ye&&Ye[_]){var{[_]:S}=Ye,R=(0,$.default)(Ye,[_].map(_toPropertyKey)),O=Object.keys(R).length>0&&"some";qe(R),Ge(O)}else{R=_objectSpread(_objectSpread({},Ye),{},{[_]:!0});var P=Object.keys(R).length===ze.length||"some";qe(R),Ge(P)}},_t=(0,Q.useCallback)(()=>{(0,ne.default)(de)?(pe(!1),"entity_thresholds"===Y.value&&"custom"===j.configureAllSomeEntities?X(be.ENTITY_RECOMMENDATION_PANELS.filter(s=>"select_entities"===s.value)[0]):"entity_thresholds"===Y.value&&"all"===j.configureAllSomeEntities||"select_entities"===Y.value?X(be.ENTITY_RECOMMENDATION_PANELS.filter(s=>"recommend_thresholding"===s.value)[0]):"recommend_thresholding"===Y.value&&X(be.ENTITY_RECOMMENDATION_PANELS.filter(s=>"accept_run"===s.value)[0]),U(!1),j.thresholdConfigValue===Fe.thresholdConfigValue&&j.analysisWindowValue===Fe.analysisWindowValue&&se.default.unix(j.analysisWindowStartDate).format(Se.MOMENT_FORMAT).toString()===se.default.unix(Fe.analysisWindowStartDate).format(Se.MOMENT_FORMAT).toString()&&j.recommendationApplyAsValue===Fe.recommendationApplyAsValue&&j.allowNegativeValue===Fe.allowNegativeValue&&j.thresholdSensitivity===Fe.thresholdSensitivity||(We(j),te&&oe(!1),ee(!0))):pe(!0)},[j,de,Fe,Y.value,te]),St=(0,Q.useCallback)(()=>{ee(!1),W?vt():"accept_run"===Y.value?X(be.ENTITY_RECOMMENDATION_PANELS.filter(s=>"recommend_thresholding"===s.value)[0]):"recommend_thresholding"===Y.value&&"custom"===j.configureAllSomeEntities?(te&&oe(!1),X(be.ENTITY_RECOMMENDATION_PANELS.filter(s=>"select_entities"===s.value)[0])):("recommend_thresholding"===Y.value&&"all"===j.configureAllSomeEntities||"select_entities"===Y.value)&&(U(!0),X(be.ENTITY_RECOMMENDATION_PANELS.filter(s=>"entity_thresholds"===s.value)[0]))},[W,Y.value,vt,te]);return Q.default.createElement("div",null,Q.default.createElement(De,{open:_,onRequestClose:vt,width:Y.width,"data-test-itsi":"entity-thresholding-recommendation-modal"},Q.default.createElement(ce.default.Header,{onRequestClose:vt,title:ot?Y.title:(0,ge.gettext)("Missing software"),subtitle:ot?Y.description:(0,ge.gettext)(""),"data-test-itsi":"entity-thresholding-recommendation-modal-header"}),Q.default.createElement(Pe,{padding:Y.padding,"data-test-itsi":"entity-thresholding-recommendation-modal-body"},(dt=Y.value,!ot&&_?Q.default.createElement(Oe,{appearance:"fill",type:"error","data-test-itsi":"recommendation-install-psc-error-message"},Q.default.createElement("div",null,!st&&Q.default.createElement(Q.default.Fragment,null,Ie.AT_RECOMMENDATION_PSC_NOT_INSTALLED_MESSAGE," ",(0,ge.gettext)("Install app for"),Q.default.createElement(Ae,{"data-test-itsi":"recommendation-psc-app-install-link-linux",to:(0,Re.getSplunkBaseURL)(Me.SPLUNKBASE_APPS.Python_Scientific_Linux.id),openInNewContext:!0},(0,ge.gettext)("Linux 64-bit")),",",Q.default.createElement(Ae,{"data-test-itsi":"recommendation-psc-app-install-link-windows",to:(0,Re.getSplunkBaseURL)(Me.SPLUNKBASE_APPS.Python_Scientific_Windows.id),openInNewContext:!0},(0,ge.gettext)("Windows 64-bit")),",",Q.default.createElement(Ae,{"data-test-itsi":"recommendation-psc-app-install-link-mac-intel",to:(0,Re.getSplunkBaseURL)(Me.SPLUNKBASE_APPS.Python_Scientific_Mac_Intel.id),openInNewContext:!0},(0,ge.gettext)("Mac Intel")),", ".concat((0,ge.gettext)("or")),Q.default.createElement(Ae,{"data-test-itsi":"recommendation-psc-app-install-link-mac-arm",to:(0,Re.getSplunkBaseURL)(Me.SPLUNKBASE_APPS.Python_Scientific_Mac_Apple_Silicon.id),openInNewContext:!0},(0,ge.gettext)("Mac Apple Silicon"))),st&<&&Q.default.createElement(Q.default.Fragment,null,Ie.AT_RECOMMENDATION_PSC_DISABLED_MESSAGE," ",Q.default.createElement(me.default,{"data-test-itsi":"recommendation-psc-app-enable-link",to:(0,Re.manageAppsURL)({search:Me.PYTHON_SCIENTIFIC_APP_NAME_PREFIX}),openInNewContext:!0},(0,ge.gettext)("Enable the app here."))))):dt===be.ENTITY_RECOMMENDATION_PANELS[0].value?Q.default.createElement(Te.default,{onRecommendationControlsChange:ut,recommendationSettingsObject:j,handleFooterErrorMessage:ht,isServiceTemplateView:N}):dt===be.ENTITY_RECOMMENDATION_PANELS[1].value?Q.default.createElement("div",null,Q.default.createElement("div",null,(0,fe.sprintf)((0,ve.ungettext)("%(entityCount)d Entity selected","%(entityCount)d Entities selected",Object.keys(Ye).length||0),{entityCount:Object.keys(Ye).length||0})),Q.default.createElement(Ne,null,Q.default.createElement(Ce.default,{handleClickAdvancedFiltering:ft,handleEntityFilterChange:pt})),Q.default.createElement(Ve,null,Ze.map(s=>Q.default.createElement(le.default,{"data-test-itsi":"entity-side-panel-".concat(s.value.split("_").join("-"),"-filter-chip"),key:s.value,value:s.value,onRequestRemove:handleRemoveAdvancedFiltering},s.label))),Q.default.createElement(je,{"data-test-itsi":"entity-modal-select-all-button",onClick:onClickSelectAll,selected:Ue,appearance:"checkbox"},(0,ge.gettext)("Select all")),Q.default.createElement(He,null),Q.default.createElement(Be,{"data-test-itsi":"entity-side-panel-entities-scroll-container",elementRef:handleScrollElMount,onScroll:onScroll},et.map(s=>Q.default.createElement(je,{"data-test-itsi":"entity-modal-select-entity-button",value:s.entity_title,onClick:onClickEntity,selected:Ye[s.entity_title],appearance:"checkbox",key:"N/A"!==s.entity_key?s.entity_key:s.entity_title},s.entity_title)),it?Q.default.createElement(Ke,{"data-test-itsi":"entity-side-panel-entities-scroll-loading-text"},(0,ge.gettext)("Loading...")):"")):dt===be.ENTITY_RECOMMENDATION_PANELS[2].value?Q.default.createElement(xe.default,{entityRecommendationConfig:j,useRawSearch:R,shouldLoadPreview:Z,handleSaveButtonDisplay:ct,kpiEntitiesData:"custom"===j.configureAllSomeEntities?gt():o}):Q.default.createElement("div",{"data-test-itsi":"entity-recommendation-save-confirmation"},Q.default.createElement(Le,{appearance:"fill",type:"warning","data-test-itsi":"entity-recommendation-save-confirmation-message"},Q.default.createElement("strong",null,(0,ge.gettext)("Waiting period required.")),Q.default.createElement("div",null,N?(0,ge.gettext)("Entity threshold recommendations will be generated while the scheduled entity onboarding job runs, and after services are synced with the service template."):(0,ge.gettext)("While recommendations are being generated, the threshold configurations can’t be edited for selected entities. After saving, refresh this page and wait for recommendations to continue editing."))),(0,ge.gettext)("Continue to generate entity threshold recommendations? ")))),ot&&Q.default.createElement(ce.default.Footer,{"data-test-itsi":"entity-thresholding-recommendation-footer"},Q.default.createElement(ke.default,{onBack:St,onCancel:"accept_run"===Y.value?vt:St,onSave:"accept_run"===Y.value?yt:_t,cancelBtnLabel:W?(0,ge.gettext)("Cancel"):(0,ge.gettext)("Back"),showThirdButton:"accept_run"===Y.value,showSaveButton:!te,showError:ue,errorMessage:ue?de:"",showEntitySelectorMessage:Y.value===be.ENTITY_RECOMMENDATION_PANELS[1].value&&(null==ze?void 0:ze.length)>10,allowNextButtonClick:Y.value!==be.ENTITY_RECOMMENDATION_PANELS[1].value||Y.value===be.ENTITY_RECOMMENDATION_PANELS[1].value&&Object.keys(Ye).length>0}))))}EntityThresholdingRecommendationModal.defaultProps={isOpen:!1,pageToOpenOn:{}},EntityThresholdingRecommendationModal.propTypes={isOpen:ee.default.bool,handleEntityThresholdingModalClose:ee.default.func.isRequired,useRawSearch:ee.default.bool.isRequired,toggleFeatures:ee.default.object.isRequired,pageToOpenOn:ee.default.object,entityData:ee.default.array.isRequired,appsData:ee.default.object.isRequired};o.default=EntityThresholdingRecommendationModal;s.exports=o.default},2643:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N=S(_(7)),V=S(_(0)),j=S(_(3)),K=S(_(2)),W=S(_(27)),U=S(_(24)),Y=_(22),$=_(4),X=(0,K.default)(W.default)(R||(R=(0,N.default)(["\n margin-left: 10px;\n background-color: "," !important;\n color: "," !important;\n"])),s=>s.showThirdButton&&s.backgroundColor,s=>s.showThirdButton&&Y.variables.white),Z=K.default.div(O||(O=(0,N.default)(["\n display: flex;\n height: 30px;\n justify-content: ",";\n"])),s=>s.showThirdButton?"space-between":"flex-end"),Q=(0,K.default)(U.default)(P||(P=(0,N.default)(["\n margin-bottom: 0px;\n max-width: 400px;\n align-items: center;\n"]))),ee=(0,K.default)(U.default)(D||(D=(0,N.default)(["\n margin-bottom: 0px;\n align-items: center;\n"])));function EntityThresholdingRecommendationModalFooter(s){var{cancelBtnLabel:o,onCancel:_,onSave:S,onBack:R,showThirdButton:O,showSaveButton:P,showError:D,errorMessage:N,showEntitySelectorMessage:j,allowNextButtonClick:K}=s;return V.default.createElement(Z,{showThirdButton:O,"data-test-itsi":"entity-thresholding-recommendation-footer-container"},D&&V.default.createElement(ee,{type:"error"},N),j&&V.default.createElement(Q,{type:"info"},(0,$.gettext)("The first 10 selected entities will be shown for preview in the next step")),O&&V.default.createElement("div",null,V.default.createElement(W.default,{"data-test-itsi":"entity-recommendation-footer-back-button",label:o,onClick:R})),V.default.createElement("div",null,V.default.createElement(X,{"data-test-itsi":"entity-recommendation-footer-cancel-button",label:O?(0,$.gettext)("Cancel"):o,onClick:_,appearance:O?"destructive":"default"}),P&&V.default.createElement(W.default,{"data-test-itsi":"entity-recommendation-footer-save-button",label:O?(0,$.gettext)("Confirm"):(0,$.gettext)("Next"),onClick:S,appearance:"primary",disabled:!K})))}EntityThresholdingRecommendationModalFooter.propTypes={cancelBtnLabel:j.default.string,onCancel:j.default.func.isRequired,onSave:j.default.func.isRequired,showThirdButton:j.default.bool.isRequired,onBack:j.default.func.isRequired,showSaveButton:j.default.bool.isRequired,showError:j.default.bool,errorMessage:j.default.string,showEntitySelectorMessage:j.default.bool,allowNextButtonClick:j.default.bool},EntityThresholdingRecommendationModalFooter.defaultProps={cancelBtnLabel:(0,$.gettext)("Cancel"),showError:!1,errorMessage:"",showEntitySelectorMessage:!1,allowNextButtonClick:!0};o.default=EntityThresholdingRecommendationModalFooter;s.exports=o.default},2644:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X=S(_(8)),Z=S(_(7)),Q=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),ee=S(_(3)),te=_(46),ie=_(48),ae=S(_(33)),ne=S(_(81)),re=S(_(732)),se=S(_(50)),le=S(_(349)),oe=S(_(95)),de=S(_(2)),ce=S(_(121)),he=S(_(116)),ue=S(_(27)),pe=S(_(156)),fe=S(_(348)),ge=S(_(24)),me=S(_(383)),ve=_(4),ye=_(29),_e=_(110),Se=_(67),be=_(107),Ee=_(617),Te=_(443),Ce=_(384),ke=_(57),xe=S(_(1055)),we=S(_(1054)),Re=_(803),Ie=_(519),Me=_(306),Oe=S(_(706)),Ae=_(102),Pe=_(501);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,X.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var De=(0,de.default)(me.default)(R||(R=(0,Z.default)(["\n height: 300px;\n max-width: 250px;\n border-right: 1px solid ",";\n"])),he.default.gray80),Le=(0,de.default)(me.default)(O||(O=(0,Z.default)(["\n height: 300px;\n padding: 0px 16px;\n"]))),Ne=de.default.div(P||(P=(0,Z.default)(["\n height: 20px;\n padding: 10px 8px;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n"]))),Ve=(0,de.default)(pe.default)(D||(D=(0,Z.default)(["\n background-color: ",";\n height: 32px;\n\n &:hover {\n background-color: ",";\n }\n\n width: 100%;\n"])),s=>s.selected?he.default.gray80:"none",he.default.gray80),je=de.default.div(N||(N=(0,Z.default)(["\n display: inline-block;\n font-weight: bold;\n overflow: hidden;\n text-overflow: ellipsis;\n vertical-align: middle;\n white-space: nowrap;\n width: 218px;\n padding: 6px 16px;\n"]))),He=de.default.div(V||(V=(0,Z.default)(["\n display: flex;\n flex-direction: row;\n"]))),Be=de.default.div(j||(j=(0,Z.default)(["\n display: flex;\n flex-direction: column;\n padding: 16px 0px 16px 16px;\n"]))),Ke=de.default.div(K||(K=(0,Z.default)(["\n padding: 24px;\n"]))),Fe=(0,de.default)(ge.default)(W||(W=(0,Z.default)(["\n [data-test='content'] {\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n"]))),We=de.default.div(U||(U=(0,Z.default)(["\n padding-right: 20px;\n width: 680px;\n"]))),Ue=(0,de.default)(ue.default)(Y||(Y=(0,Z.default)(["\n width: 150px !important;\n"]))),Ge=de.default.div($||($=(0,Z.default)(["\n padding: 24px;\n"])));function EntityThresholdingRecommendationPreview(s){var{entityRecommendationConfig:o,useRawSearch:_,previewRecommendedEntitiesThresholdsSearchRetrieveAction:S,previewEntitiesThresholdsRecommendationSearchStatus:R,previewEntitiesThresholdsRecommendationResults:O,kpiEntitiesConfigApiStatus:P,kpiEntitiesConfigData:D,shouldLoadPreview:N,kpiEntitiesConfigApiErrorMessage:V,previewEntitiesThresholdsRecommendationSearchErrorMessage:j,handleSaveButtonDisplay:K,kpiEntitiesData:W}=s,{kpiData:U,handleEntityRecommendationUpdate:Y,isServiceTemplate:$,selectedKpiModel:X}=(0,Q.useContext)(Me.ThresholdingContext),[Z,ee]=(0,Q.useState)({}),[te,ie]=(0,Q.useState)(1072),[de,he]=(0,Q.useState)(W[0]),[ue,pe]=(0,Q.useState)(!0),[ge,me]=(0,Q.useState)(""),[Te,Re]=(0,Q.useState)(!1),Ye=(0,Q.useRef)(null),qe=(0,re.default)(W,0,10),ze=(0,re.default)(W,10);(0,Q.useEffect)(()=>{var handleResize=()=>{var s=Ye.current&&Ye.current.offsetWidth?Ye.current.offsetWidth:0;s>774&&ie(s)};return handleResize(),window.addEventListener("resize",handleResize),()=>{window.removeEventListener("resize",handleResize)}},[Ye]);var $e=(0,Q.useCallback)(s=>{me(s),K(!1)},[K]),Je=(0,Q.useCallback)(()=>{Re(!0),me(""),K(!1)},[K]),Xe=(0,Q.useCallback)(s=>{if(s in Z)return(0,Pe.formatEntityData)(Z[s]);var o=null!=D&&D.length?D.findIndex(o=>s===o.entity_title):-1;return-1!==o?(0,Pe.formatEntityData)(D[o]):{}},[Z,D]),getThresholdDataForPreview=(s,o)=>{var _,S;return(0,ae.default)(o)||(null==o||null===(_=o.recommendationError)||void 0===_?void 0:_.length)>0?_objectSpread(_objectSpread({},s),{},{thresholdType:_e.KPI_THRESHOLD_TYPES.ENTITY,rawSearch:s.searchTimeSeriesEntities}):_objectSpread(_objectSpread({},o),{},{alertPeriod:s.alertPeriod,baseSearch:s.baseSearch,entityStatop:s.entityStatop,searchTimeSeriesEntities:s.searchTimeSeriesEntities,entityBreakdownIdFields:s.entityBreakdownIdFields,thresholdField:s.thresholdField,thresholdType:_e.KPI_THRESHOLD_TYPES.ENTITY,rawSearch:s.searchTimeSeriesEntities,searchAlertEarliest:s.searchAlertEarliest,is_entity_breakdown:null===(S=s.tempKpiData)||void 0===S?void 0:S.is_entity_breakdown})},Ze=(0,Q.useCallback)(s=>{for(var o={[_e.DEFAULT_POLICY_KEY]:_e.DEFAULT_POLICY},_=0;_<s.length;_+=1){var S=(0,ye.generateUUID)(),R=[[s[_]["Cron Expression"],parseInt(s[_].Duration,10)]],O=(0,Se.getUserTimezoneOffset)("sec"),P=(0,_e.getPolicyTitleFromTimeBlock)(R,O),D=s[_].Thresholds.replace(/'/g,'"'),N=parseFloat(s[_].Mean),V=parseFloat(s[_].Std),j=(0,ye.normalizeBoolean)(s[_][_e.ENTITY_AT_RESULTS_FIELDS.USE_STATIC_FIELD],!1),K=JSON.parse(D),W=(0,be.generateSeverityLevels)(K,!0,N,V),U={title:P,entity_thresholds:_objectSpread(_objectSpread({},s[_][_e.ENTITY_AT_RESULTS_FIELDS.THRESHOLD_DIRECTION_FIELD]!==Ae.THRESHOLD_CONFIGURATION_OPTIONS[2].value?_e.BASE_CRITICAL_THRESHOLDS:_e.DEFAULT_THRESHOLDS),{},{thresholdLevels:W}),aggregate_thresholds:(0,ne.default)(_e.DEFAULT_THRESHOLDS),policy_type:j?"static":s[_].Algorithm,time_blocks:R};o[S]=U}return o},[]);(0,Q.useEffect)(()=>{if(D&&(Te||N)){pe(!0),K(!0);var s=o.analysisWindowValue,_=ce.default.unix(o.analysisWindowStartDate),R=_.clone(),O=s.match(/\d+/g)[0];R.add(O,"days"),S({kpiId:U._key,entityIds:(0,se.default)(qe,"entity_key"),entityTitles:(0,se.default)(qe,"entity_title"),thresholdDirection:o.thresholdConfigValue,recommendationApplyAsValue:o.recommendationApplyAsValue,analysisWindow:s,allowNegativeValue:o.allowNegativeValue,thresholdSensitivity:o.thresholdSensitivity,earliest:"-".concat((0,ce.default)().diff(_,"day"),"d"),latest:(0,ce.default)().isSame(R,"day")?"now":"-".concat((0,ce.default)().diff(R,"day"),"d")}),Te&&Re(!1)}else P===Ce.SERVICE_KPI_ENTITIES_CONFIG_RETRIEVE_STATUS.ERROR&&$e(V)},[P,Te]),(0,Q.useEffect)(()=>{if(R===Ie.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.IN_PROGRESS)pe(!0),K(!0);else if(R===Ie.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.SUCCESS){pe(!1),K(!1);var s={};qe.forEach(_=>{var S=(0,oe.default)(O.results,s=>s.entity_title===_.entity_title);if((0,le.default)(S)&&S[0][_e.ENTITY_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===Ae.ENTITY_RECOMMENDATIONS.SUCCESSFUL){var R=Ze(S),P=(0,ye.normalizeBoolean)(S[0][_e.ENTITY_AT_RESULTS_FIELDS.USE_STATIC_FIELD]),D=o.analysisWindowValue,N={_key:(0,Ee.md5KeyGenerator)([_.entity_title,_.itsi_kpi_id]),entity_title:_.entity_title,entity_key:_.entity_key,kpi_id:_.itsi_kpi_id,service_id:_.itsi_service_id,entity_thresholds:getThresholdDataForPreview(U,Xe(null==_?void 0:_.entity_title)),adaptive_thresholds_is_enabled:!P,time_variate_thresholds:!0,time_variate_thresholds_specification:{policies:R},adaptive_thresholding_training_window:D===ke.KPI_TIME_PRESETS[2].value||D===ke.KPI_TIME_PRESETS[3].value?ke.KPI_TIME_PRESETS[1].value:D,threshold_recommendation_summary:{lastRun:(0,Se.getEpochNowUTC)(),confidenceScore:S[0][_e.ENTITY_AT_RESULTS_FIELDS.SCORE_FIELD],confidenceLevel:S[0][_e.ENTITY_AT_RESULTS_FIELDS.CONFIDENCE_FIELD],timePolicyDesc:S[0][_e.ENTITY_AT_RESULTS_FIELDS.TIME_POLICY_DESCRIPTION_FIELD],timePolicyType:S[0][_e.ENTITY_AT_RESULTS_FIELDS.ALGORITHM_FIELD]},recommendation_in_progress:!1,is_recommended_time_policies:!0,recommendation_error_type:""};s[_.entity_title]=N}else if((0,le.default)(S)&&S[0][_e.ENTITY_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===Ae.ENTITY_RECOMMENDATIONS.NO_PATTERN){var V=S[0].Thresholds,j=S[0][_e.ENTITY_AT_RESULTS_FIELDS.THRESHOLD_DIRECTION_FIELD]!==Ae.THRESHOLD_CONFIGURATION_OPTIONS[2].value?_e.BASE_CRITICAL_THRESHOLDS:_e.DEFAULT_THRESHOLDS,K=V.replace(/'/g,'"'),W=JSON.parse(K),Y=(0,be.generateSeverityLevels)(W,!1),$={_key:(0,Ee.md5KeyGenerator)([_.entity_title,_.itsi_kpi_id]),entity_title:_.entity_title,entity_key:_.entity_key,kpi_id:_.itsi_kpi_id,service_id:_.itsi_service_id,entity_thresholds:_objectSpread(_objectSpread({},j),{},{thresholdLevels:Y}),adaptive_thresholds_is_enabled:!1,time_variate_thresholds:!1,time_variate_thresholds_specification:{policies:{[_e.DEFAULT_POLICY_KEY]:_e.DEFAULT_POLICY}},threshold_recommendation_summary:{lastRun:(0,Se.getEpochNowUTC)(),confidenceScore:S[0][_e.ENTITY_AT_RESULTS_FIELDS.SCORE_FIELD],confidenceLevel:S[0][_e.ENTITY_AT_RESULTS_FIELDS.CONFIDENCE_FIELD],timePolicyDesc:S[0][_e.ENTITY_AT_RESULTS_FIELDS.TIME_POLICY_DESCRIPTION_FIELD],timePolicyType:S[0][_e.ENTITY_AT_RESULTS_FIELDS.ALGORITHM_FIELD]},recommendation_in_progress:!1,is_recommended_time_policies:!0,recommendation_error_type:""};s[_.entity_title]=$}else if((0,le.default)(S)&&S[0][_e.ENTITY_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===Ae.ENTITY_RECOMMENDATIONS.CONSTANT_KPI){var X={_key:(0,Ee.md5KeyGenerator)([_.entity_title,_.itsi_kpi_id]),entity_title:_.entity_title,entity_key:_.entity_key,kpi_id:_.itsi_kpi_id,service_id:_.itsi_service_id,entity_thresholds:{},adaptive_thresholds_is_enabled:!1,time_variate_thresholds:!1,time_variate_thresholds_specification:{policies:{[_e.DEFAULT_POLICY_KEY]:_e.DEFAULT_POLICY}},recommendation_in_progress:!1,recommendation_error_type:Ae.ENTITY_RECOMMENDATIONS.CONSTANT_KPI};s[_.entity_title]=X}else if((0,le.default)(S)&&S[0][_e.ENTITY_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===Ae.ENTITY_RECOMMENDATIONS.INSUFFICIENT_DATA){var Z={_key:(0,Ee.md5KeyGenerator)([_.entity_title,_.itsi_kpi_id]),entity_title:_.entity_title,entity_key:_.entity_key,kpi_id:_.itsi_kpi_id,service_id:_.itsi_service_id,entity_thresholds:{},adaptive_thresholds_is_enabled:!1,time_variate_thresholds:!1,time_variate_thresholds_specification:{policies:{[_e.DEFAULT_POLICY_KEY]:_e.DEFAULT_POLICY}},recommendation_in_progress:!1,recommendation_error_type:Ae.ENTITY_RECOMMENDATIONS.INSUFFICIENT_DATA};s[_.entity_title]=Z}else if((0,le.default)(S)&&S[0][_e.ENTITY_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===Ae.ENTITY_RECOMMENDATIONS.PATTERN_SWITCH){var Q={_key:(0,Ee.md5KeyGenerator)([_.entity_title,_.itsi_kpi_id]),entity_title:_.entity_title,entity_key:_.entity_key,kpi_id:_.itsi_kpi_id,service_id:_.itsi_service_id,entity_thresholds:{},adaptive_thresholds_is_enabled:!1,time_variate_thresholds:!1,time_variate_thresholds_specification:{policies:{[_e.DEFAULT_POLICY_KEY]:_e.DEFAULT_POLICY}},recommendation_in_progress:!1,recommendation_error_type:Ae.ENTITY_RECOMMENDATIONS.PATTERN_SWITCH};s[_.entity_title]=Q}}),$||(ze.forEach(o=>{s[o.entity_title]=(0,Pe.getEntityThresholdObject)(o,!0)}),X.set("linked_entity_config",D),X.set("linked_entities_data",W)),ee(s),Y([s])}else R!==Ie.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.ERROR||Te||$e(j)},[R]);var Qe=(0,Q.useMemo)(()=>({entity_title:de.entity_title,entity_key:de.entity_key,itsi_kpi_id:U._key}),[U._key,de]),et=(0,Q.useCallback)(s=>{he(s)},[]),tt=(0,Q.useCallback)(s=>()=>et(s),[et]),it=Xe(de.entity_title);return Q.default.createElement("div",{"data-test-itsi":"entity-thresholding-recommendation-preview"},(0,ae.default)(ge)?Q.default.createElement(Q.default.Fragment,null,Q.default.createElement(Ke,null,Q.default.createElement(Oe.default,{isEntityLevelPreview:!0,entityData:Qe,thresholdData:getThresholdDataForPreview(U,it),getTimeInIso:!0,isDefaultEntityThresholdView:!1,useKpiThresholdsForEntities:!1,showBorder:!1,showTitle:!1,svgWidth:te,useRawSearch:_,isReadOnly:!0,isRecommendationSearchRunning:ue,isRecommendationView:!0})),Q.default.createElement(fe.default,null),Q.default.createElement(He,null,Q.default.createElement(De,{"data-test-itsi":"entity-side-panel-entities-scroll-container"},Q.default.createElement(Ne,{"data-test-itsi":"entity-side-panel-entities-heading"},(0,ve.gettext)("Select an entity to preview thresholds")),Q.default.createElement(fe.default,null),Q.default.createElement("div",null,[...qe.map(s=>(s=>Q.default.createElement(Ve,{"data-test-itsi":"entity-side-panel-preview-entity-list-clickable",key:"N/A"!==s.entity_key?s.entity_key:s.entity_title,onClick:tt(s),selected:de&&de.entity_key===s.entity_key&&de.entity_title===s.entity_title},Q.default.createElement(je,{"data-test-itsi":"entity-side-panel-preview-entity-list-title",title:s.entity_title},s.entity_title)))(s))])),ue?Q.default.createElement(Be,{"data-test-itsi":"entity-recommendation-in-progress-container"},Q.default.createElement(we.default,{message:(0,ve.gettext)("Splunk AI is analyzing the data for your entities to configure the most optimal thresholding configuration")})):Q.default.createElement(Le,{"data-test-itsi":"entity-recommendation-details-container"},Q.default.createElement(xe.default,{aiSummaryInfo:{objectType:"entity",currentThreshold:Ae.THRESHOLD_TYPE_OPTIONS.filter(s=>s.value===(0,Pe.getThresholdType)(it))[0],recommendationError:it.recommendationError,thresholdInfo:{adaptiveTrainingWindow:it.adaptiveTrainingWindow,atRecommendationInfo:it.atRecommendationInfo},timeVariateThresholdsSpecification:it.timeVariateThresholdsSpecification,aggregateThresholdsConfig:it.entityThresholdsConfig},showRedirectionControls:!1})))):Q.default.createElement(Ge,{"data-test-itsi":"entity-recommendation-error-container"},Q.default.createElement(Fe,{appearance:"fill",type:"error","data-test-itsi":"entity-ai-recommendation-error-message"},Q.default.createElement(We,{"data-test-itsi":"entity-recommendation-error-content"},ge),Q.default.createElement(Ue,{label:(0,ve.gettext)("Retry"),onClick:Je,"data-test-itsi":"entity-recommendation-retry-button"}))))}EntityThresholdingRecommendationPreview.propTypes={entityRecommendationConfig:ee.default.object.isRequired,useRawSearch:ee.default.bool.isRequired,previewRecommendedEntitiesThresholdsSearchRetrieveAction:ee.default.func.isRequired,previewEntitiesThresholdsRecommendationSearchStatus:ee.default.string.isRequired,previewEntitiesThresholdsRecommendationResults:ee.default.object.isRequired,kpiEntitiesConfigApiStatus:ee.default.string.isRequired,kpiEntitiesConfigData:ee.default.array.isRequired,shouldLoadPreview:ee.default.bool.isRequired,kpiEntitiesConfigApiErrorMessage:ee.default.string.isRequired,previewEntitiesThresholdsRecommendationSearchErrorMessage:ee.default.string.isRequired,handleSaveButtonDisplay:ee.default.func.isRequired,kpiEntitiesData:ee.default.array.isRequired};o.default=(0,te.connect)(s=>({previewEntitiesThresholdsRecommendationSearchStatus:s.serviceDefinition.previewEntitiesThresholdsRecommendationSearchStatus,previewEntitiesThresholdsRecommendationResults:s.serviceDefinition.previewEntitiesThresholdsRecommendationResults,kpiEntitiesConfigApiErrorMessage:s.services.kpiEntitiesConfigApiErrorMessage,kpiEntitiesConfigApiStatus:s.services.kpiEntitiesConfigApiStatus,kpiEntitiesConfigData:s.services.kpiEntitiesConfigData,previewEntitiesThresholdsRecommendationSearchErrorMessage:s.serviceDefinition.previewEntitiesThresholdsRecommendationSearchErrorMessage}),s=>(0,ie.bindActionCreators)({previewRecommendedEntitiesThresholdsSearchRetrieveAction:Re.previewRecommendedEntitiesThresholdsSearchRetrieve,serviceKpiEntitiesConfigRetrieveAction:Te.serviceKpiEntitiesConfigRetrieve},s))(EntityThresholdingRecommendationPreview);s.exports=o.default},2645:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q,ee,te,ie,ae,ne,re,se,le,oe,de,ce,he=S(_(8)),ue=S(_(7)),pe=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),fe=S(_(484)),ge=S(_(81)),me=S(_(486)),ve=S(_(94)),ye=S(_(150)),_e=S(_(95)),Se=S(_(69)),be=S(_(62)),Ee=S(_(33)),Te=S(_(178)),Ce=S(_(50)),ke=S(_(132)),xe=S(_(439)),we=S(_(2365)),Re=S(_(2)),Ie=S(_(3)),Me=S(_(233)),Oe=S(_(283)),Ae=S(_(314)),Pe=S(_(27)),De=S(_(44)),Le=S(_(64)),Ne=S(_(24)),Ve=S(_(282)),je=S(_(66)),He=_(22),Be=_(14),Ke=_(4),Fe=S(_(351)),We=S(_(162)),Ue=S(_(2366)),Ge=S(_(2367)),Ye=S(_(2368)),qe=_(29),ze=_(61),$e=_(107),Je=_(110);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,he.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var Xe=Re.default.div(R||(R=(0,ue.default)(["\n background-color: ",";\n display: flex;\n flex-direction: column;\n height: ","px;\n width: ","px;\n padding: 16px;\n"])),He.variables.white,s=>s.height,s=>s.width),Ze=Re.default.div(O||(O=(0,ue.default)(["\n display: flex;\n height: ","px;\n width: ","px;\n"])),s=>s.height,s=>s.width),Qe=Re.default.div(P||(P=(0,ue.default)(["\n display: flex;\n gap: 12px;\n margin-right: 20px;\n"]))),et=(0,Re.default)(je.default)(D||(D=(0,ue.default)(["\n width: 240px !important;\n"]))),tt=Re.default.div(N||(N=(0,ue.default)(["\n align-self: end;\n"]))),it=(0,Re.default)(Oe.default)(V||(V=(0,ue.default)(["\n margin-right: 5px;\n"]))),at=(0,Re.default)(Ne.default)(j||(j=(0,ue.default)(["\n margin: 10px 14px;\n"]))),nt=Re.default.div(K||(K=(0,ue.default)(["\n flex-direction: column;\n display: flex;\n gap: 12px;\n min-width: ",";\n"])),s=>s.width),rt=(0,Re.default)(Pe.default)(W||(W=(0,ue.default)(["\n align-items: center;\n display: flex;\n margin-top: 5px;\n width: 120px !important;\n"]))),st=(0,Re.default)(Pe.default)(U||(U=(0,ue.default)(["\n align-items: center;\n align-self: end;\n display: flex;\n flex-grow: 0;\n margin: 0px auto 0px 12px;\n padding: 0px 14px;\n height: fit-content;\n"]))),lt=Re.default.div(Y||(Y=(0,ue.default)(["\n overflow-y: scroll;\n padding: 3px 0px 14px 0px;\n"]))),ot=Re.default.div($||($=(0,ue.default)(["\n font-weight: bold;\n min-width: 75px;\n"]))),dt=(0,Re.default)(je.default)(X||(X=(0,ue.default)(["\n margin-left: 0px;\n width: 120px !important;\n"]))),ct=(0,Re.default)(je.default)(Z||(Z=(0,ue.default)(["\n margin-left: 0px;\n width: 180px !important;\n"]))),ht=Re.default.div(Q||(Q=(0,ue.default)(["\n display: flex;\n flex-direction: column-reverse;\n gap: 5px;\n"]))),ut=Re.default.div(ee||(ee=(0,ue.default)(["\n display: flex;\n gap: 176px;\n"]))),pt=Re.default.div(te||(te=(0,ue.default)(["\n margin-bottom: 5px;\n"]))),ft=Re.default.div(ie||(ie=(0,ue.default)(["\n display: flex;\n flex-direction: row;\n gap: 10px;\n width: fit-content;\n"]))),gt=(0,Re.default)(Ve.default)(ae||(ae=(0,ue.default)(["\n width: 86px;\n span::after {\n content: ",";\n padding: 0px 8px;\n }\n"])),s=>s.unitStr?"'".concat(s.unitStr,"'"):""),mt=Re.default.div(ne||(ne=(0,ue.default)(["\n align-items: center;\n display flex;\n min-width: 80px;\n"]))),vt=Re.default.div(re||(re=(0,ue.default)(["\n align-items: center;\n display flex;\n min-width: 80px;\n margin-left: 60px;\n"]))),yt=Re.default.div(se||(se=(0,ue.default)(["\n display: flex;\n flex-direction: 'row';\n gap: ",";\n margin-top: 15px;\n"])),s=>s.isReadOnly?"30px":"10px"),_t=Re.default.div(le||(le=(0,ue.default)(["\n display: flex;\n flex-direction: column;\n gap: 4px;\n"]))),St=(0,Re.default)(Ae.default)(oe||(oe=(0,ue.default)(["\n color: ",";\n margin-right: 6px;\n margin-bottom: 2px;\n"])),s=>s.color),bt=(0,Re.default)(De.default)(de||(de=(0,ue.default)(["\n margin-left: 12px;\n margin-bottom: 0px;\n"]))),Et=(0,Re.default)(Me.default)(ce||(ce=(0,ue.default)(["\n color: ",";\n &:hover {\n color: ",";\n }\n"])),He.variables.linkColor,He.variables.linkColorHover);function ThresholdConfigurationView(s){var{isEntityLevelPreview:o,height:_,width:S,isReadOnly:R,showPreviewChart:O,thresholdObj:P,onThresholdUpdate:D,isDefaultEntityThresholdView:N,isEntityLevelThreshold:V,entityObj:j}=s,K=(0,Je.getSortedThresholdPolicies)(P.timeVariateThresholdsSpecification.policies)[0],[W,U]=(0,pe.useState)(P.isTimeVariateThresholds?K._key:null),[Y,$]=(0,pe.useState)(0),[X,Z]=(0,pe.useState)(!1),[Q,ee]=(0,pe.useState)(!1),[te,ie]=(0,pe.useState)(!1),[ae,ne]=(0,pe.useState)(!1),[re,se]=(0,pe.useState)(P),[le,oe]=(0,pe.useState)(j),de=(0,pe.useMemo)(()=>{if(!re.isTimeVariateThresholds)return S-321;var s=(0,Se.default)(re.timeVariateThresholdsSpecification.policies,{_key:W});return!s||re.isAdaptiveThresholdsEnabled&&"static"!==s.policy_type?S-663:S-572},[re.isAdaptiveThresholdsEnabled,re.isTimeVariateThresholds,re.timeVariateThresholdsSpecification.policies,W,S]),ce=(0,pe.useCallback)(s=>{se(o=>(0,fe.default)(o,s)),D(s)},[D]),he=(0,pe.useCallback)(s=>{var _=(0,ge.default)(s);if(re.isTimeVariateThresholds){var{policies:S}=re.timeVariateThresholdsSpecification,R=(0,Ce.default)(S,s=>{if(s._key!==W)return s;var S=(0,ge.default)(s),R=o?"entity_thresholds":"aggregate_thresholds";return S[R]=_,_.thresholdLevels&&(S[R]=(0,Je.updateThresholdBoundaries)(S[R])),S});ce({timeVariateThresholdsSpecification:{policies:R}})}else{_.thresholdLevels&&(_=(0,Je.updateThresholdBoundaries)(_)),ce({[o?"entityThresholdsConfig":"aggregateThresholdsConfig"]:_})}},[re.isTimeVariateThresholds,re.timeVariateThresholdsSpecification,ce,W,o]),ue=(0,pe.useCallback)(s=>{var o,{policies:_}=re.timeVariateThresholdsSpecification;o=!!(0,Se.default)(_,{_key:s._key})?(0,Ce.default)(_,o=>o._key!==s._key?o:s):(0,me.default)(_,s);var S={timeVariateThresholdsSpecification:{policies:(0,Je.getSortedThresholdPolicies)(o)}};ce(S),U(s._key),$(Y+1)},[re,ce,Y]),Re=(0,pe.useCallback)(()=>{if(W){var s=(0,_e.default)(re.timeVariateThresholdsSpecification.policies,s=>s._key!==W);ce({timeVariateThresholdsSpecification:{policies:s}})}U(null)},[W,re.timeVariateThresholdsSpecification.policies,ce]),Ie=(0,pe.useCallback)(()=>{Z(!1)},[]),Me=(0,pe.useCallback)(()=>{ee(!1)},[]),Oe=(0,pe.useCallback)(()=>{ne(!1),ie(!0)},[]),Ae=(0,pe.useCallback)(()=>{ie(!1),ne(!1)},[]),De=(0,pe.useCallback)((s,o,_,S)=>{var R=S?s.aggregate_thresholds:s.entity_thresholds,O=function copyBaseSeverityAndThresholdValues(s,o){var _=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],S=(0,Je.getThresholdBaseSeveritySettings)(s,!1),R=(0,Ce.default)(o,"_key"),O=(0,Ce.default)(re.timeVariateThresholdsSpecification.policies,o=>{if(!(0,be.default)(R,o._key))return o;var O=_?"aggregate_thresholds":"entity_thresholds",P=(0,fe.default)(_objectSpread({},o[O]),S,{thresholdLevels:s.thresholdLevels});return(0,fe.default)(_objectSpread({},o),{[O]:P})});ce({timeVariateThresholdsSpecification:{policies:O}})};o.length&&O(R,o),_.length&&O(R,_,!1)},[re.timeVariateThresholdsSpecification.policies,ce]),handleTimePolicyChange=(s,o)=>{var{value:_}=o;U(_)},onChangePolicyType=(s,o)=>{var{value:_}=o,{policies:S}=re.timeVariateThresholdsSpecification,R=(0,Ce.default)(S,s=>{if(s._key!==W)return s;var o=_objectSpread({},s);return o.policy_type=_,o});ce({timeVariateThresholdsSpecification:{policies:R}})},getThresholdConfiguration=()=>{var s=o?re.entityThresholdsConfig:re.aggregateThresholdsConfig;if(re.isTimeVariateThresholds){var _=(0,Se.default)(re.timeVariateThresholdsSpecification.policies,{_key:W});_&&(s=o?_.entity_thresholds:_.aggregate_thresholds)}return s},addNewThreshold=()=>{var s=getThresholdConfiguration(),o=s.thresholdLevels.length?(0,Te.default)(s.thresholdLevels).severityValue:s.baseSeverityValue,_=6===o?1:o+1,S=(0,Se.default)($e.DEFAULT_SEVERITY_LEVELS,["severityValue",_]);S.id=(0,qe.generateUUID)();var R=(0,Je.addThreshold)(S,s);he(R)},onChangeSeverity=(s,o)=>{var{name:_,value:S}=o,R=getThresholdConfiguration(),O=(0,Se.default)($e.DEFAULT_SEVERITY_LEVELS,["severityLabel",S]);if("base"===_){var P={baseSeverityLabel:O.severityLabel,baseSeverityValue:O.severityValue,baseSeverityColor:O.severityColor,baseSeverityColorLight:O.severityColorLight},D=(0,ke.default)(_objectSpread({},R),P);he(D)}else{var N=(0,Ce.default)(R.thresholdLevels,s=>s.id!==_?s:(0,ke.default)(_objectSpread({},s),O)),V=(0,ke.default)(_objectSpread({},R),{thresholdLevels:N});he(V)}},Ne=(0,ve.default)((s,_)=>{var{name:S,value:R}=_,O=getThresholdConfiguration(),P=re.isTimeVariateThresholds?(0,Se.default)(re.timeVariateThresholdsSpecification.policies,{_key:W}):{},D=(V||!o)&&re.isTimeVariateThresholds&&re.isAdaptiveThresholdsEnabled&&P&&"static"!==P.policy_type?"dynamicParam":"thresholdValue",N=(0,Ce.default)(O.thresholdLevels,s=>s.id!==S?s:(0,ke.default)(_objectSpread({},s),{[D]:R})),j=(0,ke.default)(_objectSpread({},O),{thresholdLevels:N});he(j)},300);(0,pe.useEffect)(()=>{W&&le.entity_title===j.entity_title?!(0,Se.default)(P.timeVariateThresholdsSpecification.policies,{_key:W})&&U(null):(W!==K._key&&U(K._key),oe(j));se(P)},[P]);return pe.default.createElement(Xe,{height:_+64,width:S,"data-test-itsi":"thresholding-controls-container"},re.isTimeVariateThresholds&&(()=>{var s,{policies:o}=re.timeVariateThresholdsSpecification,_=(0,Se.default)(o,{_key:W});return pe.default.createElement(pe.default.Fragment,null,pe.default.createElement(Qe,null,pe.default.createElement(Le.default,{"data-test-itsi":"thresholding-time-policy-controls-heading",level:4},(0,Ke.gettext)("Time policy settings")),pe.default.createElement(bt,{"data-test-itsi":"thresholding-time-policy-select-control",label:(0,Ke.gettext)("Time policy"),labelPosition:"top",required:!0},pe.default.createElement(et,{"data-test-itsi":"thresholding-time-policy-select",value:W,onChange:handleTimePolicyChange},(0,Ce.default)((0,Je.getSortedThresholdPolicies)(o),s=>pe.default.createElement(je.default.Option,{label:s.title,value:s._key,key:s._key,truncate:!0})))),!R&&pe.default.createElement(tt,{"data-test-itsi":"threshold-time-policy-action-wrapper"},pe.default.createElement(Fe.default,{actionItems:[{handleClick:()=>{ne(!0),ie(!0)},isVisible:W!==Je.DEFAULT_POLICY_KEY,label:(0,Ke.gettext)("Edit"),action:"edit"},{handleClick:()=>Z(!0),isVisible:W!==Je.DEFAULT_POLICY_KEY,label:(0,Ke.gettext)("Delete"),action:"delete"},{handleClick:()=>ee(!0),label:(0,Ke.gettext)("Copy threshold values"),action:"copy"}],buttonLabel:"",buttonDataTestItsi:"threshold-time-policy-action-dropdown",dropdownMenuStyle:{minWidth:150},toggleType:"icon-button"})),_&&_.policy_type&&re.isAdaptiveThresholdsEnabled&&!N&&pe.default.createElement(bt,{"data-test-itsi":"thresholding-time-policy-policy-type-select-control",label:(0,Ke.gettext)("Algorithm"),labelPosition:"top",required:!0,tooltip:(0,Ke.gettext)("The algorithm used to calculate threshold values.")},(s=_.policy_type,R?pe.default.createElement(ot,{"data-test-itsi":"thresholding-time-policy-policy-type-select-read-only"},(0,Se.default)(Je.POLICY_TYPES,["value",s]).label):pe.default.createElement(ct,{value:s,onChange:onChangePolicyType,"data-test-itsi":"thresholding-time-policy-policy-type-select"},(0,Ce.default)(Je.POLICY_TYPES,s=>pe.default.createElement(je.default.Option,{key:s.value,label:s.label,value:s.value,description:s.explanation}))))),!R&&pe.default.createElement(st,{onClick:Oe,"data-test-itsi":"thresholding-time-policy-add-new-time-policy"},pe.default.createElement(it,null),(0,Ke.gettext)("Add time policy"))),!R&&(()=>{var s=re.isTimeVariateThresholds?(0,Se.default)(re.timeVariateThresholdsSpecification.policies,{_key:W}):{};return pe.default.createElement(pe.default.Fragment,null,!(0,Ee.default)(s)&&pe.default.createElement(pe.default.Fragment,null,pe.default.createElement(We.default,{modalDataTestItsi:"delete-time-policy-modal",cancelButtonDataTestItsi:"delete-time-policy-modal-cancel-button",primaryButtonDataTestItsi:"delete-time-policy-modal-delete-button",showCancel:!0,open:X,beforeClose:Ie,modalStyles:ze.CONFIRMATION_MODAL_STYLE,title:(0,Ke.gettext)("Delete policy"),primaryButtonLabel:(0,Ke.gettext)("Delete"),primaryButtonClicked:Re},pe.default.createElement("span",{"data-test-itsi":"delete-time-policy-message"},(0,Be.sprintf)((0,Ke.gettext)("Are you sure you want to delete %s?"),(0,ye.default)(null==s?void 0:s.title)))),pe.default.createElement(Ue.default,{activeThresholdConfigIsAggregate:!1,selectedPolicy:s,availablePolicies:re.timeVariateThresholdsSpecification.policies,isEntityBreakdown:!!re.is_entity_breakdown,handleCopy:De,beforeClose:Me,open:Q})),pe.default.createElement(Ge.default,{key:ae,open:te,handleRequestClose:Ae,existingPolicy:ae?s:(0,we.default)(),policies:re.timeVariateThresholdsSpecification.policies,onUpdatePolicy:ue}))})())})(),re&&(()=>{if(re.isTimeVariateThresholds&&!W)return pe.default.createElement(at,{type:"info"},(0,Ke.gettext)("Select/Create a policy."));var s,P,D,K,U,$,X,Z,Q,ee,te,ie=o?N?re.searchTimeSeriesEntities:re.entityBreakdownIdFields.includes(",")?"".concat(re.baseSearch," | `aggregate_raw_compound_entity_into_limited_entity_time_series(")+"".concat(j.entity_title,", ").concat(re.entityStatop,", ").concat(re.thresholdField,", ").concat(re.entityBreakdownIdFields,", ").concat(re.searchAlertEarliest,")`"):"".concat(re.baseSearch," | `aggregate_raw_into_limited_entity_time_series(")+"".concat(j.entity_title,", ").concat(re.entityStatop,", ").concat(re.thresholdField,", ").concat(re.entityBreakdownIdFields,", ").concat(re.searchAlertEarliest,")`"):re.searchTimeSeriesAggregate;return pe.default.createElement(Ze,{height:_,width:S},(K=getThresholdConfiguration(),U=re.isTimeVariateThresholds?(0,Se.default)(re.timeVariateThresholdsSpecification.policies,{_key:W}):{},$=(V||!o)&&re.isTimeVariateThresholds&&re.isAdaptiveThresholdsEnabled&&U&&"static"!==U.policy_type?"dynamicParam":"thresholdValue",X=s=>pe.default.createElement(St,{color:s,variant:"filled"}),Z=pe.default.createElement(Et,null),Q="dynamicParam"===$?(0,Je.getAdornmentUnitStr)(U&&U.policy_type):"",ee=(s,o)=>R?Je.THRESHOLDS.filter(s=>s.value===o).map(o=>pe.default.createElement(ot,{key:s,"data-test-itsi":"thresholding-base-severity-read-only"},X(o.boxFilledColor)," ",o.label)):pe.default.createElement(dt,{key:s,name:s,value:o,onChange:onChangeSeverity,"data-test-itsi":"thresholding-base-severity-label-select"},(0,Ce.default)(Je.THRESHOLDS,s=>pe.default.createElement(je.default.Option,{"data-test-itsi":"thresholding-slider-select-option",key:s.value,label:s.label,value:s.value,icon:X(s.boxFilledColor)}))),te=(s,o)=>{var{value:_}=o,S=(0,ge.default)(getThresholdConfiguration()),R=(0,_e.default)([...S.thresholdLevels],s=>s.id!==_);S.thresholdLevels=R,he(S)},pe.default.createElement(nt,{width:"dynamicParam"===$?"373px":"280px"},pe.default.createElement(Le.default,{level:4},(0,Ke.gettext)("Threshold levels")),pe.default.createElement(lt,null,(null===(s=K.thresholdLevels)||void 0===s?void 0:s.length)>0&&pe.default.createElement(ut,null,pe.default.createElement(pt,null,(0,Ke.gettext)("Severity")),"dynamicParam"===$&&pe.default.createElement(pt,null,(0,Ke.gettext)("Actual value"))),pe.default.createElement(ht,{"data-test-itsi":"thresholdsetting-label-controls"},null===(P=K.thresholdLevels)||void 0===P?void 0:P.map(s=>pe.default.createElement(ft,{"data-test-itsi":"thresholding-slider-value-label",key:"control".concat(s.id)},ee(s.id,s.severityLabel),R?pe.default.createElement(pe.default.Fragment,null,pe.default.createElement(ot,{key:"level".concat(s.id)},s[$].toString()),"dynamicParam"===$&&pe.default.createElement(vt,{"data-test-itsi":"thresholding-actual-value"},(0,xe.default)(s.thresholdValue,2))):pe.default.createElement(pe.default.Fragment,null,pe.default.createElement(gt,{"data-test-itsi":"thresholding-level-input",key:"input".concat(s.id),name:s.id,value:s[$],onChange:Ne,hideStepButtons:!0,unitStr:Q}),"dynamicParam"===$&&pe.default.createElement(mt,{"data-test-itsi":"thresholding-level-actual-value"},(0,xe.default)(s.thresholdValue,2)),pe.default.createElement(Pe.default,{key:"delete".concat(s.id),icon:Z,appearance:"pill",onClick:te,value:s.id,"data-test-itsi":"remove-threshold-button"}))))),!R&&(null===(D=K.thresholdLevels)||void 0===D?void 0:D.length)<9&&pe.default.createElement(rt,{onClick:addNewThreshold,"data-test-itsi":"thresholding-add-threshold-button"},pe.default.createElement(it,null),(0,Ke.gettext)("Add threshold")),pe.default.createElement(yt,{isReadOnly:R},pe.default.createElement(_t,{"data-test-itsi":"thresholding-base-severity-section"},(0,Ke.gettext)("Base severity"),ee("base",K.baseSeverityLabel)))))),O&&pe.default.createElement(Ye.default,{key:"".concat(W,"-").concat(Y),isTimePoliciesEnabled:re.isTimeVariateThresholds,isReadOnly:R,height:_,width:de,thresholdConfiguration:getThresholdConfiguration(),kpiSearch:ie,onUpdateThresholdConfig:he,policyKey:W,policies:re.timeVariateThresholdsSpecification.policies}))})())}ThresholdConfigurationView.propTypes={thresholdObj:Ie.default.shape({timeVariateThresholdsSpecification:Ie.default.object,is_entity_breakdown:Ie.default.bool,thresholdType:Ie.default.string,isTimeVariateThresholds:Ie.default.bool,isAdaptiveThresholdsEnabled:Ie.default.bool,search_time_series_aggregate:Ie.default.string,search_time_series_entities:Ie.default.string}).isRequired,isEntityLevelPreview:Ie.default.bool.isRequired,entityObj:Ie.default.object,onThresholdUpdate:Ie.default.func.isRequired,height:Ie.default.number,width:Ie.default.number,isReadOnly:Ie.default.bool,isDefaultEntityThresholdView:Ie.default.bool,isEntityLevelThreshold:Ie.default.bool,showPreviewChart:Ie.default.bool},ThresholdConfigurationView.defaultProps={entityObj:{},height:400,width:1120,isReadOnly:!1,isDefaultEntityThresholdView:!1,isEntityLevelThreshold:!0,showPreviewChart:!0};o.default=ThresholdConfigurationView;s.exports=o.default},2646:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K=S(_(7)),W=S(_(33)),U=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),Y=S(_(3)),$=S(_(2)),X=S(_(37)),Z=S(_(27)),Q=S(_(427)),ee=S(_(64)),te=S(_(34)),ie=S(_(24)),ae=S(_(113)),ne=_(4),re=_(14),se=_(265),le=_(264),oe=_(108),de=_(627),ce=S(_(1459)),he=S(_(1460)),ue=_(57),pe=_(306);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var fe=[{label:(0,ne.gettext)("Data aggregation period"),value:"aggregation_span",description:(0,ne.gettext)("Time frame over which data is collected"),labelDataTestItsi:"kpi-drift-aggregation-span-label",valueDataTestItsi:"kpi-drift-aggregation-span-value",descriptionDataTestItsi:"kpi-drift-aggregation-span-description",staticContentDataTestItsi:"kpi-drift-aggregation-span-static-content"},{label:(0,ne.gettext)("Data aggregation function"),value:"aggregation_function",description:(0,ne.gettext)("Statistical method used to summarize KPI data"),labelDataTestItsi:"kpi-drift-aggregation-function-label",valueDataTestItsi:"kpi-drift-aggregation-function-value",descriptionDataTestItsi:"kpi-drift-aggregation-function-description",staticContentDataTestItsi:"kpi-drift-aggregation-function-static-content"},{label:(0,ne.gettext)("Look back period"),value:"lookback_period",description:(0,ne.gettext)("Time frame over which data is analyzed to evaluate trends and patterns"),labelDataTestItsi:"kpi-drift-lookback-label",valueDataTestItsi:"kpi-drift-lookback-value",descriptionDataTestItsi:"kpi-drift-lookback-description",staticContentDataTestItsi:"kpi-drift-lookback-static-content"},{label:(0,ne.gettext)("Drift tolerance"),value:"threshold_direction",description:(0,ne.gettext)("Percentage that a KPI can deviate from the baseline and be considered normal"),labelDataTestItsi:"kpi-drift-threshold-setting-label",valueDataTestItsi:"kpi-drift-threshold-setting-value",descriptionDataTestItsi:"kpi-drift-threshold-setting-description",staticContentDataTestItsi:"kpi-drift-threshold-setting-static-content"}],ge=$.default.div(R||(R=(0,K.default)(["\n margin-bottom: 25px;\n"]))),me=(0,$.default)(Z.default)(O||(O=(0,K.default)(["\n float: right;\n"]))),ve=(0,$.default)(te.default)(P||(P=(0,K.default)(["\n margin-left: 5px;\n"]))),ye=(0,$.default)(ae.default)(D||(D=(0,K.default)(["\n max-width: 100%;\n overflow-wrap: anywhere;\n"]))),_e=$.default.div(N||(N=(0,K.default)(["\n display: flex;\n"]))),Se=$.default.div(V||(V=(0,K.default)(["\n margin-top: 20px;\n"]))),be=(0,$.default)(ee.default)(j||(j=(0,K.default)(["\n margin-top: 0px;\n padding-bottom: 10px;\n"])));function KpiDriftTab(s){var{appsData:o,isReadOnly:_,linkedServices:S}=s,{selectedKpiModel:R}=(0,U.useContext)(pe.ThresholdingContext),[O,P]=(0,U.useState)(!1),[D,N]=(0,U.useState)([]),V=!1,j=!0;(0,X.default)(se.PYTHON_SCIENTIFIC_APP_NAMES,s=>{o&&o[s]&&o[s].isInstalled&&(V=!0,o[s].isDisabled||(j=!1))}),(0,U.useEffect)(()=>{if(S&&S.length>0){var s=[];S.forEach(o=>{var _=o.kpis.find(s=>s.title===R.get("title"));s.push({label:o.title,value:o._key,kpi:_})}),N(s)}},[S]);var handleSaveDriftSettings=s=>{(0,W.default)(s)?(R.set("has_drift_detection_enabled",!1),R.set("drift_detection_configuration",s)):(R.set("has_drift_detection_enabled",!0),R.set("drift_detection_configuration",s)),P(!1)},handleOpenDriftModal=()=>{P(!0)},handleCloseDriftModal=()=>{P(!1)},getDriftSettingsModal=s=>{var o,_=s?R.get("drift_detection_configuration",{}):{};return U.default.createElement(he.default,{driftConfiguration:_,isModalOpen:O,handleCloseModal:handleCloseDriftModal,onSaveKpiChanges:handleSaveDriftSettings,kpiId:D.length>0?null===(o=D[0].kpi)||void 0===o?void 0:o._key:R.get("_key"),kpiTitle:R.get("title"),linkedServices:D,alertPeriod:parseInt(R.get("alert_period"),10)})},K=R.get("drift_detection_configuration"),Y=!V||j,$=V?"warning":"error",ee=V?ue.DRIFT_PSC_DISABLED_MESSAGE:ue.DRIFT_PSC_NOT_INSTALLED_MESSAGE;return U.default.createElement(U.default.Fragment,null,Y&&U.default.createElement(ie.default,{type:$,"data-test-itsi":"drift-detection-install-psc-".concat($,"-message")},U.default.createElement("div",null,ee," ",!V&&U.default.createElement(U.default.Fragment,null,(0,ne.gettext)("Download the app for "),U.default.createElement(ve,{"data-test-itsi":"drift-detection-psc-app-install-link-linux",to:(0,le.getSplunkBaseURL)(se.SPLUNKBASE_APPS.Python_Scientific_Linux.id),openInNewContext:!0},(0,ne.gettext)("Linux 64-bit")),(0,ne.gettext)(", "),U.default.createElement(ve,{"data-test-itsi":"drift-detection-psc-app-install-link-windows",to:(0,le.getSplunkBaseURL)(se.SPLUNKBASE_APPS.Python_Scientific_Windows.id),openInNewContext:!0},(0,ne.gettext)("Windows 64-bit")),(0,ne.gettext)(", "),U.default.createElement(ve,{"data-test-itsi":"drift-detection-psc-app-install-link-mac-intel",to:(0,le.getSplunkBaseURL)(se.SPLUNKBASE_APPS.Python_Scientific_Mac_Intel.id),openInNewContext:!0},(0,ne.gettext)("Mac Intel")),(0,ne.gettext)(", or "),U.default.createElement(ve,{"data-test-itsi":"drift-detection-psc-app-install-link-mac-arm",to:(0,le.getSplunkBaseURL)(se.SPLUNKBASE_APPS.Python_Scientific_Mac_Apple_Silicon.id),openInNewContext:!0},(0,ne.gettext)("Mac Apple Silicon"))),V&&j&&U.default.createElement(ve,{"data-test-itsi":"drift-detection-psc-app-enable-link",to:(0,le.manageAppsURL)({search:se.PYTHON_SCIENTIFIC_APP_NAME_PREFIX}),openInNewContext:!0},(0,ne.gettext)("Enable the app here")))),!Y&&(R.get("has_drift_detection_enabled")&&K&&!(0,W.default)(K)?(s=>U.default.createElement(U.default.Fragment,null,U.default.createElement(be,{"data-test-itsi":"drift-tab-container-kpi-title",level:2},(0,ne.gettext)("Drift detection")),U.default.createElement(ge,{"data-test-itsi":"drift-panel-description"},(0,ne.gettext)("Drift detection monitors your KPI time series data for unusual behavior to prevent inaccurate configurations and alert for potential issues."),U.default.createElement(ve,{"data-test-itsi":"drift-detection-learn-more-link",to:(0,oe.makeDocsURL)(oe.DOCS_PAGES.ITSI_DRIFT_DETECTION),openInNewContext:!0},(0,ne.gettext)("Drift Documentation"))),!_&&U.default.createElement(me,{"data-test-itsi":"drift-panel-edit-configuration-button",onClick:handleOpenDriftModal},(0,ne.gettext)("Edit")),U.default.createElement(Q.default,{"data-test-itsi":"drift-panel-configuration-details-container"},fe.map(o=>U.default.createElement(Q.default.Row,{key:o.value},U.default.createElement(Q.default.Column,{"data-test-itsi":o.labelDataTestItsi,span:3},o.label),U.default.createElement(Q.default.Column,{"data-test-itsi":o.valueDataTestItsi,span:3},U.default.createElement(ye,{"data-test-itsi":o.staticContentDataTestItsi},((s,o)=>{var _,S,O;switch(o){case"aggregation_span":return(null===(_=de.DRIFT_DETECTION_TIME_PERIOD_VALUES.find(o=>o.value===s))||void 0===_?void 0:_.label)||"";case"aggregation_function":return(null===(S=de.DRIFT_DETECTION_FUNCTIONS.find(o=>o.value===s))||void 0===S?void 0:S.longLabel)||"";case"lookback_period":return(null===(O=de.DRIFT_DETECTION_LOOKBACK_PERIOD_OPTIONS.find(o=>o.value===s))||void 0===O?void 0:O.label)||"";case"threshold_direction":var P,D=R.get("drift_detection_configuration"),N=(null===(P=de.DRIFT_DETECTION_TOLERANCE_DIRECTION_OPTIONS.find(o=>o.value===s))||void 0===P?void 0:P.label)||"";return(0,re.sprintf)("%(toleranceDirection)s %(tolerancePercent)d%%",{toleranceDirection:N,tolerancePercent:D.tolerance_in_percent});default:return""}})(s[o.value],o.value))),U.default.createElement(Q.default.Column,{"data-test-itsi":o.descriptionDataTestItsi,span:6},o.description)))),getDriftSettingsModal(!0)))(K):U.default.createElement(_e,{"data-test-itsi":"drift-tab-no-configuration-container"},U.default.createElement(ce.default,null),U.default.createElement(Se,{"data-test-itsi":"drift-panel-no-configuration-text-container"},U.default.createElement("div",{"data-test-itsi":"drift-panel-description"},(0,ne.gettext)("Drift detection monitors your KPI time series data for unusual behavior to prevent inaccurate configurations and alert for potential issues."),U.default.createElement(ve,{"data-test-itsi":"drift-detection-learn-more-link",to:(0,oe.makeDocsURL)(oe.DOCS_PAGES.ITSI_DRIFT_DETECTION),openInNewContext:!0},(0,ne.gettext)("Drift Documentation"))),U.default.createElement("div",null,U.default.createElement(ie.default,{"data-test-itsi":"drift-panel-no-configuration-message",type:"info"},(0,re.sprintf)((0,ne.gettext)("Drift detection has not been set up for %(kpiTitle)s"),{kpiTitle:R.get("title")}))),!_&&U.default.createElement(Z.default,{"data-test-itsi":"drift-panel-edit-configuration-button",onClick:handleOpenDriftModal},(0,ne.gettext)("Configure drift detection"))),getDriftSettingsModal(!1))))}KpiDriftTab.propTypes={appsData:Y.default.object.isRequired,isReadOnly:Y.default.bool.isRequired,linkedServices:Y.default.array},KpiDriftTab.defaultProps={linkedServices:[]};o.default=KpiDriftTab;s.exports=o.default},2647:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K=S(_(7)),W=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),U=S(_(3)),Y=S(_(2)),$=_(48),X=_(46),Z=S(_(150)),Q=S(_(69)),ee=S(_(39)),te=S(_(38)),ie=S(_(1197)),ae=S(_(27)),ne=S(_(44)),re=S(_(64)),se=S(_(24)),le=S(_(113)),oe=_(4),de=_(14),ce=_(554),he=_(61),ue=_(136),pe=_(804),fe=_(175),ge=_(57),me=_(145),ve=_(306),ye=_(1585),_e=_(1140),Se=S(_(557)),be=S(_(1057)),Ee=S(_(1225)),Te=S(_(598));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var Ce=(0,Y.default)(ne.default)(R||(R=(0,K.default)(["\n margin-bottom: 0;\n"]))),ke=(0,Y.default)(le.default)(O||(O=(0,K.default)(["\n max-width: 100%;\n overflow-wrap: anywhere;\n"]))),xe=Y.default.div(P||(P=(0,K.default)(["\n display: flex;\n align-items: stretch;\n padding: 10px 20px 10px 20px;\n flex-direction: row;\n justify-content: flex-start;\n"]))),we=Y.default.div(D||(D=(0,K.default)(["\n width: 250px;\n"]))),Re=Y.default.div(N||(N=(0,K.default)(["\n flex: 2 2;\n"]))),Ie=(0,Y.default)(re.default)(V||(V=(0,K.default)(["\n margin-top: 0px;\n"]))),Me=(0,Y.default)(se.default)(j||(j=(0,K.default)(["\n margin-left: ","px;\n"])),he.LABEL_WIDTHS.Massive+20),getInnerContentHTML=s=>({__html:s});function KpiSearchTab(s){var o,_,{baseSearchApiErrorMessage:S,baseSearchApiStatus:R,baseSearchData:O,baseSearchSelectItems:P,featureFlags:D,handleUpdateKpiModelCallback:N,isReadOnly:V,kpiBaseSearchRetrieveAction:j,savedBaseSearchCollection:K,sdDispatcher:U,serviceKpiBackfillMapping:Y,serviceModel:$,serviceTemplate:X,validateModelEntriesCallback:ee}=s,{selectedKpiModel:ne}=(0,W.useContext)(ve.ThresholdingContext),[re,le]=(0,W.useState)(!1),[ye,Oe]=(0,W.useState)(!1),[Ae,Pe]=(0,W.useState)(1),[De,Le]=(0,W.useState)({progress:null==ne||null===(o=ne._cachedBackfillProgressStatus)||void 0===o?void 0:o.progress,status:null==ne||null===(_=ne._cachedBackfillProgressStatus)||void 0===_?void 0:_.status}),[Ne,Ve]=(0,W.useState)(!0),[je,He]=(0,W.useState)(!0),Be=(0,W.useRef)(null),Ke=(0,W.useCallback)(s=>{N(ne,s)},[ne,N]),Fe=function getEditSearchModal(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ae;if(!Be.current)return"";var o=new be.default({featureFlags:D,kpiModel:ne,serviceModel:$,initialStep:s,serviceKpiBackfillMapping:Y,handleUpdateKpiModel:Ke}),_=o.render();return Be.current.innerHTML="",Be.current.appendChild(_.el),_},onClickEdit=s=>{$.get("object_type")===ge.OBJECT_TYPE?X&&ne.get("base_service_template_id")?(le(!0),Pe(s)):(Pe(s),Fe(s)):Oe(!0)},handleCloseEditModal=()=>{Oe(!1)},editAndSaveKpi=s=>{var o=(0,te.default)(ne.parse(s.toJSON()),["aggregate_thresholds","entity_thresholds","time_letiate_thresholds_specification","skip_kpi_validation"]);ne.set(o),ne.trigger("change:time_letiate_thresholds"),Oe(!1)},We=function getControlGroup(s,o,_,S){var R=arguments.length>4&&void 0!==arguments[4]&&arguments[4],O=S;return R&&(O=W.default.createElement("div",{dangerouslySetInnerHTML:getInnerContentHTML(S)})),W.default.createElement(Ce,{"data-test-itsi":s,label:_,labelWidth:he.LABEL_WIDTHS.Massive},W.default.createElement(ke,{"data-test-itsi":o},O))};(0,W.useEffect)(()=>{var s={shouldUpdate:!0};return(s=>{ne._cachedBackfillProgressStatus&&void 0!==ne._cachedBackfillProgressStatus.progress&&void 0!==ne._cachedBackfillProgressStatus.status?Ve(!1):Se.default.getBackfillDataForKpi(ne.get("_key")).done((o,_)=>{s.shouldUpdate&&(Le({progress:o,status:_}),Ve(!1))})})(s),ne.get("base_search_id")&&j(ne.get("base_search_id")),()=>{s.shouldUpdate=!1}},[]);(0,W.useEffect)(()=>{$.get("object_type")!==fe.OBJECT_TYPE&&(V||De.progress||!Y||Y[ne.get("_key")]?He(!1):He(!0))},[De,Y]);var Ue,Ge,Ye;return W.default.createElement("div",{"data-test-itsi":"kpi-configuration-search-tab-container"},W.default.createElement(Ie,{"data-test-itsi":"kpi-configuration-search-tab-container-title",level:2},(0,oe.gettext)("Search and Calculate")),W.default.createElement(xe,{"data-test-itsi":"source-three-column-view"},!V&&W.default.createElement(we,null,(0,oe.gettext)("Source")),W.default.createElement(Re,{"data-test-itsi":"summary-view"},V&&We("kpi-source-control-group","kpi-source-value",(0,oe.gettext)("KPI Source"),(null==(Ye=(0,Q.default)(ge.KPI_SOURCE_TYPES,s=>s.value===ne.get("search_type")))?void 0:Ye.label)||""),(()=>{var s=ne.get("search_type"),o=ne.get("metric");switch(s){case"datamodel":var _=ne.get("datamodel");return _.validate()?(0,oe.gettext)("Not configured"):W.default.createElement(W.default.Fragment,null,We("kpi-source-data-model-field","kpi-source-data-model-value",(0,oe.gettext)("Data model"),_.get("datamodel"),!1),We("kpi-source-data-model-object-field","kpi-source-data-model-object-value",(0,oe.gettext)("Data model object"),_.get("object"),!1),We("kpi-source-data-model-field-field","kpi-source-data-model-field-value",(0,oe.gettext)("Data model field"),_.get("field"),!1));case"metric":return W.default.createElement(W.default.Fragment,null,We("kpi-source-metric-search-field","kpi-source-metric-search-value",(0,oe.gettext)("Search"),(0,oe.gettext)("Metrics search"),!1),We("kpi-source-metrics-index-field","kpi-source-metrics-index-value",(0,oe.gettext)("Metrics index"),(0,Z.default)(o.metric_index),!1),We("kpi-source-metric-name-field","kpi-source-metric-name-value",(0,oe.gettext)("Metric name"),(0,Z.default)(o.metric_name),!1));case"adhoc":return W.default.createElement(W.default.Fragment,null,We("kpi-source-adhoc-search-field","kpi-source-adhoc-search-value",(0,oe.gettext)("Search"),(0,Z.default)(ne.get("base_search")),!0),We("kpi-source-threshold-field-field","kpi-source-threshold-field-value",(0,oe.gettext)("Threshold field"),(0,Z.default)(ne.get("threshold_field"))));default:if(ne.get("base_search_id")){if(R===_e.KPI_BASE_SEARCHES_ONE_RETRIEVE_STATUS.IN_PROGRESS)return W.default.createElement(Me,{"data-test-itsi":"kpi-source-base-search-field-info-message",type:"info"},(0,oe.gettext)("Loading KPI base search information..."));if(R===_e.KPI_BASE_SEARCHES_ONE_RETRIEVE_STATUS.ERROR)return W.default.createElement(se.default,{"data-test-itsi":"kpi-source-base-search-field-fetch-error",type:"error"},(0,de.sprintf)((0,oe.gettext)("Could not retrieve the KPI base search information. Details: %(error)s"),{error:S}));if(R===_e.KPI_BASE_SEARCHES_ONE_RETRIEVE_STATUS.SUCCESS){var P=(0,Q.default)(O.metrics,s=>s._key===ne.get("base_search_metric"));return W.default.createElement(W.default.Fragment,null,We("kpi-source-base-search-field","kpi-source-base-search-value",(0,oe.gettext)("Base search"),(0,Z.default)(O.title)),O.is_metric?W.default.createElement(W.default.Fragment,null,We("kpi-source-base-search-metrics-index-field","kpi-source-base-search-metrics-index-value",(0,oe.gettext)("Base search metrics index"),(0,Z.default)(o.metric_index)),We("kpi-source-base-search-metric-name-field","kpi-source-base-search-metric-name-value",(0,oe.gettext)("Base search metric name"),(0,Z.default)(o.metric_name)),(null==P?void 0:P.title)&&We("kpi-source-base-search-metric-title-field","kpi-source-base-search-metric-title-value",(0,oe.gettext)("Metric"),(0,Z.default)(P.title))):W.default.createElement(W.default.Fragment,null,We("kpi-source-base-search-search-field","kpi-source-base-search-search-value",(0,oe.gettext)("Search"),(0,Z.default)(ne.get("base_search")),!0),We("kpi-source-base-search-threshold-field-field","kpi-source-base-search-threshold-field-value",(0,oe.gettext)("Threshold field"),(0,Z.default)(ne.get("threshold_field")))))}}return""}})()),!V&&W.default.createElement("div",null,W.default.createElement(ae.default,{"data-test-itsi":"kpi-search-tab-edit-button",onClick:()=>onClickEdit(1)},(0,oe.gettext)("Edit")))),W.default.createElement(xe,{"data-test-itsi":"entities-three-column-view"},!V&&W.default.createElement(we,null,(0,oe.gettext)("Entities")),W.default.createElement(Re,{"data-test-itsi":"summary-view"},ne.get("is_entity_breakdown")||ne.get("is_service_entity_filter")?W.default.createElement(W.default.Fragment,null,ne.get("is_entity_breakdown")&&We("entity-split-by-field-field","entity-split-by-field-value",(0,oe.gettext)("Entity Split Field(s)"),ne.get("entity_breakdown_id_fields")),ne.get("is_service_entity_filter")&&$.getNumEntityRules()>0&&W.default.createElement(W.default.Fragment,null,We("entity-id-fields-field","entity-id-fields-value",(0,oe.gettext)("Data filtered by service entities in field"),ne.get("entity_id_fields")),We("services-matches-entities-field","services-matches-entities-value",(0,oe.gettext)("Service matches entities on fields"),(()=>{for(var s=$.get("entity_rules"),o=[],_=0;_<s.length;_+=1)for(var S=s.at(_).get("rule_items").pluck("field"),R=0;R<S.length;R+=1)o.push((0,Z.default)(S[R]));return(o=(0,ie.default)(o)).join(", ")})()))):We("not-filtering-entities-field","not-filtering-entities-value",(0,oe.gettext)("Entities"),(0,oe.gettext)("This KPI is not filtered by or monitoring any entities."))),!V&&W.default.createElement("div",null,W.default.createElement(ae.default,{"data-test-itsi":"kpi-search-tab-edit-button",onClick:()=>onClickEdit(2)},(0,oe.gettext)("Edit")))),W.default.createElement(xe,{"data-test-itsi":"calculation-three-column-view"},!V&&W.default.createElement(we,null,(0,oe.gettext)("Calculation")),W.default.createElement(Re,{"data-test-itsi":"summary-view"},(()=>{var s,o,_=(0,pe.getAggregationOperations)("all"),S=ne.get("aggregate_statop");0===S.indexOf("perc")&&(o=S.substr(4),s={value:S,label:(0,de.sprintf)((0,oe.gettext)("Percentile (%s)"),o)});var R,O=ne.get("entity_statop");if(0===O.indexOf("perc")&&(o=O.substr(4),R={value:O,label:(0,de.sprintf)((0,oe.gettext)("Percentile (%s)"),o)}),!s||!R)for(var P=0;P<_.length&&(S===_[P].value&&(s=_[P]),O===_[P].value&&(R=_[P]),!s||!R);P+=1);if(!s)return(0,oe.gettext)("Not configured");var D,N=s.label,V=R.label,j=ne.get("alert_period"),K=ne.get("search_alert_earliest"),W=(0,Z.default)(ne.get("threshold_field")),U=ne.get("fill_gaps");return D=ne.get("is_entity_breakdown")?(0,de.sprintf)((0,oe.gettext)('Calculating <span class="field-title">%s</span> of %s per entity as entity value, <span class="field-title">%s</span> of entity value as aggregate over the last <span class="field-title">%s minute(s)</span> every <span class="field-title">%s minute(s)</span>.'),V,W,N,K,j):(0,de.sprintf)((0,oe.gettext)('Calculating <span class="field-title">%s</span> of %s as aggregate over the last <span class="field-title">%s minute(s)</span> every <span class="field-title">%s minute(s)</span>.'),N,W,K,j),D+="null_value"===U?" "+(0,de.sprintf)((0,oe.gettext)("Fill gaps in data with Null values and use a %s threshold level for them"),(0,ue.getSeverityLabel)(ne.get("gap_severity")).toLowerCase()):"custom_value"===U?" "+(0,de.sprintf)((0,oe.gettext)("Fill gaps in data with custom value of %s"),ne.get("gap_custom_alert_value")):" "+(0,oe.gettext)("Fill gaps in data with the last available value of data"),D+=".",We("calculation-field","calculation-value",(0,oe.gettext)("Calculation"),D,!0)})()),!V&&W.default.createElement("div",null,W.default.createElement(ae.default,{"data-test-itsi":"kpi-search-tab-edit-button",onClick:()=>onClickEdit(3)},(0,oe.gettext)("Edit")))),W.default.createElement(xe,{"data-test-itsi":"unit-three-column-view"},!V&&W.default.createElement(we,null,(0,oe.gettext)("Unit and Monitoring Lag")),W.default.createElement(Re,{"data-test-itsi":"summary-view"},(Ge=ne.get("unit")||(0,oe.gettext)("None"),W.default.createElement(W.default.Fragment,null,We("unit-monitoring-lag-unit-field","unit-monitoring-lag-unit-value",(0,oe.gettext)("Unit"),Ge),We("unit-monitoring-lag-lag-field","unit-monitoring-lag-lag-value",(0,oe.gettext)("Monitoring Lag"),ne.get("alert_lag"))))),!V&&W.default.createElement("div",null,W.default.createElement(ae.default,{"data-test-itsi":"kpi-search-tab-edit-button",onClick:()=>onClickEdit(4)},(0,oe.gettext)("Edit")))),$.get("object_type")!==fe.OBJECT_TYPE&&W.default.createElement(xe,{"data-test-itsi":"backfill-three-column-view"},!V&&W.default.createElement(we,null,(0,oe.gettext)("Backfill")),W.default.createElement(Re,{"data-test-itsi":"summary-view"},(()=>{if(!1===ne.get("backfill_enabled"))return We("backfill-field-not-configured-control-group","backfill-value-not-configured",(0,oe.gettext)("Backfill"),(0,oe.gettext)("Backfill has not been configured."));if(Ne)return We("backfill-field-waiting-control-group","backfill-value-waiting",(0,oe.gettext)("Backfill"),me.BACKFILL_STATUSES.WAITING);var s,o=ne.get("backfill_earliest_time");if(De.progress)s=Se.default.renderBackfillStatus(De.status,o);else{var _=(0,ce.createRangeLabel)(o,"now").toLowerCase();s=(0,de.sprintf)((0,oe.gettext)("Backfill has been configured for %(timeLabel)s of data."),{timeLabel:_})}return We("backfill-field-control-group","backfill-value",(0,oe.gettext)("Backfill"),s)})()),!V&&W.default.createElement("div",null,je&&W.default.createElement(ae.default,{"data-test-itsi":"kpi-search-tab-edit-button",onClick:()=>onClickEdit(5)},(0,oe.gettext)("Edit")))),re&&W.default.createElement(Te.default,{modalTitleSubstring:(0,oe.gettext)("Edit KPI Search"),serviceTitle:$.get("title"),serviceTemplateTitle:X.get("title"),serviceTemplateUrl:X.getEditUrl(),isModalOpen:!0,handleDeclineToUnlink:()=>{le(!1)},handleAcceptToUnlink:()=>{U.trigger("unsetBaseServiceTemplateId",$),U.trigger("unlink"),le(!1),Fe()}}),$.get("object_type")===fe.OBJECT_TYPE?(Ue={base_search_id:ne.get("base_search_id"),base_search_metric:ne.get("base_search_metric"),title:ne.get("title"),description:ne.get("description")},W.default.createElement(Ee.default,{savedBaseSearchCollection:K,baseSearchSelectItems:P,validateModelEntries:ee,handleUpdateKpiModel:N,isModalOpen:ye,isNew:!1,editAndSaveKpi:editAndSaveKpi,currentKpiSearchValuesObject:Ue,kpiModel:ne,handleCloseModal:handleCloseEditModal})):W.default.createElement("div",{"data-test-itsi":"kpi-search-edit-modal-container",ref:Be}))}KpiSearchTab.propTypes={baseSearchApiErrorMessage:U.default.string.isRequired,baseSearchApiStatus:U.default.string.isRequired,baseSearchData:U.default.object.isRequired,baseSearchSelectItems:U.default.array,featureFlags:U.default.object.isRequired,handleUpdateKpiModelCallback:U.default.func,isReadOnly:U.default.bool.isRequired,kpiBaseSearchRetrieveAction:U.default.func.isRequired,savedBaseSearchCollection:U.default.object,sdDispatcher:U.default.object,serviceKpiBackfillMapping:U.default.object,serviceModel:U.default.object.isRequired,serviceTemplate:U.default.object,validateModelEntriesCallback:U.default.func},KpiSearchTab.defaultProps={baseSearchSelectItems:[],handleUpdateKpiModelCallback:ee.default,savedBaseSearchCollection:{},sdDispatcher:{},serviceKpiBackfillMapping:{},serviceTemplate:{},validateModelEntriesCallback:ee.default};o.default=(0,X.connect)(s=>({baseSearchApiErrorMessage:s.kpiBaseSearches.baseSearchRetrieveApiErrorMessage,baseSearchApiStatus:s.kpiBaseSearches.baseSearchRetrieveApiStatus,baseSearchData:s.kpiBaseSearches.baseSearchRetrieveData}),s=>(0,$.bindActionCreators)({kpiBaseSearchRetrieveAction:ye.kpiBaseSearchOneRetrieve},s))(KpiSearchTab);s.exports=o.default},2648:function(s,o,_){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.dataTestItsify=o.SUI_SELECTORS=void 0,o.SUI_SELECTORS={accordion:'[data-test="accordion"]',accordionPanel:'[data-test="accordion"] [data-test="panel"]',accordionPanelToggle:'[data-test="accordion"] [data-test="panel"] [data-test="toggle"]',button:'[data-test="button"]',buttonDisabled:'[data-test="button"][disabled]',buttonGroup:'[data-test="button-group"]',buttonLink:'[data-test="button"][href]',card:'[data-test="card"]',cardHeader:'[data-test="card"] [data-test="header"]',cardFooter:'[data-test="card"] [data-test="footer"]',cardLayout:'[data-test="card-layout"]',chip:'div[data-test="chip"]',chipRemovable:'button[data-test="chip"]',chipRemove:'button[data-test="chip"] [data-test="cross"]',clickable:'button[data-test="clickable"]',collapsiblePanel:'[data-test="collapsible-panel"]',collapsiblePanelTitle:'[data-test="collapsible-panel"] [data-test="heading"] [data-test="title"]',columnLayout:'[data-test="column-layout"]',columnLayoutColumn:'[data-test="column-layout"] > div > [data-test="column"]',comboBox:'[data-test="combo-box"]',comboBoxText:'[data-test="combo-box"] [data-test="textbox"]',comboBoxInvalid:'[data-test="combo-box"] input[aria-invalid="true"]',comboBoxOptions:'[data-test="popover"] [data-test="menu"] button[data-test="option"]',controlGroup:'[data-test="control-group"]',controlGroupLabel:'[data-test="control-group"] > div > [data-test="label"]',controlGroupError:'[data-test="control-group"] [data-test="error"]',controlGroupHelp:'[data-test="control-group"] [data-test="help"]',controlGroupInvalid:'[data-test="control-group"][aria-invalid="true"]',controlGroupTooltip:'[data-test="control-group"] > div [data-test="tooltip"]',date:'[data-test="date"]',dateDisabled:'[data-test="date"] input[data-test="textbox"][disabled]',dateInvalid:'[data-test="date"] input[data-test="textbox"][aria-invalid="true"]',dateNextMonth:'[data-test="popover"] button[data-test="next-month"]',dateDay15:'[data-test="popover"] td[data-test-day="15"]',dateTextBox:'div[data-test="date"] input[data-test="textbox"]',definitionList:'[data-test="definition-list"]',definitionListDescription:'[data-test="definition-list"] [data-test="description"]',definitionListTerm:'[data-test="definition-list"] [data-test="term"]',divider:'[data-test="divider"]',dropdown:'[data-test="dropdown"]',dropdownItem:'[data-test="item"]',dropdownItemLink:'[data-test="item"]',dropdownItemLabel:'button[data-test="item"] div[data-test="label"]',dropdownOptions:'[data-test="menu"] [data-test="item"]',dropdownOptionsHeading:'[data-test="menu"] [data-test="heading"]',file:'[data-test="file"]',fileInput:'[data-test="file"] [data-test="file-input"]',formRow:'[data-test="form-rows"]',formRowsRow:'[data-test="form-rows"] [data-test="row"]',formRowAddRow:'[data-test="form-rows"] button[data-test="add-row"]',formRowRemoveRow:'[data-test="form-rows"] button[data-test="remove"]',heading:'[data-test="heading"]',layer:'[data-test="layer"]',link:'[data-test="link"]',linkDisabled:'[data-test="link"][disabled]',linkExternal:'[data-test="link"][target="_blank"]',list:'[data-test="list"]',listItem:'[data-test="list"] [data-test="item"]',markdown:'[data-test="markdown"]',message:'[data-test="message"]',messageError:'[data-test="message"][data-test-type="error"]',messageErrorContent:'[data-test="message"][data-test-type="error"] [data-test="content"]',messageInfo:'[data-test="message"][data-test-type="info"]',messageInfoContent:'[data-test="message"][data-test-type="info"] [data-test="content"]',messageRemove:'[data-test="message"] [data-test="remove"]',messageSuccess:'[data-test="message"][data-test-type="success"]',messageSuccessContent:'[data-test="message"][data-test-type="success"] [data-test="content"]',messageWarning:'[data-test="message"][data-test-type="warning"]',messageWarningContent:'[data-test="message"][data-test-type="warning"] [data-test="content"]',menu:'[data-test="menu"]',menuDivider:'[data-test="menu"] [data-test="divider"]',menuHeading:'[data-test="menu"] [data-test="heading"]',menuItem:'[data-test="menu"] button[data-test="item"]',menuItems:'[data-test="menu"] [data-test="item"]',menuItemLabel:'[data-test="menu"] button[data-test="item"] [data-test="label"]',modal:'[data-test="modal"]',modalTitle:'[data-test="modal"] [data-test="header"] [data-test="title"]',modalSubTitle:'[data-test="modal"] [data-test="header"] [data-test="subtitle"]',modalHeader:'[data-test="modal"] [data-test="header"]',modalHeaderCloseButton:'[data-test="modal"] [data-test="header"] [data-test="close"]',modalBody:'[data-test="modal"] > [data-test="body"]',modalFooter:'[data-test="modal"] [data-test="footer"]',multiselect:'[data-test="multiselect"]',multiselectTextBox:'[data-test="multiselect"] input[data-test="textbox"]',multiselectDisabled:'[data-test="multiselect"][disabled]',multiselectTextBoxInvalid:'[data-test="multiselect"] input[data-test="textbox"][aria-invalid=true]',multiselectOptions:'[data-test="popover"] [data-test="menu"] button[data-test="option"]',multiselectOptionsDisabled:'[data-test="multiselect"] button[data-test="selected-option"][disabled]',multiselectPopoverFooterMsg:'[data-test="popover"] [data-test="footer-message"]',multiselectPopoverTextbox:'[data-test="popover"] [data-test="textbox"]',multiselectSelectedOptions:'[data-test="multiselect"] button[data-test="selected-option"]',multiselectRemoveSelectedOption:'[data-test="multiselect"] button[data-test="selected-option"] [data-test="cross"]',multiselectSelectedOptionsLabel:'[data-test="multiselect"] button[data-test="selected-option"] div[data-test="label"]',number:'[data-test="number"]',numberTextBox:'[data-test="number"] input[data-test="textbox"]',paginator:'[data-test="paginator"]',paginatorPrevButton:'[data-test="paginator"] [data-test="prev"]',paginatorNextButton:'[data-test="paginator"] [data-test="next"]',paginatorLastButton:'[data-test="paginator"] [data-test="last"]',paginatorPage1Button:'[data-test="paginator"] [data-test-page="1"]',paginatorPage2Button:'[data-test="paginator"] [data-test-page="2"]',paginatorPage3Button:'[data-test="paginator"] [data-test-page="3"]',paginatorPage4Button:'[data-test="paginator"] [data-test-page="4"]',panel:'[data-test="panel"]',paragraph:'p[data-test="paragraph"]',popover:'[data-test="popover"]',progress:'[data-test="progress"]',radioBar:'[data-test="radio-bar"]',radioBarInvalid:'[data-test="radio-bar"][aria-invalid="true"]',radioBarOption:'[data-test="radio-bar"] [data-test="option"]',radioBarOptionDisabled:'[data-test="radio-bar"] [data-test="option"][disabled]',radioList:'[data-test="radio-list"]',radioListOption:'[data-test="radio-list"] [data-test="option"]',scroll:'[data-test="scroll"]',select:'[data-test="select"]',selectLabel:'[data-test="select"] span[data-test="label"]',selectInvalid:'[data-test="select"][aria-invalid="true"]',selectPopoverText:'[data-test="popover"] [data-test="textbox"]',selectPopoverFooterMsg:'[data-test="popover"] [data-test="footer-message"]',selectOptionsHeading:'[data-test="popover"] [data-test="menu"] [data-test="heading"]',selectOptions:'[data-test="popover"] [data-test="menu"] button[data-test="option"]',selectOptionDescriptions:'[data-test="popover"] [data-test="menu"] button[data-test="option"] [data-test="description"]',selectOptionLabels:'[data-test="popover"] [data-test="menu"] button[data-test="option"] [data-test="label"]',selectOptionsWithIcon:'[data-test="popover"] [data-test="menu"] button[data-test="option"][data-has-icon="true"]',sidePanel:'[data-test="side-panel"]',slider:'[data-test="slider"]',sliderHandle:'[data-test="slider"] [data-test="handle"]',staticContent:'[data-test="static-content"]',stepBar:'[data-test="step-bar"]',stepBarStep:'[data-test="step-bar"] [data-test="step"]',switch:'[data-test="switch"]',switchInline:'[data-test="switch"][data-inline="true"]',switchToggle:'[data-test="switch"] [data-test="button"]',switchToggleDisabled:'[data-test="switch"] [data-test="button"][disabled]',switchToggleSelected:'[data-test="switch"] [data-test="button"][data-selected="true"]',switchToggleNotSelected:'[data-test="switch"] [data-test="button"][data-selected="false"]',switchLabel:'[data-test="switch"] [data-test="label"]',slidingPanels:'[data-test="sliding-panels"]',slidingPanelPanel:'[data-test="sliding-panels"] [data-test="panel"]',tabBar:'[data-test="tab-bar"]',tabBarTab:'[data-test="tab-bar"] button[data-test="tab"]',tabLayout:'[data-test="tab-layout"]',tabLayoutTab:'[data-test="tab-layout"] [data-test="tab"]',tabLayoutTabToggle:'[data-test="tab-layout"] [data-test="tab"] [data-test="label"]',tabLayoutTabBar:'[data-test="tab-layout"] [data-test="tab-bar"]',tabLayoutPanel:'[data-test="tab-layout"] [data-test="panel"]',table:'[data-test="table"]',tableBody:'[data-test="table"] [data-test="body"]',tableBodyRow:'[data-test="table"] [data-test="body"] [data-test="row"]',tableBodyRowExpand:s=>`[data-test="table"] [data-test="body"] [data-test="row"][data-test-itsi="${s}"] td[data-test="expand"]`,tableBodyRowToggle:s=>`[data-test="table"] [data-test="body"] [data-test="row"][data-test-itsi="${s}"] [data-test="toggle"] [data-test="button"]`,tableBodyRowToggleSelected:s=>`[data-test="table"] [data-test="body"] [data-test="row"][data-test-itsi="${s}"] [data-test="toggle"] [data-test="button"][data-selected=true]`,tableBodyRowToggleNotSelected:s=>`[data-test="table"] [data-test="body"] [data-test="row"][data-test-itsi="${s}"] [data-test="toggle"] [data-test="button"][data-selected=false]`,tableBodyRowToggleDisabled:s=>`[data-test="table"] [data-test="body"] [data-test="row"][data-test-itsi="${s}"] [data-test="toggle"] [data-test="button"][disabled]`,tableBodyCell:'[data-test="table"] [data-test="body"] [data-test="row"] [data-test="cell"]',tableHead:'[data-test="table"] [data-test="head"]',tableFixedHeadCell:'[data-test="table"] thead[data-test="fixed-head"] [data-test="row"] [data-test="head-cell"]',tableHeadCell:'[data-test="table"] [data-test="head"] [data-test="row"] [data-test="head-cell"]',tableHeadCellToggleAll:'[data-test="table"] [data-test="head"] [data-test="row"] [data-test="toggle-all"]',tableHeadCellMoreInfo:'[data-test="table"] [data-test="head"] [data-test="row"] [data-test="more-info-head-cell"]',tableHeadCellToggleAllSomeSelected:'[data-test="table"] [data-test="head"] [data-test="row"] [data-test="toggle-all"] [data-test="button"][data-selected="some"]',tableHeadCellToggleAllSelected:'[data-test="table"] [data-test="head"] [data-test="row"] [data-test="toggle-all"] [data-test="button"][data-selected=true]',tableHeadCellToggleAllNotSelected:'[data-test="table"] [data-test="head"] [data-test="row"] [data-test="toggle-all"] [data-test="button"][data-selected=false]',text:'[data-test="text"]',textBoxClear:'[data-test="text"] [data-test="clear"]',textBoxText:'[data-test="text"] [data-test="textbox"]',textBoxDisabled:'[data-test="text"] [data-test="textbox"][disabled]',textBoxInvalid:'[data-test="text"] [data-test="textbox"][aria-invalid="true"]',textArea:'[data-test="text-area"]',textAreaBox:'[data-test="text-area"] textarea[data-test="textbox"]',textAreaBoxDisabled:'[data-test="text-area"] [data-test="textbox"][disabled]',textAreaValid:'[data-test="text-area"] textarea[data-test="textbox"][aria-invalid="false"]',textAreaInvalid:'[data-test="text-area"] textarea[data-test="textbox"][aria-invalid="true"]',tooltip:'[data-test="tooltip"]',tooltipScreenReaderContent:'[data-test="tooltip"] [data-test="screen-reader-content"]',tooltipToggle:'[data-test="tooltip"] [data-test="toggle"]',transitionOpen:'[data-test="transition-open"]',waitSpinner:'[data-test="wait-spinner"]'};o.dataTestItsify=s=>s.replace(/ /g,"-").replace(/_/g,"-").toLowerCase()},2649:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=S(_(15)),N=S(_(32)),V=S(_(0)),j=S(_(35)),K=S(_(2)),W=S(_(34)),U=S(_(24)),Y=_(4),$=_(52),X=_(137),Z=_(102),Q=_(57),ee=S(_(47)),te=S(_(356));_(2650);var ie=(0,K.default)(W.default)(R||(R=(0,P.default)(["\n\tmargin: 5px 0 5px 5px;\n"]))),ae=(0,K.default)(U.default)(O||(O=(0,P.default)(["\n\tmargin-bottom: 0;\n\tmargin-left: 10px;\n"]))),ne=te.default.extend({tagName:"div",className:"kpi-generated-search-panel",initialize:function initialize(s){(s=s||{}).dataTestItsi="service-generated-search-collapsible-panel",s.panelId="generated-search",s.panelTitle=(0,Y.gettext)("Generated Search"),s.contentViewOptions={kpiModel:s.kpiModel},s.ContentView=D.default.View.extend({tagName:"div",className:"kpi-generated-search-internal-panel",initialize:function initialize(s){this.kpiModel=s.kpiModel,this.listenTo(this.kpiModel,"change:search_alert",this.render),D.default.View.prototype.initialize.apply(this,arguments)},escapeKpiTitleGeneratedSearch:function escapeKpiTitleGeneratedSearch(s){var o,_,S=s.indexOf('kpi="'),R=s.indexOf("urgency=");_=o="";var O=S+5;for(R-=3;O<R;)'"'!==s[O]&&"\\"!==s[O]||(_+="\\"),_+=s[O],o+=s[O],++O;return s.replace(o,_)},onRunSearchClick:function onRunSearchClick(){var s=this.kpiModel.get("search_alert");if(s=this.escapeKpiTitleGeneratedSearch(s)){var o=this.kpiModel.get("search_alert_earliest");o===Z.ALERT_EARLIEST.CUSTOM&&(o=this.kpiModel.get("search_alert_earliest_custom_val"));var _={q:s,earliest:"-"+o+"m",latest:"now"};(0,$.redirect)((0,X.uiEditURL)(_),!0,null,!0)}},remove:function remove(){var s=(0,N.default)('<div class="generated-search-view-container"></div>');return j.default.unmountComponentAtNode(s.get(0)),D.default.View.prototype.remove.apply(this,arguments)},render:function render(){var s=this.kpiModel.get("search_alert");s=this.escapeKpiTitleGeneratedSearch(s);var o=(0,N.default)('<div class="generated-search-view-container"></div>');return j.default.unmountComponentAtNode(o.get(0)),j.default.render(V.default.createElement(ee.default,null,V.default.createElement(V.default.Fragment,null,this.kpiModel.get("search_type")===Q.KPI_SEARCH_TYPES.SHARED_BASE&&V.default.createElement(ae,{"data-test-itsi":"generated-base-search-preview-warning",type:"warning"},(0,Y.gettext)("This search preview might differ from the actual KPI search.")),V.default.createElement("div",{className:"service-definition-generated-search-preview","data-test-itsi":"service-definition-generated-search-preview"},s.length>0?s:(0,Y.gettext)("No generated search yet available.")),V.default.createElement(ie,{"data-test-itsi":"generated-search-run-in-search-link",openInNewContext:!0,onClick:this.onRunSearchClick.bind(this)},(0,Y.gettext)("Run in Search")))),o.get(0)),this.$el.html(o),this}}),te.default.prototype.initialize.apply(this,arguments)}});o.default=ne;s.exports=o.default},2650:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1081),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2651:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=_(45),D=_(4),N=_(126),V=S(_(88)),j=O.default.View.extend({initialize:function initialize(s){this.kpiModel=s.kpiModel,this.serviceModel=s.serviceModel,this.titleControl=new V.default({controlType:"Text",controlOptions:{dataTestItsi:"create-kpi-title-text",model:this.kpiModel,modelAttribute:"title"},dataTestItsi:"create-kpi-title-control-group",label:(0,D.gettext)("Title"),required:!0}),this.descriptionControl=new V.default({controlType:"Textarea",controlOptions:{dataTestItsi:"create-kpi-description-text-area",model:this.kpiModel,modelAttribute:"description",placeholder:this.kpiModel.get("description")||(0,D.gettext)("optional")},dataTestItsi:"kpi-description-control-group",label:(0,D.gettext)("Description")}),this._firstRender=!0,O.default.View.prototype.initialize.apply(this,arguments)},getSubTitle:function getSubTitle(){return(0,D.gettext)("Title and Description")},render:function render(){return this._firstRender&&(this.$el.html(""),this.$el.append('<div class="title-controls form-horizontal"></div>'),this.$(".title-controls").append(this.titleControl.render().el),this.$(".title-controls").append(this.descriptionControl.render().el),this._firstRender=!1),this},validate:function validate(){var s=!1;this.titleControl.error(!1);var o=R.default.Deferred(),_=this.kpiModel.get("title");_.length<1&&(this.titleControl.error(N.NO_EMPTY_TITLE_MESSAGE),s=!0);var S=this.serviceModel.get("kpis").pluck("title");return(0,P.contains)(S,_)&&(this.titleControl.error(N.ALREADY_EXISTING_TITLE_MESSAGE),s=!0),s?o.reject([]):o.resolve(),o}});o.default=j;s.exports=o.default},2652:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=S(_(0)),D=S(_(35)),N=_(4),V=_(14),j=S(_(34)),K=_(71),W=_(126),U=_(78),Y=_(52),$=_(2447),X=_(618),Z=_(900),Q=_(137),ee=_(57),te=_(102),ie=S(_(77)),ae=S(_(111)),ne=S(_(2653)),re=S(_(88)),se=S(_(2448)),le=S(_(2442)),oe=S(_(47)),de=S(_(2654)),ce=S(_(1821)),he=O.default.View.extend({initialize:function initialize(s){this.kpiModel=s.kpiModel,this.serviceModel=s.serviceModel,this.metricsUtilsInstance=s.metricsUtilsInstance,this.savedBaseSearchCollection=new ce.default,this.filteredSavedBaseSearchCollection={},this.kpiModel.set("skip_kpi_validation",!1),this.adHocSearchControl=new re.default({controlType:"Textarea",controlOptions:{dataTestItsi:"adhoc-search-text-area",listenForModelChanges:!0,modelAttribute:"base_search",model:this.kpiModel},dataTestItsi:"kpi-adhoc-search-control-group",label:(0,N.gettext)("Search"),help:P.default.createElement(j.default,{"data-test-itsi":"step-view-run-search-link",openInNewContext:!0,onClick:this.runBaseSearch.bind(this)},(0,N.gettext)("Run Search")),required:!0,tooltip:(0,N.gettext)("Event gathering search used to get data for the KPI.")}),this.adHocThresholdControl=new re.default({controlType:"Text",controlOptions:{dataTestItsi:"kpi-threshold-field-text",listenForModelChanges:!0,model:this.kpiModel,modelAttribute:"threshold_field"},dataTestItsi:"kpi-threshold-field-control-group",label:(0,N.gettext)("Threshold Field"),required:!0,tooltip:(0,N.gettext)("Field in the data that the KPI aggregates and monitors. For pure counts, use _time.")}),this.dataModelModel=this.kpiModel.get("datamodel"),this.dataModelControl=new se.default({datamodelModel:this.dataModelModel}),this.dataModelFilterView=new de.default({kpiModel:this.kpiModel}),this.metricsSearchControl=null,this.baseSearchSelectItems=[],this.kpiBaseSearchSelectDisabled=!0,this._createSkipKpiValidationControls(),this._createBaseSearchControls(),this.children={},this.children.runDataModelBaseSearchLink=new ie.default({dataTestItsi:"run-data-model-base-search-link",icon:"external",isLink:!0,label:(0,N.gettext)("Run Data Model Base Search"),openInNewContext:!0,onClick:this.runBaseSearch.bind(this)}),this.children.noEntitiesForServiceMessage=new ae.default({content:(0,N.gettext)("Selected base search filters by entities. This service does not have entities."),dataTestItsi:"no-entities-in-service-message",isVisible:!1,type:"warning"}),this.children.noBaseSearchPermsMessage=new ae.default({content:(0,N.gettext)("You do not have permission to view base searches."),dataTestItsi:"no-base-search-perms-message",isVisible:!1,type:"warning"}),this.children.noValidBaseSearchMessage=new ae.default({content:P.default.createElement("div",null,(0,N.gettext)("No valid base searches defined.")," ",P.default.createElement(j.default,{"data-test-itsi":"configure-base-search-link",openInNewContext:!0,to:X.uiListerURL},(0,N.gettext)("Configure KPI Base Search"))),dataTestItsi:"no-valid-base-search-message",isVisible:!1,type:"warning"}),this.listenTo(this.dataModelControl,"availablefieldschanged",this._onDataModelFieldsChange),this.listenTo(this.kpiModel,"change:search_type",this.toggleSearchControls),this.listenTo(this.dataModelModel,"change",this._onDataModelChange),this.listenTo(this.dataModelFilterView,"filterchange",this._onDataModelFilterChange),this.listenTo(this.kpiModel,"change:base_search_id",this._onBaseSearchSelect),this.listenTo(this.kpiModel,"change:base_search_metric",this._onMetricSelect),this._firstRender=!0,this.hasError=!1,O.default.View.prototype.initialize.apply(this,arguments)},runBaseSearch:function runBaseSearch(){var s=this.kpiModel.get("base_search");if(s&&(this.kpiModel.get("search_type")!==ee.KPI_SEARCH_TYPES.DATA_MODEL||this.kpiModel.get("datamodel").isValid())){var o=this.kpiModel.get("search_alert_earliest");o===te.ALERT_EARLIEST.CUSTOM&&(o=this.kpiModel.get("search_alert_earliest_custom_val"));var _={q:s,earliest:"-"+o+"m",latest:"now"};(0,Y.redirect)((0,Q.uiEditURL)(_),!0,null,!0)}},editBaseSearch:function editBaseSearch(){var s=this.kpiModel.get("base_search_id");s&&(0,Y.redirect)((0,X.uiEditURL)(s),!0)},getSubTitle:function getSubTitle(){return(0,N.gettext)("Source")},setSearchReturnsResults:function setSearchReturnsResults(){this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.ADHOC&&this.adHocSearchControl?this.adHocSearchControl.error(!1):this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.DATA_MODEL?(this.dataModelControl.dataModelSelect.error(!1),this.dataModelControl.objectSelect.error(!1),this.dataModelControl.fieldSelect.error(!1)):this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.METRIC?this.metricsSelectorView&&this.metricsSelectorView.validate(!0):this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.SHARED_BASE&&(this.baseSearchView&&this.baseSearchView.validate(!0),this.metricsControl&&this.metricsControl.error(!1))},setSearchReturnsNoResults:function setSearchReturnsNoResults(){this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.ADHOC&&this.adHocSearchControl?(this.adHocSearchControl.error(U.NO_RESULTS_ERROR_MESSAGE[te.ALERT_EARLIEST.MIN_15]),this.hasError=!0,this.renderSkipKpiValidationControls()):this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.DATA_MODEL?(this.dataModelControl.dataModelSelect.error(U.NO_RESULTS_ERROR_MESSAGE[te.ALERT_EARLIEST.MIN_15]),this.dataModelControl.objectSelect.error(U.NO_RESULTS_ERROR_MESSAGE[te.ALERT_EARLIEST.MIN_15]),this.dataModelControl.fieldSelect.error(U.NO_RESULTS_ERROR_MESSAGE[te.ALERT_EARLIEST.MIN_15])):this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.METRIC?this.metricsSelectorView&&this.metricsSelectorView.setSearchReturnsNoResults():(this.kpiModel.get("search_type"),ee.KPI_SEARCH_TYPES.SHARED_BASE)},validate:function validate(s){var o=R.default.Deferred(),_=[],S=!1;if(this.adHocSearchControl.error(!1),this.adHocThresholdControl.error(!1),this.dataModelControl.dataModelSelect.error(!1),this.dataModelControl.objectSelect.error(!1),this.dataModelControl.fieldSelect.error(!1),this.baseSearchView&&this.baseSearchView.validate(!0),this.metricsControl.error(!1),this.metricsSelectorView&&this.metricsSelectorView.validate(!0),this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.ADHOC){if(this.kpiModel.get("base_search")||(this.adHocSearchControl.error(W.NO_EMPTY_SEARCH_STRING_MESSAGE),S=!0),this.kpiModel.get("threshold_field")||(this.adHocThresholdControl.error((0,N.gettext)("Threshold field is required.")),S=!0),S)return o.reject([ee.KPI_VALIDATION_FAILED_MARKER]),o;if(s){var O=this.kpiModel.get("base_search").trim();0!==O.indexOf("search")&&0!==O.indexOf("|")&&(O="search "+O);var P={output_mode:"json",parse_only:!0,q:O};(0,Z.parseSearch)(P).then(s=>s.data).then(()=>{o.resolve()}).catch(s=>{var _=(0,K.formatErrorResponse)(s),S=(0,V.sprintf)((0,N.gettext)("Search parser failed: %s. Please check your search syntax and verify that all the Splunk objects used in search have proper permissions."),_.message);this.adHocSearchControl.error(S),o.reject(s)})}return o}if(this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.DATA_MODEL){var D=this.kpiModel.get("datamodel");return D.validate()&&(D.get("datamodel")||(this.dataModelControl.dataModelSelect.error($.VALIDATION_ERRORS.DATAMODEL),S=!0),D.get("object")||(this.dataModelControl.objectSelect.error($.VALIDATION_ERRORS.DATAMODEL_OBJECT),S=!0),D.get("field")||(this.dataModelControl.fieldSelect.error($.VALIDATION_ERRORS.DATAMODEL_FIELD),S=!0)),this.kpiModel.get("datamodel_filter").each(s=>{var o=s.validate();o&&(_.push(o),S=!0),this.dataModelFilterView.validateControls()}),S||_.length>0?S?o.reject([ee.KPI_VALIDATION_FAILED_MARKER]):o.reject(_):o.resolve(),o}return this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.METRIC?(this.kpiModel.get("metric")?(this.kpiModel.get("metric").metric_index||(S=!0),this.kpiModel.get("metric").metric_name||(S=!0)):_.push((0,N.gettext)("Metric field is required.")),S||_.length>0?(S&&(this.metricsSelectorView.validate(),o.reject([ee.KPI_VALIDATION_FAILED_MARKER])),o.reject(_)):o.resolve(),o):(this.kpiModel.get("base_search_id")||(this.baseSearchView&&this.baseSearchView.validate(!1,(0,N.gettext)("Base search field is required.")),S=!0),this.kpiModel.get("base_search_metric")||(this.metricsControl.error((0,N.gettext)("Metric field is required.")),S=!0),this.kpiModel.get("is_service_entity_filter")&&0===this.serviceModel.getNumEntityRules()&&_.push((0,N.gettext)("Cannot filter on entities as this service does not have entities.")),S||_.length>0?S?o.reject([ee.KPI_VALIDATION_FAILED_MARKER]):o.reject(_):(o.resolve(),this._updateKpiModelWithBaseSearchModel()),o)},_updateKpiModelWithBaseSearchModel:function _updateKpiModelWithBaseSearchModel(){var s=this.savedBaseSearchCollection.findWhere({_key:this.kpiModel.get("base_search_id")});if(s){var o=s.get("metrics").findWhere({_key:this.kpiModel.get("base_search_metric")}),_=s.get("search_alert_earliest");[te.ALERT_EARLIEST.MIN_1,te.ALERT_EARLIEST.MIN_5,te.ALERT_EARLIEST.MIN_15,te.ALERT_EARLIEST.HR_24].includes(_)?this.kpiModel.has("search_alert_earliest_custom_val")||this.kpiModel.set("search_alert_earliest",_):(this.kpiModel.set("search_alert_earliest_custom_val",_),this.kpiModel.set("search_alert_earliest",te.ALERT_EARLIEST.CUSTOM)),this.kpiModel.set({metric:s.get("metric"),base_search:s.get("base_search"),alert_period:s.get("alert_period"),is_metric:s.get("is_metric"),is_entity_breakdown:s.get("is_entity_breakdown"),entity_id_fields:s.get("entity_id_fields"),entity_breakdown_id_fields:s.get("entity_breakdown_id_fields"),is_service_entity_filter:s.get("is_service_entity_filter"),alert_lag:s.get("alert_lag"),threshold_field:o.get("threshold_field"),unit:o.get("unit"),entity_statop:o.get("entity_statop"),aggregate_statop:o.get("aggregate_statop"),fill_gaps:o.get("fill_gaps"),gap_custom_alert_value:o.get("gap_custom_alert_value"),gap_severity:o.get("gap_severity"),gap_severity_color:o.get("gap_severity_color"),gap_severity_color_light:o.get("gap_severity_color_light"),gap_severity_value:o.get("gap_severity_value")})}},toggleSearchControls:function toggleSearchControls(s){this.kpiModel&&this.kpiModel.changed&&this.kpiModel.changed.search_type&&this.kpiModel.changed.search_type===ee.KPI_SEARCH_TYPES.ADHOC&&this.kpiModel&&"function"==typeof this.kpiModel.previousAttributes&&this.kpiModel.previousAttributes().search_type&&this.kpiModel.previousAttributes().search_type===ee.KPI_SEARCH_TYPES.SHARED_BASE&&(this.kpiModel.set("base_search",""),this.kpiModel.set("threshold_field",""),this.kpiModel.set("skip_kpi_validation",!1),this.hasError=!1),this.hasError&&this.kpiModel&&this.kpiModel.changed&&this.kpiModel.changed.search_type&&this.kpiModel.changed.search_type===ee.KPI_SEARCH_TYPES.ADHOC&&this.kpiModel&&"function"==typeof this.kpiModel.previousAttributes&&this.kpiModel.previousAttributes().search_type&&this.kpiModel.previousAttributes().search_type!==ee.KPI_SEARCH_TYPES.SHARED_BASE&&this.$(".skip-kpi-validation-control-container").show(),this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.ADHOC?(this.dataModelControl.$el.hide(),this.dataModelFilterView.$el.hide(),this.$(".gather-step-datamodel-helper").hide(),this.$(".kpi-base-search-selector-container").hide(),this.$(".kpi-metrics-control-container").hide(),this.children.noBaseSearchPermsMessage.hide(),this.children.noValidBaseSearchMessage.hide(),this.children.noEntitiesForServiceMessage.hide(),this.adHocSearchControl.$el.show(),this.adHocThresholdControl.$el.show(),this.metricsSearchControl.hide()):this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.METRIC?(this.dataModelControl.$el.hide(),this.dataModelFilterView.$el.hide(),this.$(".gather-step-datamodel-helper").hide(),this.adHocSearchControl.$el.hide(),this.adHocThresholdControl.$el.hide(),this.$(".kpi-base-search-selector-container").hide(),this.$(".kpi-metrics-control-container").hide(),this.children.noBaseSearchPermsMessage.hide(),this.children.noValidBaseSearchMessage.hide(),this.children.noEntitiesForServiceMessage.hide(),this.metricsSearchControl.show(),this.$(".skip-kpi-validation-control-container").hide()):this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.DATA_MODEL?(this.dataModelControl.$el.show(),this.dataModelFilterView.$el.show(),this.$(".gather-step-datamodel-helper").show(),this.adHocSearchControl.$el.hide(),this.adHocThresholdControl.$el.hide(),this.$(".kpi-base-search-selector-container").hide(),this.$(".kpi-metrics-control-container").hide(),this.children.noBaseSearchPermsMessage.hide(),this.children.noValidBaseSearchMessage.hide(),this.children.noEntitiesForServiceMessage.hide(),this.metricsSearchControl.hide(),this.$(".skip-kpi-validation-control-container").hide()):this.kpiModel.get("search_type")===ee.KPI_SEARCH_TYPES.SHARED_BASE&&(this.dataModelControl.$el.hide(),this.dataModelFilterView.$el.hide(),this.$(".gather-step-datamodel-helper").hide(),this.adHocSearchControl.$el.hide(),this.adHocThresholdControl.$el.hide(),this.children.noEntitiesForServiceMessage.hide(),this.$(".skip-kpi-validation-control-container").hide(),this._checkForNoEntitiesInService(),0===this.savedBaseSearchCollection.length||0===this.filteredSavedBaseSearchCollection.length?(this.children.noBaseSearchPermsMessage.show(),this.children.noValidBaseSearchMessage.show(),this.kpiBaseSearchSelectDisabled=!0,this.$(".kpi-base-search-selector-container").hide()):(this.kpiBaseSearchSelectDisabled=!1,this.$(".kpi-base-search-selector-container").show(),this.$(".kpi-metrics-control-container").show()),s||this._populateBaseSearchControls(),this.metricsSearchControl.hide())},removeMetricsSelectorView:function removeMetricsSelectorView(){var s=this.$(".kpi-metric-selector-container").get(0);s&&D.default.unmountComponentAtNode(s)},_createMetricsSelectorView:function _createMetricsSelectorView(){var s=this.$(".kpi-metric-selector-container");return this.removeMetricsSelectorView(),D.default.render(P.default.createElement(oe.default,null,P.default.createElement(le.default,{model:this.kpiModel,metricsUtilsInstance:this.metricsUtilsInstance,ref:s=>this.metricsSelectorView=s})),s.get(0)),s},removeKPIBaseSearchSelectorView:function removeKPIBaseSearchSelectorView(){this.$(".kpi-base-search-selector-container").length&&D.default.unmountComponentAtNode(this.$(".kpi-base-search-selector-container").get(0))},onKpiBaseSearchChange:function onKpiBaseSearchChange(s){this.kpiModel.set({base_search_id:s})},_createKpiBaseSearchSelectorView:function _createKpiBaseSearchSelectorView(s){return this.removeKPIBaseSearchSelectorView(),D.default.render(P.default.createElement(oe.default,null,P.default.createElement(ne.default,{controlGroupDataTestItsi:"kpi-modal-base-search-control-group",disabled:this.kpiBaseSearchSelectDisabled,help:P.default.createElement(j.default,{"data-test-itsi":"service-kpi-edit-base-search-link",onClick:this.editBaseSearch.bind(this),openInNewContext:!0},(0,N.gettext)("Edit Base Search")),initialValue:this.kpiModel.get("base_search_id"),label:(0,N.gettext)("Base Search"),onChange:this.onKpiBaseSearchChange.bind(this),options:s,placeholder:(0,N.gettext)("Select a Base Search"),ref:s=>this.baseSearchView=s,required:!0,selectDataTestItsi:"kpi-modal-base-search-select",tooltip:(0,N.gettext)("Base search to associate with this KPI.")})),this.$(".kpi-base-search-selector-container").get(0)),this.$(".kpi-base-search-selector-container")},_checkForNoEntitiesInService:function _checkForNoEntitiesInService(){var s=this.savedBaseSearchCollection.findWhere({_key:this.kpiModel.get("base_search_id")});s&&(0===this.serviceModel.getNumEntityRules()&&s.get("is_service_entity_filter")?this.children.noEntitiesForServiceMessage.show():this.children.noEntitiesForServiceMessage.hide())},_onMetricSelect:function _onMetricSelect(){this.kpiModel.get("base_search_metric")?this._updateKpiModelWithBaseSearchModel():this.kpiModel.unset("threshold_field",{silent:!0})},_onDataModelFieldsChange:function _onDataModelFieldsChange(s){this.dataModelFilterView.updateFilterFields(s),this.dataModelFilterView.render()},_onDataModelChange:function _onDataModelChange(){this.dataModelModel.isValid()&&this.kpiModel.set("threshold_field",this.dataModelModel.get("owner_field"))},_onDataModelFilterChange:function _onDataModelFilterChange(s,o){this.kpiModel.unset("datamodel_filter",{silent:!0}),this.kpiModel.set("datamodel_filter",o)},_createSkipKpiValidationControls:function _createSkipKpiValidationControls(){this.skipKpiValidationText=new re.default({controlType:"Label",controlOptions:{dataTestItsi:"skip-kpi-validation-text",defaultValue:(0,N.gettext)("Do you want to skip the KPI validation check?")},dataTestItsi:"skip-kpi-validation-label-control-group",label:(0,N.gettext)("KPI validation"),tooltip:(0,N.gettext)("Save searches with no data in the last 15 minutes.")}),this.skipKpiValidationCheckbox=new re.default({controlType:"SyntheticCheckbox",controlOptions:{dataTestItsi:"skip-kpi-validation-checkbox",label:(0,N.gettext)("Skip KPI validation"),listenForModelChanges:!0,style:{marginLeft:120},model:this.kpiModel,modelAttribute:"skip_kpi_validation"},dataTestItsi:"skip-kpi-validation-checkbox-control-group"})},_onBaseSearchSelect:function _onBaseSearchSelect(){this.kpiModel.unset("base_search_metric"),this._populateMetricsControl(),this._checkForNoEntitiesInService()},_createBaseSearchControls:function _createBaseSearchControls(){this.metricsControl=new re.default({controlType:"SyntheticSelect",controlOptions:{dataTestItsi:"base-search-metric-select",items:[{value:"dummy",label:"Dummy"}],prompt:(0,N.gettext)("Select a metric"),model:this.kpiModel,modelAttribute:"base_search_metric",style:{width:"100%"},typeAheadFilter:!0},dataTestItsi:"kpi-base-search-metric-control-group",label:(0,N.gettext)("Metric"),required:!0,tooltip:(0,N.gettext)("Metric to associate with this KPI from the selected base search.")})},_populateBaseSearchControls:function _populateBaseSearchControls(){this.filteredSavedBaseSearchCollection=this.savedBaseSearchCollection.filter((function(s){return s.get("metrics").length>0})),this.baseSearchSelectItems=this.filteredSavedBaseSearchCollection.map((function(s){return{label:s.get("title"),value:s.get("_key")}})),this.kpiBaseSearchSelectDisabled=!1,this._createKpiBaseSearchSelectorView(this.baseSearchSelectItems),this._checkForNoEntitiesInService(),this.kpiModel.get("base_search_id")?this._populateMetricsControl():(this.metricsControl.disable(),this.renderMetricsControl())},_populateMetricsControl:function _populateMetricsControl(){this.metricsControl.enable(),this.renderMetricsControl();var s=[];this.kpiModel.get("base_search_id")&&(s=this.savedBaseSearchCollection.findWhere({_key:this.kpiModel.get("base_search_id")}).get("metrics").map((function(s){return{value:s.id,label:s.get("title")}})));this.metricsControl.setItems(s),this.renderMetricsControl()},renderSkipKpiValidationControls:function renderSkipKpiValidationControls(){var s=this.skipKpiValidationText.render().$el,o=this.skipKpiValidationCheckbox.render().$el;this.$(".skip-kpi-validation-control-container").append(s),this.$(".skip-kpi-validation-control-container").append(o),this.$(".skip-kpi-validation-control-container").show()},renderMetricsControl:function renderMetricsControl(){this.$(".kpi-metrics-control-container").append(this.metricsControl.render().$el)},render:function render(){if(this.savedBaseSearchCollection.fetch({data:{fields:["_key","title","metric","metrics","base_search","alert_period","alert_lag","is_entity_breakdown","entity_id_fields","entity_breakdown_id_fields","is_service_entity_filter","search_alert_earliest","is_metric"].join(",")}}).done(function(){this.renderControls(),this._populateBaseSearchControls()}.bind(this)).fail(function(s){403===s.status&&this.renderControls(!0)}.bind(this)),this._firstRender){var s=new ae.default({content:(0,N.gettext)("Loading source controls..."),dataTestItsi:"gather-step-view-loading-message",type:"info"});this.$el.append(s.render().$el)}return this},renderControls:function renderControls(s){if(this._firstRender){this.$el.html(""),this.$el.append('<div class="gathering-controls form-horizontal"></div>');var o=[{label:(0,N.gettext)("Data Model"),value:ee.KPI_SEARCH_TYPES.DATA_MODEL},{label:(0,N.gettext)("Metrics Search"),value:ee.KPI_SEARCH_TYPES.METRIC},{label:(0,N.gettext)("Ad hoc Search"),value:ee.KPI_SEARCH_TYPES.ADHOC},{label:(0,N.gettext)("Base Search"),value:ee.KPI_SEARCH_TYPES.SHARED_BASE}];this.isAdHocControl=new re.default({controlType:"SyntheticRadio",controlOptions:{dataTestItsi:"kpi-search-type-radio",items:s?o.splice(0,3):o,model:this.kpiModel,modelAttribute:"search_type"},dataTestItsi:"kpi-search-type-control-group",label:(0,N.gettext)("KPI Source"),tooltip:(0,N.gettext)('Select "Data Model" to base the KPI search on a Splunk data model, "Ad hoc Search" to specify the search string to use, or "Base Search" to select a pre-configured KPI base search.')}),this.$(".gathering-controls").append(this.isAdHocControl.render().$el),this.$(".gathering-controls").append(this.adHocSearchControl.render().$el),this.$(".gathering-controls").append(this.adHocThresholdControl.render().$el),this.$(".gathering-controls").append('<div class="kpi-base-search-selector-container" style="display:none"></div>'),this.$(".gathering-controls").append('<div class="kpi-metrics-control-container"></div>'),this.renderMetricsControl(),this.$(".gathering-controls").append('<div class="kpi-metric-selector-container"></div>'),s?this.$(".gathering-controls").append(this.children.noBaseSearchPermsMessage.render().$el):this.$(".gathering-controls").append(this.children.noValidBaseSearchMessage.render().$el),this.$(".gathering-controls").append(this.children.noEntitiesForServiceMessage.render().$el),this.$el.append(this.dataModelControl.render().$el),this.$el.append(this.dataModelFilterView.render().$el),this.$el.append('<div class="gather-step-datamodel-helper"></div>'),this.$el.find(".gather-step-datamodel-helper").html(this.children.runDataModelBaseSearchLink.render().$el),this.$(".gathering-controls").append('<div class="skip-kpi-validation-control-container"></div>'),this._firstRender=!1}this.metricsSearchControl=this._createMetricsSelectorView(),this._createKpiBaseSearchSelectorView(this.baseSearchSelectItems),this.toggleSearchControls(s)}});o.default=he;s.exports=o.default},2653:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(16)),P=S(_(17)),D=S(_(21)),N=S(_(19)),V=S(_(20)),j=S(_(8)),K=S(_(7)),W=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),U=S(_(3)),Y=S(_(2)),$=S(_(44)),X=S(_(66));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,N.default)(o),(0,D.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,N.default)(s).constructor):o.apply(s,_))}_(28);var Z=(0,Y.default)(X.default)(R||(R=(0,K.default)(["\n\tdisplay: inline-block;\n\tvertical-align: bottom;\n\twidth: 100%;\n"]))),Q=function(s){function ControlGroupSelectWithTypeAhead(){var s;(0,O.default)(this,ControlGroupSelectWithTypeAhead);for(var o=arguments.length,_=new Array(o),S=0;S<o;S++)_[S]=arguments[S];return s=_callSuper(this,ControlGroupSelectWithTypeAhead,[..._]),(0,j.default)(s,"onChange",(o,_)=>{var{value:S}=_;s.setState({value:S},()=>{s.props.onChange(S)})}),(0,j.default)(s,"setError",o=>{s.setState({error:o})}),(0,j.default)(s,"validate",(o,_)=>{if(o)s.setState({error:!1});else{var{value:S}=s.state,R=!1;S||(R=_),s.setState({error:R})}}),(0,j.default)(s,"getOptions",()=>{var{options:o,selectDataTestItsi:_}=s.props;return o.map(s=>W.default.createElement(X.default.Option,{"data-test-itsi":"".concat(_,"-option"),key:s.value,label:s.label,value:s.value}))}),s.state={error:!1,value:s.props.initialValue},s}return(0,V.default)(ControlGroupSelectWithTypeAhead,s),(0,P.default)(ControlGroupSelectWithTypeAhead,[{key:"render",value:function render(){var{controlGroupDataTestItsi:s,disabled:o,help:_,label:S,placeholder:R,required:O,selectDataTestItsi:P,tooltip:D}=this.props,{error:N,value:V}=this.state;return W.default.createElement($.default,{"data-test-itsi":s,error:N,help:_,label:S,required:O,tooltip:D},W.default.createElement(Z,{"data-test-itsi":P,error:!!N,filter:!0,disabled:o,placeholder:R,value:V,onChange:this.onChange},this.getOptions()))}}])}(W.Component);(0,j.default)(Q,"propTypes",{controlGroupDataTestItsi:U.default.string,disabled:U.default.bool,help:U.default.object,initialValue:U.default.string.isRequired,label:U.default.string.isRequired,placeholder:U.default.string,onChange:U.default.func.isRequired,options:U.default.arrayOf(U.default.shape({label:U.default.string,value:U.default.string})).isRequired,required:U.default.bool,selectDataTestItsi:U.default.string,tooltip:U.default.string}),(0,j.default)(Q,"defaultProps",{controlGroupDataTestItsi:"control-group-select-with-type-ahead-label",disabled:!1,help:null,placeholder:null,required:!1,selectDataTestItsi:"select-with-type-ahead",tooltip:null});o.default=Q;s.exports=o.default},2654:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(7)),P=S(_(15)),D=_(45),N=S(_(50)),V=S(_(159)),j=S(_(179)),K=S(_(0)),W=S(_(35)),U=S(_(2)),Y=_(4),$=S(_(44)),X=S(_(34)),Z=S(_(283)),Q=S(_(735)),ee=S(_(47)),te=S(_(77)),ie=S(_(2379)),ae=S(_(88));_(2655);var ne=(0,U.default)($.default)(R||(R=(0,O.default)(["\n\tmargin-bottom: 0;\n"]))),re=P.default.View.extend({tagName:"div",className:"kpi-filter-item",initialize:function initialize(s){s&&s.filterModel?this.model=s.filterModel:this.model=new ie.default,this.fieldData=[],this.invalidFieldError="",this._operatorSelector=new ae.default({controlType:"SyntheticSelect",controlOptions:{dataTestItsi:"kpi-filter-operator-select",inline:!0,items:[{value:"=",label:(0,Y.gettext)("Equals")},{value:"<",label:(0,Y.gettext)("Less than")},{value:">",label:(0,Y.gettext)("Greater than")}],label:"",model:this.model,modelAttribute:"_operator"},hasControlGroup:!1,inline:!0}),this._valueControl=new ae.default({controlType:"Text",controlOptions:{dataTestItsi:"datamodel-kpi-filter-value-text",modelAttribute:"_value",model:this.model,placeholder:(0,Y.gettext)("required"),style:{marginLeft:10}},hasControlGroup:!1,inline:!0}),this.children={},this.children.deleteButton=new te.default({appearance:"pill",dataTestItsi:"kpi-filter-delete-button",icon:"clear",onClick:this._deleteFilter.bind(this),screenReaderText:(0,Y.gettext)("Delete filter"),style:{marginLeft:10}}),P.default.View.prototype.initialize.apply(this,arguments)},renderSelectControl:function renderSelectControl(){0===this.$(".select-field-control").length&&this.$el.append('<div class="select-field-control"></div>'),W.default.unmountComponentAtNode(this.$(".select-field-control").get(0)),W.default.render(K.default.createElement(ee.default,null,K.default.createElement(Q.default,{dataTestItsi:"data-model-field-select",filter:!0,error:!!this.invalidFieldError,options:this.fieldData,placeholder:(0,Y.gettext)("Select a data model field"),updateValueInParent:s=>{this.model.set("_field",s)},value:this.model.get("_field"),valueType:typeof this.model.get("_field")})),this.$(".select-field-control").get(0))},showErrorsInControlsIfAny:function showErrorsInControlsIfAny(){this.model.get("_field")?(this.invalidFieldError="",this.renderSelectControl()):(this.invalidFieldError=(0,Y.gettext)("Must select a data model field."),this.renderSelectControl()),this.model.get("_value")?this._valueControl.error(!1):this._valueControl.error((0,Y.gettext)("Must enter a filter value."))},render:function render(){return 0===this.$(".select-field-control").length&&this.$el.append('<div class="select-field-control"></div>'),this.renderSelectControl(),this.$el.append(this._operatorSelector.render().$el),this.$el.append(this._valueControl.render().$el),this.$el.append(this.children.deleteButton.render().$el),this},remove:function remove(){return this._operatorSelector.remove(),this._valueControl.remove(),P.default.View.prototype.remove.apply(this,arguments)},updateFieldData:function updateFieldData(s){this.fieldData=s,this.renderSelectControl()},getFieldData:function getFieldData(){return this.fieldData},selectField:function selectField(s){this.model.set("_field",s),this.renderSelectControl()},selectOperator:function selectOperator(s){this._operatorSelector.setValue(s)},setValue:function setValue(s){this._valueControl.setValue(s)},_deleteFilter:function _deleteFilter(){this.model.destroy()}}),se=P.default.View.extend({tagName:"div",className:"kpi-filter-view",initialize:function initialize(s){if(!(s=s||{}).kpiModel)throw"Must provide kpiModel in options";this.fieldData=[],s.fieldData&&(this.fieldData=s.fieldData),this.kpiModel=s.kpiModel,this.collection=this.kpiModel.get("datamodel_filter"),this.collection.on("change",this._onChangeOfAttribute,this),this.collection.on("remove",this._onRemoveModel,this),this.filterItems=[],this.children={}},validate:function validate(){return!(0,V.default)(this.collection.models,(function(s){return s.validate()}))},renderControlGroup:function renderControlGroup(){this.$el.find(".kpi-filters-control-group-container").length>0&&(W.default.unmountComponentAtNode(this.$el.find(".kpi-filters-control-group-container").get(0)),W.default.render(K.default.createElement(ee.default,null,K.default.createElement(ne,{"data-test-itsi":"data-model-kpi-filters-control-group",label:(0,Y.gettext)("Filters"),tooltip:(0,Y.gettext)("Apply extra filters to selected data model.")},K.default.createElement(K.default.Fragment,null,K.default.createElement("div",{className:"filter-outer-container"},K.default.createElement("div",{className:"filter-container"}),K.default.createElement(X.default,{"data-test-itsi":"kpi-add-filter-link",onClick:this._addFilter.bind(this)},K.default.createElement(Z.default,{size:.9,screenReaderText:(0,Y.gettext)("Remove filter")})," ",(0,Y.gettext)("Add filter")))))),this.$el.find(".kpi-filters-control-group-container").get(0)))},validateControls:function validateControls(){this.filterItems.forEach(s=>s.showErrorsInControlsIfAny())},render:function render(){return this._removeItems(),this.$el.html('<div class="kpi-filters-control-group-container"></div>'),this.renderControlGroup(),this.collection.each(function(s){this._addFilterImpl(s)}.bind(this)),this.delegateEvents(),this},_removeItems:function _removeItems(){for(var s=0;s<this.filterItems.length;++s)this.filterItems[s].remove();this.filterItems=[]},remove:function remove(){return this._removeItems(),P.default.View.prototype.remove.apply(this,arguments)},_onChangeOfAttribute:function _onChangeOfAttribute(){this.validate()&&this.trigger("filterchange",this,this.collection)},_onRemoveModel:function _onRemoveModel(s){var o=(0,D.select)(this.filterItems,(function(o){return o.model===s}))[0];this.filterItems=(0,j.default)(this.filterItems,o),o.$el.remove(),this.validate()&&this.trigger("filterchange",this,this.collection)},updateFilterFields:function updateFilterFields(s){this.fieldData=(0,N.default)(s,(function(s){return{value:s.owner_field,label:s.label}})),this._updateFieldData()},_updateFieldData:function _updateFieldData(){for(var s=0;s<this.filterItems.length;++s){this.filterItems[s].updateFieldData(this.fieldData)}},_addFilterImpl:function _addFilterImpl(s){var o=new re({filterModel:s});o.updateFieldData(this.fieldData),this.filterItems.push(o),this.$(".filter-container").css("display","block").append(o.render().$el)},_addFilter:function _addFilter(){var s=new ie.default;this.collection.add(s),this._addFilterImpl(s)},getCollection:function getCollection(){return this.collection},getFilterViewItem:function getFilterViewItem(s){for(var o=0;o<this.filterItems.length;++o)if(this.filterItems[o].model.id===s.id)return this.filterItems[o];return null}});o.default=se;s.exports=o.default},2655:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1082),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2656:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=S(_(0)),D=_(4),N=S(_(34)),V=_(29),j=_(61),K=_(52),W=_(137),U=_(57),Y=S(_(88)),$=S(_(111));_(1461);var X=O.default.View.extend({initialize:function initialize(s){this.kpiModel=s.kpiModel,this.serviceModel=s.serviceModel;var o=j.LABEL_WIDTHS.ExtraLong;this.kpiUnitControl=new Y.default({controlType:"Text",controlOptions:{dataTestItsi:"kpi-unit-input",model:this.kpiModel,modelAttribute:"unit",placeholder:(0,D.gettext)("optional")},dataTestItsi:"kpi-unit-control-group",label:(0,D.gettext)("Unit"),labelWidth:o,help:(0,D.gettext)('Specify the unit of measurement to display in KPI visualizations. (For example "GB," "Mbps," "secs", etc.).')}),this.alertLagControl=new Y.default({controlType:"Number",controlOptions:{dataTestItsi:"kpi-alert-lag-number-control",max:1800,min:0,model:this.kpiModel,modelAttribute:"alert_lag",placeholder:(0,D.gettext)("required"),style:{width:"100%"}},dataTestItsi:"kpi-alert-lag-control-group",help:P.default.createElement(N.default,{"data-test-itsi":"kpi-determine-recommended-lag-link",openInNewContext:!0,onClick:this.runIndexLagSearch.bind(this)},(0,D.gettext)("Determine Recommended Lag")),label:(0,D.gettext)("Monitoring Lag (in seconds)"),labelWidth:o,required:!0,tooltip:(0,D.gettext)("Pushes KPI evaluation back by a number of seconds. Should be set to data's index lag.")}),this.children={},this.children.baseSearchAutoFillMessage=new $.default({content:(0,D.gettext)("Fields are populated from the selected base search."),dataTestItsi:"base-search-auto-fill-unit-message",type:"warning"}),O.default.View.prototype.initialize.apply(this,arguments)},getSubTitle:function getSubTitle(){return(0,D.gettext)("Optional Setup - Unit and Monitoring Lag")},runIndexLagSearch:function runIndexLagSearch(){var s=this.kpiModel.get("kpi_base_search");if(s){var o={q:s+=' | eval indexing_lag=floor(_indextime - _time) | stats perc98(indexing_lag) AS "Recommended Monitoring Lag" max(indexing_lag) AS "Maximum Indexing Lag" avg(indexing_lag) AS "Average Indexing Lag" min(indexing_lag) AS "Minimum Indexing Lag"',earliest:"-90m",latest:"-30m"};(0,K.redirect)((0,W.uiEditURL)(o),!0,null,!0)}},render:function render(){this.$el.html(""),this.$el.append('<div class="unit-controls form-horizontal"></div><div class="advanced-controls form-horizontal"></div>'),this.$(".unit-controls").append(this.kpiUnitControl.render().el),this.$(".advanced-controls").append(this.alertLagControl.render().el),"shared_base"===this.kpiModel.get("search_type")?(this.$el.prepend(this.children.baseSearchAutoFillMessage.render().$el),this.kpiUnitControl.disable(),this.alertLagControl.disable()):(this.kpiUnitControl.enable(),this.alertLagControl.enable());return(0,R.default)("input",this.kpiUnitControl.$el).attr("maxlength",4),this},validate:function validate(){var s=!1;this.alertLagControl.error(!1);var o=R.default.Deferred(),_=this.kpiModel.get("alert_lag");return(!V.isAllNumericRE.test(_)||parseInt(_,10)>1800)&&(s=!0,this.alertLagControl.error((0,D.gettext)("Must be a positive integer less than 1800 seconds."))),s?o.reject([U.KPI_VALIDATION_FAILED_MARKER]):o.resolve(),o}});o.default=X;s.exports=o.default},2657:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=_(4),D=S(_(88)),N=S(_(1222)),V=O.default.View.extend({initialize:function initialize(s){this.kpiModel=s.kpiModel,this.serviceModel=s.serviceModel,this.aggregateThresholdModel=s.aggregateThresholdModel,this.entityThresholdModel=s.entityThresholdModel,this._configSettingsModel=new O.default.Model({threshold_config_is_aggregate:!0}),O.default.View.prototype.initialize.apply(this,arguments)},getSubTitle:function getSubTitle(){return(0,P.gettext)("Thresholds")},render:function render(){return this.thresholdView&&this.thresholdView.remove(),this.thresholdView=new N.default({kpiModel:this.kpiModel,service:this.serviceModel,aggregateThresholdModel:this.aggregateThresholdModel,entityThresholdModel:this.entityThresholdModel,configSettingsModel:this._configSettingsModel}),this.aggregateEntityConfigureControl&&this.aggregateEntityConfigureControl.remove(),this.aggregateEntityConfigureControl=new D.default({controlType:"SyntheticRadio",controlOptions:{dataTestItsi:"service-threshold-config-radio",items:[{value:!0,label:(0,P.gettext)("Aggregate Thresholds")},{value:!1,label:(0,P.gettext)("Per-Entity Thresholds")}],model:this._configSettingsModel,modelAttribute:"threshold_config_is_aggregate"},hasControlGroup:!1}),this.$el.html(""),this.$el.append(this.aggregateEntityConfigureControl.render().$el),this._toggleAggregateEntitySelector(),this.$el.append(this.thresholdView.render().$el),this.thresholdView&&this.thresholdView.aggregateSettings&&this.thresholdView.aggregateSettings.thresholdPreviewView&&this.thresholdView.aggregateSettings.thresholdPreviewView.children&&this.thresholdView.aggregateSettings.thresholdPreviewView.children&&this.thresholdView.aggregateSettings.thresholdPreviewView.children.optionsLink&&this.thresholdView.aggregateSettings.thresholdPreviewView.children.optionsLink.hide(),this},_toggleAggregateEntitySelector:function _toggleAggregateEntitySelector(){this.kpiModel.get("is_entity_breakdown")?this.aggregateEntityConfigureControl.$el.show():(this._configSettingsModel.set("threshold_config_is_aggregate",!0),this.aggregateEntityConfigureControl.$el.hide())},remove:function remove(){return this.thresholdView&&this.thresholdView.remove(),O.default.View.prototype.remove.apply(this,arguments)},validate:function validate(){return R.default.Deferred().resolve()}});o.default=V;s.exports=o.default},2658:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=S(_(35)),D=S(_(254)),N=_(4),V=_(29),j=_(145),K=_(102),W=S(_(111)),U=S(_(2659));_(1461);var Y=O.default.View.extend({initialize:function initialize(s){this.kpiModel=s.kpiModel,this.serviceModel=s.serviceModel,this.backfillControl=null,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,O.default.View.prototype.initialize.apply(this,arguments)},getSubTitle:function getSubTitle(){return(0,N.gettext)("Optional Setup - Backfill")},removeChildReactViews:function removeChildReactViews(){var s=this.$(".backfill-enable-disable-control").get(0);s&&P.default.unmountComponentAtNode(s);var o=this.$(".kpi-backfill-status-control").get(0);o&&P.default.unmountComponentAtNode(o)},render:function render(){this.$el.html(""),this.$el.append('<div class="unit-controls form-horizontal"></div><div class="advanced-controls form-horizontal"></div>');var s=this.kpiModel.get("search_alert_earliest");if(s===K.ALERT_EARLIEST.CUSTOM&&(s=this.kpiModel.get("search_alert_earliest_custom_val")),Number(s)>15){this.kpiModel.set("backfill_enabled",!1);var o=new W.default({content:(0,N.gettext)("Calculation window too large to backfill KPI."),dataTestItsi:"calculation-window-too-large-message",type:"warning"});this.$(".advanced-controls").append(o.render().$el)}else this.backfillControl instanceof U.default&&this.backfillControl.remove(),this.backfillControl=new U.default({kpiModel:this.kpiModel,serviceModel:this.serviceModel,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping}),this.$(".advanced-controls").append(this.backfillControl.render().$el);return this},validate:function validate(){var s=[],o=R.default.Deferred(),_=this.kpiModel.get("backfill_enabled");return(0,D.default)(_)&&s.push((0,N.gettext)("Invalid backfill settings")),this.kpiModel.get("backfill_earliest_time")===j.BACKFILL_TIME_PERIOD_EARLIEST_INVALID_TIME?s.push((0,N.gettext)("Backfill period must have an earliest time before the current date.")):!this.kpiModel._checkSummarizedDataCache||(0,V.isUndefinedOrNull)(this.kpiModel._checkSummarizedDataCache.backfillNeeded)||this.kpiModel._checkSummarizedDataCache.backfillNeeded||s.push(this.kpiModel._checkSummarizedDataCache.backfillNeededErrorMessage),s.length>0?o.reject(s):o.resolve(),o}});o.default=Y;s.exports=o.default},2659:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(45),O=S(_(32)),P=S(_(15)),D=S(_(112)),N=S(_(0)),V=S(_(35)),j=_(4),K=_(14),W=_(554),U=_(67),Y=_(145),$=S(_(111)),X=S(_(47)),Z=S(_(1455)),Q=S(_(1456)),ee=S(_(557));_(2660);var te=(0,R.template)('<div class="backfill-status-label" data-test-itsi="backfill-status-label"><%- vars.gettext("Backfill Status") %></div><div class="backfill-status-text" data-test-itsi="backfill-status-text"><%- vars.status %></div>',null,{variable:"vars"}),ie=P.default.View.extend({className:"form-horizontal kpi-backfill-control-view",initialize:function initialize(s){if(!s.kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.serviceModel=s.serviceModel,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.listenTo(this.kpiModel,"change:backfill_status",this._renderTrainingStatus),P.default.View.prototype.initialize.apply(this,arguments)},render:function render(){if(this._renderedStatus)"controls"===this._renderedStatus?this._renderControls():"backfillNotNeeded"===this._renderedStatus&&this._renderBackfillNotNeeded();else{var s=new $.default({content:(0,j.gettext)("Loading backfill controls..."),dataTestItsi:"backfill-control-view-loading-message",type:"info"});this.$el.html('<div class="backfill-controls"></div><div class="backfill-status"></div>'),this.$el.find(".backfill-controls").html(s.render().$el),this.checkIsKPICreateMode()?this._renderControls():this._getKpiEarliestTime()}return this},remove:function remove(){return this.earliestTimeSearchXhr&&(0,D.default)(this.earliestTimeSearchXhr.abort)&&this.earliestTimeSearchXhr.abort(),P.default.View.prototype.remove.apply(this,arguments)},_getKpiEarliestTime:function _getKpiEarliestTime(){this.kpiModel.earliestTimeSearchPromise.then(s=>{s?this._checkBackfillProgress():this._renderBackfillStatusFailure((0,j.gettext)("Error retrieving the KPI earliest time. Check logs for details."))})},checkIsKPICreateMode:function checkIsKPICreateMode(){return Object.prototype.hasOwnProperty.call(this.kpiModel._watchedAttrs.original,"base_search")&&""===this.kpiModel._watchedAttrs.original.base_search},_checkBackfillProgress:function _checkBackfillProgress(){var s=this.kpiModel.get("_key");ee.default.getBackfillDataForKpi(s).done(function(o,_){if(o)this._renderBackfillStatus(_);else if(this.serviceKpiBackfillMapping[s]){var S=(0,W.createRangeLabel)(this.kpiModel.get("backfill_earliest_time"),"now").toLowerCase(),R=(0,K.sprintf)((0,j.gettext)("Backfill has been configured for %(timeLabel)s of data."),{timeLabel:S});this._renderBackfillIsConfigured(R)}else this._renderControls()}.bind(this))},_renderBackfillStatus:function _renderBackfillStatus(s){this.$(".backfill-controls").hide();var o=this.kpiModel.get("backfill_earliest_time");s=ee.default.renderBackfillStatus(s,o);var _=te({gettext:j.gettext,status:s},{variable:"vars"});this.$(".backfill-status").html(_).show(),this._renderedStatus="inprogress"},_renderBackfillNotNeeded:function _renderBackfillNotNeeded(){this.$(".backfill-controls").hide(),this.$(".backfill-status").text(Y.BACKFILL_STATUSES.NOT_AVAILABLE).show(),this._renderedStatus="backfillNotNeeded"},_renderBackfillStatusFailure:function _renderBackfillStatusFailure(s){this.$(".backfill-controls").hide(),this.$(".backfill-status").text(s).show(),this._renderedStatus="backfillError"},_renderBackfillIsConfigured:function _renderBackfillIsConfigured(s){this.$(".backfill-controls").hide();var o=te({gettext:j.gettext,status:s},{variable:"vars"});this.$(".backfill-status").html(o).show(),this._renderedStatus="configured"},onEnableDisableBackfill:function onEnableDisableBackfill(s){this.kpiModel.set({backfill_enabled:s}),this._renderBackfillTimeControls(s)},_createAndRenderSwitchControl:function _createAndRenderSwitchControl(){var s=this.kpiModel.get("backfill_enabled"),o=(0,O.default)('<div data-test-itsi="backfill-enable-disable-control" class="backfill-enable-disable-control"></div>');return V.default.unmountComponentAtNode(o.get(0)),V.default.render(N.default.createElement(X.default,null,N.default.createElement(Z.default,{enabled:s,onChange:this.onEnableDisableBackfill.bind(this),size:"medium"})),o.get(0)),o},_checkAndSetIfBackfillPeriodIsValid:function _checkAndSetIfBackfillPeriodIsValid(s){var o=this.kpiModel._checkSummarizedDataCache.earliestTime,_=parseInt(o,10),S=(new Date).getTime()/1e3-(0,U.relativeToSeconds)(s),R=!1;return(isNaN(_)||S<_)&&(R=!0),this.kpiModel._checkSummarizedDataCache.backfillNeeded=R,this.kpiModel._checkSummarizedDataCache.backfillNeeded},_handleTimePickerSelection:function _handleTimePickerSelection(s){var o,_=this.checkIsKPICreateMode();_||(o=this._checkAndSetIfBackfillPeriodIsValid(s)),this.kpiModel.set("backfill_earliest_time",s),_||o||s===Y.BACKFILL_TIME_PERIOD_EARLIEST_INVALID_TIME?this.$(".kpi-invalid-backfill-time")&&this.$(".kpi-invalid-backfill-time").remove():this._renderInValidBackfillTimeControl(s)},_renderControls:function _renderControls(){this.$(".backfill-status").hide();var s=this.$(".backfill-controls");s.html("").css({display:"table"}),this.kpiBackfillEnableControl=this._createAndRenderSwitchControl(),s.append(this.kpiBackfillEnableControl),s.append('<div class="backfill-enable-status"></div>'),this._renderBackfillTimeControls(this.kpiModel.get("backfill_enabled")),this._renderedStatus="controls"},_renderBackfillStatusControl:function _renderBackfillStatusControl(s){var o=(0,O.default)('<div class="kpi-backfill-status-control"></div>'),_=this.$(".kpi-backfill-status-control").get(0);if(_&&V.default.unmountComponentAtNode(_),s){var S,R=this.checkIsKPICreateMode();R||(S=this._checkAndSetIfBackfillPeriodIsValid(this.kpiModel.get("backfill_earliest_time"))),R||S||this.kpiModel.get("backfill_earliest_time")===Y.BACKFILL_TIME_PERIOD_EARLIEST_INVALID_TIME||this._renderInValidBackfillTimeControl(this.kpiModel.get("backfill_earliest_time"))}else this.$(".kpi-invalid-backfill-time")&&this.$(".kpi-invalid-backfill-time").remove();return V.default.render(N.default.createElement(X.default,null,N.default.createElement(Q.default,{backfillEnabled:s,backfillEarliest:this.kpiModel.get("backfill_earliest_time"),onTimePickerSelection:this._handleTimePickerSelection.bind(this)})),o.get(0)),o},_renderInValidBackfillTimeControl:function _renderInValidBackfillTimeControl(s){var o=s.slice(1,s.length-1),_=(0,K.sprintf)((0,j.gettext)("You already have %s day(s) of data in the summary index. Select a larger time range."),o),S=new $.default({content:_,dataTestItsi:"backfill-error-message",type:"error"});0===this.$(".kpi-invalid-backfill-time").length?(this.$el.append('<div class="kpi-invalid-backfill-time"></div>'),this.$el.find(".kpi-invalid-backfill-time").append(S.render().$el)):this.$(".kpi-invalid-backfill-time").html(S.render().$el),this.kpiModel._checkSummarizedDataCache.backfillNeededErrorMessage=_},_renderBackfillTimeControls:function _renderBackfillTimeControls(s){var o=this._renderBackfillStatusControl(s);this.$(".backfill-enable-status").html(o)},_renderTrainingStatus:function _renderTrainingStatus(){var s=this.kpiModel.get("backfill_status");if(s){"new"===s||"pending"===s||"running"===s?s=(0,j.gettext)("In progress"):"done"===s?s=(0,j.gettext)("Finished"):"failed"===s&&(s=(0,j.gettext)("Failed"));var o=te({gettext:j.gettext,status:s},{variable:"vars"});this.$(".kpi-backfill-search-status").html(o).show()}}});o.default=ie;s.exports=o.default},2660:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1084),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2661:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1085),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2662:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q,ee,te,ie,ae,ne=S(_(8)),re=S(_(7)),se=_interopRequireWildcard(_(0)),le=_(46),oe=_(48),de=S(_(3)),ce=S(_(2)),he=S(_(81)),ue=S(_(37)),pe=S(_(33)),fe=_interopRequireWildcard(_(166)),ge=_interopRequireWildcard(_(337)),me=_(322),ve=S(_(27)),ye=S(_(156)),_e=S(_(44)),Se=S(_(267)),be=S(_(64)),Ee=S(_(34)),Te=S(_(100)),Ce=S(_(51)),ke=S(_(283)),xe=S(_(66)),we=S(_(313)),Re=S(_(83)),Ie=S(_(219)),Me=S(_(75)),Oe=S(_(91)),Ae=_(125),Pe=_(4),De=_(14),Le=_(22),Ne=_(73),Ve=_(108),je=_(78),He=_(452),Be=_(487),Ke=_(145),Fe=_(109),We=S(_(1055)),Ue=S(_(1054)),Ge=S(_(2663)),Ye=S(_(1457)),qe=S(_(815)),ze=S(_(706)),$e=_(102),Je=_(306),Xe=_(501),Ze=_(2548),Qe=_(763),et=_(764);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,ne.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var tt=ce.default.div(R||(R=(0,re.default)(["\n display: flex;\n flex-direction: row;\n width: 1000px;\n"]))),it=(0,ce.default)(Se.default)(O||(O=(0,re.default)(["\n color: ",";\n"])),Le.variables.warningColor),at=(0,ce.default)(Me.default)(P||(P=(0,re.default)(["\n padding: 20px 0;\n width: 1480px;\n height: calc(100vh - 298px);\n justify-content: center;\n"]))),nt=ce.default.div(D||(D=(0,re.default)(["\n display: flex;\n justify-content: start;\n"]))),rt=(0,ce.default)(Ee.default)(N||(N=(0,re.default)(["\n margin-left: 10px;\n"]))),st=(0,ce.default)(be.default)(V||(V=(0,re.default)(["\n margin-top: 0px;\n"]))),lt=ce.default.span(j||(j=(0,re.default)(["\n padding: 20px;\n"]))),ot=ce.default.div(K||(K=(0,re.default)(["\n width: 1480px;\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n"]))),dt=ce.default.div(W||(W=(0,re.default)(["\n padding: 12px 0px;\n"]))),ct=ce.default.div(U||(U=(0,re.default)(["\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"]))),ht=ce.default.img(Y||(Y=(0,re.default)(["\n display: block;\n margin-left: auto;\n margin-right: auto;\n"]))),ut=(0,ce.default)(Ce.default)($||($=(0,re.default)(["\n text-align: center;\n margin-top: 20px;\n margin-bottom: 30px;\n"]))),pt=(0,ce.default)(_e.default)(X||(X=(0,re.default)(["\n width: 226px !important;\n"]))),ft=ce.default.div(Z||(Z=(0,re.default)(["\n margin-top: 20px;\n display: flex;\n"]))),gt=(0,ce.default)(we.default)(Q||(Q=(0,re.default)(["\n flex-grow: 1;\n"]))),mt=(0,ce.default)(ye.default)(ee||(ee=(0,re.default)(["\n color: ",";\n border-bottom: 1px solid ",";\n"])),Le.variables.linkColor,Le.variables.gray92),vt=(0,ce.default)(Te.default)(te||(te=(0,re.default)(["\n width: 600px;\n"]))),yt=(0,ce.default)(_e.default)(ie||(ie=(0,re.default)(["\n margin-top: 20px;\n"]))),_t=(0,ce.default)(Ie.default)(ae||(ae=(0,re.default)(["\n width: 100% !important;\n"]))),St=(0,ge.makeCreateToast)(ge.default),bt=se.default.createElement(it,{"data-test-itsi":"base-configuration-tab-warning-icon",variant:"filled"});function KpiThresholdingControlsContainer(s){var{appsData:o,thresholdTemplateCollection:_,healthAnalyticsConsoleRecommendationsResultsRetrieveAction:S,healthAnalyticsConsoleRecommendationsSearchResetAction:R,recommendationResults:O,recommendationSearchErrorMessage:P,recommendationSearchSid:D,recommendationSearchStatus:N,useRawSearch:V,isReadOnly:j,previewServiceCache:K,serviceTemplateKey:W,linkedServices:U,openToThresholdLevelsTab:Y,kpiThresholdTemplateResetAction:$,kpiThresholdTemplateCreateAction:X,kpiThresholdTemplateApiStatus:Z,handleSelectedServiceChange:Q,selectedKpi:ee}=s,{formatRecommendations:te,hadCopyKPIToEntityThresholds:ie,isServiceTemplate:ae,isServiceTemplateNewKpi:ne,kpiData:re,revertKpiAIThresholdSettings:le,selectedKpiModel:oe,setHadCopyKPIToEntityThresholds:de,updateKpiData:ce,updateThresholdInKpiModel:ge,previewServiceKey:ye}=(0,se.useContext)(Je.ThresholdingContext),_e=$e.THRESHOLDING_TABS[1].value;oe.get("is_recommended_time_policies")&&(_e=$e.THRESHOLDING_TABS[0].value),Y&&(_e=$e.THRESHOLDING_TABS[2].value);var[Se,be]=(0,se.useState)(_e),[Ee,Ce]=(0,se.useState)(!1),[Ie,Me]=(0,se.useState)(!1),[Le,He]=(0,se.useState)({}),[Qe,it]=(0,se.useState)(1480),[Et,Tt]=(0,se.useState)(oe.get("is_recommended_time_policies")),[Ct,kt]=(0,se.useState)(null),[xt,wt]=(0,se.useState)(oe.get("kpi_recommendation_unlinked")||!1),[Rt,It]=(0,se.useState)(!1),[Mt,Ot]=(0,se.useState)(!1),[At,Pt]=(0,se.useState)(""),[Dt,Lt]=(0,se.useState)(""),[Nt,Vt]=(0,se.useState)(!1),jt=(0,se.useRef)(null);(0,se.useEffect)(()=>{var handleResize=()=>{var s=jt.current&&jt.current.offsetWidth?jt.current.offsetWidth:0;s>774&&it(s)};return handleResize(),window.addEventListener("resize",handleResize),()=>{window.removeEventListener("resize",handleResize)}},[jt]),(0,se.useEffect)(()=>{Y&&be($e.THRESHOLDING_TABS[2].value)},[Y]);var Ht=(0,se.useCallback)(s=>{kt(_.get(s)),St({type:me.TOAST_TYPES.WARNING,message:(0,Pe.gettext)("Threshold template unlinked"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1})},[_]);(0,se.useEffect)(()=>{if(N===Be.HEALTH_ANALYTICS_RECOMMENDATIONS_SEARCH_RETRIEVE_STATUS.SUCCESS&&D)S(D);else if(N===Be.HEALTH_ANALYTICS_RECOMMENDATIONS_RESULTS_RETRIEVE_STATUS.SUCCESS&&O){var s,o;null!=O&&null!==(s=O.result)&&void 0!==s&&null!==(s=s.data)&&void 0!==s&&s.length&&(null===(o=O.result.data[0])||void 0===o?void 0:o.itsi_kpi_id)===re._key?(oe.unset("recommendation_in_progress"),""!==re.thresholdTemplateId&&Ht(re.thresholdTemplateId),te(O.result.data[0].kpi_at_configurations),be($e.THRESHOLDING_TABS[0].value),Tt(!0)):oe.set("recommendation_error_type",(0,De.sprintf)((0,Pe.gettext)("No recommendations available due to unknown reason: %(reasonCode)s"),{reasonCode:P})),R()}},[O,P,D,N]);var Bt=(0,se.useCallback)(()=>{de(!0),St({type:me.TOAST_TYPES.WARNING,message:(0,Pe.gettext)("Copy adaptive thresholds to entity settings unlinked"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1})},[de]),Kt=(0,se.useCallback)(()=>{le(),Tt(!0),wt(!1)},[le]),Ft=(0,se.useCallback)(()=>{var s;oe.set("kpi_recommendation_unlinked",!0),oe.set("is_recommended_time_policies",!1),oe.set("was_recommendation_modified",!0),void 0!==(null==oe||null===(s=oe.get("threshold_recommendation_summary"))||void 0===s?void 0:s.lastRun)&&wt(!0),Tt(!1)},[oe]),Wt=(0,se.useCallback)(s=>{var o=_objectSpread({},re);if(""!==o.thresholdTemplateId&&(Ht(o.thresholdTemplateId),o.thresholdTemplateId=""),Et&&Ft(),o.isCopyKPIToEntityThresholdsEnabled&&(Bt(),o.isCopyKPIToEntityThresholdsEnabled=!1,oe.set("adaptive_thresholding_copy_kpi_to_entity",!1)),"adaptive"===s)o.isTimeVariateThresholds=!0,o.isAdaptiveThresholdsEnabled=!0,ce(o),oe.set("time_variate_thresholds",!0),oe.set("adaptive_thresholds_is_enabled",!0),o.tempKpiData=oe.toJSON(),o.tempKpiData.time_variate_thresholds_specification=JSON.parse(JSON.stringify(o.timeVariateThresholdsSpecification));else if("time"===s){var _=o.timeVariateThresholdsSpecification.policies;Object.keys(_).forEach(s=>{"static"!==_[s].policy_type&&(_[s].policy_type="static")}),o.isTimeVariateThresholds=!0,o.isAdaptiveThresholdsEnabled=!1,o.timeVariateThresholdsSpecification.policies=_,ce(o),oe.set("time_variate_thresholds",!0),oe.set("adaptive_thresholds_is_enabled",!1),ge(o)}else oe.unset("kpi_threshold_template_id"),o.isTimeVariateThresholds=!1,o.isAdaptiveThresholdsEnabled=!1,ce(o),oe.set("time_variate_thresholds",!1),oe.set("adaptive_thresholds_is_enabled",!1)},[re,Et,Ht,Ft,Bt,oe,ce,ge]),Ut=(0,se.useCallback)(s=>{var o,_=_objectSpread({},re);""!==_.thresholdTemplateId&&(Ht(_.thresholdTemplateId),_.thresholdTemplateId=""),Et&&Ft(),null!==(o=s.timeVariateThresholdsSpecification)&&void 0!==o&&o.policies&&(_.timeVariateThresholdsSpecification=s.timeVariateThresholdsSpecification,_.isAdaptiveThresholdsEnabled&&(_.tempKpiData.time_variate_thresholds_specification=JSON.parse(JSON.stringify(_.timeVariateThresholdsSpecification)))),s.aggregateThresholdsConfig&&(_.aggregateThresholdsConfig=s.aggregateThresholdsConfig),ce(_),ge(_)},[re,Et,ce,ge,Ht,Ft]),Gt=(0,se.useCallback)(s=>{var o=_objectSpread(_objectSpread({},re),s);Et&&Ft(),""!==o.thresholdTemplateId&&(Ht(o.thresholdTemplateId),o.thresholdTemplateId=""),ce(o),"adaptiveTrainingWindow"in s?oe.set("adaptive_thresholding_training_window",s.adaptiveTrainingWindow):"isOutlierDetectionEnabled"in s?oe.set("aggregate_outlier_detection_enabled",s.isOutlierDetectionEnabled):"outlierDetectionAlgorithm"in s?oe.set("outlier_detection_algo",s.outlierDetectionAlgorithm):"outlierDetectionSensitivity"in s&&oe.set("outlier_detection_sensitivity",s.outlierDetectionSensitivity)},[Ht,Et,re,oe,Ft,ce]),Yt=(0,se.useCallback)(()=>{Me(!0),(0,je.cleanSearchJobSubscriptions)(null==Le?void 0:Le.searchJob,null==Le?void 0:Le.searchJobSubscription);var s=re._key,o="".concat((0,Ke.getAdaptiveThresholdMetricIndexSearchForKpi)(s,null,!1)," usetempcollection collection=itsi_temporary_storage key=").concat(s);(0,Fe.syncTempCollection)(re._key,oe.toJSON()).then(()=>{var s=Oe.default.create({id:(0,je.createUniqueSearchId)("kpi-adaptive-thresholding-search"),earliest_time:re.adaptiveTrainingWindow,latest_time:"now",preview:!1,cancelOnUnload:!0,search:o},{app:(0,Ne.getShortAppName)(!0)}),_=s.getResults().subscribe({next:()=>{(0,Fe.retrieveTempCollection)(re._key).then(s=>{var{policies:o}=s.data.time_variate_thresholds_specification,_=(0,he.default)(re),S=_.timeVariateThresholdsSpecification.policies;(0,ue.default)(o,(s,R)=>{var O=S[R].aggregate_thresholds.thresholdLevels,P=fe.extent(s.aggregate_thresholds.thresholdLevels.map(s=>s.thresholdValue));P[0]=Number(P[0]),P[1]=Number(P[1]),(O.isMinStatic&&P[0]<O.gaugeMin||!O.isMinStatic)&&(O.gaugeMin=P[0]-Math.abs(.1*P[0]),O.renderBoundaryMin>O.gaugeMin&&(O.renderBoundaryMin=O.gaugeMin)),(O.isMaxStatic&&P[1]>O.gaugeMax||!O.isMaxStatic)&&(O.gaugeMax=P[1]+Math.abs(.1*P[1]),O.renderBoundaryMax<O.gaugeMax&&(O.renderBoundaryMax=O.gaugeMax)),S[R].aggregate_thresholds.thresholdLevels=o[R].aggregate_thresholds.thresholdLevels,null!=_&&_.isCopyKPIToEntityThresholdsEnabled&&(S[R].entity_thresholds.thresholdLevels=o[R].aggregate_thresholds.thresholdLevels)}),ge(_),ce(_),Me(!1)})}});He({searchJob:s,searchJobSubscription:_})})},[Le.searchJobSubscription,Le.searchJob,re,oe,ge,ce]),qt=(0,se.useCallback)((s,o)=>{var{selectedTabId:_}=o;be(_),Ee&&Ce(!1)},[Ee]),zt=(0,se.useCallback)((s,o)=>{var{value:_}=o;Pt(_),Ot(!1)},[Pt]),$t=(0,se.useCallback)((s,o)=>{var{value:_}=o;Lt(_)},[Lt]),Jt=(0,se.useCallback)(()=>{var s=_.pluck("title");if(""===At||s.includes(At))Ot(!0);else{var o;if(Rt){var S=JSON.parse(JSON.stringify(oe.toJSON()));o=(0,Ze.generateTemplate)(S)}o=_objectSpread(_objectSpread({},o),{title:At,description:Dt}),Vt(!0),X(o)}},[_,At,Rt,Dt,X,oe]),Xt=(0,se.useCallback)(()=>{if(oe&&oe.get("kpi_threshold_template_id")){var s=_.findWhere({_key:oe.get("kpi_threshold_template_id")});s?(Pt(s.get("title")),Lt(s.get("description"))):(Pt(""),Lt(""))}It(!Rt),Ot(!1),Vt(!1)},[oe,Rt,_]),Zt=null!=re&&re.thresholdTemplateId?_.get(re.thresholdTemplateId):{},Qt=(0,se.useCallback)(()=>{be($e.THRESHOLDING_TABS[1].value),Ce(!0)},[]),ei=(0,se.useCallback)(()=>{be($e.THRESHOLDING_TABS[1].value),Ee&&Ce(!1)},[Ee]),ti=(0,se.useCallback)(()=>{be($e.THRESHOLDING_TABS[2].value)},[]),ii=(0,se.useCallback)(()=>{Wt(),ei()},[Wt,ei]);(0,se.useEffect)(()=>{Z!==et.KPI_THRESHOLD_TEMPLATE_CREATE_STATUS.SUCCESS&&Z!==et.KPI_THRESHOLD_TEMPLATE_CREATE_STATUS.ERROR||!Rt||(Z===et.KPI_THRESHOLD_TEMPLATE_CREATE_STATUS.SUCCESS?_.fetch().done(s=>{var o=s.find(s=>s.title===At);_.add(o);var S="";o&&(S=o._key),S&&(oe.set("kpi_threshold_template_id",S),ce(oe),Vt(!1),St({type:me.TOAST_TYPES.SUCCESS,message:(0,Pe.gettext)("Threshold template successfully saved"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1}),Rt&&Xt(),$())}):St({type:me.TOAST_TYPES.ERROR,message:(0,Pe.gettext)("Threshold templated failed to save"),autoDismiss:!0,dismissOnActionClick:!0,showAction:!1}))},[Z]);var ai="";return Mt&&(ai=""!==At?(0,Pe.gettext)("A template with this title already exists."):(0,Pe.gettext)("This is a required field.")),se.default.createElement("div",{"data-test-itsi":"kpi-thresholding-controls-container",ref:jt},se.default.createElement(nt,null,se.default.createElement(st,{"data-test-itsi":"kpi-thresholding-container-kpi-title",level:2},(0,Pe.gettext)("KPI thresholds")),se.default.createElement(rt,{"data-test-itsi":"kpi-thresholding-learn-more-link",to:(0,Ve.makeDocsURL)(Ve.DOCS_PAGES.ITSI_KPI_ADAPTIVE_THRESHOLDING),openInNewContext:!0},(0,Pe.gettext)("KPI documentation"))),ae&&!(0,pe.default)(re)&&se.default.createElement(pt,{"data-test-itsi":"kpi-thresholding-preview-service-control-group",label:(0,Pe.gettext)("Preview service"),labelPosition:"top"},se.default.createElement(xe.default,{"data-test-itsi":"kpi-thresholding-service-select",value:ye,onChange:Q,disabled:ne},U.map(s=>se.default.createElement(xe.default.Option,{label:s.title,value:s._key,key:s._key})))),ne?se.default.createElement(ct,null,se.default.createElement(ht,{src:(0,Ae.createStaticURL)("".concat($e.STATIC_IMAGES_BASE_URL).concat("no_dashboard.svg")),"data-test-itsi":"no-chart-preview-image"}),se.default.createElement(ut,{"data-test-itsi":"no-chart-preview-image"},(0,Pe.gettext)("Threshold previews will be displayed after saving the service template and propagating the changes to linked services."))):Ie?se.default.createElement(tt,null,se.default.createElement(at,{size:"large"}),se.default.createElement(lt,null,(0,Pe.gettext)("Applying adaptive thresholds based on an analysis of your KPI..."))):se.default.createElement(ot,null,se.default.createElement(ze.default,{isEntityLevelPreview:!1,thresholdData:re,getTimeInIso:!0,showBorder:!1,showTitle:!1,svgWidth:Qe,useRawSearch:V,isReadOnly:j,isServiceTemplate:ae})),N===Be.HEALTH_ANALYTICS_RECOMMENDATIONS_SEARCH_RETRIEVE_STATUS.IN_PROGRESS||N===Be.HEALTH_ANALYTICS_RECOMMENDATIONS_RESULTS_RETRIEVE_STATUS.IN_PROGRESS?se.default.createElement(Ue.default,{message:(0,Pe.gettext)("Your KPI recommendations are loading. This process could take up to 5 minutes. Do not navigate away or save changes until complete.")}):se.default.createElement(dt,null,se.default.createElement(ft,null,se.default.createElement(gt,{activeTabId:Se,onChange:qt,"data-test-itsi":"kpi-thresholding-configuration-tab-bar"},$e.THRESHOLDING_TABS.reduce((s,o)=>(o.value===$e.THRESHOLDING_TABS[0].value&&!Et||j&&o.value===$e.THRESHOLDING_TABS[3].value||s.push(se.default.createElement(we.default.Tab,{key:o.value,label:o.label,tabId:o.value,icon:o.value===$e.THRESHOLDING_TABS[1].value&&(xt||(0,pe.default)(Zt)&&!(0,pe.default)(Ct))?bt:"","data-test-itsi":"kpi-thresholding-".concat(o.value.split("_").join("-"),"-tab")})),s),[])),(0,pe.default)(Zt)&&se.default.createElement(mt,{onClick:Xt},se.default.createElement(ke.default,null)," ",(0,Pe.gettext)("Save as template"))),Et&&Se===$e.THRESHOLDING_TABS[0].value&&se.default.createElement(We.default,{aiSummaryInfo:{objectType:"kpi",currentThreshold:$e.THRESHOLD_TYPE_OPTIONS.filter(s=>s.value===(0,Xe.getThresholdType)(re))[0],recommendationError:oe.get("recommendation_error_type")||"",thresholdInfo:{adaptiveTrainingWindow:re.adaptiveTrainingWindow,atRecommendationInfo:re.atRecommendationInfo},timeVariateThresholdsSpecification:re.timeVariateThresholdsSpecification,isOutlierDetectionEnabled:re.isOutlierDetectionEnabled,outlierDetectionAlgorithm:re.outlierDetectionAlgorithm,aggregateThresholdsConfig:re.aggregateThresholdsConfig},feedBackContent:(()=>{var s,o={adaptive_thresholding_training_window:re.adaptiveTrainingWindow,itsi_kpi_id:re._key};if(re.outlier_detection_algo&&(o.outlier_detection_algo=re.outlier_detection_algo),re.outlier_detection_sensitivity&&(o.outlier_detection_sensitivity=re.outlier_detection_sensitivity),re.threshold_direction&&(o.threshold_direction=re.threshold_direction),null!==(s=oe.get("threshold_recommendations"))&&void 0!==s&&s.length){var _=oe.get("threshold_recommendations")[0];_.Score&&(o.score=_.Score),_["Time Policy Description"]&&(o.description=_["Time Policy Description"]),_.itsi_kpi_id&&(o.itsi_kpi_id=_.itsi_kpi_id)}return re.threshold_direction&&(o.threshold_direction=re.threshold_direction),re.threshold_direction&&(o.threshold_direction=re.threshold_direction),re.atRecommendationInfo.lastRun&&(o.last_run=re.atRecommendationInfo.lastRun),{recommendationInfo:o}})(),handleGoToAISettings:Qt,handleGoToThresholdType:ei,handleGoToThresholdLevels:ti,handleClearAIRecommendationError:ii,shouldAllowRemoval:!0}),Se===$e.THRESHOLDING_TABS[1].value&&se.default.createElement(Ye.default,{appsData:o,isApplyingAdaptiveThresholds:Ie,isRecommendationConfigured:Et,handleUpdateAdaptiveThresholding:Yt,handleRevertAIThresholdSettings:Kt,handleThresholdTypeChange:Wt,handleThresholdDataUpdate:Gt,selectedThresholdTemplate:Zt,previousThresholdTemplate:Ct,thresholdData:re,isRecommendationUnlinked:xt,unlinkAIRecommendation:Ft,isReadOnly:j,selectedObject:ee,hadCopyKPIToEntityThresholds:ie,openAIThresholdingControls:Ee,thresholdTemplateCollection:_,previewServiceCache:K,serviceTemplateKey:W}),Se===$e.THRESHOLDING_TABS[2].value&&se.default.createElement(qe.default,{isEntityLevelPreview:!1,thresholdObj:re,onThresholdUpdate:Ut,isReadOnly:j,width:Qe,height:500,showPreviewChart:!ne}),Se===$e.THRESHOLDING_TABS[3].value&&se.default.createElement(Ge.default,null),se.default.createElement(vt,{"data-test-itsi":"kpi-thresholding-save-threshold-template-modal",open:Rt,onRequestClose:Xt},se.default.createElement(Te.default.Header,{onRequestClose:Xt,title:(0,Pe.gettext)("Save as new threshold template")}),se.default.createElement(Te.default.Body,null,se.default.createElement("div",{"data-test-itsi":"kpi-threshold-template-save-as-info-text"},(0,Pe.gettext)("Save this configuration as a new threshold template. This template will only preserve your KPI thresholds and default settings for entities. Threshold values for individual entities will not be included in the template.")),se.default.createElement(yt,{"data-test-itsi":"kpi-threshold-template-save-title-control-group",label:(0,Pe.gettext)("Threshold template title"),error:Mt,help:ai,required:!0},se.default.createElement(Re.default,{"data-test-itsi":"kpi-threshold-template-save-title-text",value:At,onChange:zt,placeholder:(0,Pe.gettext)("required")})),se.default.createElement(yt,{label:(0,Pe.gettext)("Description")},se.default.createElement(_t,{"data-test-itsi":"kpi-threshold-template-save-description-text",inline:!0,onChange:$t,placeholder:(0,Pe.gettext)("optional"),value:Dt,name:"description"}))),se.default.createElement(Te.default.Footer,null,se.default.createElement(ve.default,{"data-test-itsi":"kpi-thresholding-save-threshold-template-modal-cancel-button",label:(0,Pe.gettext)("Cancel"),onClick:Xt}),se.default.createElement(ve.default,{"data-test-itsi":"kpi-thresholding-save-threshold-template-modal-save-button",disabled:Nt,label:Nt?(0,Pe.gettext)("Saving..."):(0,Pe.gettext)("Save"),appearance:"primary",error:Mt,onClick:Jt})))))}KpiThresholdingControlsContainer.defaultProps={isReadOnly:!1,linkedServices:[],previewServiceCache:{},serviceTemplateKey:"",openToThresholdLevelsTab:!1},KpiThresholdingControlsContainer.propTypes={appsData:de.default.object.isRequired,recommendationSearchSid:de.default.string.isRequired,recommendationSearchStatus:de.default.string.isRequired,recommendationSearchErrorMessage:de.default.string.isRequired,recommendationResults:de.default.object.isRequired,handleSelectedServiceChange:de.default.func.isRequired,healthAnalyticsConsoleRecommendationsResultsRetrieveAction:de.default.func.isRequired,healthAnalyticsConsoleRecommendationsSearchResetAction:de.default.func.isRequired,thresholdTemplateCollection:de.default.object.isRequired,useRawSearch:de.default.bool.isRequired,isReadOnly:de.default.bool,previewServiceCache:de.default.object,selectedKpi:de.default.object.isRequired,serviceTemplateKey:de.default.string,linkedServices:de.default.array,openToThresholdLevelsTab:de.default.bool,kpiThresholdTemplateResetAction:de.default.func.isRequired,kpiThresholdTemplateCreateAction:de.default.func.isRequired,kpiThresholdTemplateApiStatus:de.default.string.isRequired};o.default=(0,le.connect)(s=>({recommendationSearchSid:s.healthAnalyticsConsole.recommendationSearchSid,recommendationSearchStatus:s.healthAnalyticsConsole.recommendationSearchStatus,recommendationSearchErrorMessage:s.healthAnalyticsConsole.recommendationSearchErrorMessage,recommendationResults:s.healthAnalyticsConsole.recommendationResults,kpiThresholdTemplateApiStatus:s.kpiThresholdTemplate.apiStatus}),s=>(0,oe.bindActionCreators)({healthAnalyticsConsoleRecommendationsResultsRetrieveAction:He.healthAnalyticsConsoleRecommendationsResultsRetrieve,healthAnalyticsConsoleRecommendationsSearchResetAction:He.healthAnalyticsConsoleRecommendationsSearchReset,kpiThresholdTemplateResetAction:Qe.kpiThresholdTemplateReset,kpiThresholdTemplateCreateAction:Qe.kpiThresholdTemplateCreate},s))(KpiThresholdingControlsContainer);s.exports=o.default},2663:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(8)),D=S(_(7)),N=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),V=S(_(2)),j=S(_(81)),K=S(_(201)),W=S(_(283)),U=S(_(27)),Y=S(_(44)),$=S(_(369)),X=S(_(103)),Z=_(22),Q=_(4),ee=_(306),te=_(61),ie=_(110),ae=S(_(1462));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,P.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var ne=(0,V.default)(X.default)(R||(R=(0,D.default)(["\n margin: 10px 0px 5px 10px;\n"]))),re=(0,V.default)(U.default)(O||(O=(0,D.default)(["\n color: ",";\n margin-top: 10px;\n margin-left: ","px;\n"])),Z.variables.linkColor,s=>s.leftMargin),se=N.default.createElement(W.default,null);o.default=function AlertRulesControls(){var{kpiData:s,updateKpiData:o,selectedKpiModel:_}=(0,N.useContext)(ee.ThresholdingContext),S=s.kpiCustomAlertRules,R=s.isKpiCustomAlertingEnabled,O=(0,N.useCallback)(()=>S&&0!==S.length&&R?"custom":"all",[S,R]),P=(0,N.useCallback)(()=>{var s=(0,ie.getSortedThresholdValues)().map(s=>s.value),o=S.map(s=>s.change_to);return(0,K.default)(s,o)},[S]),[D,V]=(0,N.useState)(P()),[W,U]=(0,N.useState)(O()),[X,Z]=(0,N.useState)(S),le=(0,N.useCallback)(()=>{var S=_objectSpread({},s);S.isKpiAlertingEnabled=!s.isKpiAlertingEnabled,o(S),_.set("aggregate_thresholds_alert_enabled",!s.isKpiAlertingEnabled)},[o,s,_]),computeAvailableSeverities=s=>{var o=(0,ie.getSortedThresholdValues)().map(s=>s.value),_=s.map(s=>s.change_to);return(0,K.default)(o,_)},oe=(0,N.useCallback)((S,R)=>{var{value:O}=R;U(O);var P=_objectSpread({},s);if("all"===O)Z([]),P.isKpiCustomAlertingEnabled=!1,P.kpiCustomAlertRules=[],_.set({aggregate_thresholds_custom_alert_rules:[],aggregate_thresholds_custom_alert_enabled:!1});else{var D=[{change_to:"critical",change_from:["high","medium","low","normal","info"]}],N=computeAvailableSeverities(D);V(N),Z(D),P.isKpiCustomAlertingEnabled=!0,P.kpiCustomAlertRules=D,_.set({aggregate_thresholds_custom_alert_rules:D,aggregate_thresholds_custom_alert_enabled:!0})}o(P)},[o,s,_]),onClickRemoveRule=S=>{var R=X.filter(s=>s.change_to!==S),O=computeAvailableSeverities(R);V(O),Z(R);var P=_objectSpread({},s);P.kpiCustomAlertRules=R,_.set({aggregate_thresholds_custom_alert_rules:R,aggregate_thresholds_custom_alert_enabled:!0}),o(P)},onUpdateToSeverity=(S,R)=>{var O=(0,j.default)(X),P=O.findIndex(s=>s.change_to===S);O[P].change_to=R,O[P].change_from=O[P].change_from.filter(s=>s!==R);var D=computeAvailableSeverities(O);V(D),Z(O);var N=_objectSpread({},s);N.kpiCustomAlertRules=O,_.set({aggregate_thresholds_custom_alert_rules:O}),o(N)},onUpdateFromSeverityRule=(S,R)=>{var O=(0,j.default)(X),P=O.findIndex(s=>s.change_to===S);O[P].change_from=R;var D=computeAvailableSeverities(O);V(D),Z(O);var N=_objectSpread({},s);N.kpiCustomAlertRules=O,_.set({aggregate_thresholds_custom_alert_rules:O}),o(N)},de=(0,N.useCallback)(()=>{if(D.length>0){var S=(0,j.default)(X);S.push({change_to:D[0],change_from:[]});var R=computeAvailableSeverities(S);V(R),Z(S);var O=_objectSpread({},s);O.kpiCustomAlertRules=S,_.set({aggregate_thresholds_custom_alert_rules:S}),o(O)}},[X,D,o,s,_]);return N.default.createElement("div",{"data-test-itsi":"kpi-alerting-settings-container"},N.default.createElement(ne,{"data-test-itsi":"kpi-alerting-switch",key:"kpi-alerting-switch",value:"kpi-alerting-switch",onClick:le,selected:s.isKpiAlertingEnabled,appearance:"toggle"},s.isKpiAlertingEnabled?(0,Q.gettext)("Active"):(0,Q.gettext)("Inactive")),s.isKpiAlertingEnabled&&N.default.createElement(N.default.Fragment,null,N.default.createElement(Y.default,{"data-test-itsi":"kpi-alerting-options-control-group",label:(0,Q.gettext)("Trigger a notable event for"),labelWidth:te.LABEL_WIDTHS.LongPlus},N.default.createElement($.default,{"data-test-itsi":"kpi-alerting-options-radio",value:W,onChange:oe},N.default.createElement($.default.Option,{"data-test-itsi":"kpi-alerting-all-option",value:"all"},(0,Q.gettext)("All KPI severity changes")),N.default.createElement($.default.Option,{"data-test-itsi":"kpi-alerting-custom-option",value:"custom"},(0,Q.gettext)("Specific severity changes")))),"custom"===W&&(X&&0!==X.length?X.map(s=>N.default.createElement(ae.default,{availableSeverityValues:D,fromSeverityValues:s.change_from,onClickRemoveRule:onClickRemoveRule,toSeverityValue:s.change_to,key:s.change_to,onUpdateToSeverity:onUpdateToSeverity,updateRule:onUpdateFromSeverityRule})):null),"custom"===W&&D.length>0&&N.default.createElement(re,{"data-test-itsi":"add-kpi-alerting-rule-button",icon:se,label:(0,Q.gettext)("Add rule"),appearance:"pill",onClick:de})))};s.exports=o.default},2664:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(45),O=S(_(15)),P=S(_(37)),D=S(_(118)),N=S(_(50)),V=_(4),j=_(14),K=_(78),W=_(163),U=_(188),Y=S(_(1464)),$=S(_(2665));_(2666);var X=(0,R.template)($.default,null,{variable:"vars"}),Z=O.default.View.extend({initialize:function initialize(s){if(!(s=s||{}).searchJob)throw"Must provide searchJob option";if(!s.percAnomaliesExpected&&0!==s.percAnomaliesExpected)throw"Must provide percAnomaliesExpected option";if(this.percAnomaliesExpected=s.percAnomaliesExpected,!s.trendingResultsModel)throw"Must provide trending results option";if(this.trendingResultsModel=s.trendingResultsModel,!s.trendingAdSettingsModel)throw"Trending AD settings model must be provided.";this.trendingAdSettingsModel=s.trendingAdSettingsModel,this.searchJob=s.searchJob,this._renderResultsChart(),O.default.View.prototype.initialize(this,arguments)},_renderResultsSummary:function _renderResultsSummary(){var s=this.trendingResultsModel.get("fractionAnomaliesDetected"),o="0";if(!(0,D.default)(this.percAnomaliesExpected)||!(0,D.default)(s))throw"Passed in percAnomaliesExpected and fractionAnomaliesDetected must be valid numbers.";o=s<.01&&0!==s?(0,j.sprintf)((0,V.gettext)("<1%% (Recommended <%s%%)"),Math.round(100*this.percAnomaliesExpected*100)/100):(0,j.sprintf)((0,V.gettext)("%s%% (Recommended <%s%%)"),Math.round(100*s*100)/100,Math.round(100*this.percAnomaliesExpected*100)/100),this.$(".kpi-anomaly-panel-trending-analysis-description-anomalies-info-value").text(o);var _=(0,j.sprintf)((0,V.gettext)("KPI Value for %s"),this.trendingResultsModel.get("analysisTimeWindow"));this.$(".kpi-anomaly-panel-trending-analysis-description-preview-info").text(_)},_renderResultsChart:function _renderResultsChart(){var s=this.trendingAdSettingsModel.getSensitivityValues(),o=(0,N.default)(s,(function(s){return"max(sensitivity_"+s+') AS "sensitivity_'+s+'"'}));o=o.join(" "),this.analysisBreakdownPostProcessSearchSubscription&&this.analysisBreakdownPostProcessSearchSubscription.unsubscribe(),this.analysisBreakdownPostProcessSearchSubscription=this.searchJob.getResults({search:'timechart bins=1000 avg(input_value) AS "alert_value" '.concat(o),offset:0,count:0}).subscribe({next:o=>{this._timeDataXAxis=[],this._alertValueDataYAxis=[],this._anomalyDataYAxis={},(0,P.default)(s,function(s){this._anomalyDataYAxis["sensitivity_"+s]=[]}.bind(this)),(0,P.default)(o.results,function(s){this._timeDataXAxis.push(new Date(s._time).toLocaleString()),s.alert_value?this._alertValueDataYAxis.push(Math.round(100*parseFloat(s.alert_value))/100):this._alertValueDataYAxis.push(0),(0,P.default)(this._anomalyDataYAxis,function(o,_){s[_]?1===parseInt(s[_])?s.alert_value?this._anomalyDataYAxis[_].push(Math.round(100*parseFloat(s.alert_value))/100):this._anomalyDataYAxis[_].push(0):(0!==parseInt(s[_])&&console.log("Anomaly value is not 0 when it should be!"),this._anomalyDataYAxis[_].push(Math.round(100*parseInt(s[_]))/100)):this._anomalyDataYAxis[_].push(0)}.bind(this))}.bind(this)),requestAnimationFrame(()=>{this._renderHighChart()}),this.listenTo(this.trendingAdSettingsModel,"change:sensitivity",(function(){this._renderHighChart()}))},error:()=>{}})},render:function render(){var s=X({percAnomaliesDetectedString:"",labelString:(0,V.gettext)("Percentage of Data Points with Anomalies:"),analysisTimeWindowString:""},{variable:"vars"});return this.$el.prepend(s),this._renderResultsSummary(),this.listenTo(this.trendingResultsModel,"change",(function(){this._renderResultsSummary()})),this},_renderHighChart:function _renderHighChart(){var s=O.default.Model.extend({}),o=O.default.Collection.extend({model:s}),_="sensitivity_"+parseInt(this.trendingAdSettingsModel.get("sensitivity"),10),S=new o([{name:"KPI Value",data:this._alertValueDataYAxis,color:U.linkColor,lineWidth:1.5,marker:{radius:0}},{name:"Detected Anomaly",data:this._anomalyDataYAxis[_],lineWidth:0,marker:{enabled:!0,fillColor:U.anomalyColor,radius:4}}]);S.length>0&&(this.highChart=new Y.default({el:"#kpi-anomaly-trending-search-preview-highchart-view",data:S,time:this._timeDataXAxis}),this.highChart.render())},remove:function remove(){return(0,W.safeRemoveView)(this,this.highChart),(0,K.cleanSearchJobSubscriptions)(this.searchJob,this.analysisBreakdownPostProcessSearchSubscription),O.default.View.prototype.remove.apply(this,arguments)}});o.default=Z;s.exports=o.default},2665:function(s,o){s.exports='<div class="kpi-anomaly-panel-trending-analysis-description">\n <div class="kpi-anomaly-panel-trending-analysis-description-anomalies-info">\n <span class="kpi-anomaly-panel-trending-analysis-description-anomalies-info-label" data-test-itsi="kpi-anomaly-panel-trending-analysis-description-anomalies-info-label">\n <%- vars.labelString %>\n </span>\n <span class="kpi-anomaly-panel-trending-analysis-description-anomalies-info-value" data-test-itsi="kpi-anomaly-panel-trending-analysis-description-anomalies-info-value">\n <%- vars.percAnomaliesDetectedString %>\n </span>\n </div>\n <div class="kpi-anomaly-panel-trending-analysis-description-preview-info" data-test-itsi="kpi-anomaly-panel-trending-analysis-description-preview-info">\n <%- vars.analysisTimeWindowString %>\n </div>\n</div>'},2666:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1086),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2667:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=S(_(356)),P=O.default.extend({tagName:"div",className:"kpi-anomaly-panel-trending-analysis-preview",initialize:function initialize(s){(s=s||{}).dataTestItsi="service-definition-trending-analysis-breakdown-collapsible-panel",s.expanded=!0,s.panelId="trendingAnalysisBreakdown",s.panelTitle=(0,R.gettext)("Analysis Breakdown"),O.default.prototype.initialize.apply(this,arguments)}});o.default=P;s.exports=o.default},2668:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(45),O=S(_(15)),P=S(_(37)),D=S(_(86)),N=S(_(118)),V=S(_(625)),j=S(_(91)),K=_(4),W=_(14),U=_(73),Y=_(78),$=_(163),X=_(188),Z=S(_(1464)),Q=S(_(2669));_(2670);var ee=(0,R.template)(Q.default,null,{variable:"vars"}),te=O.default.View.extend({initialize:function initialize(s){if(!(s=s||{}).percAnomaliesExpected&&0!==s.percAnomaliesExpected)throw"Must provide percAnomaliesExpected option";if(this.percAnomaliesExpected=s.percAnomaliesExpected,!s.cohesiveResultsModel)throw"Must provide cohesive results option";if(this.cohesiveResultsModel=s.cohesiveResultsModel,!s.parentSearchSid)throw"Must pass parentSearchSid";if(this.parentSearchSid=s.parentSearchSid,this.earliestTime=s.earliestTime,!s.cohesiveAdSettingsModel)throw"Cohesive AD settings model must be provided.";this.cohesiveAdSettingsModel=s.cohesiveAdSettingsModel,this.total_random_entities_to_show=3,this.algorithmType=s.algorithmType,this._dataValueAllZero=(0,V.default)(this.total_random_entities_to_show).map((function(){return!0})),this._entityFillColors=["#00A85D","#FFB400","#705AA0"],this._renderResultsChart(),O.default.View.prototype.initialize(this,arguments)},_renderResultsSummary:function _renderResultsSummary(){this.$(".analyzed").text(this.cohesiveResultsModel.get("entitiesAnalyzed")),this.$(".anomalies").text(this.cohesiveResultsModel.get("entitiesWithAnomalies")),this.$(".anomalies-per-entity").text(this.cohesiveResultsModel.get("averageAnomaliesPerEntity"));var s="0",o=this.cohesiveResultsModel.get("fractionAnomaliesDetected");if(!(0,N.default)(this.percAnomaliesExpected)||!(0,N.default)(o))throw"Passed in percAnomaliesExpected and fractionAnomaliesDetected must be valid numbers.";s=o<.01&&0!==o?(0,W.sprintf)((0,K.gettext)("<1%% (Recommended <%s%%)"),Math.round(100*this.percAnomaliesExpected*100)/100):(0,W.sprintf)((0,K.gettext)("%s%% (Recommended <%s%%)"),Math.round(100*o*100)/100,Math.round(100*this.percAnomaliesExpected*100)/100),this.$(".perc-anomalies").text(s);var _=(0,K.gettext)("Not enough data to generate the preview chart.");0!==this.cohesiveResultsModel.get("entitiesWithAnomalies")&&(_=(0,W.sprintf)((0,K.gettext)("%s Anomalous Entity KPI values for %s"),this.total_random_entities_to_show,this.cohesiveResultsModel.get("analysisTimeWindow"))),this.$(".kpi-anomaly-panel-cohesive-analysis-description-preview-info").text(_)},_renderResultsChart:function _renderResultsChart(){this.anomalyXYSeries={};var s=this.cohesiveAdSettingsModel.getSensitivityValues();(0,P.default)(s,function(s){this.anomalyXYSeries[s]={},this.analysisBreakdownLoadjobSearchJob=j.default.create({id:(0,Y.createUniqueSearchId)("cohesive-ad-per-entity-analysis-".concat(s)),earliest_time:this.earliestTime,latest_time:"now",cache:600,status_buckets:0,sample_ratio:null,search:"| loadjob ".concat(this.parentSearchSid," | bin _time bins=1000 ")+"| stats avg(input_value) as value sum(sensitivity_"+s+") as alert by entity_id, _time | eventstats max(alert) as has_alert by entity_id | where has_alert>0 | xyseries _time entity_id alert,value",time_format:"%s.%Q",auto_cancel:90},{app:(0,U.getShortAppName)(!0)}),this.analysisBreakdownLoadjobSearchSubscription=this.analysisBreakdownLoadjobSearchJob.getResults({offset:0,count:0}).subscribe({next:o=>{var _={};if(o.results&&(_.rows=o.results.map(s=>Object.values(s))),o.fields&&(_.fields=o.fields.map(s=>s.name)),0===o.results.length)this.anomalyXYSeries[s]={dataValueAllZero:[],alertValues:[[]],alertAnomalies:[[]],timeDataXAxis:[]};else{for(var S=_.fields.length-1,R=0,O=!0,P=[[]],D=[[]],N=[],V=[!0,!0,!0];R<this.total_random_entities_to_show&&O;){P[R]=[],D[R]=[],V[R]=!1;for(var j=0;j<o.results.length;j++){var K=_.rows[j],W=K[R+1+(_.fields.length-1)/2];W||(W=0);var U=parseFloat(K[R+1]);U>0&&(U=W),P[R].push(parseFloat(W)),D[R].push(parseFloat(U)),N.length!==o.results.length&&N.push(new Date(K[0]).toLocaleString())}0===(S-=2)&&(O=!1),R++}this.anomalyXYSeries[s]={dataValueAllZero:V,alertValues:P,alertAnomalies:D,timeDataXAxis:N}}parseInt(this.cohesiveAdSettingsModel.get("sensitivity"),10)===s&&this._renderHighChart()},error:()=>{this.$(".kpi-anomaly-panel-cohesive-analysis-description-preview-info").text((0,K.gettext)("Not enough data to generate the preview chart."))}})}.bind(this)),this.listenTo(this.cohesiveAdSettingsModel,"change:sensitivity",(function(){this._renderHighChart()}))},render:function render(){var s=ee({entitiesAnalyzedLabel:(0,K.gettext)("Entities Analyzed:"),entitiesAnalyzed:"",entitiesWithAnomaliesLabel:(0,K.gettext)("Entities with Detected Anomalies:"),entitiesWithAnomalies:"",averageAnomaliesPerEntityLabel:(0,K.gettext)("Average Anomalies Per Entity:"),averageAnomaliesPerEntity:"",percAnomaliesDetectedString:"",labelString:(0,K.gettext)("Percentage of Data Points with Anomalies:"),analysisTimeWindowString:""},{variable:"vars"});return this.$el.prepend(s),this._renderResultsSummary(),this.listenTo(this.cohesiveResultsModel,"change",(function(){this._renderResultsSummary()})),this},_renderHighChart:function _renderHighChart(){for(var s,o=O.default.Model.extend({}),_=new(O.default.Collection.extend({model:o})),S=this.anomalyXYSeries[parseInt(this.cohesiveAdSettingsModel.get("sensitivity"),10)]||{},R=0;R<this.total_random_entities_to_show;R++)if((0,D.default)(S.dataValueAllZero)&&S.dataValueAllZero.length>R&&!S.dataValueAllZero[R]){var P=[];(0,D.default)(S.alertValues)&&S.alertValues.length>R&&(P=S.alertValues[R]),_.add(new o({name:(0,W.sprintf)((0,K.gettext)("Entity %s Value"),R+1),data:P,color:this._entityFillColors[R],lineWidth:1.5,marker:{radius:0}}));var N=[];(0,D.default)(S.alertAnomalies)&&S.alertAnomalies.length>R&&(N=S.alertAnomalies[R]),_.add(new o({name:(0,W.sprintf)((0,K.gettext)("Entity %s Anomaly"),R+1),data:N,lineWidth:0,marker:{enabled:!0,fillColor:X.anomalyColor,radius:4}}))}_.length>0?(this.highChart&&this.highChart.$el.show(),this.highChart=new Z.default({el:"#kpi-anomaly-cohesive-search-preview-highchart-view",data:_,time:S.timeDataXAxis}),this.highChart.render()):null===(s=this.highChart)||void 0===s||null===(s=s.$el)||void 0===s||s.hide()},cleanupSearchJob:function cleanupSearchJob(){(0,Y.cleanSearchJobSubscriptions)(this.analysisBreakdownLoadjobSearchJob,this.analysisBreakdownLoadjobSearchSubscription)},remove:function remove(){return this.anomalyXYSeries={},this.cleanupSearchJob(),(0,$.safeRemoveView)(this,this.highChart),O.default.View.prototype.remove.apply(this,arguments)}});o.default=te;s.exports=o.default},2669:function(s,o){s.exports='<div class="kpi-anomaly-panel-cohesive-analysis-description">\n <div class="kpi-anomaly-panel-trending-analysis-description-anomalies-info">\n <div class="kpi-anomaly-panel-cohesive-analysis-description">\n <span class="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-label" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-label">\n <%- vars.entitiesAnalyzedLabel %>\n </span>\n <span class="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-value analyzed" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-value-analyzed">\n <%- vars.entitiesAnalyzed %>\n </span>\n </div>\n <div class="kpi-anomaly-panel-cohesive-analysis-description">\n <span class="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-label" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-label">\n <%- vars.entitiesWithAnomaliesLabel %>\n </span>\n <span class="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-value anomalies" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-value-anomalies">\n <%- vars.entitiesWithAnomalies %>\n </span>\n </div>\n <div class="kpi-anomaly-panel-cohesive-analysis-description">\n <span class="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-label" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-label">\n <%- vars.averageAnomaliesPerEntityLabel %>\n </span>\n <span class="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-value anomalies-per-entity" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-value-anomalies-per-entity">\n <%- vars.averageAnomaliesPerEntity %>\n </span>\n </div>\n <div>\n <span class="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-label" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-label">\n <%- vars.labelString %>\n </span>\n <span class="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-value perc-anomalies" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-anomalies-info-value-perc-anomalies">\n <%- vars.percAnomaliesDetectedString %>\n </span>\n </div>\n </div>\n <div class="kpi-anomaly-panel-cohesive-analysis-description-preview-info" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-description-preview-info">\n <%- vars.analysisTimeWindowString %>\n </div>\n</div>'},2670:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1087),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2671:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=S(_(356)),P=O.default.extend({tagName:"div",className:"kpi-anomaly-panel-cohesive-analysis-preview",initialize:function initialize(s){(s=s||{}).dataTestItsi="service-definition-cohesive-analysis-breakdown-collapsible-panel",s.expanded=!0,s.panelId="cohesiveAnalysisBreakdown",s.panelTitle=(0,R.gettext)("Analysis Breakdown"),O.default.prototype.initialize.apply(this,arguments)}});o.default=P;s.exports=o.default},2672:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(15)),O=S(_(0)),P=S(_(35)),D=_(29),N=S(_(1427)),V=S(_(47)),j=R.default.View.extend({attributes:{"data-test-itsi":"slider-view"},tagName:"div",className:"slider-container",initialize:function initialize(s){if(R.default.View.prototype.initialize.apply(this,arguments),!s)throw"Must provide all required options";if((0,D.isUndefinedOrNull)(s.min))throw"Must provide min option";if((0,D.isUndefinedOrNull)(s.max))throw"Must provide max option";(0,D.isUndefinedOrNull)(s.step)&&(s.step=1),this.options=s,this.sliderRef=null,this.listenTo(this.model,"change:"+this.options.modelAttribute,this.updateSlider)},handleChange:function handleChange(s){this.model.set(this.options.modelAttribute,s)},updateSlider:function updateSlider(){this.sliderRef.setValue(Number(this.model.get(this.options.modelAttribute)))},render:function render(){return this.$el.html('<div class="slider-placeholder"></div>'),P.default.unmountComponentAtNode(this.$el.find(".slider-placeholder").get(0)),P.default.render(O.default.createElement(V.default,null,O.default.createElement(N.default,{dataTestItsi:this.options.dataTestItsi,initialValue:Number(this.model.get(this.options.modelAttribute)),min:this.options.min,max:this.options.max,onChange:this.handleChange.bind(this),ref:s=>this.sliderRef=s,step:this.options.step})),this.$el.find(".slider-placeholder").get(0)),this}});o.default=j;s.exports=o.default},2673:function(s,o){s.exports='<div class="kpi-anomaly-panel-upper-section">\n\t<div class="kpi-anomaly-panel-explanation-container" data-test-itsi="kpi-anomaly-panel-explanation-container"></div>\n\t<div class="kpi-anomaly-panel-analysis-window-config-container"></div>\n\t<div class="kpi-anomaly-panel-analysis-container-read-only"></div>\n\t<div class="kpi-anomaly-panel-analysis-container">\n\t\t<div class="kpi-anomaly-panel-trending-analysis-container">\n\t\t\t<div class="kpi-anomaly-panel-trending-analysis-result">\n\t\t\t\t<div class="kpi-anomaly-panel-trending-analysis-config-result-label" data-test-itsi="kpi-anomaly-panel-trending-analysis-config-result-label"></div>\n\t\t\t\t<div class="kpi-anomaly-panel-trending-analysis-config-result-pane kpi-anomaly-panel-trending-analysis-config-result-pane-start" data-test-itsi="kpi-anomaly-panel-trending-analysis-config-result-pane-start"></div>\n\t\t\t\t<div class="kpi-anomaly-panel-trending-analysis-config-result-pane kpi-anomaly-panel-trending-analysis-config-result-pane-processing" data-test-itsi="kpi-anomaly-panel-trending-analysis-config-result-pane-processing" style="display:none">\n\t\t\t\t\t<div class="kpi-anomaly-panel-analysis-config-result kpi-anomaly-panel-trending-analysis-config-result-processing" data-test-itsi="kpi-anomaly-panel-trending-analysis-config-result-processing"></div>\n\t\t\t\t</div>\n\t\t\t\t <div class="kpi-anomaly-panel-trending-analysis-config-result-pane kpi-anomaly-panel-trending-analysis-config-result-pane-end" data-test-itsi="kpi-anomaly-panel-trending-analysis-config-result-pane-end" style="display:none">\n\t\t\t\t\t<div class="kpi-anomaly-panel-analysis-config-result kpi-anomaly-panel-trending-analysis-config-result-end" data-test-itsi="kpi-anomaly-panel-trending-analysis-config-result-end"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="kpi-anomaly-panel-trending-analysis-config kpi-anomaly-panel-ad-config" data-test-itsi="kpi-anomaly-panel-trending-analysis-config"></div>\n\t\t\t<div class="kpi-anomaly-panel-analysis-preview-container kpi-anomaly-panel-trending-analysis-preview-container" data-test-itsi="kpi-anomaly-panel-trending-analysis-preview-container"></div>\n\t\t</div>\n\t\t<div class="kpi-anomaly-panel-cohesive-analysis-container">\n\t\t\t<div class="kpi-anomaly-panel-cohesive-analysis-result">\n\t\t\t\t<div class="kpi-anomaly-panel-cohesive-analysis-config-result-label" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-config-result-label"></div>\n\t\t\t\t<div class="kpi-anomaly-panel-cohesive-analysis-config-result-pane kpi-anomaly-panel-cohesive-analysis-config-result-pane-start" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-config-result-pane-start"></div>\n\t\t\t\t<div class="kpi-anomaly-panel-cohesive-analysis-config-result-pane kpi-anomaly-panel-cohesive-analysis-config-result-pane-processing" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-config-result-pane-processing" style="display:none">\n\t\t\t\t\t<div class="kpi-anomaly-panel-analysis-config-result kpi-anomaly-panel-cohesive-analysis-config-result-processing" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-config-result-processing"></div>\n\t\t\t\t</div>\n\t\t\t\t <div class="kpi-anomaly-panel-cohesive-analysis-config-result-pane kpi-anomaly-panel-cohesive-analysis-config-result-pane-end" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-config-result-pane-end" style="display:none">\n\t\t\t\t\t<div class="kpi-anomaly-panel-analysis-config-result kpi-anomaly-panel-cohesive-analysis-config-result-end" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-config-result-end"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="kpi-anomaly-panel-cohesive-analysis-config kpi-anomaly-panel-ad-config" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-config"></div>\n\t\t\t<div class="kpi-anomaly-panel-analysis-preview-container kpi-anomaly-panel-cohesive-analysis-preview-container" data-test-itsi="kpi-anomaly-panel-cohesive-analysis-preview-container"></div>\n\t\t</div>\n\t</div>\n</div>\n'},2674:function(s,o){s.exports='<div class="kpi-anomaly-trending-search-preview-chart">\n <div id="kpi-anomaly-trending-search-preview-highchart-view" class="dashboard-element chart" style="width: 100%"></div>\n</div>'},2675:function(s,o){s.exports='<div class="kpi-anomaly-cohesive-search-preview-chart">\n <div id="kpi-anomaly-cohesive-search-preview-highchart-view" class="dashboard-element chart" style="width: 100%"></div>\n</div>'},2676:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1088),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2677:function(s,o){s.exports='<div class="sidebar-layout-container">\n\t<div class="sidebar-layout-header"></div>\n\t<div>\n\t\t<table class="side-bar-layout-table" data-test-itsi="side-bar-layout-table">\n\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class="sidebar-layout-sidebar-td" data-test-itsi="side-bar-layout-table-sidebar">\n\t\t\t\t\t\t<div class="sidebar-layout-sidebar"></div>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class="sidebar-layout-main-td" data-test-itsi="side-bar-layout-table-main">\n\t\t\t\t\t\t<div class="sidebar-layout-main"></div>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</tbody>\n\t\t</table>\n\t</div>\n</div>'},2678:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1089),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2679:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(7)),P=S(_(32)),D=S(_(0)),N=S(_(35)),V=S(_(150)),j=S(_(2)),K=S(_(2680)),W=S(_(27)),U=S(_(89)),Y=_(4),$=_(14),X=_(61),Z=S(_(162)),Q=S(_(377)),ee=_(175),te=_(57),ie=_(145),ae=_(294),ne=S(_(77)),re=S(_(559)),se=S(_(1421)),le=S(_(1748)),oe=S(_(2401)),de=S(_(2681)),ce=S(_(598)),he=S(_(47)),ue=S(_(1193));_(2683);var pe={maxHeight:"400px",overflow:"scroll"},fe=j.default.div(R||(R=(0,O.default)(["\n\tmax-width: 60ch;\n\tword-wrap: break-word;\n"]))),ge=D.default.createElement(fe,null,(0,$.sprintf)((0,Y.gettext)("Indicates that the KPI is linked to an active %(objectName)s"),{objectName:ae.OBJECT_NAMES.singular})),me=oe.default.extend({title:(0,Y.gettext)("KPIs"),initialize:function initialize(s){this.serviceModel=s.serviceModel,this.examples=new ue.default,this.exampleDfd=this.examples.fetch({data:{filter:this.serviceModel.getSecGrpMembershipFilter()}}),this.readOnly=s.readOnly,oe.default.prototype.initialize.call(this,arguments)},triggerClickCloneKPI:function triggerClickCloneKPI(){this.serviceModel.trigger("clickCloneKPI")},triggerClickNewKPI:function triggerClickNewKPI(s){this.serviceModel.trigger("clickNewKPI",s)},render:function render(){if(oe.default.prototype.render.apply(this,arguments),!this.readOnly){var s=this.serviceModel.get("object_type")===ee.OBJECT_TYPE;this.$el.append('<div class="actions pull-right" data-test-itsi="kpi-list-view-actions"><div class="kpi-list-view-button-placeholder" style="display: inline-block; margin-right: 10px"></div><div class="kpi-list-view-placeholder" style="display: inline-block"></div></div>'),s?N.default.render(D.default.createElement(he.default,null,D.default.createElement(W.default,{"data-test-itsi":"kpi-create-button",label:(0,Y.gettext)("New KPI"),onClick:this.triggerClickNewKPI.bind(this)})),this.$(".kpi-list-view-button-placeholder").get(0)):N.default.render(D.default.createElement(he.default,null,D.default.createElement(W.default,{"data-test-itsi":"kpi-clone-button",label:(0,Y.gettext)("Clone"),onClick:this.triggerClickCloneKPI.bind(this)})),this.$(".kpi-list-view-button-placeholder").get(0)),this.exampleDfd.done(()=>{for(var s=[{dataTestItsi:"new-generic-kpi-item-option",label:(0,Y.gettext)("Generic KPI"),handleClick:this.triggerClickNewKPI.bind(this)}],o=0;o<this.examples.length;++o)this._addExampleCollection(s,this.examples.at(o));N.default.render(D.default.createElement(he.default,null,D.default.createElement(Q.default,{buttonAppearance:"default",buttonLabel:(0,Y.gettext)("New"),dataTestItsiButton:"kpi-create-dropdown-button",dataTestItsiDropdown:"kpi-create-dropdown",menuStyle:pe,options:s})),this.$(".kpi-list-view-placeholder").get(0))}).fail(()=>{})}return this},getExamplesCollection:function getExamplesCollection(){return this.examples},_addExampleCollection:function _addExampleCollection(s,o){var _=this,lowerCaseFlat=s=>s.toLowerCase().replaceAll(" ","-").replace(":",""),S=o.get("title");s.push({dataTestItsi:"new-kpi-item-option-".concat(lowerCaseFlat(S)),title:S});for(var R=o.get("kpis").primarykpis,O=function _loop(){var S=o.id,O=R.at(P).get("title"),D=R.at(P).id,N="".concat(lowerCaseFlat(S),"-").concat(lowerCaseFlat(O));s.push({dataTestItsi:"new-kpi-item-option-".concat(N),label:O,handleClick:()=>_.triggerClickNewKPI({"data-collection":S,"data-id":D})})},P=0;P<R.length;++P)O()}}),ve=le.default.extend({initialize:function initialize(s){this.readOnly=s.readOnly,this.serviceTemplate=s.serviceTemplate,this.serviceModel=s.serviceModel,this.sdDispatcher=s.sdDispatcher,le.default.prototype.initialize.apply(this,arguments),this.children={},this.children.deleteButton=new ne.default({appearance:"pill",dataTestItsi:"remove-kpi-button",icon:"clear",onClick:this._onDelete.bind(this),screenReaderText:(0,Y.gettext)("Delete KPI"),style:{marginRight:5},wrapperStyle:"float:right;vertical-align:top"}),this.children.lockIcon=new re.default({dataTestItsi:"kpi-from-service-template-locked-icon",dataTestItsiTooltip:"kpi-from-service-template-locked-icon-tooltip",hasTooltip:!0,style:{fontSize:15},tooltipContent:(0,$.sprintf)((0,Y.gettext)("KPI linked to service template %(serviceTemplateName)s."),{serviceTemplateName:this.serviceTemplate?this.serviceTemplate.get("title"):""}),type:"lock"})},_renderActiveCustomThresholdWindowIcon:function _renderActiveCustomThresholdWindowIcon(){var s=(0,P.default)('<div class="kpi-list-row-custom-threshold-window-icon-container"></div>');return N.default.unmountComponentAtNode(s.get(0)),N.default.render(D.default.createElement(he.default,null,D.default.createElement(U.default,{"data-test-itsi":"kpi-list-row-custom-threshold-window-icon-tooltip",contentRelationship:"label",content:ge},D.default.createElement(K.default,{"data-test-itsi":"kpi-list-row-custom-threshold-window-icon",hideDefaultTooltip:!0,variant:"filled"}))),s.get(0)),s},render:function render(){return le.default.prototype.render.apply(this,arguments),this.$el.append('<div class="kpi-list-row-indicator-icons"></div>'),this.model.get("base_service_template_id")&&this.serviceModel.get("object_type")===te.OBJECT_TYPE&&(this.$el.find(".collection-list-row-content").addClass("short-item-lock-icon"),this.$el.find(".kpi-list-row-indicator-icons").append('<div class="kpi-list-row-lock-icon-container"><span class="kpi-from-service-template-locked-icon-wrapper"></span></div>'),this.$el.find(".kpi-from-service-template-locked-icon-wrapper").html(this.children.lockIcon.render().$el)),this.serviceModel.get("object_type")===te.OBJECT_TYPE&&(0,ie.hasActiveCustomThresholdWindow)(this.model.toJSON())&&this.$el.find(".kpi-list-row-indicator-icons").append(this._renderActiveCustomThresholdWindowIcon()),this.readOnly||this.$el.append(this.children.deleteButton.render().$el),this},primaryButtonClickedAction:function primaryButtonClickedAction(){this.$el.trigger("deletekpi",this.model.id)},_onDelete:function _onDelete(){if(this.serviceTemplate&&this.model.get("base_service_template_id"))this._showUnlinkWarningModal();else{var s=this.$el.parents(".collection-list-container").find(".collection-list-modal-container");N.default.unmountComponentAtNode(s.get(0)),N.default.render(D.default.createElement(he.default,null,D.default.createElement(Z.default,{modalDataTestItsi:"kpi-list-view-delete-modal",cancelButtonDataTestItsi:"kpi-list-view-modal-cancel-button",primaryButtonDataTestItsi:"kpi-list-view-modal-delete-button",showCancel:!0,open:!0,modalStyles:X.CONFIRMATION_MODAL_STYLE,title:(0,Y.gettext)("Delete KPI"),primaryButtonLabel:(0,Y.gettext)("Delete"),primaryButtonClicked:this.primaryButtonClickedAction.bind(this)},D.default.createElement("span",{"data-test-itsi":"delete-service-kpi-message"},(0,$.sprintf)((0,Y.gettext)("Are you sure you want to delete %s?"),(0,V.default)(this.model.get("title")))))),s.get(0))}},_showUnlinkWarningModal:function _showUnlinkWarningModal(){var s=(0,P.default)('<div class="unlink-warning-modal"></div>');N.default.unmountComponentAtNode(s.get(0)),N.default.render(D.default.createElement(he.default,null,D.default.createElement(ce.default,{modalTitleSubstring:(0,Y.gettext)("Delete KPI"),serviceTitle:this.serviceModel.get("title"),serviceTemplateTitle:this.serviceTemplate.get("title"),serviceTemplateUrl:this.serviceTemplate.getEditUrl(),isModalOpen:!0,handleAcceptToUnlink:this.handleAcceptToUnlink.bind(this)})),s.get(0))},handleAcceptToUnlink:function handleAcceptToUnlink(){this.sdDispatcher.trigger("unsetBaseServiceTemplateId",this.serviceModel),this.sdDispatcher.trigger("unlink"),this.serviceModel.deleteKpi(this.model.id)},select:function select(){this.isSelected()||(this.toggleSelect(),this.trigger("selectionchange",this,this.selected))}}),ye=se.default.extend({attributes:{"data-test-itsi":"kpi-list-view"},className:"kpi-list-view",events:{deletekpi:"_onDeleteKpi"},initialize:function initialize(s){this.readOnly=s.readOnly,this.service=s.service,this.serviceTemplate=s.serviceTemplate,this.sdDispatcher=s.sdDispatcher,(s=s||{}).HeaderView=me,s.headerOptions={readOnly:this.readOnly,serviceModel:this.service},s.RowView=ve,s.rowOptions={readOnly:this.readOnly,serviceTemplate:this.serviceTemplate,serviceModel:this.service,sdDispatcher:this.sdDispatcher},se.default.prototype.initialize.call(this,s),this.listenTo(this.service,"clickCloneKPI",this.onImportKPIs.bind(this)),this.listenTo(this.service,"clickNewKPI",this._handleNewKpi.bind(this))},onImportKPIs:function onImportKPIs(){var s=new de.default({onHiddenRemove:!0,service:this.service});this.listenTo(s,"kpiscloned",(function(s){this.collection.add(s)})),s.render()},_handleNewKpi:function _handleNewKpi(s){if("blank"!==s["data-id"]&&s["data-collection"]){var o=this.getHeaderView().getExamplesCollection(),_=s["data-collection"],S=o.get(_).get("kpis").primarykpis;this.trigger("newkpi",this,S.get(s["data-id"]))}else this.trigger("newkpi",this)},_onDeleteKpi:function _onDeleteKpi(s,o){this.service.deleteKpi(o)},addItem:function addItem(s){s.get("type")!==te.KPI_TYPES.SERVICE_HEALTH&&se.default.prototype.addItem.apply(this,arguments)},render:function render(){return se.default.prototype.render.apply(this,arguments),this}});o.default=ye;s.exports=o.default},2680:function(s,o,_){(()=>{"use strict";var o={n:s=>{var _=s&&s.__esModule?()=>s.default:()=>s;return o.d(_,{a:_}),_},d:(s,_)=>{for(var S in _)o.o(_,S)&&!o.o(s,S)&&Object.defineProperty(s,S,{enumerable:!0,get:_[S]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},S={};o.r(S),o.d(S,{default:()=>W});const R=_(0);var O=o.n(R);const P=_(104);var D=o.n(P);const N=_(106);function u(s,o){if(null==s)return{};var _,S,R=function i(s,o){if(null==s)return{};var _,S,R={},O=Object.keys(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||(R[_]=s[_]);return R}(s,o);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||Object.prototype.propertyIsEnumerable.call(s,_)&&(R[_]=s[_])}return R}var V=new Map;V.set("outlined",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13 4.5C13 3.67157 13.6716 3 14.5 3H18.5C19.3284 3 20 3.67157 20 4.5V19H21C21.5523 19 22 19.4477 22 20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20C2 19.4477 2.44772 19 3 19H4V4.5C4 3.67157 4.67157 3 5.5 3H9.5C10.3284 3 11 3.67157 11 4.5V19H13V4.5ZM6 15V19H9V15H6ZM9 13H6V5H9V13ZM18 5V13H15V5H18ZM15 19V15H18V19H15Z"}))})),V.set("filled",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13 4.5C13 3.67157 13.6716 3 14.5 3H18.5C19.3284 3 20 3.67157 20 4.5V19H21C21.5523 19 22 19.4477 22 20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20C2 19.4477 2.44772 19 3 19H4V4.5C4 3.67157 4.67157 3 5.5 3H9.5C10.3284 3 11 3.67157 11 4.5V19H13V4.5ZM9 13V5H6V13H9ZM18 5V13H15V5H18Z"}))}));var j=["default","outlined","filled"],K=function e(s){return"default"===s||s&&!function e(s){return j.indexOf(s)>=0}(s)?"outlined":s};const W=function e(s){var o=s.children,_=s.variant,S=void 0===_?"default":_,P=u(s,["children","variant"]),j=K(S),W="chartbarstacked100-".concat(j),U=(0,R.useContext)(N.IconContext),Y=V.get(j);if(U&&Y){var $=U.toRender;if((0,U.addIcon)(W,Y()),!$)return null}return O().createElement(D(),P,o,U?O().createElement("use",{href:"#".concat(W)}):!!Y&&Y())};s.exports=S})()},2681:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=S(_(0)),D=S(_(35)),N=S(_(37)),V=S(_(69)),j=S(_(157)),K=_(4),W=_(85),U=S(_(1608)),Y=_(73),$=_(57),X=_(109),Z=_(102),Q=S(_(2682)),ee=S(_(155)),te=S(_(111)),ie=S(_(1226)),ae=S(_(77)),ne=S(_(688)),re=S(_(288)),se=S(_(47));_(1840);var le={width:"250px"},oe=ee.default.extend({dataTestItsi:"kpi-clone-modal",isWide:!0,initialize:function initialize(s){ee.default.prototype.initialize.apply(this,arguments),this.service=s.service,this.layout=new ie.default({sidebarContent:this.sidebarTemplate,mainContent:this.mainTemplate}),this.fetchServiceObjectView=this._createScrollableServiceList();var o=O.default.Model.extend({idAttribute:"_key"}),_=O.default.Collection.extend({model:o});this.kpiCollection=new _,this.selectedKPIs=[],this.children.errorMessage=new te.default({content:(0,K.gettext)("Must select at least one KPI."),dataTestItsi:"clone-kpi-none-selected-error-message",isInline:!0,isVisible:!1,type:"error"}),this.children.cancelButton=new ae.default({dataTestItsi:"kpi-clone-modal-cancel-button",label:(0,K.gettext)("Cancel"),onClick:this.hide.bind(this)}),this.children.saveButton=new ae.default({appearance:"primary",dataTestItsi:"kpi-clone-modal-primary-button",label:(0,K.gettext)("Clone"),onClick:this._saveKpis.bind(this),style:{marginLeft:10}})},_createScrollableServiceList:function _createScrollableServiceList(){var s=(0,R.default)('<div class="field-value-react-dropdown" data-test-itsi="kpi-clone-list"></div>');return D.default.unmountComponentAtNode(s.get(0)),D.default.render(P.default.createElement(se.default,null,P.default.createElement(U.default,{objectsCollectionCountPath:"".concat(X.baseURL,"/count"),objectsCollectionPath:X.baseURL,handleItemSelect:this.handleServiceSelect.bind(this),handleItemDeselect:this.handleServiceDeselect.bind(this),filterPlaceholder:(0,K.gettext)("Filter services"),fields:"title,_key,kpis.title,kpis._key,kpis.type,kpis.description",searchBarStyle:le,isSearchBarInline:!1,itemTitle:$.OBJECT_NAMES})),s.get(0)),s},onRequestToggle:function onRequestToggle(s){var o=this.selectedKPIs.indexOf(s);o>-1?this.selectedKPIs.splice(o,1):this.selectedKPIs.push(s),this.renderCloneKPITable()},onRequestToggleAllRows:function onRequestToggleAllRows(s){0===this.selectedKPIs.length||(0,j.default)(s,this.selectedKPIs).length!==this.selectedKPIs.length?this.selectedKPIs=this.kpiCollection.models.map(s=>s.get("_key")):this.selectedKPIs=[],this.renderCloneKPITable()},renderCloneKPITable:function renderCloneKPITable(){if(this.layout.$el.find(".kpi-main-list").length){D.default.unmountComponentAtNode(this.layout.$el.find(".kpi-main-list").get(0));var s=this.kpiCollection.models.map(s=>({_key:s.get("_key"),description:s.get("description"),title:s.get("title"),serviceTitle:s.get("serviceTitle")}));D.default.render(P.default.createElement(se.default,null,P.default.createElement(Q.default,{kpiData:s,onRequestToggle:this.onRequestToggle.bind(this),onRequestToggleAllRows:this.onRequestToggleAllRows.bind(this),selectedKPIs:this.selectedKPIs})),this.layout.$el.find(".kpi-main-list").get(0))}},handleServiceSelect:function handleServiceSelect(s){var o=[];s.kpis.forEach((function(s){s.type===$.KPI_TYPES.PRIMARY&&o.push(s)}));for(var _=0;_<o.length;_++)this.kpiCollection.add({serviceId:s._key,serviceTitle:s.title,_key:o[_]._key,title:o[_].title,description:o[_].description});this.renderCloneKPITable()},handleServiceDeselect:function handleServiceDeselect(s){var o=[];s.kpis.forEach((function(s){s.type===$.KPI_TYPES.PRIMARY&&o.push(s)})),o.forEach(s=>{var o=this.selectedKPIs.indexOf(s._key);o>-1&&this.selectedKPIs.splice(o,1)});var _=s._key,S=this.kpiCollection.where({serviceId:_});this.kpiCollection.remove(S),this.renderCloneKPITable()},_saveKpis:function _saveKpis(){if(0!==this.selectedKPIs.length){this.children.errorMessage.hide(),this.children.saveButton.changeStateAndLabel(!0,(0,K.gettext)("Cloning..."));var s=[],o=[],_=[];(0,N.default)(this.selectedKPIs,o=>{var S=this.kpiCollection.where({_key:o});if(S&&S.length>0){var R=function processServiceModel(o){var _=o.get("serviceId"),S=new re.default({_key:_});if(!(0,V.default)(s,function(s){return s.id===_}.bind(this)))return s.push(S),S.fetch()}(S[0]);R&&_.push(R)}}),R.default.when.apply(R.default,_).done(function(){(0,N.default)(this.selectedKPIs,function(_){var S=null;(0,V.default)(s,function(s){var o=s.get("kpis").findWhere({_key:_});o&&(S=o)}.bind(this));var R=new ne.default(S.attributes,{service:this.service});R.unset(ne.default.prototype.idAttribute),(0,N.default)(Z.KPI_CLONE_ATTRIBUTES_BLOCK_LIST,function(s){R.unset(s)}.bind(this)),R.set(ne.default.prototype.idAttribute,this.service.generateKpiId());for(var O=this.service.get("kpis"),P=" ("+(0,K.gettext)("copy")+")",D=R.get("title");O.findWhere({title:D});)D+=P;R.set("title",D),0===this.service.getNumEntityRules()&&"shared_base"!==R.get("search_type")&&R.set("is_service_entity_filter",!1),R.save({},{service:this.service,app:(0,Y.getShortAppName)(!0),owner:W.username}),this.service.get("kpis").primarykpis.add(R),o.push(R)}.bind(this)),this.trigger("kpiscloned",o),this.hide(),this.remove()}.bind(this)).fail(()=>{this.children.saveButton.changeStateAndLabel(!1,(0,K.gettext)("Clone"))})}else this.children.errorMessage.show()},render:function render(){return this.setModalTitle((0,K.gettext)("Clone KPIs")),this.appendToBody(this.children.errorMessage.render().$el),this.appendToBody(this.layout.render().el),this.layout.$el.find(".sidebar-layout-header").hide(),this.layout.$el.find(".service-list").append(this.fetchServiceObjectView),this.renderCloneKPITable(),this.appendToFooter(this.children.cancelButton.render().$el),this.appendToFooter(this.children.saveButton.render().$el),ee.default.prototype.render.apply(this,arguments),this},sidebarTemplate:'<div class="service-list"></div>',mainTemplate:'<div class="kpi-main-list"></div>'});o.default=oe;s.exports=o.default},2682:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=o.columnsData=o.cellData=void 0;var R,O=S(_(7)),P=S(_(0)),D=S(_(3)),N=S(_(24)),V=S(_(93)),j=S(_(89)),K=_(4),W=_(130),U=(0,S(_(2)).default)(V.default)(R||(R=(0,O.default)(["\n width: 100%;\n"]))),Y=o.columnsData=[{dataTestItsi:"kpi-clone-table-kpi-title-column-header",label:(0,K.gettext)("KPI Title")},{dataTestItsi:"kpi-clone-table-kpi-description-column-header",label:(0,K.gettext)("KPI Description")},{dataTestItsi:"kpi-clone-table-kpi-service-title-column-header",label:(0,K.gettext)("Service Title")}],$=o.cellData=[{dataTestItsi:"kpi-clone-table-kpi-title-cell"},{dataTestItsi:"kpi-clone-table-kpi-description-cell"},{dataTestItsi:"kpi-clone-table-kpi-service-title-cell"}];function CloneKPITable(s){var{kpiData:o,onRequestToggle:_,onRequestToggleAllRows:S,selectedKPIs:R}=s,onRequestToggleInternal=(s,o)=>{_(o)},limitCellContentSize=(s,o)=>!s||s.length<=16?s:P.default.createElement(j.default,{"data-test-itsi":o,content:s,key:"".concat(s,"-").concat(o)},"".concat(s.slice(0,16),"..."));return o&&o.length?P.default.createElement(U,{"data-test-itsi":"clone-kpi-table",stripeRows:!0,onRequestToggleAllRows:()=>{S(o.map(s=>s._key))},rowSelection:0===R.length?W.SELECTED_NONE:R.length===o.length?W.SELECTED_ALL:W.SELECTED_SOME},P.default.createElement(V.default.Head,{"data-test-itsi":"clone-kpi-table-head"},Y.map(s=>P.default.createElement(V.default.HeadCell,{"data-test-itsi":s.dataTestItsi,key:s.dataTestItsi},s.label))),P.default.createElement(V.default.Body,null,o.map(s=>P.default.createElement(V.default.Row,{"data-test-itsi":"clone-kpi-table-row",key:"".concat(s._key,"-").concat(s.title,"-row"),onRequestToggle:onRequestToggleInternal,data:s._key,selected:R.indexOf(s._key)>-1},P.default.createElement(V.default.Cell,{"data-test-itsi":$[0].dataTestItsi,key:"".concat(s._key,"-").concat(s.title,"-kpi-title-cell")},limitCellContentSize(s.title,"clone-kpi-table-kpi-title-tooltip")),P.default.createElement(V.default.Cell,{"data-test-itsi":$[1].dataTestItsi,key:"".concat(s._key,"-").concat(s.title,"-kpi-description-cell")},limitCellContentSize(s.description,"clone-kpi-table-kpi-description-tooltip")),P.default.createElement(V.default.Cell,{"data-test-itsi":$[2].dataTestItsi,key:"".concat(s._key,"-").concat(s.title,"-service-title-cell")},limitCellContentSize(s.serviceTitle,"clone-kpi-table-service-title-tooltip")))))):P.default.createElement(N.default,{"data-test-itsi":"clone-kpi-table-none-message",type:"info"},(0,K.gettext)("No KPIs to display. Select service(s) on the left panel."))}CloneKPITable.propTypes={kpiData:D.default.arrayOf(D.default.shape({_key:D.default.string,description:D.default.string,title:D.default.string,serviceTitle:D.default.string})),onRequestToggle:D.default.func.isRequired,onRequestToggleAllRows:D.default.func.isRequired,selectedKPIs:D.default.array},CloneKPITable.defaultProps={kpiData:[],selectedKPIs:[]};o.default=CloneKPITable},2683:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1091),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2684:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(7)),P=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),D=S(_(2)),N=S(_(1518)),V=_(102);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var j=(0,D.default)(N.default)(R||(R=(0,O.default)(["\n margin-right: 25px;\n"])));o.default=function AnomalyDetectionDeprecationNotice(){var[s,o]=(0,P.useState)(!0),_=(0,P.useCallback)(()=>{o(!1)},[o]);return s&&P.default.createElement(j,{type:"info",onRequestClose:_,"data-test-itsi":"kpi-anomaly-detection-deprecation-notice"},V.KPI_ANOMALY_DETECTION_DEPRECATION_NOTICE)};s.exports=o.default},2685:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(0)),P=S(_(35)),D=_(4),N=S(_(805)),V=S(_(47)),j=S(_(598)),K=N.default.extend({initialize:function initialize(s){if(!(s=s||{}).serviceTemplate)throw"Should pass serviceTemplate to ServiceDefinitionKpiInlineTextControl";if(!s.serviceModel)throw"Should pass serviceModel to ServiceDefinitionKpiInlineTextControl";this.serviceTemplate=s.serviceTemplate,this.serviceModel=s.serviceModel,this.sdDispatcher=s.sdDispatcher,N.default.prototype.initialize.apply(this,arguments)},_toEditMode:function _toEditMode(){this._showUnlinkWarningModal()},handleAcceptToUnlink:function handleAcceptToUnlink(){this.sdDispatcher.trigger("unsetBaseServiceTemplateId",this.serviceModel),this.sdDispatcher.trigger("unlink")},_showUnlinkWarningModal:function _showUnlinkWarningModal(){var s=(0,R.default)('<div class="unlink-warning-modal"></div>'),o=(0,D.gettext)("Edit KPI Title");P.default.unmountComponentAtNode(s.get(0)),P.default.render(O.default.createElement(V.default,null,O.default.createElement(j.default,{modalTitleSubstring:o,serviceTitle:this.serviceModel.get("title"),serviceTemplateTitle:this.serviceTemplate.get("title"),serviceTemplateUrl:this.serviceTemplate.getEditUrl(),isModalOpen:!0,handleAcceptToUnlink:this.handleAcceptToUnlink.bind(this)})),s.get(0))}});o.default=K;s.exports=o.default},2686:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(8)),O=S(_(38)),P=_(4),D=S(_(356)),N=S(_(1466));function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,R.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}_(2687);var V=D.default.extend({tagName:"div",className:"kpi-drift-panel",initialize:function initialize(s){if(s=s||{},this.options=s,!s.kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.serviceModel=s.serviceModel,this.linkedServices=s.linkedServices,s.dataTestItsi="service-drift-detection-collapsible-panel",s.panelId="drift",s.panelTitle=(0,P.gettext)("Drift detection"),s.contentViewOptions=_objectSpread({kpiModel:this.kpiModel,serviceModel:this.serviceModel,linkedServices:this.linkedServices},(0,O.default)(this.options,"dataTestItsi")),s.ContentView=N.default,D.default.prototype.initialize.apply(this,arguments)},render:function render(){return D.default.prototype.render.apply(this,arguments),this}});o.default=V;s.exports=o.default},2687:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1092),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2688:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(8)),O=S(_(38)),P=_(4),D=_(14),N=S(_(559)),V=S(_(356)),j=S(_(1467));function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,R.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}_(1468);var K=V.default.extend({tagName:"div",className:"kpi-search-panel",initialize:function initialize(s){if(s=s||{},this.options=s,!s.kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.baseSearchCache=s.baseSearchCache||{},this.serviceModel=s.serviceModel,this.serviceTemplateTitle=s.serviceTemplateTitle,s.dataTestItsi="service-search-and-calculate-collapsible-panel",s.panelId="search",s.panelTitle=(0,P.gettext)("Search and Calculate"),s.contentViewOptions=_objectSpread({kpiModel:this.kpiModel,serviceModel:this.serviceModel,baseSearchCache:this.baseSearchCache},(0,O.default)(this.options,"dataTestItsi")),s.ContentView=j.default,this.iconDataTestItsiSelector="search-and-calculate-collapsible-linked-to-st-icon",this.children={},this.children.lockIcon=new N.default({dataTestItsi:this.iconDataTestItsiSelector,dataTestItsiTooltip:"".concat(this.iconDataTestItsiSelector,"-tooltip"),hasTooltip:!0,style:{marginLeft:8,fontSize:15},tooltipContent:(0,D.sprintf)((0,P.gettext)("KPI linked to service template %(serviceTemplateName)s."),{serviceTemplateName:this.serviceTemplateTitle}),type:"lock"}),V.default.prototype.initialize.apply(this,arguments)},render:function render(){return V.default.prototype.render.apply(this,arguments),this.kpiModel.get("base_service_template_id")&&0===this.$el.find('[data-test-itsi="'.concat(this.iconDataTestItsiSelector,'"]')).length&&this.$el.find('[data-test="collapsible-panel"] [data-test="toggle"] [data-test="title"]').append(this.children.lockIcon.render().$el),this}});o.default=K;s.exports=o.default},2689:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(159)),O=_(45),P=_(4),D=_(14),N=S(_(356)),V=S(_(559)),j=_(188),K=S(_(1469));_(2704);var W=N.default.extend({tagName:"div",className:"kpi-thresholding-panel",initialize:function initialize(s){if(!(s=s||{}).kpiModel)throw"Must provide kpiModel";if(this.kpiModel=s.kpiModel,!s.serviceModel)throw"Must provide serviceModel";this.serviceModel=s.serviceModel,this.linkedServices=s.linkedServices,this.serviceTemplateTitle=s.serviceTemplateTitle,this.featureFlags=s.featureFlags,this.appsData=s.appsData,this.permissions=s.permissions,this.previewServiceCache=s.previewServiceCache,this.thresholdTemplateCollection=s.thresholdTemplateCollection,this.userData=s.userData,this.hideRecommendedThresholding=s.hideRecommendedThresholding||!1,s.dataTestItsi="thresholding-collapsible-panel",s.panelId="thresholding",s.panelTitle=(0,P.gettext)("Thresholding"),s.ContentView=K.default,s.contentViewOptions={appsData:this.appsData,service:this.serviceModel,hideRecommendedThresholding:this.hideRecommendedThresholding,kpiModel:this.kpiModel,linkedServices:this.linkedServices,kpiConfigView:!0,featureFlags:this.featureFlags,permissions:this.permissions,previewServiceCache:this.previewServiceCache,thresholdTemplateCollection:this.thresholdTemplateCollection,userData:this.userData},this.thresholdsUpdated=!!this.kpiModel.get("linked_kpi_thresholds_updated"),this.isLinkedToServiceTemplate=!!this.serviceModel.get("base_service_template_id")&&!!this.kpiModel.get("base_service_template_id"),this.children={},this.children.unlockIcon=new V.default({dataTestItsi:"service-template-icon-unlocked",dataTestItsiTooltip:"service-template-icon-unlocked-tooltip",hasTooltip:!0,style:{marginLeft:8,fontSize:15,color:j.warningColor},tooltipContent:(0,D.sprintf)((0,P.gettext)("This setting has been changed. Its value is no longer synced with the %s service template, even though the service is still linked."),this.serviceTemplateTitle),type:"lock-unlocked"}),N.default.prototype.initialize.apply(this,arguments)},_handleSoftLink:function _handleSoftLink(s,o){if(this.thresholdsUpdated)this._renderUnlock();else{var _=["renderBoundaryMax","renderBoundaryMin","search"],S=Object.keys(s.changed),P=(0,R.default)(S,(function(s){return!(0,O.contains)(_,s)}));(0!==S.length||o&&o.changeManifest&&o.changeManifest.search||o&&o.changeManifest&&o.changeManifest.renderBoundaryMax||o&&o.changeManifest&&o.changeManifest.renderBoundaryMin)&&!P||this.thresholdsUpdated||this._renderUnlock()}},_renderUnlock:function _renderUnlock(){0===this.$el.find('[data-test-itsi="service-template-icon-unlocked"]').length&&this.$('[data-test="collapsible-panel"] [data-test="toggle"] [data-test="title"]').append(this.children.unlockIcon.render().$el)},render:function render(){return N.default.prototype.render.apply(this,arguments),this.isLinkedToServiceTemplate&&(this.listenTo(this.kpiModel,"change:kpi_threshold_template_id change:tz_offset change:time_variate_thresholds change:adaptive_thresholds_is_enabled change:adaptive_thresholding_training_window ",this._handleSoftLink),this.listenTo(this.kpiModel.get("aggregate_thresholds"),"change",this._handleSoftLink),this.listenTo(this.kpiModel.get("entity_thresholds"),"change",this._handleSoftLink),this.listenTo(this.kpiModel.get("time_variate_thresholds_specification"),"change",this._handleSoftLink),this.listenTo(this.kpiModel,"change:aggregate_thresholds_alert_enabled change:aggregate_thresholds_custom_alert_enabled change:aggregate_thresholds_custom_alert_rules",this._handleSoftLink)),this.isLinkedToServiceTemplate&&this.thresholdsUpdated&&this._renderUnlock(),this}});o.default=W;s.exports=o.default},2690:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N=S(_(7)),V=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),j=S(_(3)),K=S(_(2)),W=S(_(373)),U=S(_(266)),Y=S(_(24)),$=S(_(51)),X=S(_(247)),Z=S(_(461)),Q=_(14),ee=_(4),te=_(102),ie=_(110);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var ae=(0,K.default)(U.default)(R||(R=(0,N.default)(["\n margin-bottom: 18px;\n"]))),ne=(0,K.default)(X.default.Item)(O||(O=(0,N.default)(["\n display: flex;\n"]))),re=(0,K.default)(W.default)(P||(P=(0,N.default)(["\n margin-right: 4px;\n"]))),se=(0,K.default)($.default)(D||(D=(0,N.default)(["\n margin-left: 4px;\n margin-right: 4px;\n"]))),le=V.default.createElement(W.default,{"data-test-itsi":"kpi-recommendation-icon"});function KpiRecommendedThresholdingInfoView(s){var o,{confidenceLevel:_,confidenceScore:S,timePolicyDesc:R,timePolicyType:O,kpiObj:P}=s,[D,N]=(0,V.useState)(!0),j=(0,V.useCallback)(()=>{N(!1)},[]),K=(null==P?void 0:P.adaptive_thresholds_is_enabled)&&te.ANALYSIS_WINDOW_OPTIONS.filter(s=>s.value===P.adaptive_thresholding_training_window)[0],W=null===(o=ie.POLICY_TYPES.find(s=>O===s.value))||void 0===o?void 0:o.label.toLowerCase();return V.default.createElement("div",null,D&&V.default.createElement(Y.default,{appearance:"fill",type:"info","data-test-itsi":"kpi-threshold-recommended-info-message",onRequestRemove:j},V.default.createElement(Z.default,{"data-test-itsi":"kpi-threshold-recommended-info-message-heading",as:"p",weight:"bold"},(0,ee.gettext)("Splunk AI recommendations")),V.default.createElement(X.default,null,V.default.createElement(ne,{"data-test-itsi":"kpi-threshold-recommended-config-container-time-policy-item"},V.default.createElement(re,null),V.default.createElement(Z.default,{as:"p",weight:"bold"},(0,Q.sprintf)((0,ee.gettext)("Time policies are %(areTimePoliciesEnabled)s"),{areTimePoliciesEnabled:P.time_variate_thresholds?(0,ee.gettext)("active"):(0,ee.gettext)("inactive")})),V.default.createElement(se,null,"-"),V.default.createElement($.default,null,(0,ee.gettext)("based on analysis of KPI behavior over time."))),P.adaptive_thresholds_is_enabled&&V.default.createElement(ne,{"data-test-itsi":"kpi-threshold-recommended-config-container-at-item"},V.default.createElement(re,null),V.default.createElement(Z.default,{as:"p",weight:"bold"},(0,Q.sprintf)((0,ee.gettext)("Adaptive thresholding with a %(days)s day analysis window using the %(algorithm)s algorithm"),{days:K.days,algorithm:W})," "),V.default.createElement(se,null,"-"),V.default.createElement($.default,null,(0,ee.gettext)("this setting automatically adjusts threshold values by analyzing historical KPI behavior, and the algorithm method calculates threshold values that fit your data's behavior."))),P.adaptive_thresholds_is_enabled&&V.default.createElement(ne,{"data-test-itsi":"kpi-threshold-recommended-config-container-outlier-item"},V.default.createElement(re,null),V.default.createElement(Z.default,{as:"p",weight:"bold"},(0,Q.sprintf)((0,ee.gettext)("Outlier exclusion is active using %(outlierAlgo)s"),{outlierAlgo:te.OUTLIER_ALGORITHM_LABEL_MAP[P.outlier_detection_algo]})," "),V.default.createElement(se,null,"-"),V.default.createElement($.default,null,(0,ee.gettext)("this setting defines outlier data points to exclude from adaptive threshold calculations to avoid data skews."))),V.default.createElement(ne,{"data-test-itsi":"kpi-threshold-recommended-config-container-description-item"},V.default.createElement(re,null),V.default.createElement(Z.default,{"data-test-itsi":"kpi-threshold-recommended-config-container-description",as:"p",weight:"bold"},(0,Q.sprintf)((0,ee.gettext)("%(description)s recommended with %(confidence)s confidence (Confidence Score = %(score)s%%)"),{description:R.charAt(0).toUpperCase()+R.slice(1),confidence:_,score:(100*S).toFixed(2)})),V.default.createElement(se,null,"-"),V.default.createElement($.default,null,(0,ee.gettext)("settings that describe your data's patterns and are reflected in the recommendation."))))),V.default.createElement(ae,{icon:le,"data-test-itsi":"kpi-threshold-recommended-info-icon-chip"},(0,ee.gettext)("This icon represents threshold settings configured using Splunk's AI-powered analysis.")))}KpiRecommendedThresholdingInfoView.propTypes={confidenceLevel:j.default.string.isRequired,confidenceScore:j.default.string.isRequired,timePolicyDesc:j.default.string.isRequired,timePolicyType:j.default.string.isRequired,kpiObj:j.default.object.isRequired};o.default=KpiRecommendedThresholdingInfoView;s.exports=o.default},2691:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V=S(_(7)),j=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),K=S(_(3)),W=S(_(2)),U=S(_(37)),Y=S(_(75)),$=S(_(34)),X=S(_(66)),Z=S(_(24)),Q=_(4),ee=_(265),te=_(71),ie=_(61),ae=_(126),ne=_(78),re=_(110),se=S(_(2692)),le=S(_(2696)),oe=S(_(2697)),de=S(_(2700)),ce=S(_(162)),he=_(345),ue=_(517);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var pe=(0,W.default)(Y.default)(R||(R=(0,V.default)(["\n padding: 20px 0;\n text-align: center;\n"]))),fe=(0,W.default)(X.default)(O||(O=(0,V.default)(["\n margin-left: 10px;\n width: 250px !important;\n"]))),ge=(0,W.default)(Z.default)(P||(P=(0,V.default)(["\n margin-top: 20px;\n"]))),me=W.default.span(D||(D=(0,V.default)(["\n margin-right: 15px;\n"]))),ve=W.default.div(N||(N=(0,V.default)(["\n margin-left: 20px;\n margin-bottom: 20px;\n"])));function KpiThresholdingViewContainer(s){var{appsData:o,kpiModel:_,updateThresholdInKpiModel:S,thresholdTemplateCollection:R,generateTemplate:O,canWriteOnGlobalTeam:P,disabled:D,hasTimeVariateThresholds:N,showWaitSpinnerOnLoad:V}=s,[K,W]=(0,j.useState)(V),[Y,Z]=(0,j.useState)(_.get("is_entity_breakdown")),[ye,_e]=(0,j.useState)(!0),[Se,be]=(0,j.useState)(!0),[Ee,Te]=(0,j.useState)(_.get("kpi_threshold_template_id")),[Ce,ke]=(0,j.useState)(!1),[xe,we]=(0,j.useState)(!1),[Re,Ie]=(0,j.useState)([]),[Me,Oe]=(0,j.useState)(""),[Ae,Pe]=(0,j.useState)(!1),[De,Le]=(0,j.useState)("");(0,j.useEffect)(()=>{(()=>{var s=R.get(_.get("kpi_threshold_template_id"));if(s){var o=s.get("time_variate_thresholds_specification"),S=_.get("time_variate_thresholds_specification");S.set(S.parse({policies:JSON.parse(JSON.stringify(o.get("policies")))}),{silent:!0}),_.set("time_variate_thresholds",s.get("time_variate_thresholds"),{silent:!0}),_.set("aggregate_outlier_detection_enabled",s.get("aggregate_outlier_detection_enabled"),{silent:!0}),_.set("outlier_detection_algo",s.get("outlier_detection_algo"),{silent:!0}),_.set("outlier_detection_sensitivity",s.get("outlier_detection_sensitivity"),{silent:!0})}})(),_.on("change:is_entity_breakdown",()=>{Z(_.get("is_entity_breakdown")),_.get("is_entity_breakdown")||_e(!0)}),_.on("change:kpi_threshold_template_id",(s,o,_)=>{_&&_.unset&&Te("create-new-template")});var s=(0,re.checkSummaryIndexForKpiData)(_.get("_key"),"single-thresholding-preview");return s.promise.then(s=>{var o=!s||(0,re.checkShouldUseRawSearch)(s);be(o),W(!1)}).catch(()=>{be(!0),W(!1)}),()=>{var o;o=s,(0,ne.cleanSearchJobSubscriptions)(null==o?void 0:o.searchJob,null==o?void 0:o.subscription),_.off("change:is_entity_breakdown"),_.off("change:kpi_threshold_template_id")}},[]),(0,j.useEffect)(()=>{var s=[];R&&(0,U.default)(R.models,o=>{s.push({value:o.get("_key"),label:o.get("title")})}),Ie(s)},[]);var applyKpiThresholdTemplate=s=>{var o=R.get(s);if(o){var S=o.get("time_variate_thresholds_specification"),O=_.get("time_variate_thresholds_specification");O.set(O.parse({policies:JSON.parse(JSON.stringify(S.get("policies")))})),_.set("kpi_threshold_template_id",s),_.set("adaptive_thresholds_is_enabled",o.get("adaptive_thresholds_is_enabled")),_.set("adaptive_thresholding_training_window",o.get("adaptive_thresholding_training_window")),_.set("time_variate_thresholds",o.get("time_variate_thresholds")),_.set("aggregate_outlier_detection_enabled",o.get("aggregate_outlier_detection_enabled")),_.set("outlier_detection_algo",o.get("outlier_detection_algo")),_.set("outlier_detection_sensitivity",o.get("outlier_detection_sensitivity")),Le(s)}},Ne=(0,j.useCallback)((s,o)=>{var{value:_}=o;Te(_),"create-new-template"!==_?_!==Ee&&ke(!0):we(!0)},[Ee]),handleCloseConfirmDialog=()=>{ke(!1)},handleApplyConfirmDialog=()=>{applyKpiThresholdTemplate(Ee)},Ve=(0,j.useCallback)(()=>{we(!1),Oe("")},[]),je=(0,j.useCallback)((s,o)=>{var _=O();_.set("title",s),_.set("description",o),Pe(!0),_.save(_.toJSON(),{silent:!0}).done(s=>{var o;Te(s._key),we(!1),o=s._key,R.fetch().done(()=>{var s=[];R&&(0,U.default)(R.models,o=>{s.push({value:o.get("_key"),label:o.get("title")})}),Ie(s),applyKpiThresholdTemplate(o)}).fail(()=>{}),Pe(!1)}).fail(s=>{Pe(!1),s&&409===s.status&&s.responseText&&s.responseText.indexOf(ae.ALREADY_EXISTING_TITLE_MARKER)>-1?Oe(ae.ALREADY_EXISTING_TITLE_MESSAGE):Oe("".concat(he.OBJECT_NAMES.singular," could not be saved. Possible cause: connection lost. Try restarting the Splunk platform. ").concat((0,te.formatErrorResponse)(s).message))})},[]),He=(0,j.useCallback)(s=>{var o={isValid:!0,message:""};return R.pluck("title").includes(s)?(o.isValid=!1,o.message=(0,Q.gettext)("A template with this title already exists."),o):""===s.replace(/\s+/g,"")?(o.isValid=!1,o.message=(0,Q.gettext)("Title field is required."),o):o},[R]),Be=(0,j.useCallback)(s=>{s===re.KPI_THRESHOLD_TYPES.AGGREGATE?_e(!0):_e(!1)},[]);if(K)return j.default.createElement(pe,{"data-test-itsi":"kpi-thresholding-view-container-wait-spinner",size:"large"});var Ke,Fe,We=!1,Ue=!0;return(0,U.default)(ee.PYTHON_SCIENTIFIC_APP_NAMES,s=>{o&&o[s]&&o[s].isInstalled&&(We=!0,o[s].isDisabled||(Ue=!1))}),j.default.createElement(j.default.Fragment,null,j.default.createElement(de.default,{validateKpiThresholdTitle:He,open:xe,handleClose:Ve,handleSave:je,apiErrorMessage:Me,isApiInProgress:Ae}),j.default.createElement(ve,null,j.default.createElement(me,null,(0,Q.gettext)("Apply template (optional) ")),j.default.createElement(fe,{"data-test-itsi":"kpi-threshold-template-select",disabled:D,filter:!0,placeholder:(0,Q.gettext)("Create new template"),onChange:Ne,truncate:!0,value:Ee},j.default.createElement(X.default.Divider,null),j.default.createElement(X.default.Option,{disabled:!(P&&N),key:"create-new-template",label:(0,Q.gettext)("Create new template"),value:"create-new-template","data-test-itsi":"kpi-threshold-template-create-new-template"}),j.default.createElement(X.default.Heading,null,(0,Q.gettext)("Threshold templates")),Re.map(s=>j.default.createElement(X.default.Option,{"data-test-itsi":"kpi-threshold-template-select-option",key:s.value,label:s.label,value:s.value})))),Y&&j.default.createElement(le.default,{handleTabChange:Be,showRecommendationIcon:!1}),ye&&j.default.createElement(oe.default,{kpiModel:_,isPSCDisabled:Ue,isPSCInstalled:We,onThresholdUpdate:S,useRawSearch:Se,key:De}),Y&&!ye&&j.default.createElement(se.default,{kpiModel:_,isPSCDisabled:Ue,isPSCInstalled:We,onThresholdUpdate:S,useRawSearch:Se,key:De}),(Ke=Ee,Fe=R.get(Ke),j.default.createElement(ce.default,{modalDataTestItsi:"apply-threshold-template-modal",cancelButtonDataTestItsi:"apply-threshold-template-modal-cancel-button",primaryButtonDataTestItsi:"apply-threshold-template-modal-apply-button",showCancel:!0,open:Ce,beforeClose:handleCloseConfirmDialog,modalStyles:ie.CONFIRMATION_MODAL_STYLE,title:(0,Q.gettext)("Apply Threshold Template"),primaryButtonLabel:(0,Q.gettext)("Apply"),primaryButtonClicked:handleApplyConfirmDialog,secondaryButtonClicked:handleCloseConfirmDialog},j.default.createElement("span",{"data-test-itsi":"threshold-template-modal-apply-message"},(0,Q.gettext)("All existing threshold settings will be discarded. Are you sure you want to apply template?"),Fe&&Fe.get("_immutable")&&j.default.createElement(ge,{"data-test-itsi":"kpi-threshold-template-apply-info-message",type:"info",appearance:"fill"},j.default.createElement("div",null,(0,Q.gettext)("The threshold time policies will be applied in UTC. If you want the threshold time policies to be applied in your local timezone, clone this template using your timezone and then apply it.")," ",j.default.createElement($.default,{"data-test-itsi":"clone-kpi-threshold-template-link",openInNewContext:!0,to:ue.uiListerURL},(0,Q.gettext)("Clone Threshold Template")),"."))))))}KpiThresholdingViewContainer.propTypes={appsData:K.default.object.isRequired,kpiModel:K.default.object.isRequired,updateThresholdInKpiModel:K.default.func.isRequired,thresholdTemplateCollection:K.default.object.isRequired,generateTemplate:K.default.func.isRequired,canWriteOnGlobalTeam:K.default.bool,disabled:K.default.bool,hasTimeVariateThresholds:K.default.bool,showWaitSpinnerOnLoad:K.default.bool},KpiThresholdingViewContainer.defaultProps={canWriteOnGlobalTeam:!0,disabled:!1,hasTimeVariateThresholds:!0,showWaitSpinnerOnLoad:!0};o.default=KpiThresholdingViewContainer;s.exports=o.default},2692:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D=S(_(8)),N=S(_(7)),V=_interopRequireWildcard(_(0)),j=_(46),K=_(48),W=S(_(484)),U=S(_(81)),Y=S(_(33)),$=S(_(485)),X=S(_(3)),Z=S(_(2)),Q=S(_(95)),ee=S(_(50)),te=S(_(1148)),ie=S(_(732)),ae=S(_(349)),ne=S(_(582)),re=_interopRequireWildcard(_(337)),se=S(_(446)),le=_(322),oe=S(_(75)),de=S(_(121)),ce=_(4),he=_(14),ue=_(22),pe=_(41),fe=_(29),ge=_(107),me=_(110),ve=_(67),ye=_(617),_e=_(803),Se=_(443),be=_(384),Ee=_(57),Te=_(519),Ce=_(102),ke=S(_(162)),xe=S(_(2693)),we=S(_(2694)),Re=S(_(706)),Ie=S(_(815)),Me=S(_(705)),Oe=S(_(2695));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,D.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var Ae=(0,re.makeCreateToast)(re.default),Pe=(0,Z.default)(oe.default)(R||(R=(0,N.default)(["\n padding: 20px 0;\n text-align: center;\n"]))),De=Z.default.div(O||(O=(0,N.default)(["\n display: flex;\n"]))),Le=Z.default.div(P||(P=(0,N.default)(["\n display: flex;\n flex-direction: column;\n position: relative;\n margin: 0px;\n padding: 12px;\n border: 1px solid ",";\n"])),ue.variables.gray80);function EntityThresholdingContainer(s){var{isPSCDisabled:o,isPSCInstalled:_,isReadOnly:S,kpiEntitiesApiErrorMessage:R,kpiEntitiesApiStatus:O,kpiEntitiesData:P,kpiEntitiesConfigApiStatus:D,kpiEntitiesConfigData:N,previewEntitiesThresholdsRecommendationSearchStatus:j,previewEntitiesThresholdsRecommendationResults:K,kpiModel:X,onThresholdUpdate:Z,serviceKpiEntitiesRetrieveAction:re,serviceKpiEntitiesConfigRetrieveAction:oe,previewRecommendedEntitiesThresholdsSearchRetrieveAction:ue,useRawSearch:_e}=s,Se=(0,V.useCallback)(s=>{var{_key:o,entity_key:_,entity_title:S,kpi_id:R,entity_thresholds:O,time_variate_thresholds:P,time_variate_thresholds_specification:D,adaptive_thresholds_is_enabled:N,adaptive_thresholding_training_window:V}=s;return{_key:o,adaptiveTrainingWindow:V,name:S,entityKey:_,kpiId:R,entityThresholdsConfig:_objectSpread({},O),isAdaptiveThresholdsEnabled:N,isTimeVariateThresholds:P,timeVariateThresholdsSpecification:(0,U.default)(D)}},[]),[Ne,Ve]=(0,V.useState)({entity:{},thresholdObj:{},isReadOnly:!1}),[je,He]=(0,V.useState)(!X.get("is_entity_level_thresholding")),[Be,Ke]=(0,V.useState)((s=>{var o,_,{_key:S,title:R,alert_period:O,aggregate_thresholds:P,base_search:D,entity_statop:N,entity_thresholds:V,entity_breakdown_id_fields:j,search_time_series_entities:K,threshold_field:W,time_variate_thresholds:U,time_variate_thresholds_specification:Y,adaptive_thresholds_is_enabled:$,adaptive_thresholding_training_window:Z,search_alert_earliest:Q}=s;return{_key:S,name:R,isAdaptiveThresholdsEnabled:$,adaptiveTrainingWindow:Z,isTimeVariateThresholds:U,baseSearch:D,entityStatop:N,searchTimeSeriesEntities:K,entityBreakdownIdFields:j,thresholdField:W,searchAlertEarliest:Q,aggregateThresholdsConfig:_objectSpread(_objectSpread({},P),{},{thresholdLevels:P.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}})}),entityThresholdsConfig:_objectSpread(_objectSpread({},V),{},{thresholdLevels:V.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}})}),timeVariateThresholdsSpecification:(o=Y.get("policies"),_={policies:{}},o.models&&o.models.forEach(s=>{var{id:o}=s,{title:S,aggregate_thresholds:R,entity_thresholds:O,policy_type:P,time_blocks:D}=s.toJSON()[o],{thresholdLevels:N,gaugeMin:V,gaugeMax:j,isMinStatic:K,isMaxStatic:W,renderBoundaryMin:U,renderBoundaryMax:Y,baseSeverityValue:$,baseSeverityColor:X,baseSeverityColorLight:Z,baseSeverityLabel:Q,metricField:ee}=R;_.policies[o]={title:S,aggregate_thresholds:{gaugeMax:j,thresholdLevels:N.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}}),isMaxStatic:W,gaugeMin:V,baseSeverityLabel:Q,baseSeverityColor:X,metricField:ee,baseSeverityValue:$,baseSeverityColorLight:Z,renderBoundaryMin:U,renderBoundaryMax:Y,isMinStatic:K},entity_thresholds:{gaugeMax:O.gaugeMax,thresholdLevels:O.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}}),isMaxStatic:O.isMaxStatic,gaugeMin:O.gaugeMin,baseSeverityLabel:O.baseSeverityLabel,baseSeverityColor:O.baseSeverityColor,metricField:O.metricField,baseSeverityValue:O.baseSeverityValue,baseSeverityColorLight:O.baseSeverityColorLight,renderBoundaryMin:O.renderBoundaryMin,renderBoundaryMax:O.renderBoundaryMax,isMinStatic:O.isMinStatic},policy_type:P,time_blocks:D}}),_),thresholdType:me.KPI_THRESHOLD_TYPES.ENTITY,rawSearch:s.search_time_series_entities,alertPeriod:O,tempKpiData:_objectSpread(_objectSpread({},s),{},{adaptive_thresholding_training_window:X.get("adaptive_thresholding_training_window"),time_variate_thresholds_specification:JSON.parse(JSON.stringify(Y.toJSON()))})}})(X.toJSON())),[Fe,We]=(0,V.useState)(X.get("is_entity_level_thresholding")||!1),[Ue,Ge]=(0,V.useState)(!1),[Ye,qe]=(0,V.useState)(!1),[ze,$e]=(0,V.useState)(!1),[Je,Xe]=(0,V.useState)(!1),[Ze,Qe]=(0,V.useState)(!X.get("is_entity_level_thresholding")),et={analysisWindowValue:X.get("entity_recommendation_training_window")||Ce.ANALYSIS_WINDOW_OPTIONS[2].value,analysisWindowStartDate:X.get("entity_recommendation_start_date")||(0,de.default)().subtract(Ce.ANALYSIS_WINDOW_OPTIONS[2].days,"days").unix(),recommendationApplyAsValue:!!X.get("entity_keep_recommended_policy_static"),thresholdConfigValue:X.get("entity_threshold_direction")||Ce.THRESHOLD_CONFIGURATION_OPTIONS[0].value},tt=(0,V.useRef)(),it=(0,V.useCallback)(()=>{var s=(0,ie.default)(P.results,0,10),o=X.get("entity_recommendation_training_window")||"30d",_=X.get("entity_recommendation_start_date")?de.default.unix(X.get("entity_recommendation_start_date")):de.default.unix((0,de.default)().subtract(o.match(/\d+/g)[0],"days").unix()),S=_.clone(),R=o.match(/\d+/g)[0];S.add(R,"days"),ue({kpiId:X.get("_key"),entityIds:(0,ee.default)(s,"entity_key"),entityTitles:(0,ee.default)(s,"entity_title"),thresholdDirection:X.get("entity_threshold_direction"),recommendationApplyAsValue:X.get("entity_keep_recommended_policy_static"),earliest:"-".concat((0,de.default)().diff(_,"day"),"d"),latest:(0,de.default)().isSame(S,"day")?"now":"-".concat((0,de.default)().diff(S,"day"),"d")})},[P.results,X,ue]),at=(0,V.useCallback)(s=>{var o=X.get("entity_threshold_configuration")||{},_=X.get("entity_threshold_recommended_configuration")||{};if(s in _)return[Se(_[s]),!0];if(s in o)return[Se(o[s]),!1];var S=N.length?N.findIndex(o=>s===o.entity_title):-1;return-1!==S?[Se(N[S]),!1]:[{},!1]},[X,N,Se]);(0,V.useEffect)(()=>(tt.current=null,()=>clearTimeout(tt.current)),[]),(0,V.useEffect)(()=>{X.on("change:is_entity_level_thresholding",()=>{X.get("is_entity_level_thresholding")?(Qe(!1),He(!1),We(!0)):(He(!0),We(!1))})},[]),(0,V.useEffect)(()=>{Fe&&(oe(Be._key),re({kpiId:Be._key,earliest:"-48h",latest:"now"}))},[Fe]),(0,V.useEffect)(()=>{if(O===be.SERVICE_KPI_ENTITIES_RETRIEVE_STATUS.SUCCESS){if(ze&&($e(!1),it()),P&&null!=P&&P.results.length&&null!=P&&P.results[0]){var[s,o]=at(P.results[0].entity_title);Ve({entity:P.results[0],thresholdObj:s,isReadOnly:o}),He(!1)}else Ve({entity:{entity_key:"entity_default_configuration",entity_title:(0,ce.gettext)("Default Configuration")},thresholdObj:{},isReadOnly:!1}),He(!0);Qe(!0)}},[O]),(0,V.useEffect)(()=>{},[R]);var generateToastMessage=(s,o)=>{Ae({type:s,message:o,autoDismiss:!0,dismissOnActionClick:!0,showAction:!1})},nt=function generateThresholdLevels(s,o,_){var S=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,R=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,O=(0,U.default)(me.DEFAULT_THRESHOLDS),P=[];Object.entries(s).forEach(s=>{var[o,O]=s,D=Array.isArray(O)?O:[O],N=ge.DEFAULT_SEVERITY_LEVELS.find(s=>s.severityLabel===o);N&&D.forEach(s=>{var o={severityLabel:N.severityLabel,severityValue:N.severityValue,severityColor:N.severityColor,severityColorLight:N.severityColorLight,thresholdValue:_?s*R+S:s,dynamicParam:_?s:0};P.push(o)})}),P.sort((s,o)=>s.thresholdValue-o.thresholdValue);var{renderBoundaryMin:D}=O,{renderBoundaryMax:N}=O;if(O.thresholdLevels=P,P.length){var V=P[0].thresholdValue;O.gaugeMin=V-Math.abs(.1*V),O.gaugeMin<D&&(O.renderBoundaryMin=O.gaugeMin);var j=P[P.length-1].thresholdValue;O.gaugeMax=j+Math.abs(.1*j),O.gaugeMax>N&&(O.renderBoundaryMax=O.gaugeMax)}if(o!==Ce.THRESHOLD_CONFIGURATION_OPTIONS[2].value){var{severityLabel:K,severityValue:W,severityColor:Y,severityColorLight:$}=ge.DEFAULT_SEVERITY_LEVELS[5];O.baseSeverityLabel=K,O.baseSeverityValue=W,O.baseSeverityColor=Y,O.baseSeverityColorLight=$}return O},rt=(0,V.useCallback)(s=>{for(var o={[me.DEFAULT_POLICY_KEY]:me.DEFAULT_POLICY},_=0;_<s.length;_+=1){var S=(0,fe.generateUUID)(),R=[[s[_]["Cron Expression"],parseInt(s[_].Duration,10)]],O=(0,ve.getUserTimezoneOffset)("sec"),P=(0,me.getPolicyTitleFromTimeBlock)(R,O),D=s[_].Thresholds.replace(/'/g,'"'),N=parseFloat(s[_].Mean),V=parseFloat(s[_].Std),j=(0,fe.normalizeBoolean)(s[_]["Use Static"]),K=JSON.parse(D),W={title:P,entity_thresholds:nt(K,s[_]["Threshold Direction"],!0,N,V),aggregate_thresholds:(0,U.default)(me.DEFAULT_THRESHOLDS),policy_type:j?"static":s[_].Algorithm,time_blocks:R};o[S]=W}return o},[]);(0,V.useEffect)(()=>{if(j===Te.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.IN_PROGRESS&&Xe(!0),Je){if(Xe(!1),j===Te.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.ERROR){var s=(0,ce.gettext)("There was a problem training your entities");generateToastMessage(le.TOAST_TYPES.ERROR,s)}if(j===Te.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.SUCCESS){X.set("did_load_recommendation",!0);var o=(0,te.default)([(0,ae.default)(P.results),10]),_=(0,ne.default)(K.results,"entity_title"),S=(0,ae.default)((0,Q.default)(_,s=>s["Recommendation Flag"]===Ce.ENTITY_RECOMMENDATIONS.SUCCESSFUL||s["Recommendation Flag"]===Ce.ENTITY_RECOMMENDATIONS.NO_PATTERN)),R=(0,he.sprintf)((0,ce.gettext)("%(numSuccess)d of %(numEntities)d Entities Successfully Trained"),{numSuccess:S,numEntities:o}),O=S===o?le.TOAST_TYPES.SUCCESS:le.TOAST_TYPES.WARNING;generateToastMessage(O,R),(0,ie.default)(P.results,0,10).forEach(s=>{var o=(0,Q.default)(K.results,o=>o.entity_title===s.entity_title);if((0,ae.default)(o)&&o[0]["Recommendation Flag"]===Ce.ENTITY_RECOMMENDATIONS.SUCCESSFUL){var _=rt(o),S=(0,fe.normalizeBoolean)(o[0]["Use Static"]),R=X.get("entity_recommendation_training_window"),O={_key:(0,ye.md5KeyGenerator)([s.entity_title,s.itsi_kpi_id]),entity_title:s.entity_title,entity_key:s.entity_key,kpi_id:s.itsi_kpi_id,entity_thresholds:Ne.thresholdObj,adaptive_thresholds_is_enabled:!S,time_variate_thresholds:!0,time_variate_thresholds_specification:{policies:_},adaptive_thresholding_training_window:R===Ee.KPI_TIME_PRESETS[2].value||R===Ee.KPI_TIME_PRESETS[3].value?Ee.KPI_TIME_PRESETS[1].value:R},P=X.get("entity_threshold_recommended_configuration")||{};if(P[s.entity_title]=(0,U.default)(O),Ne.entity.entity_title===s.entity_title){var D=Se(O),N=Object.assign((0,U.default)(Ne.thresholdObj),(0,U.default)(D));Ve({entity:Ne.entity,thresholdObj:N,isReadOnly:!0})}X.set("entity_threshold_recommended_configuration",(0,U.default)(P))}else if((0,ae.default)(o)&&o[0]["Recommendation Flag"]===Ce.ENTITY_RECOMMENDATIONS.NO_PATTERN){var V=o[0].Thresholds.replace(/'/g,'"'),j=JSON.parse(V),W=nt(j,o[0]["Threshold Direction"],!1),Y={_key:(0,ye.md5KeyGenerator)([s.entity_title,s.itsi_kpi_id]),entity_title:s.entity_title,entity_key:s.entity_key,kpi_id:s.itsi_kpi_id,entity_thresholds:W,adaptive_thresholds_is_enabled:!1,time_variate_thresholds:!1,time_variate_thresholds_specification:{policies:{[me.DEFAULT_POLICY_KEY]:me.DEFAULT_POLICY}}},$=X.get("entity_threshold_recommended_configuration")||{};if($[s.entity_title]=(0,U.default)(Y),Ne.entity.entity_title===s.entity_title){var Z=Se(Y),ee=Object.assign((0,U.default)(Ne.thresholdObj),(0,U.default)(Z));Ve({entity:Ne.entity,thresholdObj:ee,isReadOnly:!0})}X.set("entity_threshold_recommended_configuration",(0,U.default)($))}})}}},[j]);var st=(0,V.useCallback)(s=>{if(Qe(!1),"entity_default_configuration"===s.entity_key)He(!0),Ve({entity:s,thresholdObj:{},isReadOnly:!1});else{var[o,_]=at(s.entity_title);Ve({entity:s,thresholdObj:o,isReadOnly:_}),He(!1)}Qe(!0)},[at]),lt=(0,V.useCallback)(s=>{if(je){var o,_=_objectSpread({},Be);null!==(o=s.timeVariateThresholdsSpecification)&&void 0!==o&&o.policies&&(_.timeVariateThresholdsSpecification=s.timeVariateThresholdsSpecification),s.entityThresholdsConfig&&(_.entityThresholdsConfig=s.entityThresholdsConfig),Ke(_),Z(_)}else{var S=N.length?N.findIndex(s=>Ne.entity.entity_title===s.entity_title):-1,R=(0,U.default)(Ne.thresholdObj),O=X.get("entity_threshold_configuration")||{};Ne.entity.entity_title in O?R.isTimeVariateThresholds?(R.timeVariateThresholdsSpecification=(0,U.default)(s.timeVariateThresholdsSpecification),O[Ne.entity.entity_title]=_objectSpread(_objectSpread({},O[Ne.entity.entity_title]),{},{time_variate_thresholds_specification:s.timeVariateThresholdsSpecification})):(O[Ne.entity.entity_title]=_objectSpread(_objectSpread({},O[Ne.entity.entity_title]),{},{entity_thresholds:s.entityThresholdsConfig}),R.entityThresholdsConfig=(0,U.default)(s.entityThresholdsConfig)):R.isTimeVariateThresholds?(O[Ne.entity.entity_title]=_objectSpread(_objectSpread({},N[S]),{},{time_variate_thresholds_specification:s.timeVariateThresholdsSpecification}),R.timeVariateThresholdsSpecification=s.timeVariateThresholdsSpecification):(O[Ne.entity.entity_title]=_objectSpread(_objectSpread({},N[S]),{},{entity_thresholds:s.entityThresholdsConfig}),R.entityThresholdsConfig=s.entityThresholdsConfig),O[Ne.entity.entity_title].is_recommended_time_policies=!1,X.set("entity_threshold_configuration",O),Ve(s=>({entity:s.entity,thresholdObj:R,isReadOnly:s.isReadOnly}))}},[je,Be,N,X,Z,Ne.entity.entity_title,Ne.thresholdObj]),ot=(0,V.useCallback)(()=>{Ge(!0),tt.current=setTimeout(()=>{var s=_objectSpread({},Be);if(Be.isTimeVariateThresholds){var o=(0,$.default)(Be.timeVariateThresholdsSpecification.policies,s=>{var o=(0,U.default)(s.aggregate_thresholds);return(0,W.default)(_objectSpread({},s),{entity_thresholds:o})});s.timeVariateThresholdsSpecification={policies:o}}else{var _=(0,U.default)(Be.aggregateThresholdsConfig);s.entityThresholdsConfig=_}Ke(s),Z(s),Ge(!1)},100)},[Be,Z]),dt=(0,V.useCallback)((s,o)=>{X.set("did_load_recommendation",!1),"threshold_direction"===s?X.set("entity_threshold_direction",o):"analysis_window"===s?X.set("entity_recommendation_training_window",o):"start_date"===s?X.set("entity_recommendation_start_date",o):"apply_as"===s&&X.set("entity_keep_recommended_policy_static",o)},[X]),handleEntityThresholdTypeChange=s=>{var o=(0,U.default)(Ne.thresholdObj),_=X.get("entity_threshold_configuration")||{};if(s===Ce.THRESHOLD_TYPE_OPTIONS[0].value)if(o.isTimeVariateThresholds=!1,o.isAdaptiveThresholdsEnabled=!1,Ne.entity.entity_title in _)_[Ne.entity.entity_title]=_objectSpread(_objectSpread({},_[Ne.entity.entity_title]),{},{time_variate_thresholds:!1,adaptive_thresholds_is_enabled:!1});else{var S=N.findIndex(s=>Ne.entity.entity_title===s.entity_title);_[Ne.entity.entity_title]=_objectSpread(_objectSpread({},N[S]),{},{time_variate_thresholds:!1,adaptive_thresholds_is_enabled:!1})}else if(s===Ce.THRESHOLD_TYPE_OPTIONS[2].value)if(o.isTimeVariateThresholds=!0,o.isAdaptiveThresholdsEnabled=!0,Ne.entity.entity_title in _)_[Ne.entity.entity_title]=_objectSpread(_objectSpread({},_[Ne.entity.entity_title]),{},{time_variate_thresholds:!0,adaptive_thresholds_is_enabled:!0});else{var R=N.findIndex(s=>Ne.entity.entity_title===s.entity_title);_[Ne.entity.entity_title]=_objectSpread(_objectSpread({},N[R]),{},{time_variate_thresholds:!0,adaptive_thresholds_is_enabled:!0})}else{o.isTimeVariateThresholds=!0,o.isAdaptiveThresholdsEnabled=!1;var O=o.timeVariateThresholdsSpecification.policies;if(Object.keys(O).forEach(s=>{"static"!==O[s].policy_type&&(O[s].policy_type="static")}),Ne.entity.entity_title in _)_[Ne.entity.entity_title]=_objectSpread(_objectSpread({},_[Ne.entity.entity_title]),{},{time_variate_thresholds:!0,adaptive_thresholds_is_enabled:!1,time_variate_thresholds_specification:{policies:(0,U.default)(O)}});else{var P=N.findIndex(s=>Ne.entity.entity_title===s.entity_title);_[Ne.entity.entity_title]=_objectSpread(_objectSpread({},N[P]),{},{time_variate_thresholds:!0,adaptive_thresholds_is_enabled:!1,time_variate_thresholds_specification:{policies:(0,U.default)(O)}})}}X.set("entity_threshold_configuration",_),Ve(s=>({entity:s.entity,thresholdObj:o,isReadOnly:s.isReadOnly}))},handleEntityAdaptiveTrainingWindowChange=s=>{var o=(0,U.default)(Ne.thresholdObj),_=X.get("entity_threshold_configuration")||{};if(o.adaptiveTrainingWindow=s,Ne.entity.entity_title in _)_[Ne.entity.entity_title]=_objectSpread(_objectSpread({},_[Ne.entity.entity_title]),{},{adaptive_thresholding_training_window:s});else{var S=N.findIndex(s=>Ne.entity.entity_title===s.entity_title);_[Ne.entity.entity_title]=_objectSpread(_objectSpread({},N[S]),{},{adaptive_thresholding_training_window:s})}X.set("entity_threshold_configuration",_),Ve(s=>({entity:s.entity,thresholdObj:o,isReadOnly:s.isReadOnly}))},getThresholdType=s=>s.isTimeVariateThresholds?s.isAdaptiveThresholdsEnabled?Ce.THRESHOLD_TYPE_OPTIONS[2].value:Ce.THRESHOLD_TYPE_OPTIONS[1].value:Ce.THRESHOLD_TYPE_OPTIONS[0].value,ct=(0,V.useCallback)(()=>{qe(!0)},[]),ht=(0,V.useCallback)(()=>{qe(!1)},[]),ut=(0,V.useCallback)(()=>{qe(!1),X.has("entity_recommendation_training_window")||X.set("entity_recommendation_training_window",Ce.ANALYSIS_WINDOW_OPTIONS[2].value),X.has("entity_recommendation_start_date")||X.set("entity_recommendation_start_date",(0,de.default)().subtract(Ce.ANALYSIS_WINDOW_OPTIONS[2].days,"days").unix()),X.has("entity_keep_recommended_policy_static")||X.set("entity_keep_recommended_policy_static",Ce.RECOMMENDATION_APPLY_AS_OPTIONS[0].value),X.has("entity_threshold_direction")||X.set("entity_threshold_direction",Ce.THRESHOLD_CONFIGURATION_OPTIONS[0].value),X.set("is_entity_level_thresholding",!0),X.set("is_entity_recommendation_async_job_required",!0),O===be.SERVICE_KPI_ENTITIES_RETRIEVE_STATUS.SUCCESS?it():$e(!0)},[X,O,it]);return V.default.createElement("div",null,V.default.createElement(se.default,{position:"top-center"}),V.default.createElement(Me.default,{isPSCInstalled:_,isPSCDisabled:o,onLoadRecommendationsClick:ct,onRecommendationControlsChange:dt,recommendationSettingsObject:et}),V.default.createElement(we.default,{kpiModel:X,isThresholdCopyInProgress:Ue,isPerEntityThresholdEnabled:Fe,handleCopyThresholds:ot}),(()=>{if(Fe&&(O===be.SERVICE_KPI_ENTITIES_RETRIEVE_STATUS.IN_PROGRESS||O===pe.READY||D===be.SERVICE_KPI_ENTITIES_CONFIG_RETRIEVE_STATUS.IN_PROGRESS||D===pe.READY))return V.default.createElement(Pe,{"data-test-itsi":"entity-thresholding-wait-spinner",size:"large"});var s,o,_,R=S||!je&&(0,Y.default)(Ne.thresholdObj)||Ne.isReadOnly,N=(s=Be,o=Ne.thresholdObj,je||(0,Y.default)(o)?s:_objectSpread(_objectSpread({},(0,U.default)(o)),{},{alertPeriod:s.alertPeriod,baseSearch:s.baseSearch,entityStatop:s.entityStatop,searchTimeSeriesEntities:s.searchTimeSeriesEntities,entityBreakdownIdFields:s.entityBreakdownIdFields,thresholdField:s.thresholdField,thresholdType:s.thresholdType,rawSearch:s.search_time_series_entities,searchAlertEarliest:s.searchAlertEarliest,is_entity_breakdown:null===(_=s.tempKpiData)||void 0===_?void 0:_.is_entity_breakdown})),j=!(je||(0,Y.default)(Ne.thresholdObj));return V.default.createElement(De,null,Fe&&V.default.createElement(xe.default,{updateSelectedEntityInParent:st,kpiEntitiesData:P&&(null==P?void 0:P.results)}),V.default.createElement(Le,null,Ze?V.default.createElement(V.default.Fragment,null,j&&V.default.createElement(Oe.default,{key:N._key,selectedThresholdType:getThresholdType(N),selectedAdaptiveTrainingWindow:N.adaptiveTrainingWindow,handleThresholdTypeChange:handleEntityThresholdTypeChange,handleAdaptiveTrainingWindowChange:handleEntityAdaptiveTrainingWindowChange,isReadOnly:R}),V.default.createElement(Re.default,{isEntityLevelPreview:!0,entityData:Ne.entity,thresholdData:N,getTimeInIso:!0,isDefaultEntityThresholdView:je,useRawSearch:_e}),V.default.createElement(Ie.default,{isEntityLevelPreview:!0,thresholdObj:N,entityData:Ne.entity,onThresholdUpdate:lt,isReadOnly:R,isDefaultEntityThresholdView:je,isEntityLevelThreshold:j,width:1055})):V.default.createElement(Pe,{"data-test-itsi":"entity-thresholding-per-entity-level-wait-spinner",size:"large"})))})(),V.default.createElement(ke.default,{modalDataTestItsi:"entity-load-recommendations-modal",cancelButtonDataTestItsi:"entity-load-recommendations-modal-cancel-button",primaryButtonDataTestItsi:"entity-load-recommendations-modal-confirm-button",showCancel:!0,beforeClose:ht,open:Ye,title:(0,ce.gettext)("Load Recommendations"),primaryButtonLabel:(0,ce.gettext)("Confirm"),primaryButtonClicked:ut},(0,ce.gettext)("Loading recommendations will cause all existing threshold settings to be overwritten. Are you sure you want to load recommendations?")))}EntityThresholdingContainer.propTypes={isPSCDisabled:X.default.bool,isPSCInstalled:X.default.bool,isReadOnly:X.default.bool,kpiModel:X.default.object.isRequired,kpiEntitiesApiErrorMessage:X.default.string.isRequired,kpiEntitiesApiStatus:X.default.string.isRequired,kpiEntitiesData:X.default.object.isRequired,previewEntitiesThresholdsRecommendationSearchStatus:X.default.string.isRequired,previewEntitiesThresholdsRecommendationResults:X.default.object.isRequired,kpiEntitiesConfigApiStatus:X.default.string.isRequired,kpiEntitiesConfigData:X.default.array.isRequired,onThresholdUpdate:X.default.func.isRequired,serviceKpiEntitiesRetrieveAction:X.default.func.isRequired,previewRecommendedEntitiesThresholdsSearchRetrieveAction:X.default.func.isRequired,serviceKpiEntitiesConfigRetrieveAction:X.default.func.isRequired,useRawSearch:X.default.bool.isRequired},EntityThresholdingContainer.defaultProps={isPSCDisabled:!1,isPSCInstalled:!0,isReadOnly:!1};o.default=(0,j.connect)(s=>({kpiEntitiesApiErrorMessage:s.services.kpiEntitiesApiErrorMessage,kpiEntitiesApiStatus:s.services.kpiEntitiesApiStatus,kpiEntitiesData:s.services.kpiEntitiesData,previewEntitiesThresholdsRecommendationSearchStatus:s.serviceDefinition.previewEntitiesThresholdsRecommendationSearchStatus,previewEntitiesThresholdsRecommendationResults:s.serviceDefinition.previewEntitiesThresholdsRecommendationResults,kpiEntitiesConfigApiErrorMessage:s.services.kpiEntitiesConfigApiErrorMessage,kpiEntitiesConfigApiStatus:s.services.kpiEntitiesConfigApiStatus,kpiEntitiesConfigData:s.services.kpiEntitiesConfigData}),s=>(0,K.bindActionCreators)({serviceKpiEntitiesRetrieveAction:Se.serviceKpiEntitiesRetrieve,previewRecommendedEntitiesThresholdsSearchRetrieveAction:_e.previewRecommendedEntitiesThresholdsSearchRetrieve,serviceKpiEntitiesConfigRetrieveAction:Se.serviceKpiEntitiesConfigRetrieve},s))(EntityThresholdingContainer);s.exports=o.default},2693:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y=S(_(7)),$=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),X=_(46),Z=S(_(3)),Q=S(_(2)),ee=S(_(94)),te=S(_(69)),ie=S(_(99)),ae=S(_(39)),ne=S(_(583)),re=S(_(304)),se=S(_(624)),le=S(_(156)),oe=S(_(64)),de=S(_(383)),ce=S(_(66)),he=S(_(83)),ue=S(_(75)),pe=S(_(116)),fe=_(4),ge=_(41),me=_(87),ve=_(519),ye=_(102);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var _e=Q.default.div(R||(R=(0,Y.default)(["\n display: flex;\n flex-direction: column;\n width: 226px;\n align-items: flex-start;\n margin: 0px;\n border: 1px solid ",";\n"])),pe.default.gray80),Se=Q.default.div(O||(O=(0,Y.default)(["\n display: flex;\n flex-direction: column;\n gap: 13px;\n margin: 12px;\n width: 204px;\n"]))),be=(0,Q.default)(de.default)(P||(P=(0,Y.default)(["\n overflow: auto;\n height: 720px;\n width: 100%;\n"]))),Ee=(0,Q.default)(oe.default)(D||(D=(0,Y.default)(["\n margin: 4px 0px 0px 0px;\n"]))),Te=(0,Q.default)(ue.default)(N||(N=(0,Y.default)(["\n float: right;\n margin-right: 12px;\n"]))),Ce=(0,Q.default)(ne.default)(V||(V=(0,Y.default)(["\n float: right;\n margin: 4px 12px 4px 4px;\n color: ",";\n"])),pe.default.successColor),ke=(0,Q.default)(se.default)(j||(j=(0,Y.default)(["\n float: right;\n margin-right: 11px;\n margin-top: 2px;\n color: ",";\n font-size: 22px;\n"])),pe.default.infoColor),xe=(0,Q.default)(re.default)(K||(K=(0,Y.default)(["\n float: right;\n margin-right: 12px;\n margin-top: 2px;\n color: ",";\n font-size: 22px;\n"])),pe.default.errorColor),we=(0,Q.default)(le.default)(W||(W=(0,Y.default)(["\n background-color: ",";\n padding-left: 12px;\n height: 48px;\n &:hover {\n background-color: ",";\n }\n width: 100%;\n"])),s=>s.selected?pe.default.gray80:"none",pe.default.gray80),Re=Q.default.div(U||(U=(0,Y.default)(["\n display: inline-block;\n font-weight: bold;\n overflow: hidden;\n text-overflow: ellipsis;\n vertical-align: middle;\n white-space: nowrap;\n width: 182px;\n"])));function EntitySidePanel(s){var{kpiEntitiesData:o,updateSelectedEntityInParent:_,previewEntitiesThresholdsRecommendationSearchStatus:S,previewEntitiesThresholdsRecommendationResults:R}=s,O={entity_key:"entity_default_configuration",entity_title:(0,fe.gettext)("Default Configuration")},[P,D]=(0,$.useState)(""),[N,V]=(0,$.useState)(o),[j,K]=(0,$.useState)(""),[W,U]=(0,$.useState)(o.length?o[0]:O),[Y,X]=(0,$.useState)(!1),Z=(0,ee.default)((s,_)=>{var S,R,{value:O}=_,N=O.toLowerCase();if(N!==P){var j=(S=N,R=new RegExp((0,me.regexEscapedObjectName)(S.trim()),"ig"),o.filter(s=>-1!==s.entity_title.search(R)));D(N),V(j)}},me.DEFAULT_DEBOUNCE_DELAY),Q=(0,$.useCallback)((s,o)=>{var{value:_}=o;K(_)},[]),ae=(0,$.useCallback)(s=>{U(s),_(s)},[_]),handleEntityClick=s=>()=>ae(s);(0,$.useEffect)(()=>{S===ve.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.IN_PROGRESS&&X(!0)},[S]);var createEntityItem=(s,o)=>$.default.createElement(we,{"data-test-itsi":"entity-side-panel-entity-list-clickable",key:"N/A"!==s.entity_key?s.entity_key:s.entity_title,onClick:handleEntityClick(s),selected:W&&W.entity_key===s.entity_key&&W.entity_title===s.entity_title},$.default.createElement(Re,{"data-test-itsi":"entity-side-panel-entity-list-title",title:s.entity_title},s.entity_title),((s,o)=>{if(!(0,ie.default)(o)&&Y){if(S!==ge.READY&&o>9)return $.default.createElement(ke,null);if(S===ve.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.IN_PROGRESS)return $.default.createElement(Te,null);if(S===ve.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.ERROR)return $.default.createElement(xe,{variant:"filled"});if(S===ve.PREVIEW_RECOMMENDED_ENTITIES_THRESHOLDS_SEARCH_RETRIEVE_STATUS.SUCCESS){var _=(0,te.default)(R.results,{entity_title:s.entity_title});return(0,ie.default)(_)||_["Recommendation Flag"]!==ye.ENTITY_RECOMMENDATIONS.SUCCESSFUL&&_["Recommendation Flag"]!==ye.ENTITY_RECOMMENDATIONS.NO_PATTERN?$.default.createElement(ke,null):$.default.createElement(Ce,{size:1})}}return $.default.createElement("span",null)})(s,o));return $.default.createElement(_e,null,$.default.createElement(Se,null,$.default.createElement(Ee,{"data-test-itsi":"entity-side-panel-entity-count"},N.length," ",(0,fe.gettext)("Entities")),$.default.createElement(he.default,{appearance:"search","data-test-itsi":"entity-side-panel-entity-search-box",canClear:!0,placeholder:(0,fe.gettext)("Search..."),onChange:Z}),$.default.createElement(ce.default,{"data-test-itsi":"entity-side-panel-recommendation-status-select",value:j,placeholder:(0,fe.gettext)("Entity Status"),onChange:Q,inline:!1},ye.ENTITY_RECOMMENDATION_STATUS.map(s=>$.default.createElement(ce.default.Option,{"data-test-itsi":"entity-side-panel-recommendation-status-select-option",label:s.label,value:s.value,key:s.value})))),$.default.createElement(be,{"data-test-itsi":"entity-side-panel-entities-scroll-container"},$.default.createElement("div",{"data-test-itsi":"entity-side-panel-entities-container"},[createEntityItem(O),...N.map((s,o)=>createEntityItem(s,o))])))}EntitySidePanel.propTypes={kpiEntitiesData:Z.default.array.isRequired,updateSelectedEntityInParent:Z.default.func,previewEntitiesThresholdsRecommendationSearchStatus:Z.default.string.isRequired,previewEntitiesThresholdsRecommendationResults:Z.default.object.isRequired},EntitySidePanel.defaultProps={updateSelectedEntityInParent:ae.default};o.default=(0,X.connect)(s=>({previewEntitiesThresholdsRecommendationSearchStatus:s.serviceDefinition.previewEntitiesThresholdsRecommendationSearchStatus,previewEntitiesThresholdsRecommendationResults:s.serviceDefinition.previewEntitiesThresholdsRecommendationResults}),null)(EntitySidePanel);s.exports=o.default},2694:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j=S(_(7)),K=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),W=S(_(2)),U=S(_(3)),Y=S(_(27)),$=S(_(44)),X=S(_(64)),Z=S(_(24)),Q=S(_(66)),ee=_(4),te=_(102);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var ie=W.default.div(R||(R=(0,j.default)(["\n margin: 16px 10px;\n"]))),ae=W.default.div(O||(O=(0,j.default)(["\n display: flex;\n"]))),ne=(0,W.default)(X.default)(P||(P=(0,j.default)(["\n margin-top: 10px;\n width: 150px;\n"]))),re=(0,W.default)(Q.default)(D||(D=(0,j.default)(["\n width: 220px !important;\n"]))),se=(0,W.default)($.default)(N||(N=(0,j.default)(["\n margin-left: 16px;\n div[data-test='controls'] {\n width: 120px;\n }\n"]))),le=(0,W.default)(Z.default)(V||(V=(0,j.default)(["\n align-self: flex-end;\n margin-left: 16px;\n"])));function EntityThresholdControls(s){var{kpiModel:o,isPerEntityThresholdEnabled:_,isThresholdCopyInProgress:S,handleCopyThresholds:R}=s,[O,P]=(0,K.useState)(_?te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[1].value:te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[0].value),D=(0,K.useCallback)((s,_)=>{var{value:S}=_;P(S),S===te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[1].value?o.set("is_entity_level_thresholding",!0):o.set("is_entity_level_thresholding",!1)},[o]);(0,K.useEffect)(()=>{_&&O!==te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[1].value?P(te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[1].value):_||O===te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[0].value||P(te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[0].value)},[_]);var N=o.get("time_variate_thresholds")?(0,ee.gettext)("time-variant"):(0,ee.gettext)("static");return K.default.createElement(ie,null,K.default.createElement(ae,null,K.default.createElement(ne,{"data-test-itsi":"entity-threshold-control-threshold-set-up-header",level:4},(0,ee.gettext)("Entity set up")),K.default.createElement($.default,{"data-test-itsi":"entity-threshold-control-threshold-apply-as-select-control",label:(0,ee.gettext)("Apply as"),labelPosition:"top",required:!0,tooltip:te.ENTITY_THRESHOLD_APPLY_AS_TYPE_TOOLTIP},K.default.createElement(re,{"data-test-itsi":"entity-threshold-control-threshold-apply-as-select",value:O,onChange:D},te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS.map(s=>K.default.createElement(Q.default.Option,{"data-test-itsi":"entity-threshold-control-threshold-apply-as-select-option",label:s.label,value:s.value,key:s.value})))),O===te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[0].value?K.default.createElement(se,{"data-test-itsi":"entity-threshold-control-threshold-copy-threshold-button-control",label:(0,ee.gettext)("Copy KPI threshold settings to global entity threshold settings?"),labelPosition:"top"},K.default.createElement(Y.default,{"data-test-itsi":"entity-threshold-control-threshold-copy-threshold-button",disabled:S,label:S?(0,ee.gettext)("Copying..."):(0,ee.gettext)("Copy settings"),onClick:R})):K.default.createElement(le,{type:"info","data-test-itsi":"entity-threshold-per-entity-threshold-info-message"},(0,ee.gettext)("The default configuration will be saved to the threshold template. Customizations for individual entities will not be stored."))),O===te.ENTITY_THRESHOLD_APPLY_AS_OPTIONS[0].value&&K.default.createElement(Z.default,{type:"info","data-test-itsi":"entity-threshold-threshold-type-info-message"},(0,ee.gettext)("The thresholding type is set to"),K.default.createElement("strong",null," ",N,", "),(0,ee.gettext)("aligned with your KPI thresholding settings. To change thresholding type for entities, you must also change thresholding type for KPIs.")))}EntityThresholdControls.propTypes={kpiModel:U.default.object.isRequired,isPerEntityThresholdEnabled:U.default.bool,isThresholdCopyInProgress:U.default.bool,handleCopyThresholds:U.default.func.isRequired},EntityThresholdControls.defaultProps={isPerEntityThresholdEnabled:!1,isThresholdCopyInProgress:!1};o.default=EntityThresholdControls;s.exports=o.default},2695:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N=S(_(7)),V=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),j=S(_(2)),K=S(_(3)),W=S(_(39)),U=S(_(44)),Y=S(_(66)),$=S(_(64)),X=_(4),Z=_(102),Q=_(57);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var ee=j.default.div(R||(R=(0,N.default)(["\n margin: 16px 0px;\n display: flex;\n"]))),te=(0,j.default)($.default)(O||(O=(0,N.default)(["\n margin-top: 10px;\n width: 150px;\n"]))),ie=(0,j.default)(U.default)(P||(P=(0,N.default)(["\n margin-left: 16px;\n"]))),ae=(0,j.default)(Y.default)(D||(D=(0,N.default)(["\n width: 220px !important;\n"])));function ThresholdTypeControl(s){var{isReadOnly:o,selectedAdaptiveTrainingWindow:_,selectedThresholdType:S,handleThresholdTypeChange:R,handleAdaptiveTrainingWindowChange:O}=s,[P,D]=(0,V.useState)(S),[N,j]=(0,V.useState)(_);_!==N&&j(_);var K=(0,V.useCallback)((s,o)=>{var{value:_}=o;_!==P&&(D(_),R(_))},[R,P]),W=(0,V.useCallback)((s,o)=>{var{value:_}=o;_!==N&&(j(_),O(_))},[N,O]);return V.default.createElement(ee,null,V.default.createElement(te,{"data-test-itsi":"threshold-type-control-heading",level:4},(0,X.gettext)("Settings")),V.default.createElement(U.default,{"data-test-itsi":"threshold-type-control-group",label:(0,X.gettext)("Thresholding Type"),labelPosition:"top",required:!0},V.default.createElement(ae,{"data-test-itsi":"threshold-type-select",value:P,onChange:K,disabled:o},Z.THRESHOLD_TYPE_OPTIONS.map(s=>V.default.createElement(Y.default.Option,{"data-test-itsi":"threshold-type-select-option",label:s.label,value:s.value,key:s.value})))),"adaptive"===P&&V.default.createElement(ie,{"data-test-itsi":"threshold-type-adaptive-training-window-control",label:(0,X.gettext)("Training Window"),labelPosition:"top",required:!0,tooltip:Z.AT_TRAINING_WINDOW_TOOLTIP},V.default.createElement(Y.default,{"data-test-itsi":"threshold-type-adaptive-training-window-select",value:N,onChange:W,disabled:o},Q.KPI_TIME_PRESETS.slice(0,2).map(s=>V.default.createElement(Y.default.Option,{"data-test-itsi":"threshold-type-adaptive-training-window-select-option",label:s.label,value:s.value,key:s.value})))))}ThresholdTypeControl.propTypes={selectedThresholdType:K.default.string,selectedAdaptiveTrainingWindow:K.default.string,handleThresholdTypeChange:K.default.func,handleAdaptiveTrainingWindowChange:K.default.func,isReadOnly:K.default.bool},ThresholdTypeControl.defaultProps={selectedThresholdType:Z.THRESHOLD_TYPE_OPTIONS[0].value,selectedAdaptiveTrainingWindow:Q.KPI_TIME_PRESETS[0].value,handleThresholdTypeChange:W.default,handleAdaptiveTrainingWindowChange:W.default,isReadOnly:!1};o.default=ThresholdTypeControl;s.exports=o.default},2696:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),O=S(_(39)),P=S(_(3)),D=S(_(373)),N=S(_(313)),V=_(4),j=_(110);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var K=R.default.createElement(D.default,{"data-test-itsi":"thresholding-content-tab-".concat(j.KPI_THRESHOLD_TYPES.AGGREGATE,"-recommendation-icon")});function KpiThresholdingContentTabView(s){var{showRecommendationIcon:o,handleTabChange:_}=s,[S,O]=(0,R.useState)(j.KPI_THRESHOLD_TYPES.AGGREGATE),P=(0,R.useCallback)((s,o)=>{var{selectedTabId:S}=o;O(S),_(S)},[_]);return R.default.createElement(N.default,{"data-test-itsi":"thresholding-content-tab-bar",activeTabId:S,onChange:P,iconSize:"inline"},R.default.createElement(N.default.Tab,{"data-test-itsi":"thresholding-content-tab-".concat(j.KPI_THRESHOLD_TYPES.AGGREGATE),label:(0,V.gettext)("KPI Thresholding"),tabId:j.KPI_THRESHOLD_TYPES.AGGREGATE,icon:o?K:""}),R.default.createElement(N.default.Tab,{"data-test-itsi":"thresholding-content-tab-".concat(j.KPI_THRESHOLD_TYPES.ENTITY),label:(0,V.gettext)("Entity Thresholding"),tabId:j.KPI_THRESHOLD_TYPES.ENTITY}))}KpiThresholdingContentTabView.propTypes={handleTabChange:P.default.func,showRecommendationIcon:P.default.bool},KpiThresholdingContentTabView.defaultProps={handleTabChange:O.default,showRecommendationIcon:!1};o.default=KpiThresholdingContentTabView;s.exports=o.default},2697:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X=S(_(8)),Z=S(_(7)),Q=_interopRequireWildcard(_(0)),ee=_(46),te=_(48),ie=S(_(3)),ae=S(_(2)),ne=_interopRequireWildcard(_(166)),re=S(_(81)),se=S(_(37)),le=S(_(33)),oe=S(_(121)),de=S(_(373)),ce=_interopRequireWildcard(_(337)),he=_(322),ue=S(_(247)),pe=S(_(24)),fe=S(_(91)),ge=S(_(51)),me=S(_(461)),ve=S(_(75)),ye=_(14),_e=_(4),Se=_(22),be=_(73),Ee=_(29),Te=_(78),Ce=_(107),ke=_(110),xe=_(67),we=_(452),Re=_(487),Ie=_(803),Me=_(519),Oe=_(109),Ae=_(145),Pe=_(102),De=S(_(162)),Le=S(_(2698)),Ne=S(_(2699)),Ve=S(_(705)),je=S(_(706)),He=S(_(815));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,X.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var Be=ae.default.div(R||(R=(0,Z.default)(["\n display: flex;\n flex-direction: column;\n position: relative;\n margin: 0px;\n padding: 12px;\n border: 1px solid ",";\n"])),Se.variables.gray80),Ke=ae.default.div(O||(O=(0,Z.default)(["\n display: flex;\n"]))),Fe=ae.default.div(P||(P=(0,Z.default)(["\n display: flex;\n flex-direction: row;\n width: 1000px;\n"]))),We=ae.default.span(D||(D=(0,Z.default)(["\n padding: 10px;\n"]))),Ue=(0,ae.default)(ve.default)(N||(N=(0,Z.default)(["\n align-self: center;\n vertical-align: middle;\n"]))),Ge=ae.default.span(V||(V=(0,Z.default)(["\n padding: 6px 0;\n min-width: calc(100vw - 20px * 4);\n"]))),Ye=ae.default.div(j||(j=(0,Z.default)(["\n padding-top: 10px;\n"]))),qe=(0,ae.default)(pe.default)(K||(K=(0,Z.default)(["\n margin: 20px;\n"]))),ze=(0,ae.default)(pe.default)(W||(W=(0,Z.default)(["\n margin: 20px 0 0;\n"]))),$e=(0,ae.default)(ue.default.Item)(U||(U=(0,Z.default)(["\n display: flex;\n"]))),Je=(0,ae.default)(de.default)(Y||(Y=(0,Z.default)(["\n margin-right: 4px;\n"]))),Xe=(0,ae.default)(ge.default)($||($=(0,Z.default)(["\n margin-left: 4px;\n margin-right: 4px;\n"]))),Ze=(0,ce.makeCreateToast)(ce.default);function KpiThresholdingSectionContainer(s){var{isPSCDisabled:o,isPSCInstalled:_,isReadOnly:S,kpiModel:R,onThresholdUpdate:O,useRawSearch:P,healthAnalyticsConsoleRecommendationsSearchRetrieveAction:D,healthAnalyticsConsoleRecommendationsResultsRetrieveAction:N,healthAnalyticsConsoleRecommendationsSearchResetAction:V,recommendationSearchSid:j,recommendationSearchStatus:K,recommendationSearchErrorMessage:W,recommendationResults:U,thresholdRecommendationKPIDataAvailabilitySearchRetrieveAction:Y,thresholdRecommendationKPIDataAvailabilitySearchStatus:$,thresholdRecommendationKPIDataAvailabilitySearchResults:X}=s,[Z,ee]=(0,Q.useState)((s=>{var o,_,{_key:S,title:O,alert_period:P,aggregate_thresholds:D,aggregate_thresholds_alert_enabled:N,aggregate_thresholds_custom_alert_enabled:V,aggregate_thresholds_custom_alert_rules:j,aggregate_outlier_detection_enabled:K,outlier_detection_algo:W,outlier_detection_sensitivity:U,base_search:Y,entity_statop:$,entity_thresholds:X,entity_breakdown_id_fields:Z,search_time_series_aggregate:Q,search_time_series_entities:ee,threshold_field:te,time_variate_thresholds:ie,time_variate_thresholds_specification:ae,adaptive_thresholds_is_enabled:ne,adaptive_thresholding_training_window:re,search_alert_earliest:se,recommendation_training_window:le}=s;return{_key:S,name:O,isAdaptiveThresholdsEnabled:ne,isKpiAlertingEnabled:N,isKpiCustomAlertingEnabled:V,kpiCustomAlertRules:j,isOutlierDetectionEnabled:K,outlierDetectionAlgorithm:W||"stdev",outlierDetectionSensitivity:U||2,adaptiveTrainingWindow:re||"7 days",isTimeVariateThresholds:ie,baseSearch:Y,entityStatop:$,searchTimeSeriesAggregate:Q,searchTimeSeriesEntities:ee,entityBreakdownIdFields:Z,thresholdField:te,searchAlertEarliest:se,recommendationTrainingWindow:le,aggregateThresholdsConfig:_objectSpread(_objectSpread({},D),{},{thresholdLevels:D.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}})}),entityThresholdsConfig:_objectSpread(_objectSpread({},X),{},{thresholdLevels:X.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}})}),timeVariateThresholdsSpecification:(o=ae.get("policies"),_={policies:{}},o.models&&o.models.forEach(s=>{var{id:o}=s,{title:S,aggregate_thresholds:R,entity_thresholds:O,policy_type:P,time_blocks:D}=s.toJSON()[o],{thresholdLevels:N,gaugeMin:V,gaugeMax:j,isMinStatic:K,isMaxStatic:W,renderBoundaryMin:U,renderBoundaryMax:Y,baseSeverityValue:$,baseSeverityColor:X,baseSeverityColorLight:Z,baseSeverityLabel:Q,metricField:ee}=R;_.policies[o]={title:S,aggregate_thresholds:{gaugeMax:j,thresholdLevels:N.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}}),isMaxStatic:W,gaugeMin:V,baseSeverityLabel:Q,baseSeverityColor:X,metricField:ee,baseSeverityValue:$,baseSeverityColorLight:Z,renderBoundaryMin:U,renderBoundaryMax:Y,isMinStatic:K},entity_thresholds:{gaugeMax:O.gaugeMax,thresholdLevels:O.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}}),isMaxStatic:O.isMaxStatic,gaugeMin:O.gaugeMin,baseSeverityLabel:O.baseSeverityLabel,baseSeverityColor:O.baseSeverityColor,metricField:O.metricField,baseSeverityValue:O.baseSeverityValue,baseSeverityColorLight:O.baseSeverityColorLight,renderBoundaryMin:O.renderBoundaryMin,renderBoundaryMax:O.renderBoundaryMax,isMinStatic:O.isMinStatic},policy_type:P,time_blocks:D}}),_),thresholdType:ke.KPI_THRESHOLD_TYPES.AGGREGATE,rawSearch:s.search_time_series_aggregate,alertPeriod:P,tempKpiData:_objectSpread(_objectSpread({},s),{},{adaptive_thresholding_training_window:R.get("adaptive_thresholding_training_window"),time_variate_thresholds_specification:JSON.parse(JSON.stringify(ae.toJSON()))})}})(R.toJSON())),[te,ie]=(0,Q.useState)(!1),[ae,de]=(0,Q.useState)(""),[ce,pe]=(0,Q.useState)(!1),[ve,Se]=(0,Q.useState)(!1),[we,Ie]=(0,Q.useState)(!1),[Qe,et]=(0,Q.useState)({}),[tt,it]=(0,Q.useState)(!1),[at,nt]=(0,Q.useState)({}),[rt,st]=(0,Q.useState)(!1),lt={analysisWindowValue:R.get("recommendation_training_window")||Pe.ANALYSIS_WINDOW_OPTIONS[1].value,analysisWindowStartDate:R.get("recommendation_start_date")||(0,oe.default)().subtract(Pe.ANALYSIS_WINDOW_OPTIONS[1].days,"days").unix(),recommendationApplyAsValue:!!R.get("keep_recommended_policy_static"),thresholdConfigValue:R.get("threshold_direction")||Pe.THRESHOLD_CONFIGURATION_OPTIONS[0].value},ot=(0,Q.useRef)();(0,Q.useEffect)(()=>(ot.current=null,()=>clearTimeout(ot.current)),[]);var dt=(0,Q.useCallback)(s=>{var o,_=_objectSpread({},Z);null!==(o=s.timeVariateThresholdsSpecification)&&void 0!==o&&o.policies&&(_.timeVariateThresholdsSpecification=s.timeVariateThresholdsSpecification),s.aggregateThresholdsConfig&&(_.aggregateThresholdsConfig=s.aggregateThresholdsConfig),ee(_),O(_)},[Z,O]),ct=(0,Q.useCallback)((s,o)=>{R.set("did_load_recommendation",!1),"threshold_direction"===s?R.set("threshold_direction",o):"analysis_window"===s?R.set("recommendation_training_window",o):"start_date"===s?R.set("recommendation_start_date",o):"apply_as"===s&&R.set("keep_recommended_policy_static",o)},[R]),ht=(0,Q.useCallback)(s=>{var o=_objectSpread({},Z);if("adaptive"===s)o.isTimeVariateThresholds=!0,o.isAdaptiveThresholdsEnabled=!0,ee(o),R.set("time_variate_thresholds",!0),R.set("adaptive_thresholds_is_enabled",!0);else if("time"===s){var _=o.timeVariateThresholdsSpecification.policies;Object.keys(_).forEach(s=>{"static"!==_[s].policy_type&&(_[s].policy_type="static")}),o.isTimeVariateThresholds=!0,o.isAdaptiveThresholdsEnabled=!1,o.timeVariateThresholdsSpecification.policies=_,ee(o),R.set("time_variate_thresholds",!0),R.set("adaptive_thresholds_is_enabled",!1),O(o)}else o.isTimeVariateThresholds=!1,o.isAdaptiveThresholdsEnabled=!1,ee(o),R.set("time_variate_thresholds",!1),R.set("adaptive_thresholds_is_enabled",!1);et({})},[Z,R,O]),ut=(0,Q.useCallback)(s=>{var o=_objectSpread({},Z);o.isKpiAlertingEnabled=s,ee(o),R.set("aggregate_thresholds_alert_enabled",s)},[Z,R]),pt=(0,Q.useCallback)(s=>{var o=_objectSpread({},Z);o.adaptiveTrainingWindow=s,ee(o),R.set("adaptive_thresholding_training_window",s)},[Z,R]),ft=(0,Q.useCallback)(s=>{var o=_objectSpread({},Z);o.isOutlierDetectionEnabled=s,ee(o),R.set("aggregate_outlier_detection_enabled",s)},[Z,R]),gt=(0,Q.useCallback)(s=>{var o=_objectSpread({},Z);o.outlierDetectionAlgorithm=s,ee(o),R.set("outlier_detection_algo",s)},[Z,R]),mt=(0,Q.useCallback)(s=>{var o=_objectSpread({},Z);o.outlierDetectionSensitivity=s,ee(o),R.set("outlier_detection_sensitivity",s)},[Z,R]),vt=(0,Q.useCallback)(()=>{Ie(!0),(0,Te.cleanSearchJobSubscriptions)(null==at?void 0:at.searchJob,null==at?void 0:at.searchJobSubscription);var s=Z._key,o="".concat((0,Ae.getAdaptiveThresholdMetricIndexSearchForKpi)(s,null,!1)," usetempcollection collection=itsi_temporary_storage key=").concat(s);(0,Oe.syncTempCollection)(Z._key,R.toJSON()).then(()=>{var s=fe.default.create({id:(0,Te.createUniqueSearchId)("kpi-update-adaptive-thresholding-search"),earliest_time:Z.adaptiveTrainingWindow,latest_time:"now",preview:!1,cancelOnUnload:!0,search:o},{app:(0,be.getShortAppName)(!0)}),_=s.getResults().subscribe({next:()=>{(0,Oe.retrieveTempCollection)(Z._key).then(s=>{var{policies:o}=s.data.time_variate_thresholds_specification,_=Z.timeVariateThresholdsSpecification.policies;(0,se.default)(o,(s,S)=>{var R=_[S].aggregate_thresholds.thresholdLevels,P=ne.extent(s.aggregate_thresholds.thresholdLevels.map(s=>s.thresholdValue));P[0]=Number(P[0]),P[1]=Number(P[1]),(R.isMinStatic&&P[0]<R.gaugeMin||!R.isMinStatic)&&(R.gaugeMin=P[0]-Math.abs(.1*P[0]),R.renderBoundaryMin>R.gaugeMin&&(R.renderBoundaryMin=R.gaugeMin)),(R.isMaxStatic&&P[1]>R.gaugeMax||!R.isMaxStatic)&&(R.gaugeMax=P[1]+Math.abs(.1*P[1]),R.renderBoundaryMax<R.gaugeMax&&(R.renderBoundaryMax=R.gaugeMax));var D=_objectSpread({},Z);D.timeVariateThresholdsSpecification={policies:o},O(D),ee(D),Ie(!1)})})}});nt({searchJob:s,searchJobSubscription:_})})},[at.searchJob,at.searchJobSubscription,Z,R,O]),yt=(0,Q.useCallback)(()=>{var s=Q.default.createElement(Ge,null,Q.default.createElement(Ue,{"data-test-itsi":"load-recommendation-wait-spinner",size:"medium"})," ",(0,_e.gettext)("Checking for KPI data in the selected time range..."));de(s);var o=R.get("recommendation_training_window")||"30d",_=R.get("recommendation_start_date")?oe.default.unix(R.get("recommendation_start_date")):oe.default.unix((0,oe.default)().subtract(o.match(/\d+/g)[0],"days").unix()),S=_.clone(),O=o.match(/\d+/g)[0];S.add(O,"days");var P={search:(0,Ae.getMetricIndexEarliestTimeSearchForKPIData)([Z._key]),earliest:"-".concat((0,oe.default)().diff(_,"day"),"d"),latest:(0,oe.default)().isSame(S,"day")?"now":"-".concat((0,oe.default)().diff(S,"day"),"d")};Y(P)},[Z,R,Y]),_t=(0,Q.useCallback)(()=>{pe(!0),ie(!0),yt()},[yt]),handleLoadRecommendationsKPIDataSearchResponse=(s,o)=>{var _=(R.get("recommendation_training_window")||"30d").match(/\d+/g)[0],S=Q.default.createElement(ze,{type:"error",appearance:"fill"},(0,_e.gettext)("Unable to identify KPI data for the number of days selected. Update the analysis window and try again."));if(s){var O=o.length?Math.ceil((new Date-1e3*Number(o[0].earliest_data_time))/864e5):0;S=O<Number(_)&&Q.default.createElement(ze,{type:"warning",appearance:"fill"},(0,ye.sprintf)((0,_e.gettext)("You have only %(data_range)d days of summary data for this KPI."),{data_range:O}))}de(S),pe(!1)},St=(0,Q.useCallback)(()=>{ie(!1)},[]),handleLoadRecommendationsNoRecommendation=s=>{var o="";switch(s){case Pe.KPI_NO_RECOMMENDATIONS.CONSTANT_KPI.type:o=(0,_e.gettext)("We detected a constant value in your data and are unable to recommend threshold values and settings.");break;case Pe.KPI_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.type:o=(0,_e.gettext)("Your KPI does not have enough data for our system to produce targeted recommendations for the options you previously selected.");break;case Pe.KPI_NO_RECOMMENDATIONS.PATTERN_SWITCH.type:o=(0,_e.gettext)("We could not detect a consistent pattern in your data. It appears that there is more than one pattern.");break;default:o=(0,ye.sprintf)((0,_e.gettext)("No recommendations available due to unknown reason: %(reasonCode)s"),{reasonCode:s})}Ze({type:he.TOAST_TYPES.ERROR,message:o,autoDismiss:!0,dismissOnActionClick:!0,showAction:!1})};(0,Q.useEffect)(()=>{if(K===Re.HEALTH_ANALYTICS_RECOMMENDATIONS_SEARCH_RETRIEVE_STATUS.SUCCESS&&j)N(j);else if(K===Re.HEALTH_ANALYTICS_RECOMMENDATIONS_RESULTS_RETRIEVE_STATUS.SUCCESS&&U){var s,o;if(Se(!1),null!=U&&null!==(s=U.result)&&void 0!==s&&null!==(s=s.data)&&void 0!==s&&s.length&&(null===(o=U.result.data[0])||void 0===o?void 0:o.itsi_kpi_id)===Z._key){var _,S=U.result.data[0].kpi_at_configurations.length?U.result.data[0].kpi_at_configurations:[],P=S[0][ke.KPI_AT_RESULTS_FIELDS.ALGORITHM_FIELD],D=null===(_=ke.POLICY_TYPES.find(s=>P===s.value))||void 0===_?void 0:_.label.toLowerCase(),Y=S[0][ke.KPI_AT_RESULTS_FIELDS.CONFIDENCE_FIELD],Q=S[0][ke.KPI_AT_RESULTS_FIELDS.SCORE_FIELD],te=S[0][ke.KPI_AT_RESULTS_FIELDS.TIME_POLICY_DESCRIPTION_FIELD],ie=Pe.ANALYSIS_WINDOW_OPTIONS.filter(s=>s.value===Z.recommendationTrainingWindow)[0],ae=S[0][ke.KPI_AT_RESULTS_FIELDS.THRESHOLD_DIRECTION_FIELD],ne={[ke.DEFAULT_POLICY_KEY]:{aggregate_thresholds:ke.DEFAULT_THRESHOLDS,entity_thresholds:ke.DEFAULT_THRESHOLDS,policy_type:"static",time_blocks:[],title:(0,_e.gettext)("Default")}};if(S[0][ke.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]!==Pe.KPI_RECOMMENDATIONS.SUCCESSFUL&&S[0][ke.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]!==Pe.KPI_NO_RECOMMENDATIONS.NO_PATTERN.type)return void handleLoadRecommendationsNoRecommendation(S[0][ke.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]);if(S[0][ke.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===Pe.KPI_NO_RECOMMENDATIONS.NO_PATTERN.type){var se=S[0][ke.KPI_AT_RESULTS_FIELDS.THRESHOLDS_FIELD].replace(/'/g,'"'),le=JSON.parse(se),oe=(0,Ce.generateSeverityLevels)(le,!1),de=(0,re.default)(ke.DEFAULT_THRESHOLDS);oe.sort((s,o)=>s.thresholdValue-o.thresholdValue),de.thresholdLevels=oe;var ce=oe[oe.length-1].thresholdValue,he=ce+.1*ce;de.gaugeMax=he,de.renderBoundaryMax=he,R.set("time_variate_thresholds",!1),R.set("adaptive_thresholds_is_enabled",!1),R.set("aggregate_outlier_detection_enabled",!1);var ue=_objectSpread({},Z);ue.isTimeVariateThresholds=!1,ue.isAdaptiveThresholdsEnabled=!1,ue.isOutlierDetectionEnabled=!1,ue.aggregateThresholdsConfig=de,O(ue),et({algorithm:D,days:null==ie?void 0:ie.days,confidence:Y,score:Q,timePolicy:te}),ee(ue)}else{var pe=[],fe=R.get("keep_recommended_policy_static");S.forEach(s=>{var o=(0,Ee.generateUUID)(),_=[[s[ke.KPI_AT_RESULTS_FIELDS.CRON_FIELD],parseInt(s[ke.KPI_AT_RESULTS_FIELDS.DURATION_FIELD],10)]],S=(0,xe.getUserTimezoneOffset)("sec"),O=(0,ke.getPolicyTitleFromTimeBlock)(_,S),P=s[ke.KPI_AT_RESULTS_FIELDS.THRESHOLDS_FIELD],D=parseFloat(s[ke.KPI_AT_RESULTS_FIELDS.MEAN_FIELD]),N=parseFloat(s[ke.KPI_AT_RESULTS_FIELDS.STD_FIELD]),V=P.replace(/'/g,'"'),j=JSON.parse(V),K=(0,Ce.generateSeverityLevels)(j,!0,D,N);pe.push({Algorithm:s[ke.KPI_AT_RESULTS_FIELDS.ALGORITHM_FIELD],Confidence:s[ke.KPI_AT_RESULTS_FIELDS.CONFIDENCE_FIELD],"Cron Expression":s[ke.KPI_AT_RESULTS_FIELDS.CRON_FIELD],Duration:s[ke.KPI_AT_RESULTS_FIELDS.DURATION_FIELD].toString(),"Recommendation Flag":s[ke.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD],Score:s[ke.KPI_AT_RESULTS_FIELDS.SCORE_FIELD].toString(),Sensitivity:s[ke.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD].toString(),"Threshold Direction":s[ke.KPI_AT_RESULTS_FIELDS.THRESHOLD_DIRECTION_FIELD],Thresholds:s[ke.KPI_AT_RESULTS_FIELDS.THRESHOLDS_FIELD],"Time Policy Description":s[ke.KPI_AT_RESULTS_FIELDS.TIME_POLICY_DESCRIPTION_FIELD],itsi_kpi_id:Z._key,Mean:s[ke.KPI_AT_RESULTS_FIELDS.MEAN_FIELD],Std:s[ke.KPI_AT_RESULTS_FIELDS.STD_FIELD]});var W=R.get("threshold_direction")!==Pe.THRESHOLD_CONFIGURATION_OPTIONS[2].value?ke.BASE_CRITICAL_THRESHOLDS:ke.DEFAULT_THRESHOLDS;ne[o]={_key:o,title:O,aggregate_thresholds:_objectSpread(_objectSpread({},W),{},{thresholdLevels:K}),entity_thresholds:ke.DEFAULT_THRESHOLDS,policy_type:fe?s[ke.KPI_AT_RESULTS_FIELDS.ALGORITHM_FIELD]:Pe.RECOMMENDATION_APPLY_AS_OPTIONS[1].value,time_blocks:_}});var ge=S[0][ke.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD]!==Pe.OUTLIER_NO_RECOMMENDATION;R.set("adaptive_thresholds_is_enabled",fe),R.set("aggregate_outlier_detection_enabled",ge),R.set("did_load_recommendation",!0),R.set("time_variate_thresholds",!0),R.set("time_variate_thresholds_specification",{policies:ne}),R.set("threshold_direction",ae),R.set("threshold_recommendations",pe);var me=_objectSpread({},Z);et({algorithm:D,days:null==ie?void 0:ie.days,confidence:Y,score:Q,timePolicy:te}),me.isAdaptiveThresholdsEnabled=fe,me.isOutlierDetectionEnabled=ge,me.isTimeVariateThresholds=!0,me.timeVariateThresholdsSpecification={policies:ne},S[0][ke.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD]!==Pe.OUTLIER_NO_RECOMMENDATION&&(R.set("outlier_detection_algo",Pe.OUTLIER_RECOMMENDATION_DETECTION_ALGORITHM),R.set("outlier_detection_sensitivity",Number(S[0][ke.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD])),me.outlierDetectionAlgorithm=Pe.OUTLIER_RECOMMENDATION_DETECTION_ALGORITHM,me.outlierDetectionSensitivity=Number(S[0][ke.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD])),O(me),ee(me)}}else{var ve=(0,ye.sprintf)((0,_e.gettext)("Recommendation failed to be generated. No results returned. %(searchMsg)s"),{searchMsg:W});handleLoadRecommendationsNoRecommendation(ve)}V()}else K!==Re.HEALTH_ANALYTICS_RECOMMENDATIONS_SEARCH_RETRIEVE_STATUS.IN_PROGRESS&&K!==Re.HEALTH_ANALYTICS_RECOMMENDATIONS_RESULTS_RETRIEVE_STATUS.IN_PROGRESS||(it(!0),Se(!0));$===Me.THRESHOLD_RECOMMENDATION_KPI_DATA_AVAILABILITY_SEARCH_RETRIEVE_STATUS.SUCCESS?handleLoadRecommendationsKPIDataSearchResponse(!0,X.results):$===Me.THRESHOLD_RECOMMENDATION_KPI_DATA_AVAILABILITY_SEARCH_RETRIEVE_STATUS.ERROR&&handleLoadRecommendationsKPIDataSearchResponse(!1,{})},[N,V,j,K,U,Y,$,X]);var bt=(0,Q.useCallback)(()=>{ie(!1),R.has("recommendation_training_window")||R.set("recommendation_training_window",Pe.ANALYSIS_WINDOW_OPTIONS[2].value),R.has("recommendation_start_date")||R.set("recommendation_start_date",(0,oe.default)().subtract(Pe.ANALYSIS_WINDOW_OPTIONS[2].days,"days").unix()),R.has("keep_recommended_policy_static")||R.set("keep_recommended_policy_static",Pe.RECOMMENDATION_APPLY_AS_OPTIONS[0].value),R.has("threshold_direction")||R.set("threshold_direction",Pe.THRESHOLD_CONFIGURATION_OPTIONS[0].value),R.set("is_entity_level_thresholding",!1);var s=R.get("recommendation_training_window")||"30d",o=R.get("recommendation_start_date")?oe.default.unix(R.get("recommendation_start_date")):oe.default.unix((0,oe.default)().subtract(s.match(/\d+/g)[0],"days").unix()),_=o.clone(),S=s.match(/\d+/g)[0];_.add(S,"days");var O={search:(0,Ae.getRecommendedThresholdSearchForKPIs)([Z._key],null,R.get("threshold_direction")||"auto"),earliest:"-".concat((0,oe.default)().diff(o,"day"),"d"),latest:(0,oe.default)().isSame(_,"day")?"now":"-".concat((0,oe.default)().diff(_,"day"),"d")};et({}),D(O)},[D,Z._key,R]),Et=(0,Q.useCallback)(()=>{st(!0)},[]),Tt=(0,Q.useCallback)(()=>{st(!1)},[]),Ct=(0,Q.useCallback)((s,o)=>{var _=_objectSpread({},Z);"all"===s?(_.isKpiCustomAlertingEnabled=!1,_.kpiCustomAlertRules=[],R.set({aggregate_thresholds_custom_alert_rules:[],aggregate_thresholds_custom_alert_enabled:!1})):(_.isKpiCustomAlertingEnabled=!0,_.kpiCustomAlertRules=o,R.set({aggregate_thresholds_custom_alert_rules:o,aggregate_thresholds_custom_alert_enabled:!0})),ee(_)},[Z,R]),kt=(0,Q.useMemo)(()=>ve?(0,_e.gettext)("Loading recommended threshold configuration based on an analysis of your KPI..."):(0,_e.gettext)("Applying adaptive thresholds based on an analysis of your KPI..."),[ve]);return Q.default.createElement("div",null,Q.default.createElement(Ve.default,{isPSCInstalled:_,isPSCDisabled:o,onLoadRecommendationsClick:_t,onRecommendationControlsChange:ct,recommendationSettingsObject:lt}),Q.default.createElement(Ne.default,{kpiData:Z,onThresholdingTypeChange:ht,onKpiAlertingToggle:ut,onTrainingWindowChange:pt,onKpiAlertingRulesClick:Et,onOutlierExclusionToggle:ft,onOutlierExclusionAlgoChange:gt,onOutlierExclusionSensitivityChange:mt,onUpdateAdaptiveThresholding:vt,isUpdatingAdaptiveThresholds:we}),tt&&Qe&&!(0,le.default)(Qe)&&Q.default.createElement(Ye,null,Q.default.createElement(qe,{appearance:"fill",type:"info","data-test-itsi":"health-analytics-thresholding-config-container-at-recommendations-container"},Q.default.createElement(me.default,{as:"p",weight:"bold"},(0,_e.gettext)("Splunk AI recommendations")),Q.default.createElement(ue.default,null,Q.default.createElement($e,{"data-test-itsi":"health-analytics-thresholding-config-container-time-policy-item"},Q.default.createElement(Je,null),Q.default.createElement(me.default,{as:"p",weight:"bold"},(0,ye.sprintf)((0,_e.gettext)("Time policies are %(areTimePoliciesEnabled)s"),{areTimePoliciesEnabled:Z.isTimeVariateThresholds?(0,_e.gettext)("active"):(0,_e.gettext)("inactive")})),Q.default.createElement(Xe,null,"-"),Q.default.createElement(ge.default,null,(0,_e.gettext)("based on analysis of KPI behavior over time."))),Z.isAdaptiveThresholdsEnabled&&Q.default.createElement($e,{"data-test-itsi":"health-analytics-thresholding-config-container-at-item"},Q.default.createElement(Je,null),Q.default.createElement(me.default,{as:"p",weight:"bold"},(0,ye.sprintf)((0,_e.gettext)("Adaptive thresholding with a %(days)s day analysis window using the %(algorithm)s algorithm"),{days:Qe.days,algorithm:Qe.algorithm})," "),Q.default.createElement(Xe,null,"-"),Q.default.createElement(ge.default,null,(0,_e.gettext)("this setting automatically adjusts threshold values by analyzing historical KPI behavior, and the algorithm method calculates threshold values that fit your data's behavior."))),Z.isAdaptiveThresholdsEnabled&&Q.default.createElement($e,{"data-test-itsi":"health-analytics-thresholding-config-container-outlier-item"},Q.default.createElement(Je,null),Q.default.createElement(me.default,{as:"p",weight:"bold"},(0,ye.sprintf)((0,_e.gettext)("Outlier exclusion is active using %(outlierAlgo)s"),{outlierAlgo:Pe.OUTLIER_ALGORITHM_LABEL_MAP[Z.outlierDetectionAlgorithm]})," "),Q.default.createElement(Xe,null,"-"),Q.default.createElement(ge.default,null,(0,_e.gettext)("this setting defines outlier data points to exclude from adaptive threshold calculations to avoid data skews."))),Q.default.createElement($e,{"data-test-itsi":"health-analytics-thresholding-config-container-description-item"},Q.default.createElement(Je,null),Q.default.createElement(me.default,{as:"p",weight:"bold"},(0,ye.sprintf)((0,_e.gettext)("%(description)s recommended with %(confidence)s confidence (Confidence Score = %(score)s%%)"),{description:Qe.timePolicy.charAt(0).toUpperCase()+Qe.timePolicy.slice(1),confidence:Qe.confidence,score:(100*Qe.score).toFixed(2)})),Q.default.createElement(Xe,null,"-"),Q.default.createElement(ge.default,null,(0,_e.gettext)("settings that describe your data's patterns and are reflected in the recommendation.")))))),Q.default.createElement(Ke,null,Q.default.createElement(Be,null,ve||we?Q.default.createElement(Fe,null,Q.default.createElement(We,null,kt),Q.default.createElement(Ue,{size:"large"})):Q.default.createElement(Q.default.Fragment,null,Q.default.createElement(je.default,{isEntityLevelPreview:!1,thresholdData:Z,getTimeInIso:!0,useRawSearch:P}),Q.default.createElement(He.default,{isEntityLevelPreview:!1,thresholdObj:Z,onThresholdUpdate:dt,isReadOnly:S,width:1055})))),Q.default.createElement(De.default,{hideCloseButton:ce,disablePrimaryClick:ce,disableCancelClick:ce,modalDataTestItsi:"aggregate-load-recommendations-modal",cancelButtonDataTestItsi:"aggregate-load-recommendations-modal-cancel-button",primaryButtonDataTestItsi:"aggregate-load-recommendations-modal-confirm-button",showCancel:!ce,open:te,title:(0,_e.gettext)("Load Recommendations"),primaryButtonLabel:(0,_e.gettext)("Confirm"),primaryButtonClicked:bt,secondaryButtonClicked:St,beforeClose:St},!ce&&(0,_e.gettext)("Loading recommendations will cause all existing threshold settings to be overwritten. Are you sure you want to load recommendations?"),ae),Q.default.createElement(Le.default,{isModelOpen:rt,isCustomAlertingEnabled:Z.isKpiCustomAlertingEnabled,customAlertingRules:Z.kpiCustomAlertRules,handleAlertRulesUpdate:Ct,handleRequestClose:Tt}))}KpiThresholdingSectionContainer.propTypes={isPSCDisabled:ie.default.bool,isPSCInstalled:ie.default.bool,isReadOnly:ie.default.bool,kpiModel:ie.default.object.isRequired,onThresholdUpdate:ie.default.func.isRequired,useRawSearch:ie.default.bool.isRequired,healthAnalyticsConsoleRecommendationsSearchRetrieveAction:ie.default.func.isRequired,healthAnalyticsConsoleRecommendationsResultsRetrieveAction:ie.default.func.isRequired,healthAnalyticsConsoleRecommendationsSearchResetAction:ie.default.func.isRequired,recommendationSearchSid:ie.default.string.isRequired,recommendationSearchStatus:ie.default.string.isRequired,recommendationSearchErrorMessage:ie.default.string.isRequired,recommendationResults:ie.default.object.isRequired,thresholdRecommendationKPIDataAvailabilitySearchRetrieveAction:ie.default.func.isRequired,thresholdRecommendationKPIDataAvailabilitySearchStatus:ie.default.string.isRequired,thresholdRecommendationKPIDataAvailabilitySearchResults:ie.default.object.isRequired},KpiThresholdingSectionContainer.defaultProps={isPSCDisabled:!1,isPSCInstalled:!0,isReadOnly:!1};o.default=(0,ee.connect)(s=>({recommendationSearchSid:s.healthAnalyticsConsole.recommendationSearchSid,recommendationSearchStatus:s.healthAnalyticsConsole.recommendationSearchStatus,recommendationSearchErrorMessage:s.healthAnalyticsConsole.recommendationSearchErrorMessage,recommendationResults:s.healthAnalyticsConsole.recommendationResults,thresholdRecommendationKPIDataAvailabilitySearchStatus:s.serviceDefinition.thresholdRecommendationKPIDataAvailabilitySearchStatus,thresholdRecommendationKPIDataAvailabilitySearchResults:s.serviceDefinition.thresholdRecommendationKPIDataAvailabilitySearchResults}),s=>(0,te.bindActionCreators)({healthAnalyticsConsoleRecommendationsSearchRetrieveAction:we.healthAnalyticsConsoleRecommendationsSearchRetrieve,healthAnalyticsConsoleRecommendationsResultsRetrieveAction:we.healthAnalyticsConsoleRecommendationsResultsRetrieve,healthAnalyticsConsoleRecommendationsSearchResetAction:we.healthAnalyticsConsoleRecommendationsSearchReset,thresholdRecommendationKPIDataAvailabilitySearchRetrieveAction:Ie.thresholdRecommendationKPIDataAvailabilitySearchRetrieve},s))(KpiThresholdingSectionContainer);s.exports=o.default},2698:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),N=S(_(2)),V=S(_(3)),j=S(_(81)),K=S(_(201)),W=S(_(39)),U=S(_(283)),Y=S(_(27)),$=S(_(44)),X=S(_(24)),Z=S(_(100)),Q=S(_(369)),ee=_(22),te=_(4),ie=_(61),ae=_(110),ne=S(_(1462));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var re=(0,N.default)(Z.default)(R||(R=(0,P.default)(["\n width: 720px;\n max-height: 600px;\n"]))),se=(0,N.default)(Y.default)(O||(O=(0,P.default)(["\n color: ",";\n margin-top: 10px;\n margin-left: ","px;\n"])),ee.variables.linkColor,s=>s.leftMargin),le=D.default.createElement(U.default,null);function KpiAlertingOptionsModal(s){var{customAlertingRules:o,isCustomAlertingEnabled:_,isModelOpen:S,handleRequestClose:R,handleAlertRulesUpdate:O}=s,P=(0,D.useCallback)(()=>o&&0!==o.length&&_?"custom":"all",[o,_]),N=(0,D.useCallback)(()=>{var s=(0,ae.getSortedThresholdValues)().map(s=>s.value),_=o.map(s=>s.change_to);return(0,K.default)(s,_)},[o]),[V,W]=(0,D.useState)(N()),[U,ee]=(0,D.useState)(P()),[oe,de]=(0,D.useState)(o),[ce,he]=(0,D.useState)(!1),ue=(0,D.useCallback)(()=>{W(N()),ee(P()),de(o),R()},[o,N,P,R]),pe=(0,D.useCallback)(()=>"custom"!==U||oe.every(s=>s.change_from.length>0),[oe,U]),fe=(0,D.useCallback)(()=>{pe()?(he(!1),O(U,oe),R()):he(!0)},[oe,O,R,U,pe]),computeAvailableSeverities=s=>{var o=(0,ae.getSortedThresholdValues)().map(s=>s.value),_=s.map(s=>s.change_to);return(0,K.default)(o,_)},ge=(0,D.useCallback)((s,o)=>{var{value:_}=o;if(ee(_),"all"===_)de([]);else{var S=[{change_to:"critical",change_from:["high","medium","low","normal","info"]}],R=computeAvailableSeverities(S);W(R),de(S)}},[]),onClickRemoveRule=s=>{var o=oe.filter(o=>o.change_to!==s),_=computeAvailableSeverities(o);W(_),de(o)},onUpdateToSeverity=(s,o)=>{var _=(0,j.default)(oe),S=_.findIndex(o=>o.change_to===s);_[S].change_to=o,_[S].change_from=_[S].change_from.filter(s=>s!==o);var R=computeAvailableSeverities(_);W(R),de(_)},onUpdateFromSeverityRule=(s,o)=>{var _=(0,j.default)(oe),S=_.findIndex(o=>o.change_to===s);_[S].change_from=o;var R=computeAvailableSeverities(_);W(R),de(_)},me=(0,D.useCallback)(()=>{if(V.length>0){var s=(0,j.default)(oe);s.push({change_to:V[0],change_from:[]});var o=computeAvailableSeverities(s);W(o),de(s)}},[oe,V]);return D.default.createElement(re,{"data-test-itsi":"kpi-alerting-options-modal",open:S,onRequestClose:ue},D.default.createElement(Z.default.Header,{"data-test-itsi":"kpi-alerting-options-modal-header",title:(0,te.gettext)("KPI alert rules"),onRequestClose:ue}),D.default.createElement(Z.default.Body,null,ce&&D.default.createElement(X.default,{appearance:"fill","data-test-itsi":"kpi-alerting-options-missing-rule-value-error-message",type:"error"},(0,te.gettext)("All KPI alerting rules must have a corresponding value.")),D.default.createElement($.default,{"data-test-itsi":"kpi-alerting-options-control-group",label:(0,te.gettext)("Trigger a notable event for"),labelWidth:ie.LABEL_WIDTHS.LongPlus},D.default.createElement(Q.default,{"data-test-itsi":"kpi-alerting-options-radio",value:U,onChange:ge},D.default.createElement(Q.default.Option,{"data-test-itsi":"kpi-alerting-all-option",value:"all"},(0,te.gettext)("All KPI severity changes")),D.default.createElement(Q.default.Option,{"data-test-itsi":"kpi-alerting-custom-option",value:"custom"},(0,te.gettext)("Specific severity changes")))),"custom"===U&&(oe&&0!==oe.length?oe.map(s=>D.default.createElement(ne.default,{availableSeverityValues:V,fromSeverityValues:s.change_from,onClickRemoveRule:onClickRemoveRule,toSeverityValue:s.change_to,key:s.change_to,onUpdateToSeverity:onUpdateToSeverity,updateRule:onUpdateFromSeverityRule})):null),"custom"===U&&V.length>0&&D.default.createElement(se,{"data-test-itsi":"add-kpi-alerting-rule-button",icon:le,label:(0,te.gettext)("Add rule"),appearance:"pill",onClick:me})),D.default.createElement(Z.default.Footer,null,D.default.createElement(Y.default,{appearance:"secondary","data-test-itsi":"kpi-alerting-modal-cancel-button",onClick:ue,label:(0,te.gettext)("Cancel")}),D.default.createElement(Y.default,{appearance:"primary","data-test-itsi":"kpi-alerting-modal-save-button",onClick:fe,label:(0,te.gettext)("Save"),leftMargin:ie.LABEL_WIDTHS.LongPlus})))}KpiAlertingOptionsModal.propTypes={customAlertingRules:V.default.array,handleAlertRulesUpdate:V.default.func,handleRequestClose:V.default.func,isCustomAlertingEnabled:V.default.bool,isModelOpen:V.default.bool},KpiAlertingOptionsModal.defaultProps={customAlertingRules:[],handleAlertRulesUpdate:W.default,handleRequestClose:W.default,isCustomAlertingEnabled:!1,isModelOpen:!1};o.default=KpiAlertingOptionsModal;s.exports=o.default},2699:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j=S(_(7)),K=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),W=S(_(2)),U=S(_(3)),Y=S(_(63)),$=S(_(39)),X=S(_(27)),Z=S(_(44)),Q=S(_(64)),ee=S(_(66)),te=S(_(633)),ie=S(_(103)),ae=_(4),ne=_(57),re=_(102);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var se=W.default.div(R||(R=(0,j.default)(["\n margin: 16px 10px;\n"]))),le=(0,W.default)(Z.default)(O||(O=(0,j.default)(["\n margin-left: 16px;\n"]))),oe=(0,W.default)(X.default)(P||(P=(0,j.default)(["\n margin-top: 11px;\n"]))),de=W.default.div(D||(D=(0,j.default)(["\n display: flex;\n"]))),ce=(0,W.default)(Q.default)(N||(N=(0,j.default)(["\n margin-top: 10px;\n width: 150px;\n"]))),he=(0,W.default)(ee.default)(V||(V=(0,j.default)(["\n width: 220px !important;\n"])));function KpiThresholdingControls(s){var{kpiData:o,onThresholdingTypeChange:_,onKpiAlertingRulesClick:S,onKpiAlertingToggle:R,onTrainingWindowChange:O,onOutlierExclusionToggle:P,onOutlierExclusionAlgoChange:D,onOutlierExclusionSensitivityChange:N,onUpdateAdaptiveThresholding:V,isUpdatingAdaptiveThresholds:j}=s,W=(0,K.useMemo)(()=>o.isTimeVariateThresholds?o.isAdaptiveThresholdsEnabled?"adaptive":"time":"static",[o.isAdaptiveThresholdsEnabled,o.isTimeVariateThresholds]),U=(0,K.useCallback)((s,o)=>{var{value:S}=o;_(S)},[_]),$=(0,K.useCallback)(()=>{R(!o.isKpiAlertingEnabled)},[o.isKpiAlertingEnabled,R]),Q=(0,K.useCallback)((s,o)=>{var{value:_}=o;O(_)},[O]),ue=(0,K.useCallback)((s,o)=>{var{value:_}=o;D(_)},[D]),pe=(0,K.useCallback)(()=>{P(!o.isOutlierDetectionEnabled)},[o.isOutlierDetectionEnabled,P]),fe=(0,K.useCallback)((s,o)=>{var{value:_}=o;N(_)},[N]);return K.default.createElement(se,null,K.default.createElement(de,null,K.default.createElement(ce,{"data-test-itsi":"kpi-threshold-control-threshold-settings-header",level:4},(0,ae.gettext)("Settings")),K.default.createElement(Z.default,{"data-test-itsi":"threshold-type-control-group",label:(0,ae.gettext)("Thresholding type"),labelPosition:"top",required:!0},K.default.createElement(he,{"data-test-itsi":"threshold-type-select",value:W,onChange:U},re.THRESHOLD_TYPE_OPTIONS.map(s=>K.default.createElement(ee.default.Option,{"data-test-itsi":"threshold-type-select-option",label:s.label,value:s.value,key:s.value})))),K.default.createElement(le,{"data-test-itsi":"kpi-alerting-control-group",label:(0,ae.gettext)("KPI alerting"),labelPosition:"top"},K.default.createElement(ie.default,{"data-test-itsi":"kpi-alerting-switch",key:"kpi-alerting-switch",value:"kpi-alerting-switch",onClick:$,selected:o.isKpiAlertingEnabled,appearance:"toggle"},o.isKpiAlertingEnabled&&(0,ae.gettext)("Active")),o.isKpiAlertingEnabled&&K.default.createElement(X.default,{"data-test-itsi":"kpi-alerting-alert-rules-button",onClick:S,label:(0,ae.gettext)("Alert rules")}))),"adaptive"===W&&K.default.createElement(de,null,K.default.createElement(ce,{"data-test-itsi":"kpi-threshold-control-threshold-at-settings-header",level:4},(0,ae.gettext)("AT Settings")),K.default.createElement(Z.default,{"data-test-itsi":"training-window-control-group",label:(0,ae.gettext)("Training window"),labelPosition:"top",required:!0},K.default.createElement(he,{"data-test-itsi":"training-window-select",value:o.adaptiveTrainingWindow,onChange:Q},ne.KPI_TIME_PRESETS.map(s=>K.default.createElement(ee.default.Option,{"data-test-itsi":"training-window-select-option",label:s.label,value:s.value,key:s.value})))),K.default.createElement(le,{"data-test-itsi":"outlier-switch-control-group",label:(0,ae.gettext)("Outlier exclusion"),labelPosition:"top"},K.default.createElement(ie.default,{"data-test-itsi":"outlier-exclusion-switch",key:"outlier-exclusion-switch",value:"outlier-exclusion-switch",onClick:pe,selected:o.isOutlierDetectionEnabled,appearance:"toggle"})),o.isOutlierDetectionEnabled&&K.default.createElement(K.default.Fragment,null,K.default.createElement(le,{"data-test-itsi":"outlier-algo-control-group",label:(0,ae.gettext)("Outlier method/algorithm"),labelPosition:"top"},K.default.createElement(he,{"data-test-itsi":"outlier-algo-select",value:o.outlierDetectionAlgorithm,onChange:ue},(0,Y.default)(re.OUTLIER_ALGORITHM_LABEL_MAP).map(s=>K.default.createElement(ee.default.Option,{"data-test-itsi":"outlier-algo-select-option",label:re.OUTLIER_ALGORITHM_LABEL_MAP[s],value:s,key:s})))),K.default.createElement(le,{"data-test-itsi":"outlier-sensitivity-control-group",label:(0,ae.gettext)("Trigger outlier threshold"),labelPosition:"top"},K.default.createElement(te.default,{"data-test-itsi":"outlier-sensitivity-slider-control",min:1,max:30,step:1,onChange:fe,value:o.outlierDetectionSensitivity,stepMarks:"always",inline:!0}))),K.default.createElement(le,{"data-test-itsi":"preview-at-control-group",label:" ",labelPosition:"top"},K.default.createElement(oe,{"data-test-itsi":"preview-at-button-control",label:j?(0,ae.gettext)("Applying adaptive thresholds..."):(0,ae.gettext)("Update adaptive thresholding"),onClick:V,disabled:j}))))}KpiThresholdingControls.propTypes={kpiData:U.default.object.isRequired,onThresholdingTypeChange:U.default.func,onKpiAlertingRulesClick:U.default.func,onKpiAlertingToggle:U.default.func,onTrainingWindowChange:U.default.func,onOutlierExclusionToggle:U.default.func,onOutlierExclusionAlgoChange:U.default.func,onOutlierExclusionSensitivityChange:U.default.func,onUpdateAdaptiveThresholding:U.default.func,isUpdatingAdaptiveThresholds:U.default.bool},KpiThresholdingControls.defaultProps={onThresholdingTypeChange:$.default,onKpiAlertingRulesClick:$.default,onKpiAlertingToggle:$.default,onTrainingWindowChange:$.default,onOutlierExclusionToggle:$.default,onOutlierExclusionAlgoChange:$.default,onOutlierExclusionSensitivityChange:$.default,onUpdateAdaptiveThresholding:$.default,isUpdatingAdaptiveThresholds:!1};o.default=KpiThresholdingControls;s.exports=o.default},2700:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N=S(_(8)),V=S(_(7)),j=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),K=S(_(3)),W=S(_(2)),U=S(_(27)),Y=S(_(44)),$=S(_(100)),X=S(_(83)),Z=S(_(24)),Q=S(_(219)),ee=_(4);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,N.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var te=(0,W.default)(Q.default)(R||(R=(0,V.default)(["\n width: 100% !important;\n"]))),ie=W.default.div(O||(O=(0,V.default)(["\n width: 550px;\n"]))),ae=(0,W.default)($.default)(P||(P=(0,V.default)(["\n max-width: 600px;\n"]))),ne=(0,W.default)(Y.default)(D||(D=(0,V.default)(["\n width: 550px;\n"])));function KpiThresholdingTemplateModal(s){var{validateKpiThresholdTitle:o,open:_,handleClose:S,handleSave:R,apiErrorMessage:O,isApiInProgress:P}=s,[D,N]=(0,j.useState)({}),[V,K]=(0,j.useState)(!0),[W,Y]=(0,j.useState)("");(0,j.useEffect)(()=>{_||N({})},[_]);var Q=(0,j.useCallback)((s,o)=>{var{value:_,name:S}=o;N(_objectSpread(_objectSpread({},D),{},{[S]:_}))},[D]),re=(0,j.useCallback)(()=>{var s=D.title||"",_=D.description||"",S=o(s);S.isValid?(R(s,_),K(!0),Y("")):(K(!1),Y(S.message))},[R,D.description,D.title,o]),se=(0,j.useCallback)(()=>{K(!0),S()},[S]);return j.default.createElement(ae,{"data-test-itsi":"kpi-threshold-template-modal",onRequestClose:se,open:_},j.default.createElement($.default.Header,{title:(0,ee.gettext)("Edit Title or Description"),onRequestClose:se}),j.default.createElement($.default.Body,null,O?j.default.createElement(Z.default,{"data-test-itsi":"kpi-threshold-template-error-message",type:"error"},O):"",j.default.createElement(ie,null,j.default.createElement(ne,{label:(0,ee.gettext)("Title"),"data-test-itsi":"kpi-threshold-template-title-control-group",controlsLayout:"none",labelWidth:120,help:W,error:!V},j.default.createElement(X.default,{"data-test-itsi":"kpi-threshold-template-title-control",error:!V,onChange:Q,placeholder:(0,ee.gettext)("required"),value:D.title||"",name:"title"})),j.default.createElement(ne,{label:(0,ee.gettext)("Description"),"data-test-itsi":"kpi-threshold-template-description-control-group",controlsLayout:"none",labelWidth:120},j.default.createElement(te,{"data-test-itsi":"kpi-threshold-template-description-control",inline:!0,onChange:Q,placeholder:(0,ee.gettext)("optional"),value:D.description||"",name:"description"})))),j.default.createElement($.default.Footer,null,j.default.createElement(U.default,{appearance:"secondary","data-test-itsi":"kpi-threshold-template-modal-cancel-button",onClick:se,label:(0,ee.gettext)("Cancel")}),j.default.createElement(U.default,{appearance:"primary","data-test-itsi":"kpi-threshold-template-modal-save-button",label:(0,ee.gettext)("Save"),onClick:re,disabled:P})))}KpiThresholdingTemplateModal.propTypes={validateKpiThresholdTitle:K.default.func.isRequired,open:K.default.bool.isRequired,handleClose:K.default.func.isRequired,handleSave:K.default.func.isRequired,apiErrorMessage:K.default.string.isRequired,isApiInProgress:K.default.bool.isRequired};o.default=KpiThresholdingTemplateModal;s.exports=o.default},2701:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K=S(_(17)),W=S(_(16)),U=S(_(21)),Y=S(_(19)),$=S(_(20)),X=S(_(8)),Z=S(_(7)),Q=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),ee=S(_(3)),te=S(_(201)),ie=S(_(37)),ae=S(_(62)),ne=S(_(2)),re=S(_(233)),se=S(_(27)),le=S(_(231)),oe=S(_(66)),de=S(_(314)),ce=S(_(113)),he=_(4),ue=_(96),pe=_(110);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,Y.default)(o),(0,U.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,Y.default)(s).constructor):o.apply(s,_))}_(28);var fe=Q.default.createElement(re.default,{screenReaderText:(0,he.gettext)("Remove KPI alerting rule")}),ge=(0,ne.default)(de.default)(R||(R=(0,Z.default)(["\n\tcolor: ",";\n"])),s=>s.color),me=(0,ne.default)(ce.default)(O||(O=(0,Z.default)(["\n\tdisplay: inline-block;\n\twhite-space: nowrap;\n\tpadding-left: 0;\n\tpadding-right: 0;\n"]))),ve=(0,ne.default)(ce.default)(P||(P=(0,Z.default)(["\n\tdisplay: inline-block;\n\tpadding-left: 0;\n\tpadding-right: 0;\n"]))),ye=ne.default.div(D||(D=(0,Z.default)(["\n\tpadding-top: 10px;\n"]))),_e=ne.default.div(N||(N=(0,Z.default)(["\n\tdisplay: inline-block;\n\tpadding-right: 10px;\n"]))),Se=ne.default.div(V||(V=(0,Z.default)(["\n\tdisplay: inline-block;\n\tpadding: 0 10px;\n"]))),be=(0,ne.default)(se.default)(j||(j=(0,Z.default)(["\n\tmargin-left: 10px;\n"]))),Ee=function(s){function KpiAlertingCustomRule(s){var o;(0,W.default)(this,KpiAlertingCustomRule);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,KpiAlertingCustomRule,[s,...S]),(0,X.default)(o,"getBoxFilled",s=>Q.default.createElement(ge,{color:s,variant:"filled"})),(0,X.default)(o,"generateSeverityOptions",()=>{var s=[],_=o.props.getAvailableSeverityValues();return(0,ae.default)(_,o.state.toSeverity)||_.push(o.state.toSeverity),_.map(_=>{var S=o.getSeverityObject(_);s.push(Q.default.createElement(oe.default.Option,{"data-test-itsi":"kpi-alerting-severity-select-option",icon:S.boxFilledColor?o.getBoxFilled(S.boxFilledColor):null,label:S.label,value:S.value,key:S.value}))}),s}),(0,X.default)(o,"getSeverityObject",s=>pe.THRESHOLDS.find(o=>o.value===s)),(0,X.default)(o,"generateMultiselectOptions",()=>(0,te.default)(pe.THRESHOLDS,[o.getSeverityObject(o.state.toSeverity)]).map(s=>Q.default.createElement(le.default.Option,{"data-test-itsi":"kpi-alerting-multiselect-option",label:s.label,value:s.value,key:s.value}))),(0,X.default)(o,"handleToSeverityChange",(s,_)=>{var{value:S}=_;o.props.onUpdateToSeverity(o.state.toSeverity,S),o.setState({toSeverity:S})}),(0,X.default)(o,"handleMultiSelectChange",(s,_)=>{var{values:S}=_;o.props.updateRule(o.state.toSeverity,S),o.setState({fromSeverityValues:S})}),(0,X.default)(o,"handleRemoveRule",()=>{o.props.removeRuleFromKpiModel(o.state.toSeverity)}),(0,X.default)(o,"getFromSeveritiesAsString",s=>{var _="";return(0,ie.default)(s,s=>{var S=o.getSeverityObject(s),R=S?S.label+", ":"";_+=R}),_=_.slice(0,-2)}),(0,X.default)(o,"render",()=>{var{isReadOnly:s}=o.props,{fromSeverityValues:_,toSeverity:S}=o.state,R=o.generateSeverityOptions(),O=o.generateMultiselectOptions(),P=o.getSeverityObject(o.state.toSeverity);return Q.default.createElement(ye,(0,ue.createITSITestHook)(o.constructor.name),Q.default.createElement(_e,{"data-test-itsi":"kpi-alerting-change-to-text"},(0,he.gettext)("KPI severity changes to")),s?Q.default.createElement(me,{"data-test-itsi":"kpi-alerting-change-to-severity"},P?P.label:""):Q.default.createElement(oe.default,{"data-test-itsi":"kpi-alerting-severity-select",value:S,onChange:o.handleToSeverityChange},R),Q.default.createElement(Se,{"data-test-itsi":"kpi-alerting-from-text"},(0,he.gettext)("from")),s?Q.default.createElement(ve,{"data-test-itsi":"kpi-alerting-change-from-severity"},o.getFromSeveritiesAsString(_)):Q.default.createElement(Q.Fragment,null,Q.default.createElement(le.default,{"data-test-itsi":"kpi-alerting-multiselect",values:_,onChange:o.handleMultiSelectChange,inline:!0},O),Q.default.createElement(be,{appearance:"pill","data-test-itsi":"remove-kpi-alerting-rule",icon:fe,onClick:o.handleRemoveRule})))}),o.state={toSeverity:o.props.toSeverity,fromSeverityValues:o.props.fromSeverityValues},o}return(0,$.default)(KpiAlertingCustomRule,s),(0,K.default)(KpiAlertingCustomRule)}(Q.Component);(0,X.default)(Ee,"propTypes",{getAvailableSeverityValues:ee.default.func.isRequired,updateRule:ee.default.func.isRequired,removeRuleFromKpiModel:ee.default.func.isRequired,toSeverity:ee.default.string.isRequired,fromSeverityValues:ee.default.array.isRequired,onUpdateToSeverity:ee.default.func.isRequired,isReadOnly:ee.default.bool}),(0,X.default)(Ee,"defaultProps",{isReadOnly:!1});o.default=Ee;s.exports=o.default},2702:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z=S(_(16)),Q=S(_(17)),ee=S(_(21)),te=S(_(19)),ie=S(_(20)),ae=S(_(8)),ne=S(_(7)),re=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),se=S(_(3)),le=S(_(2)),oe=S(_(373)),de=S(_(27)),ce=S(_(266)),he=S(_(44)),ue=S(_(576)),pe=S(_(34)),fe=S(_(24)),ge=S(_(550)),me=S(_(369)),ve=S(_(66)),ye=S(_(461)),_e=S(_(121)),Se=_(4),be=_(22),Ee=_(265),Te=_(264),Ce=_(108),ke=_(61),xe=_(67),we=_(110),Re=_(517),Ie=_(102),Me=_(57);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,te.default)(o),(0,ee.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,te.default)(s).constructor):o.apply(s,_))}_(28);var Oe=(0,le.default)(ce.default)(R||(R=(0,ne.default)(["\n\tmargin-left: 10px;\n"]))),Ae=(0,le.default)(pe.default)(O||(O=(0,ne.default)(["\n\tmargin-left: 10px;\n"]))),Pe=(0,le.default)(ve.default)(P||(P=(0,ne.default)(["\n\tmargin-left: 10px;\n\twidth: 300px;\n"]))),De=le.default.div(D||(D=(0,ne.default)(["\n\tmargin-bottom: 15px;\n"]))),Le=re.default.createElement(oe.default,{"data-test-itsi":"kpi-threshold-recommended-ai-chip-icon"}),Ne=(0,le.default)(he.default)(N||(N=(0,ne.default)(["\n\tdiv[data-test='controls'] {\n\t\twidth: max-content;\n\t}\n"]))),Ve=(0,le.default)(ye.default)(V||(V=(0,ne.default)(["\n\tcolor: ",";\n"])),be.variables.contentColorMuted),je=le.default.div(j||(j=(0,ne.default)(["\n\tdisplay: flex;\n\tflex-direction: column;\n\twidth: 1120px;\n"]))),He=le.default.div(K||(K=(0,ne.default)(["\n\tdisplay: flex;\n"]))),Be=le.default.div(W||(W=(0,ne.default)(["\n\tdisplay: inline;\n\ttext-align: right;\n"]))),Ke=(0,le.default)(ve.default)(U||(U=(0,ne.default)(["\n\twidth: 365px !important;\n"]))),Fe=(0,le.default)(ve.default)(Y||(Y=(0,ne.default)(["\n\twidth: 100px !important;\n"]))),We=(0,le.default)(ve.default)($||($=(0,ne.default)(["\n\twidth: 196px !important;\n"]))),Ue=le.default.div(X||(X=(0,ne.default)(["\n\tdisplay: flex;\n"]))),Ge={analysisWindowValue:se.default.string,analysisWindowStartDate:se.default.number,canWriteOnGlobalTeam:se.default.bool,disabled:se.default.bool,exportAction:se.default.func,hasTimeVariateThresholds:se.default.bool,hideRecommendedThresholding:se.default.bool,isPSCDisabled:se.default.bool,isPSCInstalled:se.default.bool,isRecommendedThresholdSearchInProgress:se.default.bool.isRequired,onAnalysisWindowChange:se.default.func.isRequired,onAnalysisWindowStartDateChange:se.default.func.isRequired,onApplyAsValueChange:se.default.func.isRequired,onApplyToValueChange:se.default.func.isRequired,onLoadRecommendationsClick:se.default.func.isRequired,onRadioChange:se.default.func.isRequired,onSelectChange:se.default.func.isRequired,onThresholdConfigChange:se.default.func.isRequired,radioValue:se.default.string,recommendationApplyToValue:se.default.string,recommendationApplyAsValue:se.default.bool,selectOptions:se.default.arrayOf(se.default.shape({label:se.default.string,value:se.default.string})).isRequired,selectValue:se.default.string,showEntityLevelAdaptiveThresholding:se.default.bool,thresholdConfigValue:se.default.string},Ye={analysisWindowValue:Ie.ANALYSIS_WINDOW_OPTIONS[1].value,analysisWindowStartDate:(0,_e.default)().subtract(Ie.ANALYSIS_WINDOW_OPTIONS[1].value.match(/\d+/g)[0],"days").unix(),canWriteOnGlobalTeam:!0,disabled:!1,exportAction:null,hasTimeVariateThresholds:!0,hideRecommendedThresholding:!1,isPSCDisabled:!1,isPSCInstalled:!1,radioValue:"",recommendationApplyToValue:Ie.RECOMMENDATION_APPLY_TO_OPTIONS[0].value,recommendationApplyAsValue:Ie.RECOMMENDATION_APPLY_AS_OPTIONS[0].value,selectValue:"",showEntityLevelAdaptiveThresholding:!0,thresholdConfigValue:Ie.THRESHOLD_CONFIGURATION_OPTIONS[0].value},qe=function(s){function KpiThresholdingRadioList(s){var o;return(0,Z.default)(this,KpiThresholdingRadioList),o=_callSuper(this,KpiThresholdingRadioList,[s]),(0,ae.default)(o,"_onRadioChange",(s,_)=>{var{value:S}=_,{onRadioChange:R}=o.props;o.setState({radioValue:S}),R(S)}),(0,ae.default)(o,"_onAnalysisWindowChange",(s,_)=>{var{value:S}=_,{onRadioChange:R,onAnalysisWindowChange:O,onAnalysisWindowStartDateChange:P}=o.props,{radioValue:D}=o.state,N=(0,_e.default)().subtract(S.match(/\d+/g)[0],"days").unix();o.setState({analysisWindowValue:S,analysisWindowStartDate:N}),D!==we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED&&(o.setState({radioValue:we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED}),R(we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED)),O(S),P(N)}),(0,ae.default)(o,"_onAnalysisWindowStartDateChange",(s,_)=>{var{value:S}=_,{onRadioChange:R,onAnalysisWindowStartDateChange:O}=o.props,{radioValue:P}=o.state,D=(0,_e.default)(S).unix();o.setState({analysisWindowStartDate:D}),P!==we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED&&(o.setState({radioValue:we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED}),R(we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED)),O(D)}),(0,ae.default)(o,"_onRecommendationApplyToValueChange",(s,_)=>{var{value:S}=_,{onApplyToValueChange:R,onRadioChange:O}=o.props,{radioValue:P}=o.state;o.setState({recommendationApplyToValue:S}),P!==we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED&&(o.setState({radioValue:we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED}),O(we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED)),R(S)}),(0,ae.default)(o,"_onRecommendationApplyAsValueChange",(s,_)=>{var{value:S}=_,{onApplyAsValueChange:R,onRadioChange:O}=o.props,{radioValue:P}=o.state;o.setState({recommendationApplyAsValue:S}),P!==we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED&&(o.setState({radioValue:we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED}),O(we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED)),R(S)}),(0,ae.default)(o,"_onThresholdConfigChange",(s,_)=>{var{value:S}=_,{onRadioChange:R,onThresholdConfigChange:O}=o.props,{radioValue:P}=o.state;o.setState({thresholdConfigValue:S}),P!==we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED&&(o.setState({radioValue:we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED}),R(we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED)),O(S)}),(0,ae.default)(o,"_onSelectChange",(s,_)=>{var{value:S}=_,{onRadioChange:R,onSelectChange:O}=o.props,{radioValue:P}=o.state;o.setState({selectValue:S}),P!==we.KPI_THRESHOLD_TEMPLATE_TYPES.TEMPLATE&&(o.setState({radioValue:we.KPI_THRESHOLD_TEMPLATE_TYPES.TEMPLATE}),R(we.KPI_THRESHOLD_TEMPLATE_TYPES.TEMPLATE)),O(S)}),(0,ae.default)(o,"handleLoadRecommendationsClick",()=>{var{onRadioChange:s,onLoadRecommendationsClick:_}=o.props,{radioValue:S}=o.state;S!==we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED&&(o.setState({radioValue:we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED}),s(we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED)),_()}),o.state={radioValue:s.radioValue,selectValue:s.selectValue,analysisWindowValue:s.analysisWindowValue,analysisWindowStartDate:s.analysisWindowStartDate,recommendationApplyToValue:s.recommendationApplyToValue,recommendationApplyAsValue:s.recommendationApplyAsValue,thresholdConfigValue:s.thresholdConfigValue},o}return(0,ie.default)(KpiThresholdingRadioList,s),(0,Q.default)(KpiThresholdingRadioList,[{key:"componentDidUpdate",value:function componentDidUpdate(s){s.radioValue!==this.props.radioValue&&this.setState({radioValue:this.props.radioValue}),s.selectValue!==this.props.selectValue&&this.setState({selectValue:this.props.selectValue})}},{key:"render",value:function render(){var s,{canWriteOnGlobalTeam:o,disabled:_,exportAction:S,hasTimeVariateThresholds:R,hideRecommendedThresholding:O,isPSCDisabled:P,isPSCInstalled:D,isRecommendedThresholdSearchInProgress:N,selectOptions:V,showEntityLevelAdaptiveThresholding:j}=this.props,{analysisWindowValue:K,analysisWindowStartDate:W,radioValue:U,recommendationApplyAsValue:Y,recommendationApplyToValue:$,selectValue:X,thresholdConfigValue:Z}=this.state,Q=(0,Se.gettext)("Select the time window over which the thresholding recommendation should run. The analysis window will be used as the training window for adaptive thresholding."),ee=(0,Se.gettext)("Choose the normality for thresholding your KPI from three options. Determine if your KPI should stay above a certain level, below a certain level, or constrained to a specific range"),te=X&&X!==we.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM,ie=U===we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED,ae=!D||P,ne=K.match(/\d+/g)[0],se=(0,_e.default)().subtract(ne,"day"),le=_e.default.unix(W).isBefore(se),oe=_e.default.unix(W).format(xe.MOMENT_FORMAT).toString(),ce=(!U||U===we.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM)&&R&&o,ye="";return D?P&&(ye=Me.AT_RECOMMENDATION_PSC_DISABLED_MESSAGE,s="warning"):(ye=Me.AT_RECOMMENDATION_PSC_NOT_INSTALLED_MESSAGE,s="error"),re.default.createElement("div",null,re.default.createElement(me.default,{"data-test-itsi":"kpi-thresholding-radio-list",disabled:_||N,onChange:this._onRadioChange.bind(this),value:U},!O&&re.default.createElement(me.default.Option,{"data-test-itsi":"kpi-thresholding-recommended-radio-list-option",value:we.KPI_THRESHOLD_TEMPLATE_TYPES.RECOMMENDED},re.default.createElement(De,null,(0,Se.gettext)("Use Recommended Thresholding Configuration"),re.default.createElement(Oe,{"data-test-itsi":"kpi-threshold-recommended-ai-chip",icon:Le},(0,Se.gettext)("Powered by Splunk AI"))," ",re.default.createElement(Ve,{as:"span","data-test-itsi":"kpi-threshold-recommended-info-text",variant:"smallBody",weight:400},(0,Se.gettext)("Start with values configured based on a unique AI-driven analysis of this KPI.")))),!O&&!ae&&ie&&re.default.createElement(je,null,re.default.createElement(Ne,{"data-test-itsi":"kpi-threshold-recommended-thresholding-direction",label:(0,Se.gettext)("Thresholding Direction"),tooltip:ee,labelWidth:ke.LABEL_WIDTHS.Massive},re.default.createElement(Ke,{"data-test-itsi":"kpi-threshold-recommended-thresholding-direction-select",disabled:_||ae||N,value:Z,onChange:this._onThresholdConfigChange.bind(this)},Ie.THRESHOLD_CONFIGURATION_OPTIONS.map(s=>re.default.createElement(ve.default.Option,{"data-test-itsi":"kpi-threshold-recommended-thresholding-direction-select-option",description:s.description,label:s.label,value:s.value,key:s.value})))),re.default.createElement(He,null,re.default.createElement(Ne,{"data-test-itsi":"kpi-threshold-recommended-analysis-window",label:(0,Se.gettext)("Analysis Window"),labelFor:"kpi-threshold-recommended-analysis-window-select",tooltip:Q,labelWidth:ke.LABEL_WIDTHS.Massive,controlsLayout:"none"},re.default.createElement(Fe,{"data-test-itsi":"kpi-threshold-recommended-analysis-window-select",disabled:_||ae||N,inputId:"kpi-threshold-recommended-analysis-window-select",value:K,onChange:this._onAnalysisWindowChange.bind(this)},Ie.ANALYSIS_WINDOW_OPTIONS.map(s=>re.default.createElement(ve.default.Option,{"data-test-itsi":"kpi-threshold-recommended-analysis-window-select-option",label:s.label,value:s.value,key:s.value})))),re.default.createElement(he.default,{"data-test-itsi":"kpi-threshold-recommended-start-date-control-group",label:(0,Se.gettext)("starting on"),labelWidth:ke.LABEL_WIDTHS.Short,error:!le&&(0,Se.gettext)("Selected analysis window and date will exceed today's date")},re.default.createElement(ue.default,{"data-test-itsi":"kpi-threshold-recommended-start-date",disabled:_||ae||N,value:oe,onChange:this._onAnalysisWindowStartDateChange}))),j&&re.default.createElement(Ue,null,re.default.createElement(Ne,{"data-test-itsi":"kpi-threshold-recommended-apply-to-control",label:(0,Se.gettext)("Apply AI recommendations to"),labelFor:"kpi-threshold-recommended-apply-to-radio-bar",labelWidth:ke.LABEL_WIDTHS.Massive},re.default.createElement(ge.default,{"data-test-itsi":"kpi-threshold-recommended-apply-to-radio-bar",onChange:this._onRecommendationApplyToValueChange,value:$},Ie.RECOMMENDATION_APPLY_TO_OPTIONS.map(s=>re.default.createElement(ge.default.Option,{"data-test-itsi":"kpi-threshold-recommended-apply-to-radio-bar-option",label:s.label,value:s.value,key:s.value})))),re.default.createElement(he.default,{"data-test-itsi":"kpi-threshold-recommended-apply-as-control",label:(0,Se.gettext)("Apply As"),labelWidth:ke.LABEL_WIDTHS.Short},re.default.createElement(We,{"data-test-itsi":"kpi-threshold-recommended-apply-as-select",onChange:this._onRecommendationApplyAsValueChange,value:Y},Ie.RECOMMENDATION_APPLY_AS_OPTIONS.map(s=>re.default.createElement(ve.default.Option,{"data-test-itsi":"kpi-threshold-recommended-apply-as-select-option",description:s.description,label:s.label,value:s.value,key:s.value}))))),re.default.createElement(Be,null,re.default.createElement(de.default,{appearance:"primary","data-test-itsi":"kpi-threshold-load-recommendations-button",disabled:_||ae||N||!le,onClick:this.handleLoadRecommendationsClick.bind(this),label:(0,Se.gettext)("Load Recommendations")}))),!O&&ae&&ie&&re.default.createElement(fe.default,{type:s,"data-test-itsi":"kpi-thresholding-install-psc-".concat(s,"-message")},re.default.createElement("div",null,ye," ",!D&&re.default.createElement(re.default.Fragment,null,(0,Se.gettext)("Download the app for "),re.default.createElement(pe.default,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-linux",to:(0,Te.getSplunkBaseURL)(Ee.SPLUNKBASE_APPS.Python_Scientific_Linux.id),openInNewContext:!0},(0,Se.gettext)("Linux 64-bit")),(0,Se.gettext)(", "),re.default.createElement(pe.default,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-windows",to:(0,Te.getSplunkBaseURL)(Ee.SPLUNKBASE_APPS.Python_Scientific_Windows.id),openInNewContext:!0},(0,Se.gettext)("Windows 64-bit")),(0,Se.gettext)(", "),re.default.createElement(pe.default,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-mac-intel",to:(0,Te.getSplunkBaseURL)(Ee.SPLUNKBASE_APPS.Python_Scientific_Mac_Intel.id),openInNewContext:!0},(0,Se.gettext)("Mac Intel")),(0,Se.gettext)(", or "),re.default.createElement(pe.default,{"data-test-itsi":"kpi-thresholding-psc-app-install-link-mac-arm",to:(0,Te.getSplunkBaseURL)(Ee.SPLUNKBASE_APPS.Python_Scientific_Mac_Apple_Silicon.id),openInNewContext:!0},(0,Se.gettext)("Mac Apple Silicon"))),D&&P&&re.default.createElement(pe.default,{"data-test-itsi":"kpi-thresholding-psc-app-enable-link",to:(0,Te.manageAppsURL)({search:Ee.PYTHON_SCIENTIFIC_APP_NAME_PREFIX}),openInNewContext:!0},(0,Se.gettext)("Enable the app here")))),re.default.createElement(me.default.Option,{"data-test-itsi":"kpi-thresholding-template-radio-list-option",value:we.KPI_THRESHOLD_TEMPLATE_TYPES.TEMPLATE},(0,Se.gettext)("Use Thresholding Template"),re.default.createElement(Pe,{"data-test-itsi":"kpi-threshold-template-select",disabled:_||N,inline:!0,filter:!0,placeholder:(0,Se.gettext)("Select a thresholding template"),onChange:this._onSelectChange.bind(this),truncate:!0,value:X},V.map(s=>re.default.createElement(ve.default.Option,{"data-test-itsi":"kpi-threshold-template-select-option",key:s.value,label:s.label,value:s.value}))),te&&re.default.createElement(Ae,{"data-test-itsi":"threshold-template-edit-link",openInNewContext:!0,to:(0,Re.uiEditURL)(X)},o?(0,Se.gettext)("Edit Template"):(0,Se.gettext)("View Template")),re.default.createElement(Ae,{"data-test-itsi":"threshold-timezones-external-link",openInNewContext:!0,to:(0,Ce.makeDocsURL)(Ce.DOCS_PAGES.ITSI_THRESHOLD_TZ)},(0,Se.gettext)("Learn more"))),re.default.createElement(me.default.Option,{"data-test-itsi":"kpi-thresholding-custom-radio-list-option",value:we.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM},(0,Se.gettext)("Set Custom Thresholds"),ce&&re.default.createElement(Ae,{"data-test-itsi":"thresholding-template-export-link",openInNewContext:!0,onClick:S},(0,Se.gettext)("Save as template")))))}}])}(re.Component);qe.propTypes=Ge,qe.defaultProps=Ye;o.default=qe;s.exports=o.default},2703:function(s,o){s.exports='<div class="kpi-thresholding-panel-upper-section">\n\t<div class="kpi-thresholding-panel-custom-threshold-window-content">\n\t\t<div class="kpi-thresholding-panel-custom-threshold-window-status"></div>\n\t\t<div class="kpi-thresholding-panel-custom-threshold-window-link"></div>\n\t</div>\n\t<div class="kpi-thresholding-panel-config-container">\n\t\t<div class="thresholding-template-selector-control-container">\n\t\t\t<div class="thresholding-template-custom-control">\n\t\t\t\t<div class="thresholding-template-radio-control"></div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="thresholding-recommendation-progress-control"></div>\n\t\t<div class="thresholding-recommendation-error-container"></div>\n\t\t<div class="thresholding-recommendation-info-container"></div>\n\t\t<div class="thresholding-enable-time-policy-control"></div>\n\t</div>\n</div>\n<div class="kpi-thresholding-panel-lower-section">\n\t<% if (vars.isServiceTemplate) { %>\n\t\t<div class="thresholding-configure-preview-controls">\n\t\t\t<div class="thresholding-configure-error-state" style="display: none;"></div>\n\t\t\t<div class="thresholding-configure-preview-service"></div>\n\t\t</div>\n\t<% } %>\n\t<div class="thresholding-configure-aggregate-entity-toggle"></div>\n\t<div class="thresholding-configure-settings">\n\t\t<div class="thresolding-adaptive-thresholding-controls">\n\t\t\t<div class="thresholding-enable-adaptive-thresholding"></div>\n\t\t\t<div class="thresholding-adaptive-thresholding-training"></div>\n\t\t\t<div class="thresholding-adaptive-thresholding-explanation" style="display:none;"></div>\n\t\t</div>\n\t\t<div class="thresholding-timezone-warning"></div>\n\t\t<div class="thresholding-enable-outlier-detection"></div>\n\t\t<div class="thresholding-apply-adaptive-thresholding"></div>\n\t\t<div class="kpi-alerting-enable-disable-control"></div>\n\t\t<div class="kpi-alerting-options"></div>\n\t\t<div class="kpi-alerting-custom-rules" style="display:none;"></div>\n\t</div>\n\t<div class="thresholding-default-container">\n\t\t<div class="thresholding-default-preview-container">\n\t\t\t<div class="thresholding-entity-side-panel-container"></div>\n\t\t\t<div class="thresholding-default-preview"></div>\n\t\t</div>\n\t\t<div class="thresholding-default-settings"></div>\n\t</div>\n\t<div class="thresholding-time-policy-container"></div>\n\t<div class="thresholding-confirmation-dialog"></div>\n</div>\n'},2704:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1095),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2705:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=_(1449),P=S(_(356)),D=S(_(1463)),N=S(_(138));_(2706);var V=P.default.extend({tagName:"div",className:"kpi-anomaly-panel",initialize:function initialize(s){(s=s||{}).dataTestItsi="service-anomaly-detection-collapsible-panel",s.panelId="anomaly",s.panelTitle=(0,R.gettext)("Anomaly Detection"),s.contentViewOptions={kpiModel:s.kpiModel,serviceModel:s.serviceModel},s.ContentView=D.default,P.default.prototype.initialize.apply(this,arguments)},_onPanelExpanded:function _onPanelExpanded(){P.default.prototype._onPanelExpanded.apply(this,arguments),(0,O.isJavaAvailable)().then(()=>{}).catch(()=>{new N.default({dataTestItsi:"kpi-anomaly-detection-java-error-modal",errorMessage:(0,R.gettext)("Java version installed on this search head does not support anomaly detection, Java version 1.8 or greater is required. You will still be able to enable AD on the KPI, but AD will not run properly."),onHiddenRemove:!0}).render()})}});o.default=V;s.exports=o.default},2706:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1096),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2707:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1097),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2708:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1098),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2709:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(45),O=S(_(0)),P=S(_(35)),D=S(_(44)),N=S(_(113)),V=_(4),j=_(14),K=_(61),W=_(141),U=_(57),Y=_(175),$=S(_(47)),X=S(_(559)),Z=S(_(805)),Q=S(_(557)),ee=S(_(1465)),te=S(_(2710)),ie=S(_(1467)),ae=S(_(1466)),ne=S(_(2713));_(2714);var re=(0,R.template)(ne.default,null,{variable:"vars"}),se=function renderControlGroup(s,o,_,S,R){s.length>0&&(P.default.unmountComponentAtNode(s.get(0)),P.default.render(O.default.createElement($.default,null,O.default.createElement(D.default,{"data-test-itsi":o,label:_,labelWidth:K.LABEL_WIDTHS.Massive},O.default.createElement(N.default,{"data-test-itsi":S},R))),s.get(0)))},le=ie.default.extend({_checkIfBackfillIsNeeded:function _checkIfBackfillIsNeeded(){this._checkBackfillProgress()},_renderBackfillControls:function _renderBackfillControls(s,o){var _,S=this.kpiModel.get("backfill_earliest_time");_=s?Q.default.renderBackfillStatus(o,S):(0,j.sprintf)((0,V.gettext)("Backfill has been configured for %(timeValue)s."),{timeValue:S}),se(this.backfillView.summaryView.$el,"backfill-field-read-only-control-group",(0,V.gettext)("Backfill"),"backfill-read-only-value",_)},_checkBackfillProgress:function _checkBackfillProgress(){this.kpiModel._cachedBackfillProgressStatus&&void 0!==this.kpiModel._cachedBackfillProgressStatus.progress&&void 0!==this.kpiModel._cachedBackfillProgressStatus.status?this._renderBackfillControls(this.kpiModel._cachedBackfillProgressStatus.progress,this.kpiModel._cachedBackfillProgressStatus.status):Q.default.getBackfillDataForKpi(this.kpiModel.get("_key")).done((s,o)=>{this._renderBackfillControls(s,o)})}}),oe=ee.default.extend({initialize:function initialize(s){ee.default.prototype.initialize.apply(this,arguments),this.hideAnomalyDetectionPanel=s.hideAnomalyDetectionPanel,this.hideDriftPanel=!1,s.featureFlags&&(this.hideDriftPanel=s.featureFlags[W.featureFlagsStanzas.DRIFT_DETECTION]||!1),this.isBaseServiceTemplate=this.serviceModel.get("object_type")===Y.OBJECT_TYPE,this.kpiThresholdingContentReadOnlyView=new te.default({appsData:s.appsData,service:this.serviceModel,hideRecommendedThresholding:s.hideRecommendedThresholding,linkedServices:this.linkedServices,kpiModel:this.kpiModel,serviceTemplate:s.serviceTemplate,featureFlags:s.featureFlags,permissions:s.permissions,thresholdTemplateCollection:s.thresholdTemplateCollection,userData:s.userData}),this.hideDriftPanel||(this.kpiDriftPanelContentReadOnlyView=new ae.default({serviceModel:this.serviceModel,kpiModel:this.kpiModel,isReadOnly:!0})),this.kpiSearchPanelContentReadOnlyView=new le({baseSearchCache:this.baseSearchCache,serviceModel:this.serviceModel,kpiModel:this.kpiModel,isReadOnly:!0}).render(),this.childViews.lockIcon=new X.default({dataTestItsi:"search-and-calculate-linked-to-st-icon",style:{fontSize:15,marginLeft:8,verticalAlign:"baseline"},type:"lock"})},setupPanelViews:function setupPanelViews(){},setupHeader:function setupHeader(){this.childViews.kpiTitleControl=new Z.default({dataTestItsi:"kpi-title-read-only-text-control",model:this.kpiModel,modelAttribute:"title",isReadOnly:!0,placeholder:(0,V.gettext)("KPI title")}),this.childViews.kpiDescriptionControl=new Z.default({dataTestItsi:"kpi-description-read-only-text-control",model:this.kpiModel,modelAttribute:"description",isReadOnly:!0,placeholder:(0,V.gettext)("KPI description")})},setupServiceDefinitionHeader:function setupServiceDefinitionHeader(){this.childViews.kpiTitleControl=new Z.default({dataTestItsi:"kpi-title-read-only-text-control",model:this.kpiModel,modelAttribute:"title",isReadOnly:!0,placeholder:(0,V.gettext)("KPI title")}),this.childViews.kpiDescriptionControl=new Z.default({dataTestItsi:"kpi-description-read-only-text-control",model:this.kpiModel,modelAttribute:"description",isReadOnly:!0,placeholder:(0,V.gettext)("KPI description")})},render:function render(){ee.default.prototype.render.apply(this,arguments),this.$el.append(re({gettext:V.gettext,isLinkedToServiceTemplate:!!this.serviceModel.get("base_service_template_id"),hideAnomalyDetectionPanel:this.hideAnomalyDetectionPanel,isBaseServiceTemplate:this.isBaseServiceTemplate},{variable:"vars"})),this.serviceModel.get("base_service_template_id")&&this.$el.find("h3.kpi-info-container-header").append(this.childViews.lockIcon.render().$el);var s=this.kpiSearchPanelContentReadOnlyView.sourceView.summaryView.$el,o=(0,R.findWhere)(U.KPI_SOURCE_TYPES,{value:this.kpiModel.get("search_type")});return s.prepend('<div class="kpi-source-control-group-container"></div>'),se(s.find(".kpi-source-control-group-container"),"kpi-source-control-group",(0,V.gettext)("KPI Source"),"kpi-source-value",o?o.label:""),this.$(".kpi-search-info-container").append(s),this.$(".kpi-entity-info-container").append(this.kpiSearchPanelContentReadOnlyView.entityView.summaryView.$el),"not-filtering-entities-value"===this.$(".kpi-entity-info-container .input-label").attr("data-test-itsi")&&this.$(".kpi-entity-info-container .input-label").css({"margin-left":"-80px"}),this.$(".kpi-calculation-info-container").append(this.kpiSearchPanelContentReadOnlyView.calculationView.summaryView.$el),this.$(".kpi-units-info-container").append(this.kpiSearchPanelContentReadOnlyView.unitView.summaryView.$el),this.isBaseServiceTemplate||this.$(".kpi-backfill-info-container").append(this.kpiSearchPanelContentReadOnlyView.backfillView.summaryView.$el),this.$(".kpi-thresholding-info").append(this.kpiThresholdingContentReadOnlyView.render().$el),this.hideDriftPanel||this.$(".kpi-drift-info").append(this.kpiDriftPanelContentReadOnlyView.render().$el),this.hideAnomalyDetectionPanel||this.renderAnomalyDetection(),this},renderAnomalyDetection:function renderAnomalyDetection(){this.$(".kpi-anomaly-detection-info .form-horizontal").append('<div class="anomaly-detection-container"></div><div class="trending-algorithm-container"></div><div class="cohesion-anomaly-container"></div><div class="cohesion-algorithm-container"></div>'),se(this.$(".anomaly-detection-container"),"anomaly-detection-control-group",(0,V.gettext)("Enable Trending Anomaly Detection"),"anomaly-detection-value",this.kpiModel.get("anomaly_detection_is_enabled")?(0,V.gettext)("Yes"):(0,V.gettext)("No")),se(this.$(".trending-algorithm-container"),"algorithm-sensitivity-control-group",(0,V.gettext)("Trending Algorithm Sensitivity"),"algorithm-sensitivity-value",this.kpiModel.get("trending_ad").get("sensitivity")),se(this.$(".cohesion-anomaly-container"),"cohesion-anomaly-control-group",(0,V.gettext)("Enable Entity Cohesion Anomaly Detection"),"cohesion-anomaly-value",this.kpiModel.get("cohesive_anomaly_detection_is_enabled")?(0,V.gettext)("Yes"):(0,V.gettext)("No")),se(this.$(".cohesion-algorithm-container"),"cohesion-anomaly-sensitivity-control-group",(0,V.gettext)("Entity Cohesion Algorithm Sensitivity"),"cohesion-anomaly-sensitivity-value",this.kpiModel.get("cohesive_ad").get("sensitivity"))}});o.default=oe;s.exports=o.default},2710:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(45),O=S(_(32)),P=S(_(0)),D=S(_(35)),N=_(4),V=_(14),j=_(67),K=_(110),W=_(102),U=S(_(88)),Y=S(_(47)),$=S(_(1470)),X=S(_(1471)),Z=S(_(1822)),Q=S(_(2547)),ee=S(_(1448)),te=S(_(1469)),ie=S(_(2711));_(1472),_(2712);var ae=te.default.extend({KpiSingleThresholdingView:Z.default,KpiTimeVariantThresholdingView:Q.default,compiledTemplate:(0,R.template)(ie.default,null,{variable:"vars"}),initialize:function initialize(s){te.default.prototype.initialize.call(this,s);var o,_=this.kpiModel.get("kpi_threshold_template_id"),S=this.kpiModel.get("is_recommended_time_policies");if(o=S?(0,N.gettext)("Using Splunk recommended thresholds"):_===K.KPI_THRESHOLD_TEMPLATE_TYPES.CUSTOM?(0,N.gettext)("Using custom thresholds"):(0,N.gettext)("Using threshold template"),this.childViews={},this.childViews.useThresholdingTemplateControl=new U.default({controlType:"Label",controlOptions:{dataTestItsi:"use-thresholding-template-label",defaultValue:o},dataTestItsi:"kpi-threshold-template-control-group",label:(0,N.gettext)("Thresholding Option"),labelWidth:this.currPageLabelWidth}),S){var O=this.kpiModel.get("recommendation_training_window"),P=W.ANALYSIS_WINDOW_OPTIONS.filter(s=>s.value===O),D=P.length?P[0].label:"",Y=this.kpiModel.get("recommendation_start_date");D=D&&Y?(0,V.sprintf)((0,N.gettext)("%s starting on %s"),D,(0,j.convertEpochToDateString)(Y)):D,this.childViews.recommendationAnalysisWindow=new U.default({controlType:"Label",controlOptions:{dataTestItsi:"recommendation-analysis-window-label",defaultValue:D},dataTestItsi:"kpi-recommendation-analysis-window-control-group",label:(0,N.gettext)("Recommendation Analysis Window"),labelWidth:this.currPageLabelWidth});var $=this.kpiModel.get("threshold_direction"),X=W.THRESHOLD_CONFIGURATION_OPTIONS.filter(s=>s.value===$);this.childViews.recommendationThresholdDirection=new U.default({controlType:"Label",controlOptions:{dataTestItsi:"recommendation-threshold-direction-label",defaultValue:X.length?X[0].label:""},dataTestItsi:"kpi-recommendation-threshold-direction-control-group",label:(0,N.gettext)("Recommendation Threshold Direction"),labelWidth:this.currPageLabelWidth})}this.childViews.enableTimePoliciesControl=new U.default({controlType:"Label",controlOptions:{dataTestItsi:"enable-time-policies-label",defaultValue:this.kpiModel.get("time_variate_thresholds")?(0,N.gettext)("Yes"):(0,N.gettext)("No")},dataTestItsi:"kpi-time-policies-template-control-group",label:(0,N.gettext)("Enable Time Policies"),labelWidth:this.currPageLabelWidth}),this.childViews.enableAdaptiveThresholdingControl=new U.default({controlType:"Label",controlOptions:{dataTestItsi:"enable-adaptive-thresholding-label",defaultValue:this._configSettingsModel.get("adaptive_thresholds_is_enabled")?(0,N.gettext)("Yes"):(0,N.gettext)("No")},dataTestItsi:"kpi-enable-adaptive-thresholding-control-group",label:(0,N.gettext)("Enable Adaptive Thresholding"),labelWidth:this.currPageLabelWidth});var Z=(0,R.findWhere)(this.kpiTimePresetsList,{value:this._configSettingsModel.get("adaptive_thresholding_training_window")}).label||"";this.childViews.trainingWindowControl=new U.default({controlType:"Label",controlOptions:{dataTestItsi:"kpi-training-window-label",defaultValue:Z},dataTestItsi:"kpi-training-window-control-group",label:(0,N.gettext)("Training Window"),labelWidth:this.currPageLabelWidth})},_createKpiAlertingSwitchControl:function _createKpiAlertingSwitchControl(){var s=this.kpiModel.get("aggregate_thresholds_alert_enabled"),o=(0,O.default)("<div></div>").css({display:"inline-block","vertical-align":"top"});return D.default.unmountComponentAtNode(o.get(0)),D.default.render(P.default.createElement(Y.default,null,P.default.createElement($.default,{enabled:s,onChange:this._onEnableDisableAlerting,size:"medium",isReadOnly:!0,isEntityBreakDown:this.kpiModel.get("is_entity_breakdown")})),o.get(0)),s&&(this.$(".kpi-alerting-options").show(),this.$(".kpi-alerting-options").html(this._createKpiAlertingOptions())),o},_createKpiAlertingOptions:function _createKpiAlertingOptions(){var s=(0,O.default)('<div style="margin-left: '.concat(this.currPageLabelWidth,'px"></div>'));D.default.unmountComponentAtNode(s.get(0));var o=this.kpiModel.get("aggregate_thresholds_custom_alert_rules"),_=2;return o&&this.kpiModel.get("aggregate_thresholds_custom_alert_enabled")&&0!==o.length||(_=1),D.default.render(P.default.createElement(Y.default,null,P.default.createElement(X.default,{selectedAdvancedOption:_,getCurrentRules:this.getCurrentRules,getAvailableSeverityValues:this.getAvailableSeveritiesForDropdown,handleKpiAlertingOptionChange:this.handleKpiAlertingOptionChange,addOrUpdateRuleToKpiModel:this.addOrUpdateRuleToKpiModel,removeRuleFromKpiModel:this.removeRuleFromKpiModel,removeAndAddRuleToKpiModel:this.removeAndAddRuleToKpiModel,isReadOnly:!0})),s.get(0)),s},_renderOutlierDetectionControls:function _renderOutlierDetectionControls(){var s=this.kpiModel.get("aggregate_outlier_detection_enabled"),o=this.kpiModel.get("outlier_detection_algo"),_=this.kpiModel.get("outlier_detection_sensitivity"),S=this.$(".thresholding-enable-outlier-detection").css({display:"inline-block","vertical-align":"top"});return D.default.unmountComponentAtNode(S.get(0)),D.default.render(P.default.createElement(Y.default,null,P.default.createElement(ee.default,{enabled:s,algo:o,sensitivity:_,onChange:this._onEnableDisableOutlierDetection,isReadOnly:!0,size:"medium",isEntityBreakDown:this.kpiModel.get("is_entity_breakdown")})),S.get(0)),S},_renderKpiThresholdingContentView:function _renderKpiThresholdingContentView(){return te.default.prototype._renderKpiThresholdingContentView.apply(this,arguments),this.$(".kpi-thresholding-panel-info-container").append(this.childViews.useThresholdingTemplateControl.render().$el),this.childViews.recommendationAnalysisWindow&&this.$(".kpi-thresholding-panel-info-container").append(this.childViews.recommendationAnalysisWindow.render().$el),this.childViews.recommendationThresholdDirection&&this.$(".kpi-thresholding-panel-info-container").append(this.childViews.recommendationThresholdDirection.render().$el),this.$(".kpi-thresholding-panel-info-container").append(this.childViews.enableTimePoliciesControl.render().$el),this.$(".kpi-thresholding-panel-info-container").append(this.childViews.enableAdaptiveThresholdingControl.render().$el),this.$(".kpi-thresholding-panel-info-container").append(this.childViews.trainingWindowControl.render().$el),this}});o.default=ae;s.exports=o.default},2711:function(s,o){s.exports='<div class="kpi-thresholding-panel-upper-section read-only">\n\t<div class="kpi-thresholding-panel-custom-threshold-window-content">\n\t\t<div class="kpi-thresholding-panel-custom-threshold-window-status"></div>\n\t\t<div class="kpi-thresholding-panel-custom-threshold-window-link"></div>\n\t</div>\n</div>\n<div class="kpi-thresholding-panel-info-container form-horizontal"></div>\n<div class="kpi-thresholding-panel-lower-section read-only">\n\t<% if (vars.isServiceTemplate) { %>\n\t\t<div class="thresholding-configure-preview-controls">\n\t\t\t<div class="thresholding-configure-error-state" style="display: none;"></div>\n\t\t\t<div class="thresholding-configure-preview-service"></div>\n\t\t</div>\n\t<% } %>\n\t<div class="thresholding-configure-aggregate-entity-toggle"></div>\n\t<div class="thresholding-configure-settings">\n\t\t<div class="thresholding-enable-outlier-detection"></div>\n\t\t<div class="kpi-alerting-enable-disable-control"></div>\n\t\t<div class="kpi-alerting-options"></div>\n\t\t<div class="kpi-alerting-custom-rules" style="display:none;"></div>\n\t</div>\n\t<div class="thresholding-default-container"></div>\n\t<div class="thresholding-time-policy-container"></div>\n</div>\n'},2712:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1099),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2713:function(s,o){s.exports='<div class="kpi-info-container">\n\t<div class="kpi-search-calculate-info form-horizontal">\n\t\t<h3 class="kpi-info-container-header" data-test-itsi="kpi-read-only-info-container-header">\n\t\t\t<%- vars.gettext(\'Search and calculate\') %>\n\t\t</h3>\n\t\t<div class="kpi-search-info-container"></div>\n\t\t<div class="kpi-entity-info-container"></div>\n\t\t<div class="kpi-calculation-info-container"></div>\n\t\t<div class="kpi-units-info-container"></div>\n\t\t<% if (!vars.isBaseServiceTemplate) { %>\n\t\t\t<div class="kpi-backfill-info-container"></div>\n\t\t<% } %>\n\t</div>\n\t<div class="kpi-thresholding-info">\n\t\t<h3 class="kpi-info-container-header" data-test-itsi="kpi-read-only-info-thresholding-header"><%- vars.gettext(\'Thresholding\') %></h3>\n\t</div>\n\t<% if (!vars.hideDriftPanel) { %>\n\t\t<div class="kpi-drift-info">\n\t\t\t<h3 class="kpi-info-container-header" data-test-itsi="kpi-read-only-info-drift-header"><%- vars.gettext(\'Drift detection\') %></h3>\n\t\t</div>\n\t<% } %>\n\t<% if (!vars.hideAnomalyDetectionPanel) { %>\n\t\t<div class="kpi-anomaly-detection-info">\n\t\t\t<h3 class="kpi-info-container-header" data-test-itsi="kpi-read-only-info-anomaly-detection-header"><%- vars.gettext(\'Anomaly detection\') %></h3>\n\t\t\t<div class="kpi-anomaly-detection-explanation" data-test-itsi="kpi-anomaly-detection-explanation">\n\t\t\t\t<%- vars.gettext(\'ITSI Anomaly Detection learns the normal patterns of KPIs continuously in real-time, triggering a notable event when a KPI departs from its expected behavior. Certain types of data are not suitable for use with anomaly detection because they produce too many false positives. We recommend that you analyze the KPI data first to check its compatibility with ITSI\\\'s anomaly detection algorithms.\') %>\n\t\t\t</div>\n\t\t\t<div class="form-horizontal"></div>\n\t\t</div>\n\t<% } %>\n</div>\n'},2714:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1100),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2715:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(45),O=_(4),P=S(_(1207)),D=S(_(2716)),N=S(_(2719));_(2720);var V=P.default.extend({compiledTemplate:(0,R.template)(N.default,null,{variable:"vars"}),entityRuleGroupJoin:'<div class="entity-rule-group-or-join" data-test-itsi="rule-group-or-join">'+(0,O.gettext)("OR")+"</div>",_addRuleGroupImpl:function _addRuleGroupImpl(s){var o=new D.default({rulesGroupModel:s,ruleFieldsBlockList:this._ruleFieldsBlockList});this.ruleGroupViews.push(o),this.$(".rules-view-container").append(o.render().$el)}});o.default=V;s.exports=o.default},2716:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=S(_(1431)),P=S(_(2717)),D=O.default.extend({events:{},compiledGroupMarkup:'<div class="rules-outer-container"><div class="rules-container" data-test-itsi="rules-container-read-only"></div></div>',entityRuleItemJoin:'<div class="entity-rule-and-join" data-test-itsi="entity-rule-and-join">'+(0,R.gettext)("AND")+"</div>",_addRuleImpl:function _addRuleImpl(s){var o=new P.default({rulesItemModel:s,ruleFieldsBlockList:this._ruleFieldsBlockList});this.collection.add(o.rulesItemModel),this.ruleItems.push(o),this.$(".rules-container").append(o.render().$el)},addRuleLink:function addRuleLink(){}});o.default=D;s.exports=o.default},2717:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(15)),O=S(_(70)),P=S(_(33)),D=S(_(118)),N=_(4),V=S(_(805)),j=S(_(1432));_(2718);var K=j.default.extend({blankPlaceholder:(0,N.gettext)("N/A"),events:{},inputDefaults:{isReadOnly:!0,clickToEdit:!1,placeholder:(0,N.gettext)("N/A")},setupInputControlsAndHandlers:function setupInputControlsAndHandlers(){this._deleteEmptyValueToInvokePlaceholder(),this._fieldTypeSelectControl=new V.default((0,O.default)({},this.inputDefaults,{dataTestItsi:"field-type-read-only-text-control",modelAttribute:"field_type",model:this.rulesItemModel})),this._tempRulesItemModel=this.rulesItemModel.clone(),this._tempRulesItemModel.set("field",'"'+this._tempRulesItemModel.get("field")+'"'),this._fieldSelectControl=new V.default((0,O.default)({},this.inputDefaults,{dataTestItsi:"field-select-read-only-text-control",modelAttribute:"field",model:this.rulesItemModel}));var s=this.rulesItemModel.get("rule_type");switch(s){case"matches":this.rulesItemModel.set("readable_rule_type",(0,N.gettext)("matches"));break;case"not":this.rulesItemModel.set("readable_rule_type",(0,N.gettext)("does not match"));break;case"matchesblank":this.rulesItemModel.set("readable_rule_type",(0,N.gettext)("matches a value to be defined in the service"));break;case"notmatchesblank":this.rulesItemModel.set("readable_rule_type",(0,N.gettext)("does not match a value to be defined in the service"));break;default:this.rulesItemModel.set("readable_rule_type",s)}this._staticOrRulesSelector=new V.default((0,O.default)({},this.inputDefaults,{dataTestItsi:"static-or-rules-read-only-text-control",modelAttribute:"readable_rule_type",model:this.rulesItemModel}));var o=this.rulesItemModel.get("value");o||(0,D.default)(o)||"matchesblank"===s||"notmatchesblank"===s||this.rulesItemModel.set("value","<empty>",{silent:!0}),this._staticRulesControl=new V.default((0,O.default)({},this.inputDefaults,{dataTestItsi:"static-rules-read-only-text-control",modelAttribute:"value",model:this.rulesItemModel})),this._staticRulesControl.setUrl=function(s){return s},this._fieldSelectControl.setAutoCompleteFields=function(s){return s},R.default.View.prototype.initialize.apply(this,arguments)},renderFieldsMultiSelect:function renderFieldsMultiSelect(){},renderValuesMultiSelect:function renderValuesMultiSelect(){},_deleteEmptyValueToInvokePlaceholder:function _deleteEmptyValueToInvokePlaceholder(){(0,P.default)(this.rulesItemModel.get("value"))&&delete this.rulesItemModel.attributes.value},render:function render(){this.$el.append(this._fieldTypeSelectControl.render().$el),this.$el.append('<div class="fields-multi-select-placeholder" style="display:none"></div>');var s=this._fieldSelectControl.render().$el;this.$el.append(s),s.find("label").addClass("entity-rule-item-value"),this.$el.append(this._staticOrRulesSelector.render().$el),this.$el.append('<div class="values-multi-select-placeholder" style="display:none"></div>');var o=this._staticRulesControl.render().$el;return this.$el.append(o),o.find("label").addClass("entity-rule-item-value"),this._updateToFieldType(this.rulesItemModel.get("field_type")),this}});o.default=K;s.exports=o.default},2718:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1101),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2719:function(s,o){s.exports='<div class="rules-view-outer-container" data-test-itsi="rules-view-outer-container-read-only">\n <div class="rules-view-container"></div>\n</div>\n'},2720:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(1102),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},2885:function(s,o,_){(o=_(36)(!1)).push([s.i,".entities-content-view {\n\tpadding: 15px 20px;\n}\n\n.matched-entities-title {\n\tmargin-top: 25px; /* Just some neat separation between the rules and matched entities table */\n}\n\n.entities-content-view td.tableData {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}",""]),s.exports=o},2886:function(s,o,_){(o=_(36)(!1)).push([s.i,".entity-description-header {\n\tpadding: 10px 0;\n}\n.matched-entities-table-view .actionable-row td {\n\tcolor: #006eaa; /* theme.linkColor */\n}\n.matched-entities-table-view .actionable-row td:hover {\n\ttext-decoration: underline;\n}\n.matched-entities-table-view table {\n\tmargin-top: 10px;\n}\n.matched-entities-table-view .count-container {\n\tdisplay: inline;\n}\n.show-warning-message-container {\n\twidth: max-content;\n}\n.fill-in-empty-rule-message-container {\n\tmargin-left: 10px;\n}\n",""]),s.exports=o},2887:function(s,o,_){(o=_(36)(!1)).push([s.i,".service-dep-header {\n\tpadding: 10px 10px 10px 0;\n}\n.service-dep-header-controls {\n\tpadding: 10px 20px;\n}\n.service-dep-body {\n\tpadding: 10px 20px;\n}\n.service-dep-footer-controls {\n\tpadding: 10px;\n}",""]),s.exports=o},2888:function(s,o,_){(o=_(36)(!1)).push([s.i,"@keyframes showup {\n\t0% {\n\t\tposition: fixed;\n\t\tbottom: -400px;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, -50%);\n\t}\n\t20% {\n\t\tbottom: -22px;\n\t}\n\t80% {\n\t\tbottom: -22px;\n\t}\n\t100% {\n\t\tposition: fixed;\n\t\tbottom: -400px;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, -50%);\n\t}\n}\n\n@keyframes wave {\n\t0% {\n\t\ttransform: rotate(0deg);\n\t}\n\t10% {\n\t\ttransform: rotate(40deg);\n\t}\n\t20% {\n\t\ttransform: rotate(0deg);\n\t}\n\t30% {\n\t\ttransform: rotate(-40deg);\n\t}\n\t40% {\n\t\ttransform: rotate(0deg);\n\t}\n\t50% {\n\t\ttransform: rotate(40deg);\n\t}\n\t60% {\n\t\ttransform: rotate(0deg);\n\t}\n\t70% {\n\t\ttransform: rotate(-40deg);\n\t}\n\t80% {\n\t\ttransform: rotate(0deg);\n\t}\n\t100% {\n\t\ttransform: rotate(0deg);\n\t}\n}\n\n@keyframes cry {\n\t0% {\n\t\ttransform: translate(0, 0);\n\t}\n\t50% {\n\t\ttransform: translate(0, 30px);\n\t}\n\t100% {\n\t\ttransform: translate(0, 30px);\n\t}\n}\n\n@keyframes pump {\n\t0% {\n\t\ttransform: scale(1, 1);\n\t}\n\t50% {\n\t\ttransform: scale(2.5, 2.5);\n\t}\n\t100% {\n\t\ttransform: scale(1.8, 1.8);\n\t}\n}\n\n#svg-object-panda {\n\tposition: fixed;\n\tbottom: -400px;\n\tleft: 50%;\n\ttransform: translate(-50%, -50%);\n}\n\n.happypandalips{\n\ttransform: rotate(180deg);\n\ttransform-origin: 164px 214px;\n}\n.activepanda {\n\tanimation: showup 4s cubic-bezier(0.715, 0.000, 0.400, 1.000) 1;\n}\n.wavehand {\n\ttransform-origin: 358px 244px;\n\tanimation: wave 2s linear 1;\n\tanimation-delay: 1s;\n}\n\n.tear {\n\tdisplay: block;\n\tanimation: cry 2s linear forwards;\n\tanimation-delay: 0.6s;\n}\n\n.heart {\n\tdisplay: block;\n\ttransform-origin: 357px 92.75px;\n\tanimation: pump 1s cubic-bezier(0.715, 0.000, 0.400, 1.000) forwards;\n\tanimation-delay: 0.6s;\n}\n\n",""]),s.exports=o},2889:function(s,o,_){(o=_(36)(!1)).push([s.i,".service-definition-body .tab-layout-container {\n\tdisplay: block; /** The flex layout on IE is causing an issue */\n}\n.service-definition-body td {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}",""]),s.exports=o},306:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.ThresholdingContext=void 0,o.ThresholdingProvider=ThresholdingProvider;var R=S(_(8)),O=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),P=S(_(94)),D=S(_(81)),N=S(_(321)),V=S(_(33)),j=S(_(3)),K=_(4),W=_(14),U=S(_(689)),Y=S(_(635)),$=_(29),X=_(107),Z=_(110),Q=_(67),ee=_(102);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,R.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}var te=o.ThresholdingContext=(0,O.createContext)();function ThresholdingProvider(s){var{kpiModel:o,serviceKey:_,originalKpiCollection:S,isServiceTemplate:R,children:j}=s,handleTimeVariateThresholdsSpecificationPolicies=s=>{var o={policies:{}};return s.models&&s.models.forEach(s=>{var{id:_}=s,{title:S,aggregate_thresholds:R,entity_thresholds:O,policy_type:P,time_blocks:D}=s.toJSON()[_],{thresholdLevels:N,gaugeMin:V,gaugeMax:j,isMinStatic:K,isMaxStatic:W,renderBoundaryMin:U,renderBoundaryMax:Y,baseSeverityValue:$,baseSeverityColor:X,baseSeverityColorLight:Z,baseSeverityLabel:Q,metricField:ee}=R;o.policies[_]={title:S,aggregate_thresholds:{gaugeMax:j,thresholdLevels:N.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}}),isMaxStatic:W,gaugeMin:V,baseSeverityLabel:Q,baseSeverityColor:X,metricField:ee,baseSeverityValue:$,baseSeverityColorLight:Z,renderBoundaryMin:U,renderBoundaryMax:Y,isMinStatic:K},entity_thresholds:{gaugeMax:O.gaugeMax,thresholdLevels:O.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}}),isMaxStatic:O.isMaxStatic,gaugeMin:O.gaugeMin,baseSeverityLabel:O.baseSeverityLabel,baseSeverityColor:O.baseSeverityColor,metricField:O.metricField,baseSeverityValue:O.baseSeverityValue,baseSeverityColorLight:O.baseSeverityColorLight,renderBoundaryMin:O.renderBoundaryMin,renderBoundaryMax:O.renderBoundaryMax,isMinStatic:O.isMinStatic},policy_type:P,time_blocks:D}}),o},ie=(0,O.useCallback)((function(s){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",{_key:S,alert_period:O,aggregate_thresholds:P,aggregate_thresholds_alert_enabled:D,aggregate_thresholds_custom_alert_enabled:N,aggregate_thresholds_custom_alert_rules:j,aggregate_outlier_detection_enabled:K,outlier_detection_algo:W,outlier_detection_sensitivity:U,base_search:Y,entity_statop:$,entity_thresholds:X,entity_breakdown_id_fields:Q,threshold_field:ee,time_variate_thresholds:te,time_variate_thresholds_specification:ie,adaptive_thresholds_is_enabled:ae,adaptive_thresholding_training_window:ne,adaptive_thresholding_copy_kpi_to_entity:re,search_alert_earliest:se,recommendation_training_window:le,kpi_threshold_template_id:oe,description:de,is_entity_breakdown:ce,threshold_recommendation_summary:he}=R&&!(0,V.default)(o)?o:s;return{_key:s?s._key:o._key,name:s?s.title:o.title,atRecommendationInfo:he||{},isAdaptiveThresholdsEnabled:ae,isCopyKPIToEntityThresholdsEnabled:re,isKpiAlertingEnabled:D,isKpiCustomAlertingEnabled:N,kpiCustomAlertRules:j,isOutlierDetectionEnabled:K,outlierDetectionAlgorithm:W||"stdev",outlierDetectionSensitivity:U||2,adaptiveTrainingWindow:ne,isTimeVariateThresholds:te,baseSearch:Y,entityStatop:$,searchTimeSeriesAggregate:s?s.search_time_series_aggregate:"",searchTimeSeriesEntities:s?s.search_time_series_entities:"",entityBreakdownIdFields:Q,thresholdField:ee,searchAlertEarliest:se,recommendationTrainingWindow:le,aggregateThresholdsConfig:_objectSpread(_objectSpread({},P),{},{thresholdLevels:P.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}})}),entityThresholdsConfig:_objectSpread(_objectSpread({},X),{},{thresholdLevels:X.thresholdLevels.models.map(s=>{var{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}=s.toJSON();return{severityColor:o,thresholdValue:_,severityValue:S,severityColorLight:R,dynamicParam:O,severityLabel:P}})}),timeVariateThresholdsSpecification:handleTimeVariateThresholdsSpecificationPolicies(ie.get("policies")),thresholdType:Z.KPI_THRESHOLD_TYPES.AGGREGATE,rawSearch:s?s.search_time_series_aggregate:"",alertPeriod:O,tempKpiData:_objectSpread(_objectSpread({},s),{},{serviceTemplateKpiId:S,serviceTemplateId:_,adaptive_thresholding_training_window:ne,time_variate_thresholds_specification:JSON.parse(JSON.stringify(ie.toJSON()))}),thresholdTemplateId:oe,description:de,isEntityBreakdown:ce}}),[R]),[ae,ne]=(0,O.useState)((0,V.default)(o)?{}:ie(o.toJSON())),[re,se]=(0,O.useState)((0,V.default)(o)?{}:o),[le,oe]=(0,O.useState)(_),[de,ce]=(0,O.useState)(!1),[he,ue]=(0,O.useState)({}),pe=(0,O.useMemo)(()=>[],[]),[fe,ge]=(0,O.useState)(!1),[me,ve]=(0,O.useState)(!1),ye=(0,O.useCallback)(s=>{ge(s)},[]),_e=(0,O.useCallback)(s=>{(0,N.default)(s,s=>{var o;(null==s||null===(o=s.recommendation_error_type)||void 0===o?void 0:o.length)>0&&(-1===(pe.length?pe.findIndex(o=>s.entity_title===o.entityTitle):-1)&&pe.push({entityKey:s.entity_key,entityTitle:s.entity_title,recommendationError:s.recommendation_error_type}));null!=s&&s.recommendation_in_progress&&ye(!0)})},[pe,ye]),Se=(0,O.useCallback)(s=>{ue(s),_e(s[0])},[_e]),be=(0,P.default)((function(s){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z.KPI_THRESHOLD_TYPES.AGGREGATE,_=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(re.unset("kpi_threshold_template_id"),s.isTimeVariateThresholds){var R=new Y.default((0,D.default)(s.timeVariateThresholdsSpecification),{parse:!0});re.set({time_variate_thresholds_specification:R})}else if(o===Z.KPI_THRESHOLD_TYPES.ENTITY){var O=new U.default(JSON.parse(JSON.stringify((0,D.default)(s.entityThresholdsConfig))),{parse:!0});re.set({entity_thresholds:O})}else{var P=new U.default(JSON.parse(JSON.stringify((0,D.default)(s.aggregateThresholdsConfig))),{parse:!0});re.set({aggregate_thresholds:P})}_&&S.set([re],{remove:!1})}),10),Ee=(0,O.useCallback)((s,o,_)=>{ne(ie(s,o.toJSON(),_))},[ie]),Te=(0,O.useCallback)(s=>{s.attributes?ne(ie(s.toJSON())):ne(s)},[ie]),Ce=(0,O.useCallback)(()=>{var s=re.get("_key"),o=S.get(s);if(!(0,V.default)(o)){re.unset("kpi_recommendation_unlinked"),re.set("aggregate_thresholds",o.get("aggregate_thresholds").clone()),re.set("outlier_detection_algo",o.get("originalKpiCollection")),re.set("outlier_detection_sensitivity",o.get("outlier_detection_sensitivity")),re.set("time_variate_thresholds",o.get("time_variate_thresholds")),re.set("adaptive_thresholds_is_enabled",o.get("adaptive_thresholds_is_enabled")),re.set("adaptive_thresholding_training_window",o.get("adaptive_thresholding_training_window")),re.set("kpi_threshold_template_id",o.get("kpi_threshold_template_id")),re.set("recommendation_training_window",o.get("recommendation_training_window")),re.set("recommendation_start_date",o.get("recommendation_start_date")),re.set("recommendation_allow_negative_value",o.get("recommendation_allow_negative_value")),re.set("threshold_direction",o.get("threshold_direction")),re.set("recommendation_threshold_sensitivity",o.get("recommendation_threshold_sensitivity")),re.set("keep_recommended_policy_static",o.get("keep_recommended_policy_static")),re.set("is_recommended_time_policies",!0),re.set("was_recommendation_modified",!1),re.set("threshold_recommendation_summary",o.get("threshold_recommendation_summary"));var _=re.get("time_variate_thresholds_specification").get("policies"),R=o.get("time_variate_thresholds_specification").get("policies").clone();R.models.forEach(s=>{var{id:o}=s,S=_.get(o)||{};(0,V.default)(S)||s.set("entity_thresholds",S.get("entity_thresholds").clone())}),re.get("time_variate_thresholds_specification").set("policies",R),Te(re)}},[S,re,Te]),ke=(0,O.useCallback)(s=>{var o=s[0][Z.KPI_AT_RESULTS_FIELDS.THRESHOLD_DIRECTION_FIELD],_={[Z.DEFAULT_POLICY_KEY]:Z.DEFAULT_POLICY},S=_objectSpread({},ae);if(S.thresholdTemplateId&&(S.thresholdTemplateId=""),s[0][Z.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===ee.KPI_RECOMMENDATIONS.SUCCESSFUL||s[0][Z.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===ee.KPI_NO_RECOMMENDATIONS.NO_PATTERN.type)if(s[0][Z.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]===ee.KPI_NO_RECOMMENDATIONS.NO_PATTERN.type){var R=s[0][Z.KPI_AT_RESULTS_FIELDS.THRESHOLDS_FIELD].replace(/'/g,'"'),O=JSON.parse(R),P=(0,X.generateSeverityLevels)(O,!1),N=o!==ee.THRESHOLD_CONFIGURATION_OPTIONS[2].value?(0,D.default)(Z.BASE_CRITICAL_THRESHOLDS):(0,D.default)(Z.DEFAULT_THRESHOLDS),V={lastRun:(0,Q.getEpochNowUTC)(),confidenceScore:s[0][Z.KPI_AT_RESULTS_FIELDS.SCORE_FIELD],confidenceLevel:s[0][Z.KPI_AT_RESULTS_FIELDS.CONFIDENCE_FIELD],timePolicyDesc:s[0][Z.KPI_AT_RESULTS_FIELDS.TIME_POLICY_DESCRIPTION_FIELD],timePolicyType:s[0][Z.KPI_AT_RESULTS_FIELDS.ALGORITHM_FIELD]};P.sort((s,o)=>s.thresholdValue-o.thresholdValue),N.thresholdLevels=P;var j=P[P.length-1].thresholdValue,U=j+.1*j;N.gaugeMax=U,N.renderBoundaryMax=U,re.set("time_variate_thresholds",!1),re.set("adaptive_thresholds_is_enabled",!1),re.set("aggregate_outlier_detection_enabled",!1),re.set("was_recommendation_modified",!1),re.set("is_recommended_time_policies",!0),re.set("threshold_recommendation_summary",V),S.isTimeVariateThresholds=!1,S.isAdaptiveThresholdsEnabled=!1,S.isOutlierDetectionEnabled=!1,S.aggregateThresholdsConfig=N,S.atRecommendationInfo=V,be(S,Z.KPI_THRESHOLD_TYPES.AGGREGATE,!0),Te(S)}else{var Y=[],te=!s[0][Z.KPI_AT_RESULTS_FIELDS.USE_STATIC],ie={lastRun:(0,Q.getEpochNowUTC)(),confidenceScore:s[0][Z.KPI_AT_RESULTS_FIELDS.SCORE_FIELD],confidenceLevel:s[0][Z.KPI_AT_RESULTS_FIELDS.CONFIDENCE_FIELD],timePolicyDesc:s[0][Z.KPI_AT_RESULTS_FIELDS.TIME_POLICY_DESCRIPTION_FIELD],timePolicyType:s[0][Z.KPI_AT_RESULTS_FIELDS.ALGORITHM_FIELD]};s.forEach(s=>{var S=(0,$.generateUUID)(),R=[[s[Z.KPI_AT_RESULTS_FIELDS.CRON_FIELD],parseInt(s[Z.KPI_AT_RESULTS_FIELDS.DURATION_FIELD],10)]],O=(0,Q.getUserTimezoneOffset)("sec"),P=(0,Z.getPolicyTitleFromTimeBlock)(R,O),D=s[Z.KPI_AT_RESULTS_FIELDS.THRESHOLDS_FIELD],N=parseFloat(s[Z.KPI_AT_RESULTS_FIELDS.MEAN_FIELD]),V=parseFloat(s[Z.KPI_AT_RESULTS_FIELDS.STD_FIELD]),j=D.replace(/'/g,'"'),K=JSON.parse(j),W=(0,X.generateSeverityLevels)(K,!0,N,V);Y.push({Algorithm:s[Z.KPI_AT_RESULTS_FIELDS.ALGORITHM_FIELD],Confidence:s[Z.KPI_AT_RESULTS_FIELDS.CONFIDENCE_FIELD],"Cron Expression":s[Z.KPI_AT_RESULTS_FIELDS.CRON_FIELD],Duration:s[Z.KPI_AT_RESULTS_FIELDS.DURATION_FIELD].toString(),"Recommendation Flag":s[Z.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD],Score:s[Z.KPI_AT_RESULTS_FIELDS.SCORE_FIELD].toString(),Sensitivity:s[Z.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD].toString(),"Threshold Direction":s[Z.KPI_AT_RESULTS_FIELDS.THRESHOLD_DIRECTION_FIELD],Thresholds:s[Z.KPI_AT_RESULTS_FIELDS.THRESHOLDS_FIELD],"Time Policy Description":s[Z.KPI_AT_RESULTS_FIELDS.TIME_POLICY_DESCRIPTION_FIELD],itsi_kpi_id:ae._key,Mean:s[Z.KPI_AT_RESULTS_FIELDS.MEAN_FIELD],Std:s[Z.KPI_AT_RESULTS_FIELDS.STD_FIELD]});var U=o!==ee.THRESHOLD_CONFIGURATION_OPTIONS[2].value?Z.BASE_CRITICAL_THRESHOLDS:Z.DEFAULT_THRESHOLDS;_[S]={_key:S,title:P,aggregate_thresholds:_objectSpread(_objectSpread({},U),{},{thresholdLevels:W}),entity_thresholds:Z.DEFAULT_THRESHOLDS,policy_type:te?s[Z.KPI_AT_RESULTS_FIELDS.ALGORITHM_FIELD]:"static",time_blocks:R}});var ne=s[0][Z.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD]!==ee.OUTLIER_NO_RECOMMENDATION;re.set("adaptive_thresholds_is_enabled",te),re.set("adaptive_thresholding_training_window",s[0][Z.KPI_AT_RESULTS_FIELDS.ANALYSIS_WINDOW]),re.set("aggregate_outlier_detection_enabled",ne),re.set("was_recommendation_modified",!1),re.set("is_recommended_time_policies",!0),re.set("time_variate_thresholds",!0),re.set("threshold_direction",o),re.set("threshold_recommendations",Y),re.set("threshold_recommendation_summary",ie),S.isAdaptiveThresholdsEnabled=te,S.adaptiveTrainingWindow=s[0][Z.KPI_AT_RESULTS_FIELDS.ANALYSIS_WINDOW],S.isOutlierDetectionEnabled=ne,S.isTimeVariateThresholds=!0,S.timeVariateThresholdsSpecification={policies:_},S.atRecommendationInfo=ie,s[0][Z.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD]!==ee.OUTLIER_NO_RECOMMENDATION&&(re.set("outlier_detection_algo",ee.OUTLIER_RECOMMENDATION_DETECTION_ALGORITHM),re.set("outlier_detection_sensitivity",Number(s[0][Z.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD])),S.outlierDetectionAlgorithm=ee.OUTLIER_RECOMMENDATION_DETECTION_ALGORITHM,S.outlierDetectionSensitivity=Number(s[0][Z.KPI_AT_RESULTS_FIELDS.SENSITIVITY_FIELD])),te&&(S.tempKpiData=re.toJSON(),S.tempKpiData.time_variate_thresholds_specification=JSON.parse(JSON.stringify(S.timeVariateThresholdsSpecification))),be(S,Z.KPI_THRESHOLD_TYPES.AGGREGATE,!0),Te(S)}else switch(re.set("was_recommendation_modified",!1),re.set("is_recommended_time_policies",!0),Te(S),s[0][Z.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]){case ee.KPI_NO_RECOMMENDATIONS.CONSTANT_KPI.type:re.set("recommendation_error_type",ee.KPI_NO_RECOMMENDATIONS.CONSTANT_KPI.type);break;case ee.KPI_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.type:re.set("recommendation_error_type",ee.KPI_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.type);break;case ee.KPI_NO_RECOMMENDATIONS.PATTERN_SWITCH.type:re.set("recommendation_error_type",ee.KPI_NO_RECOMMENDATIONS.PATTERN_SWITCH.type);break;default:re.set("recommendation_error_type",(0,W.sprintf)((0,K.gettext)("No recommendations available due to unknown reason: %(reasonCode)s"),{reasonCode:s[0][Z.KPI_AT_RESULTS_FIELDS.RECOMMENDATION_FIELD]}))}},[Te,ae,re,be]),xe=(0,O.useCallback)(s=>{se(s)},[]),we=(0,O.useMemo)(()=>({entityRecommendationError:pe,formatRecommendations:ke,handleEntityRecommendationError:_e,handleEntityRecommendationInProgress:ye,handleEntityRecommendationUpdate:Se,handleKpiModelChange:xe,handleServiceTemplateKpiChange:Ee,hadCopyKPIToEntityThresholds:de,isEntityRecommendationInProgress:fe,isServiceTemplate:R,isServiceTemplateNewKpi:me,kpiData:ae,previewServiceKey:le,recommendedThresholds:he,revertKpiAIThresholdSettings:Ce,selectedKpiModel:re,setHadCopyKPIToEntityThresholds:ce,setIsServiceTemplateNewKpi:ve,setPreviewServiceKey:oe,updateKpiData:Te,updateThresholdInKpiModel:be}),[pe,ke,_e,ye,Se,xe,Ee,de,fe,R,me,ae,le,he,Ce,re,ce,ve,oe,Te,be]);return O.default.createElement(te.Provider,{value:we},j)}ThresholdingProvider.propTypes={kpiModel:j.default.object,originalKpiCollection:j.default.object,serviceKey:j.default.string,isServiceTemplate:j.default.bool,children:j.default.object.isRequired},ThresholdingProvider.defaultProps={kpiModel:{},originalKpiCollection:{},serviceKey:"",isServiceTemplate:!1}},4001:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(57),O=S(_(2612)),P=S(_(4002)),D=S(_(4003)),N=S(_(4004)),V=S(_(4006)),j=S(_(4007)),K=S(_(2614));_(7691);var W=O.default.extend({tabLayoutDataTestItsi:"service-definition-tab-layout",EntitiesTabView:P.default,KpiTabView:N.default,DependencyTabView:V.default,ServiceSettingsTabView:D.default,PredictiveAnalyticsTabView:j.default,initialize:function initialize(s){this.appsData=s.appsData,this.featureFlags=s.featureFlags,this.globalTeamData=s.globalTeamData,this.teamsCollectionData=s.teamsCollectionData,this.permissions=s.permissions,this.thresholdTemplateCollection=s.thresholdTemplateCollection,this.userData=s.userData,this.serviceTemplate=s.serviceTemplate,this.sdDispatcher=s.sdDispatcher,this.servicesCollectionData=s.servicesCollectionData,this.tagsData=s.tagsData,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.severityLabels=s.severityLabels,this.tabToShow=s.tabToShow,this.kpiToShow=s.kpiToShow,this.model=s.model,O.default.prototype.initialize.apply(this,arguments),this.renderTabs(),this.childViews.tabViews.tabs=[this.infoTab,this.kpiTab,this.dependencyTab,this.settingsTab,this.predictiveAnalyticsTab],this.listenTo(this.sdDispatcher,"showKpiTab",this.showKpiTab)},showKpiTab:function showKpiTab(){var s;null===(s=this.childViews)||void 0===s||null===(s=s.tabViews)||void 0===s||s.showTab(R.SERVICE_DEFINITION_TABS.KPI)},render:function render(){return this.$el.html('<div class="service-info-header"></div><div class="service-tab-container"></div>'),this.$(".service-tab-container").append(this.childViews.tabViews.render().$el),this},updateServicesCollectionData:function updateServicesCollectionData(s){this.servicesCollectionData=s},renderTabs:function renderTabs(){this.infoTab=new this.EntitiesTabView({service:this.modelClone,ContentView:K.default,serviceTemplate:this.serviceTemplate}),this.kpiTab=new this.KpiTabView({featureFlags:this.featureFlags,appsData:this.appsData,kpiToShow:this.kpiToShow,service:this.modelClone,serviceTemplate:this.serviceTemplate,sdDispatcher:this.sdDispatcher,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping,severityLabels:this.severityLabels,permissions:this.permissions,thresholdTemplateCollection:this.thresholdTemplateCollection,userData:this.userData}),this.dependencyTab=new this.DependencyTabView({globalTeamData:this.globalTeamData,servicesCollectionData:this.servicesCollectionData,updateServicesCollectionData:this.updateServicesCollectionData,service:this.modelClone}),this.settingsTab=new D.default({service:this.modelClone,teamsCollectionData:this.teamsCollectionData,servicesCollectionData:this.servicesCollectionData,tagsData:this.tagsData,serviceTemplate:this.serviceTemplate,sdDispatcher:this.sdDispatcher}),this.predictiveAnalyticsTab=new j.default({service:this.modelClone,sdDispatcher:this.sdDispatcher})},refreshModel:function refreshModel(){this.infoTab.refreshModel(),this.kpiTab.refreshModel(),this.dependencyTab.refreshModel(),this.settingsTab.refreshModel(),this.predictiveAnalyticsTab.refreshModel()}});o.default=W;s.exports=o.default},4002:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(57),O=S(_(2613)),P=S(_(2614)),D=O.default.extend({dataTestItsi:"service-definition-entities-tab",initialize:function initialize(s){if(!(s=s||{}).service)throw"Must provide service";s.tabId=R.SERVICE_DEFINITION_TABS.INFO,s.contentViewOptions={service:s.service,serviceTemplate:s.serviceTemplate},s.ContentView||(s.ContentView=P.default),O.default.prototype.initialize.apply(this,arguments)}});o.default=D;s.exports=o.default},4003:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(2617)),O=S(_(7665)),P=R.default.extend({dataTestItsi:"service-definition-settings-tab",initialize:function initialize(s){if(!(s=s||{}).service)throw"Must provide service";s.contentViewOptions={service:s.service,isReadOnly:s.readOnly,teamsCollectionData:s.teamsCollectionData,servicesCollectionData:s.servicesCollectionData,tagsData:s.tagsData,serviceTemplate:s.serviceTemplate,sdDispatcher:s.sdDispatcher},s.ContentView=O.default,R.default.prototype.initialize.call(this,s)}});o.default=P;s.exports=o.default},4004:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(2631)),O=S(_(4005)),P=R.default.extend({dataTestItsi:"service-definition-kpis-tab",initialize:function initialize(s){if(!(s=s||{}).service)throw"Must provide service";this.featureFlags=s.featureFlags,this.appsData=s.appsData,this.permissions=s.permissions,this.thresholdTemplateCollection=s.thresholdTemplateCollection,this.userData=s.userData,this.readOnly=s.readOnly,this.service=s.service,this.serviceTemplate=s.serviceTemplate,this.sdDispatcher=s.sdDispatcher,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.severityLabels=s.severityLabels,this.kpiToShow=s.kpiToShow,s.ContentView=s.ContentView||O.default,s.contentViewOptions={featureFlags:this.featureFlags,appsData:this.appsData,kpiToShow:this.kpiToShow,service:this.service,readOnly:this.readOnly,serviceTemplate:this.serviceTemplate,sdDispatcher:this.sdDispatcher,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping,severityLabels:this.severityLabels,permissions:this.permissions,thresholdTemplateCollection:this.thresholdTemplateCollection,userData:this.userData},R.default.prototype.initialize.apply(this,arguments)}});o.default=P;s.exports=o.default},4005:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(2632)),O=R.default.extend({initialize:function initialize(s){if(!(s=s||{}).service)throw"Must provide service";this.serviceObj=s.service,R.default.prototype.initialize.apply(this,arguments)}});o.default=O;s.exports=o.default},4006:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=_(57),P=S(_(276)),D=S(_(7666)),N=P.default.extend({dataTestItsi:"service-definition-dependencies-tab",initialize:function initialize(s){(s=s||{}).tabId=O.SERVICE_DEFINITION_TABS.DEPENDENCY,s.tabLabel=(0,R.gettext)("Service Dependencies"),s.ContentView=D.default,s.contentViewOptions={globalTeamData:s.globalTeamData,servicesCollectionData:s.servicesCollectionData,updateServicesCollectionData:s.updateServicesCollectionData,service:s.service,isReadOnly:s.readOnly},P.default.prototype.initialize.apply(this,arguments)}});o.default=N;s.exports=o.default},4007:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(7675)),O=S(_(7676)),P=R.default.extend({dataTestItsi:"service-definition-pa-tab",initialize:function initialize(s){if(!(s=s||{}).service)throw"Must provide service";s.contentViewOptions={service:s.service,isReadOnly:s.readOnly,sdDispatcher:s.sdDispatcher},s.ContentView=O.default,R.default.prototype.initialize.call(this,s)}});o.default=P;s.exports=o.default},4008:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j=S(_(16)),K=S(_(17)),W=S(_(21)),U=S(_(19)),Y=S(_(20)),$=S(_(8)),X=S(_(7)),Z=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),Q=S(_(3)),ee=S(_(2)),te=S(_(27)),ie=S(_(272)),ae=S(_(634)),ne=S(_(89)),re=_(4),se=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,U.default)(o),(0,W.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,U.default)(s).constructor):o.apply(s,_))}_(28);var le=ee.default.div(R||(R=(0,X.default)(["\n\tdisplay: block;\n\twidth: 350px;\n"]))),oe=ee.default.span(O||(O=(0,X.default)(["\n\twhite-space: nowrap;\n"]))),de=Z.default.createElement(oe,null,(0,re.gettext)("Open in Search")),ce=(0,ee.default)(te.default)(P||(P=(0,X.default)(["\n\tpadding: 0;\n"]))),he=(0,ee.default)(ie.default)(D||(D=(0,X.default)(["\n\tmargin: 5px;\n\tmin-height: 150px;\n"]))),ue=(0,ee.default)(ie.default.Body)(N||(N=(0,X.default)(["\n\tmargin: ",";\n"])),s=>s.isCompleted?"":"0 auto"),pe=(0,ee.default)(ne.default)(V||(V=(0,X.default)(["\n\tfloat: right;\n"]))),fe=Z.default.createElement(ae.default,{screenReaderText:(0,re.gettext)("Open in Search"),height:"16",width:"16"}),ge=function(s){function PredictiveAnalyticsResultsCard(s){var o;(0,j.default)(this,PredictiveAnalyticsResultsCard);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,PredictiveAnalyticsResultsCard,[s,...S]),(0,$.default)(o,"getTooltipContent",s=>Z.default.createElement(le,null,s)),(0,$.default)(o,"getAlertTooltipContent",s=>Z.default.createElement(le,null,s?(0,re.gettext)("Save service before creating Correlation Search"):(0,re.gettext)("Create a Correlation Search"))),(0,$.default)(o,"getCardHeader",s=>se.PANELS.filter(o=>o.value===s).map(_=>{var S=s===se.PANEL_TYPE.WORST_HEALTHSCORE||s===se.PANEL_TYPE.WORST_SEVERITY;return Z.default.createElement(ie.default.Header,{title:_.label,key:_.value,subtitle:_.subtitle},Z.default.createElement("div",null,Z.default.createElement(ne.default,{"data-test-itsi":"pa-results-card-description-tooltip",content:o.getTooltipContent(_.description)}),Z.default.createElement(pe,{"data-test-itsi":"pa-results-card-open-in-search-tooltip",content:de},Z.default.createElement(ce,{"aria-label":(0,re.gettext)("Open in Search"),"data-test-itsi":"pa-open-in-search-button",disabled:o.props.getDisabledState(_.value),onClick:o.props.openInSearch(_.value),appearance:"pill",icon:fe})),S?Z.default.createElement(pe,{"data-test-itsi":"pa-results-card-create-alert-tooltip",content:o.getAlertTooltipContent(o.props.serviceUpdated)},o.props.createAlertObject):null))})),o.state={},o}return(0,Y.default)(PredictiveAnalyticsResultsCard,s),(0,K.default)(PredictiveAnalyticsResultsCard,[{key:"render",value:function render(){var s=this.getCardHeader(this.props.panelType);return this.props.fillCard?Z.default.createElement(he,{"data-test-itsi":"pa-results-fill-card"},s,this.props.body):Z.default.createElement(he,{"data-test-itsi":"pa-results-card"},s,Z.default.createElement(ue,{isCompleted:this.props.isCompleted},this.props.body))}}])}(Z.Component);(0,$.default)(ge,"propTypes",{isCompleted:Q.default.bool.isRequired,panelType:Q.default.number.isRequired,body:Q.default.object,getDisabledState:Q.default.func.isRequired,openInSearch:Q.default.func.isRequired,fillCard:Q.default.bool,createAlertObject:Q.default.object,serviceUpdated:Q.default.bool}),(0,$.default)(ge,"defaultProps",{body:Z.default.createElement("div",null),fillCard:!1,createAlertObject:null,serviceUpdated:!1});o.default=ge;s.exports=o.default},434:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.VIZ_COLORS=o.TRAIN_TEST_WORKFLOW_STEP=o.TEST_DATA_SPLIT_MESSAGES=o.SERVICE_CONFIGURATION_TEXT=o.SEARCH_TYPE=o.SEARCH_PROGRESS_ELEMENTS=o.SEARCHES=o.RANK_IGNORED=o.PREDICTIVE_ANALYTICS_ALGORITHM_TYPE=o.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES=o.PREDICTIVE_ANALYTICS_ALGORITHMS=o.PREDICTED_HEALTH_STATE_TOOLTIP=o.PREDICTED_HEALTH_SCORE_TOOLTIP=o.PLOTLINE_VIZ_COLOR=o.PANEL_TYPE=o.PANELS=o.NUM_ROOT_CAUSE_KPI=o.MODEL_MISSING_MESSAGES=o.MODEL_MISSING_MESSAGE=o.MATH_UTILS=o.LOOKUP_FILE_TYPES=o.LOAD_STATE=o.KPI_MODEL_TTL=o.KPI_FORECAST_TYPE=o.DEFAULT_SPLUNK_SEARCH_ERROR_MESSAGE=o.CLASSIFICATION_STATES=o.ALGO_TYPES=o.ALERT_ERROR_MESSAGES=void 0,o.classificationAlgorithmCategoryColor=function classificationAlgorithmCategoryColor(s){var o=(0,ie.getSeverityColor)(6),_=me.filter(o=>o.type===s);(0,K.default)(_)||(o=_[0].color);return o},o.confirmationModalBody=function confirmationModalBody(){return N.default.createElement($.default.Body,null,N.default.createElement(Y.default,{"data-test-itsi":"cs-create-success-message",type:"success"},N.default.createElement("div",null,(0,Z.gettext)("Correlation search successfully created. To view the search, go to the")+" ",N.default.createElement(U.default,{"data-test-itsi":"correlation-searches-lister-link",to:ae.uiListerURL,openInNewContext:!0},(0,Z.gettext)("Correlation Searches lister page.")))))},o.formatMissingModels=function formatMissingModels(s,o){return _e.filter(o=>o.value in s).map((s,_)=>_===o-1?N.default.createElement("span",{key:s.value},N.default.createElement("b",null,s.label)," "+(0,Z.gettext)("model")):_===o-2?N.default.createElement("span",{key:s.value},N.default.createElement("b",null,s.label)," "+(0,Z.gettext)("model, and")+" "):N.default.createElement("span",{key:s.value},N.default.createElement("b",null,s.label)," "+(0,Z.gettext)("model")+", "))},o.getAlgorithmLabelLabel=function getAlgorithmLabelLabel(s){switch(s){case ye.LINEAR_REGRESSION.key:return ye.LINEAR_REGRESSION.name;case ye.RANDOM_FOREST.key:return ye.RANDOM_FOREST.name;case ye.GRADIENT_BOOSTING.key:return ye.GRADIENT_BOOSTING.name;case ye.LOGISTIC_REGRESSION.key:return ye.LOGISTIC_REGRESSION.name;default:return(0,Z.gettext)(s)}},o.getAlgorithmTypeFromModelId=getAlgorithmTypeFromModelId,o.getAvailableModelSet=function getAvailableModelSet(s){var o=new Set;return(0,j.default)(s.filter(s=>1===parseInt(s.avg)&&1===parseInt(s.ss)&&1===parseInt(s.worst)),s=>{o.add(s.name)}),o},o.getKpiIdFromFieldName=function getKpiIdFromFieldName(s){var o={rank:ke,kpiId:""};if(!s.length)return o;var _=s.trim(),S=_.split("_");return _.startsWith(be.ACTUAL)||_.startsWith(be.PREDICTED)?{rank:S[1],kpiId:S.slice(2).join("_")}:o},o.getPredictionActualLabel=function getPredictionActualLabel(s){return(0,Z.gettext)(s)},o.getPredictionErrorMessage=function getPredictionErrorMessage(s){if(s.includes("Model does not exist"))return Se.PANEL;return s},o.getSavedAlgorithmModel=function getSavedAlgorithmModel(s,o){var _="";if(!s||!o)return _;var S=s.get("algorithms");if(S){var R=S.get(o);_=R.get("modelId")}return _},o.isValidAlgorithmModel=function isValidAlgorithmModel(s,o){var _=!1;if(!s||!o)return _;if(s&&o.length){o.filter(o=>o.detail.modelId===s).length&&(_=!0)}return _},o.isValidTimePeriod=function isValidTimePeriod(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"0"===s&&""===o||(""===s&&"0"!==o&&""!==o||("0"!==s&&""!==s&&""===o||!!s&&!!o))},o.loadMissingMLTKElement=function loadMissingMLTKElement(){return N.default.createElement(oe,null,N.default.createElement(Y.default,{"data-test-itsi":"install-mltk-error-message",type:"error"},N.default.createElement("div",null,(0,Z.gettext)("You must install Splunk Machine Learning Toolkit to use Predictive Analytics. Download the MLTK")+" ",N.default.createElement(U.default,{"data-test-itsi":"pa-mltk-app-link",to:(0,ee.getSplunkBaseDetailsURL)(Q.SPLUNKBASE_APPS.Machine_Learning_Toolkit.id),openInNewContext:!0},(0,Z.gettext)("here")))))},o.openInSearch=function openInSearch(s){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0",_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(!s)return;var S={q:s,earliest:o,latest:_},R=(0,re.uiEditURL)(S);window.open(R,"_blank")},o.outputCategoryColor=function outputCategoryColor(s){var o=[(0,ie.getSeverityColor)(6),(0,ie.getSeverityColor)(6),(0,ie.getSeverityColor)(5),(0,ie.getSeverityColor)(2)];return s>1||s<0?o[0]:(0,ne.getSeverityColorFromColorRangeTable)(100*s,o)};var R,O,P,D=S(_(7)),N=S(_(0)),V=S(_(2)),j=S(_(321)),K=S(_(33)),W=S(_(344)),U=S(_(34)),Y=S(_(24)),$=S(_(100)),X=S(_(75)),Z=_(4),Q=_(265),ee=_(264),te=_(29),ie=_(107),ae=_(428),ne=_(1052),re=_(137);_(28);var se=(0,V.default)(Y.default)(R||(R=(0,D.default)(["\n\tmargin: 0 auto;\n\tposition: relative;\n"]))),le=(0,V.default)(X.default)(O||(O=(0,D.default)(["\n\tdisplay: inline-block;\n"]))),oe=V.default.div(P||(P=(0,D.default)(["\n\tpadding: 10px 20px;\n"]))),de={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},ce={paddingLeft:"10px",display:"inline-block"},he={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},ue={},pe={width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},fe={},ge=(o.VIZ_COLORS=["#000000","#006d9c","#4fa484","#ec9960","#5a4575","#b6c75a"],o.PLOTLINE_VIZ_COLOR="#a8a8a8",o.ALGO_TYPES={REGRESSION:1,CLASSIFICATION:2}),me=(o.LOOKUP_FILE_TYPES={CSV:".csv",MLMODEL:".mlmodel"},o.CLASSIFICATION_STATES=[{type:"Critical",label:(0,Z.gettext)("Critical"),color:(0,ie.getSeverityColor)(6)},{type:"Medium",label:(0,Z.gettext)("Medium"),color:(0,ie.getSeverityColor)(5)},{type:"Normal",label:(0,Z.gettext)("Normal"),color:(0,ie.getSeverityColor)(2)}]),ve=(o.LOAD_STATE={FIRST_LOAD:0,NORMAL:1,MISSING:2,LOADING_MODELS:3},o.SEARCH_TYPE={HEALTHSCORE_SEARCH:"healthScore",KPI_OVER_TIME_SEARCH:"kpiOverTime"},o.DEFAULT_SPLUNK_SEARCH_ERROR_MESSAGE=(0,Z.gettext)("An error occurred while executing the search. Refer to the Splunk logs for more information."),o.PANEL_TYPE={R2:1,RMSE:2,HEALTHSCORE_COMPARISON:3,RESIDUAL_ERROR:4,AVG_HEALTHSCORE:5,WORST_HEALTHSCORE:6,PRECISION:7,RECALL:8,ACCURACY:9,F1:10,CONFUSION:11,WORST_SEVERITY:12,AVG_SEVERITY:13}),ye=(o.TRAIN_TEST_WORKFLOW_STEP={TRAIN_TO_TEST:0,TEST:1,IN_TRAIN:2},o.PREDICTIVE_ANALYTICS_ALGORITHM_TYPE=[{name:"Regression",value:ge.REGRESSION,label:(0,Z.gettext)("Regression"),labelLowerCase:(0,Z.gettext)("regression")},{name:"Classification",value:ge.CLASSIFICATION,label:(0,Z.gettext)("Classification"),labelLowerCase:(0,Z.gettext)("classification")}],o.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES={LINEAR_REGRESSION:{key:"LinearRegression",name:(0,Z.gettext)("Linear Regression")},RANDOM_FOREST:{key:"RandomForestRegressor",name:(0,Z.gettext)("Random Forest Regressor")},GRADIENT_BOOSTING:{key:"GradientBoostingRegressor",name:(0,Z.gettext)("Gradient Boosting Regressor")},LOGISTIC_REGRESSION:{key:"LogisticRegression",name:(0,Z.gettext)("Logistic Regression")}}),_e=o.PREDICTIVE_ANALYTICS_ALGORITHMS=[{value:ye.LINEAR_REGRESSION.key,label:ye.LINEAR_REGRESSION.name,type:ge.REGRESSION},{value:ye.RANDOM_FOREST.key,label:ye.RANDOM_FOREST.name,type:ge.REGRESSION},{value:ye.GRADIENT_BOOSTING.key,label:ye.GRADIENT_BOOSTING.name,type:ge.REGRESSION},{value:ye.LOGISTIC_REGRESSION.key,label:ye.LOGISTIC_REGRESSION.name,type:ge.CLASSIFICATION}],Se=(o.ALERT_ERROR_MESSAGES={NEGATIVE:(0,Z.gettext)("Input value cannot be less than 0."),MIN_ERROR:(0,Z.gettext)("Minimum range cannot be greater than maximum value."),MAX_ERROR:(0,Z.gettext)("Maximum range cannot be less than minimum value."),INTEGER:(0,Z.gettext)("Input value must be a positive integer."),HUNDRED:(0,Z.gettext)("Input value cannot be greater than 100."),ERROR_SAVING:(0,Z.gettext)("Could not save correlation search."),EMPTY:(0,Z.gettext)("Input value is required."),SEARCH_NAME:(0,Z.gettext)("Search name is required."),EMPTY_TITLE:(0,Z.gettext)("Notable event title is required.")},o.TEST_DATA_SPLIT_MESSAGES={TEST_ALL_DATA:(0,Z.gettext)("All data within the selected time period will be used for testing."),TEST_NO_DATA:(0,Z.gettext)("Do not change the time range while a model is being trained.")},o.MODEL_MISSING_MESSAGES={CREATION_DASHBOARD:" "+(0,Z.gettext)("of this type has been deleted. If it was deleted by accident, retrain it above."),CREATION_DASHBOARD_PLURAL:" "+(0,Z.gettext)("of this type have been deleted. If they were deleted by accident, retrain them above."),USAGE_DASHBOARD:" "+(0,Z.gettext)("of this type has been deleted. If it was deleted by accident, retrain it in")+" ",USAGE_DASHBOARD_PLURAL:" "+(0,Z.gettext)("of this type have been deleted. If they were deleted by accident, retrain them in")+" ",PANEL:(0,Z.gettext)("One or more models in use has been deleted. If they were deleted by accident, retrain them again.")}),be=o.KPI_FORECAST_TYPE={ACTUAL:"actual_",PREDICTED:"predicted_"},Ee=o.PREDICTED_HEALTH_SCORE_TOOLTIP=(0,Z.gettext)("Predicted health score in 20-30 minutes"),Te=o.PREDICTED_HEALTH_STATE_TOOLTIP=(0,Z.gettext)("Predicted health state in 20-30 minutes"),Ce=(o.MODEL_MISSING_MESSAGE=(0,Z.gettext)("This model has been deleted. If it was deleted by accident,")+" ",o.SERVICE_CONFIGURATION_TEXT=(0,Z.gettext)("Service Configuration"),o.PANELS=[{value:ve.R2,label:"R^2",subtitle:"",description:(0,Z.gettext)("R^2 is a measure of how well the model approximates the real data points. This value ranges from 0 to 1. In general, the higher the R^2, the better the prediction.")},{value:ve.RMSE,label:"RMSE",subtitle:"",description:(0,Z.gettext)("RMSE (Root Mean Squared Error) is a measure of the average difference between the predicted and observed service health scores. This value depends on the output distribution of the created model, but in general a smaller value is better.")},{value:ve.HEALTHSCORE_COMPARISON,label:(0,Z.gettext)("Actual vs. Predicted Service Health Score"),subtitle:"",description:(0,Z.gettext)("A scatterplot of the actual versus predicted results. The dots represent the actual values graphed against the predicted values. If a predicted value equals the actual value, the dot will fall exactly on the line. The greater the distance from the line, the farther off the prediction. It is best if there are more dots closer to the line.")},{value:ve.RESIDUAL_ERROR,label:(0,Z.gettext)("Residual Error Histogram"),subtitle:"",description:(0,Z.gettext)("A histogram of the residual error of each service health score during the test period. The residual error is the difference between the observed service health score and the estimated score predicted by the model. It is better if this graph has a normal (bell-shaped) distribution with values closer to 0.")},{value:ve.AVG_HEALTHSCORE,label:(0,Z.gettext)("Predicted Average Case Service Health Score"),subtitle:Ee,description:(0,Z.gettext)("The average predicted health score within the prediction window.")},{value:ve.WORST_HEALTHSCORE,label:(0,Z.gettext)("Predicted Worst Case Service Health Score"),subtitle:Ee,description:(0,Z.gettext)("The lowest possible predicted health score value within the prediction window.")},{value:ve.WORST_SEVERITY,label:(0,Z.gettext)("Predicted Worst Case Severity"),subtitle:Te,description:(0,Z.gettext)("The worst case predicted severity within the prediction window.")},{value:ve.AVG_SEVERITY,label:(0,Z.gettext)("Predicted Average Case Severity"),subtitle:Te,description:(0,Z.gettext)("The average predicted severity within the prediction window.")},{value:ve.PRECISION,label:(0,Z.gettext)("Precision"),subtitle:"",description:(0,Z.gettext)("The percentage of time a model identifies only the relevant data points.")},{value:ve.RECALL,label:(0,Z.gettext)("Recall"),subtitle:"",description:(0,Z.gettext)("The percentage of time the correct severity is predicted.")},{value:ve.ACCURACY,label:(0,Z.gettext)("Accuracy"),subtitle:"",description:(0,Z.gettext)("The overall percentage of correct predictions.")},{value:ve.F1,label:(0,Z.gettext)("F1"),subtitle:"",description:(0,Z.gettext)("The weighted average of precision and recall, based on a scale from zero to one. The closer the statistic is to one, the better the fit of the model.")},{value:ve.CONFUSION,label:(0,Z.gettext)("Classification Results (Confusion Matrix)"),subtitle:"",description:(0,Z.gettext)("The number of actual results against predicted results. The diagonal numbers should be closer to 100%, while the other numbers should be closer to 0.")}],o.KPI_MODEL_TTL=864e6,o.NUM_ROOT_CAUSE_KPI=5),ke=o.RANK_IGNORED=999;o.MATH_UTILS={isEvenNumber:function isEvenNumber(s){return s%2==0},isOddNumber:function isOddNumber(s){return s%2==1}},o.SEARCHES={currentModelName:"",getCreateModelSearch:function getCreateModelSearch(s,o,_,S){if(!(s&&o&&_&&(0,W.default)(S).length))return"";var R=o.split(/(?=[A-Z])/).join("_").toLowerCase();return"`train_and_test("+s+","+(_===ge.REGRESSION?"health_score":"health_score_level")+","+R+",app:"+this.getAlgorithmModelName(s,o)+","+S+")`"},getSampleCreateModelSearch:function getSampleCreateModelSearch(s,o,_,S){if(!(s&&o&&_&&(0,W.default)(S).length))return"";var R="itsi_predict_sample_model_"+o,O="",P="";switch(o){case ye.LINEAR_REGRESSION.key:P="| fit "+(O=o+" fit_intercept=true")+' next30m_avg_hs from\n"SS_*" "this_date_*" last30m_avg_hs now_avg_hs into '+R+"_avg\n| fit "+O+' next30m_min_hs from\n"SS_*" "this_date_*" last30m_min_hs now_min_hs into '+R+"_worst";break;case ye.RANDOM_FOREST.key:case ye.GRADIENT_BOOSTING.key:P="| fit "+(O=o)+' next30m_avg_hs from\n "SS_*" "this_date_*" last30m_avg_hs now_avg_hs into '+R+"_avg\n | fit "+O+' next30m_min_hs from\n "SS_*" "this_date_*" last30m_min_hs now_min_hs into '+R+"_worst";break;case ye.LOGISTIC_REGRESSION.key:P="| fit "+(O=o+" fit_intercept=true")+' next30m_avg_hsl from\n"SS_*" "this_date_*" last30m_avg_hsl now_avg_hsl into '+R+"_avg\n| fit "+O+' next30m_max_hsl from\n"SS_*" "this_date_*" last30m_max_hsl now_max_hsl into '+R+"_worst"}return"`itsi_summary_with_dependence("+s+')`\n| timechart limit=0 span=5m avg(alert_value) as value_avg\nmin(alert_value) as value_min\nmax(alert_value) as value_max\navg(alert_value) as value_avg\nstdev(alert_value) as value_std\navg(alert_level) as level_avg\nmax(alert_level) as level_max\navg(eval(if(is_service_max_severity_event=1, alert_value, null))) as value_ms_avg\nmin(eval(if(is_service_max_severity_event=1, alert_value, null))) as value_ms_min\nmax(eval(if(is_service_max_severity_event=1, alert_value, null))) as value_ms_max by kpiid\n| rename "value_avg: SHKPI-'+s+'" as now_avg_hs,\n"value_min: SHKPI-'+s+'" as now_min_hs,\n"level_avg: SHKPI-'+s+'" as now_avg_hsl,\n"level_max: SHKPI-'+s+'" as now_max_hsl\n| search now_avg_hs=*\n| eval now_avg_hsl=case(now_avg_hsl>=5, "Critical", now_avg_hsl>=3, "Medium", true(), "Normal"),\nnow_max_hsl=case(now_max_hsl>=5, "Critical", now_max_hsl>=3, "Medium", true(), "Normal")\n| eval this_date_day = strftime(_time, "%w"),\nthis_date_hour = strftime(_time, "%H")\n| filldown\n| streamstats window=6 current=f\nfirst("now_avg_hs") as last30m_avg_hs,\nfirst("now_min_hs") as last30m_min_hs,\nfirst("now_avg_hsl") as last30m_avg_hsl,\nfirst("now_min_hsl") as last30m_min_hsl\n| reverse\n| streamstats window=6 current=f\nfirst("now_avg_hs") as next30m_avg_hs,\nfirst("now_min_hs") as next30m_min_hs,\nfirst("now_avg_hsl") as next30m_avg_hsl,\nfirst("now_max_hsl") as next30m_max_hsl\n| where _time < now() - 300\n| fit StandardScaler "value_*" with_mean=true with_std=true into '+R+'_ss\n| sample seed=1001 partitions=100 fieldname="pn"\n| search pn<'+S+"\n"+P},getMLTKModelLookFileNames:function getMLTKModelLookFileNames(s,o,_){var S="__mlspl_"+this.getAlgorithmModelName(s,o);return{avg:S+"_avg"+_,worst:S+"_worst"+_,ss:S+"_ss"+_}},getAlgorithmModelName:function getAlgorithmModelName(s,o){return void 0!==this.currentModelName&&""!==this.currentModelName||(this.currentModelName="itsi_predict_"+s.replace(/-/g,"_")+"_"+o+"_"+(0,te.generateUUID)()+"_"+(new Date).getTime()),this.currentModelName},resetModelName:function resetModelName(){this.currentModelName=""},getHealthScoreSearch:function getHealthScoreSearch(s){return"`health_score_histogram("+s+")`"},getKpiOverTimeSearch:function getKpiOverTimeSearch(s){return"`kpi_values_over_time("+s+")`"},getModelSearch:function getModelSearch(s){return"| `listmodels_by_type("+("itsi_predict_"+s.toLowerCase().split("-").join("_"))+")`"},getPredictHealthScoreSearch:function getPredictHealthScoreSearch(s,o,_){var S=getAlgorithmTypeFromModelId(o),R=_?"itsi_predict_one_number":"itsi_predict";return S.type===ge.REGRESSION?"`"+R+"("+s+",health_score,app:"+o+")`":S.type===ge.CLASSIFICATION?"`"+R+"("+s+",health_score_level,app:"+o+")`":""},getComparisonSearch:function getComparisonSearch(s,o,_){return"`predict_actual_vs_predicted("+s+", app:"+o+", "+_+")`"},getResidualSearch:function getResidualSearch(s,o,_){return"`predict_residual_error("+s+", app:"+o+", "+_+")`"},getWorstHealthScoreSearch:function getWorstHealthScoreSearch(s,o){return"`only_health_score_prediction_output("+s+", app:"+o+")`"},getWorstHealthSeveritySearch:function getWorstHealthSeveritySearch(s,o){return"`only_health_score_level_prediction_output("+s+", app:"+o+")`"},getConfusionMatrixSearch:function getConfusionMatrixSearch(s,o){return"`apply_model("+s+", app:"+o+')` | rename "next30m_avg_hsl" as actual_hsl, "predicted(next30m_avg_hsl)" as predict_hsl, next30m_worst_hsl as actual_mhsl "predicted(next30m_worst_hsl)" as predict_mhsl| fields actual_hsl, predict_hsl, actual_mhsl, predict_mhsl| appendpipe [fields actual_mhsl, predict_mhsl | rename actual_mhsl as actual_hsl, predict_mhsl as predict_hsl]| search actual_hsl!="" AND predict_hsl!="" | `itsi_confusionmatrix(actual_hsl,predict_hsl)`'},getKpiForecastsSearch:function getKpiForecastsSearch(s,o){return""===o&&(o=s.toLowerCase().split("-").join("_")),"`root_cause_analysis("+s+","+o+","+Ce+")`"},getKpiForecastsR2Search:function getKpiForecastsR2Search(s){return"| `r2_for_kpi_trends("+s+")`"},getKpiModelsCountsSearch:function getKpiModelsCountsSearch(s){var o=s.toLowerCase().split("-").join("_");return"| `itsi_check_model_count("+s+","+o+")`"},getTrainKpiTrendsSearchData:function getTrainKpiTrendsSearchData(s){var o=s.toLowerCase().split("-").join("_")+"_"+(0,te.generateUUID)()+"_"+(new Date).getTime(),_={};return _.search="`train_kpi_trends("+s+","+o+")`",_.suffix=o,_}};o.SEARCH_PROGRESS_ELEMENTS={getSearchInfoElement:function getSearchInfoElement(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,Z.gettext)("Select a time range");return N.default.createElement(se,{"data-test-itsi":"pa-search-info-message",type:"info"},s)},getSearchInProgressElement:function getSearchInProgressElement(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,Z.gettext)("Waiting for results..."),o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:de,_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ce;return N.default.createElement("div",{style:o},N.default.createElement(le,{"data-test-itsi":"pa-utils-wait-spinner"}),N.default.createElement("div",{style:_},s))},getNoResultsElement:function getNoResultsElement(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,Z.gettext)("No results found."),o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:he,_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ue;return N.default.createElement("div",{style:o},N.default.createElement(Y.default,{"data-test-itsi":"pa-no-results-warning-message",type:"warning",style:_},s))},getErrorMessageElement:function getErrorMessageElement(s){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pe,_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fe;return s||(s=(0,Z.gettext)("An error occurred during the execution of the search.")),N.default.createElement("div",{style:o},N.default.createElement(Y.default,{"data-test-itsi":"pa-error-message",type:"error",style:_},s))},getCancelledMessageElement:function getCancelledMessageElement(s){return s||(s=(0,Z.gettext)("The search was cancelled.")),N.default.createElement(Y.default,{"data-test-itsi":"pa-search-cancelled-message",type:"info"},s)}};function getAlgorithmTypeFromModelId(s){var o=_e.filter(o=>s.includes(o.value));return 1===o.length?o[0]:{}}},501:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.getThresholdType=o.getKpiRecommendationErrorMessage=o.getKpiConfigurationTabs=o.getEntityThresholdingObject=o.getEntityThresholdObject=o.getEntityRecommendationErrorMessage=o.formatEntityData=o.filterEntities=void 0;var R=S(_(8)),O=S(_(81)),P=S(_(99)),D=S(_(38)),N=_(4),V=_(87),j=_(102),K=_(110),W=_(617);function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,R.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}o.getThresholdType=s=>s.isTimeVariateThresholds?s.isAdaptiveThresholdsEnabled?j.THRESHOLD_TYPE_OPTIONS[2].value:j.THRESHOLD_TYPE_OPTIONS[1].value:j.THRESHOLD_TYPE_OPTIONS[0].value;o.getEntityThresholdingObject=(s,o)=>{var _={};return Object.keys(s.timeVariateThresholdsSpecification.policies).forEach(o=>{_[o]=(0,D.default)(s.timeVariateThresholdsSpecification.policies[o],"aggregate_thresholds"),_[o].policy_type="static"}),{entity_key:o.key,entity_title:o.title,kpi_id:s._key,entity_thresholds:s.entityThresholdsConfig,adaptive_thresholds_is_enabled:!1,adaptive_thresholding_training_window:s.adaptiveTrainingWindow,time_variate_thresholds:s.isTimeVariateThresholds,time_variate_thresholds_specification:{policies:_},object_type:"kpi_entity_threshold",is_recommended_time_policies:!1,was_recommendation_modified:!1,did_load_recommendation:!1}};o.getKpiRecommendationErrorMessage=s=>{var o,_;switch(s){case j.KPI_NO_RECOMMENDATIONS.CONSTANT_KPI.type:o=j.KPI_NO_RECOMMENDATIONS.CONSTANT_KPI.message,_=j.KPI_NO_RECOMMENDATIONS.CONSTANT_KPI.label;break;case j.KPI_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.type:o=j.KPI_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.message,_=j.KPI_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.label;break;case j.KPI_NO_RECOMMENDATIONS.PATTERN_SWITCH.type:o=j.KPI_NO_RECOMMENDATIONS.PATTERN_SWITCH.message,_=j.KPI_NO_RECOMMENDATIONS.PATTERN_SWITCH.label;break;default:o=s,_=""}return[_,o]};o.getEntityRecommendationErrorMessage=s=>{var o,_;switch(s){case j.ENTITY_NO_RECOMMENDATIONS.CONSTANT_KPI.type:o=j.ENTITY_NO_RECOMMENDATIONS.CONSTANT_KPI.message,_=j.ENTITY_NO_RECOMMENDATIONS.CONSTANT_KPI.label;break;case j.ENTITY_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.type:o=j.ENTITY_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.message,_=j.ENTITY_NO_RECOMMENDATIONS.INSUFFICIENT_DATA.label;break;case j.ENTITY_NO_RECOMMENDATIONS.PATTERN_SWITCH.type:o=j.ENTITY_NO_RECOMMENDATIONS.PATTERN_SWITCH.message,_=j.ENTITY_NO_RECOMMENDATIONS.PATTERN_SWITCH.label;break;default:o=s,_=""}return[_,o]};o.formatEntityData=s=>{var{_key:o,entity_key:_,entity_title:S,kpi_id:R,entity_thresholds:D,time_variate_thresholds:N,time_variate_thresholds_specification:V,adaptive_thresholds_is_enabled:j,adaptive_thresholding_training_window:K,is_recommended_time_policies:W,threshold_recommendation_summary:U,recommendation_in_progress:Y,recommendation_error_type:$,was_recommendation_modified:X}=s;return{_key:o,adaptiveTrainingWindow:K,name:S,entityKey:_,kpiId:R,entityThresholdsConfig:_objectSpread({},D),isAdaptiveThresholdsEnabled:j,isTimeVariateThresholds:N,timeVariateThresholdsSpecification:(0,O.default)(V),isRecommendedTimePoliciesEnabled:W||!1,atRecommendationInfo:U,isRecommendationInProgress:!(0,P.default)(Y)&&Y,recommendationError:$||"",isRecommendationModified:X||!1}};o.getEntityThresholdObject=function getEntityThresholdObject(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],_={_key:(0,W.md5KeyGenerator)([s.entity_title,s.itsi_kpi_id]),entity_title:s.entity_title,entity_key:s.entity_key,kpi_id:s.itsi_kpi_id,service_id:s.itsi_service_id,entity_thresholds:{},adaptive_thresholds_is_enabled:!1,time_variate_thresholds:!1,time_variate_thresholds_specification:{policies:{[K.DEFAULT_POLICY_KEY]:K.DEFAULT_POLICY}},is_recommended_time_policies:!1,recommendation_in_progress:o,recommendation_error_type:""};return _};o.getKpiConfigurationTabs=(s,o,_)=>[{label:(0,N.gettext)("Search and calculate"),value:"search_calculate"},{label:(0,N.gettext)("KPI thresholds"),value:"kpi_thresholds"},..._?[{label:(0,N.gettext)("Entity thresholds"),value:"entity_thresholds"}]:[],...o?[{label:(0,N.gettext)("Anomaly detection"),value:"anomaly_detection"}]:[],...s?[{label:(0,N.gettext)("Drift detection"),value:"drift_detection"}]:[]];o.filterEntities=function filterEntities(s,o,_){var S=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!o.trim().length&&!_.length)return s;var R=s;if(o.trim().length){var O=new RegExp((0,V.regexEscapedObjectName)(o.toLowerCase().trim()),"ig");R=R.filter(s=>-1!==s.entity_title.search(O))}return _.length&&_.length<j.ENTITY_FILTER_OPTIONS.length&&(S||-1!==_.findIndex(s=>j.ENTITY_FILTER_OPTIONS[2].value===s.value)?S&&(R=R.filter(s=>!(!_.some(o=>o.value===s.threshold_type)&&(!_.some(s=>s.value===j.ENTITY_FILTER_OPTIONS[1].value)||s.threshold_type!==j.ENTITY_FILTER_OPTIONS[2].value&&s.threshold_type!==j.ENTITY_FILTER_OPTIONS[3].value)))):R=[]),R}},598:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D=S(_(16)),N=S(_(17)),V=S(_(21)),j=S(_(19)),K=S(_(20)),W=S(_(8)),U=S(_(7)),Y=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),$=S(_(3)),X=S(_(2)),Z=S(_(27)),Q=S(_(34)),ee=S(_(24)),te=S(_(100)),ie=_(14),ae=_(4),ne=_(96);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,j.default)(o),(0,V.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,j.default)(s).constructor):o.apply(s,_))}_(28);var re=(0,X.default)(te.default)(R||(R=(0,U.default)(["\n width: 600px;\n"]))),se=(0,X.default)(ee.default)(O||(O=(0,U.default)(["\n\tpadding-bottom: 0;\n"]))),le=X.default.div(P||(P=(0,U.default)(["\n\tpadding-top: 10px;\n"]))),oe=function(s){function ServiceUnlinkWarningModal(s){var o;(0,D.default)(this,ServiceUnlinkWarningModal);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,ServiceUnlinkWarningModal,[s,...S]),(0,W.default)(o,"handleRequestClose",()=>{var{handleDeclineToUnlink:s}=o.props;s&&s(),o.setState({isModalOpen:!1})}),(0,W.default)(o,"handleUnlinkConfirm",()=>{o.props.handleAcceptToUnlink(),o.setState({isModalOpen:!1})}),o.state={isModalOpen:o.props.isModalOpen},o}return(0,K.default)(ServiceUnlinkWarningModal,s),(0,N.default)(ServiceUnlinkWarningModal,[{key:"render",value:function render(){var s=(0,ie.sprintf)((0,ae.gettext)("Unlink Service - %s"),this.props.modalTitleSubstring);return Y.default.createElement("div",(0,ne.createITSITestHook)(this.constructor.name),Y.default.createElement(re,{"data-test-itsi":"service-unlink-warning-modal",onRequestClose:this.handleRequestClose,open:this.state.isModalOpen},Y.default.createElement(te.default.Header,{title:s,onRequestClose:this.handleRequestClose}),Y.default.createElement(te.default.Body,null,Y.default.createElement(se,{"data-test-itsi":"unlink-service-warning-message",type:"warning"},Y.default.createElement("div",null,(0,ie.sprintf)((0,ae.gettext)("The following action will unlink %s service from its template"),this.props.serviceTitle)," (",Y.default.createElement(Q.default,{"data-test-itsi":"unlink-service-template-link",to:this.props.serviceTemplateUrl,openInNewContext:!0},this.props.serviceTemplateTitle)," ) ",(0,ae.gettext)("upon saving the service."))),Y.default.createElement(le,null,(0,ae.gettext)("Are you sure you want to proceed?"))),Y.default.createElement(te.default.Footer,null,Y.default.createElement(Z.default,{"data-test-itsi":"service-unlink-modal-no-button",onClick:this.handleRequestClose,label:(0,ae.gettext)("No")}),Y.default.createElement(Z.default,{appearance:"primary","data-test-itsi":"service-unlink-modal-yes-button",onClick:this.handleUnlinkConfirm,label:(0,ae.gettext)("Yes")}))))}}])}(Y.Component);(0,W.default)(oe,"propTypes",{handleAcceptToUnlink:$.default.func.isRequired,handleDeclineToUnlink:$.default.func,isModalOpen:$.default.bool,modalTitleSubstring:$.default.string.isRequired,serviceTitle:$.default.string.isRequired,serviceTemplateTitle:$.default.string.isRequired,serviceTemplateUrl:$.default.string.isRequired}),(0,W.default)(oe,"defaultProps",{isModalOpen:!1,handleDeclineToUnlink:null});o.default=oe;s.exports=o.default},704:function(s,o,_){(()=>{"use strict";var o={n:s=>{var _=s&&s.__esModule?()=>s.default:()=>s;return o.d(_,{a:_}),_},d:(s,_)=>{for(var S in _)o.o(_,S)&&!o.o(s,S)&&Object.defineProperty(s,S,{enumerable:!0,get:_[S]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},S={};o.r(S),o.d(S,{default:()=>W});const R=_(0);var O=o.n(R);const P=_(104);var D=o.n(P);const N=_(106);function i(s,o){if(null==s)return{};var _,S,R=function l(s,o){if(null==s)return{};var _,S,R={},O=Object.keys(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||(R[_]=s[_]);return R}(s,o);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(s);for(S=0;S<O.length;S++)_=O[S],o.indexOf(_)>=0||Object.prototype.propertyIsEnumerable.call(s,_)&&(R[_]=s[_])}return R}var V=new Map;V.set("outlined",(function(){return O().createElement(O().Fragment,null,O().createElement("path",{d:"M12.3367 6.5511C11.9462 6.16058 11.9462 5.52741 12.3367 5.13689C12.7272 4.74636 13.3604 4.74636 13.7509 5.13689L19.5533 10.9393C20.1391 11.5251 20.1391 12.4748 19.5533 13.0606L13.7509 18.8631C13.3604 19.2536 12.7272 19.2536 12.3367 18.8631C11.9462 18.4725 11.9462 17.8394 12.3367 17.4489L16.8211 12.9645H5.00134C4.44906 12.9645 4.00134 12.5168 4.00134 11.9645C4.00134 11.4122 4.44906 10.9645 5.00134 10.9645H16.7501L12.3367 6.5511Z"}))}));var j=["default","outlined"],K=function e(s){return"default"===s||s&&!function e(s){return j.indexOf(s)>=0}(s)?"outlined":s};const W=function e(s){var o=s.children,_=s.variant,S=void 0===_?"default":_,P=i(s,["children","variant"]),j=K(S),W="arrowright-".concat(j),U=(0,R.useContext)(N.IconContext),Y=V.get(j);if(U&&Y){var $=U.toRender;if((0,U.addIcon)(W,Y()),!$)return null}return O().createElement(D(),P,o,U?O().createElement("use",{href:"#".concat(W)}):!!Y&&Y())};s.exports=S})()},705:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z=S(_(7)),Q=_interopRequireWildcard(_(0)),ee=_interopRequireWildcard(_(2)),te=S(_(3)),ie=S(_(39)),ae=S(_(27)),ne=S(_(1137)),re=S(_(44)),se=S(_(64)),le=S(_(51)),oe=S(_(576)),de=S(_(66)),ce=S(_(103)),he=S(_(121)),ue=_(4),pe=_(61),fe=_(67),ge=_(102);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}var me=(0,ee.default)(re.default)(R||(R=(0,Z.default)(["\n div {\n ","\n }\n\n div[data-test='controls'] {\n gap: 7px;\n align-items: center;\n }\n"])),s=>s.$showInModelStyle&&(0,ee.css)(O||(O=(0,Z.default)(["\n justify-content: flex-start;\n "])))),ve=(0,ee.default)(de.default)(P||(P=(0,Z.default)(["\n width: 200px !important;\n"]))),ye=ee.default.div(D||(D=(0,Z.default)(["\n display: flex;\n"]))),_e=(0,ee.default)(re.default)(N||(N=(0,Z.default)(["\n div {\n ","\n }\n"])),s=>s.$showInModelStyle&&(0,ee.css)(V||(V=(0,Z.default)(["\n justify-content: flex-start;\n "])))),Se=(0,ee.default)(se.default)(j||(j=(0,Z.default)(["\n margin-top: 20px;\n margin-bottom: 5px;\n"]))),be=(0,ee.default)(le.default)(K||(K=(0,Z.default)(["\n margin-bottom: 0px;\n"]))),Ee=(0,ee.default)(se.default)(W||(W=(0,Z.default)(["\n margin-top: 20px;\n"]))),Te=ee.default.div(U||(U=(0,Z.default)(["\n display: ",";\n ","\n"])),s=>s.$showInModelStyle?"block":"flex",s=>!s.$showInModelStyle&&(0,ee.css)(Y||(Y=(0,Z.default)(["\n flex-wrap: wrap;\n gap: 20px;\n "])))),Ce=(0,ee.default)(ne.default)($||($=(0,Z.default)(["\n margin-top: 5px;\n"]))),ke=ee.default.div(X||(X=(0,Z.default)(["\n margin-bottom: 10px;\n"])));function RecommendationControl(s){var{onRecommendationControlsChange:o,recommendationSettingsObject:_,isKpiRecommendation:S,isServiceTemplateView:R,handleFooterErrorMessage:O,showInModelStyle:P}=s,[D,N]=(0,Q.useState)(_.analysisWindowValue),[V,j]=(0,Q.useState)(_.analysisWindowStartDate),[K,W]=(0,Q.useState)(_.thresholdConfigValue),[U,Y]=(0,Q.useState)(!0),[$,X]=(0,Q.useState)(_.recommendationApplyAsValue),[Z,ee]=(0,Q.useState)(_.allowNegativeValue),[te,ie]=(0,Q.useState)(_.thresholdSensitivity),[re,se]=(0,Q.useState)(_.onboardNewEntities),[le,xe]=(0,Q.useState)(_.configureAllSomeEntities),we=(0,Q.useCallback)((s,_)=>{var{value:S}=_;W(S),o("thresholdConfigValue",S)},[o]),Re=(0,Q.useCallback)((s,_)=>{var{value:S}=_,R=(0,he.default)().subtract(S.match(/\d+/g)[0],"days").unix(),O=S.match(/\d+/g)[0],P=(0,he.default)().subtract(O,"day"),D=he.default.unix(R).isBefore(P);Y(D),N(S),j(R),o("analysisWindowValue",S),o("analysisWindowStartDate",R,D)},[o]),Ie=(0,Q.useCallback)((s,_)=>{var{value:S}=_,R=(0,he.default)(S).unix(),P=D.match(/\d+/g)[0],N=(0,he.default)().subtract(P,"day");j(R);var V=he.default.unix(R).isBefore(N);o("analysisWindowStartDate",R,V),Y(V),O(V?"":ge.INVALID_ANALYSIS_WINDOW_START_DATE_MESSAGE)},[D,O,o]),Me=(0,Q.useCallback)((s,_)=>{var{value:S}=_;X(S),o("recommendationApplyAsValue",S)},[o]),Oe=(0,Q.useCallback)(()=>{o("allowNegativeValue",!Z),ee(s=>!s)},[Z,o]),Ae=(0,Q.useCallback)((s,_)=>{var{value:S}=_;ie(S),o("thresholdSensitivity",S)},[o]),Pe=(0,Q.useCallback)(()=>{se(!re),o("onboardNewEntities",!re)},[o,re]),De=(0,Q.useCallback)((s,_)=>{var{value:S}=_;xe(S),o("configureAllSomeEntities",S)},[o]),Le=he.default.unix(V).format(fe.MOMENT_FORMAT).toString(),Ne=S?ge.THRESHOLD_CONFIGURATION_OPTIONS:ge.ENTITY_THRESHOLD_CONFIGURATION_OPTIONS;return Q.default.createElement(Q.default.Fragment,null,Q.default.createElement(Se,{"data-test-itsi":"threshold-recommendation-control-heading",level:4},(0,ue.gettext)("Threshold recommendation settings")),Q.default.createElement(Te,{$showInModelStyle:P},Q.default.createElement(ye,null,Q.default.createElement(me,{"data-test-itsi":"threshold-recommendation-analysis-window",label:(0,ue.gettext)("Analysis window"),labelFor:"threshold-recommendation-start-date",labelPosition:P?"left":"top",labelWidth:P?pe.LABEL_WIDTHS.LongPlus:pe.LABEL_WIDTHS.Default,$showInModelStyle:P,tooltip:S?ge.RECOMMENDATION_THRESHOLD_ANALYSIS_WINDOW_TOOLTIP:ge.ENTITY_RECOMMENDATION_THRESHOLD_ANALYSIS_WINDOW_TOOLTIP,error:!U&&(0,ue.gettext)("Analysis window can't exceed today's date")},Q.default.createElement(de.default,{error:!U,"data-test-itsi":"threshold-recommendation-analysis-window-select",value:D,onChange:Re},S?ge.ANALYSIS_WINDOW_OPTIONS.map(s=>Q.default.createElement(de.default.Option,{"data-test-itsi":"threshold-recommendation-analysis-window-select-option",description:s.description,label:s.label,value:s.value,key:s.value})):ge.ENTITY_ANALYSIS_WINDOW_OPTIONS.map(s=>Q.default.createElement(de.default.Option,{"data-test-itsi":"threshold-recommendation-analysis-window-select-option",description:s.description,label:s.label,value:s.value,key:s.value}))),Q.default.createElement(be,null,(0,ue.gettext)("starting on")),Q.default.createElement(oe.default,{inputId:"threshold-recommendation-start-date","data-test-itsi":"threshold-recommendation-start-date",value:Le,onChange:Ie,error:!U}))),Q.default.createElement(_e,{controlsLayout:P?"none":"fill","data-test-itsi":"threshold-recommendation-direction",label:(0,ue.gettext)("Thresholding direction"),labelPosition:P?"left":"top",labelWidth:P?pe.LABEL_WIDTHS.LongPlus:pe.LABEL_WIDTHS.Default,$showInModelStyle:P,tooltip:S?ge.RECOMMENDATION_THRESHOLD_DIRECTION_TOOLTIP:ge.ENTITY_RECOMMENDATION_THRESHOLD_DIRECTION_TOOLTIP},Q.default.createElement(ve,{"data-test-itsi":"threshold-recommendation-direction-select",value:K,onChange:we,inline:!0},Ne.map(s=>Q.default.createElement(de.default.Option,{"data-test-itsi":"threshold-recommendation-direction-select-option",description:s.description,label:s.label,value:s.value,key:s.value})))),Q.default.createElement(_e,{controlsLayout:P?"none":"fill","data-test-itsi":"threshold-recommendation-apply-as-control",label:(0,ue.gettext)("Apply as"),labelPosition:P?"left":"top",labelWidth:P?pe.LABEL_WIDTHS.LongPlus:pe.LABEL_WIDTHS.Default,$showInModelStyle:P,tooltip:ge.RECOMMENDATION_THRESHOLD_APPLY_AS_TOOLTIP},Q.default.createElement(ve,{"data-test-itsi":"threshold-recommendation-apply-as-select",onChange:Me,value:$,inline:!0},ge.RECOMMENDATION_APPLY_AS_OPTIONS.map(s=>Q.default.createElement(de.default.Option,{"data-test-itsi":"threshold-recommendation-apply-as-select-option",description:s.description,label:s.label,value:s.value,key:s.value})))),Q.default.createElement(_e,{controlsLayout:P?"none":"fill","data-test-itsi":"threshold-recommendation-allow-kpi-negative-value-control-group",label:(0,ue.gettext)("Positive thresholds only"),labelPosition:P?"left":"top",labelWidth:P?pe.LABEL_WIDTHS.LongPlus:pe.LABEL_WIDTHS.Default,$showInModelStyle:P,tooltip:ge.RECOMMENDATION_THRESHOLD_ALLOW_NEGATIVE_VALUE_TOOLTIP},Q.default.createElement(ce.default,{appearance:"toggle","data-test-itsi":"threshold-recommendation-allow-kpi-negative-value-checkbox",onClick:Oe,selected:!Z},Z?(0,ue.gettext)("Off"):(0,ue.gettext)("On"))),Q.default.createElement(_e,{controlsLayout:P?"none":"fill","data-test-itsi":"threshold-recommendation-threshold-sensitivity-control-group",label:(0,ue.gettext)("Threshold sensitivity"),labelPosition:P?"left":"top",labelWidth:P?pe.LABEL_WIDTHS.LongPlus:pe.LABEL_WIDTHS.Default,$showInModelStyle:P,tooltip:ge.RECOMMENDATION_THRESHOLD_SENSITIVITY_TOOLTIP},Q.default.createElement(ne.default,{"data-test-itsi":"threshold-recommendation-threshold-sensitivity-button-group"},ge.RECOMMENDATION_THRESHOLD_SENSITIVITY_OPTIONS.map(s=>Q.default.createElement(ae.default,{"data-test-itsi":"threshold-recommendation-threshold-sensitivity-button-".concat(s.label.toLowerCase()),label:s.label,value:s.value,key:s.value,onClick:Ae,selected:s.value===te}))))),!S&&Q.default.createElement(ke,null,Q.default.createElement(Ee,{"data-test-itsi":"recommendation-set-automation-heading",level:4},(0,ue.gettext)("Automation")),Q.default.createElement(_e,{"data-test-itsi":"onboard-new-entities-control",label:(0,ue.gettext)("Onboard new entities"),labelPosition:P?"left":"top",labelWidth:P?pe.LABEL_WIDTHS.LongPlus:pe.LABEL_WIDTHS.Default,$showInModelStyle:P,tooltip:ge.ONBOARD_NEW_ENTITIES_TOOLTIP,help:re?(0,ue.gettext)("Set up time policies for new entities added to service after data is available."):""},Q.default.createElement(ce.default,{"data-test-itsi":"onboard-new-entities-switch",selected:re,appearance:"toggle",onClick:Pe,disabled:R},re?(0,ue.gettext)("On"):(0,ue.gettext)("Off"))),P&&Q.default.createElement(Ee,{"data-test-itsi":"recommendation-select-num-entities-heading",level:4},(0,ue.gettext)("Recommend thresholds for")),P&&Q.default.createElement(Ce,{"data-test-itsi":"threshold-recommendation-threshold-sensitivity-button-group"},Q.default.createElement(ae.default,{"data-test-itsi":"threshold-recommendation-configure-all-entities-option",label:(0,ue.gettext)("All entities"),value:"all",key:"threshold-recommendation-configure-all-entities-option",onClick:De,selected:"all"===le}),Q.default.createElement(ae.default,{"data-test-itsi":"threshold-recommendation-configure-custom-entities-option",label:(0,ue.gettext)("Custom selection"),value:"custom",key:"threshold-recommendation-configure-custom-entities-option",onClick:De,selected:"custom"===le}))))}RecommendationControl.propTypes={isKpiRecommendation:te.default.bool,showInModelStyle:te.default.bool,isServiceTemplateView:te.default.bool,onRecommendationControlsChange:te.default.func.isRequired,recommendationSettingsObject:te.default.object.isRequired,handleFooterErrorMessage:te.default.func},RecommendationControl.defaultProps={isKpiRecommendation:!1,showInModelStyle:!0,isServiceTemplateView:!1,handleFooterErrorMessage:ie.default};o.default=RecommendationControl;s.exports=o.default},706:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(7)),P=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),D=S(_(3)),N=S(_(2)),V=S(_(81)),j=S(_(94)),K=S(_(217)),W=S(_(118)),U=S(_(50)),Y=S(_(121)),$=_(87),X=_(67),Z=_(102),Q=S(_(2552)),ee=S(_(2553)),te=_(868);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var ie=N.default.div(R||(R=(0,O.default)(["\n margin-top: 10px;\n display: flex;\n"])));function ThresholdingPreviewVizContainer(s){var{isEntityLevelPreview:o,entityData:_,getTimeInIso:S,thresholdData:R,isDefaultEntityThresholdView:O,useRawSearch:D,useKpiThresholdsForEntities:N,svgWidth:te,showBorder:ae,showTitle:ne,isReadOnly:re,isRecommendationView:se,isServiceTemplate:le}=s,[oe,de]=(0,P.useState)((0,X.getDaysAgoFromStartOfDay)(7)),ce=Y.default.newSplunkTime().subtract(1,"day").endOf("day").unix(),[he,ue]=(0,P.useState)(7),[pe,fe]=(0,P.useState)([]),[ge,me]=(0,P.useState)({min:null,max:null}),[ve,ye]=(0,P.useState)({min:null,max:null}),[_e,Se]=(0,P.useState)(D),be=Z.TIME_RANGE_WINDOW_SPANS[he],Ee=oe;if(R.isAdaptiveThresholdsEnabled&&R.isOutlierDetectionEnabled){var Te=Z.ANALYSIS_WINDOW_OPTIONS.filter(s=>s.value===R.adaptiveTrainingWindow)[0];Ee=(0,X.getDaysAgoFromStartOfDay)(Number(Te.days))}var Ce=(0,P.useCallback)(s=>{ue(s),de((0,X.getDaysAgoFromStartOfDay)(s))},[]),ke=(0,P.useCallback)(s=>{fe((0,K.default)((0,U.default)(s,s=>Z.TRENDLINE_VALUES_MAP[s])))},[]),xe=(0,j.default)(s=>{var o=(0,V.default)(ge);o.max=(0,W.default)(s)?s:null,me(o)},$.DEFAULT_DEBOUNCE_DELAY),we=(0,j.default)(s=>{var o=(0,V.default)(ge);o.min=(0,W.default)(s)?s:null,me(o)},$.DEFAULT_DEBOUNCE_DELAY),Re=(0,P.useCallback)(s=>{D||Se(s)},[D]),Ie=(0,P.useCallback)(s=>{s.min===ve.min&&s.max===ve.max||ye(s)},[ve.max,ve.min]);return P.default.createElement(P.default.Fragment,null,P.default.createElement(Q.default,{isAggregateConfigView:!o,handleTimeWindowChange:Ce,handleTrendlineChange:ke,disableTrendlineControls:_e,handleYMaxChange:xe,handleYMinChange:we,defaultYAxisRange:ve,isEntityThreshold:o,isDefaultEntityThresholdView:O,selectedEntityTitle:null==_?void 0:_.entity_title,showBorder:ae,showTitle:ne,isRecommendationView:se}),P.default.createElement(ie,null,P.default.createElement(ee.default,{displayLegend:!1,displayTooltipFooter:!1,entityData:_,graphsEarliestTime:oe,graphsLatestTime:ce,getTimeInIso:S,handleZoomLevel:Re,handleDefaultYAxisRangeChange:Ie,isAdaptiveThresholdsEnabled:(null==R?void 0:R.isAdaptiveThresholdsEnabled)||!1,outlierDetectionEnabled:R.isOutlierDetectionEnabled,outlierDetectionAlgo:R.outlierDetectionAlgorithm,outlierDetectionSensitivity:R.outlierDetectionSensitivity,outlierGraphEarliestTime:Ee,outlierGraphLatestTime:ce,isDefaultEntityThresholdView:O,isEntityLevelPreview:o,thresholdObj:R,maxTicks:7,numDays:he,searchSpan:be,selectedTrendlines:pe,shouldPreviewUpdate:!1,showYAxisTicks:!1,useRawSearch:D,useKpiThresholdsForEntities:N,windowConfigPercentage:10,yAxisRange:ge,svgWidth:te,isReadOnly:re,isRecommendationView:se,isServiceTemplate:le})))}ThresholdingPreviewVizContainer.propTypes={isEntityLevelPreview:D.default.bool.isRequired,entityData:D.default.object,getTimeInIso:D.default.bool.isRequired,thresholdData:D.default.object.isRequired,isDefaultEntityThresholdView:D.default.bool,useRawSearch:D.default.bool.isRequired,svgWidth:D.default.number,showBorder:D.default.bool,showTitle:D.default.bool,useKpiThresholdsForEntities:D.default.bool,isReadOnly:D.default.bool,isRecommendationView:D.default.bool,isServiceTemplate:D.default.bool},ThresholdingPreviewVizContainer.defaultProps={isDefaultEntityThresholdView:!1,entityData:{},svgWidth:te.SVG_DIMENSIONS.WIDTH,showBorder:!0,showTitle:!0,useKpiThresholdsForEntities:!1,isReadOnly:!1,isRecommendationView:!1,isServiceTemplate:!1};o.default=ThresholdingPreviewVizContainer;s.exports=o.default},7652:function(s,o,_){_.p=function getPath(){function getConfigValue(s,o){if(window.$C&&window.$C.hasOwnProperty(s))return window.$C[s];if(void 0!==o)return o;throw new Error("getConfigValue - "+s+" not set, no default provided")}return function make_url(){for(var s,o,_="",S=0,R=arguments.length;S<R;S++)(o=(s=arguments[S].toString()).length)>1&&"/"==s.charAt(o-1)&&(s=s.substring(0,o-1)),"/"!=s.charAt(0)?_+="/"+s:_+=s;if("/"!=_){var O=_.split("/"),P=O[1];if("static"==P||"modules"==P){var D=_.substring(P.length+2,_.length);_="/"+P,window.$C.BUILD_NUMBER&&(_+="/@"+window.$C.BUILD_NUMBER),window.$C.BUILD_PUSH_NUMBER&&(_+="."+window.$C.BUILD_PUSH_NUMBER),"app"==O[2]&&(_+=":"+getConfigValue("APP_BUILD",0)),_+="/"+D}}var N=getConfigValue("MRSPARKLE_ROOT_PATH","/"),V=getConfigValue("LOCALE","en-US"),j="/"+V+_;return""==N||"/"==N?j:N+j}("/static/app/itsi/build/pages")+"/"}();var S=_(1),R=S(_(70)),O=S(_(254)),P=S(_(50)),D=S(_(174)),N=S(_(32)),V=S(_(15)),j=S(_(0)),K=_(4),W=_(14),U=_(334),Y=_(265),$=_(264),X=_(73),Z=_(87),Q=_(67),ee=_(52),te=_(141),ie=_(292),ae=_(345),ne=_(57),re=_(109),se=_(142),le=_(274),oe=_(1760),de=_(293),ce=_(463),he=_(483),ue=S(_(288)),pe=S(_(690)),fe=S(_(2556)),ge=S(_(7653)),me=S(_(557)),ve=S(_(138)),ye=S(_(528)),_e=_(151);_(241);var Se=(0,R.default)({},V.default.Events);V.default.listenTo(Se,"rendered",(function implementPageContent(){(0,N.default)("#app-main-layout").html('<div class="service-definition-body"></div>');var s,o=function showError(s,o){new ve.default({dataTestItsi:"service-definition-error-modal",errorMessage:o,htmlResponse:(0,_e.extractErrorMsgFromResponse)(s)}).render()},_=null,S=null,R={},V={},j={},U=new fe.default,ye={},Se={},be=[],Ee={},Te=[],Ce=[],ke=function initRouter(o){new o({appsData:R,baseServiceTemplateModel:_,featureFlags:s,globalTeamData:V,permissions:ye,serviceBaseModel:S,teamsCollectionData:j,servicesCollectionData:be,serviceKpiBackfillMapping:Ee,severityLabels:Ce,tagsData:Te,thresholdTemplateCollection:U,userData:Se})},xe=null,we=(0,ee.getHash)();if(we){var Re=(we=we.slice(1)).split("/");if(Re.length>=2)xe=Re[0];else{var Ie=(0,ee.queryStringToProp)(we);xe=Ie.serviceId}}else{var Me=(0,ee.queryStringToProp)();xe=Me.serviceId}if(xe=(0,ee.sanitizeURLParam)(xe),(0,O.default)(xe))(0,he.retrieveIsUserCapable)(ne.OBJECT_TYPE,de.OPERATIONS.WRITE).then(s=>s.data).then(s=>{Object.prototype.hasOwnProperty.call(s,"is_capable")?o("",(0,K.gettext)("Could not fetch 'service' object. Verify that the URL is correct.")):o("",(0,K.gettext)("Could not fetch capabilities. 'is_capable' schema may have changed."))}).catch(s=>{o(s,(0,K.gettext)("Could not check if user has write capability for 'service' objects."))});else{S=new ue.default({_key:xe});var Oe=new Promise((_,S)=>{(0,te.retrieveFeatureFlags)().then(s=>(0,ie.formatResponse)(s.data)).then(o=>{s=o,_()}).catch(s=>{o(s,(0,K.gettext)("Could not retrieve feature flags.")),S()})}),Ae=new Promise((function(s,o){var _={count:-1,output_mode:"json",search:Y.PYTHON_SCIENTIFIC_APP_NAME_PREFIX};Y.PYTHON_SCIENTIFIC_APP_NAMES.forEach(s=>{R[s]={},R[s].isInstalled=!1,R[s].isDisabled=!1}),(0,$.retrieveApps)(_).then(s=>s.data).then(o=>{o&&o.entry&&o.entry.forEach(s=>{Y.PYTHON_SCIENTIFIC_APP_NAMES.includes(s.name)&&(0,X.versionCompare)(s.content.version,"3.0.0")>=0&&(R[s.name].isInstalled=!0,s.content&&s.content.disabled&&(R[s.name].isDisabled=!0))}),s()}).catch(()=>{o()})})),Pe=new Promise((s,o)=>{(0,oe.retrieveThresholdLabels)().then(s=>s.data).then(o=>{var _=o.entry.sort((s,o)=>s.content.threshold_level<o.content.threshold_level?-1:s.content.threshold_level>o.content.threshold_level?1:0);Ce=(0,P.default)(_,s=>({label:s.name,color:s.content.color,lightcolor:s.content.lightcolor})),s()}).catch(()=>{o()})}),De=new Promise((s,o)=>{(0,re.retrieveTags)({fields:"service_tags"}).then(s=>s.data).then(o=>{Te=o.entry||[],s()}).catch(()=>{o([])})}),Le=new Promise((s,o)=>{(0,le.retrieveTeams)({count:0,fields:"_key,title,identifying_name,permissions",offset:0,sort_dir:"asc",sort_key:"identifying_name"}).then(s=>s.data).then(o=>{j=o;var _=o.find(s=>s._key===se.GLOBAL_TEAM_KEY);ye.canWriteOnGlobalTeam=_.permissions.write,s()}).catch(()=>{ye.canWriteOnGlobalTeam=!1,o()})}),Ne=new Promise((s,o)=>{(0,ce.retrieveUser)().then(s=>s.data).then(o=>{Se.timezone=(0,Q.convertToTimezoneObject)(o&&o.entry&&o.entry[0]&&o.entry[0].content&&o.entry[0].content.tz),s()}).catch(()=>{o()})});Promise.all([S.fetch(),U.fetch({data:{fields:ae.DEFAULT_FIELDS_FOR_KPI_CONFIG}}),Oe,Ae,Le,Ne,De,Pe]).then(()=>{var s=(0,D.default)((S.get("services_depends_on")||[]).map(s=>s.serviceid)),R=[];if(s.length){var O=new Promise((_,S)=>{var R={count:0,fields:"_key,identifying_name,title,base_service_template_id,kpis.title,kpis._key,kpis.type,kpis.urgency,services_depending_on_me,services_depends_on",offset:0,sort_dir:"asc",sort_key:"identifying_name",filter:JSON.stringify((0,Z.createJSONFilterMultipleObjects)("$or","_key",s))};(0,re.retrieveServices)(R).then(s=>s.data).then(s=>{be=s,_()}).catch(s=>{be=[],o(s,(0,K.gettext)("Could not fetch the services collection.")),S()})});R.push(O)}var P=S.get("base_service_template_id");P?(_=new pe.default({_key:P}),R.push(_.fetch())):Ee=me.default.getKpiBackfillStatus(S),Promise.all(R).then(()=>{!function loadServiceDefinitionPage(s){ge.default.loadView(s,function(s){ke(s)}.bind(this))}(!S.canWrite())})}).catch(s=>{o(s,(0,W.sprintf)((0,K.gettext)("Could not find 'service' object with key: %s. Object may not exist or may have been deleted. Verify that the URL is correct."),xe))})}})),(0,U.createLayout)(j.default.createElement(ye.default,{pageEventDispatcher:Se}),{pageTitle:(0,ee.buildPageTitle)((0,K.gettext)("Service Definition"))})},7653:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(7654)),O={loadView:function loadView(s,o){if(!o)throw"ServiceDefinitionViewLoader expects a callback function";o(R.default)}};o.default=O;s.exports=o.default},7654:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(132)),O=S(_(37)),P=S(_(70)),D=S(_(32)),N=S(_(15)),V=_(4),j=_(52),K=_(57),W=_(109),U=S(_(288)),Y=S(_(2611)),$=S(_(7655)),X=S(_(7656)),Z=S(_(7657)),Q=S(_(4001)),ee=S(_(138)),te=Y.default.extend({ServiceView:Q.default,ServiceDefinitionConfigurationLayoutHeaderView:X.default,initialize:function initialize(s){s=s||{},this.featureFlags=s.featureFlags,this.appsData=s.appsData,this.baseServiceTemplateModel=s.baseServiceTemplateModel,this.permissions=s.permissions,this.globalTeamData=s.globalTeamData,this.teamsCollectionData=s.teamsCollectionData,this.servicesCollectionData=s.servicesCollectionData,this.severityLabels=s.severityLabels,this.tagsData=s.tagsData,this.thresholdTemplateCollection=s.thresholdTemplateCollection,this.serviceKpiBackfillMapping=s.serviceKpiBackfillMapping,this.userData=s.userData;var o=s&&s.serviceBaseModel&&s.serviceBaseModel.canWrite();o||(this.ServiceView=Z.default,s.configurationLayoutViewOptions={readOnly:!0,headerViewOptions:{isReadOnly:!0,clickToEdit:!1},dockedFooterViewOptions:{isReadOnly:!0,checkForFirstTimeSave:!1}}),this.sdDispatcher=(0,P.default)({},N.default.Events),this.listenTo(this.sdDispatcher,"unsetBaseServiceTemplateId",this._unsetBaseServiceTemplate),Y.default.prototype.initialize.apply(this,arguments),this.handleHash()},_unsetBaseServiceTemplate:function _unsetBaseServiceTemplate(s){s.get("base_service_template_id")&&(s.unset("base_service_template_id"),s.unset("last_synced_timestamp")),(0,O.default)(s.get("kpis").models,function(s){s.get("base_service_template_id")&&s.unset("base_service_template_id")}.bind(this))},handleHash:function handleHash(){var s,o,_,S=(0,j.getHash)(),R=[];if(S){if(1===(R=(S=S.slice(1)).split("/")).length){var O=(0,j.queryStringToProp)(S);R=[O.serviceId,O.tab],O.kpiId&&R.push(O.kpiId)}}else{var P=(0,j.queryStringToProp)();R.push(P.serviceId),R.push(P.tab),P.kpiId&&R.push(P.kpiId)}if(R.length>=2){switch(s=R[0],o=R[1]||K.SERVICE_DEFINITION_TABS.KPI,_=R[2],o){case K.SERVICE_DEFINITION_TABS.INFO:this.tabToShow=o;break;case K.SERVICE_DEFINITION_TABS.KPI:this.tabToShow=o,this.kpiToShow=_;break;case K.SERVICE_DEFINITION_TABS.DEPENDENCY:case K.SERVICE_DEFINITION_TABS.SETTINGS:case K.SERVICE_DEFINITION_TABS.PREDICTIVE_ANALYTICS:this.tabToShow=o;break;default:new ee.default({dataTestItsi:"service-definition-router-error-modal",errorMessage:(0,V.gettext)("Could not load the requested service.")}).render()}this.setServiceId(s)}},tabActivated:function tabActivated(s){var o=(0,j.createITSIURL)(W.uiURL);-1===o.indexOf("?")?o+="?":o+="&",o+=this.serviceDefinitionView.getUrl(s),this.navigate(o,{trigger:!1,replace:!0}),s===K.SERVICE_DEFINITION_TABS.PREDICTIVE_ANALYTICS&&this.layoutView.childViews.contentView.predictiveAnalyticsTab.contentView.callSearchRenderers()},setServiceId:function setServiceId(s){this.serviceId!==s&&(this.serviceId=s,this.serviceDefinitionView||("new"===this.serviceId?this._createAndRenderView(new U.default):this._createAndRenderView(this.cachedServiceBaseModel)))},_createAndRenderView:function _createAndRenderView(s){this.layoutView=new $.default((0,R.default)({headerControlsDataTestItsiPrefix:"service-definition-header",footerButtonsDataTestItsiPrefix:"service-definition-docked-footer",el:(0,D.default)(".service-definition-body"),model:s,ContentView:this.ServiceView,HeaderView:this.ServiceDefinitionConfigurationLayoutHeaderView,headerViewOptions:{serviceTemplate:this.baseServiceTemplateModel},dockedFooterViewOptions:{checkForFirstTimeSave:!0},contentViewOptions:{appsData:this.appsData,featureFlags:this.featureFlags,globalTeamData:this.globalTeamData,teamsCollectionData:this.teamsCollectionData,serviceTemplate:this.baseServiceTemplateModel,sdDispatcher:this.sdDispatcher,serviceKpiBackfillMapping:this.serviceKpiBackfillMapping||{},severityLabels:this.severityLabels,tabToShow:this.tabToShow,kpiToShow:this.kpiToShow,permissions:this.permissions,servicesCollectionData:this.servicesCollectionData,tagsData:this.tagsData,thresholdTemplateCollection:this.thresholdTemplateCollection,userData:this.userData}},this.configurationLayoutViewOptions)),this.serviceDefinitionView=this.layoutView.getContentView(),this.listenTo(this.serviceDefinitionView,"tabactivated",this.tabActivated),this.listenTo(this.serviceDefinitionView,"kpiselected",(function(){this.tabActivated(K.SERVICE_DEFINITION_TABS.KPI)})),this.layoutView.render()}});o.default=te;s.exports=o.default},7655:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(35)),P=S(_(0)),D=S(_(81)),N=S(_(33)),V=S(_(37)),j=S(_(150)),K=S(_(62)),W=_(4),U=_(14),Y=_(85),$=S(_(24)),X=S(_(91)),Z=S(_(121)),Q=S(_(162)),ee=_(73),te=_(29),ie=_(61),ae=_(78),ne=_(617),re=_(57),se=_(109),le=_(145),oe=_(501),de=_(151),ce=S(_(1202)),he=S(_(47)),ue=_(1190),pe=ce.default.extend({initialize:function initialize(s){if(!(s=s||{}).contentViewOptions)throw"Must provide contentViewOptions";this.serviceTemplate=s.contentViewOptions.serviceTemplate,this.sdDispatcher=s.contentViewOptions.sdDispatcher,this.serviceKpiBackfillMapping=s.contentViewOptions.serviceKpiBackfillMapping,this.kpiConfigsForAsyncSearch=[],this.sdDispatcher&&(this.listenTo(this.sdDispatcher,"unlink",this._removeServiceTemplate),this.listenTo(this.sdDispatcher,"modelTraining",this._handleModelTraining)),ce.default.prototype.initialize.apply(this,arguments)},_removeServiceTemplate:function _removeServiceTemplate(){this.$(".linked-service-template",this.$el).css({display:"none"})},_handleModelTraining:function _handleModelTraining(s){var o=!!this.modelClone.get("cloneChangedSinceLastSave");s&&this.childViews.dockedFooter.checkPrimaryButtonsEnabled()&&o&&this.childViews.dockedFooter.disable(),!1===s&&o&&this.childViews.dockedFooter.enable()},_getWarning:function _getWarning(s){var o=s.get("entity_rules"),_=!1;return o.forEach(s=>{s.get("rule_items").forEach(s=>{""===s.get("value")&&(_=!0)})}),_},_displayWarningModal:function _displayWarningModal(s,o){var _=(0,R.default)("<div></div>").css({display:"inline-block","vertical-align":"top"});O.default.unmountComponentAtNode(_.get(0)),O.default.render(P.default.createElement(he.default,null,P.default.createElement(Q.default,{title:(0,W.gettext)("Warning"),modalDataTestItsi:"entity-filter-warning-modal",cancelButtonDataTestItsi:"entity-filter-warning-modal-cancel-button",primaryButtonDataTestItsi:"entity-filter-warning-modal-confirm-button",primaryButtonLabel:(0,W.gettext)("Confirm"),open:!0,showCancel:!0,primaryButtonClicked:()=>{!s&&o?this._checkForFirstTimeSave():this._save()}},P.default.createElement($.default,{"data-test-itsi":"entity-filter-warning-modal-message",type:"warning"},(0,W.gettext)("One or more entity filter rules in the service has an empty value. Provide values in the entity filter rules with empty values to filter the specific set of entities."),P.default.createElement("br",null),P.default.createElement("br",null),(0,W.gettext)("Are you sure you want to continue?")))),_.get(0))},_sendModifiedRecommendationTelemetry:function _sendModifiedRecommendationTelemetry(){var s=(0,ue.getRecommendationModifications)(this.modelClone);0!==Object.keys(s).length&&(0,V.default)(Object.keys(s),o=>{var _=s[o].modifications,S=s[o].recommendationsInfo;JSON.stringify(_).length<9e3&&JSON.stringify(S).length<9e3&&((0,te.sendInteractionTelemetryData)("AssistedKpiThresholding","Recommendation Modifications",{modifications:_}),(0,te.sendInteractionTelemetryData)("AssistedKpiThresholding","Recommendation Info",{recommendationInfo:S}))})},_onSaveStart:function _onSaveStart(){this.childViews.dockedFooter.setErrorMessage();var s,o=this._getWarning(this.modelClone),_=this.model.validate(this.modelClone.attributes);if(_)return s=_ instanceof Array&&_.length?_.join("; "):_,void this.childViews.dockedFooter.setErrorMessage(s);o?this._displayWarningModal(this.modelClone.get("enabled"),this.dockedFooterViewOptions.checkForFirstTimeSave):!this.modelClone.get("enabled")&&this.dockedFooterViewOptions.checkForFirstTimeSave?this._checkForFirstTimeSave():(this._sendModifiedRecommendationTelemetry(),this._save())},_getKpiConfigForEntityThresholdGenerateSearch:function _getKpiConfigForEntityThresholdGenerateSearch(){var s=[];return(0,V.default)(this.modelClone.get("kpis").models,o=>{var _=o.get("_key");if(!(0,K.default)(_,re.HEALTH_SCORE_KPI_PREFIX)){var S=o.get("is_entity_recommendation_async_job_required")||!1,R=o.get("linked_entity_config")||[],O=o.get("linked_entities_data")||[],P=o.get("entity_threshold_configuration")||{};if(S){var V=[],j=[];(0,N.default)(O)||(O.forEach(s=>{var o=(0,N.default)(R)?{}:Object.values(R).filter(o=>s.entity_title===o.entity_title);!(0,N.default)(P)&&P[s.entity_title]?P[s.entity_title].recommendation_in_progress=!0:o[0]?(o[0].recommendation_in_progress=!0,P[s.entity_title]=o[0]):P[s.entity_title]=(0,D.default)((0,oe.getEntityThresholdObject)(s,!0)),V.push(s.entity_title),j.push(s.entity_key)}),o.set("entity_threshold_configuration",P)),o.unsetLinkedEntityConfigBeforeSave(),o.unsetLinkedEntityBeforeSave();var W=(0,le.getRecommendedEntityThresholdAsyncSearchForKpi)(_,j,V,null,o.get("entity_threshold_direction"),o.get("entity_keep_recommended_policy_static"),o.get("entity_recommendation_training_window"),o.get("entity_recommendation_allow_negative_value"),o.get("entity_recommendation_threshold_sensitivity")),U=Z.default.unix(o.get("entity_recommendation_start_date")).clone(),Y=o.get("entity_recommendation_training_window").match(/\d+/g)[0];U.add(Y,"days"),s.push({kpiId:_,search:W,earliestTime:Z.default.unix(o.get("entity_recommendation_start_date")),latestTime:U})}o.unsetEntityAsyncJobAttrBeforeSave(),o.unsetEntityRecommendationPendingStatusBeforeSave(),o.unsetIsKpiRecommendationUnlinkedBeforeSave()}}),s},_getChangedEntityThresholdConfig:function _getChangedEntityThresholdConfig(){var s=[];return(0,V.default)(this.modelClone.get("kpis").models,o=>{o.unsetEntityThresholdRecommendationAttrBeforeSave();var _=o.get("_key");if(!(0,K.default)(_,re.HEALTH_SCORE_KPI_PREFIX)){var S=o.get("entity_threshold_configuration")||{};Object.keys(S).length&&(s.extend(Object.values(S)),(0,V.default)(s,s=>{if(s.recommendation_in_progress){var S=(0,ne.md5KeyGenerator)([s.entity_title,_]);if(s._key&&s._key!==S){var R=o.get("entity_threshold_delete_filter")||{};R.entities="entities"in R?[...R.entities,{key:s._key,name:s.title}]:[{key:s._key,name:s.title}],s._key=S,o.set("entity_threshold_delete_filter",R)}}}))}}),s},_getEntityThresholdFilterToDelete:function _getEntityThresholdFilterToDelete(){var s={kpis:[],entities:[]};return(0,V.default)(this.modelClone.get("kpis").models,o=>{var _=o.get("_key");if(!(0,K.default)(_,re.HEALTH_SCORE_KPI_PREFIX)){var S=o.get("entity_threshold_delete_filter")||{};Object.keys(S).length&&("kpi"in S&&s.kpis.push(S.kpi),"entities"in S&&S.entities.forEach(o=>{s.entities.push(o.key)}))}}),s},_updateKpiWithAsyncSearchFlag:function _updateKpiWithAsyncSearchFlag(){var s=[];(0,V.default)(this.kpiConfigsForAsyncSearch,o=>{s.push(o.kpiId)}),s.length&&(0,V.default)(this.modelClone.get("kpis").models,o=>{var _=o.get("_key");(0,K.default)(s,_)&&o.set("is_entity_recommendation_async_job_required",{silent:!0})}),this.kpiConfigsForAsyncSearch=[]},_save:function _save(){var s=this.loadingMaskMessage||(0,W.gettext)("Saving...");this.modelClone.set({isFirstTimeSaveDone:!0}),this.loadingMask.show(s),this.modelClone.unset("cloneChangedSinceLastSave",{silent:!0}),this.kpiConfigsForAsyncSearch=this._getKpiConfigForEntityThresholdGenerateSearch();var o=this._getChangedEntityThresholdConfig(),_=new Promise((s,_)=>{o.length?(0,se.bulkCreateUpdateEntitiesConfig)(o).then(()=>{(0,V.default)(this.modelClone.get("kpis").models,s=>{var o=s.get("_key");(0,K.default)(o,re.HEALTH_SCORE_KPI_PREFIX)||s.unsetEntityThresholdConfigAttrBeforeSave()}),s()}).catch(s=>{this._updateKpiWithAsyncSearchFlag(),this.childViews.dockedFooter.setErrorMessage(s instanceof Object?(0,de.extractErrorMsgFromResponse)(s):s),this.childViews.dockedFooter.enable(),this.loadingMask.hide(),_()}):s()}),S=this._getEntityThresholdFilterToDelete(),R=new Promise((s,o)=>{S.kpis.length||S.entities.length?(0,se.deleteEntityConfig)(S).then(()=>{(0,V.default)(this.modelClone.get("kpis").models,s=>{var o=s.get("_key");(0,K.default)(o,re.HEALTH_SCORE_KPI_PREFIX)||s.unsetDeleteEntityThresholdFilterAttrBeforeSave()}),s()}).catch(s=>{this._updateKpiWithAsyncSearchFlag(),this.childViews.dockedFooter.setErrorMessage(s instanceof Object?(0,de.extractErrorMsgFromResponse)(s):s),this.childViews.dockedFooter.enable(),this.loadingMask.hide(),o()}):s()});Promise.all([_,R]).then(()=>this.modelClone.save().done(function(){this.model.clear({silent:!0}),this.model.set(this.model.parse(JSON.parse(JSON.stringify(this.modelClone.toJSON()))),{silent:!0}),this.modelClone.clear({silent:!0}),this.modelClone.set(this.modelClone.parse(JSON.parse(JSON.stringify(this.model.toJSON()))),{silent:!0}),this._onSaveEnd(),this.childViews.dockedFooter.hide(),this.loadingMask.hide()}.bind(this)).fail(function(s){this._updateKpiWithAsyncSearchFlag(),this.childViews.dockedFooter.setErrorMessage(s instanceof Object?(0,de.extractErrorMsgFromResponse)(s):s),this.childViews.dockedFooter.enable(),this.loadingMask.hide()}.bind(this)))},_runEntityThresholdGenerateAsyncSearch:function _runEntityThresholdGenerateAsyncSearch(){(0,V.default)(this.kpiConfigsForAsyncSearch,s=>{var o={id:(0,ae.createUniqueSearchId)("kpi-entity-threshold-async-search"),search:s.search,earliest_time:"-".concat((0,Z.default)().diff(s.earliestTime,"day"),"d"),latest_time:(0,Z.default)().isSame(s.latestTime,"day")?"now":"-".concat((0,Z.default)().diff(s.latestTime,"day"),"d"),autostart:!0},_={app:(0,ee.getShortAppName)(!0),owner:Y.username};X.default.create(o,_)}),this.kpiConfigsForAsyncSearch=[]},_onSaveEnd:function _onSaveEnd(){this._runEntityThresholdGenerateAsyncSearch(),this.modelClone.unset("cloneChangedSinceLastSave",{silent:!0}),this.loadingMask.hide(),this.childViews.contentView.refreshModel&&this.childViews.contentView.refreshModel(this.modelClone,{type:"save"})},_checkForFirstTimeSave:function _checkForFirstTimeSave(){if(this.modelClone.get("isFirstTimeSaveDone"))this._sendModifiedRecommendationTelemetry(),this._save();else{var s=(0,R.default)('<div class="service-save-modal-container"></div>');O.default.unmountComponentAtNode(s.get(0)),O.default.render(P.default.createElement(he.default,null,P.default.createElement(Q.default,{title:(0,W.gettext)("Save Service"),modalDataTestItsi:"service-definition-save-modal",cancelButtonDataTestItsi:"service-definition-cancel-button",primaryButtonDataTestItsi:"service-definition-save-and-enable-button",thirdButtonDataTestItsi:"service-definition-save-button",primaryButtonLabel:(0,W.gettext)("Save and Enable"),open:!0,showCancel:!0,modalStyles:ie.CONFIRMATION_MODAL_STYLE,primaryButtonClicked:()=>{this.modelClone.set({isFirstTimeSaveDone:!0});var s={enabled:1};this.modelClone.set(s),this._sendModifiedRecommendationTelemetry(),this._save()},thirdButtonLabel:(0,W.gettext)("Save"),thirdButtonClicked:()=>{this.modelClone.set({isFirstTimeSaveDone:!0}),this._sendModifiedRecommendationTelemetry(),this._save()}},P.default.createElement("span",{"data-test-itsi":"first-time-save-message"},(0,U.sprintf)((0,W.gettext)("Do you want to enable %s?"),(0,j.default)(this.modelClone.get("title"))),P.default.createElement("br",null),P.default.createElement("br",null),(0,W.gettext)("Enabling the service will start running the KPI searches.")))),s.get(0))}},_onCancelChanges:function _onCancelChanges(){var s=this.model.get("algorithms");s&&this.sdDispatcher.trigger("resetModelOnCancel"),ce.default.prototype._onCancelChanges.apply(this,arguments)}});o.default=pe;s.exports=o.default},7656:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D=S(_(7)),N=S(_(0)),V=S(_(35)),j=S(_(2)),K=S(_(34)),W=S(_(89)),U=S(_(671)),Y=S(_(1203)),$=S(_(47)),X=(0,j.default)(W.default)(R||(R=(0,D.default)(['\n\t& [data-test="toggle"] {\n\t\toverflow: hidden;\n\t\twhite-space: nowrap;\n\t\tmax-width: ',"\n\t}\n"])),s=>"".concat(s.tooltipToggleWidth,"px")),Z=(0,j.default)(K.default)(O||(O=(0,D.default)(["\n\tfont-size: 20px;\n\twhite-space: nowrap;\n"]))),Q=(0,j.default)(U.default)(P||(P=(0,D.default)(["\n\tvertical-align: baseline\n"]))),ee=Y.default.extend({initialize:function initialize(s){s=s||{},this.serviceTemplate=s.serviceTemplate,Y.default.prototype.initialize.apply(this,arguments)},_renderTooltip:function _renderTooltip(){var s=this.$el.find(".linked-service-template");if(s.length){var o=this.serviceTemplate.get("title"),_=o;o.length>50&&(_=o.slice(0,50)+"..."),V.default.unmountComponentAtNode(s.get(0)),V.default.render(N.default.createElement($.default,null,N.default.createElement(X,{content:o,"data-test-itsi":"linked-service-template-external-link-row-view-title-tooltip",tooltipToggleWidth:"500"},N.default.createElement(Z,{"data-test-itsi":"linked-service-template-external-link",to:this.serviceTemplate.getEditUrl(),openInNewContext:!0},N.default.createElement(Q,null)," ",_))),s.get(0))}},render:function render(){Y.default.prototype.render.apply(this),this.serviceTemplate&&(this.$el.prepend('<div style="float:right;" class="linked-service-template"></div>'),this._renderTooltip())}});o.default=ee;s.exports=o.default},7657:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(4001)),O=S(_(4002)),P=S(_(4003)),D=S(_(4004)),N=S(_(7692)),V=S(_(4006)),j=S(_(7693)),K=S(_(4007)),W=R.default.extend({renderTabs:function renderTabs(){this.infoTab=new O.default({service:this.modelClone,ContentView:j.default}),this.kpiTab=new D.default({appsData:this.appsData,kpiToShow:this.kpiToShow,service:this.modelClone,ContentView:N.default,serviceTemplate:this.serviceTemplate,featureFlags:this.featureFlags,thresholdTemplateCollection:this.thresholdTemplateCollection,readOnly:!0}),this.dependencyTab=new V.default({globalTeamData:this.globalTeamData,teamsCollectionData:this.teamsCollectionData,servicesCollectionData:this.servicesCollectionData,service:this.modelClone,readOnly:!0}),this.settingsTab=new P.default({service:this.modelClone,servicesCollectionData:this.servicesCollectionData,tagsData:this.tagsData,serviceTemplate:this.serviceTemplate,sdDispatcher:this.sdDispatcher,readOnly:!0}),this.predictiveAnalyticsTab=new K.default({service:this.modelClone,readOnly:!0})}});o.default=W;s.exports=o.default},7658:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(15)),O=_(4),P=_(57),D=S(_(1207)),N=S(_(2615));_(7659);var V=R.default.View.extend({tagName:"div",className:"entities-content-view",entityRulesHeader:"<div>"+(0,O.gettext)("Entity Rules allow for the optional, dynamic filtering of KPIs and can help in root cause analysis. A service need not define any Entity Rules and is not limited to only the entities matching Entity Rules.")+"</div>",initialize:function initialize(s){if(!(s=s||{}).service){if(!s.serviceTemplate)throw"Must provide service or service template";s.service=s.serviceTemplate}this.service=s.service,this.initEntityRulesView(),this.listenTo(this.specifyEntityRulesView,"ruleschange",this._rulesChanged),this.service.get("object_type")===P.OBJECT_TYPE&&(this.matchedEntitiesView=new N.default({service:this.service})),R.default.View.prototype.initialize.apply(this,arguments)},initEntityRulesView:function initEntityRulesView(){this.specifyEntityRulesView=new D.default({rulesContainerModel:this.service,ruleFieldsBlockList:["services"]})},render:function render(){return this.$el.html(this.entityRulesHeader),this.$el.append(this.specifyEntityRulesView.render().$el),this.$el.append('<h3 class="matched-entities-title" data-test-itsi="matched-entities-title">'+(0,O.gettext)("Matched Entities")+"</h3>"),this.matchedEntitiesView&&this.$el.append(this.matchedEntitiesView.render().$el),this},remove:function remove(){return this.specifyEntityRulesView.remove(),this.matchedEntitiesView&&this.matchedEntitiesView.remove(),R.default.View.prototype.remove.apply(this,arguments)},_rulesChanged:function _rulesChanged(s,o){var _=0===o.length;this.service.unset("entity_rules",{silent:!_}),_?this.service.get("kpis").each((function(s){"shared_base"!==s.get("search_type")&&s.set("is_service_entity_filter",!1)})):this.service.set("entity_rules",o),this.matchedEntitiesView&&this.matchedEntitiesView.refresh()},refreshModel:function refreshModel(){this.specifyEntityRulesView.refreshModel(),this.matchedEntitiesView&&this.matchedEntitiesView.refresh()}});o.default=V;s.exports=o.default},7659:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(2885),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},7660:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(2381)),O=S(_(2382)),P=S(_(1207)),D=S(_(7661)),N=P.default.extend({initialize:function initialize(s){s=s||{},this.serviceTemplateTitle=s.serviceTemplateTitle,P.default.prototype.initialize.apply(this,arguments)},_setupEntityRulesCollection:function _setupEntityRulesCollection(){return new R.default},_addRuleGroupImpl:function _addRuleGroupImpl(s){var o=new D.default({rulesGroupModel:s,ruleFieldsBlockList:this._ruleFieldsBlockList,_aliasFields:this._aliasFields,_infoFields:this._infoFields,serviceTemplateTitle:this.serviceTemplateTitle});this.ruleGroupViews.push(o),this.$(".rules-view-container").append(o.render().$el)},_addRuleGroup:function _addRuleGroup(){var s=new O.default;this.entityRulesCollection.add(s),this._addRuleGroupImpl(s)}});o.default=N;s.exports=o.default},7661:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(2383)),O=S(_(1431)),P=S(_(7662)),D=O.default.extend({initialize:function initialize(s){s=s||{},this.serviceTemplateTitle=s.serviceTemplateTitle,O.default.prototype.initialize.apply(this,arguments)},_setupEntityRuleItemModel:function _setupEntityRuleItemModel(){return new R.default},_addRuleImpl:function _addRuleImpl(s){var o=new P.default({rulesItemModel:s,ruleFieldsBlockList:this._ruleFieldsBlockList,_aliasFields:this._aliasFields,_infoFields:this._infoFields,serviceTemplateTitle:this.serviceTemplateTitle});this.collection.add(o.rulesItemModel),this.ruleItems.push(o),this.$(".rules-container").append(o.render().$el)}});o.default=D;s.exports=o.default},7662:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(7)),P=S(_(0)),D=S(_(32)),N=S(_(2)),V=_(4),j=_(14),K=_(29),W=_(187),U=S(_(1432)),Y=S(_(88)),$=S(_(559)),X=S(_(2383)),Z=S(_(2382)),Q=N.default.div(R||(R=(0,O.default)(["\n\twidth: 250px;\n"]))),ee=U.default.extend({initialize:function initialize(s){s=s||{},this.serviceTemplateTitle=s.serviceTemplateTitle,this.showFillInEmptyRulesWarning=!1,U.default.prototype.initialize.apply(this,arguments),this.children.tooltipWarningIcon=new $.default({dataTestItsi:"service-fill-in-rule-icon",dataTestItsiTooltip:"service-fill-in-rule-tooltip",hasTooltip:!0,tooltipContent:this.serviceTemplateTitle?P.default.createElement(Q,null,(0,j.sprintf)((0,V.gettext)("The entity filter rule has an empty value which might be coming from %s service template. Provide values to filter the specific set of entities."),this.serviceTemplateTitle)):P.default.createElement(Q,null,(0,V.gettext)("Provide values for empty entity rules to filter the service to a specific set of entities.")),type:"warning"})},_setupNewEntityRuleModel:function _setupNewEntityRuleModel(){return new X.default},_setupStaticOrRulesSelector:function _setupStaticOrRulesSelector(){var s=this.rulesItemModel.get("rule_type"),o=this.rulesItemModel.get("value");"notmatchesblank"===s?this._tempRulesItemModel.set({rule_type:"not"}):"matchesblank"===s&&this._tempRulesItemModel.set({rule_type:"matches"}),""===o&&(this.showFillInEmptyRulesWarning=!0),this._staticOrRulesSelector=new Y.default({controlType:"SyntheticSelect",controlOptions:{dataTestItsi:"service-entity-rule-type-select",items:W.MATCH_CRITERIA_OPTIONS,label:"",model:this._tempRulesItemModel,modelAttribute:"rule_type"},hasControlGroup:!1}),this.listenTo(this._tempRulesItemModel,"change:rule_type",this._handleRuleTypeChange)},_handleRuleTypeChange:function _handleRuleTypeChange(s,o){this.rulesItemModel.set({rule_type:o})},_setupEventHandlersForRuleValue:function _setupEventHandlersForRuleValue(){this.listenTo(this._tempRulesItemModel,"change:value",function(){var s=this._tempRulesItemModel.get("rule_type"),o=this._tempRulesItemModel.get("value"),_=s;"notmatchesblank"===s?_="not":"matchesblank"===s&&(_="matches");var S=this.$(".fill-in-empty-rule-message-container");""===o?S.length||((0,D.default)('<div class="fill-in-empty-rule-message-container"></div>').insertAfter(this.$(".entity-type-info-container")),this.$(".fill-in-empty-rule-message-container").append(this.children.tooltipWarningIcon.render().$el)):S.length&&this.$(".fill-in-empty-rule-message-container").remove(),this.rulesItemModel.set({value:(0,K.removeEnclosingQuotes)(this._tempRulesItemModel.get("value")),rule_type:_})}.bind(this))},renderExtraStuff:function renderExtraStuff(){this.showFillInEmptyRulesWarning&&(this.$el.append('<div class="fill-in-empty-rule-message-container"></div>'),this.$(".fill-in-empty-rule-message-container").append(this.children.tooltipWarningIcon.render().$el))},_addRuleGroup:function _addRuleGroup(){var s=new Z.default;this.entityRulesCollection.add(s),this._addRuleGroupImpl(s)}});o.default=ee;s.exports=o.default},7663:function(s,o){s.exports='<div class="entity-description-header">\n\t<div data-test-itsi="entity-rules-description-text"><%- vars.entityRulesDescription %></div>\n\t<% if (vars.showWarningMessage) { %>\n\t\t<div class="show-warning-message-container"></div>\n\t<% } %>\n</div>'},7664:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(2886),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},7665:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(2618)),O=R.default.extend({tagName:"div",className:R.default.prototype.className+" service-definition-settings-content-view"});o.default=O;s.exports=o.default},7666:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(39)),P=_(4),D=S(_(1824)),N=S(_(7667)),V=D.default.extend({initialize:function initialize(s){this.service=s.service||null,this.globalTeamData=s.globalTeamData||{},this.servicesCollectionData=s.servicesCollectionData||[],this.updateServicesCollectionData=s.updateServicesCollectionData||O.default,this.isReadOnly=s.isReadOnly||!1,this.children={views:{},controls:{}},this.children.views.dependencyView=new N.default({globalTeamData:this.globalTeamData,servicesCollectionData:this.servicesCollectionData,updateServicesCollectionData:this.updateServicesCollectionData,service:this.service,isReadOnly:this.isReadOnly})},value:"dependency",label:(0,P.gettext)("Dependency"),render:function render(){return this.$el.html(this.children.views.dependencyView.render().el),this},validate:function validate(s){var o=R.default.Deferred();return s===this&&o.reject(),o.resolve(),o},refreshModel:function refreshModel(){this.children.views.dependencyView.render()},save:function save(){return this.children.views.dependencyView?this.children.views.dependencyView.save():R.default.Deferred().resolve()}});o.default=V;s.exports=o.default},7667:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(15)),O=S(_(7668)),P=R.default.View.extend({initialize:function initialize(s){this.service=s.service,R.default.View.prototype.initialize.apply(this,arguments),this.dependingMainBodyView=new O.default({globalTeamData:s.globalTeamData,servicesCollectionData:s.servicesCollectionData,updateServicesCollectionData:s.updateServicesCollectionData,service:this.service,isReadOnly:s.isReadOnly})},render:function render(){return this.$el.html(""),this.$el.append(this.dependingMainBodyView.render().el),this},remove:function remove(){return this.dependingMainBodyView.remove(),R.default.View.prototype.remove.apply(this,arguments)}});o.default=P;s.exports=o.default},7668:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(45),O=S(_(32)),P=S(_(15)),D=S(_(0)),N=S(_(35)),V=S(_(69)),j=S(_(179)),K=_(4),W=_(87),U=_(1195),Y=_(109),$=_(145),X=S(_(7669)),Z=_(142),Q=S(_(77)),ee=S(_(111)),te=S(_(895)),ie=S(_(47)),ae=S(_(7670)),ne=S(_(7672)),re=S(_(7673));_(7674);var se=(0,R.template)(re.default,null,{variable:"vars"}),le=P.default.View.extend({initialize:function initialize(s){this.service=s.service,this.globalTeamData=s.globalTeamData,this.servicesCollectionData=s.servicesCollectionData,this.updateServicesCollectionData=s.updateServicesCollectionData,this.children={controls:{},views:{}},this.isReadOnly=s.isReadOnly||!1,this.hasCycles=!1,P.default.View.prototype.initialize.apply(this,arguments),this.children.controls.removeDependencyButton=new Q.default({dataTestItsi:"remove-selected-dependencies-button",disabled:!0,label:(0,K.gettext)("Remove selected dependencies"),onClick:this._removeSelectedDependencies.bind(this),style:{float:"left"}}),this.children.controls.addDependencyButton=new Q.default({appearance:"primary",dataTestItsi:"add-dependencies-button",label:(0,K.gettext)("Add dependencies"),onClick:this._addDependencies.bind(this),wrapperStyle:"float:right"}),this.selectedServices=[]},_loadDependencies:function _loadDependencies(){this.serviceObjs=this.servicesCollectionData;var s=null;this.service.get("sec_grp")!==Z.GLOBAL_TEAM_KEY?(this.teamModel=new te.default({_key:this.service.get("sec_grp")}),s=this.teamModel.fetch()):(this.teamModel=new te.default(this.globalTeamData),s=O.default.Deferred().resolve()),s.done(()=>{this._renderDependencies()}).fail((function(){console.error("Could not fetch the team model.")}))},_buildDependencyCollection:function _buildDependencyCollection(){this.dependencyCollection=new P.default.Collection,this.dependencyCollection.comparator=function(s){return s.get("title")},this.dependencyCollection.sort();for(var s=this.service.get("services_depends_on"),o=0;o<s.length;++o){var _=s[o],S=_.serviceid,O=(0,R.findWhere)(this.serviceObjs,{_key:S});if(O)for(var D=O.kpis,N=_.kpis_depending_on,V=0;V<N.length;++V){var j=N[V],K=(0,R.findWhere)(D,{_key:j});K&&this.dependencyCollection.add({serviceId:S,serviceTitle:O.title,_key:j,title:K.title})}}},onRequestToggle:function onRequestToggle(s){var o=this.selectedServices.map(s=>s.kpiId).indexOf(s.kpiId);o>-1?this.selectedServices.splice(o,1):this.selectedServices.push(s),this.updateRemoveButton(),this._createDependencyTable()},onRequestToggleAllRows:function onRequestToggleAllRows(s){0===this.selectedServices.length||s.length!==this.selectedServices.length?this.selectedServices=s:this.selectedServices=[],this.updateRemoveButton(),this._createDependencyTable()},updateRemoveButton:function updateRemoveButton(){var s,o;this.selectedServices&&0!==this.selectedServices.length?null===(s=this.children)||void 0===s||null===(s=s.controls)||void 0===s||null===(s=s.removeDependencyButton)||void 0===s||s.enable():null===(o=this.children)||void 0===o||null===(o=o.controls)||void 0===o||null===(o=o.removeDependencyButton)||void 0===o||o.disable()},_removeSelectedDependencies:function _removeSelectedDependencies(){if(this.selectedServices&&0!==this.selectedServices.length){for(var s=this.service.get("services_depends_on"),o=0;o<this.selectedServices.length;++o){var _=this.selectedServices[o],S=(0,V.default)(s,(function(s){return _.serviceId===s.serviceid}));S?(S.kpis_depending_on=(0,j.default)(S.kpis_depending_on,_.kpiId),Object.prototype.hasOwnProperty.call(S,"overloaded_urgencies")&&Object.prototype.hasOwnProperty.call(S,_.kpiId)&&delete S.overloaded_urgencies[_.kpiId],0===S.kpis_depending_on.length&&(s=(0,j.default)(s,(0,R.findWhere)(s,{serviceid:_.serviceId})))):console.log("Could not find service dependencies configured on service")}this.service.set("services_depends_on",s),this.service.trigger("changeDependencies"),this.service.trigger("change",this.service),this.selectedServices=[],this.updateRemoveButton(),this._renderDependencies()}},_checkIfThereWillBeCycles:function _checkIfThereWillBeCycles(s,o){var _=this.service.get("services_depends_on")||[],S={};_.forEach(s=>{S[s.serviceid]=!0}),o.forEach(s=>{S[s.get("serviceId")]=!0});var R=Object.keys(S).map(s=>({serviceid:s})),O=[{_key:s,title:this.service.get("title"),services_depends_on:R}],P={filter:JSON.stringify([s]),services:JSON.stringify(O)};return(0,U.retrieveServiceTree)(P)},_createDependencyTable:function _createDependencyTable(){var s=this.$el.find(".service-dep-body-table");s.length&&(N.default.unmountComponentAtNode(s.get(0)),N.default.render(D.default.createElement(ie.default,null,D.default.createElement(X.default,{isReadOnly:this.isReadOnly,serviceData:this.dependencyCollection,onRequestToggle:this.onRequestToggle.bind(this),onRequestToggleAllRows:this.onRequestToggleAllRows.bind(this),selectedRows:this.selectedServices})),s.get(0)))},_createWarningModal:function _createWarningModal(){var s=(0,O.default)('<div class="service-analyzer-react-message-banner"></div>');return N.default.unmountComponentAtNode(s.get(0)),N.default.render(D.default.createElement(ie.default,null,D.default.createElement(ne.default,{handleSaveDependencies:this._saveDependencies.bind(this),newDependentServices:this._newDependencies,thisService:this.service.get("title")})),s.get(0)),s},_saveDependencies:function _saveDependencies(){for(var s=this.service.get("services_depends_on"),o=0;o<this._newDependencies.length;++o){var _=this._newDependencies[o].get("serviceId"),S=this._newDependencies[o].get("_key"),R=(0,V.default)(s,(function(s){return _===s.serviceid}));if(R)(0,V.default)(R.kpis_depending_on,(function(s){return s===S}))||R.kpis_depending_on.push(S);else R={serviceid:_,kpis_depending_on:[S]},s.push(R)}this.service.set("services_depends_on",s),this.service.trigger("changeDependencies"),this.service.trigger("change"),this._renderDependencies()},fetchAdditionalServices:function fetchAdditionalServices(s){var o={count:0,fields:"_key,identifying_name,title,base_service_template_id,kpis.title,kpis._key,kpis.type,kpis.urgency,services_depending_on_me,services_depends_on",offset:0,sort_dir:"asc",sort_key:"identifying_name",filter:JSON.stringify((0,W.createJSONFilterMultipleObjects)("$or","_key",s))};return(0,Y.retrieveServices)(o).then(s=>s.data).then(s=>{this.serviceObjs=[...this.serviceObjs,...s],this.updateServicesCollectionData(this.serviceObjs)}).catch(()=>{})},_addDependenciesImpl:function _addDependenciesImpl(){var s=[this._checkIfThereWillBeCycles(this.service.get("_key"),this._newDependencies).then(s=>s.data).then(s=>{this.hasCycles=(0,$.serviceTopologyHasCycles)(s)}).catch(()=>{})],o=[];this._newDependencies.map(s=>s.get("serviceId")).forEach(s=>{(0,R.findWhere)(this.serviceObjs,{_key:s})||-1!==o.indexOf(s)||o.push(s)}),o.length&&s.push(this.fetchAdditionalServices(o)),Promise.all(s).then(()=>{if(this.hasCycles){var s=this._createWarningModal();this.$el.append(s)}else this._saveDependencies()})},_renderDependencies:function _renderDependencies(){this._buildDependencyCollection(),this.$el.html(se({isReadOnly:this.isReadOnly},{variable:"vars"})),this.$(".service-dep-header-controls").append(this.children.controls.removeDependencyButton.render().$el),this.$(".service-dep-header-controls").append(this.children.controls.addDependencyButton.render().$el),this._createDependencyTable(),this.delegateEvents()},render:function render(){var s=new ee.default({content:(0,K.gettext)("Loading service dependencies..."),dataTestItsi:"service-dependencies-loading-message",type:"info",style:{margin:10}});return this.$el.html(s.render().$el),this._loadDependencies(),this},_addDependencies:function _addDependencies(){var s=new ae.default({blockedServiceID:this.service.get("_key"),serviceObjs:this.serviceObjs,teamModel:this.teamModel,onHiddenRemove:!0});this.listenTo(s,"dependenciesadded",(function(s){this._newDependencies=s,this._addDependenciesImpl()})),s.render()}});o.default=le;s.exports=o.default},7669:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.getDependenciesCountLabel=o.default=o.columnsData=o.cellData=void 0;var R,O,P,D=S(_(7)),N=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),V=S(_(3)),j=S(_(2)),K=S(_(24)),W=S(_(131)),U=S(_(93)),Y=_(4),$=_(14),X=S(_(721)),Z=_(29),Q=_(130);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}var ee=o.columnsData=[{dataTestItsi:"service-dependency-body-table-title-column-header",name:(0,Y.gettext)("Title")},{dataTestItsi:"service-dependency-body-table-service-column-header",name:(0,Y.gettext)("Service")}],te=o.cellData=[{dataTestItsi:"service-dependency-body-table-title-cell",stringValueDataTestItsi:"service-dependency-body-table-title",stringValueTooltipDataTestItsi:"service-dependency-body-table-title-tooltip"},{dataTestItsi:"service-dependency-body-table-service-cell",stringValueDataTestItsi:"service-dependency-body-table-service",stringValueTooltipDataTestItsi:"service-dependency-body-table-service-tooltip"}],ie=j.default.div(R||(R=(0,D.default)(["\n line-height: 32px;\n margin-bottom: 5px;\n"]))),ae=j.default.div(O||(O=(0,D.default)(["\n float: right;\n"]))),ne=j.default.div(P||(P=(0,D.default)(["\n display: inline;\n"]))),getDependenciesCountLabel=s=>(0,$.sprintf)((0,Z.ungettext)("%(totalCount)d Dependency","%(totalCount)d Dependencies",s.length),{totalCount:s.length});o.getDependenciesCountLabel=getDependenciesCountLabel;function ServiceDependencyTable(s){var{isReadOnly:o,serviceData:_,onRequestToggle:S,onRequestToggleAllRows:R,selectedRows:O}=s,P=_.length,D=Math.ceil(P/20),[V,j]=(0,N.useState)(1),handleToggle=(s,o)=>{var _={serviceId:o.get("serviceId"),kpiId:o.get("_key")};S(_)};if(_&&_.length){var $=_.models.slice(20*(V-1),20*V),Z=o?{"data-test-itsi":"service-kpis-dependencies-table",stripeRows:!0}:{"data-test-itsi":"service-kpis-dependencies-table",onRequestToggleAllRows:()=>{var s=_.models.map(s=>({serviceId:s.get("serviceId"),kpiId:s.get("_key")}));R(s)},rowSelection:0===O.length?Q.SELECTED_NONE:_&&O.length===_.models.length?Q.SELECTED_ALL:Q.SELECTED_SOME,stripeRows:!0};return N.default.createElement(N.default.Fragment,null,N.default.createElement(ie,null,N.default.createElement(ne,{"data-test-itsi":"service-dependency-body-table-count"},getDependenciesCountLabel(_)),D>1&&N.default.createElement(ae,null,N.default.createElement(W.default,{"data-test-itsi":"service-dependency-body-table-paginator",current:V,onChange:(s,o)=>{var{page:_}=o;j(_)},totalPages:D}))),N.default.createElement(U.default,Z,N.default.createElement(U.default.Head,{"data-test-itsi":"service-dependency-body-table-head"},ee.map(s=>N.default.createElement(U.default.HeadCell,{"data-test-itsi":s.dataTestItsi,key:s.dataTestItsi},s.name))),N.default.createElement(U.default.Body,null,$.map(s=>{var _=O.map(s=>s.kpiId).indexOf(s.get("_key"))>-1,S=o?{"data-test-itsi":"service-dependency-body-table-row",key:"".concat(s.get("serviceId"),"-").concat(s.get("_key"),"-row")}:{"data-test-itsi":"service-dependency-body-table-row",data:s,key:"".concat(s.get("serviceId"),"-").concat(s.get("_key"),"-row"),onRequestToggle:handleToggle,selected:_};return N.default.createElement(U.default.Row,S,N.default.createElement(U.default.Cell,{"data-test-itsi":te[0].dataTestItsi,key:"".concat(s.get("serviceId"),"-").concat(s.get("_key"),"-kpi")},N.default.createElement(X.default,{dataTestItsi:te[0].stringValueDataTestItsi,maxWidth:500,tooltipDataTestItsi:te[0].stringValueTooltipDataTestItsi,value:s.get("title")})),N.default.createElement(U.default.Cell,{"data-test-itsi":te[1].dataTestItsi,key:"".concat(s.get("serviceId"),"-").concat(s.get("_key"),"-service")},N.default.createElement(X.default,{dataTestItsi:te[1].stringValueDataTestItsi,maxWidth:500,tooltipDataTestItsi:te[1].stringValueTooltipDataTestItsi,value:s.get("serviceTitle")})))}))))}return N.default.createElement(K.default,{"data-test-itsi":"no-dependencies-info-message",type:"info"},(0,Y.gettext)("No dependencies defined."))}ServiceDependencyTable.propTypes={isReadOnly:V.default.bool.isRequired,serviceData:V.default.object,onRequestToggle:V.default.func.isRequired,onRequestToggleAllRows:V.default.func.isRequired,selectedRows:V.default.array},ServiceDependencyTable.defaultProps={serviceData:{},selectedRows:[]};o.default=ServiceDependencyTable},7670:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=S(_(0)),D=S(_(35)),N=S(_(37)),V=S(_(157)),j=S(_(236)),K=_(4),W=S(_(1608)),U=_(57),Y=_(109),$=S(_(7671)),X=_(2378),Z=S(_(155)),Q=S(_(111)),ee=S(_(1226)),te=S(_(77)),ie=S(_(47));_(1840);var ae={width:"250px"},ne=Z.default.extend({dataTestItsi:"add-service-dependency-modal",isWide:!0,initialize:function initialize(s){Z.default.prototype.initialize.apply(this,arguments),this.blockedServiceID=s.blockedServiceID||[],this.teamModel=s.teamModel,this.layout=new ee.default({sidebarContent:this.sidebarTemplate,mainContent:this.mainTemplate});var o=O.default.Model.extend({idAttribute:"_key"}),_=O.default.Collection.extend({model:o});this.kpiCollection=new _,this.selectedKPIs=[],this.children.errorMessage=new Q.default({content:(0,K.gettext)("Must select at least one KPI."),dataTestItsi:"service-dependency-none-selected-error-message",isInline:!0,isVisible:!1,type:"error"}),this.children.cancelButton=new te.default({dataTestItsi:"service-dependency-modal-cancel-button",label:(0,K.gettext)("Cancel"),onClick:this.hide.bind(this)}),this.children.saveButton=new te.default({appearance:"primary",dataTestItsi:"service-dependency-modal-primary-button",label:(0,K.gettext)("Done"),onClick:this._saveKpis.bind(this),style:{marginLeft:10}})},_createScrollableServiceList:function _createScrollableServiceList(s){var o={_key:{$ne:this.blockedServiceID}},_=(0,R.default)('<div class="field-value-react-dropdown" data-test-itsi="add-service-dependency-list"></div>');return D.default.unmountComponentAtNode(_.get(0)),D.default.render(P.default.createElement(ie.default,null,P.default.createElement(W.default,{objectsCollectionCountPath:"".concat(Y.baseURL,"/count"),objectsCollectionPath:Y.baseURL,handleItemSelect:this.handleServiceSelect.bind(this),handleItemDeselect:this.handleServiceDeselect.bind(this),filterPlaceholder:(0,K.gettext)("Filter services"),fields:"title,_key,kpis.title,kpis._key,kpis.type,services_depending_on_me,services_depends_on",addedFilters:[s,o],searchBarStyle:ae,isSearchBarInline:!1,itemTitle:U.OBJECT_NAMES})),_.get(0)),_},onRequestToggle:function onRequestToggle(s){var o=this.selectedKPIs.indexOf(s);o>-1?this.selectedKPIs.splice(o,1):this.selectedKPIs.push(s),this.renderAddKPIDependencyTable()},onRequestToggleAllRows:function onRequestToggleAllRows(s){0===this.selectedKPIs.length||(0,V.default)(s,this.selectedKPIs).length!==this.selectedKPIs.length?this.selectedKPIs=this.kpiCollection.models.map(s=>s.get("_key")):this.selectedKPIs=[],this.renderAddKPIDependencyTable()},renderAddKPIDependencyTable:function renderAddKPIDependencyTable(){if(this.layout.$el.find(".kpi-main-list").length){D.default.unmountComponentAtNode(this.layout.$el.find(".kpi-main-list").get(0));var s=this.kpiCollection.models.map(s=>({_key:s.get("_key"),description:s.get("description"),title:s.get("title"),serviceTitle:s.get("serviceTitle")}));D.default.render(P.default.createElement(ie.default,null,P.default.createElement($.default,{kpiData:s,onRequestToggle:this.onRequestToggle.bind(this),onRequestToggleAllRows:this.onRequestToggleAllRows.bind(this),selectedKPIs:this.selectedKPIs})),this.layout.$el.find(".kpi-main-list").get(0))}},handleServiceSelect:function handleServiceSelect(s){for(var o=s.kpis,_=0;_<o.length;_++)this.kpiCollection.add({serviceId:s._key,serviceTitle:s.title,_key:o[_]._key,title:o[_].title,description:o[_].description});this.renderAddKPIDependencyTable()},handleServiceDeselect:function handleServiceDeselect(s){var o=[];s.kpis.forEach((function(s){s.type===U.KPI_TYPES.PRIMARY&&o.push(s)})),o.forEach(s=>{var o=this.selectedKPIs.indexOf(s._key);o>-1&&this.selectedKPIs.splice(o,1)});var _=s._key,S=this.kpiCollection.where({serviceId:_});this.kpiCollection.remove(S),this.renderAddKPIDependencyTable()},_saveKpis:function _saveKpis(){if(0!==this.selectedKPIs.length){this.children.errorMessage.hide();var s=[];(0,N.default)(this.selectedKPIs,function(o){var _=this.kpiCollection.where({_key:o});_&&_.length>0&&s.push(_[0])}.bind(this)),this.trigger("dependenciesadded",s),this.hide(),this.remove()}else this.children.errorMessage.show()},render:function render(){var s,o=[];(0,N.default)(this.teamModel.get("parents"),s=>{(0,j.default)(s)&&o.push(s._key)}),s=(0,X.createJSONFilterTeam)(this.teamModel.get("_key"),o),this.fetchServiceObjectView=this._createScrollableServiceList(s),this._renderModal()},_renderModal:function _renderModal(){return this.setModalTitle((0,K.gettext)("Add dependencies")),this.appendToBody(this.children.errorMessage.render().$el),this.appendToBody(this.layout.render().$el),this.layout.$el.find(".sidebar-layout-header").hide(),this.layout.$el.find(".service-list").append(this.fetchServiceObjectView),this.renderAddKPIDependencyTable(),this.appendToFooter(this.children.cancelButton.render().$el),this.appendToFooter(this.children.saveButton.render().$el),Z.default.prototype.render.apply(this,arguments),this},sidebarTemplate:'<div class="service-list"></div>',mainTemplate:'<div class="kpi-main-list"></div>'});o.default=ne;s.exports=o.default},7671:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=o.columnsData=o.cellData=void 0;var R,O=S(_(7)),P=S(_(0)),D=S(_(3)),N=S(_(2)),V=S(_(24)),j=S(_(93)),K=S(_(89)),W=_(4),U=_(130),Y=(0,N.default)(j.default)(R||(R=(0,O.default)(["\n width: 100%;\n"]))),$=o.columnsData=[{dataTestItsi:"add-service-dependencies-table-kpi-title-column-header",label:(0,W.gettext)("KPI Title")},{dataTestItsi:"add-service-dependencies-table-kpi-service-title-column-header",label:(0,W.gettext)("Service Title")}],X=o.cellData=[{dataTestItsi:"add-service-dependencies-table-kpi-title-cell"},{dataTestItsi:"add-service-dependencies-table-kpi-service-title-cell"}];function AddKPIDependencyTable(s){var{kpiData:o,onRequestToggle:_,onRequestToggleAllRows:S,selectedKPIs:R}=s,onRequestToggleInternal=(s,o)=>{_(o)},limitCellContentSize=(s,o)=>!s||s.length<=25?s:P.default.createElement(K.default,{"data-test-itsi":o,content:s,key:"".concat(s,"-").concat(o)},"".concat(s.slice(0,25),"..."));return o&&o.length?P.default.createElement(Y,{"data-test-itsi":"add-service-dependencies-table",stripeRows:!0,onRequestToggleAllRows:()=>{S(o.map(s=>s._key))},rowSelection:0===R.length?U.SELECTED_NONE:R.length===o.length?U.SELECTED_ALL:U.SELECTED_SOME},P.default.createElement(j.default.Head,{"data-test-itsi":"add-service-dependencies-table-head"},$.map(s=>P.default.createElement(j.default.HeadCell,{"data-test-itsi":s.dataTestItsi,key:s.dataTestItsi},s.label))),P.default.createElement(j.default.Body,null,o.map(s=>P.default.createElement(j.default.Row,{"data-test-itsi":"add-service-dependencies-table-row",key:"".concat(s._key,"-").concat(s.title,"-row"),onRequestToggle:onRequestToggleInternal,data:s._key,selected:R.indexOf(s._key)>-1},P.default.createElement(j.default.Cell,{"data-test-itsi":X[0].dataTestItsi,key:"".concat(s._key,"-").concat(s.title,"-kpi-title-cell")},limitCellContentSize(s.title,"add-service-dependencies-table-kpi-title-tooltip")),P.default.createElement(j.default.Cell,{"data-test-itsi":X[1].dataTestItsi,key:"".concat(s._key,"-").concat(s.title,"-service-title-cell")},limitCellContentSize(s.serviceTitle,"add-service-dependencies-table-service-title-tooltip")))))):P.default.createElement(V.default,{"data-test-itsi":"add-service-dependencies-table-none-message",type:"info"},(0,W.gettext)("No KPIs to display. Select service(s) on the left panel."))}AddKPIDependencyTable.propTypes={kpiData:D.default.arrayOf(D.default.shape({_key:D.default.string,description:D.default.string,title:D.default.string,serviceTitle:D.default.string})),onRequestToggle:D.default.func.isRequired,onRequestToggleAllRows:D.default.func.isRequired,selectedKPIs:D.default.array},AddKPIDependencyTable.defaultProps={kpiData:[],selectedKPIs:[]};o.default=AddKPIDependencyTable},7672:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O=S(_(16)),P=S(_(17)),D=S(_(21)),N=S(_(19)),V=S(_(20)),j=S(_(8)),K=S(_(7)),W=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),U=S(_(3)),Y=S(_(2)),$=S(_(100)),X=S(_(24)),Z=S(_(27)),Q=_(4);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,N.default)(o),(0,D.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,N.default)(s).constructor):o.apply(s,_))}_(28);var ee=(0,Y.default)($.default)(R||(R=(0,K.default)(["\n\twidth: 600px;\n"]))),te={handleSaveDependencies:U.default.func.isRequired,newDependentServices:U.default.array.isRequired,thisService:U.default.string.isRequired},ie=function(s){function CyclicDependencyWarningModal(s,o){var _;return(0,O.default)(this,CyclicDependencyWarningModal),_=_callSuper(this,CyclicDependencyWarningModal,[s,o]),(0,j.default)(_,"handleRequestOpen",()=>{_.setState({open:!0})}),(0,j.default)(_,"handleRequestClose",()=>{_.setState({open:!1})}),(0,j.default)(_,"submit",()=>{_.props.handleSaveDependencies(),_.handleRequestClose()}),_.state={open:!0},_}return(0,V.default)(CyclicDependencyWarningModal,s),(0,P.default)(CyclicDependencyWarningModal,[{key:"render",value:function render(){var{thisService:s,newDependentServices:o}=this.props,_=1===o.length?o[0].get("serviceTitle"):o.map((function(s){return s.get("serviceTitle")})).join(", ");return W.default.createElement("div",null,W.default.createElement(ee,{"data-test-itsi":"cyclic-dependency-warning-modal",onRequestClose:this.handleRequestClose,open:this.state.open},W.default.createElement($.default.Header,{title:(0,Q.gettext)("Warning"),onRequestClose:this.handleRequestClose}),W.default.createElement($.default.Body,null,W.default.createElement(X.default,{"data-test-itsi":"cyclic-dependency-warning-message",type:"warning"},(0,Q.gettext)("Adding one or more of")+" ",W.default.createElement("b",null,_)," "+(0,Q.gettext)("as dependent service(s) of")+" ",W.default.createElement("b",null,s)," "+(0,Q.gettext)("will cause a cyclic dependency loop. This could result in miscalculation of the service health score. Do you want to continue adding this dependency?"))),W.default.createElement($.default.Footer,null,W.default.createElement(Z.default,{appearance:"secondary","data-test-itsi":"service-cyclic-dependency-modal-no-button",onClick:this.handleRequestClose,label:(0,Q.gettext)("No")}),W.default.createElement(Z.default,{appearance:"primary","data-test-itsi":"service-cyclic-dependency-modal-yes-button",onClick:this.submit,label:(0,Q.gettext)("Yes")}))))}}])}(W.Component);ie.propTypes=te;o.default=ie;s.exports=o.default},7673:function(s,o){s.exports='<div class="service-dep">\n\t<% if (!vars.isReadOnly) { %>\n\t<div class="service-dep-header clearfix">\n\t\t<div class="service-dep-header-controls"></div>\n\t</div>\n\t<% } %>\n\t<div class="service-dep-body">\n\t\t<div class="service-dep-body-table" data-test-itsi="service-dep-body-table-container"></div>\n\t</div>\n</div>'},7674:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(2887),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},7675:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=_(4),O=_(57),P=S(_(276)),D=P.default.extend({dataTestItsi:"base-service-pa-tab",initialize:function initialize(s){(s=s||{}).tabId=O.SERVICE_DEFINITION_TABS.PREDICTIVE_ANALYTICS,s.tabLabel=(0,R.gettext)("Predictive Analytics"),P.default.prototype.initialize.call(this,s)}});o.default=D;s.exports=o.default},7676:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(7677)),O=R.default.extend({tagName:"div",className:R.default.prototype.className+" service-definition-predictive-analytics-content-view"});o.default=O;s.exports=o.default},7677:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(32)),O=S(_(15)),P=S(_(0)),D=S(_(35)),N=_(45),V=S(_(254)),j=_(188),K=S(_(47)),W=S(_(7678)),U=S(_(7689));_(7690);var Y=(0,N.template)(U.default,null,{variable:"vars"}),$=O.default.View.extend({tagName:"div",className:"predictive-analytics-content-view",initialize:function initialize(s){if(!(s=s||{}).service)throw"Must provide service";this.serviceModelClone=s.service,this.sdDispatcher=s.sdDispatcher,this.isReadOnly=s.isReadOnly||!1,this.prevInfo={},this.currentAlgoSavedModelId=null,this.handleTrainingInProgress=this.handleTrainingInProgress.bind(this),this.saveLoadedInfo=this.saveLoadedInfo.bind(this),this.handleShowPanda=this.handleShowPanda.bind(this),this.setCurrentAlgoSavedModelId=this.setCurrentAlgoSavedModelId.bind(this),this.resetCancel=this.resetCancel.bind(this),this.cancelChanges=!1,this.sdDispatcher&&this.listenTo(this.sdDispatcher,"resetModelOnCancel",this.resetModelOnCancel.bind(this)),O.default.View.prototype.initialize.apply(this,arguments)},callSearchRenderers:function callSearchRenderers(){this.predictiveAnalyticsContent&&this.predictiveAnalyticsContent.executeTrainInputSearches()},handleTrainingInProgress:function handleTrainingInProgress(s){this.sdDispatcher.trigger("modelTraining",s)},resetModelOnCancel:function resetModelOnCancel(){this.cancelChanges=!0},resetCancel:function resetCancel(){this.cancelChanges=!1},handleShowPanda:function handleShowPanda(s){(0,V.default)(s)||(this.$("#svg-object-panda").length&&this.$("#svg-object-panda").remove(),s?this.triggerHappy():this.triggerSad(),setTimeout(function(){this.$("#svg-object-panda").remove()}.bind(this),5e3))},triggerSad:function triggerSad(){this.$el.append(Y({backgroundColor:j.backgroundColor,legacyDarkColor:j.legacyDarkColor,syntaxBlue:j.syntaxBlue,syntaxRed:j.syntaxRed},{variable:"vars"})),this.$("#svg-object-panda").attr("class","activepanda"),this.$("#hand").attr("class","wavehand"),this.$("#heart").css({display:"none"}),this.$("#tear").attr("class","tear")},triggerHappy:function triggerHappy(){this.$el.append(Y({backgroundColor:j.backgroundColor,legacyDarkColor:j.legacyDarkColor,syntaxBlue:j.syntaxBlue,syntaxRed:j.syntaxRed},{variable:"vars"})),this.$("#svg-object-panda").attr("class","activepanda"),this.$("#lips").attr("class","happypandalips"),this.$("#hand").attr("class","wavehand"),this.$("#tear").css({display:"none"}),this.$("#heart").attr("class","heart")},saveLoadedInfo:function saveLoadedInfo(s,o,_){this.prevInfo={previousModel:s,previousEarliest:o,previousLatest:_}},setCurrentAlgoSavedModelId:function setCurrentAlgoSavedModelId(s){this.currentAlgoSavedModelId=s},render:function render(){return this.contentView=this._createContentView(),this.$el.html(this.contentView),this},_createContentView:function _createContentView(){var s=(0,R.default)('<div class="predictive-analytics-create-view"></div>');D.default.unmountComponentAtNode(s.get(0));var o=void 0!==this.predictiveAnalyticsContent&&!this.cancelChanges;return this.predictiveAnalyticsContent=null,D.default.render(P.default.createElement(K.default,null,P.default.createElement(W.default,{service:this.serviceModelClone,handleTrainingInProgress:this.handleTrainingInProgress,isReadOnly:this.isReadOnly,saveSelectedInfo:this.saveLoadedInfo,savedService:o,prevInfo:this.prevInfo,currentAlgoSavedModelId:this.currentAlgoSavedModelId,handleShowPanda:this.handleShowPanda,setCurrentAlgoSavedModelId:this.setCurrentAlgoSavedModelId,cancelChanges:this.cancelChanges,resetCancel:this.resetCancel,ref:s=>this.predictiveAnalyticsContent=s})),s.get(0)),s},refreshModel:function refreshModel(){this.render()}});o.default=$;s.exports=o.default},7678:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K=S(_(16)),W=S(_(17)),U=S(_(21)),Y=S(_(19)),$=S(_(20)),X=S(_(8)),Z=S(_(7)),Q=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),ee=S(_(3)),te=S(_(33)),ie=S(_(254)),ae=S(_(349)),ne=S(_(2)),re=S(_(624)),se=S(_(575)),le=S(_(64)),oe=S(_(24)),de=S(_(89)),ce=_(22),he=_(14),ue=_(4),pe=_(67),fe=_(1052),ge=S(_(7679)),me=S(_(7687)),ve=S(_(7688)),ye=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,Y.default)(o),(0,U.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,Y.default)(s).constructor):o.apply(s,_))}_(28);var _e=ne.default.div(R||(R=(0,Z.default)(["\n\tpadding: 20px 20px 10px 20px;\n\tmargin-bottom: 0;\n"]))),Se=(0,ne.default)(le.default)(O||(O=(0,Z.default)(["\n\tpadding-left: 20px;\n\tpadding-top: 12px;\n\tmargin-top: 0;\n"]))),be=(0,ne.default)(de.default)(P||(P=(0,Z.default)(["\n\tpadding-left: 10px;\n"]))),Ee=ne.default.span(D||(D=(0,Z.default)(["\n\tdisplay: block;\n\twidth: 450px;\n"]))),Te=(0,ne.default)(se.default)(N||(N=(0,Z.default)(["\n\tpadding: 0 20px 20px 20px;\n"]))),Ce=(0,ne.default)(re.default)(V||(V=(0,Z.default)(["\n\tcolor: ",";\n\tfont-size: 22px;\n"])),ce.variables.infoColor),ke=(0,ne.default)(oe.default)(j||(j=(0,Z.default)(["\n\tdisplay: inline-flex;\n\tmargin-left: 20px;\n"]))),xe=function(s){function PredictiveAnalyticsCreateMain(s){var o;(0,K.default)(this,PredictiveAnalyticsCreateMain);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,PredictiveAnalyticsCreateMain,[s,...S]),(0,X.default)(o,"componentDidMount",()=>{o.checkMLTKPromise.then(()=>{o.setState({predictiveAnalyticsLoadState:ye.LOAD_STATE.NORMAL})}).catch(()=>{o.setState({predictiveAnalyticsLoadState:ye.LOAD_STATE.MISSING})}),o.props.cancelChanges&&!(0,ie.default)(o.props.currentAlgoSavedModelId)?(o.updateTrainedModelId(o.props.currentAlgoSavedModelId),o.setTestPeriods(o.props.prevInfo.previousEarliest,o.props.prevInfo.previousLatest),o.props.resetCancel()):(0,ae.default)(o.props.prevInfo)>0&&o.props.prevInfo.previousModel&&o.props.savedService&&(o.updateTrainedModelId(o.props.prevInfo.previousModel),o.setTestPeriods(o.props.prevInfo.previousEarliest,o.props.prevInfo.previousLatest))}),(0,X.default)(o,"executeTrainInputSearches",()=>{o.setState({runTrainInputSearches:!0})}),(0,X.default)(o,"handleTrainInputSearchesDone",()=>{o.setState({runTrainInputSearches:!1})}),(0,X.default)(o,"handleModelCreation",(s,_,S,R,O,P,D,N,V,j,K,W)=>{_=_||"now",o.setState({testPeriodEarliest:s,testPeriodLatest:_,trainingSplit:S,testDataSplitMessage:(0,he.sprintf)((0,ue.gettext)("%d percent of the data in the selected time period will be used for testing."),100-S),disableWhileTraining:!1,trainedModelId:R,modelType:O,trainTestWorkflowStep:P,next30AverageHealthScore:D,next30WorstSeverity:V,next30AverageSeverity:N,next30MinHealthScore:j,createModelSearch:K,service:W})}),(0,X.default)(o,"handleTrainError",()=>{o.setState({trainTestWorkflowStep:ye.TRAIN_TEST_WORKFLOW_STEP.TEST,testDataSplitMessage:ye.TEST_DATA_SPLIT_MESSAGES.TEST_ALL_DATA,disableWhileTraining:!1})}),(0,X.default)(o,"handleTrainTestWorkflowStepUpdate",s=>{o.setState({trainTestWorkflowStep:s})}),(0,X.default)(o,"updateTestTimePickerAttributes",(s,_,S)=>{o.setState({testPeriodEarliest:s,testPeriodLatest:_,testDataSplitMessage:S})}),(0,X.default)(o,"updateTrainedModelId",s=>{var _={};o.state.testDataSplitMessage!==ye.TEST_DATA_SPLIT_MESSAGES.TEST_ALL_DATA&&(_.testDataSplitMessage=ye.TEST_DATA_SPLIT_MESSAGES.TEST_ALL_DATA);var S=(0,ye.getAlgorithmTypeFromModelId)(s);_.modelType=(0,te.default)(S)?ye.ALGO_TYPES.REGRESSION:S.type,_.trainedModelId=s,o.setState(_)}),(0,X.default)(o,"handleTrainProgress",s=>{s&&o.setState({testDataSplitMessage:ye.TEST_DATA_SPLIT_MESSAGES.TEST_NO_DATA,disableWhileTraining:!0,trainedModelId:""})}),(0,X.default)(o,"setMissingModels",(s,_)=>{ye.ALGO_TYPES.REGRESSION===s?o.setState({missingRegressionModels:_}):ye.ALGO_TYPES.CLASSIFICATION===s&&o.setState({missingClassificationModels:_})}),(0,X.default)(o,"setTestPeriods",(s,_)=>{o.setState({testPeriodEarliest:s,testPeriodLatest:_})}),(0,X.default)(o,"getTooltipContent",s=>Q.default.createElement(Ee,null,s)),(0,X.default)(o,"renderPredictiveAnalyticsState",()=>{var s=Q.default.createElement("div",null),_=100-o.state.trainingSplit,S=(0,ue.gettext)("The predictions and forecasts displayed here are based on the underlying data that is passed to the algorithms for training purposes. Because historical accuracy is not a guarantee of future accuracy, the predictions might not always be 100% accurate. Please ensure that a human validates the accuracy of the predictions before acting on them.");switch(o.state.predictiveAnalyticsLoadState){case ye.LOAD_STATE.FIRST_LOAD:break;case ye.LOAD_STATE.NORMAL:s=Q.default.createElement("div",null,Q.default.createElement(_e,{"data-test-itsi":"pa-create-main-description"},(0,ue.gettext)("ITSI Predictive Analytics uses machine learning algorithms to predict the future health score of your service. You can train and test different machine learning algorithms to determine which one will give the most accurate prediction. Expand the INSTRUCTIONS section to get started."),Q.default.createElement(be,{"data-test-itsi":"pa-create-main-tooltip",content:o.getTooltipContent(S)},Q.default.createElement(Ce,null))),Q.default.createElement(Te,{"data-test-itsi":"pa-create-main-collapsible-panel",title:(0,ue.gettext)("INSTRUCTIONS")},Q.default.createElement(ve.default,{isReadOnly:o.props.isReadOnly,serviceId:o.props.service.get("_key")})),o.props.isReadOnly&&Q.default.createElement(ke,{"data-test-itsi":"pa-write-access-info-message",type:"info"},(0,ue.gettext)("You must have write access to this service to train models.")),!1===o.props.isReadOnly&&Q.default.createElement(me.default,{isValidTimePeriod:ye.isValidTimePeriod,service:o.props.service,runTrainInputSearches:o.state.runTrainInputSearches,handleTrainInputSearchesDone:o.handleTrainInputSearchesDone,timePickerAttributes:pe.TIME_PICKER_ATTRIBUTES,handleModelCreation:o.handleModelCreation,handleTrainProgress:o.handleTrainProgress,trainingSplit:o.state.trainingSplit,handleTrainTestWorkflowStepUpdate:o.handleTrainTestWorkflowStepUpdate,handleTrainError:o.handleTrainError,handleTrainingInProgress:o.props.handleTrainingInProgress,savedService:o.props.savedService,setCurrentAlgoSavedModelId:o.props.setCurrentAlgoSavedModelId,cancelChanges:o.props.cancelChanges,missingRegressionModels:o.state.missingRegressionModels,missingClassificationModels:o.state.missingClassificationModels,setMissingModels:o.setMissingModels}),Q.default.createElement(Se,{"data-test-itsi":"test-a-model-heading",level:2,id:"test-a-model"},(0,ue.gettext)("Test a Model")),Q.default.createElement(ge.default,{isValidTimePeriod:ye.isValidTimePeriod,service:o.props.service,timePickerAttributes:pe.TIME_PICKER_ATTRIBUTES,testPeriodEarliest:o.state.testPeriodEarliest,testPeriodLatest:o.state.testPeriodLatest,testDataSplit:_,testDataSplitMessage:o.state.testDataSplitMessage,trainedModelId:o.state.trainedModelId,modelAlgorithmType:o.state.modelType,updateTestTimePickerAttributes:o.updateTestTimePickerAttributes,updateTrainedModelId:o.updateTrainedModelId,trainTestWorkflowStep:o.state.trainTestWorkflowStep,handleTrainTestWorkflowStepUpdate:o.handleTrainTestWorkflowStepUpdate,next30AverageHealthScore:o.state.next30AverageHealthScore,next30WorstSeverity:o.state.next30WorstSeverity,next30AverageSeverity:o.state.next30AverageSeverity,next30MinHealthScore:o.state.next30MinHealthScore,createModelSearch:o.state.createModelSearch,disableWhileTraining:o.state.disableWhileTraining,isReadOnly:o.props.isReadOnly,saveSelectedInfo:o.props.saveSelectedInfo,didSaveService:o.props.savedService,handleShowPanda:o.props.handleShowPanda,cancelChanges:o.props.cancelChanges,missingRegressionModels:o.state.missingRegressionModels,missingClassificationModels:o.state.missingClassificationModels,setMissingModels:o.setMissingModels}));break;case ye.LOAD_STATE.MISSING:s=(0,ye.loadMissingMLTKElement)()}return s}),o.checkMLTKPromise=(0,fe.retrieveMLToolkitApp)(),o.state={service:o.props.service,runTrainInputSearches:!1,predictiveAnalyticsLoadState:ye.LOAD_STATE.FIRST_LOAD,testPeriodEarliest:"-24h@h",trainingSplit:70,testDataSplitMessage:ye.TEST_DATA_SPLIT_MESSAGES.TEST_ALL_DATA,trainedModelId:"",modelType:ye.ALGO_TYPES.REGRESSION,trainTestWorkflowStep:ye.TRAIN_TEST_WORKFLOW_STEP.TEST,next30AverageHealthScore:null,next30WorstSeverity:null,next30AverageSeverity:null,next30MinHealthScore:null,createModelSearch:"",disableWhileTraining:!1,missingRegressionModels:[],missingClassificationModels:[]},o}return(0,$.default)(PredictiveAnalyticsCreateMain,s),(0,W.default)(PredictiveAnalyticsCreateMain,[{key:"render",value:function render(){return Q.default.createElement("div",null,this.renderPredictiveAnalyticsState())}}])}(Q.Component);(0,X.default)(xe,"propTypes",{service:ee.default.object.isRequired,handleTrainingInProgress:ee.default.func.isRequired,isReadOnly:ee.default.bool.isRequired,saveSelectedInfo:ee.default.func.isRequired,savedService:ee.default.bool.isRequired,prevInfo:ee.default.object.isRequired,handleShowPanda:ee.default.func,currentAlgoSavedModelId:ee.default.string,setCurrentAlgoSavedModelId:ee.default.func.isRequired,cancelChanges:ee.default.bool.isRequired,resetCancel:ee.default.func.isRequired}),(0,X.default)(xe,"defaultProps",{handleShowPanda:function handleShowPanda(){},currentAlgoSavedModelId:null});o.default=xe;s.exports=o.default},7679:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N=S(_(16)),V=S(_(17)),j=S(_(21)),K=S(_(19)),W=S(_(20)),U=S(_(8)),Y=S(_(7)),$=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),X=S(_(3)),Z=S(_(321)),Q=S(_(33)),ee=S(_(99)),te=S(_(2)),ie=S(_(429)),ae=S(_(272)),ne=S(_(44)),re=S(_(24)),se=_(4),le=S(_(91)),oe=_(73),de=_(29),ce=_(78),he=_(3700),ue=S(_(665)),pe=S(_(2388)),fe=S(_(2389)),ge=S(_(3701)),me=S(_(1744)),ve=S(_(7680)),ye=S(_(7681)),_e=S(_(7682)),Se=S(_(7683)),be=S(_(7685)),Ee=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,K.default)(o),(0,j.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,K.default)(s).constructor):o.apply(s,_))}_(28);var Te=te.default.div(R||(R=(0,Y.default)(["\n\tpadding: 0 20px 10px;\n"]))),Ce=te.default.div(O||(O=(0,Y.default)(["\n\tdisplay:inline-block;\n\tpadding: 0 10px;\n"]))),ke=(0,te.default)(re.default)(P||(P=(0,Y.default)(["\n\tdisplay: inline-flex;\n"]))),xe=(0,te.default)(ne.default)(D||(D=(0,Y.default)(["\n\twidth: 150px;\n\tdisplay: inline-block;\n\tmargin-right: 10px;\n"]))),we=function(s){function PredictiveAnalyticsTestPane(s){var o;(0,N.default)(this,PredictiveAnalyticsTestPane);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,PredictiveAnalyticsTestPane,[s,...S]),(0,U.default)(o,"updateVisualizationsWithTrainedData",s=>{o.resetVisualizations(),o.props.modelAlgorithmType===Ee.ALGO_TYPES.CLASSIFICATION?(o.setState({predictedHealthProgress:ce.SEARCH_PROGRESS.COMPLETED,testResultsSearch:o.props.createModelSearch,averagePredictedSeverityData:o.props.next30AverageSeverity,worstPredictedSeverityData:o.props.next30WorstSeverity,accuracyData:s.get("accuracy"),precisionData:s.get("precision"),recallData:s.get("recall"),f1Data:s.get("f1_score"),testDataSplit:o.props.testDataSplit}),o.performConfusionMatrixSearch(o.serviceId,o.props.trainedModelId,o.props.testPeriodEarliest,o.props.testPeriodLatest)):(o.setState({predictedHealthProgress:ce.SEARCH_PROGRESS.COMPLETED,rsquaredData:s.get("rSquared"),rmseData:s.get("RMSE"),averagePredictedHealthData:o.props.next30AverageHealthScore,worstPredictedHealthData:o.props.next30MinHealthScore,testResultsSearch:o.props.createModelSearch,testDataSplit:o.props.testDataSplit}),o.performHealthScoreComparisonSearch(o.serviceId,o.props.trainedModelId,o.props.testPeriodEarliest,o.props.testPeriodLatest),o.performResidualErrorSearch(o.serviceId,o.props.trainedModelId,o.props.testPeriodEarliest,o.props.testPeriodLatest))}),(0,U.default)(o,"convertDataToVizFormat",s=>{if((0,Q.default)(s.results))return[];var o=s.fields,_=s.results,S={};(0,Z.default)(o,(s,o)=>{S[o]=s.name});var R=o.length,O=[];return(0,Z.default)(_,s=>{for(var o=0;o<R;o++){O[o]||(O[o]=[]);var _=s[S[o]];O[o].push((0,ee.default)(_)?"":_)}}),O}),(0,U.default)(o,"triggerVisualizationSearches",(s,_,S,R,O)=>{o.performHealthScorePredictionSearch(s,_,S,R,O),O===Ee.ALGO_TYPES.CLASSIFICATION?o.performConfusionMatrixSearch(s,_,S,R):(o.performHealthScoreComparisonSearch(s,_,S,R),o.performResidualErrorSearch(s,_,S,R))}),(0,U.default)(o,"handleTimeRangeChange",(s,_)=>{o.props.testPeriodEarliest===s&&o.props.testPeriodLatest===_||o.props.trainedModelId&&(o.resetVisualizations(),o.triggerVisualizationSearches(o.serviceId,o.props.trainedModelId,s,_,o.props.modelAlgorithmType)),o.props.updateTestTimePickerAttributes(s,_,Ee.TEST_DATA_SPLIT_MESSAGES.TEST_ALL_DATA)}),(0,U.default)(o,"onModelSelection",(s,_)=>{var S=_.model_name;if(S!==o.props.trainedModelId){o.resetVisualizations();var R=(0,Ee.getAlgorithmTypeFromModelId)(S);o.triggerVisualizationSearches(o.serviceId,S,o.props.testPeriodEarliest,o.props.testPeriodLatest,R.type),o.props.updateTrainedModelId(S)}}),(0,U.default)(o,"openPredictHealthScoreSearch",()=>{o.onOpenInSearch(o.state.testResultsSearch)}),(0,U.default)(o,"openConfusionMatrixSearch",()=>{o.onOpenInSearch(Ee.SEARCHES.getConfusionMatrixSearch(o.serviceId,o.props.trainedModelId))}),(0,U.default)(o,"openComparisonSearch",()=>{o.onOpenInSearch(Ee.SEARCHES.getComparisonSearch(o.serviceId,o.props.trainedModelId,o.state.testDataSplit))}),(0,U.default)(o,"openResidualErrorSearch",()=>{o.onOpenInSearch(Ee.SEARCHES.getResidualSearch(o.serviceId,o.props.trainedModelId,o.state.testDataSplit))}),(0,U.default)(o,"onOpenInSearch",s=>{(0,Ee.openInSearch)(s,o.props.testPeriodEarliest,o.props.testPeriodLatest)}),(0,U.default)(o,"getSearchErrorMessage",s=>s.toLowerCase().includes("model does not exist")?Ee.MODEL_MISSING_MESSAGE+(0,se.gettext)("retrain it above."):s),(0,U.default)(o,"paEasterEgg",(s,_)=>{if("fluffy"===o.props.service.get("identifying_name")){var S;switch(_){case Ee.ALGO_TYPES.CLASSIFICATION:S="Normal"===s;break;case Ee.ALGO_TYPES.REGRESSION:S=!(isNaN(s)||s<80);break;default:S=null}o.props.handleShowPanda(S)}}),(0,U.default)(o,"performHealthScorePredictionSearch",(s,_,S,R,O)=>{(0,ce.cleanSearchJobSubscriptions)(o.healthScorePredictionManager,o.healthScorePredictionResultSubscription),o.healthScorePredictionManager=le.default.create({id:(0,ce.createUniqueSearchId)("pa-test-pane-health-score-prediction-search"),search:Ee.SEARCHES.getPredictHealthScoreSearch(s,_,!1),earliest_time:S,latest_time:R},{app:(0,oe.getShortAppName)(!0)}),o.healthScorePredictionResultSubscription=o.healthScorePredictionManager.getResults({offset:0,count:0}).subscribe({next:S=>{S.fields?O===Ee.ALGO_TYPES.CLASSIFICATION?(o.setState({predictedHealthProgress:ce.SEARCH_PROGRESS.COMPLETED,recallData:parseFloat(S.results[0].recall),accuracyData:parseFloat(S.results[0].accuracy),precisionData:parseFloat(S.results[0].precision),f1Data:parseFloat(S.results[0].f1),averagePredictedSeverityData:S.results[0].next30m_avg_hsl,worstPredictedSeverityData:S.results[0].next30m_worst_hsl,testResultsSearch:Ee.SEARCHES.getPredictHealthScoreSearch(s,_,!1)}),o.paEasterEgg(S.results[0].next30m_avg_hsl,O)):(o.setState({predictedHealthProgress:ce.SEARCH_PROGRESS.COMPLETED,rsquaredData:parseFloat(S.results[0].rSquared),rmseData:parseFloat(S.results[0].RMSE),averagePredictedHealthData:parseFloat(S.results[0].next30m_avg_hs),worstPredictedHealthData:parseFloat(S.results[0].next30m_worst_hs),testResultsSearch:Ee.SEARCHES.getPredictHealthScoreSearch(s,_,!1)}),o.paEasterEgg(S.results[0].next30m_avg_hs,O)):o.setState({predictedHealthProgress:ce.SEARCH_PROGRESS.NO_RESULTS,testResultsSearch:Ee.SEARCHES.getPredictHealthScoreSearch(s,_,!1)})},error:S=>{o.setState({predictedHealthErrorMessage:o.getSearchErrorMessage(S.message),predictedHealthProgress:ce.SEARCH_PROGRESS.ERROR,testResultsSearch:Ee.SEARCHES.getPredictHealthScoreSearch(s,_,!1)})},complete:()=>{}}),o.setState({predictedHealthProgress:ce.SEARCH_PROGRESS.IN_PROGRESS})}),(0,U.default)(o,"performHealthScoreComparisonSearch",(s,_,S,R)=>{(0,ce.cleanSearchJobSubscriptions)(o.healthScoreComparisonSearchJob,o.healthScoreComparisonResultSubscription),o.healthScoreComparisonSearchJob=le.default.create({id:(0,ce.createUniqueSearchId)("pa-test-pane-health-score-comparison-search"),search:Ee.SEARCHES.getComparisonSearch(s,_,o.state.testDataSplit),earliest_time:S,latest_time:R},{app:(0,oe.getShortAppName)(!0)}),o.healthScoreComparisonResultSubscription=o.healthScoreComparisonSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{o.healthScoreComparisonData=s},error:s=>{o.setState({healthScoreComparisonErrorMessage:o.getSearchErrorMessage(s.message),healthScoreComparisonProgress:ce.SEARCH_PROGRESS.ERROR})},complete:()=>{var s=o.convertDataToVizFormat(o.healthScoreComparisonData);(0,Q.default)(s)?o.setState({healthScoreComparisonProgress:ce.SEARCH_PROGRESS.NO_RESULTS}):o.setState({healthScoreComparisonProgress:ce.SEARCH_PROGRESS.COMPLETED,healthScoreComparisonData:{fields:o.healthScoreComparisonData.fields,columns:s}})}}),o.setState({healthScoreComparisonProgress:ce.SEARCH_PROGRESS.IN_PROGRESS})}),(0,U.default)(o,"performResidualErrorSearch",(s,_,S,R)=>{(0,ce.cleanSearchJobSubscriptions)(o.residualErrorSearchJob,o.residualErrorResultSubscription),o.residualErrorSearchJob=le.default.create({id:(0,ce.createUniqueSearchId)("pa-test-pane-residual-error-search"),search:Ee.SEARCHES.getResidualSearch(s,_,o.state.testDataSplit),earliest_time:S,latest_time:R},{app:(0,oe.getShortAppName)(!0)}),o.residualErrorResultSubscription=o.residualErrorSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{o.residualErrorData=s},error:s=>{o.setState({residualErrorErrorMessage:o.getSearchErrorMessage(s.message),residualErrorProgress:ce.SEARCH_PROGRESS.ERROR})},complete:()=>{var s=o.convertDataToVizFormat(o.residualErrorData);(0,Q.default)(s)?o.setState({residualErrorProgress:ce.SEARCH_PROGRESS.NO_RESULTS}):o.setState({residualErrorProgress:ce.SEARCH_PROGRESS.COMPLETED,residualErrorData:{fields:o.residualErrorData.fields,columns:s}})}}),o.setState({residualErrorProgress:ce.SEARCH_PROGRESS.IN_PROGRESS})}),(0,U.default)(o,"performConfusionMatrixSearch",(s,_,S,R)=>{(0,ce.cleanSearchJobSubscriptions)(o.confusionMatrixSearchJob,o.confusionMatrixResultSubscription),o.confusionMatrixSearchJob=le.default.create({id:(0,ce.createUniqueSearchId)("pa-test-pane-confusion-matrix-search"),search:Ee.SEARCHES.getConfusionMatrixSearch(s,_),earliest_time:S,latest_time:R},{app:(0,oe.getShortAppName)(!0)}),o.confusionMatrixResultSubscription=o.confusionMatrixSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{o.confusionMatrixData=s},error:s=>{o.setState({confusionMatrixErrorMessage:o.getSearchErrorMessage(s.message),confusionMatrixProgress:ce.SEARCH_PROGRESS.ERROR})},complete:()=>{(0,Q.default)(o.confusionMatrixData)?o.setState({confusionMatrixProgress:ce.SEARCH_PROGRESS.NO_RESULTS}):o.setState({confusionMatrixProgress:ce.SEARCH_PROGRESS.COMPLETED,confusionMatrixData:o.confusionMatrixData.results})}}),o.setState({confusionMatrixProgress:ce.SEARCH_PROGRESS.IN_PROGRESS})}),(0,U.default)(o,"updateAlgorithmCollection",s=>{var _=[],S=[],R=JSON.parse(JSON.stringify(o.props.service.get("algorithms").toJSON())),O=new pe.default(R,{parse:!0}),P=(0,Ee.getAvailableModelSet)(s);(0,Z.default)(O.toJSON(),(s,o)=>{if(s instanceof me.default){var R=s.get("modelId");R&&!P.has(R)&&(O.get(o).set("modelId",""),s instanceof ge.default?S[o]=!0:s instanceof fe.default&&(_[o]=!0))}}),o.props.setMissingModels(Ee.ALGO_TYPES.REGRESSION,_),o.props.setMissingModels(Ee.ALGO_TYPES.CLASSIFICATION,S)}),(0,U.default)(o,"performListModelSearch",(s,_,S)=>{(0,ce.cleanSearchJobSubscriptions)(o.listModelSearchJob,o.listModelResultSubscription),o.listModelSearchJob=le.default.create({id:(0,ce.createUniqueSearchId)("pa-test-pane-list-model-search"),search:Ee.SEARCHES.getModelSearch(s),earliest_time:_,latest_time:S},{app:(0,oe.getShortAppName)(!0)}),o.listModelResultSubscription=o.listModelSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{o.updateAlgorithmCollection(s.results)},error:s=>{o.setState({listingModelErrorMessage:(0,Ee.getPredictionErrorMessage)(s.message),listingModelProgress:ce.SEARCH_PROGRESS.ERROR})},complete:()=>{o.setState({listingModelProgress:ce.SEARCH_PROGRESS.COMPLETED})}}),o.setState({listingModelProgress:ce.SEARCH_PROGRESS.IN_PROGRESS})}),(0,U.default)(o,"openInSearch",s=>{var _;switch(s){case Ee.PANEL_TYPE.R2:case Ee.PANEL_TYPE.RMSE:_=o.openPredictHealthScoreSearch;break;case Ee.PANEL_TYPE.HEALTHSCORE_COMPARISON:_=o.openComparisonSearch;break;case Ee.PANEL_TYPE.RESIDUAL_ERROR:_=o.openResidualErrorSearch;break;case Ee.PANEL_TYPE.AVG_HEALTHSCORE:case Ee.PANEL_TYPE.WORST_HEALTHSCORE:case Ee.PANEL_TYPE.PRECISION:case Ee.PANEL_TYPE.RECALL:case Ee.PANEL_TYPE.ACCURACY:case Ee.PANEL_TYPE.F1:_=o.openPredictHealthScoreSearch;break;case Ee.PANEL_TYPE.CONFUSION:_=o.openConfusionMatrixSearch;break;case Ee.PANEL_TYPE.AVG_SEVERITY:case Ee.PANEL_TYPE.WORST_SEVERITY:_=o.openPredictHealthScoreSearch}return _}),(0,U.default)(o,"getDisabledState",s=>{var _=!0,S=o.state.predictedHealthProgress===ce.SEARCH_PROGRESS.ERROR||o.state.predictedHealthProgress===ce.SEARCH_PROGRESS.NO_RESULTS,R=o.state.healthScoreComparisonProgress===ce.SEARCH_PROGRESS.ERROR||o.state.healthScoreComparisonProgress===ce.SEARCH_PROGRESS.NO_RESULTS,O=o.state.residualErrorProgress===ce.SEARCH_PROGRESS.ERROR||o.state.residualErrorProgress===ce.SEARCH_PROGRESS.NO_RESULTS;switch(s){case Ee.PANEL_TYPE.R2:_=!S&&(0,de.isUndefinedOrNull)(o.state.rsquaredData);break;case Ee.PANEL_TYPE.RMSE:_=!S&&(0,de.isUndefinedOrNull)(o.state.rmseData);break;case Ee.PANEL_TYPE.HEALTHSCORE_COMPARISON:_=!R&&(0,de.isUndefinedOrNull)(o.state.healthScoreComparisonData);break;case Ee.PANEL_TYPE.RESIDUAL_ERROR:_=!O&&(0,de.isUndefinedOrNull)(o.state.residualErrorData);break;case Ee.PANEL_TYPE.AVG_HEALTHSCORE:_=!S&&(0,de.isUndefinedOrNull)(o.state.averagePredictedHealthData);break;case Ee.PANEL_TYPE.WORST_HEALTHSCORE:_=!S&&(0,de.isUndefinedOrNull)(o.state.worstPredictedHealthData);break;case Ee.PANEL_TYPE.PRECISION:_=(0,de.isUndefinedOrNull)(o.state.precisionData);break;case Ee.PANEL_TYPE.RECALL:_=(0,de.isUndefinedOrNull)(o.state.recallData);break;case Ee.PANEL_TYPE.ACCURACY:_=(0,de.isUndefinedOrNull)(o.state.accuracyData);break;case Ee.PANEL_TYPE.F1:_=(0,de.isUndefinedOrNull)(o.state.f1Data);break;case Ee.PANEL_TYPE.CONFUSION:_=(0,de.isUndefinedOrNull)(o.state.confusionMatrixData);break;case Ee.PANEL_TYPE.AVG_SEVERITY:_=(0,de.isUndefinedOrNull)(o.state.averagePredictedSeverityData);break;case Ee.PANEL_TYPE.WORST_SEVERITY:_=(0,de.isUndefinedOrNull)(o.state.worstPredictedSeverityData)}return _}),(0,U.default)(o,"generateRegressionModelTable",()=>{var s=(0,se.gettext)("The recommended model is the model that most closely predicts a service's health score. The recommendation might not be accurate if you change the test period."),_=$.default.createElement(ve.default,{tableDataTestItsi:"pa-regression-models-table",trainedModelId:o.props.trainedModelId,data:o.props.service.get("algorithms"),hasRecommendation:!0,loadSelection:o.onModelSelection,tooltipText:s,algoType:he.ALGORITHM_TYPES.REGRESSION,disableRows:o.props.disableWhileTraining,listingModelProgress:o.state.listingModelProgress,listingModelErrorMessage:o.state.listingModelErrorMessage,missingModels:o.props.missingRegressionModels});return $.default.createElement(ae.default,{"data-test-itsi":"regression-models-card"},$.default.createElement(ae.default.Header,{title:(0,se.gettext)("Regression Models")}),_)}),(0,U.default)(o,"generateClassificationModelTable",()=>{var s=$.default.createElement(ve.default,{tableDataTestItsi:"pa-classification-models-table",trainedModelId:o.props.trainedModelId,data:o.props.service.get("algorithms"),hasRecommendation:!1,loadSelection:o.onModelSelection,algoType:he.ALGORITHM_TYPES.CLASSIFICATION,disableRows:o.props.disableWhileTraining,listingModelProgress:o.state.listingModelProgress,listingModelErrorMessage:o.state.listingModelErrorMessage,missingModels:o.props.missingClassificationModels});return $.default.createElement(ae.default,{"data-test-itsi":"classification-models-card"},$.default.createElement(ae.default.Header,{title:(0,se.gettext)("Classification Models")}),s)}),(0,U.default)(o,"resetVisualizations",()=>{o.setState({rsquaredData:null,rmseData:null,averagePredictedHealthData:null,worstPredictedHealthData:null,worstPredictedSeverityData:null,averagePredictedSeverityData:null,healthScoreComparisonData:null,healthScoreComparisonProgress:ce.SEARCH_PROGRESS.NOT_STARTED,healthScoreComparisonErrorMessage:"",residualErrorData:null,residualErrorProgress:ce.SEARCH_PROGRESS.NOT_STARTED,residualErrorErrorMessage:"",f1Data:null,recallData:null,accuracyData:null,precisionData:null,confusionMatrixData:null,confusionMatrixErrorMessage:"",confusionMatrixProgress:ce.SEARCH_PROGRESS.NOT_STARTED,testDataSplit:100})}),(0,U.default)(o,"getMessageElement",()=>{var s=o.props.testDataSplitMessage===Ee.TEST_DATA_SPLIT_MESSAGES.TEST_NO_DATA?"warning":"info";return $.default.createElement(ke,{"data-test-itsi":"pa-test-pane-message",type:s},o.props.testDataSplitMessage)}),(0,U.default)(o,"handleAlertRequestOpen",()=>{o.setState({alertOpen:!0})}),(0,U.default)(o,"handleAlertRequestClose",()=>{o.setState({alertOpen:!1})}),o.state={displayModelTable:!1,rsquaredData:null,rmseData:null,averagePredictedHealthData:null,worstPredictedHealthData:null,worstPredictedSeverityData:null,averagePredictedSeverityData:null,predictedHealthProgress:ce.SEARCH_PROGRESS.NOT_STARTED,predictedHealthErrorMessage:"",healthScoreComparisonData:null,healthScoreComparisonProgress:ce.SEARCH_PROGRESS.NOT_STARTED,healthScoreComparisonErrorMessage:"",residualErrorData:null,residualErrorProgress:ce.SEARCH_PROGRESS.NOT_STARTED,residualErrorErrorMessage:"",testResultsSearch:"",alertOpen:!1,accuracyData:null,precisionData:null,recallData:null,f1Data:null,confusionMatrixData:null,confusionMatrixProgress:ce.SEARCH_PROGRESS.NOT_STARTED,confusionMatrixErrorMessage:"",testDataSplit:100,listingModelProgress:ce.SEARCH_PROGRESS.NOT_STARTED,listingModelErrorMessage:""},o.serviceId=o.props.service.get("_key"),o}return(0,W.default)(PredictiveAnalyticsTestPane,s),(0,V.default)(PredictiveAnalyticsTestPane,[{key:"componentDidUpdate",value:function componentDidUpdate(){if(this.props.trainTestWorkflowStep===Ee.TRAIN_TEST_WORKFLOW_STEP.TRAIN_TO_TEST){var s=this.props.service.get("algorithms"),o=(0,Ee.getAlgorithmTypeFromModelId)(this.props.trainedModelId),_=s.get(o.value);this.updateVisualizationsWithTrainedData(_),this.props.handleTrainTestWorkflowStepUpdate(Ee.TRAIN_TEST_WORKFLOW_STEP.TEST)}this.state.predictedHealthProgress===ce.SEARCH_PROGRESS.COMPLETED&&this.props.saveSelectedInfo(this.props.trainedModelId,this.props.testPeriodEarliest,this.props.testPeriodLatest),this.state.listingModelProgress===ce.SEARCH_PROGRESS.NOT_STARTED&&this.performListModelSearch(this.serviceId,this.props.testPeriodEarliest,this.props.testPeriodLatest)}},{key:"componentWillUnmount",value:function componentWillUnmount(){(0,ce.cleanSearchJobSubscriptions)(this.healthScorePredictionManager,this.healthScorePredictionResultSubscription),(0,ce.cleanSearchJobSubscriptions)(this.healthScoreComparisonSearchJob,this.healthScoreComparisonResultSubscription),(0,ce.cleanSearchJobSubscriptions)(this.residualErrorSearchJob,this.residualErrorResultSubscription),(0,ce.cleanSearchJobSubscriptions)(this.confusionMatrixSearchJob,this.confusionMatrixResultSubscription),(0,ce.cleanSearchJobSubscriptions)(this.listModelSearchJob,this.listModelResultSubscription)}},{key:"componentDidMount",value:function componentDidMount(){this.resetVisualizations(),(this.props.didSaveService||this.props.cancelChanges)&&this.props.trainedModelId&&this.triggerVisualizationSearches(this.serviceId,this.props.trainedModelId,this.props.testPeriodEarliest,this.props.testPeriodLatest,this.props.modelAlgorithmType)}},{key:"render",value:function render(){var s=(0,se.gettext)("The span of time available to test the model created from training."),o=this.props.isValidTimePeriod(this.props.testPeriodEarliest,this.props.testPeriodLatest)&&this.serviceId,_=!(!this.props.trainedModelId||!o),S=this.getMessageElement();return $.default.createElement(Te,{className:"predictive-analytics-create-test-container","data-test-itsi":"predictive-analytics-test-pane"},$.default.createElement(Te,null,$.default.createElement(Ce,null,$.default.createElement(xe,{"data-test-itsi":"pa-test-period-control-group",label:(0,se.gettext)("Test Period"),tooltip:s,labelPosition:"top"},$.default.createElement(ue.default,{advancedInputTypes:this.props.timePickerAttributes.advancedInputTypes,disabled:this.props.disableWhileTraining,handleTimeRangeChange:this.handleTimeRangeChange,earliest:this.props.testPeriodEarliest,formInputTypes:this.props.timePickerAttributes.formInputTypes,latest:this.props.testPeriodLatest,skipRealTimePresets:!0})),this.props.disableWhileTraining||this.props.isReadOnly?"":S),$.default.createElement("div",null,$.default.createElement(ie.default,{"data-test-itsi":"pa-test-panel-card-layout"},this.generateRegressionModelTable(),this.generateClassificationModelTable()))),this.props.modelAlgorithmType===Ee.ALGO_TYPES.REGRESSION&&$.default.createElement("div",null,$.default.createElement(Se.default,{service:this.props.service,showVisualizations:_,openInSearch:this.openInSearch,getDisabledState:this.getDisabledState,rsquaredData:this.state.rsquaredData,rmseData:this.state.rmseData,healthScoreComparisonData:this.state.healthScoreComparisonData,healthScoreComparisonProgress:this.state.healthScoreComparisonProgress,healthScoreComparisonErrorMessage:this.state.healthScoreComparisonErrorMessage,residualErrorData:this.state.residualErrorData,residualErrorProgress:this.state.residualErrorProgress,residualErrorErrorMessage:this.state.residualErrorErrorMessage,predictedHealthProgress:this.state.predictedHealthProgress,predictedHealthErrorMessage:this.state.predictedHealthErrorMessage,averagePredictedHealthData:this.state.averagePredictedHealthData,worstPredictedHealthData:this.state.worstPredictedHealthData,handleAlertRequestOpen:this.handleAlertRequestOpen}),$.default.createElement(ye.default,{minHealthScore:parseFloat(this.state.worstPredictedHealthData),service:this.props.service,modelId:this.props.trainedModelId,alertSearch:Ee.SEARCHES.getWorstHealthScoreSearch(this.serviceId,this.props.trainedModelId),openState:this.state.alertOpen,handleClose:this.handleAlertRequestClose})),this.props.modelAlgorithmType===Ee.ALGO_TYPES.CLASSIFICATION&&$.default.createElement("div",null,$.default.createElement(be.default,{service:this.props.service,showVisualizations:_,openInSearch:this.openInSearch,getDisabledState:this.getDisabledState,predictedHealthProgress:this.state.predictedHealthProgress,predictedHealthErrorMessage:this.state.predictedHealthErrorMessage,averagePredictedSeverityData:this.state.averagePredictedSeverityData,worstPredictedSeverityData:this.state.worstPredictedSeverityData,accuracyData:this.state.accuracyData,precisionData:this.state.precisionData,recallData:this.state.recallData,f1Data:this.state.f1Data,confusionMatrixData:this.state.confusionMatrixData,confusionMatrixProgress:this.state.confusionMatrixProgress,confusionMatrixErrorMessage:this.state.confusionMatrixErrorMessage,handleAlertRequestOpen:this.handleAlertRequestOpen}),$.default.createElement(_e.default,{worstHealthSeverity:this.state.worstPredictedSeverityData,service:this.props.service,modelId:this.props.trainedModelId,alertSearch:Ee.SEARCHES.getWorstHealthSeveritySearch(this.serviceId,this.props.trainedModelId),openState:this.state.alertOpen,handleClose:this.handleAlertRequestClose})))}}])}($.Component);(0,U.default)(we,"propTypes",{isValidTimePeriod:X.default.func.isRequired,service:X.default.object.isRequired,createModelSearch:X.default.string.isRequired,disableWhileTraining:X.default.bool.isRequired,saveSelectedInfo:X.default.func.isRequired,didSaveService:X.default.bool.isRequired,isReadOnly:X.default.bool.isRequired,testDataSplit:X.default.number.isRequired,testDataSplitMessage:X.default.string.isRequired,trainedModelId:X.default.string.isRequired,modelAlgorithmType:X.default.number.isRequired,updateTestTimePickerAttributes:X.default.func.isRequired,updateTrainedModelId:X.default.func.isRequired,trainTestWorkflowStep:X.default.number.isRequired,handleTrainTestWorkflowStepUpdate:X.default.func.isRequired,timePickerAttributes:X.default.object.isRequired,testPeriodEarliest:X.default.string.isRequired,testPeriodLatest:X.default.string,next30AverageHealthScore:X.default.number,next30WorstSeverity:X.default.string,next30AverageSeverity:X.default.string,next30MinHealthScore:X.default.number,handleShowPanda:X.default.func,cancelChanges:X.default.bool.isRequired,missingRegressionModels:X.default.array,missingClassificationModels:X.default.array,setMissingModels:X.default.func.isRequired}),(0,U.default)(we,"defaultProps",{testPeriodLatest:"now",next30AverageHealthScore:null,next30MinHealthScore:null,next30WorstSeverity:null,next30AverageSeverity:null,handleShowPanda:function handleShowPanda(){},missingRegressionModels:[],missingClassificationModels:[]});o.default=we;s.exports=o.default},7680:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D=S(_(16)),N=S(_(17)),V=S(_(21)),j=S(_(19)),K=S(_(20)),W=S(_(8)),U=S(_(7)),Y=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),$=S(_(3)),X=S(_(2)),Z=_(14),Q=_(4),ee=S(_(272)),te=S(_(583)),ie=S(_(24)),ae=S(_(93)),ne=S(_(89)),re=_(22),se=S(_(238)),le=_(78),oe=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,j.default)(o),(0,V.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,j.default)(s).constructor):o.apply(s,_))}_(28);var de=(0,X.default)(ne.default)(R||(R=(0,U.default)(["\n\tmargin-left: 5px;\n"]))),ce=X.default.span(O||(O=(0,U.default)(["\n\tdisplay: block;\n\twidth: 450px;\n"]))),he=(0,X.default)(ie.default)(P||(P=(0,U.default)(["\n\tdisplay: inline-flex;\n"]))),ue=function(s){function PredictiveAnalyticsModelTable(s){var o;(0,D.default)(this,PredictiveAnalyticsModelTable);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,PredictiveAnalyticsModelTable,[s,...S]),(0,W.default)(o,"getSelectedRowStyle",s=>o.props.trainedModelId===s?{backgroundColor:re.variables.accentColorL50}:{}),(0,W.default)(o,"getTableRows",s=>{var _=o.props.data&&o.props.data.getAlgorithmsByType(o.props.algoType).filter(s=>""!==s.model_name)||[];if(_.length<1){var S=oe.PREDICTIVE_ANALYTICS_ALGORITHM_TYPE.find(s=>s.name===o.props.algoType),R=(0,Z.sprintf)((0,Q.gettext)("No models found. Train and create a %(algoName)s model above."),{algoName:S?S.labelLowerCase:(0,Q.gettext)("not found")});return Y.default.createElement(ae.default.Row,{"data-test-itsi":"pa-model-table-row-empty",key:"no-models-found"},Y.default.createElement(ae.default.Cell,{"data-test-itsi":"pa-model-table-cell-empty"},R))}return _.map(_=>{if(!(_.algorithm_name in o.props.missingModels)){var S=o.getSelectedRowStyle(_.model_name);return o.props.disableRows?Y.default.createElement(ae.default.Row,{"data-test-itsi":"pa-models-table-row",key:_.model_name,data:_,style:S},Y.default.createElement(ae.default.Cell,{"data-test-itsi":"pa-models-table-algorithm-cell"},(0,oe.getAlgorithmLabelLabel)(_.algorithm_name)),s?Y.default.createElement(ae.default.Cell,{"data-test-itsi":"pa-models-table-recommended-cell"},_.recommended?Y.default.createElement(te.default,null):""):null):Y.default.createElement(ae.default.Row,{"data-test-itsi":"pa-models-table-row",key:_.model_name,data:_,onClick:o.props.loadSelection,style:S},Y.default.createElement(ae.default.Cell,{"data-test-itsi":"pa-models-table-algorithm-cell"},(0,oe.getAlgorithmLabelLabel)(_.algorithm_name)),s?Y.default.createElement(ae.default.Cell,{"data-test-itsi":"pa-models-table-recommended-cell"},_.recommended?Y.default.createElement(te.default,null):""):null)}})}),(0,W.default)(o,"getTooltipContent",s=>Y.default.createElement(ce,null,s)),(0,W.default)(o,"generateModelListTable",()=>{var s;switch(o.props.listingModelProgress){case le.SEARCH_PROGRESS.NOT_STARTED:break;case le.SEARCH_PROGRESS.IN_PROGRESS:s=oe.SEARCH_PROGRESS_ELEMENTS.getSearchInProgressElement();break;case le.SEARCH_PROGRESS.ERROR:s=oe.SEARCH_PROGRESS_ELEMENTS.getErrorMessageElement(o.props.listingModelErrorMessage);break;case le.SEARCH_PROGRESS.NO_RESULTS:case le.SEARCH_PROGRESS.COMPLETED:var _=o.props.tooltipText,S=o.props.hasRecommendation,R=o.getTableRows(S);s=Y.default.createElement(ae.default,{"data-test-itsi":o.props.tableDataTestItsi,stripeRows:!0},Y.default.createElement(ae.default.Head,null,Y.default.createElement(ae.default.HeadCell,{"data-test-itsi":"pa-models-table-algorithm-column-header"},(0,Q.gettext)("Algorithm")),S?Y.default.createElement(ae.default.HeadCell,{"data-test-itsi":"pa-models-table-recommended-column-header"},(0,Q.gettext)("Recommended"),Y.default.createElement(de,{content:o.getTooltipContent(_),"data-test-itsi":"pa-model-algorithm-tooltip"})):null),Y.default.createElement(ae.default.Body,null,R))}return s}),(0,W.default)(o,"getMissingModelMessageElement",()=>{var s=Object.keys(o.props.missingModels).length;return 0===s?null:Y.default.createElement(he,{"data-test-itsi":"pa-model-table-warning-message",type:"warning"},(0,oe.formatMissingModels)(o.props.missingModels,s),1===s?oe.MODEL_MISSING_MESSAGES.CREATION_DASHBOARD:oe.MODEL_MISSING_MESSAGES.CREATION_DASHBOARD_PLURAL)}),o.state={},o}return(0,K.default)(PredictiveAnalyticsModelTable,s),(0,N.default)(PredictiveAnalyticsModelTable,[{key:"render",value:function render(){return Y.default.createElement(ee.default.Body,null,this.getMissingModelMessageElement(),this.generateModelListTable())}}])}(Y.Component);(0,W.default)(ue,"propTypes",{trainedModelId:$.default.string.isRequired,tableDataTestItsi:$.default.string.isRequired,data:$.default.object.isRequired,hasRecommendation:$.default.bool.isRequired,loadSelection:$.default.func.isRequired,tooltipText:$.default.string,algoType:$.default.string.isRequired,disableRows:$.default.bool.isRequired,listingModelProgress:$.default.number.isRequired,listingModelErrorMessage:$.default.string.isRequired,missingModels:$.default.array.isRequired}),(0,W.default)(ue,"defaultProps",{data:null,errorMessage:"",tooltipText:""});o.default=(0,se.default)(ue);s.exports=o.default},7681:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U=S(_(16)),Y=S(_(17)),$=S(_(21)),X=S(_(19)),Z=S(_(20)),Q=S(_(8)),ee=S(_(7)),te=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),ie=S(_(3)),ae=S(_(50)),ne=S(_(172)),re=S(_(2)),se=_(14),le=_(4),oe=S(_(27)),de=S(_(44)),ce=S(_(24)),he=S(_(100)),ue=S(_(66)),pe=S(_(314)),fe=S(_(51)),ge=S(_(83)),me=_(22),ve=_(1423),ye=_(184),_e=_(151),Se=S(_(1030)),be=S(_(189)),Ee=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,X.default)(o),(0,$.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,X.default)(s).constructor):o.apply(s,_))}_(28);var Te=(0,re.default)(ue.default)(R||(R=(0,ee.default)(["\n\twidth: 100%;\n"]))),Ce=(0,re.default)(ge.default)(O||(O=(0,ee.default)(["\n\twidth: 50px;\n\tborder-top-right-radius: 3px;\n\tborder-bottom-right-radius: 3px;\n\tborder-right: 1px solid ",";\n"])),me.variables.borderColor),ke=(0,re.default)(ge.default)(P||(P=(0,ee.default)(["\n\twidth: 50px;\n"]))),xe=(0,re.default)(pe.default)(D||(D=(0,ee.default)(["\n\tcolor: ",";\n"])),s=>s.color),getBoxFilled=s=>te.default.createElement(xe,{color:s,variant:"filled"}),we=(0,re.default)(fe.default)(N||(N=(0,ee.default)(["\n\tpadding: 5px 10px;\n\tmargin: auto;\n"]))),Re=(0,re.default)(de.default)(V||(V=(0,ee.default)(['\n\tbutton[data-test="clickable"] {\n\t\tmargin-bottom: 5px;\n\t}\n']))),Ie=(0,re.default)(ge.default)(j||(j=(0,ee.default)(["\n\tspan > textarea {\n\t\tpadding: 5px 10px !important;\n\t}\n"]))),Me=(0,re.default)(ge.default)(K||(K=(0,ee.default)(["\n\tspan > div {\n\t\tdisplay: none;\n\t}\n"]))),Oe=(0,re.default)(he.default)(W||(W=(0,ee.default)(["\n\twidth: 650px;\n"]))),Ae={LESS_THAN:{symbol:"<",label:(0,le.gettext)("less than")},LESS_EQUAL:{symbol:"<=",label:(0,le.gettext)("less than or equal to")},BETWEEN:{symbol:"<<",label:(0,le.gettext)("between")},BETWEEN_EQUAL:{symbol:"<=<=",label:(0,le.gettext)("between (inclusive)")}},Pe=0,De=1,Le=2,Ne=3,Ve=function(s){function PredictiveAnalyticsCreateAlert(s){var o;(0,U.default)(this,PredictiveAnalyticsCreateAlert);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,PredictiveAnalyticsCreateAlert,[s,...S]),(0,Q.default)(o,"componentDidMount",()=>{be.default.getNotableEventsConfigsInfo().done(function(s){this.setState({notableEventSeverities:s.severities})}.bind(o))}),(0,Q.default)(o,"componentDidUpdate",s=>{o.props.openState&&s.openState!==o.props.openState&&""===o.state.maxInputValue&&""===o.state.notableEventTitle&&o.setTitleAndTrigger(),o.props.modelId&&s.modelId!==o.props.modelId&&o.setState({customTitle:!1,maxInputValue:"",notableEventTitle:""}),o.props.openState||s.openState===o.props.openState||o.resetDefaults()}),(0,Q.default)(o,"createCorrelationSearch",()=>{if(""===o.state.maxInputValue)o.setState({maxInputError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.EMPTY});else if(o.state.triggerOperator!==Ae.BETWEEN.symbol&&o.state.triggerOperator!==Ae.BETWEEN_EQUAL.symbol||""!==o.state.minInputValue)if(""===o.state.searchName)o.setState({searchNameError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.SEARCH_NAME});else if(""===o.state.notableEventTitle)o.setState({notableEventTitleError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.EMPTY_TITLE});else{o.setCorrelationSearch();var s=o.correlationSearchModel.save();o.setState({alertState:De}),s.done(function(){this.setState({alertState:Ne})}.bind(o)).fail(function(s){var o=(0,_e.extractErrorMsgFromResponse)(s);this.setState({alertErrorMessage:(0,se.sprintf)(Ee.ALERT_ERROR_MESSAGES.ERROR_SAVING+" %s.",o),alertState:Le}),o.includes("already exists")&&this.setState({searchNameError:!0})}.bind(o))}else o.setState({minInputError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.EMPTY})}),(0,Q.default)(o,"setCorrelationSearch",()=>{var s=o.props.alertSearch+" | where next30m_worst_hs ";o.state.triggerOperator===Ae.BETWEEN.symbol?s+=Ae.LESS_THAN.symbol+" "+o.state.maxInputValue+" AND next30m_worst_hs > "+o.state.minInputValue:o.state.triggerOperator===Ae.BETWEEN_EQUAL.symbol?s+=Ae.LESS_EQUAL.symbol+" "+o.state.maxInputValue+" AND next30m_worst_hs >= "+o.state.minInputValue:s+=o.state.triggerOperator+" "+o.state.maxInputValue;var _=(0,ve.uiEditURL)("predictive_analytics_usage",{model_id:o.props.modelId,service_id:o.serviceId,auto_load:!0});o.correlationSearchModel.set({search:s,name:o.state.searchName,cron_schedule:o.state.schedule,"dispatch.earliest_time":"-1h","action.itsi_event_generator.param.drilldown_uri":_,"action.itsi_event_generator.param.title":o.state.notableEventTitle,"action.itsi_event_generator.param.severity":o.state.eventSeverity,"action.itsi_event_generator.param.drilldown_title":(0,se.sprintf)((0,le.gettext)("Predictive Analytics %s Dashboard"),o.serviceName),"action.itsi_event_generator.param.service_ids":o.serviceId})}),(0,Q.default)(o,"handleInputSearchName",(s,_)=>{var{value:S}=_;o.setState({searchName:S}),o.state.searchNameError&&o.setState({searchNameError:!1,alertState:Pe})}),(0,Q.default)(o,"handleComparison",(s,_)=>{var{value:S}=_;o.setNotableEventTitle(o.state.minInputValue,o.state.maxInputValue,S),o.setState({triggerOperator:S})}),(0,Q.default)(o,"handleInputTitle",(s,_)=>{var{value:S}=_;o.setState({customTitle:!0,notableEventTitle:S}),o.state.notableEventTitleError&&o.setState({notableEventTitleError:!1,alertState:Pe})}),(0,Q.default)(o,"handleSchedulingSelection",(s,_)=>{var{value:S}=_;o.setState({schedule:S})}),(0,Q.default)(o,"handleSeveritySelection",(s,_)=>{var{value:S}=_;o.setState({eventSeverity:S})}),(0,Q.default)(o,"onMaxTriggerInput",(s,_)=>{var{value:S}=_,R=parseFloat(S);isNaN(S)||R<=0?o.setState({maxInputValue:S,maxInputError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.INTEGER}):R>100?o.setState({maxInputValue:S,maxInputError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.HUNDRED}):R<parseFloat(o.state.minInputValue)?o.setState({maxInputValue:S,maxInputError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.MAX_ERROR}):(o.setState({maxInputValue:S}),o.state.maxInputError&&o.setState({maxInputError:!1,alertState:Pe}),o.state.minInputError&&o.setState({minInputError:!1})),o.setNotableEventTitle(o.state.minInputValue,S,o.state.triggerOperator)}),(0,Q.default)(o,"onMinTriggerInput",(s,_)=>{var{value:S}=_,R=parseFloat(S);isNaN(S)?o.setState({minInputValue:S,minInputError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.INTEGER}):R<0?o.setState({minInputValue:S,minInputError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.NEGATIVE}):R>parseFloat(o.state.maxInputValue)?o.setState({minInputValue:S,minInputError:!0,alertState:Le,alertErrorMessage:Ee.ALERT_ERROR_MESSAGES.MIN_ERROR}):(o.setState({minInputValue:S}),o.state.minInputError&&o.setState({minInputError:!1,alertState:Pe}),o.state.maxInputError&&o.setState({maxInputError:!1})),o.setNotableEventTitle(S,o.state.maxInputValue,o.state.triggerOperator)}),(0,Q.default)(o,"renderTriggerText",s=>{var _=[];return _.push(te.default.createElement(ke,{"data-test-itsi":"pa-create-alert-max-text",error:o.state.maxInputError,key:"input-trigger-max",value:o.state.maxInputValue,onChange:o.onMaxTriggerInput})),s!==Ae.BETWEEN_EQUAL.symbol&&s!==Ae.BETWEEN.symbol||(_.unshift(te.default.createElement(we,{key:"and-separator"}," ",(0,le.gettext)("and")," ")),_.unshift(te.default.createElement(Ce,{"data-test-itsi":"trigger-min-text",error:o.state.minInputError,key:"input-trigger-min",value:o.state.minInputValue,onChange:o.onMinTriggerInput}))),_}),(0,Q.default)(o,"renderTrigger",()=>te.default.createElement(de.default,{"data-test-itsi":"pa-trigger-operator",label:(0,le.gettext)("Create a notable event when predicted health score is"),labelWidth:o.labelTextWidth,controlsLayout:"fillJoin"},te.default.createElement(ue.default,{"data-test-itsi":"pa-trigger-operator-select",value:o.state.triggerOperator,onChange:o.handleComparison},(0,ae.default)(Ae,s=>te.default.createElement(ue.default.Option,{"data-test-itsi":"pa-trigger-operator-select-option",key:s.label,label:s.label,value:s.symbol}))),o.renderTriggerText(o.state.triggerOperator))),(0,Q.default)(o,"renderRunSchedule",()=>te.default.createElement(Te,{"data-test-itsi":"pa-scheduling-select",value:o.state.schedule,onChange:o.handleSchedulingSelection},(0,ae.default)(ye.BASIC_CRON_SCHEDULE_ARRAY,(function(s){return te.default.createElement(ue.default.Option,{"data-test-itsi":"pa-scheduling-select-option",key:s.value,label:s.label,value:s.value})})))),(0,Q.default)(o,"setNotableEventTitle",(s,_,S)=>{if(!o.state.customTitle)switch(S){case Ae.LESS_THAN.symbol:o.setState({notableEventTitle:(0,se.sprintf)((0,le.gettext)("%s's health score is predicted to drop below %s in 30 minutes"),o.serviceName,_)});break;case Ae.LESS_EQUAL.symbol:o.setState({notableEventTitle:(0,se.sprintf)((0,le.gettext)("%s's health score is predicted to hit or drop below %s in 30 minutes"),o.serviceName,_)});break;case Ae.BETWEEN.symbol:o.setState({notableEventTitle:(0,se.sprintf)((0,le.gettext)("%s's health score is predicted to drop between %s and %s in 30 minutes"),o.serviceName,s,_)});break;case Ae.BETWEEN_EQUAL.symbol:o.setState({notableEventTitle:(0,se.sprintf)((0,le.gettext)("%s's health score is predicted to drop between %s and %s (inclusive) in 30 minutes"),o.serviceName,s,_)})}}),(0,Q.default)(o,"renderSeverityOptions",()=>{var s=o.state.notableEventSeverities;return s=(0,ne.default)(s,"value"),te.default.createElement(Te,{"data-test-itsi":"pa-event-severity-select",value:o.state.eventSeverity,onChange:o.handleSeveritySelection},(0,ae.default)(s,(function(s){return te.default.createElement(ue.default.Option,{"data-test-itsi":"pa-event-severity-select-option",key:s.value,label:s.label,icon:getBoxFilled(s.color),value:s.value})})))}),(0,Q.default)(o,"resetDefaults",()=>{o.setState({searchName:(0,se.sprintf)((0,le.gettext)("Predicted worst case health score for %s service"),o.serviceName),searchNameError:!1,maxInputError:!1,maxInputValue:"",minInputError:!1,minInputValue:"0",triggerOperator:Ae.LESS_EQUAL.symbol,alertErrorMessage:"",alertState:Pe,notableEventTitle:"",notableEventTitleError:!1,schedule:"*/5 * * * *",eventSeverity:"6",customTitle:!1})}),(0,Q.default)(o,"setTitleAndTrigger",()=>{o.setState({maxInputValue:o.props.minHealthScore.toFixed(2),notableEventTitle:(0,se.sprintf)((0,le.gettext)("%s's health score is predicted to hit or drop below %s in 30 minutes"),o.serviceName,o.props.minHealthScore.toFixed(2))})}),(0,Q.default)(o,"renderModalBody",()=>o.state.alertState===Ne?(0,Ee.confirmationModalBody)():te.default.createElement(he.default.Body,null,o.state.alertState===Le&&te.default.createElement(ce.default,{"data-test-itsi":"pa-create-alert-error-message",type:"error"},o.state.alertErrorMessage),te.default.createElement(de.default,{"data-test-itsi":"pa-create-alert-search-name",label:(0,le.gettext)("Search Name"),labelWidth:o.labelTextWidth},te.default.createElement(Me,{"data-test-itsi":"pa-create-alert-search-name-text",value:o.state.searchName,error:o.state.searchNameError,onChange:o.handleInputSearchName,canClear:!0})),o.renderTrigger(),te.default.createElement(Re,{"data-test-itsi":"pa-create-alert-title",label:(0,le.gettext)("Notable Event Title"),labelWidth:o.labelTextWidth,tooltip:(0,le.gettext)("The title automatically updates with input value(s) unless you manually change it.")},te.default.createElement(Ie,{"data-test-itsi":"pa-create-alert-input-title-text",value:o.state.notableEventTitle,onChange:o.handleInputTitle,error:o.state.notableEventTitleError})),te.default.createElement(de.default,{"data-test-itsi":"predictive-analytics-notable-event-run-every",label:(0,le.gettext)("Run Every"),labelWidth:o.labelTextWidth,controlsLayout:"none"},o.renderRunSchedule()),te.default.createElement(de.default,{"data-test-itsi":"predictive-analytics-notable-event-severity",label:(0,le.gettext)("Severity"),tooltip:(0,le.gettext)("The initial severity of a newly created notable event."),labelWidth:o.labelTextWidth,controlsLayout:"none"},o.renderSeverityOptions()))),(0,Q.default)(o,"renderFooter",()=>{var s=o.state.maxInputError||o.state.minInputError||o.state.searchNameError||o.state.alertState===De;return o.state.alertState===Ne?te.default.createElement(he.default.Footer,null,te.default.createElement(oe.default,{appearance:"primary","data-test-itsi":"pa-create-alert-ok-button",onClick:o.props.handleClose,label:(0,le.gettext)("OK")})):o.state.alertState===De?te.default.createElement(he.default.Footer,null,te.default.createElement(oe.default,{"data-test-itsi":"pa-create-alert-save-button",disabled:s,appearance:"primary",label:(0,le.gettext)("Saving...")})):te.default.createElement(he.default.Footer,null,te.default.createElement(oe.default,{appearance:"secondary","data-test-itsi":"pa-create-alert-cancel-button",onClick:o.props.handleClose,label:(0,le.gettext)("Cancel")}),te.default.createElement(oe.default,{appearance:"primary","data-test-itsi":"pa-create-alert-create-button",disabled:s,onClick:o.createCorrelationSearch,label:(0,le.gettext)("Create")}))}),o.serviceId=o.props.service.get("_key"),o.serviceName=o.props.service.get("title"),o.state={alertState:Pe,searchName:(0,se.sprintf)((0,le.gettext)("Predicted worst case health score for %s service"),o.serviceName),searchNameError:!1,maxInputValue:"",maxInputError:!1,minInputValue:"0",minInputError:!1,triggerOperator:Ae.LESS_EQUAL.symbol,alertErrorMessage:"",notableEventTitle:"",notableEventTitleError:!1,customTitle:!1,schedule:"*/5 * * * *",eventSeverity:"6",notableEventSeverities:null},o.labelTextWidth="180px",o.correlationSearchModel=new Se.default,o}return(0,Z.default)(PredictiveAnalyticsCreateAlert,s),(0,Y.default)(PredictiveAnalyticsCreateAlert,[{key:"render",value:function render(){return te.default.createElement("div",{"data-test-itsi":"predictive-analytics-create-alert"},te.default.createElement(Oe,{"data-test-itsi":"pa-create-alert-modal",onRequestClose:this.props.handleClose,open:this.props.openState},te.default.createElement(he.default.Header,{title:(0,le.gettext)("Create Correlation Search"),onRequestClose:this.props.handleClose}),this.renderModalBody(),this.renderFooter()))}}])}(te.Component);(0,Q.default)(Ve,"propTypes",{service:ie.default.object.isRequired,modelId:ie.default.string.isRequired,alertSearch:ie.default.string.isRequired,openState:ie.default.bool.isRequired,handleClose:ie.default.func.isRequired,minHealthScore:ie.default.number}),(0,Q.default)(Ve,"defaultProps",{minHealthScore:0});o.default=Ve;s.exports=o.default},7682:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N=S(_(16)),V=S(_(17)),j=S(_(21)),K=S(_(19)),W=S(_(20)),U=S(_(8)),Y=S(_(7)),$=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),X=S(_(3)),Z=S(_(50)),Q=S(_(172)),ee=S(_(2)),te=_(14),ie=_(4),ae=S(_(27)),ne=S(_(44)),re=S(_(24)),se=S(_(100)),le=S(_(66)),oe=S(_(314)),de=S(_(83)),ce=_(1423),he=_(184),ue=_(151),pe=S(_(1030)),fe=S(_(189)),ge=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,K.default)(o),(0,j.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,K.default)(s).constructor):o.apply(s,_))}_(28);var me={MEDIUM:(0,ie.gettext)("Medium"),CRITICAL:(0,ie.gettext)("Critical"),BOTH:(0,ie.gettext)("Medium or Critical")},ve=0,ye=1,_e=2,Se=3,be=(0,ee.default)(oe.default)(R||(R=(0,Y.default)(["\n\tcolor: ",";\n"])),s=>s.color),getBoxFilled=s=>$.default.createElement(be,{color:s,variant:"filled"}),Ee=(0,ee.default)(ne.default)(O||(O=(0,Y.default)(['\n\tbutton[data-test="clickable"] {\n\t\tmargin-bottom: 5px;\n\t}\n']))),Te=(0,ee.default)(de.default)(P||(P=(0,Y.default)(["\n\tspan {\n\t\tpadding: 5px 10px !important;\n\t}\n"]))),Ce=(0,ee.default)(se.default)(D||(D=(0,Y.default)(["\n\twidth: 650px;\n"]))),ke=function(s){function PredictiveAnalyticsCreateClassificationAlert(s){var o;(0,N.default)(this,PredictiveAnalyticsCreateClassificationAlert);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,PredictiveAnalyticsCreateClassificationAlert,[s,...S]),(0,U.default)(o,"componentDidMount",()=>{fe.default.getNotableEventsConfigsInfo().done(function(s){this.setState({notableEventSeverities:s.severities})}.bind(o))}),(0,U.default)(o,"componentDidUpdate",s=>{o.props.openState&&s.openState!==o.props.openState&&""===o.state.severityInputValue&&""===o.state.notableEventTitle&&o.setTitleAndTrigger(),o.props.modelId&&s.modelId!==o.props.modelId&&o.setState({customTitle:!1,severityInputValue:"",notableEventTitle:""}),o.props.openState||s.openState===o.props.openState||o.resetDefaults()}),(0,U.default)(o,"createCorrelationSearch",()=>{if(""===o.state.searchName)o.setState({searchNameError:!0,alertState:_e,alertErrorMessage:ge.ALERT_ERROR_MESSAGES.SEARCH_NAME});else if(""===o.state.notableEventTitle)o.setState({notableEventTitleError:!0,alertState:_e,alertErrorMessage:ge.ALERT_ERROR_MESSAGES.EMPTY_TITLE});else{o.setCorrelationSearch();var s=o.correlationSearchModel.save();o.setState({alertState:ye}),s.done(function(){this.setState({alertState:Se})}.bind(o)).fail(function(s){var o=(0,ue.extractErrorMsgFromResponse)(s);this.setState({alertErrorMessage:(0,te.sprintf)(ge.ALERT_ERROR_MESSAGES.ERROR_SAVING+" %s.",o),alertState:_e}),o.includes("already exists")&&this.setState({searchNameError:!0})}.bind(o))}}),(0,U.default)(o,"setCorrelationSearch",()=>{var s=o.props.alertSearch+' | where next30m_worst_hsl="';o.state.severityInputValue===me.BOTH?s+=me.MEDIUM+'" OR next30m_worst_hsl="'+me.CRITICAL+'"':s+=o.state.severityInputValue+'"';var _=(0,ce.uiEditURL)("predictive_analytics_usage",{model_id:o.props.modelId,service_id:o.serviceId,auto_load:!0});o.correlationSearchModel.set({search:s,name:o.state.searchName,cron_schedule:o.state.schedule,"dispatch.earliest_time":"-1h","action.itsi_event_generator.param.drilldown_uri":_,"action.itsi_event_generator.param.title":o.state.notableEventTitle,"action.itsi_event_generator.param.severity":o.state.eventSeverity,"action.itsi_event_generator.param.drilldown_title":(0,te.sprintf)((0,ie.gettext)("Predictive Analytics %s Dashboard"),o.serviceName),"action.itsi_event_generator.param.service_ids":o.serviceId})}),(0,U.default)(o,"handleInputSearchName",(s,_)=>{var{value:S}=_;o.setState({searchName:S}),o.state.searchNameError&&o.setState({searchNameError:!1,alertState:ve})}),(0,U.default)(o,"handleStateComparison",(s,_)=>{var{value:S}=_;o.setNotableEventTitle(S),o.setState({severityInputValue:S})}),(0,U.default)(o,"handleInputTitle",(s,_)=>{var{value:S}=_;o.setState({customTitle:!0,notableEventTitle:S}),o.state.notableEventTitleError&&o.setState({notableEventTitleError:!1,alertState:ve})}),(0,U.default)(o,"handleSchedulingSelection",(s,_)=>{var{value:S}=_;o.setState({schedule:S})}),(0,U.default)(o,"handleSeveritySelection",(s,_)=>{var{value:S}=_;o.setState({eventSeverity:S})}),(0,U.default)(o,"renderTrigger",()=>{var s=o.state.severityInputValue;return s.toLowerCase()==="Normal".toLowerCase()&&(s=me.BOTH),$.default.createElement(ne.default,{"data-test-itsi":"pa-classification-notable-event",label:(0,ie.gettext)("Create a notable event when predicted health state is"),labelWidth:o.labelTextWidth,controlsLayout:"fillJoin"},$.default.createElement(le.default,{"data-test-itsi":"pa-state-comparison-select",value:s,onChange:o.handleStateComparison},(0,Z.default)(me,s=>$.default.createElement(le.default.Option,{"data-test-itsi":"pa-state-comparison-select-option",key:s,label:s,value:s}))))}),(0,U.default)(o,"renderRunSchedule",()=>$.default.createElement(le.default,{"data-test-itsi":"pa-scheduling-selection-select",value:o.state.schedule,onChange:o.handleSchedulingSelection},(0,Z.default)(he.BASIC_CRON_SCHEDULE_ARRAY,(function(s){return $.default.createElement(le.default.Option,{"data-test-itsi":"pa-scheduling-selection-select-option",key:s.value,label:s.label,value:s.value})})))),(0,U.default)(o,"setNotableEventTitle",s=>{if(!o.state.customTitle)if(s===me.BOTH){var _=(0,ie.gettext)('"Medium" or "Critical"');o.setState({notableEventTitle:(0,te.sprintf)((0,ie.gettext)("The health state of %s is predicted to become either %s in 30 minutes"),o.serviceName,_)})}else o.setState({notableEventTitle:(0,te.sprintf)((0,ie.gettext)('The health state of %s is predicted to become "%s" in 30 minutes'),o.serviceName,s)})}),(0,U.default)(o,"renderSeverityOptions",()=>{var s=o.state.notableEventSeverities;return s=(0,Q.default)(s,"value"),$.default.createElement(le.default,{"data-test-itsi":"pa-severity-selection-select",value:o.state.eventSeverity,onChange:o.handleSeveritySelection},(0,Z.default)(s,(function(s){return $.default.createElement(le.default.Option,{"data-test-itsi":"pa-severity-selection-select-option",key:s.value,label:s.label,icon:getBoxFilled(s.color),value:s.value})})))}),(0,U.default)(o,"resetDefaults",()=>{o.setState({searchName:(0,te.sprintf)((0,ie.gettext)("Predicted worst case health state for %s service"),o.serviceName),searchNameError:!1,severityInputValue:"",alertErrorMessage:"",alertState:ve,notableEventTitle:"",notableEventTitleError:!1,schedule:"*/5 * * * *",eventSeverity:"6",customTitle:!1})}),(0,U.default)(o,"setTitleAndTrigger",()=>{var s=me.BOTH;o.props.worstHealthSeverity.toLowerCase()!=="Normal".toLowerCase()&&(s=o.props.worstHealthSeverity),o.setState({severityInputValue:s}),o.setNotableEventTitle(s)}),(0,U.default)(o,"renderModalBody",()=>o.state.alertState===Se?(0,ge.confirmationModalBody)():$.default.createElement(se.default.Body,null,o.state.alertState===_e&&$.default.createElement(re.default,{"data-test-itsi":"pa-create-classification-error-message",type:"error"},o.state.alertErrorMessage),$.default.createElement(ne.default,{"data-test-itsi":"pa-create-classification-search-name",label:(0,ie.gettext)("Search Name"),labelWidth:o.labelTextWidth},$.default.createElement(de.default,{"data-test-itsi":"pa-create-classification-search-name-text",value:o.state.searchName,error:o.state.searchNameError,onChange:o.handleInputSearchName,canClear:!0})),o.renderTrigger(),$.default.createElement(Ee,{"data-test-itsi":"pa-create-classification-notable-event-title",label:(0,ie.gettext)("Notable Event Title"),labelWidth:o.labelTextWidth,tooltip:(0,ie.gettext)("The title automatically updates with input value unless you manually change it.")},$.default.createElement(Te,{"data-test-itsi":"pa-create-classification-input-title-text",value:o.state.notableEventTitle,onChange:o.handleInputTitle,error:o.state.notableEventTitleError})),$.default.createElement(ne.default,{"data-test-itsi":"pa-create-classification-notable-event-run-every",label:(0,ie.gettext)("Run Every"),labelWidth:o.labelTextWidth,controlsLayout:"none"},o.renderRunSchedule()),$.default.createElement(ne.default,{"data-test-itsi":"pa-create-classification-notable-event-severity",label:(0,ie.gettext)("Severity"),tooltip:(0,ie.gettext)("The initial severity of a newly created notable event."),labelWidth:o.labelTextWidth,controlsLayout:"none"},o.renderSeverityOptions()))),(0,U.default)(o,"renderFooter",()=>{var s=o.state.maxInputError||o.state.minInputError||o.state.searchNameError||o.state.alertState===ye;return o.state.alertState===Se?$.default.createElement(se.default.Footer,null,$.default.createElement(ae.default,{appearance:"primary","data-test-itsi":"pa-create-classification-alert-ok-button",onClick:o.props.handleClose,label:(0,ie.gettext)("OK")})):o.state.alertState===ye?$.default.createElement(se.default.Footer,null,$.default.createElement(ae.default,{"data-test-itsi":"pa-create-classification-alert-save-button",disabled:s,appearance:"primary",label:(0,ie.gettext)("Saving...")})):$.default.createElement(se.default.Footer,null,$.default.createElement(ae.default,{appearance:"secondary","data-test-itsi":"pa-create-classification-alert-cancel-button",onClick:o.props.handleClose,label:(0,ie.gettext)("Cancel")}),$.default.createElement(ae.default,{appearance:"primary","data-test-itsi":"pa-create-classification-alert-create-button",disabled:s,onClick:o.createCorrelationSearch,label:(0,ie.gettext)("Create")}))}),o.serviceId=o.props.service.get("_key"),o.serviceName=o.props.service.get("title"),o.state={alertState:ve,searchName:(0,te.sprintf)((0,ie.gettext)("Predicted worst case health state for %s service"),o.serviceName),searchNameError:!1,severityInputValue:"",alertErrorMessage:"",notableEventTitle:"",customTitle:!1,schedule:"*/5 * * * *",eventSeverity:"6",notableEventSeverities:null},o.labelTextWidth="200px",o.correlationSearchModel=new pe.default,o}return(0,W.default)(PredictiveAnalyticsCreateClassificationAlert,s),(0,V.default)(PredictiveAnalyticsCreateClassificationAlert,[{key:"render",value:function render(){return $.default.createElement("div",{"data-test-itsi":"predictive-analytics-create-classification-alert"},$.default.createElement(Ce,{"data-test-itsi":"pa-create-classification-alert-modal",onRequestClose:this.props.handleClose,open:this.props.openState},$.default.createElement(se.default.Header,{title:(0,ie.gettext)("Create Correlation Search"),onRequestClose:this.props.handleClose}),this.renderModalBody(),this.renderFooter()))}}])}($.Component);(0,U.default)(ke,"propTypes",{service:X.default.object.isRequired,modelId:X.default.string.isRequired,alertSearch:X.default.string.isRequired,openState:X.default.bool.isRequired,handleClose:X.default.func.isRequired,worstHealthSeverity:X.default.string}),(0,U.default)(ke,"defaultProps",{worstHealthSeverity:me.CRITICAL});o.default=ke;s.exports=o.default},7683:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=S(_(0)),N=S(_(3)),V=S(_(254)),j=S(_(2)),K=S(_(1301)),W=S(_(27)),U=S(_(429)),Y=S(_(1357)),$=_(4),X=_(61),Z=_(78),Q=_(107),ee=_(1052),te=S(_(1838)),ie=S(_(4008)),ae=S(_(7684)),ne=_(434);_(28);var re=(0,j.default)(W.default)(R||(R=(0,P.default)(["\n\tpadding: 0;\n"]))),se=j.default.div(O||(O=(0,P.default)(["\n\tpadding: 0 20px;\n\tdisplay: ",";\n"])),s=>s.showVisualizations?"block":"none"),le=D.default.createElement(K.default,{screenReaderText:(0,$.gettext)("Create alert"),height:"16",width:"16"}),oe={},de={service:N.default.object.isRequired,showVisualizations:N.default.bool.isRequired,getDisabledState:N.default.func.isRequired,openInSearch:N.default.func.isRequired,healthScoreComparisonProgress:N.default.number.isRequired,healthScoreComparisonErrorMessage:N.default.string.isRequired,residualErrorProgress:N.default.number.isRequired,residualErrorErrorMessage:N.default.string.isRequired,predictedHealthProgress:N.default.number.isRequired,predictedHealthErrorMessage:N.default.string.isRequired,handleAlertRequestOpen:N.default.func.isRequired,rsquaredData:N.default.number,rmseData:N.default.number,healthScoreComparisonData:N.default.object,residualErrorData:N.default.object,averagePredictedHealthData:N.default.number,worstPredictedHealthData:N.default.number};function PredictiveAnalyticsRegressionPanels(s){var o,_,S,R;return D.default.createElement(se,{"data-test-itsi":"predictive-analytics-regression-panels",showVisualizations:s.showVisualizations},D.default.createElement(U.default,{"data-test-itsi":"pa-regression-panels-widgets-card-layout"},(o=(0,ne.outputCategoryColor)(s.rsquaredData),_=(0,X.getContrastingColor)(o),S=s.predictedHealthProgress===Z.SEARCH_PROGRESS.COMPLETED,R=D.default.createElement(te.default,{widgetSeverity:o,color:_,data:s.rsquaredData,searchProgress:s.predictedHealthProgress,errorMessage:s.predictedHealthErrorMessage}),D.default.createElement(ie.default,{isCompleted:S,panelType:ne.PANEL_TYPE.R2,body:R,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0})),(()=>{var o=(0,Q.getSeverityColor)(-1),_=(0,X.getContrastingColor)(o),S=s.predictedHealthProgress===Z.SEARCH_PROGRESS.COMPLETED,R=D.default.createElement(te.default,{widgetSeverity:o,color:_,data:s.rmseData,searchProgress:s.predictedHealthProgress,errorMessage:s.predictedHealthErrorMessage});return D.default.createElement(ie.default,{isCompleted:S,panelType:ne.PANEL_TYPE.RMSE,body:R,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0})})()),D.default.createElement(U.default,{"data-test-itsi":"pa-regression-panels-chart-card-layout"},(()=>{var o,_=s.healthScoreComparisonProgress===Z.SEARCH_PROGRESS.COMPLETED,S=(0,$.gettext)("Actual vs. Predicted");switch(s.healthScoreComparisonProgress){case Z.SEARCH_PROGRESS.NOT_STARTED:break;case Z.SEARCH_PROGRESS.IN_PROGRESS:o=ne.SEARCH_PROGRESS_ELEMENTS.getSearchInProgressElement();break;case Z.SEARCH_PROGRESS.ERROR:o=ne.SEARCH_PROGRESS_ELEMENTS.getErrorMessageElement(s.healthScoreComparisonErrorMessage);break;case Z.SEARCH_PROGRESS.NO_RESULTS:o=ne.SEARCH_PROGRESS_ELEMENTS.getNoResultsElement((0,$.gettext)("No results found."));break;case Z.SEARCH_PROGRESS.COMPLETED:o=D.default.createElement("div",null,D.default.createElement(ae.default,{data:s.healthScoreComparisonData,containerId:"healthscore-actual-vs-predict",scatterPointName:S}))}return D.default.createElement(ie.default,{isCompleted:_,panelType:ne.PANEL_TYPE.HEALTHSCORE_COMPARISON,body:o,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch})})(),(()=>{var o,_=s.residualErrorProgress===Z.SEARCH_PROGRESS.COMPLETED;switch(s.residualErrorProgress){case Z.SEARCH_PROGRESS.NOT_STARTED:break;case Z.SEARCH_PROGRESS.IN_PROGRESS:o=ne.SEARCH_PROGRESS_ELEMENTS.getSearchInProgressElement();break;case Z.SEARCH_PROGRESS.ERROR:o=ne.SEARCH_PROGRESS_ELEMENTS.getErrorMessageElement(s.residualErrorErrorMessage);break;case Z.SEARCH_PROGRESS.NO_RESULTS:o=ne.SEARCH_PROGRESS_ELEMENTS.getNoResultsElement((0,$.gettext)("No results found."));break;case Z.SEARCH_PROGRESS.COMPLETED:o=D.default.createElement("div",null,D.default.createElement(Y.default,{options:oe,dataSources:{primary:{data:s.residualErrorData}}}))}return D.default.createElement(ie.default,{isCompleted:_,panelType:ne.PANEL_TYPE.RESIDUAL_ERROR,body:o,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch})})()),D.default.createElement(U.default,{"data-test-itsi":"pa-regression-panels-health-score-card-layout"},(()=>{var o=(0,ee.getSeverityColorFromColorRangeTable)(parseFloat(s.averagePredictedHealthData)),_=(0,X.getContrastingColor)(o),S=s.predictedHealthProgress===Z.SEARCH_PROGRESS.COMPLETED,R=s.predictedHealthProgress,O=(0,V.default)(s.averagePredictedHealthData)||!s.averagePredictedHealthData.toString().length;S&&O&&(R=Z.SEARCH_PROGRESS.NO_RESULTS);var P=D.default.createElement(te.default,{widgetSeverity:o,color:_,data:s.averagePredictedHealthData,searchProgress:R,errorMessage:s.predictedHealthErrorMessage});return D.default.createElement(ie.default,{isCompleted:S,panelType:ne.PANEL_TYPE.AVG_HEALTHSCORE,body:P,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0})})(),(()=>{var o=(0,ee.getSeverityColorFromColorRangeTable)(parseFloat(s.worstPredictedHealthData)),_=(0,X.getContrastingColor)(o),S=s.predictedHealthProgress===Z.SEARCH_PROGRESS.COMPLETED,R=s.predictedHealthProgress,O=s.predictedHealthProgress===Z.SEARCH_PROGRESS.NO_RESULTS,P=s.predictedHealthProgress===Z.SEARCH_PROGRESS.ERROR,N=(0,V.default)(s.worstPredictedHealthData)||!s.worstPredictedHealthData.toString().length;S&&N&&(R=Z.SEARCH_PROGRESS.NO_RESULTS,O=!0);var j=D.default.createElement(te.default,{widgetSeverity:o,color:_,data:s.worstPredictedHealthData,searchProgress:R,errorMessage:s.predictedHealthErrorMessage}),K=O||P||!!s.service.get("cloneChangedSinceLastSave")||s.getDisabledState(ne.PANEL_TYPE.WORST_HEALTHSCORE),W=D.default.createElement(re,{"aria-label":(0,$.gettext)("Create alert"),"data-test-itsi":"pa-create-regression-alert-button",disabled:K,onClick:s.handleAlertRequestOpen,appearance:"pill",icon:le});return D.default.createElement(ie.default,{isCompleted:S,panelType:ne.PANEL_TYPE.WORST_HEALTHSCORE,body:j,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0,createAlertObject:W,serviceUpdated:!!s.service.get("cloneChangedSinceLastSave")})})()))}o.default=PredictiveAnalyticsRegressionPanels;PredictiveAnalyticsRegressionPanels.defaultProps={rsquaredData:null,rmseData:null,averagePredictedHealthData:null,worstPredictedHealthData:null,residualErrorData:null,healthScoreComparisonData:null},PredictiveAnalyticsRegressionPanels.propTypes=de,s.exports=o.default},7684:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(16)),O=S(_(17)),P=S(_(21)),D=S(_(19)),N=S(_(20)),V=S(_(8)),j=S(_(32)),K=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),W=S(_(3)),U=S(_(94)),Y=S(_(586)),$=S(_(889)),X=_(4),Z=S(_(238)),Q=_(188);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,D.default)(o),(0,P.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,D.default)(s).constructor):o.apply(s,_))}_(28);var ee=function(s){function PredictiveAnalyticsScatterLineVisualization(s){var o;(0,R.default)(this,PredictiveAnalyticsScatterLineVisualization);for(var _=arguments.length,S=new Array(_>1?_-1:0),O=1;O<_;O++)S[O-1]=arguments[O];return o=_callSuper(this,PredictiveAnalyticsScatterLineVisualization,[s,...S]),(0,V.default)(o,"formatData",(s,o)=>{if(!s||!s.columns)return null;o=o<0?0:o;var _=null,S=null,R=[];return(0,Y.default)(...s.columns).forEach((function(s){var O=+parseFloat(s[0]).toFixed(o),P=+parseFloat(s[1]).toFixed(o);isNaN(O)||isNaN(P)||(R.push([O,P]),_=null===_?O:Math.min(_,O),S=null===S?O:Math.max(S,O))})),{points:R,minValue:_,maxValue:S}}),(0,V.default)(o,"generateScatterLineChart",()=>{o.chart&&(o.chart.destroy(),o.chart=null);var s=o.formatData(o.props.data,o.props.numValueDigits),_=(0,j.default)("#"+o.props.containerId).get(0);null!==s&&void 0!==_&&(o.chart=$.default.chart({chart:{renderTo:_,height:o.props.chartHeight},legend:{enabled:!1},credits:!1,lang:{noData:(0,X.gettext)("Unable to render chart due to lack of data.")},title:{text:""},xAxis:{title:{text:o.props.data.fields[0].name}},yAxis:{title:{text:o.props.data.fields[1].name}},plotOptions:{series:{animation:!1}},series:[{type:"line",data:[[s.minValue,s.minValue],[s.maxValue,s.maxValue]],stats:{hover:{lineWidth:0}},enableMouseTracking:!1,color:Q.warningColor},{type:"scatter",name:o.props.scatterPointName,data:s.points,marker:{radius:3},color:Q.linkColor,tooltip:{backgroundColor:Q.legacyDarkColor,borderColor:Q.legacyDarkColor,style:{color:Q.backgroundColor},animation:!1,hideDelay:0,crosshairs:{color:Q.gray60Color,dashStyle:"solid"},shared:!1,pointFormat:"<b>"+(0,X.gettext)("Actual:")+"</b> {point.x}<br><b>"+(0,X.gettext)("Predicted:")+"</b> {point.y}"}}]}))}),o.chart=null,o.generateChart=(0,U.default)(o.generateScatterLineChart).bind(o),o}return(0,N.default)(PredictiveAnalyticsScatterLineVisualization,s),(0,O.default)(PredictiveAnalyticsScatterLineVisualization,[{key:"render",value:function render(){return this.generateChart(),K.default.createElement("div",{id:this.props.containerId})}}])}(K.Component);(0,V.default)(ee,"propTypes",{data:W.default.object.isRequired,containerId:W.default.string.isRequired,scatterPointName:W.default.string.isRequired,numValueDigits:W.default.number,chartHeight:W.default.number}),(0,V.default)(ee,"defaultProps",{numValueDigits:2,chartHeight:250});o.default=(0,Z.default)(ee);s.exports=o.default},7685:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P=S(_(7)),D=S(_(0)),N=S(_(3)),V=S(_(2)),j=S(_(1301)),K=S(_(27)),W=S(_(429)),U=_(4),Y=_(61),$=_(136),X=_(78),Z=S(_(1838)),Q=S(_(4008)),ee=S(_(7686)),te=_(434);_(28);var ie=(0,V.default)(K.default)(R||(R=(0,P.default)(["\n\tpadding: 0;\n"]))),ae=V.default.div(O||(O=(0,P.default)(["\n\tpadding: 0 20px;\n\tdisplay: ",";\n"])),s=>s.showVisualizations?"block":"none"),ne=D.default.createElement(j.default,{screenReaderText:(0,U.gettext)("Create alert"),height:"16",width:"16"}),re={service:N.default.object.isRequired,showVisualizations:N.default.bool.isRequired,getDisabledState:N.default.func.isRequired,openInSearch:N.default.func.isRequired,predictedHealthProgress:N.default.number.isRequired,predictedHealthErrorMessage:N.default.string.isRequired,confusionMatrixProgress:N.default.number.isRequired,confusionMatrixErrorMessage:N.default.string.isRequired,handleAlertRequestOpen:N.default.func.isRequired,averagePredictedSeverityData:N.default.string,worstPredictedSeverityData:N.default.string,accuracyData:N.default.number,precisionData:N.default.number,recallData:N.default.number,f1Data:N.default.number,confusionMatrixData:N.default.array};function PredictiveAnalyticsClassificationPanels(s){var o,_,S,R;return D.default.createElement(ae,{"data-test-itsi":"predictive-analytics-classification-panels",showVisualizations:s.showVisualizations},D.default.createElement(W.default,{"data-test-itsi":"pa-classification-panels-widgets-card-layout"},(o=(0,te.outputCategoryColor)(s.precisionData),_=(0,Y.getContrastingColor)(o),S=s.predictedHealthProgress===X.SEARCH_PROGRESS.COMPLETED,R=D.default.createElement(Z.default,{widgetSeverity:o,color:_,data:s.precisionData,searchProgress:s.predictedHealthProgress,errorMessage:s.predictedHealthErrorMessage}),D.default.createElement(Q.default,{isCompleted:S,panelType:te.PANEL_TYPE.PRECISION,body:R,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0})),(()=>{var o=(0,te.outputCategoryColor)(s.recallData),_=(0,Y.getContrastingColor)(o),S=s.predictedHealthProgress===X.SEARCH_PROGRESS.COMPLETED,R=D.default.createElement(Z.default,{widgetSeverity:o,color:_,data:s.recallData,searchProgress:s.predictedHealthProgress,errorMessage:s.predictedHealthErrorMessage});return D.default.createElement(Q.default,{isCompleted:S,panelType:te.PANEL_TYPE.RECALL,body:R,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0})})(),(()=>{var o=(0,te.outputCategoryColor)(s.accuracyData),_=(0,Y.getContrastingColor)(o),S=s.predictedHealthProgress===X.SEARCH_PROGRESS.COMPLETED,R=D.default.createElement(Z.default,{widgetSeverity:o,color:_,data:s.accuracyData,searchProgress:s.predictedHealthProgress,errorMessage:s.predictedHealthErrorMessage});return D.default.createElement(Q.default,{isCompleted:S,panelType:te.PANEL_TYPE.ACCURACY,body:R,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0})})(),(()=>{var o=(0,te.outputCategoryColor)(s.f1Data),_=(0,Y.getContrastingColor)(o),S=s.predictedHealthProgress===X.SEARCH_PROGRESS.COMPLETED,R=D.default.createElement(Z.default,{widgetSeverity:o,color:_,data:s.f1Data,searchProgress:s.predictedHealthProgress,errorMessage:s.predictedHealthErrorMessage});return D.default.createElement(Q.default,{isCompleted:S,panelType:te.PANEL_TYPE.F1,body:R,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0})})()),D.default.createElement(W.default,{"data-test-itsi":"pa-classification-panels-confusion-matrix-card-layout"},(()=>{var o=s.confusionMatrixProgress===X.SEARCH_PROGRESS.COMPLETED,_=D.default.createElement(ee.default,{confusionMatrixData:s.confusionMatrixData,confusionMatrixProgress:s.confusionMatrixProgress,confusionMatrixErrorMessage:s.confusionMatrixErrorMessage,openInSearch:s.openInSearch});return D.default.createElement(Q.default,{isCompleted:o,panelType:te.PANEL_TYPE.CONFUSION,body:_,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch})})()),D.default.createElement(W.default,{"data-test-itsi":"pa-classification-panels-severity-card-layout"},(()=>{var o=(0,te.classificationAlgorithmCategoryColor)(s.averagePredictedSeverityData),_=(0,Y.getContrastingColor)(o),S=s.predictedHealthProgress===X.SEARCH_PROGRESS.COMPLETED,R=(0,$.getSeverityLabel)(s.averagePredictedSeverityData),O=s.predictedHealthProgress;S&&!s.averagePredictedSeverityData&&(O=X.SEARCH_PROGRESS.NO_RESULTS);var P=D.default.createElement(Z.default,{widgetSeverity:o,color:_,data:R,searchProgress:O,errorMessage:s.predictedHealthErrorMessage});return D.default.createElement(Q.default,{isCompleted:S,panelType:te.PANEL_TYPE.AVG_SEVERITY,body:P,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0})})(),(()=>{var o=(0,te.classificationAlgorithmCategoryColor)(s.worstPredictedSeverityData),_=(0,Y.getContrastingColor)(o),S=s.predictedHealthProgress===X.SEARCH_PROGRESS.COMPLETED,R=(0,$.getSeverityLabel)(s.worstPredictedSeverityData),O=s.predictedHealthProgress,P=s.predictedHealthProgress===X.SEARCH_PROGRESS.NO_RESULTS,N=s.predictedHealthProgress===X.SEARCH_PROGRESS.ERROR;S&&!s.worstPredictedSeverityData&&(O=X.SEARCH_PROGRESS.NO_RESULTS);var V=D.default.createElement(Z.default,{widgetSeverity:o,color:_,data:R,searchProgress:O,errorMessage:s.predictedHealthErrorMessage}),j=P||N||!!s.service.get("cloneChangedSinceLastSave")||s.getDisabledState(te.PANEL_TYPE.WORST_SEVERITY),K=D.default.createElement(ie,{"aria-label":(0,U.gettext)("Create alert"),"data-test-itsi":"pa-create-classification-alert-button",disabled:j,onClick:s.handleAlertRequestOpen,appearance:"pill",icon:ne});return D.default.createElement(Q.default,{isCompleted:S,panelType:te.PANEL_TYPE.WORST_SEVERITY,body:V,getDisabledState:s.getDisabledState,openInSearch:s.openInSearch,fillCard:!0,createAlertObject:K,serviceUpdated:!!s.service.get("cloneChangedSinceLastSave")})})()))}o.default=PredictiveAnalyticsClassificationPanels;PredictiveAnalyticsClassificationPanels.defaultProps={averagePredictedSeverityData:null,worstPredictedSeverityData:null,accuracyData:null,precisionData:null,recallData:null,f1Data:null,confusionMatrixData:null},PredictiveAnalyticsClassificationPanels.propTypes=re,s.exports=o.default},7686:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(16)),O=S(_(17)),P=S(_(21)),D=S(_(19)),N=S(_(20)),V=S(_(8)),j=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),K=S(_(3)),W=S(_(33)),U=_(4),Y=S(_(93)),$=_(78),X=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,D.default)(o),(0,P.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,D.default)(s).constructor):o.apply(s,_))}_(28);var Z=function(s){function PredictiveAnalyticsConfusionMatrix(){var s;(0,R.default)(this,PredictiveAnalyticsConfusionMatrix);for(var o=arguments.length,_=new Array(o),S=0;S<o;S++)_[S]=arguments[S];return s=_callSuper(this,PredictiveAnalyticsConfusionMatrix,[..._]),(0,V.default)(s,"processMatrixData",()=>{if(!(0,W.default)(s.props.confusionMatrixData))return s.props.confusionMatrixData.map(s=>{var o=X.CLASSIFICATION_STATES.filter(o=>o.type===s["Predicted actual"]).map(s=>s.label);return j.default.createElement(Y.default.Row,{"data-test-itsi":"pa-confusion-matrix-table-row",key:o},j.default.createElement(Y.default.Cell,{"data-test-itsi":"pa-confusion-matrix-table-label-cell"},(0,X.getPredictionActualLabel)(s["Predicted actual"])),j.default.createElement(Y.default.Cell,{"data-test-itsi":"pa-confusion-matrix-table-critical-cell"},s["Predicted Critical"]),j.default.createElement(Y.default.Cell,{"data-test-itsi":"pa-confusion-matrix-table-medium-cell"},s["Predicted Medium"]),j.default.createElement(Y.default.Cell,{"data-test-itsi":"pa-confusion-matrix-table-normal-cell"},s["Predicted Normal"]))})}),s}return(0,N.default)(PredictiveAnalyticsConfusionMatrix,s),(0,O.default)(PredictiveAnalyticsConfusionMatrix,[{key:"render",value:function render(){var s="<div></div>";switch(this.props.confusionMatrixProgress){case $.SEARCH_PROGRESS.NOT_STARTED:s=X.SEARCH_PROGRESS_ELEMENTS.getSearchInfoElement();break;case $.SEARCH_PROGRESS.IN_PROGRESS:s=X.SEARCH_PROGRESS_ELEMENTS.getSearchInProgressElement();break;case $.SEARCH_PROGRESS.ERROR:s=X.SEARCH_PROGRESS_ELEMENTS.getErrorMessageElement(this.props.confusionMatrixErrorMessage);break;case $.SEARCH_PROGRESS.NO_RESULTS:s=X.SEARCH_PROGRESS_ELEMENTS.getNoResultsElement((0,U.gettext)("No results found."));break;case $.SEARCH_PROGRESS.COMPLETED:s=j.default.createElement(Y.default,{"data-test-itsi":"pa-confusion-matrix-table",stripeRows:!0},j.default.createElement(Y.default.Head,null,j.default.createElement(Y.default.HeadCell,{"data-test-itsi":"pa-confusion-matrix-table-actual-predicted-head-cell"},(0,U.gettext)("Actual/Predicted")),j.default.createElement(Y.default.HeadCell,{"data-test-itsi":"pa-confusion-matrix-table-critical-head-cell"},(0,U.gettext)("Critical")),j.default.createElement(Y.default.HeadCell,{"data-test-itsi":"pa-confusion-matrix-table-medium-head-cell"},(0,U.gettext)("Medium")),j.default.createElement(Y.default.HeadCell,{"data-test-itsi":"pa-confusion-matrix-table-normal-head-cell"},(0,U.gettext)("Normal"))),j.default.createElement(Y.default.Body,null,this.processMatrixData()))}return s}}])}(j.Component);(0,V.default)(Z,"propTypes",{confusionMatrixProgress:K.default.number.isRequired,confusionMatrixErrorMessage:K.default.string.isRequired,confusionMatrixData:K.default.array}),(0,V.default)(Z,"defaultProps",{confusionMatrixData:null});o.default=Z;s.exports=o.default},7687:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q,ee,te,ie,ae=S(_(16)),ne=S(_(17)),re=S(_(21)),se=S(_(19)),le=S(_(20)),oe=S(_(8)),de=S(_(7)),ce=S(_(32)),he=_interopRequireWildcard(_(0)),ue=S(_(3)),pe=S(_(321)),fe=S(_(62)),ge=S(_(33)),me=S(_(76)),ve=S(_(99)),ye=_interopRequireWildcard(_(2)),_e=S(_(27)),Se=S(_(429)),be=S(_(272)),Ee=S(_(1357)),Te=S(_(44)),Ce=S(_(1149)),ke=S(_(34)),xe=S(_(24)),we=S(_(634)),Re=S(_(66)),Ie=S(_(633)),Me=S(_(89)),Oe=S(_(75)),Ae=S(_(91)),Pe=_(14),De=_(4),Le=_(125),Ne=_(73),Ve=_(136),je=_(78),He=_(239),Be=_(137),Ke=_(293),Fe=S(_(665)),We=_(151),Ue=S(_(2389)),Ge=S(_(2388)),Ye=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}function _callSuper(s,o,_){return o=(0,se.default)(o),(0,re.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,se.default)(s).constructor):o.apply(s,_))}_(28);var qe=ye.default.span(R||(R=(0,de.default)(["\n\tdisplay: block;\n\twidth: 450px;\n"]))),ze=ye.default.div(O||(O=(0,de.default)(["\n\tdisplay: block;\n\tpadding-left: 40px;\n"]))),$e=ye.default.div(P||(P=(0,de.default)(["\n\tpadding: 0 20px;\n\tdisplay: block;\n"]))),Je=(0,ye.css)(D||(D=(0,de.default)(['\n\tdisplay: inline-block;\n\n\tbutton[data-test="clickable"] {\n\t\tmargin-bottom: 5px;\n\t}\n']))),Xe=(0,ye.default)(Te.default)(N||(N=(0,de.default)(["\n\t",";\n\tmargin-left: 20px;\n"])),Je),Ze=(0,ye.default)(Te.default)(V||(V=(0,de.default)(["\n\t",";\n\tmargin-left: 10px;\n\tvertical-align: top;\n"])),Je),Qe=(0,ye.default)(Te.default)(j||(j=(0,de.default)(["\n\t",";\n\tmargin-left: 20px;\n\tvertical-align: top;\n"])),Je),et={},tt=he.default.createElement(qe,null,(0,De.gettext)("A graph of the input data (KPIs and service health scores) over the selected training period.")),it=he.default.createElement(qe,null,(0,De.gettext)("Shows how often each health score occurs over time. In general, it is best to have evenly distributed data.")),at=ye.default.span(K||(K=(0,de.default)(["\n\twhite-space: nowrap;\n"]))),nt=he.default.createElement(at,null,(0,De.gettext)("Open in Search")),rt=(0,ye.default)(Me.default)(W||(W=(0,de.default)(["\n\tflex: none;\n"]))),st=(0,ye.default)(Re.default)(U||(U=(0,de.default)(["\n\twidth: 200px;\n"]))),lt=(0,ye.default)(_e.default)(Y||(Y=(0,de.default)(["\n\tpadding: 0;\n"]))),ot=(0,ye.default)(_e.default)($||($=(0,de.default)(["\n\tmargin: 20px 0 20px 20px;\n\tvertical-align: bottom;\n"]))),buttonIcon=s=>he.default.createElement(we.default,{screenReaderText:(0,De.gettext)("Open in Search"),height:"16",width:"16",disabled:s}),dt=(0,ye.default)(be.default.Body)(X||(X=(0,de.default)(["\n\tmargin: ",";\n"])),s=>s.isCompleted?"":"0 auto"),ct=he.default.createElement(qe,null,(0,De.gettext)("Randomly divides a percentage of the data to train the algorithm and the other percentage to test it. 70/30 is a generally agreed upon standard. However, be sure to tune this ratio based on your data volume and the time period.")),ht=he.default.createElement(qe,null,(0,De.gettext)("The data used to build the final model comes from this time period. The default is not a recommended value. In general, a longer time period is better.")),ut=he.default.createElement(qe,null,(0,De.gettext)("Regression predicts a numerical health score. Classification predicts a relative health state.")),pt=ye.default.span(Z||(Z=(0,de.default)(["\n\tpadding-right: 3px;\n"]))),ft=ye.default.span(Q||(Q=(0,de.default)(["\n\tpadding-left: 3px;\n"]))),gt=ye.default.span(ee||(ee=(0,de.default)(["\n\tpadding-left: 4px;\n"]))),mt=(0,ye.default)(Oe.default)(te||(te=(0,de.default)(["\n\tdisplay: inline-block;\n"]))),vt=ye.default.div(ie||(ie=(0,de.default)(["\n\tpadding-left: 10px;\n\tdisplay: inline-block;\n"]))),yt=function(s){function PredictiveAnalyticsCreateTrainPaneView(s){var o;(0,ae.default)(this,PredictiveAnalyticsCreateTrainPaneView);for(var _=arguments.length,S=new Array(_>1?_-1:0),R=1;R<_;R++)S[R-1]=arguments[R];return o=_callSuper(this,PredictiveAnalyticsCreateTrainPaneView,[s,...S]),(0,oe.default)(o,"fillDataGaps",s=>{for(var o=[],_=[],S=[],R=[],O=s[0],P=s[1],D=O[0],N=O[O.length-1],V=D.split("-"),j=N.split("-"),K=+V[0],W=+j[0],U=0;U<=100;U++)U<K?(o.push((0,Pe.sprintf)("%s-%s",U,U+1)),_.push("0")):U>W&&(S.push((0,Pe.sprintf)("%s-%s",U,U+1)),R.push("0"));return[o.concat(O).concat(S),_.concat(P).concat(R)]}),(0,oe.default)(o,"updateSearchJobs",(s,_)=>{(0,je.cleanSearchJobSubscriptions)(o.kpisOverTimeSearchJob,o.kpisOverTimeResultsSubscription),o.kpisOverTimeSearchJob=Ae.default.create({id:(0,je.createUniqueSearchId)("pa-create-train-pane-kpis-over-time-update-search"),search:Ye.SEARCHES.getKpiOverTimeSearch(o.serviceId),earliest_time:s,latest_time:_},{app:(0,Ne.getShortAppName)(!0)}),o.kpisOverTimeResultsSubscription=o.kpisOverTimeSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{o.kpisOverTimeResults=s},error:s=>{o.setState({kpiSearchResultsErrorMessage:s.message,kpiSearchProgress:je.SEARCH_PROGRESS.ERROR}),o.props.handleTrainInputSearchesDone()},complete:()=>{var s=o.getResultsForCharting(o.kpisOverTimeResults);(0,ge.default)(s)?o.setState({kpiSearchProgress:je.SEARCH_PROGRESS.NO_RESULTS}):o.setState({kpiSearchProgress:je.SEARCH_PROGRESS.COMPLETED,kpiValuesOverTimeData:{fields:o.kpisOverTimeResults.fields,columns:s}}),o.props.handleTrainInputSearchesDone()}}),o.setState({kpiSearchProgress:je.SEARCH_PROGRESS.IN_PROGRESS}),(0,je.cleanSearchJobSubscriptions)(o.healthScoreSearchJob,o.healthScoreResultsSubscription),o.healthScoreSearchJob=Ae.default.create({id:(0,je.createUniqueSearchId)("pa-create-train-pane-health-score-update-search"),search:Ye.SEARCHES.getHealthScoreSearch(o.serviceId),earliest_time:s,latest_time:_},{app:(0,Ne.getShortAppName)(!0)}),o.healthScoreResultsSubscription=o.healthScoreSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{o.healthScoreResults=s},error:s=>{o.setState({healthScoreResultsErrorMessage:s.message,healthScoreProgress:je.SEARCH_PROGRESS.ERROR})},complete:()=>{var s=o.getResultsForCharting(o.healthScoreResults);if((0,ge.default)(s))o.setState({healthScoreProgress:je.SEARCH_PROGRESS.NO_RESULTS});else{var _=o.fillDataGaps(s);o.setState({healthScoreProgress:je.SEARCH_PROGRESS.COMPLETED,healthScoreData:{fields:o.healthScoreResults.fields,columns:_}})}}}),o.setState({healthScoreProgress:je.SEARCH_PROGRESS.IN_PROGRESS})}),(0,oe.default)(o,"setAlgorithmProperties",(s,o,_)=>{var S=s.get(o);if((0,pe.default)(_,(function(s,o){S.set(o,s)})),S instanceof Ue.default){var R,O=Number.MIN_VALUE;(0,pe.default)(s.attributes,(function(s,o){o&&s instanceof Ue.default&&(s.set("recommended",!1),s.get("rSquared")>O&&(O=s.get("rSquared"),R=s))})),R&&R.set("recommended",!0)}return s.set(o,S),s}),(0,oe.default)(o,"getResultsForCharting",s=>{if((0,ge.default)(s.results))return[];var o=s.fields,_=s.results,S={};(0,pe.default)(o,(s,o)=>{S[o]=s.name});var R=o.length,O=[];return(0,pe.default)(_,s=>{for(var o=0;o<R;o++){O[o]||(O[o]=[]);var _=s[S[o]];O[o].push((0,ve.default)(_)?"":_)}}),O}),(0,oe.default)(o,"checkAndUpdateSearch",(s,_)=>{!!o.serviceId&&o.props.isValidTimePeriod(s,_)&&o.updateSearchJobs(s,_)}),(0,oe.default)(o,"handleSliderChange",(s,_)=>{var{value:S}=_;o.setState({trainingSplit:S})}),(0,oe.default)(o,"handleAlgoTypeChange",(s,_)=>{var{value:S}=_,R=o.isTrainEnabled(S,"",o.state.trainingPeriodEarliest,o.state.trainingPeriodLatest);o.setState({algoType:S,algo:"",toTrain:R})}),(0,oe.default)(o,"handleAlgoChange",(s,_)=>{var{value:S}=_,R=o.isTrainEnabled(o.state.algoType,S,o.state.trainingPeriodEarliest,o.state.trainingPeriodLatest);o.setState({algo:S,toTrain:R})}),(0,oe.default)(o,"handleTimeRangeChange",(s,_)=>{var S=o.isTrainEnabled(o.state.algoType,o.state.algo,s,_);o.checkAndUpdateSearch(s,_),o.setState({trainingPeriodEarliest:s,trainingPeriodLatest:_,toTrain:S})}),(0,oe.default)(o,"getPermissionData",()=>{var s=o.props.service.get("permissions").user;return{"perms.read":He.ROLES.ITOA_USER,sharing:Ke.PERMISSIONS.APP,owner:s}}),(0,oe.default)(o,"makeModelReadAll",()=>{var s=Ye.SEARCHES.getMLTKModelLookFileNames(o.serviceId,o.state.algo,o.lookupFileType),_=o.getPermissionData(),S=[],R=ce.default.ajax({url:(0,Le.createRESTURL)("/servicesNS/"+_.owner+"/itsi/data/lookup-table-files/"+s.avg+"/acl"),type:"POST",data:_});S.push(R);var O=ce.default.ajax({url:(0,Le.createRESTURL)("/servicesNS/"+_.owner+"/itsi/data/lookup-table-files/"+s.worst+"/acl"),type:"POST",data:_});S.push(O);var P=ce.default.ajax({url:(0,Le.createRESTURL)("/servicesNS/"+_.owner+"/itsi/data/lookup-table-files/"+s.ss+"/acl"),type:"POST",data:_});return S.push(P),S}),(0,oe.default)(o,"getXHRsForKpiModelReadAll",(s,_)=>{var S=o.getPermissionData(),R=[];(0,pe.default)(s,s=>{var _=ce.default.ajax({url:(0,Le.createRESTURL)("/servicesNS/"+S.owner+"/itsi/data/lookup-table-files/__mlspl_"+s+o.lookupFileType+"/acl"),type:"POST",data:S});R.push(_)});var O=ce.default.ajax({url:(0,Le.createRESTURL)("/servicesNS/"+S.owner+"/itsi/data/lookup-table-files/__mlspl_itsi_predict_kpi_ss_"+_+o.lookupFileType+"/acl"),type:"POST",data:S});R.push(O);var P=ce.default.ajax({url:(0,Le.createRESTURL)("/servicesNS/"+S.owner+"/itsi/data/lookup-table-files/__mlspl_itsi_predict_kpi_hs_"+_+o.lookupFileType+"/acl"),type:"POST",data:S});return R.push(P),R}),(0,oe.default)(o,"updateStateOnTrainError",s=>{var _=s;if(s&&"string"==typeof s&&(0,fe.default)(s.toLowerCase(),"solver needs samples of at least 2 classes")){var S=s.split(":"),R=S[S.length-1]||"";_=(0,Pe.sprintf)((0,De.gettext)("The training dataset needs at least 2 classes, but the data contains only one class: %s"),R)}o.setState({trainResultsErrorMessage:_,trainSearchProgress:je.SEARCH_PROGRESS.ERROR,toTrain:!0,disableTrainInputs:!1}),o.props.handleTrainError(),o.props.handleTrainingInProgress(!1),Ye.SEARCHES.resetModelName()}),(0,oe.default)(o,"updateStateOnTrainCompletion",(s,_,S,R,O,P,D)=>{var N=(0,Ye.getAlgorithmTypeFromModelId)(s),V=N.type;o.props.handleModelCreation(o.state.trainingPeriodEarliest,o.state.trainingPeriodLatest,o.state.trainingSplit,s,V,Ye.TRAIN_TEST_WORKFLOW_STEP.TRAIN_TO_TEST,_,S,R,O,P,D),o.setState({trainSearchProgress:je.SEARCH_PROGRESS.COMPLETED,toTrain:!0,disableTrainInputs:!1});var j=V===Ye.ALGO_TYPES.REGRESSION?o.props.missingRegressionModels:o.props.missingClassificationModels;N.value in j&&delete j[N.value],o.props.setMissingModels(V,j),o.props.handleTrainingInProgress(!1)}),(0,oe.default)(o,"trainKpiModels",s=>{var _=Ye.SEARCHES.getTrainKpiTrendsSearchData(o.serviceId);o.kpiModelSuffix=_.suffix,o.trainKpiModelsJob=Ae.default.create({id:(0,je.createUniqueSearchId)("pa-create-train-kpi-models-search"),search:_.search,earliest_time:o.state.trainingPeriodEarliest,latest_time:o.state.trainingPeriodLatest},{app:(0,Ne.getShortAppName)(!0)});var S=[];o.trainKpiModelsJobSubscription=o.trainKpiModelsJob.getResults({offset:0,count:0}).subscribe({next:s=>{s.fields&&(0,pe.default)(s.results,s=>{S.push(s.modelname)})},error:s=>{var _=(0,Pe.sprintf)((0,De.gettext)("Failed to train KPI models: %s"),s.message);o.updateStateOnTrainError(_)},complete:()=>{var R=o.getXHRsForKpiModelReadAll(S,_.suffix);ce.default.when.apply(ce.default,R).done(s.bind(o)).fail(function(s){var o=(0,Pe.sprintf)((0,De.gettext)("An error occurred while setting permissions on the created KPI models. Status code : %s, Error: %s"),s.status,(0,We.extractErrorMsgFromResponse)(s));this.updateStateOnTrainError(o)}.bind(o))}})}),(0,oe.default)(o,"checkLookupFileExtension",(s,o,_)=>{var S="__mlspl_"+Ye.SEARCHES.getAlgorithmModelName(s,o),R=(0,Le.createRESTURL)("/servicesNS/"+_+"/itsi/data/lookup-table-files/"+S);return{getCsvXhr:ce.default.ajax({url:R+"_avg"+Ye.LOOKUP_FILE_TYPES.CSV,type:"GET"}),getMlmodelXhr:ce.default.ajax({url:R+"_avg"+Ye.LOOKUP_FILE_TYPES.MLMODEL,type:"GET"})}}),(0,oe.default)(o,"onClickTrain",()=>{var s=Ye.SEARCHES.getCreateModelSearch(o.serviceId,o.state.algo,o.state.algoType,o.state.trainingSplit);(0,je.cleanSearchJobSubscriptions)(o.trainSearchJob,o.trainResultsSubscription),o.props.handleTrainingInProgress(!0),o.trainSearchJob=Ae.default.create({id:(0,je.createUniqueSearchId)("pa-create-train-search"),search:s,earliest_time:o.state.trainingPeriodEarliest,latest_time:o.state.trainingPeriodLatest},{app:(0,Ne.getShortAppName)(!0)});var _=(0,Ye.getSavedAlgorithmModel)(o.props.service,o.state.algo);(0,me.default)(_)&&o.props.setCurrentAlgoSavedModelId(_);var S,R,O,P=Ye.SEARCHES.getAlgorithmModelName(o.serviceId,o.state.algo),D=0,N=(0,Ve.getSeverityLabel)("Critical"),V=JSON.parse(JSON.stringify(o.props.service.get("algorithms").toJSON())),j=new Ge.default(V,{parse:!0});o.trainResultsSubscription=o.trainSearchJob.getResults({offset:0,count:0}).subscribe({next:s=>{s.fields&&j&&(o.state.algoType===Ye.ALGO_TYPES.REGRESSION?(O=o.setAlgorithmProperties(j,o.state.algo,{modelId:Ye.SEARCHES.getAlgorithmModelName(o.serviceId,o.state.algo),rSquared:parseFloat(s.results[0].rSquared),RMSE:parseFloat(s.results[0].RMSE)}),S=parseFloat(s.results[0].next30m_avg_hs),D=parseFloat(s.results[0].next30m_worst_hs)):(O=o.setAlgorithmProperties(j,o.state.algo,{modelId:Ye.SEARCHES.getAlgorithmModelName(o.serviceId,o.state.algo),precision:parseFloat(s.results[0].precision),recall:parseFloat(s.results[0].recall),accuracy:parseFloat(s.results[0].accuracy),f1_score:parseFloat(s.results[0].f1)}),R=s.results[0].next30m_avg_hsl,N=s.results[0].next30m_worst_hsl))},error:s=>{var _=(0,De.gettext)("An error occurred while training the model. Try again, or check the logs for details.");_=s.message.includes("No valid fields to fit or apply model to")?(0,De.gettext)("Error in fit command: Insufficient data to train the model."):s.message,o.updateStateOnTrainError(_)},complete:()=>{var _=ce.default.Deferred(),K=o.checkLookupFileExtension(o.serviceId,o.state.algo,o.props.service.get("permissions").user);K.getCsvXhr.done((function(){_.resolve(Ye.LOOKUP_FILE_TYPES.CSV)})).fail(function(){K.getMlmodelXhr.done((function(){_.resolve(Ye.LOOKUP_FILE_TYPES.MLMODEL)})).fail((function(s){_.reject(s)}))}.bind(o)),_.done(function(o){this.lookupFileType=o;var _=this.makeModelReadAll();ce.default.when.apply(ce.default,_).done(function(){var o=V.kpiModelsCreatedAt,onTrainKpiModelsDone=()=>{O||(O=j),O=O.set({kpiModelsCreatedAt:(new Date).getTime(),kpiModelSuffix:this.kpiModelSuffix}),this.props.service.set("algorithms",O),this.updateStateOnTrainCompletion(P,S,R,N,D,s,this.props.service)};if(!o||o+Ye.KPI_MODEL_TTL<(new Date).getTime())this.trainKpiModels(onTrainKpiModelsDone);else{var _=Ye.SEARCHES.getKpiModelsCountsSearch(this.serviceId);this.checkModelsJob=Ae.default.create({id:(0,je.createUniqueSearchId)("pa-create-train-pane-check-models-search"),search:_,earliest_time:this.state.trainingPeriodEarliest,latest_time:this.state.trainingPeriodLatest},{app:(0,Ne.getShortAppName)(!0)});var K=!1;this.checkModelsSubscription=this.checkModelsJob.getResults({offset:0,count:0}).subscribe({next:s=>{s.fields&&parseInt(s.results[0].modelcount)<parseInt(s.results[0].kpicount)+2&&(K=!0)},error:s=>{var o=(0,Pe.sprintf)((0,De.gettext)("Failed to check KPI models: %s"),s.message);this.updateStateOnTrainError(o)},complete:()=>{K?this.trainKpiModels(onTrainKpiModelsDone):(this.props.service.set("algorithms",O),this.updateStateOnTrainCompletion(P,S,R,N,D,s,this.props.service))}})}}.bind(this)).fail(function(s){this.onErrorWithSetPermissions(s)}.bind(this)),Ye.SEARCHES.resetModelName()}.bind(o)).fail(function(s){this.onErrorWithSetPermissions(s)}.bind(o))}}),o.props.handleTrainProgress(!0),o.setState({trainSearchProgress:je.SEARCH_PROGRESS.IN_PROGRESS,toTrain:!1,disableTrainInputs:!0}),o.props.handleTrainTestWorkflowStepUpdate(Ye.TRAIN_TEST_WORKFLOW_STEP.IN_TRAIN)}),(0,oe.default)(o,"onErrorWithSetPermissions",s=>{var _=(0,Pe.sprintf)((0,De.gettext)("An error occurred while setting permissions on the created health score prediction models. Status code : %s, Error: %s"),s.status,(0,We.extractErrorMsgFromResponse)(s));o.updateStateOnTrainError(_)}),(0,oe.default)(o,"isTrainEnabled",(s,_,S,R)=>!!(o.serviceId&&s&&_&&o.props.isValidTimePeriod(S,R))),(0,oe.default)(o,"runKpiOverTimeSearchInTab",()=>{o.runSearchInTab(Ye.SEARCH_TYPE.KPI_OVER_TIME_SEARCH)}),(0,oe.default)(o,"runHealthScoreSearchInTab",()=>{o.runSearchInTab(Ye.SEARCH_TYPE.HEALTHSCORE_SEARCH)}),(0,oe.default)(o,"runSearchInTab",s=>{var _;switch(s){case Ye.SEARCH_TYPE.HEALTHSCORE_SEARCH:_=Ye.SEARCHES.getHealthScoreSearch(o.serviceId);break;case Ye.SEARCH_TYPE.KPI_OVER_TIME_SEARCH:_=Ye.SEARCHES.getKpiOverTimeSearch(o.serviceId);break;default:_=""}(0,Ye.openInSearch)(_,o.state.trainingPeriodEarliest,o.state.trainingPeriodLatest)}),(0,oe.default)(o,"generateAlgorithmSelectOptions",()=>Ye.PREDICTIVE_ANALYTICS_ALGORITHMS.filter(s=>s.type===o.state.algoType).map(s=>he.default.createElement(Re.default.Option,{"data-test-itsi":"pa-algorithm-select-option",label:s.label,value:s.value,key:s.value}))),(0,oe.default)(o,"generateAlgorithmTypeSelectOptions",()=>Ye.PREDICTIVE_ANALYTICS_ALGORITHM_TYPE.map(s=>he.default.createElement(Re.default.Option,{"data-test-itsi":"pa-algorithm-type-select-option",label:s.label,value:s.value,key:s.value}))),(0,oe.default)(o,"getChart",s=>{var _;switch(s){case Ye.SEARCH_TYPE.HEALTHSCORE_SEARCH:switch(o.state.healthScoreProgress){case je.SEARCH_PROGRESS.NO_RESULTS:_=Ye.SEARCH_PROGRESS_ELEMENTS.getNoResultsElement();break;case je.SEARCH_PROGRESS.NOT_STARTED:_=Ye.SEARCH_PROGRESS_ELEMENTS.getSearchInfoElement();break;case je.SEARCH_PROGRESS.IN_PROGRESS:_=Ye.SEARCH_PROGRESS_ELEMENTS.getSearchInProgressElement();break;case je.SEARCH_PROGRESS.ERROR:_=Ye.SEARCH_PROGRESS_ELEMENTS.getErrorMessageElement(o.state.healthScoreResultsErrorMessage);break;case je.SEARCH_PROGRESS.COMPLETED:_=he.default.createElement(Ee.default,{"data-test-itsi":"pa-create-train-pane-column",options:et,dataSources:{primary:{data:o.state.healthScoreData}}});break;default:_="<div></div>"}break;case Ye.SEARCH_TYPE.KPI_OVER_TIME_SEARCH:switch(o.state.kpiSearchProgress){case je.SEARCH_PROGRESS.NO_RESULTS:_=Ye.SEARCH_PROGRESS_ELEMENTS.getNoResultsElement();break;case je.SEARCH_PROGRESS.NOT_STARTED:_=Ye.SEARCH_PROGRESS_ELEMENTS.getSearchInfoElement();break;case je.SEARCH_PROGRESS.IN_PROGRESS:_=Ye.SEARCH_PROGRESS_ELEMENTS.getSearchInProgressElement();break;case je.SEARCH_PROGRESS.ERROR:_=Ye.SEARCH_PROGRESS_ELEMENTS.getErrorMessageElement(o.state.kpiSearchResultsErrorMessage);break;case je.SEARCH_PROGRESS.COMPLETED:_=he.default.createElement(Ce.default,{"data-test-itsi":"pa-create-train-pane-line",options:et,dataSources:{primary:{data:o.state.kpiValuesOverTimeData}}});break;default:_="<div></div>"}break;default:_=""}return _}),(0,oe.default)(o,"getKpiOverTimeChart",s=>{var _=o.getChart(Ye.SEARCH_TYPE.KPI_OVER_TIME_SEARCH),S=!!o.serviceId&&o.props.isValidTimePeriod(o.state.trainingPeriodEarliest,o.state.trainingPeriodLatest),R=o.state.kpiSearchProgress===je.SEARCH_PROGRESS.COMPLETED;return he.default.createElement(Se.default,{"data-test-itsi":"pa-create-train-kpi-over-time-card-layout"},he.default.createElement(be.default,{"data-test-itsi":"pa-create-train-kpi-over-time-card"},he.default.createElement(be.default.Header,{title:(0,De.gettext)("Service Health Score and KPIs over time")},he.default.createElement(Me.default,{"data-test-itsi":"service-health-score-tooltip",content:tt}),he.default.createElement(rt,{"data-test-itsi":"service-health-score-open-in-search-tooltip",content:nt},he.default.createElement(lt,{"aria-label":(0,De.gettext)("Open in Search"),"data-test-itsi":"pa-create-train-kpi-ot-open-in-search-button",disabled:!s,onClick:o.runKpiOverTimeSearchInTab,appearance:"pill",icon:buttonIcon(S)}))),he.default.createElement(dt,{isCompleted:R},_)))}),(0,oe.default)(o,"getHealthScoreChart",s=>{var _=o.getChart(Ye.SEARCH_TYPE.HEALTHSCORE_SEARCH),S=!!o.serviceId&&o.props.isValidTimePeriod(o.state.trainingPeriodEarliest,o.state.trainingPeriodLatest),R=o.state.healthScoreProgress===je.SEARCH_PROGRESS.COMPLETED;return he.default.createElement(Se.default,{"data-test-itsi":"pa-create-train-health-score-card-layout"},he.default.createElement(be.default,{"data-test-itsi":"pa-create-train-health-score-card"},he.default.createElement(be.default.Header,{title:(0,De.gettext)("Distribution of Service Health Score Values")},he.default.createElement(Me.default,{"data-test-itsi":"distribution-service-health-score-tooltip",content:it}),he.default.createElement(rt,{"data-test-itsi":"distribution-service-health-score-open-in-search-tooltip",content:nt},he.default.createElement(lt,{"aria-label":(0,De.gettext)("Open in Search"),"data-test-itsi":"pa-create-train-hs-open-in-search-button",disabled:!s,onClick:o.runHealthScoreSearchInTab,appearance:"pill",icon:buttonIcon(S)}))),he.default.createElement(dt,{isCompleted:R},_)))}),(0,oe.default)(o,"scrollToTest",()=>((0,ce.default)("html,body").animate({scrollTop:(0,ce.default)("#test-a-model").offset().top},"slow"),!1)),(0,oe.default)(o,"getTrainResultElement",()=>{var s,_={q:Ye.SEARCHES.getSampleCreateModelSearch(o.serviceId,o.state.algo,o.state.algoType,o.state.trainingSplit),earliest:o.state.trainingPeriodEarliest,latest:o.state.trainingPeriodLatest},S=(0,Be.uiEditURL)(_);switch(o.state.trainSearchProgress){case je.SEARCH_PROGRESS.IN_PROGRESS:s=he.default.createElement("div",null,he.default.createElement(mt,{"data-test-itsi":"pa-create-train-wait-spinner"}),he.default.createElement(vt,{"data-test-itsi":"creating-model-message-text"},(0,De.gettext)("Creating model...")));break;case je.SEARCH_PROGRESS.COMPLETED:s=he.default.createElement(xe.default,{"data-test-itsi":"search-completed-info-message",type:"info"},he.default.createElement("div",null,he.default.createElement(pt,null,(0,De.gettext)("Model created. See")),he.default.createElement(ke.default,{"data-test-itsi":"test-a-model-link",onClick:o.scrollToTest},(0,De.gettext)("Test a Model")),he.default.createElement(ft,null,(0,De.gettext)("below for details.")),he.default.createElement(ke.default,{"data-test-itsi":"run-sample-search-link",to:S,openInNewContext:!0},he.default.createElement(gt,null,(0,De.gettext)("Run sample search")))));break;case je.SEARCH_PROGRESS.ERROR:s=he.default.createElement(xe.default,{"data-test-itsi":"pa-create-train-error-message",type:"error"},o.state.trainResultsErrorMessage);break;default:s=he.default.createElement("div",null)}return s}),o.serviceId=o.props.service.get("_key"),o.lookupFileType=Ye.LOOKUP_FILE_TYPES.CSV,o.state={trainingSplit:o.props.trainingSplit,trainingPeriodEarliest:"-14d@d",trainingPeriodLatest:"now",toTrain:!1,algoType:"",algo:"",trainingTestPeriodEarliest:"",kpiValuesOverTimeData:{},healthScoreData:{},kpiSearchResultsErrorMessage:"",kpiSearchProgress:je.SEARCH_PROGRESS.NOT_STARTED,healthScoreResultsErrorMessage:"",healthScoreProgress:je.SEARCH_PROGRESS.NOT_STARTED,trainResultsErrorMessage:"",trainSearchProgress:je.SEARCH_PROGRESS.NOT_STARTED,disableTrainInputs:!1},o}return(0,le.default)(PredictiveAnalyticsCreateTrainPaneView,s),(0,ne.default)(PredictiveAnalyticsCreateTrainPaneView,[{key:"componentDidUpdate",value:function componentDidUpdate(s){this.props.runTrainInputSearches&&s.runTrainInputSearches!==this.props.runTrainInputSearches&&this.checkAndUpdateSearch(this.state.trainingPeriodEarliest,this.state.trainingPeriodLatest)}},{key:"componentDidMount",value:function componentDidMount(){(this.props.runTrainInputSearches||this.props.savedService||this.props.cancelChanges)&&this.checkAndUpdateSearch(this.state.trainingPeriodEarliest,this.state.trainingPeriodLatest)}},{key:"componentWillUnmount",value:function componentWillUnmount(){(0,je.cleanSearchJobSubscriptions)(this.kpisOverTimeSearchJob,this.kpisOverTimeResultsSubscription),(0,je.cleanSearchJobSubscriptions)(this.trainSearchJob,this.trainResultsSubscription),(0,je.cleanSearchJobSubscriptions)(this.healthScoreSearchJob,this.healthScoreResultsSubscription),(0,je.cleanSearchJobSubscriptions)(this.trainKpiModelsJob,this.trainKpiModelsJobSubscription),(0,je.cleanSearchJobSubscriptions)(this.checkModelsJob,this.checkModelsSubscription)}},{key:"render",value:function render(){var s=this.generateAlgorithmTypeSelectOptions(),o=this.generateAlgorithmSelectOptions(),_=(0,Pe.sprintf)((0,De.gettext)("Split for Training/Test: %s/%s"),this.state.trainingSplit,100-this.state.trainingSplit),S=!!this.serviceId&&this.props.isValidTimePeriod(this.state.trainingPeriodEarliest,this.state.trainingPeriodLatest),R=this.getKpiOverTimeChart(S),O=this.getHealthScoreChart(S),P=this.getTrainResultElement();return he.default.createElement("div",{"data-test-itsi":"predictive-analytics-create-train-pane"},he.default.createElement($e,null,he.default.createElement(Ze,{"data-test-itsi":"pa-create-train-time-period",label:(0,De.gettext)("Time Period"),tooltip:ht,labelPosition:"top"},he.default.createElement(Fe.default,{advancedInputTypes:this.props.timePickerAttributes.advancedInputTypes,handleTimeRangeChange:this.handleTimeRangeChange,disabled:this.state.disableTrainInputs,earliest:this.state.trainingPeriodEarliest,formInputTypes:this.props.timePickerAttributes.formInputTypes,latest:this.state.trainingPeriodLatest,skipRealTimePresets:!0})),he.default.createElement(Xe,{"data-test-itsi":"pa-create-train-algorithm-type",label:(0,De.gettext)("Algorithm Type"),tooltip:ut,labelPosition:"top"},he.default.createElement(st,{"data-test-itsi":"pa-algorithm-type-select",inline:!0,disabled:this.state.disableTrainInputs,onChange:this.handleAlgoTypeChange},s)),he.default.createElement(Xe,{"data-test-itsi":"pa-create-train-algorithm",label:(0,De.gettext)("Algorithm"),tooltip:(0,De.gettext)("The algorithm to use for the health score prediction."),labelPosition:"top"},he.default.createElement(st,{inline:!0,"data-test-itsi":"pa-algorithm-select",disabled:!this.state.algoType||this.state.disableTrainInputs,onChange:this.handleAlgoChange},o)),he.default.createElement(Qe,{"data-test-itsi":"pa-create-train-test-split",label:_,tooltip:ct,labelPosition:"top"},he.default.createElement(Ie.default,{"data-test-itsi":"pa-create-train-test-split-slider-control",min:10,max:90,step:10,disabled:this.state.disableTrainInputs,onChange:this.handleSliderChange,value:this.state.trainingSplit})),he.default.createElement(ot,{"data-test-itsi":"pa-train-button",label:(0,De.gettext)("Train"),disabled:!this.state.toTrain,appearance:"primary",onClick:this.onClickTrain})),he.default.createElement(ze,null,P),he.default.createElement($e,null,he.default.createElement("div",null,he.default.createElement("div",null,R),he.default.createElement("div",null,O))))}}])}(he.Component);(0,oe.default)(yt,"propTypes",{isValidTimePeriod:ue.default.func.isRequired,service:ue.default.object.isRequired,runTrainInputSearches:ue.default.bool.isRequired,timePickerAttributes:ue.default.object.isRequired,handleModelCreation:ue.default.func.isRequired,handleTrainProgress:ue.default.func.isRequired,trainingSplit:ue.default.number.isRequired,handleTrainInputSearchesDone:ue.default.func.isRequired,handleTrainTestWorkflowStepUpdate:ue.default.func.isRequired,handleTrainError:ue.default.func.isRequired,handleTrainingInProgress:ue.default.func.isRequired,savedService:ue.default.bool.isRequired,setCurrentAlgoSavedModelId:ue.default.func.isRequired,cancelChanges:ue.default.bool.isRequired,missingRegressionModels:ue.default.array.isRequired,missingClassificationModels:ue.default.array.isRequired,setMissingModels:ue.default.func.isRequired});o.default=yt;s.exports=o.default},7688:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R,O,P,D=S(_(16)),N=S(_(17)),V=S(_(21)),j=S(_(19)),K=S(_(20)),W=S(_(8)),U=S(_(7)),Y=S(_(3)),$=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),X=S(_(2)),Z=S(_(429)),Q=S(_(272)),ee=S(_(64)),te=S(_(34)),ie=S(_(247)),ae=S(_(51)),ne=_(4),re=_(125),se=_(108),le=_(1423),oe=_(434);function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function _callSuper(s,o,_){return o=(0,j.default)(o),(0,V.default)(s,function _isNativeReflectConstruct(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(s){}return function _isNativeReflectConstruct(){return!!s}()}()?Reflect.construct(o,_||[],(0,j.default)(s).constructor):o.apply(s,_))}_(28);var de=X.default.img(R||(R=(0,U.default)(["\n\theight: 150px;\n\twidth: 200px;\n"]))),ce=(0,X.default)(ae.default)(O||(O=(0,U.default)(["\n\tmargin-top: 20px;\n"]))),he=(0,X.default)(Q.default)(P||(P=(0,U.default)(["\n\tborder: none;\n"]))),ue=function(s){function PredictiveAnalyticsInstructionsPane(s){(0,D.default)(this,PredictiveAnalyticsInstructionsPane);for(var o=arguments.length,_=new Array(o>1?o-1:0),S=1;S<o;S++)_[S-1]=arguments[S];return _callSuper(this,PredictiveAnalyticsInstructionsPane,[s,..._])}return(0,K.default)(PredictiveAnalyticsInstructionsPane,s),(0,N.default)(PredictiveAnalyticsInstructionsPane,[{key:"getUsageDashboardUrl",value:function getUsageDashboardUrl(){return(0,le.uiEditURL)("predictive_analytics_usage",{service_id:this.props.serviceId})}},{key:"render",value:function render(){return $.default.createElement("div",{className:"instructionsContainer"},!1===this.props.isReadOnly&&$.default.createElement(ee.default,{"data-test-itsi":"pa-train-heading",level:4},(0,ne.gettext)("TRAIN")),!1===this.props.isReadOnly&&$.default.createElement(ie.default,{"data-test-itsi":"pa-instructions-list",type:"decimal"},$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-instructions-list-item"},(0,ne.gettext)("Select a training period.")),$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-instructions-list-item"},(0,ne.gettext)("Select an algorithm type.")),$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-instructions-list-item"},(0,ne.gettext)("Select the algorithm. Algorithm details are listed below."),$.default.createElement(Z.default,{"data-test-itsi":"pa-instructions-pane-linear-reg-card-layout"},$.default.createElement(he,{"data-test-itsi":"linear-regression-card"},$.default.createElement(Q.default.Header,{title:oe.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES.LINEAR_REGRESSION.name}),$.default.createElement(Q.default.Body,null,$.default.createElement(de,{"data-test-itsi":"linear-regression-img",src:(0,re.createURL)("/static/app/itsi/images/predictive_analytics/LinearRegression.png"),alt:oe.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES.LINEAR_REGRESSION.name}),$.default.createElement("div",null,$.default.createElement(ce,{"data-test-itsi":"algorithm-linear-line-paragraph"},(0,ne.gettext)("This algorithm fits a linear line to your data, using each input (KPIs and historical service health scores) as an additional dimension. It assumes that your data is normal and is highly scalable."))))),$.default.createElement(he,{"data-test-itsi":"random-forest-card"},$.default.createElement(Q.default.Header,{title:oe.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES.RANDOM_FOREST.name}),$.default.createElement(Q.default.Body,null,$.default.createElement(de,{"data-test-itsi":"random-forest-img",src:(0,re.createURL)("/static/app/itsi/images/predictive_analytics/RandomForest.png"),alt:oe.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES.RANDOM_FOREST.name}),$.default.createElement("div",null,$.default.createElement(ce,{"data-test-itsi":"algorithm-historical-paragraph"},(0,ne.gettext)('This algorithm takes the inputs (KPIs and historical service health scores) and forms a random decision tree (a "forest") to determine the output value. This model makes no assumptions about the normalcy of your data, but requires more processing power and takes longer to run.'))))),$.default.createElement(he,{"data-test-itsi":"gradient-boosting-card"},$.default.createElement(Q.default.Header,{title:oe.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES.GRADIENT_BOOSTING.name}),$.default.createElement(Q.default.Body,null,$.default.createElement(de,{"data-test-itsi":"gradient-boosting-img",src:(0,re.createURL)("/static/app/itsi/images/predictive_analytics/GradientBoosting.png"),alt:oe.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES.GRADIENT_BOOSTING.name}),$.default.createElement("div",null,$.default.createElement(ce,{"data-test-itsi":"algorithm-loss-function-paragraph"},(0,ne.gettext)("This algorithm uses a loss function to fit a line to your data, a decision tree, and an additive model to predict the service health score value. Think of this as a combination of the Random Forest Regressor and Linear Regression."))))),$.default.createElement(he,{"data-test-itsi":"logistic-regression-card"},$.default.createElement(Q.default.Header,{title:oe.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES.LOGISTIC_REGRESSION.name}),$.default.createElement(Q.default.Body,null,$.default.createElement(de,{"data-test-itsi":"logistic-regression-img",src:(0,re.createURL)("/static/app/itsi/images/predictive_analytics/LogisticRegression.png"),alt:oe.PREDICTIVE_ANALYTICS_ALGORITHM_NAMES.LOGISTIC_REGRESSION.name}),$.default.createElement("div",null,$.default.createElement(ce,{"data-test-itsi":"algorithm-predictive-paragraph"},(0,ne.gettext)("This algorithm predicts a service health state (Normal, Medium, or Critical) rather than a numerical value. Use this algorithm if you have tuned KPI importance values or adaptive thresholds to normalize your service health scores."))))))),$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-instructions-list-item"},(0,ne.gettext)("Configure the train/test ratio to divide your data into separate training and testing sets.")),$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-instructions-list-item"},(0,ne.gettext)("Click")," ",$.default.createElement("b",null,(0,ne.gettext)("Train"))," ",(0,ne.gettext)("to generate a model."))),$.default.createElement(ee.default,{"data-test-itsi":"pa-test-heading",level:4},(0,ne.gettext)("TEST")),$.default.createElement(ie.default,{"data-test-itsi":"pa-test-instructions-list",type:"decimal"},$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-test-instructions-list-item"},(0,ne.gettext)("Select a model to test.")),$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-test-instructions-list-item"},(0,ne.gettext)("Review the average predicted health score and worst-case scenario.")),$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-test-instructions-list-item"},(0,ne.gettext)("Click")," ",$.default.createElement("b",null,(0,ne.gettext)("Save"))," ",(0,ne.gettext)("to save the model into the service definition.")),$.default.createElement(ie.default.Item,{"data-test-itsi":"pa-test-instructions-list-item"},(0,ne.gettext)("(Optional) Create an alert to be notified if the health score reaches the predicted worst-case level.")+" ",$.default.createElement(te.default,{"data-test-itsi":"predictive-analytics-create-pa-alert-learn-more-link",to:(0,se.makeDocsURL)(se.DOCS_PAGES.ITSI_PA_ALERT),openInNewContext:!0},(0,ne.gettext)("Learn more")))),$.default.createElement(ae.default,{"data-test-itsi":"use-models-rca-paragraph"},(0,ne.gettext)("To use these models to perform root cause analysis on a specific health score prediction, see the")+" ",$.default.createElement(te.default,{"data-test-itsi":"pa-dashboard-link",to:this.getUsageDashboardUrl(),openInNewContext:!0},(0,ne.gettext)("Predictive Analytics Dashboard"))),$.default.createElement(ae.default,{"data-test-itsi":"add-pa-models-gt-paragraph"},(0,ne.gettext)("You can also add predictive models to glass tables.")+" ",$.default.createElement(te.default,{"data-test-itsi":"predictive-analytics-pa-gt-learn-more-link",to:(0,se.makeDocsURL)(se.DOCS_PAGES.ITSI_PA_GT),openInNewContext:!0},(0,ne.gettext)("Learn more"))))}}])}($.Component);(0,W.default)(ue,"propTypes",{isReadOnly:Y.default.bool.isRequired,serviceId:Y.default.string.isRequired});o.default=ue;s.exports=o.default},7689:function(s,o){s.exports='<svg width="384px" height="256px" viewBox="0 0 430 256" id="svg-object-panda">\n\t\t<g id="panda" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n\t\t\t<g fill-rule="nonzero">\n\t\t\t\t<g id="head" transform="translate(0.817390, 0.685989)">\n\t\t\t\t\t<g id="ears" fill="<%- vars.legacyDarkColor %>">\n\t\t\t\t\t\t<circle id="left-ear" cx="48" cy="48" r="48"></circle>\n\t\t\t\t\t\t<circle id="right-ear" cx="284" cy="48" r="48"></circle>\n\t\t\t\t\t</g>\n\t\t\t\t\t<path d="M164.103978,247.480262 C235.58525,247.480262 277.284882,232.958631 296.397582,206.391254 C304.306519,195.397532 308.454162,182.244846 309.52341,166.499205 C310.406489,153.495068 309.265078,139.579898 306.294973,120.944352 C301.538884,91.1028714 285.44967,62.479303 261.238262,41.3671528 C235.29087,18.7412399 201.707705,6 164.220191,6 C126.731192,6 93.1394036,18.7424443 67.1885434,41.3674888 C42.9700495,62.482184 26.8839892,91.1060792 22.1459316,120.94106 C19.0004732,140.747634 17.7860088,155.020052 18.6288306,168.21226 C19.641047,184.055906 23.7530558,197.069283 31.6667392,207.84507 C50.5799027,233.598467 92.1797275,247.480262 164.103978,247.480262 Z" id="face" stroke="<%- vars.legacyDarkColor %>" stroke-width="12" fill="<%- vars.backgroundColor %>"></path>\n\t\t\t\t\t<g id="eyes" transform="translate(48.000000, 60.000000)" fill="<%- vars.legacyDarkColor %>">\n\t\t\t\t\t\t<path d="M37.5547514,92.2496213 C14.3587919,92.2496213 -2.33534898,71.5988402 0.267344078,46.1248106 C2.87003714,20.6507811 23.7839772,0 46.9799367,0 C70.1758962,0 86.8700371,20.6507811 84.2673441,46.1248106 C81.664651,71.5988402 60.7507109,92.2496213 37.5547514,92.2496213 Z M52,60 C56.418278,60 60,56.418278 60,52 C60,47.581722 56.418278,44 52,44 C47.581722,44 44,47.581722 44,52 C44,56.418278 47.581722,60 52,60 Z" id="left-eye"></path>\n\t\t\t\t\t\t<path d="M185.554751,92.2496213 C162.358792,92.2496213 145.664651,71.5988402 148.267344,46.1248106 C150.870037,20.6507811 171.783977,0 194.979937,0 C218.175896,0 234.870037,20.6507811 232.267344,46.1248106 C229.664651,71.5988402 208.750711,92.2496213 185.554751,92.2496213 Z M200,60 C204.418278,60 208,56.418278 208,52 C208,47.581722 204.418278,44 200,44 C195.581722,44 192,47.581722 192,52 C192,56.418278 195.581722,60 200,60 Z" id="right-eye" transform="translate(190.267344, 46.124811) scale(-1, 1) translate(-190.267344, -46.124811) "></path>\n\t\t\t\t\t</g>\n\t\t\t\t\t<path d="M97,179.485281 C97,170.47005 94.6666667,162.308289 90,155 C85.3333333,162.308289 83,170.47005 83,179.485281 C83,193.008129 97,193.008129 97,179.485281 Z" id="tear" fill="<%- vars.syntaxBlue %>"></path>\n\t\t\t\t\t<path d="M168,191.755534 L168,216 L160,216 L160,191.755534 C155.799638,191.09579 151.649194,189.392955 147.548668,186.647029 C145.331007,185.161966 144,182.668776 144,179.9998 L144,176 C144,171.581722 147.581722,168 152,168 L176,168 C180.418278,168 184,171.581722 184,176 L183.999998,179.999803 C183.999998,182.668779 182.668991,185.16197 180.451329,186.647031 C176.350804,189.392956 172.200361,191.09579 168,191.755534 Z" id="nose" fill="<%- vars.legacyDarkColor %>"></path>\n\t\t\t\t\t<path d="M146,222 C151.984069,216.352463 157.984069,213.528695 164,213.528695 C170.015931,213.528695 176.015931,216.352463 182,222" id="lips" stroke="<%- vars.legacyDarkColor %>" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"></path>\n\t\t\t\t</g>\n\t\t\t\t<rect id="hand" fill="<%- vars.legacyDarkColor %>" x="332" y="166" width="52" height="78" rx="26"></rect>\n\t\t\t</g>\n\t\t\t<path d="M367.451214,89.8784068 C367.337111,86.7976247 365.017015,84.4775296 362.050336,84.4775296 C360.148619,84.4775296 358.399039,85.4664226 357.410146,87.1018995 C356.421253,85.5044569 354.671673,84.4775296 352.769956,84.4775296 C349.765242,84.4775296 347.445147,86.7976247 347.369079,89.8784068 C347.254976,92.9591889 349.651139,95.6596275 357.258009,100.984436 C357.296043,101.02247 357.334077,101.02247 357.372112,101.02247 L357.524249,101.02247 C357.562284,101.02247 357.600318,101.02247 357.638352,100.984436 C365.169153,95.6596275 367.565317,92.9591889 367.451214,89.8784068 Z" id="heart" fill="<%- vars.syntaxRed %>" fill-rule="nonzero"></path>\n\t\t</g>\n\t</svg>\n'},7690:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(2888),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},7691:function(s,o,_){"use strict";_.r(o);var S=_(12),R=_.n(S),O=_(2889),P=_.n(O),D={insert:"head",singleton:!1};R()(P.a,D);o.default=P.a.locals||{}},7692:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(2709)),O=S(_(1454)),P=S(_(4005)).default.extend({KpiMainContentView:R.default,ServiceHealthView:O.default});o.default=P;s.exports=o.default},7693:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(2614)),O=S(_(2715)),P=R.default.extend({initEntityRulesView:function initEntityRulesView(){this.specifyEntityRulesView=new O.default({rulesContainerModel:this.service,ruleFieldsBlockList:["services"]})}});o.default=P;s.exports=o.default},815:function(s,o,_){"use strict";var S=_(1);Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var R=S(_(8)),O=function _interopRequireWildcard(s,o){if(!o&&s&&s.__esModule)return s;if(null===s||"object"!=typeof s&&"function"!=typeof s)return{default:s};var _=_getRequireWildcardCache(o);if(_&&_.has(s))return _.get(s);var S={__proto__:null},R=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in s)if("default"!==O&&{}.hasOwnProperty.call(s,O)){var P=R?Object.getOwnPropertyDescriptor(s,O):null;P&&(P.get||P.set)?Object.defineProperty(S,O,P):S[O]=s[O]}return S.default=s,_&&_.set(s,S),S}(_(0)),P=S(_(3)),D=S(_(484)),N=S(_(81)),V=S(_(129)),j=S(_(2364)),K=S(_(39)),W=_(29),U=S(_(2645));function _getRequireWildcardCache(s){if("function"!=typeof WeakMap)return null;var o=new WeakMap,_=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(s){return s?_:o})(s)}function ownKeys(s,o){var _=Object.keys(s);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(s);o&&(S=S.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),_.push.apply(_,S)}return _}function _objectSpread(s){for(var o=1;o<arguments.length;o++){var _=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(_),!0).forEach((function(o){(0,R.default)(s,o,_[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(_)):ownKeys(Object(_)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(_,o))}))}return s}function ThresholdConfigurationViewContainer(s){var{isEntityLevelPreview:o,entityData:_,isDefaultEntityThresholdView:S,isEntityLevelThreshold:R,isReadOnly:P,onThresholdUpdate:K,showPreviewChart:Y,thresholdObj:$,width:X,height:Z}=s,[Q,ee]=(0,O.useState)($),te=(0,O.useRef)($),ie=(0,O.useMemo)(()=>{var s,_,S=(0,N.default)(Q),addIdsToThresholdLevels=s=>{var o,_=(0,N.default)(s);return null!==(o=_.thresholdLevels)&&void 0!==o&&o.length&&(_.thresholdLevels=(0,N.default)(_.thresholdLevels.map(s=>_objectSpread(_objectSpread({},s),{},{id:(0,W.generateUUID)()})))),_},R=o?"entityThresholdsConfig":"aggregateThresholdsConfig";return null!==(s=S[R])&&void 0!==s&&null!==(s=s.thresholdLevels)&&void 0!==s&&s.length&&(S[R]=addIdsToThresholdLevels(S[R])),null!==(_=S.timeVariateThresholdsSpecification)&&void 0!==_&&_.policies&&(S.timeVariateThresholdsSpecification.policies=Object.keys(S.timeVariateThresholdsSpecification.policies).map(s=>{var _=(0,N.default)(_objectSpread(_objectSpread({},S.timeVariateThresholdsSpecification.policies[s]),{},{_key:s})),R=o?"entity_thresholds":"aggregate_thresholds";return _[R]&&(_[R]=addIdsToThresholdLevels(_[R])),_})),S},[o,Q]),ae=(0,O.useCallback)(s=>{var _,S,R=(0,N.default)(s),O=o?"entity_thresholds":"aggregate_thresholds";if(null===(_=R[o?"entityThresholdsConfig":"aggregateThresholdsConfig"])||void 0===_||null===(_=_.thresholdLevels)||void 0===_||_.forEach(s=>(0,j.default)(s,"id")),null!==(S=R.timeVariateThresholdsSpecification)&&void 0!==S&&S.policies){var P={};R.timeVariateThresholdsSpecification.policies.forEach(s=>{var o;null===(o=s[O])||void 0===o||null===(o=o.thresholdLevels)||void 0===o||o.forEach(s=>(0,j.default)(s,"id")),P[s._key]=(0,D.default)((0,N.default)(s),{_key:void 0})}),R.timeVariateThresholdsSpecification.policies=P}te.current=(0,D.default)((0,N.default)(te.current),R),K(R)},[o,K]);return(0,O.useEffect)(()=>{($.isTimeVariateThresholds!==te.current.isTimeVariateThresholds||$.isAdaptiveThresholdsEnabled!==te.current.isAdaptiveThresholdsEnabled||($.isTimeVariateThresholds&&te.current.isTimeVariateThresholds?!(0,V.default)(te.current.timeVariateThresholdsSpecification,$.timeVariateThresholdsSpecification):o?!(0,V.default)(te.current.entityThresholdsConfig,$.entityThresholdsConfig):!(0,V.default)(te.current.aggregateThresholdsConfig,$.aggregateThresholdsConfig)))&&(ee($),te.current=$)},[$]),O.default.createElement(U.default,{isEntityLevelPreview:o,thresholdObj:ie,entityObj:_,width:X,height:Z,isReadOnly:P,isEntityLevelThreshold:R,isDefaultEntityThresholdView:S,onThresholdUpdate:ae,showPreviewChart:Y})}ThresholdConfigurationViewContainer.propTypes={isEntityLevelPreview:P.default.bool.isRequired,thresholdObj:P.default.object.isRequired,width:P.default.number,height:P.default.number,isReadOnly:P.default.bool,entityData:P.default.object,isDefaultEntityThresholdView:P.default.bool,isEntityLevelThreshold:P.default.bool,onThresholdUpdate:P.default.func,showPreviewChart:P.default.bool},ThresholdConfigurationViewContainer.defaultProps={isDefaultEntityThresholdView:!1,isEntityLevelThreshold:!1,isReadOnly:!1,entityData:{},width:1120,height:400,onThresholdUpdate:K.default,showPreviewChart:!0};o.default=ThresholdConfigurationViewContainer;s.exports=o.default},889:function(s,o,_){"use strict";var S;!function(R,O){s.exports?(O.default=O,s.exports=R.document?O(R):O):void 0===(S=function(){return O(R)}.call(o,_,o,s))||(s.exports=S)}("undefined"!=typeof window?window:this,(function(s){function M(s,o,_,S){s.hasOwnProperty(o)||(s[o]=S.apply(null,_))}var o={};return M(o,"Core/Globals.js",[],(function(){var o,_=void 0!==s?s:"undefined"!=typeof window?window:{};return function(s){s.SVG_NS="http://www.w3.org/2000/svg",s.product="Highcharts",s.version="9.3.3",s.win=_,s.doc=s.win.document,s.svg=s.doc&&s.doc.createElementNS&&!!s.doc.createElementNS(s.SVG_NS,"svg").createSVGRect,s.userAgent=s.win.navigator&&s.win.navigator.userAgent||"",s.isChrome=-1!==s.userAgent.indexOf("Chrome"),s.isFirefox=-1!==s.userAgent.indexOf("Firefox"),s.isMS=/(edge|msie|trident)/i.test(s.userAgent)&&!s.win.opera,s.isSafari=!s.isChrome&&-1!==s.userAgent.indexOf("Safari"),s.isTouchDevice=/(Mobile|Android|Windows Phone)/.test(s.userAgent),s.isWebKit=-1!==s.userAgent.indexOf("AppleWebKit"),s.deg2rad=2*Math.PI/360,s.hasBidiBug=s.isFirefox&&4>parseInt(s.userAgent.split("Firefox/")[1],10),s.hasTouch=!!s.win.TouchEvent,s.marginNames=["plotTop","marginRight","marginBottom","plotLeft"],s.noop=function(){},s.supportsPassiveEvents=function(){var o=!1;if(!s.isMS){var _=Object.defineProperty({},"passive",{get:function(){o=!0}});s.win.addEventListener&&s.win.removeEventListener&&(s.win.addEventListener("testPassive",s.noop,_),s.win.removeEventListener("testPassive",s.noop,_))}return o}(),s.charts=[],s.dateFormats={},s.seriesTypes={},s.symbolSizes={},s.chartCount=0}(o||(o={})),o})),M(o,"Core/Utilities.js",[o["Core/Globals.js"]],(function(s){function v(o,_,R,O){var P=_?"Highcharts error":"Highcharts warning";32===o&&(o=P+": Deprecated member");var D=n(o),N=D?P+" #"+o+": www.highcharts.com/errors/"+o+"/":o.toString();if(void 0!==O){var V="";D&&(N+="?"),B(O,(function(s,o){V+="\n - "+o+": "+s,D&&(N+=encodeURI(o)+"="+encodeURI(s))})),N+=V}J(s,"displayError",{chart:R,code:o,message:N,params:O},(function(){if(_)throw Error(N);S.console&&-1===v.messages.indexOf(N)&&console.warn(N)})),v.messages.push(N)}function F(s,o){return parseInt(s,o||10)}function y(s){return"string"==typeof s}function G(s){return"[object Array]"===(s=Object.prototype.toString.call(s))||"[object Array Iterator]"===s}function H(s,o){return!(!s||"object"!=typeof s||o&&G(s))}function A(s){return H(s)&&"number"==typeof s.nodeType}function q(s){var o=s&&s.constructor;return!(!H(s,!0)||A(s)||!o||!o.name||"Object"===o.name)}function n(s){return"number"==typeof s&&!isNaN(s)&&1/0>s&&-1/0<s}function k(s){return null!=s}function e(s,o,_){var S;return y(o)?k(_)?s.setAttribute(o,_):s&&s.getAttribute&&((S=s.getAttribute(o))||"class"!==o||(S=s.getAttribute(o+"Name"))):B(o,(function(o,_){k(o)?s.setAttribute(_,o):s.removeAttribute(_)})),S}function c(s,o){var _;for(_ in s||(s={}),o)s[_]=o[_];return s}function h(){for(var s=arguments,o=s.length,_=0;_<o;_++){var S=s[_];if(null!=S)return S}}function f(o,_){s.isMS&&!s.svg&&_&&void 0!==_.opacity&&(_.filter="alpha(opacity="+100*_.opacity+")"),c(o.style,_)}function w(s,o){return 1e14<s?s:parseFloat(s.toPrecision(o||14))}function B(s,o,_){for(var S in s)Object.hasOwnProperty.call(s,S)&&o.call(_||s[S],s[S],S,s)}function t(o,_,S){function m(_,S){var R=o.removeEventListener||s.removeEventListenerPolyfill;R&&R.call(o,_,S,!1)}function x(s){var S;if(o.nodeName){if(_){var R={};R[_]=!0}else R=s;B(R,(function(o,_){if(s[_])for(S=s[_].length;S--;)m(_,s[_][S].fn)}))}}var R="function"==typeof o&&o.prototype||o;if(Object.hasOwnProperty.call(R,"hcEvents")){var O=R.hcEvents;_?(R=O[_]||[],S?(O[_]=R.filter((function(s){return S!==s.fn})),m(_,S)):(x(O),O[_]=[])):(x(O),delete R.hcEvents)}}function J(o,S,R,O){if(R=R||{},_.createEvent&&(o.dispatchEvent||o.fireEvent&&o!==s)){var P=_.createEvent("Events");P.initEvent(S,!0,!0),R=c(P,R),o.dispatchEvent?o.dispatchEvent(R):o.fireEvent(S,R)}else if(o.hcEvents){R.target||c(R,{preventDefault:function(){R.defaultPrevented=!0},target:o,type:S}),P=[];for(var D=o,N=!1;D.hcEvents;)Object.hasOwnProperty.call(D,"hcEvents")&&D.hcEvents[S]&&(P.length&&(N=!0),P.unshift.apply(P,D.hcEvents[S])),D=Object.getPrototypeOf(D);N&&P.sort((function(s,o){return s.order-o.order})),P.forEach((function(s){!1===s.fn.call(o,R)&&R.preventDefault()}))}O&&!R.defaultPrevented&&O.call(o,R)}var o=s.charts,_=s.doc,S=s.win;(v||(v={})).messages=[],Math.easeInOutSine=function(s){return-.5*(Math.cos(Math.PI*s)-1)};var R=Array.prototype.find?function(s,o){return s.find(o)}:function(s,o){var _,S=s.length;for(_=0;_<S;_++)if(o(s[_],_))return s[_]};B({map:"map",each:"forEach",grep:"filter",reduce:"reduce",some:"some"},(function(o,_){s[_]=function(s){var S;return v(32,!1,void 0,((S={})["Highcharts."+_]="use Array."+o,S)),Array.prototype[o].apply(s,[].slice.call(arguments,1))}}));var O,P=function(){var s=Math.random().toString(36).substring(2,9)+"-",o=0;return function(){return"highcharts-"+(O?"":s)+o++}}();return S.jQuery&&(S.jQuery.fn.highcharts=function(){var _=[].slice.call(arguments);if(this[0])return _[0]?(new(s[y(_[0])?_.shift():"Chart"])(this[0],_[0],_[1]),this):o[e(this[0],"data-highcharts-chart")]}),R={addEvent:function(o,_,S,R){void 0===R&&(R={});var O="function"==typeof o&&o.prototype||o;Object.hasOwnProperty.call(O,"hcEvents")||(O.hcEvents={}),O=O.hcEvents,s.Point&&o instanceof s.Point&&o.series&&o.series.chart&&(o.series.chart.runTrackerClick=!0);var P=o.addEventListener||s.addEventListenerPolyfill;return P&&P.call(o,_,S,!!s.supportsPassiveEvents&&{passive:void 0===R.passive?-1!==_.indexOf("touch"):R.passive,capture:!1}),O[_]||(O[_]=[]),O[_].push({fn:S,order:"number"==typeof R.order?R.order:1/0}),O[_].sort((function(s,o){return s.order-o.order})),function(){t(o,_,S)}},arrayMax:function(s){for(var o=s.length,_=s[0];o--;)s[o]>_&&(_=s[o]);return _},arrayMin:function(s){for(var o=s.length,_=s[0];o--;)s[o]<_&&(_=s[o]);return _},attr:e,clamp:function(s,o,_){return s>o?s<_?s:_:o},cleanRecursively:function z(s,o){var _={};return B(s,(function(S,R){H(s[R],!0)&&!s.nodeType&&o[R]?(S=z(s[R],o[R]),Object.keys(S).length&&(_[R]=S)):(H(s[R])||s[R]!==o[R])&&(_[R]=s[R])})),_},clearTimeout:function(s){k(s)&&clearTimeout(s)},correctFloat:w,createElement:function(s,o,S,R,O){return s=_.createElement(s),o&&c(s,o),O&&f(s,{padding:"0",border:"none",margin:"0"}),S&&f(s,S),R&&R.appendChild(s),s},css:f,defined:k,destroyObjectProperties:function(s,o){B(s,(function(_,S){_&&_!==o&&_.destroy&&_.destroy(),delete s[S]}))},discardElement:function(s){s&&s.parentElement&&s.parentElement.removeChild(s)},erase:function(s,o){for(var _=s.length;_--;)if(s[_]===o){s.splice(_,1);break}},error:v,extend:c,extendClass:function(s,o){var m=function(){};return c(m.prototype=new s,o),m},find:R,fireEvent:J,getMagnitude:function(s){return Math.pow(10,Math.floor(Math.log(s)/Math.LN10))},getNestedProperty:function(s,o){for(s=s.split(".");s.length&&k(o);){var _=s.shift();if(void 0===_||"__proto__"===_)return;if(!k(o=o[_])||"function"==typeof o||"number"==typeof o.nodeType||o===S)return}return o},getStyle:function p(o,_,R){var O=s.getStyle||p;if("width"===_)return _=Math.min(o.offsetWidth,o.scrollWidth),(R=o.getBoundingClientRect&&o.getBoundingClientRect().width)<_&&R>=_-1&&(_=Math.floor(R)),Math.max(0,_-(O(o,"padding-left",!0)||0)-(O(o,"padding-right",!0)||0));if("height"===_)return Math.max(0,Math.min(o.offsetHeight,o.scrollHeight)-(O(o,"padding-top",!0)||0)-(O(o,"padding-bottom",!0)||0));if(S.getComputedStyle||v(27,!0),o=S.getComputedStyle(o,void 0)){var P=o.getPropertyValue(_);h(R,"opacity"!==_)&&(P=F(P))}return P},inArray:function(s,o,_){return v(32,!1,void 0,{"Highcharts.inArray":"use Array.indexOf"}),o.indexOf(s,_)},isArray:G,isClass:q,isDOMElement:A,isFunction:function(s){return"function"==typeof s},isNumber:n,isObject:H,isString:y,keys:function(s){return v(32,!1,void 0,{"Highcharts.keys":"use Object.keys"}),Object.keys(s)},merge:function(){var s,o=arguments,_={},l=function(s,o){return"object"!=typeof s&&(s={}),B(o,(function(_,S){"__proto__"!==S&&"constructor"!==S&&(!H(_,!0)||q(_)||A(_)?s[S]=o[S]:s[S]=l(s[S]||{},_))})),s};!0===o[0]&&(_=o[1],o=Array.prototype.slice.call(o,2));var S=o.length;for(s=0;s<S;s++)_=l(_,o[s]);return _},normalizeTickInterval:function(s,o,_,S,R){var O=s,P=s/(_=h(_,1));for(o||(o=R?[1,1.2,1.5,2,2.5,3,4,5,6,8,10]:[1,2,2.5,5,10],!1===S&&(1===_?o=o.filter((function(s){return 0==s%1})):.1>=_&&(o=[1/_]))),S=0;S<o.length&&(O=o[S],!(R&&O*_>=s||!R&&P<=(o[S]+(o[S+1]||o[S]))/2));S++);return w(O*_,-Math.round(Math.log(.001)/Math.LN10))},objectEach:B,offset:function(s){var o=_.documentElement;return{top:(s=s.parentElement||s.parentNode?s.getBoundingClientRect():{top:0,left:0,width:0,height:0}).top+(S.pageYOffset||o.scrollTop)-(o.clientTop||0),left:s.left+(S.pageXOffset||o.scrollLeft)-(o.clientLeft||0),width:s.width,height:s.height}},pad:function(s,o,_){return Array((o||2)+1-String(s).replace("-","").length).join(_||"0")+s},pick:h,pInt:F,relativeLength:function(s,o,_){return/%$/.test(s)?o*parseFloat(s)/100+(_||0):parseFloat(s)},removeEvent:t,splat:function(s){return G(s)?s:[s]},stableSort:function(s,o){var _,S,R=s.length;for(S=0;S<R;S++)s[S].safeI=S;for(s.sort((function(s,S){return 0===(_=o(s,S))?s.safeI-S.safeI:_})),S=0;S<R;S++)delete s[S].safeI},syncTimeout:function(s,o,_){return 0<o?setTimeout(s,o,_):(s.call(0,_),-1)},timeUnits:{millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:24192e5,year:314496e5},uniqueKey:P,useSerialIds:function(s){return O=h(s,O)},wrap:function(s,o,_){var S=s[o];s[o]=function(){var s=Array.prototype.slice.call(arguments),o=arguments,R=this;return R.proceed=function(){S.apply(R,arguments.length?arguments:o)},s.unshift(S),s=_.apply(this,s),R.proceed=null,s}}}})),M(o,"Core/Chart/ChartDefaults.js",[],(function(){return{panning:{enabled:!1,type:"x"},styledMode:!1,borderRadius:0,colorCount:10,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacing:[10,10,15,10],resetZoomButton:{theme:{zIndex:6},position:{align:"right",x:-10,y:10}},zoomBySingleTouch:!1,width:null,height:null,borderColor:"#335cad",backgroundColor:"#ffffff",plotBorderColor:"#cccccc"}})),M(o,"Core/Color/Color.js",[o["Core/Globals.js"],o["Core/Utilities.js"]],(function(s,o){var _=o.isNumber,S=o.merge,R=o.pInt;return o=function(){function u(o){this.rgba=[NaN,NaN,NaN,NaN],this.input=o;var _=s.Color;return _&&_!==u?new _(o):this instanceof u?void this.init(o):new u(o)}return u.parse=function(s){return s?new u(s):u.None},u.prototype.init=function(s){var o;if("object"==typeof s&&void 0!==s.stops)this.stops=s.stops.map((function(s){return new u(s[1])}));else if("string"==typeof s){if(this.input=s=u.names[s.toLowerCase()]||s,"#"===s.charAt(0)){var _=s.length,S=parseInt(s.substr(1),16);7===_?o=[(16711680&S)>>16,(65280&S)>>8,255&S,1]:4===_&&(o=[(3840&S)>>4|(3840&S)>>8,(240&S)>>4|240&S,(15&S)<<4|15&S,1])}if(!o)for(S=u.parsers.length;S--&&!o;){var R=u.parsers[S];(_=R.regex.exec(s))&&(o=R.parse(_))}}o&&(this.rgba=o)},u.prototype.get=function(s){var o=this.input,R=this.rgba;if("object"==typeof o&&void 0!==this.stops){var O=S(o);return O.stops=[].slice.call(O.stops),this.stops.forEach((function(o,_){O.stops[_]=[O.stops[_][0],o.get(s)]})),O}return R&&_(R[0])?"rgb"===s||!s&&1===R[3]?"rgb("+R[0]+","+R[1]+","+R[2]+")":"a"===s?""+R[3]:"rgba("+R.join(",")+")":o},u.prototype.brighten=function(s){var o=this.rgba;if(this.stops)this.stops.forEach((function(o){o.brighten(s)}));else if(_(s)&&0!==s)for(var S=0;3>S;S++)o[S]+=R(255*s),0>o[S]&&(o[S]=0),255<o[S]&&(o[S]=255);return this},u.prototype.setOpacity=function(s){return this.rgba[3]=s,this},u.prototype.tweenTo=function(s,o){var S=this.rgba,R=s.rgba;return _(S[0])&&_(R[0])?((s=1!==R[3]||1!==S[3])?"rgba(":"rgb(")+Math.round(R[0]+(S[0]-R[0])*(1-o))+","+Math.round(R[1]+(S[1]-R[1])*(1-o))+","+Math.round(R[2]+(S[2]-R[2])*(1-o))+(s?","+(R[3]+(S[3]-R[3])*(1-o)):"")+")":s.input||"none"},u.names={white:"#ffffff",black:"#000000"},u.parsers=[{regex:/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/,parse:function(s){return[R(s[1]),R(s[2]),R(s[3]),parseFloat(s[4],10)]}},{regex:/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/,parse:function(s){return[R(s[1]),R(s[2]),R(s[3]),1]}}],u.None=new u(""),u}()})),M(o,"Core/Color/Palettes.js",[],(function(){return{colors:"#7cb5ec #434348 #90ed7d #f7a35c #8085e9 #f15c80 #e4d354 #2b908f #f45b5b #91e8e1".split(" ")}})),M(o,"Core/Time.js",[o["Core/Globals.js"],o["Core/Utilities.js"]],(function(s,o){var _=s.win,S=o.defined,R=o.error,O=o.extend,P=o.isObject,D=o.merge,N=o.objectEach,V=o.pad,j=o.pick,K=o.splat,W=o.timeUnits,U=s.isSafari&&_.Intl&&_.Intl.DateTimeFormat.prototype.formatRange,Y=s.isSafari&&_.Intl&&!_.Intl.DateTimeFormat.prototype.formatRange;return o=function(){function w(s){this.options={},this.variableTimezone=this.useUTC=!1,this.Date=_.Date,this.getTimezoneOffset=this.timezoneOffsetFunction(),this.update(s)}return w.prototype.get=function(s,o){if(this.variableTimezone||this.timezoneOffset){var _=o.getTime(),S=_-this.getTimezoneOffset(o);return o.setTime(S),s=o["getUTC"+s](),o.setTime(_),s}return this.useUTC?o["getUTC"+s]():o["get"+s]()},w.prototype.set=function(s,o,_){if(this.variableTimezone||this.timezoneOffset){if("Milliseconds"===s||"Seconds"===s||"Minutes"===s&&0==this.getTimezoneOffset(o)%36e5)return o["setUTC"+s](_);var S=this.getTimezoneOffset(o);return S=o.getTime()-S,o.setTime(S),o["setUTC"+s](_),s=this.getTimezoneOffset(o),S=o.getTime()+s,o.setTime(S)}return this.useUTC||U&&"FullYear"===s?o["setUTC"+s](_):o["set"+s](_)},w.prototype.update=function(s){var o=j(s&&s.useUTC,!0);this.options=s=D(!0,this.options||{},s),this.Date=s.Date||_.Date||Date,this.timezoneOffset=(this.useUTC=o)&&s.timezoneOffset,this.getTimezoneOffset=this.timezoneOffsetFunction(),this.variableTimezone=o&&!(!s.getTimezoneOffset&&!s.timezone)},w.prototype.makeTime=function(s,o,_,S,R,O){if(this.useUTC){var P=this.Date.UTC.apply(0,arguments),D=this.getTimezoneOffset(P);P+=D;var N=this.getTimezoneOffset(P);D!==N?P+=N-D:D-36e5!==this.getTimezoneOffset(P-36e5)||Y||(P-=36e5)}else P=new this.Date(s,o,j(_,1),j(S,0),j(R,0),j(O,0)).getTime();return P},w.prototype.timezoneOffsetFunction=function(){var s=this,o=this.options,S=o.getTimezoneOffset,O=o.moment||_.moment;if(!this.useUTC)return function(s){return 6e4*new Date(s.toString()).getTimezoneOffset()};if(o.timezone){if(O)return function(s){return 6e4*-O.tz(s,o.timezone).utcOffset()};R(25)}return this.useUTC&&S?function(s){return 6e4*S(s.valueOf())}:function(){return 6e4*(s.timezoneOffset||0)}},w.prototype.dateFormat=function(o,_,R){if(!S(_)||isNaN(_))return s.defaultOptions.lang&&s.defaultOptions.lang.invalidDate||"";o=j(o,"%Y-%m-%d %H:%M:%S");var P=this,D=new this.Date(_),K=this.get("Hours",D),W=this.get("Day",D),U=this.get("Date",D),Y=this.get("Month",D),$=this.get("FullYear",D),X=s.defaultOptions.lang,Z=X&&X.weekdays,Q=X&&X.shortWeekdays;return D=O({a:Q?Q[W]:Z[W].substr(0,3),A:Z[W],d:V(U),e:V(U,2," "),w:W,b:X.shortMonths[Y],B:X.months[Y],m:V(Y+1),o:Y+1,y:$.toString().substr(2,2),Y:$,H:V(K),k:K,I:V(K%12||12),l:K%12||12,M:V(this.get("Minutes",D)),p:12>K?"AM":"PM",P:12>K?"am":"pm",S:V(D.getSeconds()),L:V(Math.floor(_%1e3),3)},s.dateFormats),N(D,(function(s,S){for(;-1!==o.indexOf("%"+S);)o=o.replace("%"+S,"function"==typeof s?s.call(P,_):s)})),R?o.substr(0,1).toUpperCase()+o.substr(1):o},w.prototype.resolveDTLFormat=function(s){return P(s,!0)?s:{main:(s=K(s))[0],from:s[1],to:s[2]}},w.prototype.getTimeTicks=function(s,o,_,R){var P,D=this,N=[],V={},K=new D.Date(o),U=s.unitRange,Y=s.count||1;if(R=j(R,1),S(o)){if(D.set("Milliseconds",K,U>=W.second?0:Y*Math.floor(D.get("Milliseconds",K)/Y)),U>=W.second&&D.set("Seconds",K,U>=W.minute?0:Y*Math.floor(D.get("Seconds",K)/Y)),U>=W.minute&&D.set("Minutes",K,U>=W.hour?0:Y*Math.floor(D.get("Minutes",K)/Y)),U>=W.hour&&D.set("Hours",K,U>=W.day?0:Y*Math.floor(D.get("Hours",K)/Y)),U>=W.day&&D.set("Date",K,U>=W.month?1:Math.max(1,Y*Math.floor(D.get("Date",K)/Y))),U>=W.month){D.set("Month",K,U>=W.year?0:Y*Math.floor(D.get("Month",K)/Y));var $=D.get("FullYear",K)}U>=W.year&&D.set("FullYear",K,$-$%Y),U===W.week&&($=D.get("Day",K),D.set("Date",K,D.get("Date",K)-$+R+($<R?-7:0))),$=D.get("FullYear",K),R=D.get("Month",K);var X=D.get("Date",K),Z=D.get("Hours",K);for(o=K.getTime(),!D.variableTimezone&&D.useUTC||!S(_)||(P=_-o>4*W.month||D.getTimezoneOffset(o)!==D.getTimezoneOffset(_)),o=K.getTime(),K=1;o<_;)N.push(o),o=U===W.year?D.makeTime($+K*Y,0):U===W.month?D.makeTime($,R+K*Y):!P||U!==W.day&&U!==W.week?P&&U===W.hour&&1<Y?D.makeTime($,R,X,Z+K*Y):o+U*Y:D.makeTime($,R,X+K*Y*(U===W.day?1:7)),K++;N.push(o),U<=W.hour&&1e4>N.length&&N.forEach((function(s){0==s%18e5&&"000000000"===D.dateFormat("%H%M%S%L",s)&&(V[s]="day")}))}return N.info=O(s,{higherRanks:V,totalRange:U*Y}),N},w.prototype.getDateFormat=function(s,o,_,S){var R=this.dateFormat("%m-%d %H:%M:%S.%L",o),O={millisecond:15,second:12,minute:9,hour:6,day:3},P="millisecond";for(D in W){if(s===W.week&&+this.dateFormat("%w",o)===_&&"00:00:00.000"===R.substr(6)){var D="week";break}if(W[D]>s){D=P;break}if(O[D]&&R.substr(O[D])!=="01-01 00:00:00.000".substr(O[D]))break;"week"!==D&&(P=D)}if(D)var N=this.resolveDTLFormat(S[D]).main;return N},w}()})),M(o,"Core/DefaultOptions.js",[o["Core/Chart/ChartDefaults.js"],o["Core/Color/Color.js"],o["Core/Globals.js"],o["Core/Color/Palettes.js"],o["Core/Time.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O){o=o.parse;var P=O.merge,D={colors:S.colors,symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:"January February March April May June July August September October November December".split(" "),shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),weekdays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),decimalPoint:".",numericSymbols:"kMGTPE".split(""),resetZoom:"Reset zoom",resetZoomTitle:"Reset zoom level 1:1",thousandsSep:" "},global:{},time:{Date:void 0,getTimezoneOffset:void 0,timezone:void 0,timezoneOffset:0,useUTC:!0},chart:s,title:{text:"Chart title",align:"center",margin:15,widthAdjust:-44},subtitle:{text:"",align:"center",widthAdjust:-44},caption:{margin:15,text:"",align:"left",verticalAlign:"bottom"},plotOptions:{},labels:{style:{position:"absolute",color:"#333333"}},legend:{enabled:!0,align:"center",alignColumns:!0,className:"highcharts-no-tooltip",layout:"horizontal",labelFormatter:function(){return this.name},borderColor:"#999999",borderRadius:0,navigation:{activeColor:"#003399",inactiveColor:"#cccccc"},itemStyle:{color:"#333333",cursor:"pointer",fontSize:"12px",fontWeight:"bold",textOverflow:"ellipsis"},itemHoverStyle:{color:"#000000"},itemHiddenStyle:{color:"#cccccc"},shadow:!1,itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},squareSymbol:!0,symbolPadding:5,verticalAlign:"bottom",x:0,y:0,title:{style:{fontWeight:"bold"}}},loading:{labelStyle:{fontWeight:"bold",position:"relative",top:"45%"},style:{position:"absolute",backgroundColor:"#ffffff",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,animation:_.svg,borderRadius:3,dateTimeLabelFormats:{millisecond:"%A, %b %e, %H:%M:%S.%L",second:"%A, %b %e, %H:%M:%S",minute:"%A, %b %e, %H:%M",hour:"%A, %b %e, %H:%M",day:"%A, %b %e, %Y",week:"Week from %A, %b %e, %Y",month:"%B %Y",year:"%Y"},footerFormat:"",headerShape:"callout",hideDelay:500,padding:8,shape:"callout",shared:!1,snap:_.isTouchDevice?25:10,headerFormat:'<span style="font-size: 10px">{point.key}</span><br/>',pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.y}</b><br/>',backgroundColor:o("#f7f7f7").setOpacity(.85).get(),borderWidth:1,shadow:!0,stickOnContact:!1,style:{color:"#333333",cursor:"default",fontSize:"12px",whiteSpace:"nowrap"},useHTML:!1},credits:{enabled:!0,href:"https://www.highcharts.com?credits",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#999999",fontSize:"9px"},text:"Highcharts.com"}};D.chart.styledMode=!1;var N=new R(P(D.global,D.time));return s={defaultOptions:D,defaultTime:N,getOptions:function(){return D},setOptions:function(s){return P(!0,D,s),(s.time||s.global)&&(_.time?_.time.update(P(D.global,D.time,s.global,s.time)):_.time=N),D}}})),M(o,"Core/Animation/Fx.js",[o["Core/Color/Color.js"],o["Core/Globals.js"],o["Core/Utilities.js"]],(function(s,o,_){var S=s.parse,R=o.win,O=_.isNumber,P=_.objectEach;return function(){function a(s,o,_){this.pos=NaN,this.options=o,this.elem=s,this.prop=_}return a.prototype.dSetter=function(){var s=this.paths,o=s&&s[0];s=s&&s[1];var _=this.now||0,S=[];if(1!==_&&o&&s)if(o.length===s.length&&1>_)for(var R=0;R<s.length;R++){for(var P=o[R],D=s[R],N=[],V=0;V<D.length;V++){var j=P[V],K=D[V];O(j)&&O(K)&&("A"!==D[0]||4!==V&&5!==V)?N[V]=j+_*(K-j):N[V]=K}S.push(N)}else S=s;else S=this.toD||[];this.elem.attr("d",S,void 0,!0)},a.prototype.update=function(){var s=this.elem,o=this.prop,_=this.now,S=this.options.step;this[o+"Setter"]?this[o+"Setter"]():s.attr?s.element&&s.attr(o,_,null,!0):s.style[o]=_+this.unit,S&&S.call(s,_,this)},a.prototype.run=function(s,o,_){var S=this,O=S.options,h=function(s){return!h.stopped&&S.step(s)},P=R.requestAnimationFrame||function(s){setTimeout(s,13)},w=function(){for(var s=0;s<a.timers.length;s++)a.timers[s]()||a.timers.splice(s--,1);a.timers.length&&P(w)};s!==o||this.elem["forceAnimate:"+this.prop]?(this.startTime=+new Date,this.start=s,this.end=o,this.unit=_,this.now=this.start,this.pos=0,h.elem=this.elem,h.prop=this.prop,h()&&1===a.timers.push(h)&&P(w)):(delete O.curAnim[this.prop],O.complete&&0===Object.keys(O.curAnim).length&&O.complete.call(this.elem))},a.prototype.step=function(s){var o=+new Date,_=this.options,S=this.elem,R=_.complete,O=_.duration,D=_.curAnim;if(S.attr&&!S.element)s=!1;else if(s||o>=O+this.startTime){this.now=this.end,this.pos=1,this.update();var N=D[this.prop]=!0;P(D,(function(s){!0!==s&&(N=!1)})),N&&R&&R.call(S),s=!1}else this.pos=_.easing((o-this.startTime)/O),this.now=this.start+(this.end-this.start)*this.pos,this.update(),s=!0;return s},a.prototype.initPath=function(s,o,_){function e(s,o){for(;s.length<j;){var _=s[0],S=o[j-s.length];S&&"M"===_[0]&&(s[0]="C"===S[0]?["C",_[1],_[2],_[1],_[2],_[1],_[2]]:["L",_[1],_[2]]),s.unshift(_),P&&(_=s.pop(),s.push(s[s.length-1],_))}}function c(s,o){for(;s.length<j;)if("C"===(o=s[Math.floor(s.length/D)-1].slice())[0]&&(o[1]=o[5],o[2]=o[6]),P){var _=s[Math.floor(s.length/D)].slice();s.splice(s.length/2,0,o,_)}else s.push(o)}var S=s.startX,R=s.endX;_=_.slice();var P=s.isArea,D=P?2:1;if(!(o=o&&o.slice()))return[_,_];if(S&&R&&R.length){for(s=0;s<S.length;s++){if(S[s]===R[0]){var N=s;break}if(S[0]===R[R.length-S.length+s]){N=s;var V=!0;break}if(S[S.length-1]===R[R.length-S.length+s]){N=S.length-s;break}}void 0===N&&(o=[])}if(o.length&&O(N)){var j=_.length+N*D;V?(e(o,_),c(_,o)):(e(_,o),c(o,_))}return[o,_]},a.prototype.fillSetter=function(){a.prototype.strokeSetter.apply(this,arguments)},a.prototype.strokeSetter=function(){this.elem.attr(this.prop,S(this.start).tweenTo(S(this.end),this.pos),void 0,!0)},a.timers=[],a}()})),M(o,"Core/Animation/AnimationUtilities.js",[o["Core/Animation/Fx.js"],o["Core/Utilities.js"]],(function(s,o){function v(s){return P(s)?D({duration:500,defer:0},s):{duration:s?500:0,defer:0}}function F(o,_){for(var S=s.timers.length;S--;)s.timers[S].elem!==o||_&&_!==s.timers[S].prop||(s.timers[S].stopped=!0)}var _=o.defined,S=o.getStyle,R=o.isArray,O=o.isNumber,P=o.isObject,D=o.merge,N=o.objectEach,V=o.pick;return{animate:function(o,_,V){var j,K,W,U="";if(!P(V)){var Y=arguments;V={duration:Y[2],easing:Y[3],complete:Y[4]}}O(V.duration)||(V.duration=400),V.easing="function"==typeof V.easing?V.easing:Math[V.easing]||Math.easeInOutSine,V.curAnim=D(_),N(_,(function(O,P){F(o,P),W=new s(o,V,P),K=void 0,"d"===P&&R(_.d)?(W.paths=W.initPath(o,o.pathArray,_.d),W.toD=_.d,j=0,K=1):o.attr?j=o.attr(P):(j=parseFloat(S(o,P))||0,"opacity"!==P&&(U="px")),K||(K=O),"string"==typeof K&&K.match("px")&&(K=K.replace(/px/g,"")),W.run(j,K,U)}))},animObject:v,getDeferredAnimation:function(s,o,S){var R=v(o),O=0,P=0;return(S?[S]:s.series).forEach((function(s){s=v(s.options.animation),O=o&&_(o.defer)?R.defer:Math.max(O,s.duration+s.defer),P=Math.min(R.duration,s.duration)})),s.renderer.forExport&&(O=0),{defer:Math.max(0,O-P),duration:Math.min(O,P)}},setAnimation:function(s,o){o.renderer.globalAnimation=V(s,o.options.chart.animation,!0)},stop:F}})),M(o,"Core/Renderer/HTML/AST.js",[o["Core/Globals.js"],o["Core/Utilities.js"]],(function(s,o){var _=s.SVG_NS,S=o.attr,R=o.createElement,O=o.error,P=o.isFunction,D=o.isString,N=o.objectEach,V=o.splat,j=(o=s.win.trustedTypes)&&P(o.createPolicy)&&o.createPolicy("highcharts",{createHTML:function(s){return s}}),K=j?j.createHTML(""):"";try{var W=!!(new DOMParser).parseFromString(K,"text/html")}catch(s){W=!1}return P=function(){function h(s){this.nodes="string"==typeof s?this.parseMarkup(s):s}return h.filterUserAttributes=function(s){return N(s,(function(o,_){var S=!0;-1===h.allowedAttributes.indexOf(_)&&(S=!1),-1!==["background","dynsrc","href","lowsrc","src"].indexOf(_)&&(S=D(o)&&h.allowedReferences.some((function(s){return 0===o.indexOf(s)}))),S||(O("Highcharts warning: Invalid attribute '"+_+"' in config"),delete s[_])})),s},h.setElementHTML=function(s,o){s.innerHTML=h.emptyHTML,o&&new h(o).addToDOM(s)},h.prototype.addToDOM=function(o){return function e(o,R){var P;return V(o).forEach((function(o){var D=o.tagName,V=o.textContent?s.doc.createTextNode(o.textContent):void 0;if(D)if("#text"===D)var j=V;else if(-1!==h.allowedTags.indexOf(D)){D=s.doc.createElementNS("svg"===D?_:R.namespaceURI||_,D);var K=o.attributes||{};N(o,(function(s,o){"tagName"!==o&&"attributes"!==o&&"children"!==o&&"textContent"!==o&&(K[o]=s)})),S(D,h.filterUserAttributes(K)),V&&D.appendChild(V),e(o.children||[],D),j=D}else O("Highcharts warning: Invalid tagName "+D+" in config");j&&R.appendChild(j),P=j})),P}(this.nodes,o)},h.prototype.parseMarkup=function(s){var o=[];if(s=s.trim(),W)s=(new DOMParser).parseFromString(j?j.createHTML(s):s,"text/html");else{var _=R("div");_.innerHTML=s,s={body:_}}var f=function(s,o){var _=s.nodeName.toLowerCase(),S={tagName:_};if("#text"===_&&(S.textContent=s.textContent||""),_=s.attributes){var R={};[].forEach.call(_,(function(s){R[s.name]=s.value})),S.attributes=R}if(s.childNodes.length){var O=[];[].forEach.call(s.childNodes,(function(s){f(s,O)})),O.length&&(S.children=O)}o.push(S)};return[].forEach.call(s.body.childNodes,(function(s){return f(s,o)})),o},h.allowedAttributes="aria-controls aria-describedby aria-expanded aria-haspopup aria-hidden aria-label aria-labelledby aria-live aria-pressed aria-readonly aria-roledescription aria-selected class clip-path color colspan cx cy d dx dy disabled fill height href id in markerHeight markerWidth offset opacity orient padding paddingLeft paddingRight patternUnits r refX refY role scope slope src startOffset stdDeviation stroke stroke-linecap stroke-width style tableValues result rowspan summary target tabindex text-align textAnchor textLength title type valign width x x1 x2 y y1 y2 zIndex".split(" "),h.allowedReferences="https:// http:// mailto: / ../ ./ #".split(" "),h.allowedTags="a abbr b br button caption circle clipPath code dd defs div dl dt em feComponentTransfer feFuncA feFuncB feFuncG feFuncR feGaussianBlur feOffset feMerge feMergeNode filter h1 h2 h3 h4 h5 h6 hr i img li linearGradient marker ol p path pattern pre rect small span stop strong style sub sup svg table text thead tbody tspan td th tr u ul #text".split(" "),h.emptyHTML=K,h}()})),M(o,"Core/FormatUtilities.js",[o["Core/DefaultOptions.js"],o["Core/Utilities.js"]],(function(s,o){function v(s,o,S,R){s=+s||0,o=+o;var N=_.lang,V=(s.toString().split(".")[1]||"").split("e")[0].length,j=s.toString().split("e"),K=o;if(-1===o)o=Math.min(V,20);else if(O(o)){if(o&&j[1]&&0>j[1]){var W=o+ +j[1];0<=W?(j[0]=(+j[0]).toExponential(W).split("e")[0],o=W):(j[0]=j[0].split(".")[0]||0,s=20>o?(j[0]*Math.pow(10,j[1])).toFixed(o):0,j[1]=0)}}else o=2;W=(Math.abs(j[1]?j[0]:s)+Math.pow(10,-Math.max(o,V)-1)).toFixed(o);var U=3<(V=String(D(W))).length?V.length%3:0;return S=P(S,N.decimalPoint),R=P(R,N.thousandsSep),s=(0>s?"-":"")+(U?V.substr(0,U)+R:""),s=0>+j[1]&&!K?"0":s+V.substr(U).replace(/(\d{3})(?=\d)/g,"$1"+R),o&&(s+=S+W.slice(-o)),j[1]&&0!=+s&&(s+="e"+j[1]),s}var _=s.defaultOptions,S=s.defaultTime,R=o.getNestedProperty,O=o.isNumber,P=o.pick,D=o.pInt;return{dateFormat:function(s,o,_){return S.dateFormat(s,o,_)},format:function(s,o,O){var P="{",D=!1,N=/f$/,V=/\.([0-9])/,j=_.lang,K=O&&O.time||S;O=O&&O.numberFormatter||v;for(var W=[];s;){var U=s.indexOf(P);if(-1===U)break;var Y=s.slice(0,U);if(D){if(Y=Y.split(":"),P=R(Y.shift()||"",o),Y.length&&"number"==typeof P)if(Y=Y.join(":"),N.test(Y)){var $=parseInt((Y.match(V)||["","-1"])[1],10);null!==P&&(P=O(P,$,j.decimalPoint,-1<Y.indexOf(",")?j.thousandsSep:""))}else P=K.dateFormat(Y,P);W.push(P)}else W.push(Y);s=s.slice(U+1),P=(D=!D)?"}":"{"}return W.push(s),W.join("")},numberFormat:v}})),M(o,"Core/Renderer/RendererUtilities.js",[o["Core/Utilities.js"]],(function(s){var o,_=s.clamp,S=s.pick,R=s.stableSort;return function(s){s.distribute=function u(s,o,O){var P,D=s,N=D.reducedLen||o,c=function(s,o){return(o.rank||0)-(s.rank||0)},h=function(s,o){return s.target-o.target},V=!0,j=[],K=0;for(P=s.length;P--;)K+=s[P].size;if(K>N){for(R(s,c),K=P=0;K<=N;)K+=s[P].size,P++;j=s.splice(P-1,s.length)}for(R(s,h),s=s.map((function(s){return{size:s.size,targets:[s.target],align:S(s.align,.5)}}));V;){for(P=s.length;P--;)N=s[P],c=(Math.min.apply(0,N.targets)+Math.max.apply(0,N.targets))/2,N.pos=_(c-N.size*N.align,0,o-N.size);for(P=s.length,V=!1;P--;)0<P&&s[P-1].pos+s[P-1].size>s[P].pos&&(s[P-1].size+=s[P].size,s[P-1].targets=s[P-1].targets.concat(s[P].targets),s[P-1].align=.5,s[P-1].pos+s[P-1].size>o&&(s[P-1].pos=o-s[P-1].size),s.splice(P,1),V=!0)}return D.push.apply(D,j),P=0,s.some((function(s){var _=0;return(s.targets||[]).some((function(){return D[P].pos=s.pos+_,void 0!==O&&Math.abs(D[P].pos-D[P].target)>O?(D.slice(0,P+1).forEach((function(s){return delete s.pos})),D.reducedLen=(D.reducedLen||o)-.1*o,D.reducedLen>.1*o&&u(D,o,O),!0):(_+=D[P].size,P++,!1)}))})),R(D,h),D}}(o||(o={})),o})),M(o,"Core/Renderer/SVG/SVGElement.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/Renderer/HTML/AST.js"],o["Core/Color/Color.js"],o["Core/Globals.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R){var O=s.animate,P=s.animObject,D=s.stop,N=S.deg2rad,V=S.doc,j=S.noop,K=S.svg,W=S.SVG_NS,U=S.win,Y=R.addEvent,$=R.attr,X=R.createElement,Z=R.css,Q=R.defined,ee=R.erase,te=R.extend,ie=R.fireEvent,ae=R.isArray,ne=R.isFunction,re=R.isNumber,se=R.isString,le=R.merge,oe=R.objectEach,de=R.pick,ce=R.pInt,he=R.syncTimeout,ue=R.uniqueKey;return(s=function(){function a(){this.element=void 0,this.onEvents={},this.opacity=1,this.renderer=void 0,this.SVG_NS=W,this.symbolCustomAttribs="x y width height r start end innerR anchorX anchorY rounded".split(" ")}return a.prototype._defaultGetter=function(s){return s=de(this[s+"Value"],this[s],this.element?this.element.getAttribute(s):null,0),/^[\-0-9\.]+$/.test(s)&&(s=parseFloat(s)),s},a.prototype._defaultSetter=function(s,o,_){_.setAttribute(o,s)},a.prototype.add=function(s){var o=this.renderer,_=this.element;if(s&&(this.parentGroup=s),this.parentInverted=s&&s.inverted,void 0!==this.textStr&&"text"===this.element.nodeName&&o.buildText(this),this.added=!0,!s||s.handleZ||this.zIndex)var S=this.zIndexSetter();return S||(s?s.element:o.box).appendChild(_),this.onAdd&&this.onAdd(),this},a.prototype.addClass=function(s,o){var _=o?"":this.attr("class")||"";return(s=(s||"").split(/ /g).reduce((function(s,o){return-1===_.indexOf(o)&&s.push(o),s}),_?[_]:[]).join(" "))!==_&&this.attr("class",s),this},a.prototype.afterSetters=function(){this.doTransform&&(this.updateTransform(),this.doTransform=!1)},a.prototype.align=function(s,o,_){var S,R,O,P={},D=this.renderer,N=D.alignedObjects;s?(this.alignOptions=s,this.alignByTranslate=o,(!_||se(_))&&(this.alignTo=S=_||"renderer",ee(N,this),N.push(this),_=void 0)):(s=this.alignOptions,o=this.alignByTranslate,S=this.alignTo),_=de(_,D[S],"scrollablePlotBox"===S?D.plotBox:void 0,D),S=s.align;var V=s.verticalAlign;return D=(_.x||0)+(s.x||0),N=(_.y||0)+(s.y||0),"right"===S?R=1:"center"===S&&(R=2),R&&(D+=(_.width-(s.width||0))/R),P[o?"translateX":"x"]=Math.round(D),"bottom"===V?O=1:"middle"===V&&(O=2),O&&(N+=(_.height-(s.height||0))/O),P[o?"translateY":"y"]=Math.round(N),this[this.placed?"animate":"attr"](P),this.placed=!0,this.alignAttr=P,this},a.prototype.alignSetter=function(s){var o={left:"start",center:"middle",right:"end"};o[s]&&(this.alignValue=s,this.element.setAttribute("text-anchor",o[s]))},a.prototype.animate=function(s,o,_){var S=this,R=P(de(o,this.renderer.globalAnimation,!0));return o=R.defer,de(V.hidden,V.msHidden,V.webkitHidden,!1)&&(R.duration=0),0!==R.duration?(_&&(R.complete=_),he((function(){S.element&&O(S,s,R)}),o)):(this.attr(s,void 0,_),oe(s,(function(s,o){R.step&&R.step.call(this,s,{prop:o,pos:1,elem:this})}),this)),this},a.prototype.applyTextOutline=function(s){var o=this.element;-1!==s.indexOf("contrast")&&(s=s.replace(/contrast/g,this.renderer.getContrast(o.style.fill)));var _=s.split(" ");if(s=_[_.length-1],(_=_[0])&&"none"!==_&&S.svg){this.fakeTS=!0,this.ySetter=this.xSetter,_=_.replace(/(^[\d\.]+)(.*?)$/g,(function(s,o,_){return 2*Number(o)+_})),this.removeTextOutline();var R=V.createElementNS(W,"tspan");$(R,{class:"highcharts-text-outline",fill:s,stroke:s,"stroke-width":_,"stroke-linejoin":"round"}),[].forEach.call(o.childNodes,(function(s){var o=s.cloneNode(!0);o.removeAttribute&&["fill","stroke","stroke-width","stroke"].forEach((function(s){return o.removeAttribute(s)})),R.appendChild(o)}));var O=V.createElementNS(W,"tspan");O.textContent="",["x","y"].forEach((function(s){var _=o.getAttribute(s);_&&O.setAttribute(s,_)})),R.appendChild(O),o.insertBefore(R,o.firstChild)}},a.prototype.attr=function(s,o,_,S){var R,O,P,N=this.element,V=this.symbolCustomAttribs,j=this;if("string"==typeof s&&void 0!==o){var K=s;(s={})[K]=o}return"string"==typeof s?j=(this[s+"Getter"]||this._defaultGetter).call(this,s,N):(oe(s,(function(o,_){O=!1,S||D(this,_),this.symbolName&&-1!==V.indexOf(_)&&(R||(this.symbolAttr(s),R=!0),O=!0),!this.rotation||"x"!==_&&"y"!==_||(this.doTransform=!0),O||((P=this[_+"Setter"]||this._defaultSetter).call(this,o,_,N),!this.styledMode&&this.shadows&&/^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(_)&&this.updateShadows(_,o,P))}),this),this.afterSetters()),_&&_.call(this),j},a.prototype.clip=function(s){return this.attr("clip-path",s?"url("+this.renderer.url+"#"+s.id+")":"none")},a.prototype.crisp=function(s,o){o=o||s.strokeWidth||0;var _=Math.round(o)%2/2;return s.x=Math.floor(s.x||this.x||0)+_,s.y=Math.floor(s.y||this.y||0)+_,s.width=Math.floor((s.width||this.width||0)-2*_),s.height=Math.floor((s.height||this.height||0)-2*_),Q(s.strokeWidth)&&(s.strokeWidth=o),s},a.prototype.complexColor=function(s,o,S){var R,O,P,D,N,V,j,K,W,U,Y,$=this.renderer,X=[];ie(this.renderer,"complexColor",{args:arguments},(function(){if(s.radialGradient?O="radialGradient":s.linearGradient&&(O="linearGradient"),O){if(P=s[O],N=$.gradients,V=s.stops,W=S.radialReference,ae(P)&&(s[O]=P={x1:P[0],y1:P[1],x2:P[2],y2:P[3],gradientUnits:"userSpaceOnUse"}),"radialGradient"===O&&W&&!Q(P.gradientUnits)&&(D=P,P=le(P,$.getRadialAttr(W,D),{gradientUnits:"userSpaceOnUse"})),oe(P,(function(s,o){"id"!==o&&X.push(o,s)})),oe(V,(function(s){X.push(s)})),X=X.join(","),N[X])U=N[X].attr("id");else{P.id=U=ue();var Z=N[X]=$.createElement(O).attr(P).add($.defs);Z.radAttr=D,Z.stops=[],V.forEach((function(s){0===s[1].indexOf("rgba")?(R=_.parse(s[1]),j=R.get("rgb"),K=R.get("a")):(j=s[1],K=1),s=$.createElement("stop").attr({offset:s[0],"stop-color":j,"stop-opacity":K}).add(Z),Z.stops.push(s)}))}Y="url("+$.url+"#"+U+")",S.setAttribute(o,Y),S.gradient=X,s.toString=function(){return Y}}}))},a.prototype.css=function(s){var o=this.styles,_={},S=this.element,R=["textOutline","textOverflow","width"],O="",P=!o;if(s&&s.color&&(s.fill=s.color),o&&oe(s,(function(s,S){o&&o[S]!==s&&(_[S]=s,P=!0)})),P){if(o&&(s=te(o,_)),s)if(null===s.width||"auto"===s.width)delete this.textWidth;else if("text"===S.nodeName.toLowerCase()&&s.width)var D=this.textWidth=ce(s.width);if(this.styles=s,D&&!K&&this.renderer.forExport&&delete s.width,S.namespaceURI===this.SVG_NS){var E=function(s,o){return"-"+o.toLowerCase()};oe(s,(function(s,o){-1===R.indexOf(o)&&(O+=o.replace(/([A-Z])/g,E)+":"+s+";")})),O&&$(S,"style",O)}else Z(S,s);this.added&&("text"===this.element.nodeName&&this.renderer.buildText(this),s&&s.textOutline&&this.applyTextOutline(s.textOutline))}return this},a.prototype.dashstyleSetter=function(s){var o=this["stroke-width"];if("inherit"===o&&(o=1),s=s&&s.toLowerCase()){var _=s.replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").split(",");for(s=_.length;s--;)_[s]=""+ce(_[s])*de(o,NaN);s=_.join(",").replace(/NaN/g,"none"),this.element.setAttribute("stroke-dasharray",s)}},a.prototype.destroy=function(){var s=this,o=s.element||{},_=s.renderer,S=o.ownerSVGElement,R=_.isSVG&&"SPAN"===o.nodeName&&s.parentGroup||void 0;if(o.onclick=o.onmouseout=o.onmouseover=o.onmousemove=o.point=null,D(s),s.clipPath&&S){var O=s.clipPath;[].forEach.call(S.querySelectorAll("[clip-path],[CLIP-PATH]"),(function(s){-1<s.getAttribute("clip-path").indexOf(O.element.id)&&s.removeAttribute("clip-path")})),s.clipPath=O.destroy()}if(s.stops){for(S=0;S<s.stops.length;S++)s.stops[S].destroy();s.stops.length=0,s.stops=void 0}for(s.safeRemoveChild(o),_.styledMode||s.destroyShadows();R&&R.div&&0===R.div.childNodes.length;)o=R.parentGroup,s.safeRemoveChild(R.div),delete R.div,R=o;s.alignTo&&ee(_.alignedObjects,s),oe(s,(function(o,_){s[_]&&s[_].parentGroup===s&&s[_].destroy&&s[_].destroy(),delete s[_]}))},a.prototype.destroyShadows=function(){(this.shadows||[]).forEach((function(s){this.safeRemoveChild(s)}),this),this.shadows=void 0},a.prototype.destroyTextPath=function(s,o){var _=s.getElementsByTagName("text")[0];if(_){if(_.removeAttribute("dx"),_.removeAttribute("dy"),o.element.setAttribute("id",""),this.textPathWrapper&&_.getElementsByTagName("textPath").length){for(s=this.textPathWrapper.element.childNodes;s.length;)_.appendChild(s[0]);_.removeChild(this.textPathWrapper.element)}}else(s.getAttribute("dx")||s.getAttribute("dy"))&&(s.removeAttribute("dx"),s.removeAttribute("dy"));this.textPathWrapper&&(this.textPathWrapper=this.textPathWrapper.destroy())},a.prototype.dSetter=function(s,o,_){ae(s)&&("string"==typeof s[0]&&(s=this.renderer.pathToSegments(s)),this.pathArray=s,s=s.reduce((function(s,o,_){return o&&o.join?(_?s+" ":"")+o.join(" "):(o||"").toString()}),"")),/(NaN| {2}|^$)/.test(s)&&(s="M 0 0"),this[o]!==s&&(_.setAttribute(o,s),this[o]=s)},a.prototype.fadeOut=function(s){var o=this;o.animate({opacity:0},{duration:de(s,150),complete:function(){o.attr({y:-9999}).hide()}})},a.prototype.fillSetter=function(s,o,_){"string"==typeof s?_.setAttribute(o,s):s&&this.complexColor(s,o,_)},a.prototype.getBBox=function(s,o){var _=this.renderer,S=this.element,R=this.styles,O=this.textStr,P=_.cache,D=_.cacheKeys,V=S.namespaceURI===this.SVG_NS;o=de(o,this.rotation,0);var j,K=_.styledMode?S&&a.prototype.getStyle.call(S,"font-size"):R&&R.fontSize;if(Q(O)){var W=O.toString();-1===W.indexOf("<")&&(W=W.replace(/[0-9]/g,"0")),W+=["",o,K,this.textWidth,R&&R.textOverflow,R&&R.fontWeight].join()}if(W&&!s&&(j=P[W]),!j){if(V||_.forExport){try{var U=this.fakeTS&&function(s){var o=S.querySelector(".highcharts-text-outline");o&&Z(o,{display:s})};ne(U)&&U("none"),j=S.getBBox?te({},S.getBBox()):{width:S.offsetWidth,height:S.offsetHeight},ne(U)&&U("")}catch(s){}(!j||0>j.width)&&(j={width:0,height:0})}else j=this.htmlGetBBox();if(_.isSVG&&(s=j.width,_=j.height,V&&(j.height=_={"11px,17":14,"13px,20":16}[(K||"")+","+Math.round(_)]||_),o&&(V=o*N,j.width=Math.abs(_*Math.sin(V))+Math.abs(s*Math.cos(V)),j.height=Math.abs(_*Math.cos(V))+Math.abs(s*Math.sin(V)))),W&&(""===O||0<j.height)){for(;250<D.length;)delete P[D.shift()];P[W]||D.push(W),P[W]=j}}return j},a.prototype.getStyle=function(s){return U.getComputedStyle(this.element||this,"").getPropertyValue(s)},a.prototype.hasClass=function(s){return-1!==(""+this.attr("class")).split(" ").indexOf(s)},a.prototype.hide=function(s){return s?this.attr({y:-9999}):this.attr({visibility:"hidden"}),this},a.prototype.htmlGetBBox=function(){return{height:0,width:0,x:0,y:0}},a.prototype.init=function(s,o){this.element="span"===o?X(o):V.createElementNS(this.SVG_NS,o),this.renderer=s,ie(this,"afterInit")},a.prototype.invert=function(s){return this.inverted=s,this.updateTransform(),this},a.prototype.on=function(s,o){var _=this.onEvents;return _[s]&&_[s](),_[s]=Y(this.element,s,o),this},a.prototype.opacitySetter=function(s,o,_){this.opacity=s=Number(Number(s).toFixed(3)),_.setAttribute(o,s)},a.prototype.removeClass=function(s){return this.attr("class",(""+this.attr("class")).replace(se(s)?new RegExp("(^| )"+s+"( |$)"):s," ").replace(/ +/g," ").trim())},a.prototype.removeTextOutline=function(){var s=this.element.querySelector("tspan.highcharts-text-outline");s&&this.safeRemoveChild(s)},a.prototype.safeRemoveChild=function(s){var o=s.parentNode;o&&o.removeChild(s)},a.prototype.setRadialReference=function(s){var o=this.element.gradient&&this.renderer.gradients[this.element.gradient];return this.element.radialReference=s,o&&o.radAttr&&o.animate(this.renderer.getRadialAttr(s,o.radAttr)),this},a.prototype.setTextPath=function(s,_){var S=this.element,R=this.text?this.text.element:S,O={textAnchor:"text-anchor"},P=!1,D=this.textPathWrapper,N=!D;_=le(!0,{enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},_);var V=o.filterUserAttributes(_.attributes);if(s&&_&&_.enabled){D&&null===D.element.parentNode?(N=!0,D=D.destroy()):D&&this.removeTextOutline.call(D.parentGroup),this.options&&this.options.padding&&(V.dx=-this.options.padding),D||(this.textPathWrapper=D=this.renderer.createElement("textPath"),P=!0);var K=D.element;if((_=s.element.getAttribute("id"))||s.element.setAttribute("id",_=ue()),N)for(R.setAttribute("y",0),re(V.dx)&&R.setAttribute("x",-V.dx),s=[].slice.call(R.childNodes),N=0;N<s.length;N++){var W=s[N];W.nodeType!==U.Node.TEXT_NODE&&"tspan"!==W.nodeName||K.appendChild(W)}P&&D&&D.add({element:R}),K.setAttributeNS("http://www.w3.org/1999/xlink","href",this.renderer.url+"#"+_),Q(V.dy)&&(K.parentNode.setAttribute("dy",V.dy),delete V.dy),Q(V.dx)&&(K.parentNode.setAttribute("dx",V.dx),delete V.dx),oe(V,(function(s,o){K.setAttribute(O[o]||o,s)})),S.removeAttribute("transform"),this.removeTextOutline.call(D),this.text&&!this.renderer.styledMode&&this.attr({fill:"none","stroke-width":0}),this.applyTextOutline=this.updateTransform=j}else D&&(delete this.updateTransform,delete this.applyTextOutline,this.destroyTextPath(S,s),this.updateTransform(),this.options&&this.options.rotation&&this.applyTextOutline(this.options.style.textOutline));return this},a.prototype.shadow=function(s,o,_){var S,R=[],O=this.element,P=this.oldShadowOptions,D={color:"#000000",offsetX:this.parentInverted?-1:1,offsetY:this.parentInverted?-1:1,opacity:.15,width:3},N=!1;if(!0===s?S=D:"object"==typeof s&&(S=te(D,s)),S&&(S&&P&&oe(S,(function(s,o){s!==P[o]&&(N=!0)})),N&&this.destroyShadows(),this.oldShadowOptions=S),S){if(!this.shadows){var V=S.opacity/S.width,j=this.parentInverted?"translate("+S.offsetY+", "+S.offsetX+")":"translate("+S.offsetX+", "+S.offsetY+")";for(D=1;D<=S.width;D++){var K=O.cloneNode(!1),W=2*S.width+1-2*D;$(K,{stroke:s.color||"#000000","stroke-opacity":V*D,"stroke-width":W,transform:j,fill:"none"}),K.setAttribute("class",(K.getAttribute("class")||"")+" highcharts-shadow"),_&&($(K,"height",Math.max($(K,"height")-W,0)),K.cutHeight=W),o?o.element.appendChild(K):O.parentNode&&O.parentNode.insertBefore(K,O),R.push(K)}this.shadows=R}}else this.destroyShadows();return this},a.prototype.show=function(s){return this.attr({visibility:s?"inherit":"visible"})},a.prototype.strokeSetter=function(s,o,_){this[o]=s,this.stroke&&this["stroke-width"]?(a.prototype.fillSetter.call(this,this.stroke,"stroke",_),_.setAttribute("stroke-width",this["stroke-width"]),this.hasStroke=!0):"stroke-width"===o&&0===s&&this.hasStroke?(_.removeAttribute("stroke"),this.hasStroke=!1):this.renderer.styledMode&&this["stroke-width"]&&(_.setAttribute("stroke-width",this["stroke-width"]),this.hasStroke=!0)},a.prototype.strokeWidth=function(){if(!this.renderer.styledMode)return this["stroke-width"]||0;var s=this.getStyle("stroke-width"),o=0;if(s.indexOf("px")===s.length-2)o=ce(s);else if(""!==s){var _=V.createElementNS(W,"rect");$(_,{width:s,"stroke-width":0}),this.element.parentNode.appendChild(_),o=_.getBBox().width,_.parentNode.removeChild(_)}return o},a.prototype.symbolAttr=function(s){var o=this;"x y r start end width height innerR anchorX anchorY clockwise".split(" ").forEach((function(_){o[_]=de(s[_],o[_])})),o.attr({d:o.renderer.symbols[o.symbolName](o.x,o.y,o.width,o.height,o)})},a.prototype.textSetter=function(s){s!==this.textStr&&(delete this.textPxLength,this.textStr=s,this.added&&this.renderer.buildText(this))},a.prototype.titleSetter=function(s){var o=this.element,_=o.getElementsByTagName("title")[0]||V.createElementNS(this.SVG_NS,"title");o.insertBefore?o.insertBefore(_,o.firstChild):o.appendChild(_),_.textContent=String(de(s,"")).replace(/<[^>]*>/g,"").replace(/</g,"<").replace(/>/g,">")},a.prototype.toFront=function(){var s=this.element;return s.parentNode.appendChild(s),this},a.prototype.translate=function(s,o){return this.attr({translateX:s,translateY:o})},a.prototype.updateShadows=function(s,o,_){var S=this.shadows;if(S)for(var R=S.length;R--;)_.call(S[R],"height"===s?Math.max(o-(S[R].cutHeight||0),0):"d"===s?this.d:o,s,S[R])},a.prototype.updateTransform=function(){var s=this.scaleX,o=this.scaleY,_=this.inverted,S=this.rotation,R=this.matrix,O=this.element,P=this.translateX||0,D=this.translateY||0;_&&(P+=this.width,D+=this.height),P=["translate("+P+","+D+")"],Q(R)&&P.push("matrix("+R.join(",")+")"),_?P.push("rotate(90) scale(-1,1)"):S&&P.push("rotate("+S+" "+de(this.rotationOriginX,O.getAttribute("x"),0)+" "+de(this.rotationOriginY,O.getAttribute("y")||0)+")"),(Q(s)||Q(o))&&P.push("scale("+de(s,1)+" "+de(o,1)+")"),P.length&&O.setAttribute("transform",P.join(" "))},a.prototype.visibilitySetter=function(s,o,_){"inherit"===s?_.removeAttribute(o):this[o]!==s&&_.setAttribute(o,s),this[o]=s},a.prototype.xGetter=function(s){return"circle"===this.element.nodeName&&("x"===s?s="cx":"y"===s&&(s="cy")),this._defaultGetter(s)},a.prototype.zIndexSetter=function(s,o){var _=this.renderer,S=this.parentGroup,R=(S||_).element||_.box,O=this.element;_=R===_.box;var P,D=!1,N=this.added;if(Q(s)?(O.setAttribute("data-z-index",s),s=+s,this[o]===s&&(N=!1)):Q(this[o])&&O.removeAttribute("data-z-index"),this[o]=s,N){for((s=this.zIndex)&&S&&(S.handleZ=!0),P=(o=R.childNodes).length-1;0<=P&&!D;P--){N=(S=o[P]).getAttribute("data-z-index");var V=!Q(N);S!==O&&(0>s&&V&&!_&&!P?(R.insertBefore(O,o[P]),D=!0):(ce(N)<=s||V&&(!Q(s)||0<=s))&&(R.insertBefore(O,o[P+1]||null),D=!0))}D||(R.insertBefore(O,o[_?3:0]||null),D=!0)}return D},a}()).prototype["stroke-widthSetter"]=s.prototype.strokeSetter,s.prototype.yGetter=s.prototype.xGetter,s.prototype.matrixSetter=s.prototype.rotationOriginXSetter=s.prototype.rotationOriginYSetter=s.prototype.rotationSetter=s.prototype.scaleXSetter=s.prototype.scaleYSetter=s.prototype.translateXSetter=s.prototype.translateYSetter=s.prototype.verticalAlignSetter=function(s,o){this[o]=s,this.doTransform=!0},s})),M(o,"Core/Renderer/RendererRegistry.js",[o["Core/Globals.js"]],(function(s){var o;return function(o){var _;o.rendererTypes={},o.getRendererType=function(s){return void 0===s&&(s=_),o.rendererTypes[s]||o.rendererTypes[_]},o.registerRendererType=function(S,R,O){o.rendererTypes[S]=R,_&&!O||(_=S,s.Renderer=R)}}(o||(o={})),o})),M(o,"Core/Renderer/SVG/SVGLabel.js",[o["Core/Renderer/SVG/SVGElement.js"],o["Core/Utilities.js"]],(function(s,o){var _=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function c(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(c.prototype=o.prototype,new c)}}(),S=o.defined,R=o.extend,O=o.isNumber,P=o.merge,D=o.pick,N=o.removeEvent;return function(o){function k(s,_,S,R,O,P,D,N,V,j){var K,W=o.call(this)||this;return W.paddingLeftSetter=W.paddingSetter,W.paddingRightSetter=W.paddingSetter,W.init(s,"g"),W.textStr=_,W.x=S,W.y=R,W.anchorX=P,W.anchorY=D,W.baseline=V,W.className=j,W.addClass("button"===j?"highcharts-no-tooltip":"highcharts-label"),j&&W.addClass("highcharts-"+j),W.text=s.text(void 0,0,0,N).attr({zIndex:1}),"string"==typeof O&&((K=/^url\((.*?)\)$/.test(O))||W.renderer.symbols[O])&&(W.symbolKey=O),W.bBox=k.emptyBBox,W.padding=3,W.baselineOffset=0,W.needsBox=s.styledMode||K,W.deferredAttr={},W.alignFactor=0,W}return _(k,o),k.prototype.alignSetter=function(s){(s={left:0,center:.5,right:1}[s])!==this.alignFactor&&(this.alignFactor=s,this.bBox&&O(this.xSetting)&&this.attr({x:this.xSetting}))},k.prototype.anchorXSetter=function(s,o){this.anchorX=s,this.boxAttr(o,Math.round(s)-this.getCrispAdjust()-this.xSetting)},k.prototype.anchorYSetter=function(s,o){this.anchorY=s,this.boxAttr(o,s-this.ySetting)},k.prototype.boxAttr=function(s,o){this.box?this.box.attr(s,o):this.deferredAttr[s]=o},k.prototype.css=function(o){if(o){var _={};o=P(o),k.textProps.forEach((function(s){void 0!==o[s]&&(_[s]=o[s],delete o[s])})),this.text.css(_);var S="width"in _;"fontSize"in _||"fontWeight"in _?this.updateTextPadding():S&&this.updateBoxSize()}return s.prototype.css.call(this,o)},k.prototype.destroy=function(){N(this.element,"mouseenter"),N(this.element,"mouseleave"),this.text&&this.text.destroy(),this.box&&(this.box=this.box.destroy()),s.prototype.destroy.call(this)},k.prototype.fillSetter=function(s,o){s&&(this.needsBox=!0),this.fill=s,this.boxAttr(o,s)},k.prototype.getBBox=function(){this.textStr&&0===this.bBox.width&&0===this.bBox.height&&this.updateBoxSize();var s=this.padding,o=D(this.paddingLeft,s);return{width:this.width,height:this.height,x:this.bBox.x-o,y:this.bBox.y-s}},k.prototype.getCrispAdjust=function(){return this.renderer.styledMode&&this.box?this.box.strokeWidth()%2/2:(this["stroke-width"]?parseInt(this["stroke-width"],10):0)%2/2},k.prototype.heightSetter=function(s){this.heightSetting=s},k.prototype.onAdd=function(){var s=this.textStr;this.text.add(this),this.attr({text:S(s)?s:"",x:this.x,y:this.y}),this.box&&S(this.anchorX)&&this.attr({anchorX:this.anchorX,anchorY:this.anchorY})},k.prototype.paddingSetter=function(s,o){O(s)?s!==this[o]&&(this[o]=s,this.updateTextPadding()):this[o]=void 0},k.prototype.rSetter=function(s,o){this.boxAttr(o,s)},k.prototype.shadow=function(s){return s&&!this.renderer.styledMode&&(this.updateBoxSize(),this.box&&this.box.shadow(s)),this},k.prototype.strokeSetter=function(s,o){this.stroke=s,this.boxAttr(o,s)},k.prototype["stroke-widthSetter"]=function(s,o){s&&(this.needsBox=!0),this["stroke-width"]=s,this.boxAttr(o,s)},k.prototype["text-alignSetter"]=function(s){this.textAlign=s},k.prototype.textSetter=function(s){void 0!==s&&this.text.attr({text:s}),this.updateTextPadding()},k.prototype.updateBoxSize=function(){var s=this.text.element.style,o={},_=this.padding,P=this.bBox=O(this.widthSetting)&&O(this.heightSetting)&&!this.textAlign||!S(this.text.textStr)?k.emptyBBox:this.text.getBBox();this.width=this.getPaddedWidth(),this.height=(this.heightSetting||P.height||0)+2*_,s=this.renderer.fontMetrics(s&&s.fontSize,this.text),this.baselineOffset=_+Math.min((this.text.firstLineMetrics||s).b,P.height||1/0),this.heightSetting&&(this.baselineOffset+=(this.heightSetting-s.h)/2),this.needsBox&&(this.box||((_=this.box=this.symbolKey?this.renderer.symbol(this.symbolKey):this.renderer.rect()).addClass(("button"===this.className?"":"highcharts-label-box")+(this.className?" highcharts-"+this.className+"-box":"")),_.add(this)),_=this.getCrispAdjust(),o.x=_,o.y=(this.baseline?-this.baselineOffset:0)+_,o.width=Math.round(this.width),o.height=Math.round(this.height),this.box.attr(R(o,this.deferredAttr)),this.deferredAttr={})},k.prototype.updateTextPadding=function(){var s=this.text;this.updateBoxSize();var o=this.baseline?0:this.baselineOffset,_=D(this.paddingLeft,this.padding);S(this.widthSetting)&&this.bBox&&("center"===this.textAlign||"right"===this.textAlign)&&(_+={center:.5,right:1}[this.textAlign]*(this.widthSetting-this.bBox.width)),_===s.x&&o===s.y||(s.attr("x",_),s.hasBoxWidthChanged&&(this.bBox=s.getBBox(!0)),void 0!==o&&s.attr("y",o)),s.x=_,s.y=o},k.prototype.widthSetter=function(s){this.widthSetting=O(s)?s:void 0},k.prototype.getPaddedWidth=function(){var s=this.padding,o=D(this.paddingLeft,s);return s=D(this.paddingRight,s),(this.widthSetting||this.bBox.width||0)+o+s},k.prototype.xSetter=function(s){this.x=s,this.alignFactor&&(s-=this.alignFactor*this.getPaddedWidth(),this["forceAnimate:x"]=!0),this.xSetting=Math.round(s),this.attr("translateX",this.xSetting)},k.prototype.ySetter=function(s){this.ySetting=this.y=Math.round(s),this.attr("translateY",this.ySetting)},k.emptyBBox={width:0,height:0,x:0,y:0},k.textProps="color direction fontFamily fontSize fontStyle fontWeight lineHeight textAlign textDecoration textOutline textOverflow width".split(" "),k}(s)})),M(o,"Core/Renderer/SVG/Symbols.js",[o["Core/Utilities.js"]],(function(s){function v(s,_,R,O,P){var D=[];if(P){var N=P.start||0,V=S(P.r,R);R=S(P.r,O||R);var j=(P.end||0)-.001;O=P.innerR;var K=S(P.open,.001>Math.abs((P.end||0)-N-2*Math.PI)),W=Math.cos(N),U=Math.sin(N),Y=Math.cos(j),$=Math.sin(j);N=S(P.longArc,.001>j-N-Math.PI?0:1),D.push(["M",s+V*W,_+R*U],["A",V,R,0,N,S(P.clockwise,1),s+V*Y,_+R*$]),o(O)&&D.push(K?["M",s+O*Y,_+O*$]:["L",s+O*Y,_+O*$],["A",O,O,0,N,o(P.clockwise)?1-P.clockwise:0,s+O*W,_+O*U]),K||D.push(["Z"])}return D}function z(s,o,_,S,R){return R&&R.r?F(s,o,_,S,R):[["M",s,o],["L",s+_,o],["L",s+_,o+S],["L",s,o+S],["Z"]]}function F(s,o,_,S,R){return[["M",s+(R=R&&R.r||0),o],["L",s+_-R,o],["C",s+_,o,s+_,o,s+_,o+R],["L",s+_,o+S-R],["C",s+_,o+S,s+_,o+S,s+_-R,o+S],["L",s+R,o+S],["C",s,o+S,s,o+S,s,o+S-R],["L",s,o+R],["C",s,o,s,o,s+R,o]]}var o=s.defined,_=s.isNumber,S=s.pick;return{arc:v,callout:function(s,o,S,R,O){var P=Math.min(O&&O.r||0,S,R),D=P+6,N=O&&O.anchorX;O=O&&O.anchorY||0;var V=F(s,o,S,R,{r:P});return _(N)?(s+N>=S?O>o+D&&O<o+R-D?V.splice(3,1,["L",s+S,O-6],["L",s+S+6,O],["L",s+S,O+6],["L",s+S,o+R-P]):V.splice(3,1,["L",s+S,R/2],["L",N,O],["L",s+S,R/2],["L",s+S,o+R-P]):0>=s+N?O>o+D&&O<o+R-D?V.splice(7,1,["L",s,O+6],["L",s-6,O],["L",s,O-6],["L",s,o+P]):V.splice(7,1,["L",s,R/2],["L",N,O],["L",s,R/2],["L",s,o+P]):O&&O>R&&N>s+D&&N<s+S-D?V.splice(5,1,["L",N+6,o+R],["L",N,o+R+6],["L",N-6,o+R],["L",s+P,o+R]):O&&0>O&&N>s+D&&N<s+S-D&&V.splice(1,1,["L",N-6,o],["L",N,o-6],["L",N+6,o],["L",S-P,o]),V):V},circle:function(s,o,_,S){return v(s+_/2,o+S/2,_/2,S/2,{start:.5*Math.PI,end:2.5*Math.PI,open:!1})},diamond:function(s,o,_,S){return[["M",s+_/2,o],["L",s+_,o+S/2],["L",s+_/2,o+S],["L",s,o+S/2],["Z"]]},rect:z,roundedRect:F,square:z,triangle:function(s,o,_,S){return[["M",s+_/2,o],["L",s+_,o+S],["L",s,o+S],["Z"]]},"triangle-down":function(s,o,_,S){return[["M",s,o],["L",s+_,o],["L",s+_/2,o+S],["Z"]]}}})),M(o,"Core/Renderer/SVG/TextBuilder.js",[o["Core/Renderer/HTML/AST.js"],o["Core/Globals.js"],o["Core/Utilities.js"]],(function(s,o,_){var S=o.doc,R=o.SVG_NS,O=o.win,P=_.attr,D=_.isString,N=_.objectEach,V=_.pick;return function(){function k(s){var o=s.styles;this.renderer=s.renderer,this.svgElement=s,this.width=s.textWidth,this.textLineHeight=o&&o.lineHeight,this.textOutline=o&&o.textOutline,this.ellipsis=!(!o||"ellipsis"!==o.textOverflow),this.noWrap=!(!o||"nowrap"!==o.whiteSpace),this.fontSize=o&&o.fontSize}return k.prototype.buildSVG=function(){var o=this.svgElement,_=o.element,R=o.renderer,O=V(o.textStr,"").toString(),P=-1!==O.indexOf("<"),N=_.childNodes;R=this.width&&!o.added&&R.box;var j=[O,this.ellipsis,this.noWrap,this.textLineHeight,this.textOutline,this.fontSize,this.width].join();if(j!==o.textCache){for(o.textCache=j,delete o.actualWidth,j=N.length;j--;)_.removeChild(N[j]);P||this.ellipsis||this.width||-1!==O.indexOf(" ")&&(!this.noWrap||/<br.*?>/g.test(O))?""!==O&&(R&&R.appendChild(_),O=new s(O),this.modifyTree(O.nodes),O.addToDOM(o.element),this.modifyDOM(),this.ellipsis&&-1!==(_.textContent||"").indexOf("…")&&o.attr("title",this.unescapeEntities(o.textStr||"",["<",">"])),R&&R.removeChild(_)):_.appendChild(S.createTextNode(this.unescapeEntities(O))),D(this.textOutline)&&o.applyTextOutline&&o.applyTextOutline(this.textOutline)}},k.prototype.modifyDOM=function(){var s,o=this,_=this.svgElement,D=P(_.element,"x");for(_.firstLineMetrics=void 0;(s=_.element.firstChild)&&/^[\s\u200B]*$/.test(s.textContent||" ");)_.element.removeChild(s);[].forEach.call(_.element.querySelectorAll("tspan.highcharts-br"),(function(s,S){s.nextSibling&&s.previousSibling&&(0===S&&1===s.previousSibling.nodeType&&(_.firstLineMetrics=_.renderer.fontMetrics(void 0,s.previousSibling)),P(s,{dy:o.getLineHeight(s.nextSibling),x:D}))}));var N=this.width||0;if(N){var p=function(s,O){var V=s.textContent||"",j=V.replace(/([^\^])-/g,"$1- ").split(" "),K=!o.noWrap&&(1<j.length||1<_.element.childNodes.length),W=o.getLineHeight(O),U=0,Y=_.actualWidth;if(o.ellipsis)V&&o.truncate(s,V,void 0,0,Math.max(0,N-parseInt(o.fontSize||12,10)),(function(s,o){return s.substring(0,o)+"…"}));else if(K){for(V=[],K=[];O.firstChild&&O.firstChild!==s;)K.push(O.firstChild),O.removeChild(O.firstChild);for(;j.length;)j.length&&!o.noWrap&&0<U&&(V.push(s.textContent||""),s.textContent=j.join(" ").replace(/- /g,"-")),o.truncate(s,void 0,j,0===U&&Y||0,N,(function(s,o){return j.slice(0,o).join(" ").replace(/- /g,"-")})),Y=_.actualWidth,U++;K.forEach((function(o){O.insertBefore(o,s)})),V.forEach((function(o){O.insertBefore(S.createTextNode(o),s),(o=S.createElementNS(R,"tspan")).textContent="",P(o,{dy:W,x:D}),O.insertBefore(o,s)}))}},B=function(s){[].slice.call(s.childNodes).forEach((function(o){o.nodeType===O.Node.TEXT_NODE?p(o,s):(-1!==o.className.baseVal.indexOf("highcharts-br")&&(_.actualWidth=0),B(o))}))};B(_.element)}},k.prototype.getLineHeight=function(s){var o;return s=s.nodeType===O.Node.TEXT_NODE?s.parentElement:s,this.renderer.styledMode||(o=s&&/(px|em)$/.test(s.style.fontSize)?s.style.fontSize:this.fontSize||this.renderer.style.fontSize||12),this.textLineHeight?parseInt(this.textLineHeight.toString(),10):this.renderer.fontMetrics(o,s||this.svgElement.element).h},k.prototype.modifyTree=function(s){var o=this,e=function(_,S){var R=_.attributes;R=void 0===R?{}:R;var O=_.children,P=_.tagName,N=o.renderer.styledMode;"b"===P||"strong"===P?N?R.class="highcharts-strong":R.style="font-weight:bold;"+(R.style||""):"i"!==P&&"em"!==P||(N?R.class="highcharts-emphasized":R.style="font-style:italic;"+(R.style||"")),D(R.style)&&(R.style=R.style.replace(/(;| |^)color([ :])/,"$1fill$2")),"br"===P?(R.class="highcharts-br",_.textContent="",(S=s[S+1])&&S.textContent&&(S.textContent=S.textContent.replace(/^ +/gm,""))):"a"===P&&O&&O.some((function(s){return"#text"===s.tagName}))&&(_.children=[{children:O,tagName:"tspan"}]),"#text"!==P&&"a"!==P&&(_.tagName="tspan"),_.attributes=R,O&&O.filter((function(s){return"#text"!==s.tagName})).forEach(e)};s.forEach(e)},k.prototype.truncate=function(s,o,_,S,R,O){var P,D=this.svgElement,N=D.renderer,V=D.rotation,j=[],K=_?1:0,W=(o||_||"").length,U=W,d=function(R,P){P=P||R;var V=s.parentNode;if(V&&void 0===j[P])if(V.getSubStringLength)try{j[P]=S+V.getSubStringLength(0,_?P+1:P)}catch(s){}else N.getSpanWidth&&(s.textContent=O(o||_,R),j[P]=S+N.getSpanWidth(D,s));return j[P]};D.rotation=0;var Y=d(s.textContent.length);if(S+Y>R){for(;K<=W;)U=Math.ceil((K+W)/2),_&&(P=O(_,U)),Y=d(U,P&&P.length-1),K===W?K=W+1:Y>R?W=U-1:K=U;0===W?s.textContent="":o&&W===o.length-1||(s.textContent=P||O(o||_,U))}_&&_.splice(0,U),D.actualWidth=Y,D.rotation=V},k.prototype.unescapeEntities=function(s,o){return N(this.renderer.escapes,(function(_,S){o&&-1!==o.indexOf(_)||(s=s.toString().replace(new RegExp(_,"g"),S))})),s},k}()})),M(o,"Core/Renderer/SVG/SVGRenderer.js",[o["Core/Renderer/HTML/AST.js"],o["Core/Color/Color.js"],o["Core/Globals.js"],o["Core/Renderer/RendererRegistry.js"],o["Core/Renderer/SVG/SVGElement.js"],o["Core/Renderer/SVG/SVGLabel.js"],o["Core/Renderer/SVG/Symbols.js"],o["Core/Renderer/SVG/TextBuilder.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O,P,D,N){var V,j=_.charts,K=_.deg2rad,W=_.doc,U=_.isFirefox,Y=_.isMS,$=_.isWebKit,X=_.noop,Z=_.SVG_NS,Q=_.symbolSizes,ee=_.win,te=N.addEvent,ie=N.attr,ae=N.createElement,ne=N.css,re=N.defined,se=N.destroyObjectProperties,le=N.extend,oe=N.isArray,de=N.isNumber,ce=N.isObject,he=N.isString,ue=N.merge,pe=N.pick,fe=N.pInt,ge=N.uniqueKey;return _=function(){function L(s,o,_,S,R,O,P){this.width=this.url=this.style=this.isSVG=this.imgCount=this.height=this.gradients=this.globalAnimation=this.defs=this.chartIndex=this.cacheKeys=this.cache=this.boxWrapper=this.box=this.alignedObjects=void 0,this.init(s,o,_,S,R,O,P)}return L.prototype.init=function(s,o,_,S,R,O,P){var D,N=this.createElement("svg").attr({version:"1.1",class:"highcharts-root"}),V=N.element;P||N.css(this.getStyle(S)),s.appendChild(V),ie(s,"dir","ltr"),-1===s.innerHTML.indexOf("xmlns")&&ie(V,"xmlns",this.SVG_NS),this.isSVG=!0,this.box=V,this.boxWrapper=N,this.alignedObjects=[],this.url=this.getReferenceURL(),this.createElement("desc").add().element.appendChild(W.createTextNode("Created with Highcharts 9.3.3")),this.defs=this.createElement("defs").add(),this.allowHTML=O,this.forExport=R,this.styledMode=P,this.gradients={},this.cache={},this.cacheKeys=[],this.imgCount=0,this.setSize(o,_,!1),U&&s.getBoundingClientRect&&((o=function(){ne(s,{left:0,top:0}),D=s.getBoundingClientRect(),ne(s,{left:Math.ceil(D.left)-D.left+"px",top:Math.ceil(D.top)-D.top+"px"})})(),this.unSubPixelFix=te(ee,"resize",o))},L.prototype.definition=function(o){return new s([o]).addToDOM(this.defs.element)},L.prototype.getReferenceURL=function(){if((U||$)&&W.getElementsByTagName("base").length){if(!re(V)){var o=ge();o=new s([{tagName:"svg",attributes:{width:8,height:8},children:[{tagName:"defs",children:[{tagName:"clipPath",attributes:{id:o},children:[{tagName:"rect",attributes:{width:4,height:4}}]}]},{tagName:"rect",attributes:{id:"hitme",width:8,height:8,"clip-path":"url(#"+o+")",fill:"rgba(0,0,0,0.001)"}}]}]).addToDOM(W.body),ne(o,{position:"fixed",top:0,left:0,zIndex:9e5});var _=W.elementFromPoint(6,6);V="hitme"===(_&&_.id),W.body.removeChild(o)}if(V)return ee.location.href.split("#")[0].replace(/<[^>]*>/g,"").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20")}return""},L.prototype.getStyle=function(s){return this.style=le({fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif',fontSize:"12px"},s)},L.prototype.setStyle=function(s){this.boxWrapper.css(this.getStyle(s))},L.prototype.isHidden=function(){return!this.boxWrapper.getBBox().width},L.prototype.destroy=function(){var s=this.defs;return this.box=null,this.boxWrapper=this.boxWrapper.destroy(),se(this.gradients||{}),this.gradients=null,s&&(this.defs=s.destroy()),this.unSubPixelFix&&this.unSubPixelFix(),this.alignedObjects=null},L.prototype.createElement=function(s){var o=new this.Element;return o.init(this,s),o},L.prototype.getRadialAttr=function(s,o){return{cx:s[0]-s[2]/2+(o.cx||0)*s[2],cy:s[1]-s[2]/2+(o.cy||0)*s[2],r:(o.r||0)*s[2]}},L.prototype.buildText=function(s){new D(s).buildSVG()},L.prototype.getContrast=function(s){return(s=o.parse(s).rgba)[0]*=1,s[1]*=1.2,s[2]*=.5,459<s[0]+s[1]+s[2]?"#000000":"#FFFFFF"},L.prototype.button=function(o,_,S,R,O,P,D,N,V,j){var K=this.label(o,_,S,V,void 0,void 0,j,void 0,"button"),W=this.styledMode,U=0,$=O?ue(O):{};if(o=$&&$.style||{},$=s.filterUserAttributes($),K.attr(ue({padding:8,r:2},$)),!W){var X=($=ue({fill:"#f7f7f7",stroke:"#cccccc","stroke-width":1,style:{color:"#333333",cursor:"pointer",fontWeight:"normal"}},{style:o},$)).style;delete $.style;var Z=(P=ue($,{fill:"#e6e6e6"},s.filterUserAttributes(P||{}))).style;delete P.style;var Q=(D=ue($,{fill:"#e6ebf5",style:{color:"#000000",fontWeight:"bold"}},s.filterUserAttributes(D||{}))).style;delete D.style;var ee=(N=ue($,{style:{color:"#cccccc"}},s.filterUserAttributes(N||{}))).style;delete N.style}return te(K.element,Y?"mouseover":"mouseenter",(function(){3!==U&&K.setState(1)})),te(K.element,Y?"mouseout":"mouseleave",(function(){3!==U&&K.setState(U)})),K.setState=function(s){1!==s&&(K.state=U=s),K.removeClass(/highcharts-button-(normal|hover|pressed|disabled)/).addClass("highcharts-button-"+["normal","hover","pressed","disabled"][s||0]),W||K.attr([$,P,D,N][s||0]).css([X,Z,Q,ee][s||0])},W||K.attr($).css(le({cursor:"default"},X)),K.on("touchstart",(function(s){return s.stopPropagation()})).on("click",(function(s){3!==U&&R.call(K,s)}))},L.prototype.crispLine=function(s,o,_){void 0===_&&(_="round");var S=s[0],R=s[1];return re(S[1])&&S[1]===R[1]&&(S[1]=R[1]=Math[_](S[1])-o%2/2),re(S[2])&&S[2]===R[2]&&(S[2]=R[2]=Math[_](S[2])+o%2/2),s},L.prototype.path=function(s){var o=this.styledMode?{}:{fill:"none"};return oe(s)?o.d=s:ce(s)&&le(o,s),this.createElement("path").attr(o)},L.prototype.circle=function(s,o,_){return s=ce(s)?s:void 0===s?{}:{x:s,y:o,r:_},(o=this.createElement("circle")).xSetter=o.ySetter=function(s,o,_){_.setAttribute("c"+o,s)},o.attr(s)},L.prototype.arc=function(s,o,_,S,R,O){return ce(s)?(o=(S=s).y,_=S.r,s=S.x):S={innerR:S,start:R,end:O},(s=this.symbol("arc",s,o,_,_,S)).r=_,s},L.prototype.rect=function(s,o,_,S,R,O){R=ce(s)?s.r:R;var P=this.createElement("rect");return s=ce(s)?s:void 0===s?{}:{x:s,y:o,width:Math.max(_,0),height:Math.max(S,0)},this.styledMode||(void 0!==O&&(s["stroke-width"]=O,s=P.crisp(s)),s.fill="none"),R&&(s.r=R),P.rSetter=function(s,o,_){P.r=s,ie(_,{rx:s,ry:s})},P.rGetter=function(){return P.r||0},P.attr(s)},L.prototype.setSize=function(s,o,_){this.width=s,this.height=o,this.boxWrapper.animate({width:s,height:o},{step:function(){this.attr({viewBox:"0 0 "+this.attr("width")+" "+this.attr("height")})},duration:pe(_,!0)?void 0:0}),this.alignElements()},L.prototype.g=function(s){var o=this.createElement("g");return s?o.attr({class:"highcharts-"+s}):o},L.prototype.image=function(s,o,_,S,R,O){var P={preserveAspectRatio:"none"},l=function(s,o){s.setAttributeNS?s.setAttributeNS("http://www.w3.org/1999/xlink","href",o):s.setAttribute("hc-svg-href",o)};de(o)&&(P.x=o),de(_)&&(P.y=_),de(S)&&(P.width=S),de(R)&&(P.height=R);var D=this.createElement("image").attr(P);return o=function(o){l(D.element,s),O.call(D,o)},O?(l(D.element,"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),_=new ee.Image,te(_,"load",o),_.src=s,_.complete&&o({})):l(D.element,s),D},L.prototype.symbol=function(s,o,_,S,R,O){var P,D=this,N=/^url\((.*?)\)$/,V=N.test(s),K=!V&&(this.symbols[s]?s:"circle"),U=K&&this.symbols[K];if(U){"number"==typeof o&&(P=U.call(this.symbols,Math.round(o||0),Math.round(_||0),S||0,R||0,O));var Y=this.path(P);D.styledMode||Y.attr("fill","none"),le(Y,{symbolName:K||void 0,x:o,y:_,width:S,height:R}),O&&le(Y,O)}else if(V){var $=s.match(N)[1],X=Y=this.image($);X.imgwidth=pe(Q[$]&&Q[$].width,O&&O.width),X.imgheight=pe(Q[$]&&Q[$].height,O&&O.height);var I=function(s){return s.attr({width:s.width,height:s.height})};["width","height"].forEach((function(s){X[s+"Setter"]=function(s,o){var _=this["img"+o];this[o]=s,re(_)&&(O&&"within"===O.backgroundSize&&this.width&&this.height&&(_=Math.round(_*Math.min(this.width/this.imgwidth,this.height/this.imgheight))),this.element&&this.element.setAttribute(o,_),this.alignByTranslate||(s=((this[o]||0)-_)/2,this.attr("width"===o?{translateX:s}:{translateY:s})))}})),re(o)&&X.attr({x:o,y:_}),X.isImg=!0,re(X.imgwidth)&&re(X.imgheight)?I(X):(X.attr({width:0,height:0}),ae("img",{onload:function(){var s=j[D.chartIndex];0===this.width&&(ne(this,{position:"absolute",top:"-999em"}),W.body.appendChild(this)),Q[$]={width:this.width,height:this.height},X.imgwidth=this.width,X.imgheight=this.height,X.element&&I(X),this.parentNode&&this.parentNode.removeChild(this),D.imgCount--,D.imgCount||!s||s.hasLoaded||s.onload()},src:$}),this.imgCount++)}return Y},L.prototype.clipRect=function(s,o,_,S){var R=ge()+"-",O=this.createElement("clipPath").attr({id:R}).add(this.defs);return(s=this.rect(s,o,_,S,0).add(O)).id=R,s.clipPath=O,s.count=0,s},L.prototype.text=function(s,o,_,S){var R={};return!S||!this.allowHTML&&this.forExport?(R.x=Math.round(o||0),_&&(R.y=Math.round(_)),re(s)&&(R.text=s),s=this.createElement("text").attr(R),(!S||this.forExport&&!this.allowHTML)&&(s.xSetter=function(s,o,_){for(var S,R=_.getElementsByTagName("tspan"),O=_.getAttribute(o),P=0;P<R.length;P++)(S=R[P]).getAttribute(o)===O&&S.setAttribute(o,s);_.setAttribute(o,s)}),s):this.html(s,o,_)},L.prototype.fontMetrics=function(s,o){return s=!this.styledMode&&/px/.test(s)||!ee.getComputedStyle?s||o&&o.style&&o.style.fontSize||this.style&&this.style.fontSize:o&&R.prototype.getStyle.call(o,"font-size"),{h:o=24>(s=/px/.test(s)?fe(s):12)?s+3:Math.round(1.2*s),b:Math.round(.8*o),f:s}},L.prototype.rotCorr=function(s,o,_){var S=s;return o&&_&&(S=Math.max(S*Math.cos(o*K),4)),{x:-s/3*Math.sin(o*K),y:S}},L.prototype.pathToSegments=function(s){for(var o=[],_=[],S={A:8,C:7,H:2,L:3,M:3,Q:5,S:5,T:3,V:2},R=0;R<s.length;R++)he(_[0])&&de(s[R])&&_.length===S[_[0].toUpperCase()]&&s.splice(R,0,_[0].replace("M","L").replace("m","l")),"string"==typeof s[R]&&(_.length&&o.push(_.slice(0)),_.length=0),_.push(s[R]);return o.push(_.slice(0)),o},L.prototype.label=function(s,o,_,S,R,P,D,N,V){return new O(this,s,o,_,S,R,P,D,N,V)},L.prototype.alignElements=function(){this.alignedObjects.forEach((function(s){return s.align()}))},L}(),le(_.prototype,{Element:R,SVG_NS:Z,escapes:{"&":"&","<":"<",">":">","'":"'",'"':"""},symbols:P,draw:X}),S.registerRendererType("svg",_,!0),_})),M(o,"Core/Renderer/HTML/HTMLElement.js",[o["Core/Globals.js"],o["Core/Renderer/SVG/SVGElement.js"],o["Core/Utilities.js"]],(function(s,o,_){var S=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function p(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(p.prototype=o.prototype,new p)}}(),R=s.isFirefox,O=s.isMS,P=s.isWebKit,D=s.win,N=_.css,V=_.defined,j=_.extend,K=_.pick,W=_.pInt;return function(s){function h(){return null!==s&&s.apply(this,arguments)||this}return S(h,s),h.compose=function(s){if(-1===h.composedClasses.indexOf(s)){h.composedClasses.push(s);var o=h.prototype,_=s.prototype;_.getSpanCorrection=o.getSpanCorrection,_.htmlCss=o.htmlCss,_.htmlGetBBox=o.htmlGetBBox,_.htmlUpdateTransform=o.htmlUpdateTransform,_.setSpanRotation=o.setSpanRotation}return s},h.prototype.getSpanCorrection=function(s,o,_){this.xCorr=-s*_,this.yCorr=-o},h.prototype.htmlCss=function(s){var o="SPAN"===this.element.tagName&&s&&"width"in s,_=K(o&&s.width,void 0);if(o){delete s.width,this.textWidth=_;var S=!0}return s&&"ellipsis"===s.textOverflow&&(s.whiteSpace="nowrap",s.overflow="hidden"),this.styles=j(this.styles,s),N(this.element,s),S&&this.htmlUpdateTransform(),this},h.prototype.htmlGetBBox=function(){var s=this.element;return{x:s.offsetLeft,y:s.offsetTop,width:s.offsetWidth,height:s.offsetHeight}},h.prototype.htmlUpdateTransform=function(){if(this.added){var s=this.renderer,o=this.element,_=this.translateX||0,S=this.translateY||0,R=this.x||0,O=this.y||0,P=this.textAlign||"left",D={left:0,center:.5,right:1}[P],j=this.styles;if(j=j&&j.whiteSpace,N(o,{marginLeft:_,marginTop:S}),!s.styledMode&&this.shadows&&this.shadows.forEach((function(s){N(s,{marginLeft:_+1,marginTop:S+1})})),this.inverted&&[].forEach.call(o.childNodes,(function(_){s.invertChild(_,o)})),"SPAN"===o.tagName){var K=this.rotation,U=this.textWidth&&W(this.textWidth),Y=[K,P,o.innerHTML,this.textWidth,this.textAlign].join(),$=void 0;if($=!1,U!==this.oldTextWidth){if(this.textPxLength)var X=this.textPxLength;else N(o,{width:"",whiteSpace:j||"nowrap"}),X=o.offsetWidth;(U>this.oldTextWidth||X>U)&&(/[ \-]/.test(o.textContent||o.innerText)||"ellipsis"===o.style.textOverflow)&&(N(o,{width:X>U||K?U+"px":"auto",display:"block",whiteSpace:j||"normal"}),this.oldTextWidth=U,$=!0)}this.hasBoxWidthChanged=$,Y!==this.cTT&&($=s.fontMetrics(o.style.fontSize,o).b,!V(K)||K===(this.oldRotation||0)&&P===this.oldAlign||this.setSpanRotation(K,D,$),this.getSpanCorrection(!V(K)&&this.textPxLength||o.offsetWidth,$,D,K,P)),N(o,{left:R+(this.xCorr||0)+"px",top:O+(this.yCorr||0)+"px"}),this.cTT=Y,this.oldRotation=K,this.oldAlign=P}}else this.alignOnAdd=!0},h.prototype.setSpanRotation=function(s,o,_){var S={},V=O&&!/Edge/.test(D.navigator.userAgent)?"-ms-transform":P?"-webkit-transform":R?"MozTransform":D.opera?"-o-transform":void 0;V&&(S[V]=S.transform="rotate("+s+"deg)",S[V+(R?"Origin":"-origin")]=S.transformOrigin=100*o+"% "+_+"px",N(this.element,S))},h.composedClasses=[],h}(o)})),M(o,"Core/Renderer/HTML/HTMLRenderer.js",[o["Core/Renderer/HTML/AST.js"],o["Core/Renderer/SVG/SVGElement.js"],o["Core/Renderer/SVG/SVGRenderer.js"],o["Core/Utilities.js"]],(function(s,o,_,S){var R=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function c(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(c.prototype=o.prototype,new c)}}(),O=S.attr,P=S.createElement,D=S.extend,N=S.pick;return function(_){function k(){return null!==_&&_.apply(this,arguments)||this}return R(k,_),k.compose=function(s){return-1===k.composedClasses.indexOf(s)&&(k.composedClasses.push(s),s.prototype.html=k.prototype.html),s},k.prototype.html=function(_,S,R){var V=this.createElement("span"),j=V.element,K=V.renderer,W=K.isSVG,t=function(s,_){["opacity","visibility"].forEach((function(S){s[S+"Setter"]=function(R,O,P){var D=s.div?s.div.style:_;o.prototype[S+"Setter"].call(this,R,O,P),D&&(D[O]=R)}})),s.addedSetters=!0};return V.textSetter=function(o){o!==this.textStr&&(delete this.bBox,delete this.oldTextWidth,s.setElementHTML(this.element,N(o,"")),this.textStr=o,V.doTransform=!0)},W&&t(V,V.element.style),V.xSetter=V.ySetter=V.alignSetter=V.rotationSetter=function(s,o){"align"===o?V.alignValue=V.textAlign=s:V[o]=s,V.doTransform=!0},V.afterSetters=function(){this.doTransform&&(this.htmlUpdateTransform(),this.doTransform=!1)},V.attr({text:_,x:Math.round(S),y:Math.round(R)}).css({position:"absolute"}),K.styledMode||V.css({fontFamily:this.style.fontFamily,fontSize:this.style.fontSize}),j.style.whiteSpace="nowrap",V.css=V.htmlCss,W&&(V.add=function(s){var o=K.box.parentNode,_=[];if(this.parentGroup=s){var S=s.div;if(!S){for(;s;)_.push(s),s=s.parentGroup;_.reverse().forEach((function(s){function a(o,_){s[_]=o,"translateX"===_?j.left=o+"px":j.top=o+"px",s.doTransform=!0}var R=O(s.element,"class"),N=s.styles||{},j=(S=s.div=s.div||P("div",R?{className:R}:void 0,{position:"absolute",left:(s.translateX||0)+"px",top:(s.translateY||0)+"px",display:s.display,opacity:s.opacity,cursor:N.cursor,pointerEvents:N.pointerEvents,visibility:s.visibility},S||o)).style;D(s,{classSetter:function(s){return function(o){this.element.setAttribute("class",o),s.className=o}}(S),on:function(){return _[0].div&&V.on.apply({element:_[0].div,onEvents:s.onEvents},arguments),s},translateXSetter:a,translateYSetter:a}),s.addedSetters||t(s)}))}}else S=o;return S.appendChild(j),V.added=!0,V.alignOnAdd&&V.htmlUpdateTransform(),V}),V},k.composedClasses=[],k}(_)})),M(o,"Core/Axis/AxisDefaults.js",[],(function(){var s;return function(s){s.defaultXAxisOptions={alignTicks:!0,allowDecimals:void 0,panningEnabled:!0,zIndex:2,zoomEnabled:!0,dateTimeLabelFormats:{millisecond:{main:"%H:%M:%S.%L",range:!1},second:{main:"%H:%M:%S",range:!1},minute:{main:"%H:%M",range:!1},hour:{main:"%H:%M",range:!1},day:{main:"%e. %b"},week:{main:"%e. %b"},month:{main:"%b '%y"},year:{main:"%Y"}},endOnTick:!1,gridLineDashStyle:"Solid",gridZIndex:1,labels:{autoRotation:void 0,autoRotationLimit:80,distance:void 0,enabled:!0,indentation:10,overflow:"justify",padding:5,reserveSpace:void 0,rotation:void 0,staggerLines:0,step:0,useHTML:!1,x:0,zIndex:7,style:{color:"#666666",cursor:"default",fontSize:"11px"}},maxPadding:.01,minorGridLineDashStyle:"Solid",minorTickLength:2,minorTickPosition:"outside",minPadding:.01,offset:void 0,opposite:!1,reversed:void 0,reversedStacks:!1,showEmpty:!0,showFirstLabel:!0,showLastLabel:!0,startOfWeek:1,startOnTick:!1,tickLength:10,tickPixelInterval:100,tickmarkPlacement:"between",tickPosition:"outside",title:{align:"middle",rotation:0,useHTML:!1,x:0,y:0,style:{color:"#666666"}},type:"linear",uniqueNames:!0,visible:!0,minorGridLineColor:"#f2f2f2",minorGridLineWidth:1,minorTickColor:"#999999",lineColor:"#ccd6eb",lineWidth:1,gridLineColor:"#e6e6e6",gridLineWidth:void 0,tickColor:"#ccd6eb"},s.defaultYAxisOptions={reversedStacks:!0,endOnTick:!0,maxPadding:.05,minPadding:.05,tickPixelInterval:72,showLastLabel:!0,labels:{x:-8},startOnTick:!0,title:{rotation:270,text:"Values"},stackLabels:{animation:{},allowOverlap:!1,enabled:!1,crop:!0,overflow:"justify",formatter:function(){return(0,this.axis.chart.numberFormatter)(this.total,-1)},style:{color:"#000000",fontSize:"11px",fontWeight:"bold",textOutline:"1px contrast"}},gridLineWidth:1,lineWidth:0},s.defaultLeftAxisOptions={labels:{x:-15},title:{rotation:270}},s.defaultRightAxisOptions={labels:{x:15},title:{rotation:90}},s.defaultBottomAxisOptions={labels:{autoRotation:[-45],x:0},margin:15,title:{rotation:0}},s.defaultTopAxisOptions={labels:{autoRotation:[-45],x:0},margin:15,title:{rotation:0}}}(s||(s={})),s})),M(o,"Core/Foundation.js",[o["Core/Utilities.js"]],(function(s){var o,_=s.addEvent,S=s.isFunction,R=s.objectEach,O=s.removeEvent;return function(s){s.registerEventOptions=function(s,o){s.eventOptions=s.eventOptions||{},R(o.events,(function(o,R){s.eventOptions[R]!==o&&(s.eventOptions[R]&&(O(s,R,s.eventOptions[R]),delete s.eventOptions[R]),S(o)&&(s.eventOptions[R]=o,_(s,R,o)))}))}}(o||(o={})),o})),M(o,"Core/Axis/Tick.js",[o["Core/FormatUtilities.js"],o["Core/Globals.js"],o["Core/Utilities.js"]],(function(s,o,_){var S=o.deg2rad,R=_.clamp,O=_.correctFloat,P=_.defined,D=_.destroyObjectProperties,N=_.extend,V=_.fireEvent,j=_.isNumber,K=_.merge,W=_.objectEach,U=_.pick;return o=function(){function f(s,o,_,S,R){this.isNewLabel=this.isNew=!0,this.axis=s,this.pos=o,this.type=_||"",this.parameters=R||{},this.tickmarkOffset=this.parameters.tickmarkOffset,this.options=this.parameters.options,V(this,"init"),_||S||this.addLabel()}return f.prototype.addLabel=function(){var o=this,_=o.axis,S=_.options,R=_.chart,D=_.categories,K=_.logarithmic,W=_.names,Y=o.pos,$=U(o.options&&o.options.labels,S.labels),X=_.tickPositions,Z=Y===X[0],Q=Y===X[X.length-1],ee=(!$.step||1===$.step)&&1===_.tickInterval;X=X.info;var te,ie=o.label;if(D=this.parameters.category||(D?U(D[Y],W[Y],Y):Y),K&&j(D)&&(D=O(K.lin2log(D))),_.dateTime)if(X)var ae=R.time.resolveDTLFormat(S.dateTimeLabelFormats[!S.grid&&X.higherRanks[Y]||X.unitName]),ne=ae.main;else j(D)&&(ne=_.dateTime.getXDateFormat(D,S.dateTimeLabelFormats||{}));o.isFirst=Z,o.isLast=Q;var re={axis:_,chart:R,dateTimeLabelFormat:ne,isFirst:Z,isLast:Q,pos:Y,tick:o,tickPositionInfo:X,value:D};V(this,"labelFormat",re);var u=function(o){return $.formatter?$.formatter.call(o,o):$.format?(o.text=_.defaultLabelFormatter.call(o),s.format($.format,o,R)):_.defaultLabelFormatter.call(o,o)};S=u.call(re,re);var se=ae&&ae.list;o.shortenLabel=se?function(){for(te=0;te<se.length;te++)if(N(re,{dateTimeLabelFormat:se[te]}),ie.attr({text:u.call(re,re)}),ie.getBBox().width<_.getSlotWidth(o)-2*$.padding)return;ie.attr({text:""})}:void 0,ee&&_._addedPlotLB&&o.moveLabel(S,$),P(ie)||o.movedLabel?ie&&ie.textStr!==S&&!ee&&(!ie.textWidth||$.style.width||ie.styles.width||ie.css({width:null}),ie.attr({text:S}),ie.textPxLength=ie.getBBox().width):(o.label=ie=o.createLabel({x:0,y:0},S,$),o.rotation=0)},f.prototype.createLabel=function(s,o,_){var S=this.axis,R=S.chart;return(s=P(o)&&_.enabled?R.renderer.text(o,s.x,s.y,_.useHTML).add(S.labelGroup):null)&&(R.styledMode||s.css(K(_.style)),s.textPxLength=s.getBBox().width),s},f.prototype.destroy=function(){D(this,this.axis)},f.prototype.getPosition=function(s,o,_,S){var P=this.axis,D=P.chart,N=S&&D.oldChartHeight||D.chartHeight;return(s={x:s?O(P.translate(o+_,null,null,S)+P.transB):P.left+P.offset+(P.opposite?(S&&D.oldChartWidth||D.chartWidth)-P.right-P.left:0),y:s?N-P.bottom+P.offset-(P.opposite?P.height:0):O(N-P.translate(o+_,null,null,S)-P.transB)}).y=R(s.y,-1e5,1e5),V(this,"afterGetPosition",{pos:s}),s},f.prototype.getLabelPosition=function(s,o,_,R,O,D,N,j){var K=this.axis,W=K.transA,U=K.isLinked&&K.linkedParent?K.linkedParent.reversed:K.reversed,Y=K.staggerLines,$=K.tickRotCorr||{x:0,y:0},X=R||K.reserveSpaceDefault?0:-K.labelOffset*("center"===K.labelAlign?.5:1),Z={},Q=O.y;return P(Q)||(Q=0===K.side?_.rotation?-8:-_.getBBox().height:2===K.side?$.y+8:Math.cos(_.rotation*S)*($.y-_.getBBox(!1,0).height/2)),s=s+O.x+X+$.x-(D&&R?D*W*(U?-1:1):0),o=o+Q-(D&&!R?D*W*(U?1:-1):0),Y&&(_=N/(j||1)%Y,K.opposite&&(_=Y-_-1),o+=K.labelOffset/Y*_),Z.x=s,Z.y=Math.round(o),V(this,"afterGetLabelPosition",{pos:Z,tickmarkOffset:D,index:N}),Z},f.prototype.getLabelSize=function(){return this.label?this.label.getBBox()[this.axis.horiz?"height":"width"]:0},f.prototype.getMarkPath=function(s,o,_,S,R,O){return O.crispLine([["M",s,o],["L",s+(R?0:-_),o+(R?_:0)]],S)},f.prototype.handleOverflow=function(s){var o=this.axis,_=o.options.labels,R=s.x,O=o.chart.chartWidth,P=o.chart.spacing,D=U(o.labelLeft,Math.min(o.pos,P[3]));P=U(o.labelRight,Math.max(o.isRadial?0:o.pos+o.len,O-P[1]));var N,V=this.label,j=this.rotation,K={left:0,center:.5,right:1}[o.labelAlign||V.attr("align")],W=V.getBBox().width,Y=o.getSlotWidth(this),$={},X=Y,Z=1;j||"justify"!==_.overflow?0>j&&R-K*W<D?N=Math.round(R/Math.cos(j*S)-D):0<j&&R+K*W>P&&(N=Math.round((O-R)/Math.cos(j*S))):(O=R+(1-K)*W,R-K*W<D?X=s.x+X*(1-K)-D:O>P&&(X=P-s.x+X*K,Z=-1),(X=Math.min(Y,X))<Y&&"center"===o.labelAlign&&(s.x+=Z*(Y-X-K*(Y-Math.min(W,X)))),(W>X||o.autoRotation&&(V.styles||{}).width)&&(N=X)),N&&(this.shortenLabel?this.shortenLabel():($.width=Math.floor(N)+"px",(_.style||{}).textOverflow||($.textOverflow="ellipsis"),V.css($)))},f.prototype.moveLabel=function(s,o){var _=this,S=_.label,R=_.axis,O=R.reversed,P=!1;if(S&&S.textStr===s?(_.movedLabel=S,P=!0,delete _.label):W(R.ticks,(function(o){P||o.isNew||o===_||!o.label||o.label.textStr!==s||(_.movedLabel=o.label,P=!0,o.labelPos=_.movedLabel.xy,delete o.label)})),!P&&(_.labelPos||S)){var D=_.labelPos||S.xy;S=R.horiz?O?0:R.width+R.left:D.x,R=R.horiz?D.y:O?R.width+R.left:0,_.movedLabel=_.createLabel({x:S,y:R},s,o),_.movedLabel&&_.movedLabel.attr({opacity:0})}},f.prototype.render=function(s,o,_){var S=this.axis,R=S.horiz,O=this.pos,P=U(this.tickmarkOffset,S.tickmarkOffset);P=(O=this.getPosition(R,O,P,o)).x;var D=O.y;S=R&&P===S.pos+S.len||!R&&D===S.pos?-1:1,R=U(_,this.label&&this.label.newOpacity,1),_=U(_,1),this.isActive=!0,this.renderGridLine(o,_,S),this.renderMark(O,_,S),this.renderLabel(O,o,R,s),this.isNew=!1,V(this,"afterRender")},f.prototype.renderGridLine=function(s,o,_){var S=this.axis,R=S.options,O={},P=this.pos,D=this.type,N=U(this.tickmarkOffset,S.tickmarkOffset),V=S.chart.renderer,j=this.gridLine,K=R.gridLineWidth,W=R.gridLineColor,Y=R.gridLineDashStyle;"minor"===this.type&&(K=R.minorGridLineWidth,W=R.minorGridLineColor,Y=R.minorGridLineDashStyle),j||(S.chart.styledMode||(O.stroke=W,O["stroke-width"]=K||0,O.dashstyle=Y),D||(O.zIndex=1),s&&(o=0),this.gridLine=j=V.path().attr(O).addClass("highcharts-"+(D?D+"-":"")+"grid-line").add(S.gridGroup)),j&&(_=S.getPlotLinePath({value:P+N,lineWidth:j.strokeWidth()*_,force:"pass",old:s}))&&j[s||this.isNew?"attr":"animate"]({d:_,opacity:o})},f.prototype.renderMark=function(s,o,_){var S=this.axis,R=S.options,O=S.chart.renderer,P=this.type,D=S.tickSize(P?P+"Tick":"tick"),N=s.x;s=s.y;var V=U(R["minor"!==P?"tickWidth":"minorTickWidth"],!P&&S.isXAxis?1:0);R=R["minor"!==P?"tickColor":"minorTickColor"];var j=this.mark,K=!j;D&&(S.opposite&&(D[0]=-D[0]),j||(this.mark=j=O.path().addClass("highcharts-"+(P?P+"-":"")+"tick").add(S.axisGroup),S.chart.styledMode||j.attr({stroke:R,"stroke-width":V})),j[K?"attr":"animate"]({d:this.getMarkPath(N,s,D[0],j.strokeWidth()*_,S.horiz,O),opacity:o}))},f.prototype.renderLabel=function(s,o,_,S){var R=this.axis,O=R.horiz,P=R.options,D=this.label,N=P.labels,V=N.step;R=U(this.tickmarkOffset,R.tickmarkOffset);var K=s.x;s=s.y;var W=!0;D&&j(K)&&(D.xy=s=this.getLabelPosition(K,s,D,O,N,R,S,V),this.isFirst&&!this.isLast&&!P.showFirstLabel||this.isLast&&!this.isFirst&&!P.showLastLabel?W=!1:!O||N.step||N.rotation||o||0===_||this.handleOverflow(s),V&&S%V&&(W=!1),W&&j(s.y)?(s.opacity=_,D[this.isNewLabel?"attr":"animate"](s),this.isNewLabel=!1):(D.attr("y",-9999),this.isNewLabel=!0))},f.prototype.replaceMovedLabel=function(){var s=this.label,o=this.axis,_=o.reversed;if(s&&!this.isNew){var S=o.horiz?_?o.left:o.width+o.left:s.xy.x;_=o.horiz?s.xy.y:_?o.width+o.top:o.top,s.animate({x:S,y:_,opacity:0},void 0,s.destroy),delete this.label}o.isDirty=!0,this.label=this.movedLabel,delete this.movedLabel},f}()})),M(o,"Core/Axis/Axis.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/Axis/AxisDefaults.js"],o["Core/Color/Color.js"],o["Core/DefaultOptions.js"],o["Core/Foundation.js"],o["Core/Globals.js"],o["Core/Axis/Tick.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O,P,D){var N=s.animObject,V=S.defaultOptions,j=R.registerEventOptions,K=O.deg2rad,W=D.arrayMax,U=D.arrayMin,Y=D.clamp,$=D.correctFloat,X=D.defined,Z=D.destroyObjectProperties,Q=D.erase,ee=D.error,te=D.extend,ie=D.fireEvent,ae=D.getMagnitude,ne=D.isArray,re=D.isNumber,se=D.isString,le=D.merge,oe=D.normalizeTickInterval,de=D.objectEach,ce=D.pick,he=D.relativeLength,ue=D.removeEvent,pe=D.splat,fe=D.syncTimeout;return s=function(){function a(s,o){this.zoomEnabled=this.width=this.visible=this.userOptions=this.translationSlope=this.transB=this.transA=this.top=this.ticks=this.tickRotCorr=this.tickPositions=this.tickmarkOffset=this.tickInterval=this.tickAmount=this.side=this.series=this.right=this.positiveValuesOnly=this.pos=this.pointRangePadding=this.pointRange=this.plotLinesAndBandsGroups=this.plotLinesAndBands=this.paddedTicks=this.overlap=this.options=this.offset=this.names=this.minPixelPadding=this.minorTicks=this.minorTickInterval=this.min=this.maxLabelLength=this.max=this.len=this.left=this.labelFormatter=this.labelEdge=this.isLinked=this.height=this.hasVisibleSeries=this.hasNames=this.eventOptions=this.coll=this.closestPointRange=this.chart=this.categories=this.bottom=this.alternateBands=void 0,this.init(s,o)}return a.prototype.init=function(s,o){var _=o.isX;this.chart=s,this.horiz=s.inverted&&!this.isZAxis?!_:_,this.isXAxis=_,this.coll=this.coll||(_?"xAxis":"yAxis"),ie(this,"init",{userOptions:o}),this.opposite=ce(o.opposite,this.opposite),this.side=ce(o.side,this.side,this.horiz?this.opposite?0:2:this.opposite?1:3),this.setOptions(o);var S=this.options,R=S.labels,O=S.type;this.userOptions=o,this.minPixelPadding=0,this.reversed=ce(S.reversed,this.reversed),this.visible=S.visible,this.zoomEnabled=S.zoomEnabled,this.hasNames="category"===O||!0===S.categories,this.categories=S.categories||this.hasNames,this.names||(this.names=[],this.names.keys={}),this.plotLinesAndBandsGroups={},this.positiveValuesOnly=!!this.logarithmic,this.isLinked=X(S.linkedTo),this.ticks={},this.labelEdge=[],this.minorTicks={},this.plotLinesAndBands=[],this.alternateBands={},this.len=0,this.minRange=this.userMinRange=S.minRange||S.maxZoom,this.range=S.range,this.offset=S.offset||0,this.min=this.max=null,o=ce(S.crosshair,pe(s.options.tooltip.crosshairs)[_?0:1]),this.crosshair=!0===o?{}:o,-1===s.axes.indexOf(this)&&(_?s.axes.splice(s.xAxis.length,0,this):s.axes.push(this),s[this.coll].push(this)),this.series=this.series||[],s.inverted&&!this.isZAxis&&_&&void 0===this.reversed&&(this.reversed=!0),this.labelRotation=re(R.rotation)?R.rotation:void 0,j(this,S),ie(this,"afterInit")},a.prototype.setOptions=function(s){this.options=le(o.defaultXAxisOptions,"yAxis"===this.coll&&o.defaultYAxisOptions,[o.defaultTopAxisOptions,o.defaultRightAxisOptions,o.defaultBottomAxisOptions,o.defaultLeftAxisOptions][this.side],le(V[this.coll],s)),ie(this,"afterSetOptions",{userOptions:s})},a.prototype.defaultLabelFormatter=function(s){var o=this.axis;s=this.chart.numberFormatter;var _=re(this.value)?this.value:NaN,S=o.chart.time,R=this.dateTimeLabelFormat,O=V.lang,P=O.numericSymbols;O=O.numericSymbolMagnitude||1e3;var D=o.logarithmic?Math.abs(_):o.tickInterval,N=P&&P.length;if(o.categories)var j=""+this.value;else if(R)j=S.dateFormat(R,_);else if(N&&1e3<=D)for(;N--&&void 0===j;)D>=(o=Math.pow(O,N+1))&&0==10*_%o&&null!==P[N]&&0!==_&&(j=s(_/o,-1)+P[N]);return void 0===j&&(j=1e4<=Math.abs(_)?s(_,-1):s(_,-1,void 0,"")),j},a.prototype.getSeriesExtremes=function(){var s,o=this,_=o.chart;ie(this,"getSeriesExtremes",null,(function(){o.hasVisibleSeries=!1,o.dataMin=o.dataMax=o.threshold=null,o.softThreshold=!o.isXAxis,o.stacking&&o.stacking.buildStacks(),o.series.forEach((function(S){if(S.visible||!_.options.chart.ignoreHiddenSeries){var R=S.options,O=R.threshold;if(o.hasVisibleSeries=!0,o.positiveValuesOnly&&0>=O&&(O=null),o.isXAxis){if((R=S.xData).length){R=o.logarithmic?R.filter(o.validatePositiveValue):R;var P=(s=S.getXExtremes(R)).min,D=s.max;re(P)||P instanceof Date||(R=R.filter(re),P=(s=S.getXExtremes(R)).min,D=s.max),R.length&&(o.dataMin=Math.min(ce(o.dataMin,P),P),o.dataMax=Math.max(ce(o.dataMax,D),D))}}else S=S.applyExtremes(),re(S.dataMin)&&(P=S.dataMin,o.dataMin=Math.min(ce(o.dataMin,P),P)),re(S.dataMax)&&(D=S.dataMax,o.dataMax=Math.max(ce(o.dataMax,D),D)),X(O)&&(o.threshold=O),(!R.softThreshold||o.positiveValuesOnly)&&(o.softThreshold=!1)}}))})),ie(this,"afterGetSeriesExtremes")},a.prototype.translate=function(s,o,_,S,R,O){var P=this.linkedParent||this,D=S&&P.old?P.old.min:P.min,N=P.minPixelPadding;R=(P.isOrdinal||P.brokenAxis&&P.brokenAxis.hasBreaks||P.logarithmic&&R)&&P.lin2val;var V=1,j=0;return(S=S&&P.old?P.old.transA:P.transA)||(S=P.transA),_&&(V*=-1,j=P.len),P.reversed&&(j-=(V*=-1)*(P.sector||P.len)),o?(s=(s*V+j-N)/S+D,R&&(s=P.lin2val(s))):(R&&(s=P.val2lin(s)),s=re(D)?V*(s-D)*S+j+V*N+(re(O)?S*O:0):void 0),s},a.prototype.toPixels=function(s,o){return this.translate(s,!1,!this.horiz,null,!0)+(o?0:this.pos)},a.prototype.toValue=function(s,o){return this.translate(s-(o?0:this.pos),!0,!this.horiz,null,!0)},a.prototype.getPlotLinePath=function(s){function d(s,o,_){return("pass"!==Q&&s<o||s>_)&&(Q?s=Y(s,o,_):O=!0),s}var o,_,S,R,O,P=this,D=P.chart,N=P.left,V=P.top,j=s.old,K=s.value,W=s.lineWidth,U=j&&D.oldChartHeight||D.chartHeight,$=j&&D.oldChartWidth||D.chartWidth,X=P.transB,Z=s.translatedValue,Q=s.force;return s={value:K,lineWidth:W,old:j,force:Q,acrossPanes:s.acrossPanes,translatedValue:Z},ie(this,"getPlotLinePath",s,(function(s){Z=ce(Z,P.translate(K,null,null,j)),Z=Y(Z,-1e5,1e5),o=S=Math.round(Z+X),_=R=Math.round(U-Z-X),re(Z)?P.horiz?(_=V,R=U-P.bottom,o=S=d(o,N,N+P.width)):(o=N,S=$-P.right,_=R=d(_,V,V+P.height)):(O=!0,Q=!1),s.path=O&&!Q?null:D.renderer.crispLine([["M",o,_],["L",S,R]],W||1)})),s.path},a.prototype.getLinearTickPositions=function(s,o,_){var S=$(Math.floor(o/s)*s);_=$(Math.ceil(_/s)*s);var R,O=[];if($(S+s)===S&&(R=20),this.single)return[o];for(o=S;o<=_&&(O.push(o),(o=$(o+s,R))!==P);)var P=o;return O},a.prototype.getMinorTickInterval=function(){var s=this.options;return!0===s.minorTicks?ce(s.minorTickInterval,"auto"):!1===s.minorTicks?null:s.minorTickInterval},a.prototype.getMinorTickPositions=function(){var s=this.options,o=this.tickPositions,_=this.minorTickInterval,S=this.pointRangePadding||0,R=this.min-S,O=(S=this.max+S)-R,P=[];if(O&&O/_<this.len/3){var D=this.logarithmic;if(D)this.paddedTicks.forEach((function(s,o,S){o&&P.push.apply(P,D.getLogTickPositions(_,S[o-1],S[o],!0))}));else if(this.dateTime&&"auto"===this.getMinorTickInterval())P=P.concat(this.getTimeTicks(this.dateTime.normalizeTimeTickInterval(_),R,S,s.startOfWeek));else for(s=R+(o[0]-R)%_;s<=S&&s!==P[0];s+=_)P.push(s)}return 0!==P.length&&this.trimTicks(P),P},a.prototype.adjustForMinRange=function(){var s,o,_,S,R=this.options,O=this.logarithmic,P=this.min,D=this.max,N=0;if(this.isXAxis&&void 0===this.minRange&&!O&&(X(R.min)||X(R.max)||X(R.floor)||X(R.ceiling)?this.minRange=null:(this.series.forEach((function(R){if(_=R.xData,S=R.xIncrement?1:_.length-1,1<_.length)for(s=S;0<s;s--)o=_[s]-_[s-1],(!N||o<N)&&(N=o)})),this.minRange=Math.min(5*N,this.dataMax-this.dataMin))),D-P<this.minRange){var V=this.dataMax-this.dataMin>=this.minRange,j=this.minRange,K=(j-D+P)/2;K=[P-K,ce(R.min,P-K)],V&&(K[2]=this.logarithmic?this.logarithmic.log2lin(this.dataMin):this.dataMin),D=[(P=W(K))+j,ce(R.max,P+j)],V&&(D[2]=O?O.log2lin(this.dataMax):this.dataMax),(D=U(D))-P<j&&(K[0]=D-j,K[1]=ce(R.min,D-j),P=W(K))}this.min=P,this.max=D},a.prototype.getClosest=function(){var s;return this.categories?s=1:this.series.forEach((function(o){var _=o.closestPointRange,S=o.visible||!o.chart.options.chart.ignoreHiddenSeries;!o.noSharedTooltip&&X(_)&&S&&(s=X(s)?Math.min(s,_):_)})),s},a.prototype.nameToX=function(s){var o=ne(this.categories),_=o?this.categories:this.names,S=s.options.x;if(s.series.requireSorting=!1,X(S)||(S=this.options.uniqueNames?o?_.indexOf(s.name):ce(_.keys[s.name],-1):s.series.autoIncrement()),-1===S){if(!o)var R=_.length}else R=S;return void 0!==R&&(this.names[R]=s.name,this.names.keys[s.name]=R),R},a.prototype.updateNames=function(){var s=this,o=this.names;0<o.length&&(Object.keys(o.keys).forEach((function(s){delete o.keys[s]})),o.length=0,this.minRange=this.userMinRange,(this.series||[]).forEach((function(o){o.xIncrement=null,o.points&&!o.isDirtyData||(s.max=Math.max(s.max,o.xData.length-1),o.processData(),o.generatePoints()),o.data.forEach((function(_,S){if(_&&_.options&&void 0!==_.name){var R=s.nameToX(_);void 0!==R&&R!==_.x&&(_.x=R,o.xData[S]=R)}}))})))},a.prototype.setAxisTranslation=function(){var s=this,o=s.max-s.min,_=s.linkedParent,S=!!s.categories,R=s.isXAxis,O=s.axisPointRange||0,P=0,D=0,N=s.transA;if(R||S||O){var V=s.getClosest();_?(P=_.minPointOffset,D=_.pointRangePadding):s.series.forEach((function(o){var _=S?1:R?ce(o.options.pointRange,V,0):s.axisPointRange||0,N=o.options.pointPlacement;O=Math.max(O,_),s.single&&!S||(o=o.is("xrange")?!R:R,P=Math.max(P,o&&se(N)?0:_/2),D=Math.max(D,o&&"on"===N?0:_))})),_=s.ordinal&&s.ordinal.slope&&V?s.ordinal.slope/V:1,s.minPointOffset=P*=_,s.pointRangePadding=D*=_,s.pointRange=Math.min(O,s.single&&S?1:o),R&&(s.closestPointRange=V)}s.translationSlope=s.transA=N=s.staticScale||s.len/(o+D||1),s.transB=s.horiz?s.left:s.bottom,s.minPixelPadding=N*P,ie(this,"afterSetAxisTranslation")},a.prototype.minFromRange=function(){return this.max-this.range},a.prototype.setTickInterval=function(s){var o=this.chart,_=this.logarithmic,S=this.options,R=this.isXAxis,O=this.isLinked,P=S.tickPixelInterval,D=this.categories,N=this.softThreshold,V=S.maxPadding,j=S.minPadding,K=re(S.tickInterval)&&0<=S.tickInterval?S.tickInterval:void 0,W=re(this.threshold)?this.threshold:null;this.dateTime||D||O||this.getTickAmount();var U=ce(this.userMin,S.min),Y=ce(this.userMax,S.max);if(O){this.linkedParent=o[this.coll][S.linkedTo];var Z=this.linkedParent.getExtremes();this.min=ce(Z.min,Z.dataMin),this.max=ce(Z.max,Z.dataMax),S.type!==this.linkedParent.options.type&&ee(11,1,o)}else{if(N&&X(W))if(this.dataMin>=W)Z=W,j=0;else if(this.dataMax<=W){var Q=W;V=0}this.min=ce(U,Z,this.dataMin),this.max=ce(Y,Q,this.dataMax)}if(_&&(this.positiveValuesOnly&&!s&&0>=Math.min(this.min,ce(this.dataMin,this.min))&&ee(10,1,o),this.min=$(_.log2lin(this.min),16),this.max=$(_.log2lin(this.max),16)),this.range&&X(this.max)&&(this.userMin=this.min=U=Math.max(this.dataMin,this.minFromRange()),this.userMax=Y=this.max,this.range=null),ie(this,"foundExtremes"),this.beforePadding&&this.beforePadding(),this.adjustForMinRange(),!(D||this.axisPointRange||this.stacking&&this.stacking.usePercentage||O)&&X(this.min)&&X(this.max)&&(o=this.max-this.min)&&(!X(U)&&j&&(this.min-=o*j),!X(Y)&&V&&(this.max+=o*V)),re(this.userMin)||(re(S.softMin)&&S.softMin<this.min&&(this.min=U=S.softMin),re(S.floor)&&(this.min=Math.max(this.min,S.floor))),re(this.userMax)||(re(S.softMax)&&S.softMax>this.max&&(this.max=Y=S.softMax),re(S.ceiling)&&(this.max=Math.min(this.max,S.ceiling))),N&&X(this.dataMin)&&(W=W||0,!X(U)&&this.min<W&&this.dataMin>=W?this.min=this.options.minRange?Math.min(W,this.max-this.minRange):W:!X(Y)&&this.max>W&&this.dataMax<=W&&(this.max=this.options.minRange?Math.max(W,this.min+this.minRange):W)),re(this.min)&&re(this.max)&&!this.chart.polar&&this.min>this.max&&(X(this.options.min)?this.max=this.min:X(this.options.max)&&(this.min=this.max)),this.tickInterval=this.min===this.max||void 0===this.min||void 0===this.max?1:O&&this.linkedParent&&!K&&P===this.linkedParent.options.tickPixelInterval?K=this.linkedParent.tickInterval:ce(K,this.tickAmount?(this.max-this.min)/Math.max(this.tickAmount-1,1):void 0,D?1:(this.max-this.min)*P/Math.max(this.len,P)),R&&!s){var te=this.min!==(this.old&&this.old.min)||this.max!==(this.old&&this.old.max);this.series.forEach((function(s){s.forceCrop=s.forceCropping&&s.forceCropping(),s.processData(te)})),ie(this,"postProcessData",{hasExtemesChanged:te})}this.setAxisTranslation(),ie(this,"initialAxisTranslation"),this.pointRange&&!K&&(this.tickInterval=Math.max(this.pointRange,this.tickInterval)),s=ce(S.minTickInterval,this.dateTime&&!this.series.some((function(s){return s.noSharedTooltip}))?this.closestPointRange:0),!K&&this.tickInterval<s&&(this.tickInterval=s),this.dateTime||this.logarithmic||K||(this.tickInterval=oe(this.tickInterval,void 0,ae(this.tickInterval),ce(S.allowDecimals,.5>this.tickInterval||void 0!==this.tickAmount),!!this.tickAmount)),this.tickAmount||(this.tickInterval=this.unsquish()),this.setTickPositions()},a.prototype.setTickPositions=function(){var s=this.options,o=s.tickPositions,_=this.getMinorTickInterval(),S=this.hasVerticalPanning(),R="colorAxis"===this.coll,O=(R||!S)&&s.startOnTick;S=(R||!S)&&s.endOnTick,R=s.tickPositioner,this.tickmarkOffset=this.categories&&"between"===s.tickmarkPlacement&&1===this.tickInterval?.5:0,this.minorTickInterval="auto"===_&&this.tickInterval?this.tickInterval/5:_,this.single=this.min===this.max&&X(this.min)&&!this.tickAmount&&(parseInt(this.min,10)===this.min||!1!==s.allowDecimals),this.tickPositions=_=o&&o.slice(),!_&&(this.ordinal&&this.ordinal.positions||!((this.max-this.min)/this.tickInterval>Math.max(2*this.len,200))?_=this.dateTime?this.getTimeTicks(this.dateTime.normalizeTimeTickInterval(this.tickInterval,s.units),this.min,this.max,s.startOfWeek,this.ordinal&&this.ordinal.positions,this.closestPointRange,!0):this.logarithmic?this.logarithmic.getLogTickPositions(this.tickInterval,this.min,this.max):this.getLinearTickPositions(this.tickInterval,this.min,this.max):(_=[this.min,this.max],ee(19,!1,this.chart)),_.length>this.len&&((_=[_[0],_.pop()])[0]===_[1]&&(_.length=1)),this.tickPositions=_,R&&(R=R.apply(this,[this.min,this.max])))&&(this.tickPositions=_=R),this.paddedTicks=_.slice(0),this.trimTicks(_,O,S),this.isLinked||(this.single&&2>_.length&&!this.categories&&!this.series.some((function(s){return s.is("heatmap")&&"between"===s.options.pointPlacement}))&&(this.min-=.5,this.max+=.5),o||R||this.adjustTickAmount()),ie(this,"afterSetTickPositions")},a.prototype.trimTicks=function(s,o,_){var S=s[0],R=s[s.length-1],O=!this.isOrdinal&&this.minPointOffset||0;if(ie(this,"trimTicks"),!this.isLinked){if(o&&-1/0!==S)this.min=S;else for(;this.min-O>s[0];)s.shift();if(_)this.max=R;else for(;this.max+O<s[s.length-1];)s.pop();0===s.length&&X(S)&&!this.options.tickPositions&&s.push((R+S)/2)}},a.prototype.alignToOthers=function(){var s,o={},_=this.options;return!1!==this.chart.options.chart.alignTicks&&_.alignTicks&&!1!==_.startOnTick&&!1!==_.endOnTick&&!this.logarithmic&&this.chart[this.coll].forEach((function(_){var S=_.options;S=[_.horiz?S.left:S.top,S.width,S.height,S.pane].join(),_.series.length&&(o[S]?s=!0:o[S]=1)})),s},a.prototype.getTickAmount=function(){var s=this.options,o=s.tickPixelInterval,_=s.tickAmount;!X(s.tickInterval)&&!_&&this.len<o&&!this.isRadial&&!this.logarithmic&&s.startOnTick&&s.endOnTick&&(_=2),!_&&this.alignToOthers()&&(_=Math.ceil(this.len/o)+1),4>_&&(this.finalTickAmt=_,_=5),this.tickAmount=_},a.prototype.adjustTickAmount=function(){var s=this.options,o=this.tickInterval,_=this.tickPositions,S=this.tickAmount,R=this.finalTickAmt,O=_&&_.length,P=ce(this.threshold,this.softThreshold?0:null);if(this.hasData()&&re(this.min)&&re(this.max)){if(O<S){for(;_.length<S;)_.length%2||this.min===P?_.push($(_[_.length-1]+o)):_.unshift($(_[0]-o));this.transA*=(O-1)/(S-1),this.min=s.startOnTick?_[0]:Math.min(this.min,_[0]),this.max=s.endOnTick?_[_.length-1]:Math.max(this.max,_[_.length-1])}else O>S&&(this.tickInterval*=2,this.setTickPositions());if(X(R)){for(o=s=_.length;o--;)(3===R&&1==o%2||2>=R&&0<o&&o<s-1)&&_.splice(o,1);this.finalTickAmt=void 0}}},a.prototype.setScale=function(){var s=!1,o=!1;this.series.forEach((function(_){s=s||_.isDirtyData||_.isDirty,o=o||_.xAxis&&_.xAxis.isDirty||!1})),this.setAxisSize();var _=this.len!==(this.old&&this.old.len);_||s||o||this.isLinked||this.forceRedraw||this.userMin!==(this.old&&this.old.userMin)||this.userMax!==(this.old&&this.old.userMax)||this.alignToOthers()?(this.stacking&&this.stacking.resetStacks(),this.forceRedraw=!1,this.getSeriesExtremes(),this.setTickInterval(),this.isDirty||(this.isDirty=_||this.min!==(this.old&&this.old.min)||this.max!==(this.old&&this.old.max))):this.stacking&&this.stacking.cleanStacks(),s&&this.panningState&&(this.panningState.isDirty=!0),ie(this,"afterSetScale")},a.prototype.setExtremes=function(s,o,_,S,R){var O=this,P=O.chart;_=ce(_,!0),O.series.forEach((function(s){delete s.kdTree})),R=te(R,{min:s,max:o}),ie(O,"setExtremes",R,(function(){O.userMin=s,O.userMax=o,O.eventArgs=R,_&&P.redraw(S)}))},a.prototype.zoom=function(s,o){var _=this,S=this.dataMin,R=this.dataMax,O=this.options,P=Math.min(S,ce(O.min,S)),D=Math.max(R,ce(O.max,R));return ie(this,"zoom",s={newMin:s,newMax:o},(function(s){var o=s.newMin,O=s.newMax;o===_.min&&O===_.max||(_.allowZoomOutside||(X(S)&&(o<P&&(o=P),o>D&&(o=D)),X(R)&&(O<P&&(O=P),O>D&&(O=D))),_.displayBtn=void 0!==o||void 0!==O,_.setExtremes(o,O,!1,void 0,{trigger:"zoom"})),s.zoomed=!0})),s.zoomed},a.prototype.setAxisSize=function(){var s=this.chart,o=this.options,_=o.offsets||[0,0,0,0],S=this.horiz,R=this.width=Math.round(he(ce(o.width,s.plotWidth-_[3]+_[1]),s.plotWidth)),O=this.height=Math.round(he(ce(o.height,s.plotHeight-_[0]+_[2]),s.plotHeight)),P=this.top=Math.round(he(ce(o.top,s.plotTop+_[0]),s.plotHeight,s.plotTop));o=this.left=Math.round(he(ce(o.left,s.plotLeft+_[3]),s.plotWidth,s.plotLeft)),this.bottom=s.chartHeight-O-P,this.right=s.chartWidth-R-o,this.len=Math.max(S?R:O,0),this.pos=S?o:P},a.prototype.getExtremes=function(){var s=this.logarithmic;return{min:s?$(s.lin2log(this.min)):this.min,max:s?$(s.lin2log(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},a.prototype.getThreshold=function(s){var o=this.logarithmic,_=o?o.lin2log(this.min):this.min;return o=o?o.lin2log(this.max):this.max,null===s||-1/0===s?s=_:1/0===s?s=o:_>s?s=_:o<s&&(s=o),this.translate(s,0,1,0,1)},a.prototype.autoLabelAlign=function(s){var o=(ce(s,0)-90*this.side+720)%360;return ie(this,"autoLabelAlign",s={align:"center"},(function(s){15<o&&165>o?s.align="right":195<o&&345>o&&(s.align="left")})),s.align},a.prototype.tickSize=function(s){var o=this.options,_=ce(o["tick"===s?"tickWidth":"minorTickWidth"],"tick"===s&&this.isXAxis&&!this.categories?1:0),S=o["tick"===s?"tickLength":"minorTickLength"];if(_&&S){"inside"===o[s+"Position"]&&(S=-S);var R=[S,_]}return ie(this,"afterTickSize",s={tickSize:R}),s.tickSize},a.prototype.labelMetrics=function(){var s=this.tickPositions&&this.tickPositions[0]||0;return this.chart.renderer.fontMetrics(this.options.labels.style.fontSize,this.ticks[s]&&this.ticks[s].label)},a.prototype.unsquish=function(){var s,o,_=this.options.labels,S=this.horiz,R=this.tickInterval,O=this.len/(((this.categories?1:0)+this.max-this.min)/R),P=_.rotation,D=this.labelMetrics(),N=Math.max(this.max-this.min,0),h=function(s){var o=s/(O||1);return(o=1<o?Math.ceil(o):1)*R>N&&1/0!==s&&1/0!==O&&N&&(o=Math.ceil(N/R)),$(o*R)},V=R,j=Number.MAX_VALUE;if(S){if(!_.staggerLines&&!_.step)if(re(P))var W=[P];else O<_.autoRotationLimit&&(W=_.autoRotation);W&&W.forEach((function(_){if(_===P||_&&-90<=_&&90>=_){var S=(o=h(Math.abs(D.h/Math.sin(K*_))))+Math.abs(_/360);S<j&&(j=S,s=_,V=o)}}))}else _.step||(V=h(D.h));return this.autoRotation=W,this.labelRotation=ce(s,re(P)?P:0),V},a.prototype.getSlotWidth=function(s){var o=this.chart,_=this.horiz,S=this.options.labels,R=Math.max(this.tickPositions.length-(this.categories?0:1),1),O=o.margin[3];if(s&&re(s.slotWidth))return s.slotWidth;if(_&&2>S.step)return S.rotation?0:(this.staggerLines||1)*this.len/R;if(!_){if(void 0!==(s=S.style.width))return parseInt(String(s),10);if(O)return O-o.spacing[3]}return.33*o.chartWidth},a.prototype.renderUnsquish=function(){var s=this.chart,o=s.renderer,_=this.tickPositions,S=this.ticks,R=this.options.labels,O=R.style,P=this.horiz,D=this.getSlotWidth(),N=Math.max(1,Math.round(D-2*R.padding)),V={},j=this.labelMetrics(),K=O.textOverflow,W=0;if(se(R.rotation)||(V.rotation=R.rotation||0),_.forEach((function(s){(s=S[s]).movedLabel&&s.replaceMovedLabel(),s&&s.label&&s.label.textPxLength>W&&(W=s.label.textPxLength)})),this.maxLabelLength=W,this.autoRotation)W>N&&W>j.h?V.rotation=this.labelRotation:this.labelRotation=0;else if(D){var U=N;if(!K){var Y="clip";for(N=_.length;!P&&N--;){var $=_[N];($=S[$].label)&&($.styles&&"ellipsis"===$.styles.textOverflow?$.css({textOverflow:"clip"}):$.textPxLength>D&&$.css({width:D+"px"}),$.getBBox().height>this.len/_.length-(j.h-j.f)&&($.specificTextOverflow="ellipsis"))}}}V.rotation&&(U=W>.5*s.chartHeight?.33*s.chartHeight:W,K||(Y="ellipsis")),(this.labelAlign=R.align||this.autoLabelAlign(this.labelRotation))&&(V.align=this.labelAlign),_.forEach((function(s){var o=(s=S[s])&&s.label,_=O.width,R={};o&&(o.attr(V),s.shortenLabel?s.shortenLabel():U&&!_&&"nowrap"!==O.whiteSpace&&(U<o.textPxLength||"SPAN"===o.element.tagName)?(R.width=U+"px",K||(R.textOverflow=o.specificTextOverflow||Y),o.css(R)):o.styles&&o.styles.width&&!R.width&&!_&&o.css({width:null}),delete o.specificTextOverflow,s.rotation=V.rotation)}),this),this.tickRotCorr=o.rotCorr(j.b,this.labelRotation||0,0!==this.side)},a.prototype.hasData=function(){return this.series.some((function(s){return s.hasData()}))||this.options.showEmpty&&X(this.min)&&X(this.max)},a.prototype.addTitle=function(s){var o,_=this.chart.renderer,S=this.horiz,R=this.opposite,O=this.options.title,P=this.chart.styledMode;this.axisTitle||((o=O.textAlign)||(o=(S?{low:"left",middle:"center",high:"right"}:{low:R?"right":"left",middle:"center",high:R?"left":"right"})[O.align]),this.axisTitle=_.text(O.text||"",0,0,O.useHTML).attr({zIndex:7,rotation:O.rotation,align:o}).addClass("highcharts-axis-title"),P||this.axisTitle.css(le(O.style)),this.axisTitle.add(this.axisGroup),this.axisTitle.isNew=!0),P||O.style.width||this.isRadial||this.axisTitle.css({width:this.len+"px"}),this.axisTitle[s?"show":"hide"](s)},a.prototype.generateTick=function(s){var o=this.ticks;o[s]?o[s].addLabel():o[s]=new P(this,s)},a.prototype.getOffset=function(){var s=this,o=this,_=o.chart,S=o.horiz,R=o.options,O=o.side,P=o.ticks,D=o.tickPositions,N=o.coll,V=o.axisParent,j=_.renderer,K=_.inverted&&!o.isZAxis?[1,0,3,2][O]:O,W=o.hasData(),U=R.title,Y=R.labels,$=_.axisOffset;_=_.clipOffset;var Z,Q=[-1,1,1,-1][O],ee=R.className,te=0,ae=0,ne=0;if(o.showAxis=Z=W||R.showEmpty,o.staggerLines=o.horiz&&Y.staggerLines||void 0,!o.axisGroup){var v=function(o,_,S){return j.g(o).attr({zIndex:S}).addClass("highcharts-"+N.toLowerCase()+_+" "+(s.isRadial?"highcharts-radial-axis"+_+" ":"")+(ee||"")).add(V)};o.gridGroup=v("grid","-grid",R.gridZIndex),o.axisGroup=v("axis","",R.zIndex),o.labelGroup=v("axis-labels","-labels",Y.zIndex)}if(W||o.isLinked?(D.forEach((function(s){o.generateTick(s)})),o.renderUnsquish(),o.reserveSpaceDefault=0===O||2===O||{1:"left",3:"right"}[O]===o.labelAlign,ce(Y.reserveSpace,"center"===o.labelAlign||null,o.reserveSpaceDefault)&&D.forEach((function(s){ne=Math.max(P[s].getLabelSize(),ne)})),o.staggerLines&&(ne*=o.staggerLines),o.labelOffset=ne*(o.opposite?-1:1)):de(P,(function(s,o){s.destroy(),delete P[o]})),U&&U.text&&!1!==U.enabled&&(o.addTitle(Z),Z&&!1!==U.reserveSpace)){o.titleOffset=te=o.axisTitle.getBBox()[S?"height":"width"];var re=U.offset;ae=X(re)?0:ce(U.margin,S?5:10)}o.renderLine(),o.offset=Q*ce(R.offset,$[O]?$[O]+(R.margin||0):0),o.tickRotCorr=o.tickRotCorr||{x:0,y:0},U=0===O?-o.labelMetrics().h:2===O?o.tickRotCorr.y:0,W=Math.abs(ne)+ae,ne&&(W=W-U+Q*(S?ce(Y.y,o.tickRotCorr.y+8*Q):Y.x)),o.axisTitleMargin=ce(re,W),o.getMaxLabelDimensions&&(o.maxLabelDimensions=o.getMaxLabelDimensions(P,D)),"colorAxis"!==N&&(S=this.tickSize("tick"),$[O]=Math.max($[O],(o.axisTitleMargin||0)+te+Q*o.offset,W,D&&D.length&&S?S[0]+Q*o.offset:0),R=!o.axisLine||R.offset?0:2*Math.floor(o.axisLine.strokeWidth()/2),_[K]=Math.max(_[K],R)),ie(this,"afterGetOffset")},a.prototype.getLinePath=function(s){var o=this.chart,_=this.opposite,S=this.offset,R=this.horiz,O=this.left+(_?this.width:0)+S;return S=o.chartHeight-this.bottom-(_?this.height:0)+S,_&&(s*=-1),o.renderer.crispLine([["M",R?this.left:O,R?S:this.top],["L",R?o.chartWidth-this.right:O,R?S:o.chartHeight-this.bottom]],s)},a.prototype.renderLine=function(){this.axisLine||(this.axisLine=this.chart.renderer.path().addClass("highcharts-axis-line").add(this.axisGroup),this.chart.styledMode||this.axisLine.attr({stroke:this.options.lineColor,"stroke-width":this.options.lineWidth,zIndex:7}))},a.prototype.getTitlePosition=function(){var s=this.horiz,o=this.left,_=this.top,S=this.len,R=this.options.title,O=s?o:_,P=this.opposite,D=this.offset,N=R.x,V=R.y,j=this.axisTitle,K=this.chart.renderer.fontMetrics(R.style.fontSize,j);return j=Math.max(j.getBBox(null,0).height-K.h-1,0),S={low:O+(s?0:S),middle:O+S/2,high:O+(s?S:0)}[R.align],o=(s?_+this.height:o)+(s?1:-1)*(P?-1:1)*this.axisTitleMargin+[-j,j,K.f,-j][this.side],s={x:s?S+N:o+(P?this.width:0)+D+N,y:s?o+V-(P?this.height:0)+D:S+V},ie(this,"afterGetTitlePosition",{titlePosition:s}),s},a.prototype.renderMinorTick=function(s,o){var _=this.minorTicks;_[s]||(_[s]=new P(this,s,"minor")),o&&_[s].isNew&&_[s].render(null,!0),_[s].render(null,!1,1)},a.prototype.renderTick=function(s,o,_){var S=this.ticks;(!this.isLinked||s>=this.min&&s<=this.max||this.grid&&this.grid.isColumn)&&(S[s]||(S[s]=new P(this,s)),_&&S[s].isNew&&S[s].render(o,!0,-1),S[s].render(o))},a.prototype.render=function(){var s,o,_=this,S=_.chart,R=_.logarithmic,D=_.options,V=_.isLinked,j=_.tickPositions,K=_.axisTitle,W=_.ticks,U=_.minorTicks,Y=_.alternateBands,$=D.stackLabels,X=D.alternateGridColor,Z=_.tickmarkOffset,Q=_.axisLine,ee=_.showAxis,te=N(S.renderer.globalAnimation);if(_.labelEdge.length=0,_.overlap=!1,[W,U,Y].forEach((function(s){de(s,(function(s){s.isActive=!1}))})),_.hasData()||V){var ae=_.chart.hasRendered&&_.old&&re(_.old.min);_.minorTickInterval&&!_.categories&&_.getMinorTickPositions().forEach((function(s){_.renderMinorTick(s,ae)})),j.length&&(j.forEach((function(s,o){_.renderTick(s,o,ae)})),Z&&(0===_.min||_.single)&&(W[-1]||(W[-1]=new P(_,-1,null,!0)),W[-1].render(-1))),X&&j.forEach((function(P,D){o=void 0!==j[D+1]?j[D+1]+Z:_.max-Z,0==D%2&&P<_.max&&o<=_.max+(S.polar?-Z:Z)&&(Y[P]||(Y[P]=new O.PlotLineOrBand(_)),s=P+Z,Y[P].options={from:R?R.lin2log(s):s,to:R?R.lin2log(o):o,color:X,className:"highcharts-alternate-grid"},Y[P].render(),Y[P].isActive=!0)})),_._addedPlotLB||(_._addedPlotLB=!0,(D.plotLines||[]).concat(D.plotBands||[]).forEach((function(s){_.addPlotBandOrLine(s)})))}[W,U,Y].forEach((function(s){var o=[],_=te.duration;de(s,(function(s,_){s.isActive||(s.render(_,!1,0),s.isActive=!1,o.push(_))})),fe((function(){for(var _=o.length;_--;)s[o[_]]&&!s[o[_]].isActive&&(s[o[_]].destroy(),delete s[o[_]])}),s!==Y&&S.hasRendered&&_?_:0)})),Q&&(Q[Q.isPlaced?"animate":"attr"]({d:this.getLinePath(Q.strokeWidth())}),Q.isPlaced=!0,Q[ee?"show":"hide"](ee)),K&&ee&&(D=_.getTitlePosition(),re(D.y)?(K[K.isNew?"attr":"animate"](D),K.isNew=!1):(K.attr("y",-9999),K.isNew=!0)),$&&$.enabled&&_.stacking&&_.stacking.renderStackTotals(),_.old={len:_.len,max:_.max,min:_.min,transA:_.transA,userMax:_.userMax,userMin:_.userMin},_.isDirty=!1,ie(this,"afterRender")},a.prototype.redraw=function(){this.visible&&(this.render(),this.plotLinesAndBands.forEach((function(s){s.render()}))),this.series.forEach((function(s){s.isDirty=!0}))},a.prototype.getKeepProps=function(){return this.keepProps||a.keepProps},a.prototype.destroy=function(s){var o=this,_=o.plotLinesAndBands,S=this.eventOptions;if(ie(this,"destroy",{keepEvents:s}),s||ue(o),[o.ticks,o.minorTicks,o.alternateBands].forEach((function(s){Z(s)})),_)for(s=_.length;s--;)_[s].destroy();for(var R in"axisLine axisTitle axisGroup gridGroup labelGroup cross scrollbar".split(" ").forEach((function(s){o[s]&&(o[s]=o[s].destroy())})),o.plotLinesAndBandsGroups)o.plotLinesAndBandsGroups[R]=o.plotLinesAndBandsGroups[R].destroy();de(o,(function(s,_){-1===o.getKeepProps().indexOf(_)&&delete o[_]})),this.eventOptions=S},a.prototype.drawCrosshair=function(s,o){var S,R=this.crosshair,O=ce(R&&R.snap,!0),P=this.chart,D=this.cross;if(ie(this,"drawCrosshair",{e:s,point:o}),s||(s=this.cross&&this.cross.e),R&&!1!==(X(o)||!O)){if(O?X(o)&&(S=ce("colorAxis"!==this.coll?o.crosshairPos:null,this.isXAxis?o.plotX:this.len-o.plotY)):S=s&&(this.horiz?s.chartX-this.pos:this.len-s.chartY+this.pos),X(S)){var N={value:o&&(this.isXAxis?o.x:ce(o.stackY,o.y)),translatedValue:S};P.polar&&te(N,{isCrosshair:!0,chartX:s&&s.chartX,chartY:s&&s.chartY,point:o}),N=this.getPlotLinePath(N)||null}if(!X(N))return void this.hideCrosshair();O=this.categories&&!this.isRadial,D||(this.cross=D=P.renderer.path().addClass("highcharts-crosshair highcharts-crosshair-"+(O?"category ":"thin ")+(R.className||"")).attr({zIndex:ce(R.zIndex,2)}).add(),P.styledMode||(D.attr({stroke:R.color||(O?_.parse("#ccd6eb").setOpacity(.25).get():"#cccccc"),"stroke-width":ce(R.width,1)}).css({"pointer-events":"none"}),R.dashStyle&&D.attr({dashstyle:R.dashStyle}))),D.show().attr({d:N}),O&&!R.width&&D.attr({"stroke-width":this.transA}),this.cross.e=s}else this.hideCrosshair();ie(this,"afterDrawCrosshair",{e:s,point:o})},a.prototype.hideCrosshair=function(){this.cross&&this.cross.hide(),ie(this,"afterHideCrosshair")},a.prototype.hasVerticalPanning=function(){var s=this.chart.options.chart.panning;return!!(s&&s.enabled&&/y/.test(s.type))},a.prototype.validatePositiveValue=function(s){return re(s)&&0<s},a.prototype.update=function(s,o){var _=this.chart;s=le(this.userOptions,s),this.destroy(!0),this.init(_,s),_.isDirtyBox=!0,ce(o,!0)&&_.redraw()},a.prototype.remove=function(s){for(var o=this.chart,_=this.coll,S=this.series,R=S.length;R--;)S[R]&&S[R].remove(!1);Q(o.axes,this),Q(o[_],this),o[_].forEach((function(s,o){s.options.index=s.userOptions.index=o})),this.destroy(),o.isDirtyBox=!0,ce(s,!0)&&o.redraw()},a.prototype.setTitle=function(s,o){this.update({title:s},o)},a.prototype.setCategories=function(s,o){this.update({categories:s},o)},a.defaultOptions=o.defaultXAxisOptions,a.keepProps="extKey hcEvents names series userMax userMin".split(" "),a}()})),M(o,"Core/Axis/DateTimeAxis.js",[o["Core/Utilities.js"]],(function(s){var o,_=s.addEvent,S=s.getMagnitude,R=s.normalizeTickInterval,O=s.timeUnits;return function(s){function u(){return this.chart.time.getTimeTicks.apply(this.chart.time,arguments)}function q(s){"datetime"!==s.userOptions.type?this.dateTime=void 0:this.dateTime||(this.dateTime=new P(this))}var o=[];s.compose=function(s){return-1===o.indexOf(s)&&(o.push(s),s.keepProps.push("dateTime"),s.prototype.getTimeTicks=u,_(s,"init",q)),s};var P=function(){function a(s){this.axis=s}return a.prototype.normalizeTimeTickInterval=function(s,o){var _=o||[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1,2]],["week",[1,2]],["month",[1,2,3,4,6]],["year",null]];o=_[_.length-1];var P,D=O[o[0]],N=o[1];for(P=0;P<_.length&&(o=_[P],D=O[o[0]],N=o[1],!(_[P+1]&&s<=(D*N[N.length-1]+O[_[P+1][0]])/2));P++);return D===O.year&&s<5*D&&(N=[1,2,5]),{unitRange:D,count:s=R(s/D,N,"year"===o[0]?Math.max(S(s/D),1):1),unitName:o[0]}},a.prototype.getXDateFormat=function(s,o){var _=this.axis;return _.closestPointRange?_.chart.time.getDateFormat(_.closestPointRange,s,_.options.startOfWeek,o)||o.year:o.day},a}();s.Additions=P}(o||(o={})),o})),M(o,"Core/Axis/LogarithmicAxis.js",[o["Core/Utilities.js"]],(function(s){var o,_=s.addEvent,S=s.getMagnitude,R=s.normalizeTickInterval,O=s.pick;return function(s){function u(s){var o=this.logarithmic;"logarithmic"!==s.userOptions.type?this.logarithmic=void 0:o||(this.logarithmic=new P(this))}function q(){var s=this.logarithmic;s&&(this.lin2val=function(o){return s.lin2log(o)},this.val2lin=function(o){return s.log2lin(o)})}var o=[];s.compose=function(s){return-1===o.indexOf(s)&&(o.push(s),s.keepProps.push("logarithmic"),_(s,"init",u),_(s,"afterInit",q)),s};var P=function(){function a(s){this.axis=s}return a.prototype.getLogTickPositions=function(s,o,_,P){var D=this.axis,N=D.len,V=D.options,j=[];if(P||(this.minorAutoInterval=void 0),.5<=s)s=Math.round(s),j=D.getLinearTickPositions(s,o,_);else if(.08<=s){var K,W=Math.floor(o),U=V=void 0;for(N=.3<s?[1,2,4]:.15<s?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];W<_+1&&!U;W++){var Y=N.length;for(K=0;K<Y&&!U;K++){var $=this.log2lin(this.lin2log(W)*N[K]);$>o&&(!P||V<=_)&&void 0!==V&&j.push(V),V>_&&(U=!0),V=$}}}else o=this.lin2log(o),_=this.lin2log(_),s=P?D.getMinorTickInterval():V.tickInterval,s=O("auto"===s?null:s,this.minorAutoInterval,V.tickPixelInterval/(P?5:1)*(_-o)/((P?N/D.tickPositions.length:N)||1)),s=R(s,void 0,S(s)),j=D.getLinearTickPositions(s,o,_).map(this.log2lin),P||(this.minorAutoInterval=s/5);return P||(D.tickInterval=s),j},a.prototype.lin2log=function(s){return Math.pow(10,s)},a.prototype.log2lin=function(s){return Math.log(s)/Math.LN10},a}();s.Additions=P}(o||(o={})),o})),M(o,"Core/Axis/PlotLineOrBand/PlotLineOrBandAxis.js",[o["Core/Utilities.js"]],(function(s){var o,_=s.erase,S=s.extend,R=s.isNumber;return function(s){var o,O=[];s.compose=function(s,_){return o||(o=s),-1===O.indexOf(_)&&(O.push(_),S(_.prototype,P.prototype)),_};var P=function(){function a(){}return a.prototype.getPlotBandPath=function(s,o,_){void 0===_&&(_=this.options);var S=this.getPlotLinePath({value:o,force:!0,acrossPanes:_.acrossPanes}),O=[],P=this.horiz;if(o=!R(this.min)||!R(this.max)||s<this.min&&o<this.min||s>this.max&&o>this.max,s=this.getPlotLinePath({value:s,force:!0,acrossPanes:_.acrossPanes}),_=1,s&&S){if(o){var D=s.toString()===S.toString();_=0}for(o=0;o<s.length;o+=2){var N=s[o],V=s[o+1],j=S[o],K=S[o+1];"M"!==N[0]&&"L"!==N[0]||"M"!==V[0]&&"L"!==V[0]||"M"!==j[0]&&"L"!==j[0]||"M"!==K[0]&&"L"!==K[0]||(P&&j[1]===N[1]?(j[1]+=_,K[1]+=_):P||j[2]!==N[2]||(j[2]+=_,K[2]+=_),O.push(["M",N[1],N[2]],["L",V[1],V[2]],["L",K[1],K[2]],["L",j[1],j[2]],["Z"])),O.isFlat=D}}return O},a.prototype.addPlotBand=function(s){return this.addPlotBandOrLine(s,"plotBands")},a.prototype.addPlotLine=function(s){return this.addPlotBandOrLine(s,"plotLines")},a.prototype.addPlotBandOrLine=function(s,_){var S=this,R=this.userOptions,O=new o(this,s);if(this.visible&&(O=O.render()),O){if(this._addedPlotLB||(this._addedPlotLB=!0,(R.plotLines||[]).concat(R.plotBands||[]).forEach((function(s){S.addPlotBandOrLine(s)}))),_){var P=R[_]||[];P.push(s),R[_]=P}this.plotLinesAndBands.push(O)}return O},a.prototype.removePlotBandOrLine=function(s){var o=this.plotLinesAndBands,S=this.options,R=this.userOptions;if(o){for(var O=o.length;O--;)o[O].id===s&&o[O].destroy();[S.plotLines||[],R.plotLines||[],S.plotBands||[],R.plotBands||[]].forEach((function(o){for(O=o.length;O--;)(o[O]||{}).id===s&&_(o,o[O])}))}},a.prototype.removePlotBand=function(s){this.removePlotBandOrLine(s)},a.prototype.removePlotLine=function(s){this.removePlotBandOrLine(s)},a}()}(o||(o={})),o})),M(o,"Core/Axis/PlotLineOrBand/PlotLineOrBand.js",[o["Core/Axis/PlotLineOrBand/PlotLineOrBandAxis.js"],o["Core/Utilities.js"]],(function(s,o){var _=o.arrayMax,S=o.arrayMin,R=o.defined,O=o.destroyObjectProperties,P=o.erase,D=o.fireEvent,N=o.merge,V=o.objectEach,j=o.pick;return o=function(){function e(s,o){this.axis=s,o&&(this.options=o,this.id=o.id)}return e.compose=function(o){return s.compose(e,o)},e.prototype.render=function(){D(this,"render");var s=this,o=s.axis,_=o.horiz,S=o.logarithmic,O=s.options,P=O.color,K=j(O.zIndex,0),W=O.events,U={},Y=o.chart.renderer,$=O.label,X=s.label,Z=O.to,Q=O.from,ee=O.value,te=s.svgElem,ie=[],ae=R(Q)&&R(Z);ie=R(ee);var ne=!te,re={class:"highcharts-plot-"+(ae?"band ":"line ")+(O.className||"")},se=ae?"bands":"lines";if(S&&(Q=S.log2lin(Q),Z=S.log2lin(Z),ee=S.log2lin(ee)),o.chart.styledMode||(ie?(re.stroke=P||"#999999",re["stroke-width"]=j(O.width,1),O.dashStyle&&(re.dashstyle=O.dashStyle)):ae&&(re.fill=P||"#e6ebf5",O.borderWidth&&(re.stroke=O.borderColor,re["stroke-width"]=O.borderWidth))),U.zIndex=K,se+="-"+K,(S=o.plotLinesAndBandsGroups[se])||(o.plotLinesAndBandsGroups[se]=S=Y.g("plot-"+se).attr(U).add()),ne&&(s.svgElem=te=Y.path().attr(re).add(S)),ie)ie=o.getPlotLinePath({value:ee,lineWidth:te.strokeWidth(),acrossPanes:O.acrossPanes});else{if(!ae)return;ie=o.getPlotBandPath(Q,Z,O)}return!s.eventsAdded&&W&&(V(W,(function(o,_){te.on(_,(function(o){W[_].apply(s,[o])}))})),s.eventsAdded=!0),(ne||!te.d)&&ie&&ie.length?te.attr({d:ie}):te&&(ie?(te.show(!0),te.animate({d:ie})):te.d&&(te.hide(),X&&(s.label=X=X.destroy()))),$&&(R($.text)||R($.formatter))&&ie&&ie.length&&0<o.width&&0<o.height&&!ie.isFlat?($=N({align:_&&ae&&"center",x:_?!ae&&4:10,verticalAlign:!_&&ae&&"middle",y:_?ae?16:10:ae?6:-4,rotation:_&&!ae&&90},$),this.renderLabel($,ie,ae,K)):X&&X.hide(),s},e.prototype.renderLabel=function(s,o,R,O){var P=this.axis,D=P.chart.renderer,V=this.label;V||(this.label=V=D.text(this.getLabelText(s),0,0,s.useHTML).attr({align:s.textAlign||s.align,rotation:s.rotation,class:"highcharts-plot-"+(R?"band":"line")+"-label "+(s.className||""),zIndex:O}).add(),P.chart.styledMode||V.css(N({textOverflow:"ellipsis"},s.style))),O=o.xBounds||[o[0][1],o[1][1],R?o[2][1]:o[0][1]],o=o.yBounds||[o[0][2],o[1][2],R?o[2][2]:o[0][2]],R=S(O),D=S(o),V.align(s,!1,{x:R,y:D,width:_(O)-R,height:_(o)-D}),V.alignValue&&"left"!==V.alignValue||V.css({width:(90===V.rotation?P.height-(V.alignAttr.y-P.top):P.width-(V.alignAttr.x-P.left))+"px"}),V.show(!0)},e.prototype.getLabelText=function(s){return R(s.formatter)?s.formatter.call(this):s.text},e.prototype.destroy=function(){P(this.axis.plotLinesAndBands,this),delete this.axis,O(this)},e}()})),M(o,"Core/Tooltip.js",[o["Core/FormatUtilities.js"],o["Core/Globals.js"],o["Core/Renderer/RendererUtilities.js"],o["Core/Renderer/RendererRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R){var O=s.format,P=o.doc,D=_.distribute,N=R.addEvent,V=R.clamp,j=R.css,K=R.defined,W=R.discardElement,U=R.extend,Y=R.fireEvent,$=R.isArray,X=R.isNumber,Z=R.isString,Q=R.merge,ee=R.pick,te=R.splat,ie=R.syncTimeout;return s=function(){function a(s,o){this.allowShared=!0,this.container=void 0,this.crosshairs=[],this.distance=0,this.isHidden=!0,this.isSticky=!1,this.now={},this.options={},this.outside=!1,this.chart=s,this.init(s,o)}return a.prototype.applyFilter=function(){var s=this.chart;s.renderer.definition({tagName:"filter",attributes:{id:"drop-shadow-"+s.index,opacity:.5},children:[{tagName:"feGaussianBlur",attributes:{in:"SourceAlpha",stdDeviation:1}},{tagName:"feOffset",attributes:{dx:1,dy:1}},{tagName:"feComponentTransfer",children:[{tagName:"feFuncA",attributes:{type:"linear",slope:.3}}]},{tagName:"feMerge",children:[{tagName:"feMergeNode"},{tagName:"feMergeNode",attributes:{in:"SourceGraphic"}}]}]})},a.prototype.bodyFormatter=function(s){return s.map((function(s){var o=s.series.tooltipOptions;return(o[(s.point.formatPrefix||"point")+"Formatter"]||s.point.tooltipFormatter).call(s.point,o[(s.point.formatPrefix||"point")+"Format"]||"")}))},a.prototype.cleanSplit=function(s){this.chart.series.forEach((function(o){var _=o&&o.tt;_&&(!_.isActive||s?o.tt=_.destroy():_.isActive=!1)}))},a.prototype.defaultFormatter=function(s){var o=this.points||te(this),_=[s.tooltipFooterHeaderFormatter(o[0])];return(_=_.concat(s.bodyFormatter(o))).push(s.tooltipFooterHeaderFormatter(o[0],!0)),_},a.prototype.destroy=function(){this.label&&(this.label=this.label.destroy()),this.split&&this.tt&&(this.cleanSplit(!0),this.tt=this.tt.destroy()),this.renderer&&(this.renderer=this.renderer.destroy(),W(this.container)),R.clearTimeout(this.hideTimer),R.clearTimeout(this.tooltipTimeout)},a.prototype.getAnchor=function(s,o){var _,S,R=this.chart,O=R.pointer,P=R.inverted,D=R.plotTop,N=R.plotLeft,V=0,j=0;return s=te(s),this.followPointer&&o?(void 0===o.chartX&&(o=O.normalize(o)),O=[o.chartX-N,o.chartY-D]):s[0].tooltipPos?O=s[0].tooltipPos:(s.forEach((function(s){_=s.series.yAxis,S=s.series.xAxis,V+=s.plotX||0,j+=s.plotLow?(s.plotLow+(s.plotHigh||0))/2:s.plotY||0,S&&_&&(P?(V+=D+R.plotHeight-S.len-S.pos,j+=N+R.plotWidth-_.len-_.pos):(V+=S.pos-N,j+=_.pos-D))})),V/=s.length,j/=s.length,O=[P?R.plotWidth-j:V,P?R.plotHeight-V:j],this.shared&&1<s.length&&o&&(P?O[0]=o.chartX-N:O[1]=o.chartY-D)),O.map(Math.round)},a.prototype.getLabel=function(){var s,_=this,R=this.chart.styledMode,O=this.options,P=this.split&&this.allowShared,D="tooltip"+(K(O.className)?" "+O.className:""),V=O.style.pointerEvents||(!this.followPointer&&O.stickOnContact?"auto":"none"),r=function(){_.inContact=!0},h=function(s){var o=_.chart.hoverSeries;_.inContact=_.shouldStickOnContact()&&_.chart.pointer.inClass(s.relatedTarget,"highcharts-tooltip"),!_.inContact&&o&&o.onMouseOut&&o.onMouseOut()},W=this.chart.renderer;if(_.label){var U=!_.label.hasClass("highcharts-label");(P&&!U||!P&&U)&&_.destroy()}if(!this.label){if(this.outside){U=this.chart.options.chart.style;var Y=S.getRendererType();this.container=s=o.doc.createElement("div"),s.className="highcharts-tooltip-container",j(s,{position:"absolute",top:"1px",pointerEvents:V,zIndex:Math.max(this.options.style.zIndex||0,(U&&U.zIndex||0)+3)}),N(s,"mouseenter",r),N(s,"mouseleave",h),o.doc.body.appendChild(s),this.renderer=W=new Y(s,0,0,U,void 0,void 0,W.styledMode)}if(P?this.label=W.g(D):(this.label=W.label("",0,0,O.shape,void 0,void 0,O.useHTML,void 0,D).attr({padding:O.padding,r:O.borderRadius}),R||this.label.attr({fill:O.backgroundColor,"stroke-width":O.borderWidth}).css(O.style).css({pointerEvents:V}).shadow(O.shadow)),R&&O.shadow&&(this.applyFilter(),this.label.attr({filter:"url(#drop-shadow-"+this.chart.index+")"})),_.outside&&!_.split){var $=this.label,X=$.xSetter,Z=$.ySetter;$.xSetter=function(o){X.call($,_.distance),s.style.left=o+"px"},$.ySetter=function(o){Z.call($,_.distance),s.style.top=o+"px"}}this.label.on("mouseenter",r).on("mouseleave",h).attr({zIndex:8}).add()}return this.label},a.prototype.getPosition=function(s,o,_){var S,R=this.chart,O=this.distance,D={},N=R.inverted&&_.h||0,V=this.outside,j=V?P.documentElement.clientWidth-2*O:R.chartWidth,K=V?Math.max(P.body.scrollHeight,P.documentElement.scrollHeight,P.body.offsetHeight,P.documentElement.offsetHeight,P.documentElement.clientHeight):R.chartHeight,W=R.pointer.getChartPosition(),p=function(S){var P="x"===S;return[S,P?j:K,P?s:o].concat(V?[P?s*W.scaleX:o*W.scaleY,P?W.left-O+(_.plotX+R.plotLeft)*W.scaleX:W.top-O+(_.plotY+R.plotTop)*W.scaleY,0,P?j:K]:[P?s:o,P?_.plotX+R.plotLeft:_.plotY+R.plotTop,P?R.plotLeft:R.plotTop,P?R.plotLeft+R.plotWidth:R.plotTop+R.plotHeight])},U=p("y"),Y=p("x");p=!!_.negative,!R.polar&&R.hoverSeries&&R.hoverSeries.yAxis&&R.hoverSeries.yAxis.reversed&&(p=!p);var $=!this.followPointer&&ee(_.ttBelow,!R.inverted===p),B=function(s,o,_,S,R,P,j){var K=V?"y"===s?O*W.scaleY:O*W.scaleX:O,U=(_-S)/2,Y=S<R-O,X=R+O+S<o,Z=R-K-_+U;if(R=R+K-U,$&&X)D[s]=R;else if(!$&&Y)D[s]=Z;else if(Y)D[s]=Math.min(j-S,0>Z-N?Z:Z-N);else{if(!X)return!1;D[s]=Math.max(P,R+N+_>o?R:R+N)}},w=function(s,o,_,S,R){var P;return R<O||R>o-O?P=!1:D[s]=R<_/2?1:R>o-S/2?o-S-2:R-_/2,P},E=function(s){var o=U;U=Y,Y=o,S=s},T=function(){!1!==B.apply(0,U)?!1!==w.apply(0,Y)||S||(E(!0),T()):S?D.x=D.y=0:(E(!0),T())};return(R.inverted||1<this.len)&&E(),T(),D},a.prototype.hide=function(s){var o=this;R.clearTimeout(this.hideTimer),s=ee(s,this.options.hideDelay),this.isHidden||(this.hideTimer=ie((function(){o.getLabel().fadeOut(s?void 0:s),o.isHidden=!0}),s))},a.prototype.init=function(s,o){this.chart=s,this.options=o,this.crosshairs=[],this.now={x:0,y:0},this.isHidden=!0,this.split=o.split&&!s.inverted&&!s.polar,this.shared=o.shared||this.split,this.outside=ee(o.outside,!(!s.scrollablePixelsX&&!s.scrollablePixelsY))},a.prototype.shouldStickOnContact=function(){return!(this.followPointer||!this.options.stickOnContact)},a.prototype.isStickyOnContact=function(){return!(!this.shouldStickOnContact()||!this.inContact)},a.prototype.move=function(s,o,_,S){var O=this,P=O.now,D=!1!==O.options.animation&&!O.isHidden&&(1<Math.abs(s-P.x)||1<Math.abs(o-P.y)),N=O.followPointer||1<O.len;U(P,{x:D?(2*P.x+s)/3:s,y:D?(P.y+o)/2:o,anchorX:N?void 0:D?(2*P.anchorX+_)/3:_,anchorY:N?void 0:D?(P.anchorY+S)/2:S}),O.getLabel().attr(P),O.drawTracker(),D&&(R.clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout((function(){O&&O.move(s,o,_,S)}),32))},a.prototype.refresh=function(s,o){var _=this.chart,S=this.options,O=te(s),P=O[0],D=[],N=S.formatter||this.defaultFormatter,V=this.shared,j=_.styledMode,K={};if(S.enabled){R.clearTimeout(this.hideTimer),this.allowShared=!(!$(s)&&s.series&&s.series.noSharedTooltip),this.followPointer=!this.split&&P.series.tooltipOptions.followPointer;var W=(s=this.getAnchor(s,o))[0],U=s[1];if(V&&this.allowShared?(_.pointer.applyInactiveState(O),O.forEach((function(s){s.setState("hover"),D.push(s.getLabelConfig())})),(K={x:P.category,y:P.y}).points=D):K=P.getLabelConfig(),this.len=D.length,N=N.call(K,this),V=P.series,this.distance=ee(V.tooltipOptions.distance,16),!1===N)this.hide();else{if(this.split&&this.allowShared)this.renderSplit(N,O);else{var X=W,Z=U;if(o&&_.pointer.isDirectTouch&&(X=o.chartX-_.plotLeft,Z=o.chartY-_.plotTop),!_.polar&&!1!==V.options.clip&&!O.some((function(s){return s.series.shouldShowTooltip(X,Z)})))return void this.hide();o=this.getLabel(),S.style.width&&!j||o.css({width:this.chart.spacingBox.width+"px"}),o.attr({text:N&&N.join?N.join(""):N}),o.removeClass(/highcharts-color-[\d]+/g).addClass("highcharts-color-"+ee(P.colorIndex,V.colorIndex)),j||o.attr({stroke:S.borderColor||P.color||V.color||"#666666"}),this.updatePosition({plotX:W,plotY:U,negative:P.negative,ttBelow:P.ttBelow,h:s[2]||0})}this.isHidden&&this.label&&this.label.attr({opacity:1}).show(),this.isHidden=!1}Y(this,"refresh")}},a.prototype.renderSplit=function(s,o){function d(s,o,S,R,O){return void 0===O&&(O=!0),S?(o=de?0:pe,s=V(s-R/2,se.left,se.right-R-(_.outside?ce:0))):(o-=he,s=V(s=O?s-R-ae:s+ae,O?s:se.left,se.right)),{x:s,y:o}}var _=this,S=_.chart,R=_.chart,O=R.chartWidth,N=R.chartHeight,j=R.plotHeight,K=R.plotLeft,W=R.plotTop,Y=R.pointer,$=R.scrollablePixelsY;$=void 0===$?0:$;var X=R.scrollablePixelsX,Q=R.scrollingContainer,te=(Q=void 0===Q?{scrollLeft:0,scrollTop:0}:Q).scrollLeft;Q=Q.scrollTop;var ie=R.styledMode,ae=_.distance,ne=_.options,re=_.options.positioner,se=_.outside&&"number"!=typeof X?P.documentElement.getBoundingClientRect():{left:te,right:te+O,top:Q,bottom:Q+N},le=_.getLabel(),oe=this.renderer||S.renderer,de=!(!S.xAxis[0]||!S.xAxis[0].opposite),ce=(S=Y.getChartPosition()).left;S=S.top;var he=W+Q,ue=0,pe=j-$;Z(s)&&(s=[!1,s]),s=s.slice(0,o.length+1).reduce((function(s,S,R){if(!1!==S&&""!==S){var O=(R=o[R-1]||{isHeader:!0,plotX:o[0].plotX,plotY:j,series:{}}).isHeader,P=O?_:R.series;S=S.toString();var D=P.tt,N=R.isHeader,U=R.series,Y="highcharts-color-"+ee(R.colorIndex,U.colorIndex,"none");if(D||(D={padding:ne.padding,r:ne.borderRadius},ie||(D.fill=ne.backgroundColor,D["stroke-width"]=ne.borderWidth),D=oe.label("",0,0,ne[N?"headerShape":"shape"],void 0,void 0,ne.useHTML).addClass((N?"highcharts-tooltip-header ":"")+"highcharts-tooltip-box "+Y).attr(D).add(le)),D.isActive=!0,D.attr({text:S}),ie||D.css(ne.style).shadow(ne.shadow).attr({stroke:ne.borderColor||R.color||U.color||"#333333"}),S=(N=(P=P.tt=D).getBBox()).width+P.strokeWidth(),O&&(ue=N.height,pe+=ue,de&&(he-=ue)),U=void 0===(U=R.plotX)?0:U,Y=void 0===(Y=R.plotY)?0:Y,D=R.series,R.isHeader){U=K+U;var $=W+j/2}else{var X=D.xAxis,Z=D.yAxis;U=X.pos+V(U,-ae,X.len+ae),D.shouldShowTooltip(0,Z.pos-W+Y,{ignoreX:!0})&&($=Z.pos+Y)}U=V(U,se.left-ae,se.right+ae),"number"==typeof $?(N=N.height+1,Y=re?re.call(_,S,N,R):d(U,$,O,S),s.push({align:re?0:void 0,anchorX:U,anchorY:$,boxWidth:S,point:R,rank:ee(Y.rank,O?1:0),size:N,target:Y.y,tt:P,x:Y.x})):P.isActive=!1}return s}),[]),!re&&s.some((function(s){var o=(_.outside?ce:0)+s.anchorX;return o<se.left&&o+s.boxWidth<se.right||o<ce-se.left+s.boxWidth&&se.right-o>o}))&&(s=s.map((function(s){var o=d(s.anchorX,s.anchorY,s.point.isHeader,s.boxWidth,!1);return U(s,{target:o.y,x:o.x})}))),_.cleanSplit(),D(s,pe);var fe=ce,ge=ce;s.forEach((function(s){var o=s.x,S=s.boxWidth;(s=s.isHeader)||(_.outside&&ce+o<fe&&(fe=ce+o),!s&&_.outside&&fe+S>ge&&(ge=ce+o))})),s.forEach((function(s){var o=s.x,S=s.anchorX,R=s.pos,O=s.point.isHeader;if(R={visibility:void 0===R?"hidden":"inherit",x:o,y:R+he,anchorX:S,anchorY:s.anchorY},_.outside&&o<S){var P=ce-fe;0<P&&(O||(R.x=o+P,R.anchorX=S+P),O&&(R.x=(ge-fe)/2,R.anchorX=S+P))}s.tt.attr(R)})),s=_.container,$=_.renderer,_.outside&&s&&$&&(R=le.getBBox(),$.setSize(R.width+R.x,R.height+R.y,!1),s.style.left=fe+"px",s.style.top=S+"px")},a.prototype.drawTracker=function(){if(this.followPointer||!this.options.stickOnContact)this.tracker&&this.tracker.destroy();else{var s=this.chart,o=this.label,_=this.shared?s.hoverPoints:s.hoverPoint;if(o&&_){var S={x:0,y:0,width:0,height:0};_=this.getAnchor(_);var R=o.getBBox();_[0]+=s.plotLeft-o.translateX,_[1]+=s.plotTop-o.translateY,S.x=Math.min(0,_[0]),S.y=Math.min(0,_[1]),S.width=0>_[0]?Math.max(Math.abs(_[0]),R.width-_[0]):Math.max(Math.abs(_[0]),R.width),S.height=0>_[1]?Math.max(Math.abs(_[1]),R.height-Math.abs(_[1])):Math.max(Math.abs(_[1]),R.height),this.tracker?this.tracker.attr(S):(this.tracker=o.renderer.rect(S).addClass("highcharts-tracker").add(o),s.styledMode||this.tracker.attr({fill:"rgba(0,0,0,0)"}))}}},a.prototype.styledModeFormat=function(s){return s.replace('style="font-size: 10px"','class="highcharts-header"').replace(/style="color:{(point|series)\.color}"/g,'class="highcharts-color-{$1.colorIndex}"')},a.prototype.tooltipFooterHeaderFormatter=function(s,o){var _=s.series,S=_.tooltipOptions,R=_.xAxis,P=R&&R.dateTime;R={isFooter:o,labelConfig:s};var D=S.xDateFormat,N=S[o?"footerFormat":"headerFormat"];return Y(this,"headerFormatter",R,(function(o){P&&!D&&X(s.key)&&(D=P.getXDateFormat(s.key,S.dateTimeLabelFormats)),P&&D&&(s.point&&s.point.tooltipDateKeys||["key"]).forEach((function(s){N=N.replace("{point."+s+"}","{point."+s+":"+D+"}")})),_.chart.styledMode&&(N=this.styledModeFormat(N)),o.text=O(N,{point:s,series:_},this.chart)})),R.text},a.prototype.update=function(s){this.destroy(),Q(!0,this.chart.options.tooltip.userOptions,s),this.init(this.chart,Q(!0,this.options,s))},a.prototype.updatePosition=function(s){var o=this.chart,_=this.options,S=o.pointer,R=this.getLabel();S=S.getChartPosition();var O=(_.positioner||this.getPosition).call(this,R.width,R.height,s),P=s.plotX+o.plotLeft;s=s.plotY+o.plotTop,this.outside&&(_=_.borderWidth+2*this.distance,this.renderer.setSize(R.width+_,R.height+_,!1),1===S.scaleX&&1===S.scaleY||(j(this.container,{transform:"scale("+S.scaleX+", "+S.scaleY+")"}),P*=S.scaleX,s*=S.scaleY),P+=S.left-O.x,s+=S.top-O.y),this.move(Math.round(O.x),Math.round(O.y||0),P,s)},a}()})),M(o,"Core/Series/Point.js",[o["Core/Renderer/HTML/AST.js"],o["Core/Animation/AnimationUtilities.js"],o["Core/DefaultOptions.js"],o["Core/FormatUtilities.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R){var O=o.animObject,P=_.defaultOptions,D=S.format,N=R.addEvent,V=R.defined,j=R.erase,K=R.extend,W=R.fireEvent,U=R.getNestedProperty,Y=R.isArray,$=R.isFunction,X=R.isNumber,Z=R.isObject,Q=R.merge,ee=R.objectEach,te=R.pick,ie=R.syncTimeout,ae=R.removeEvent,ne=R.uniqueKey;return o=function(){function g(){this.colorIndex=this.category=void 0,this.formatPrefix="point",this.id=void 0,this.isNull=!1,this.percentage=this.options=this.name=void 0,this.selected=!1,this.total=this.series=void 0,this.visible=!0,this.x=void 0}return g.prototype.animateBeforeDestroy=function(){var s=this,o={x:s.startXPos,opacity:0},_=s.getGraphicalProps();_.singular.forEach((function(_){s[_]=s[_].animate("dataLabel"===_?{x:s[_].startXPos,y:s[_].startYPos,opacity:0}:o)})),_.plural.forEach((function(o){s[o].forEach((function(o){o.element&&o.animate(K({x:s.startXPos},o.startYPos?{x:o.startXPos,y:o.startYPos}:{}))}))}))},g.prototype.applyOptions=function(s,o){var _=this.series,S=_.options.pointValKey||_.pointValKey;return s=g.prototype.optionsToObject.call(this,s),K(this,s),this.options=this.options?K(this.options,s):s,s.group&&delete this.group,s.dataLabels&&delete this.dataLabels,S&&(this.y=g.prototype.getNestedProperty.call(this,S)),this.formatPrefix=(this.isNull=te(this.isValid&&!this.isValid(),null===this.x||!X(this.y)))?"null":"point",this.selected&&(this.state="select"),"name"in this&&void 0===o&&_.xAxis&&_.xAxis.hasNames&&(this.x=_.xAxis.nameToX(this)),void 0===this.x&&_?this.x=void 0===o?_.autoIncrement():o:X(s.x)&&_.options.relativeXValue&&(this.x=_.autoIncrement(s.x)),this},g.prototype.destroy=function(){function b(){for(S in(s.graphic||s.dataLabel||s.dataLabels)&&(ae(s),s.destroyElements()),s)s[S]=null}var s=this,o=s.series,_=o.chart;o=o.options.dataSorting;var S,R=_.hoverPoints,P=O(s.series.chart.renderer.globalAnimation);s.legendItem&&_.legend.destroyItem(s),R&&(s.setState(),j(R,s),R.length||(_.hoverPoints=null)),s===_.hoverPoint&&s.onMouseOut(),o&&o.enabled?(this.animateBeforeDestroy(),ie(b,P.duration)):b(),_.pointCount--},g.prototype.destroyElements=function(s){var o=this;(s=o.getGraphicalProps(s)).singular.forEach((function(s){o[s]=o[s].destroy()})),s.plural.forEach((function(s){o[s].forEach((function(s){s.element&&s.destroy()})),delete o[s]}))},g.prototype.firePointEvent=function(s,o,_){var S=this,R=this.series.options;(R.point.events[s]||S.options&&S.options.events&&S.options.events[s])&&S.importEvents(),"click"===s&&R.allowPointSelect&&(_=function(s){S.select&&S.select(null,s.ctrlKey||s.metaKey||s.shiftKey)}),W(S,s,o,_)},g.prototype.getClassName=function(){return"highcharts-point"+(this.selected?" highcharts-point-select":"")+(this.negative?" highcharts-negative":"")+(this.isNull?" highcharts-null-point":"")+(void 0!==this.colorIndex?" highcharts-color-"+this.colorIndex:"")+(this.options.className?" "+this.options.className:"")+(this.zone&&this.zone.className?" "+this.zone.className.replace("highcharts-negative",""):"")},g.prototype.getGraphicalProps=function(s){var o,_=this,S=[],R={singular:[],plural:[]};for((s=s||{graphic:1,dataLabel:1}).graphic&&S.push("graphic","upperGraphic","shadowGroup"),s.dataLabel&&S.push("dataLabel","dataLabelUpper","connector"),o=S.length;o--;){var O=S[o];_[O]&&R.singular.push(O)}return["dataLabel","connector"].forEach((function(o){var S=o+"s";s[o]&&_[S]&&R.plural.push(S)})),R},g.prototype.getLabelConfig=function(){return{x:this.category,y:this.y,color:this.color,colorIndex:this.colorIndex,key:this.name||this.category,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},g.prototype.getNestedProperty=function(s){if(s)return 0===s.indexOf("custom.")?U(s,this.options):this[s]},g.prototype.getZone=function(){var s=this.series,o=s.zones;s=s.zoneAxis||"y";var _,S=0;for(_=o[S];this[s]>=_.value;)_=o[++S];return this.nonZonedColor||(this.nonZonedColor=this.color),this.color=_&&_.color&&!this.options.color?_.color:this.nonZonedColor,_},g.prototype.hasNewShapeType=function(){return(this.graphic&&(this.graphic.symbolName||this.graphic.element.nodeName))!==this.shapeType},g.prototype.init=function(s,o,_){return this.series=s,this.applyOptions(o,_),this.id=V(this.id)?this.id:ne(),this.resolveColor(),s.chart.pointCount++,W(this,"afterInit"),this},g.prototype.optionsToObject=function(s){var o=this.series,_=o.options.keys,S=_||o.pointArrayMap||["y"],R=S.length,O={},P=0,D=0;if(X(s)||null===s)O[S[0]]=s;else if(Y(s))for(!_&&s.length>R&&("string"===(o=typeof s[0])?O.name=s[0]:"number"===o&&(O.x=s[0]),P++);D<R;)_&&void 0===s[P]||(0<S[D].indexOf(".")?g.prototype.setNestedProperty(O,s[P],S[D]):O[S[D]]=s[P]),P++,D++;else"object"==typeof s&&(O=s,s.dataLabels&&(o._hasPointLabels=!0),s.marker&&(o._hasPointMarkers=!0));return O},g.prototype.resolveColor=function(){var s=this.series,o=s.chart.styledMode,_=s.chart.options.chart.colorCount;if(delete this.nonZonedColor,s.options.colorByPoint){if(!o){var S=(_=s.options.colors||s.chart.options.colors)[s.colorCounter];_=_.length}o=s.colorCounter,s.colorCounter++,s.colorCounter===_&&(s.colorCounter=0)}else o||(S=s.color),o=s.colorIndex;this.colorIndex=te(this.options.colorIndex,o),this.color=te(this.options.color,S)},g.prototype.setNestedProperty=function(s,o,_){return _.split(".").reduce((function(s,_,S,R){return s[_]=R.length-1===S?o:Z(s[_],!0)?s[_]:{},s[_]}),s),s},g.prototype.tooltipFormatter=function(s){var o=this.series,_=o.tooltipOptions,S=te(_.valueDecimals,""),R=_.valuePrefix||"",O=_.valueSuffix||"";return o.chart.styledMode&&(s=o.chart.tooltip.styledModeFormat(s)),(o.pointArrayMap||["y"]).forEach((function(o){o="{point."+o,(R||O)&&(s=s.replace(RegExp(o+"}","g"),R+o+"}"+O)),s=s.replace(RegExp(o+"}","g"),o+":,."+S+"f}")})),D(s,{point:this,series:this.series},o.chart)},g.prototype.update=function(s,o,_,S){function d(){O.applyOptions(s);var S=D&&O.hasDummyGraphic;S=null===O.y?!S:S,D&&S&&(O.graphic=D.destroy(),delete O.hasDummyGraphic),Z(s,!0)&&(D&&D.element&&s&&s.marker&&void 0!==s.marker.symbol&&(O.graphic=D.destroy()),s&&s.dataLabels&&O.dataLabel&&(O.dataLabel=O.dataLabel.destroy()),O.connector&&(O.connector=O.connector.destroy())),R=O.index,P.updateParallelArrays(O,R),V.data[R]=Z(V.data[R],!0)||Z(s,!0)?O.options:te(s,V.data[R]),P.isDirty=P.isDirtyData=!0,!P.fixedBox&&P.hasCartesianSeries&&(N.isDirtyBox=!0),"point"===V.legendType&&(N.isDirtyLegend=!0),o&&N.redraw(_)}var R,O=this,P=O.series,D=O.graphic,N=P.chart,V=P.options;o=te(o,!0),!1===S?d():O.firePointEvent("update",{options:s},d)},g.prototype.remove=function(s,o){this.series.removePoint(this.series.data.indexOf(this),s,o)},g.prototype.select=function(s,o){var _=this,S=_.series,R=S.chart;this.selectedStaging=s=te(s,!_.selected),_.firePointEvent(s?"select":"unselect",{accumulate:o},(function(){_.selected=_.options.selected=s,S.options.data[S.data.indexOf(_)]=_.options,_.setState(s&&"select"),o||R.getSelectedPoints().forEach((function(s){var o=s.series;s.selected&&s!==_&&(s.selected=s.options.selected=!1,o.options.data[o.data.indexOf(s)]=s.options,s.setState(R.hoverPoints&&o.options.inactiveOtherPoints?"inactive":""),s.firePointEvent("unselect"))}))})),delete this.selectedStaging},g.prototype.onMouseOver=function(s){var o=this.series.chart,_=o.pointer;s=s?_.normalize(s):_.getChartCoordinatesFromPoint(this,o.inverted),_.runPointActions(s,this)},g.prototype.onMouseOut=function(){var s=this.series.chart;this.firePointEvent("mouseOut"),this.series.options.inactiveOtherPoints||(s.hoverPoints||[]).forEach((function(s){s.setState()})),s.hoverPoints=s.hoverPoint=null},g.prototype.importEvents=function(){if(!this.hasImportedEvents){var s=this,o=Q(s.series.options.point,s.options).events;s.events=o,ee(o,(function(o,_){$(o)&&N(s,_,o)})),this.hasImportedEvents=!0}},g.prototype.setState=function(o,_){var S,R=this.series,O=this.state,D=R.options.states[o||"normal"]||{},N=P.plotOptions[R.type].marker&&R.options.marker,V=N&&!1===N.enabled,j=N&&N.states&&N.states[o||"normal"]||{},U=!1===j.enabled,Y=this.marker||{},$=R.chart,Z=N&&R.markerAttribs,Q=R.halo,ee=R.stateMarkerGraphic;if(!((o=o||"")===this.state&&!_||this.selected&&"select"!==o||!1===D.enabled||o&&(U||V&&!1===j.enabled)||o&&Y.states&&Y.states[o]&&!1===Y.states[o].enabled)){if(this.state=o,Z&&(S=R.markerAttribs(this,o)),this.graphic&&!this.hasDummyGraphic){if(O&&this.graphic.removeClass("highcharts-point-"+O),o&&this.graphic.addClass("highcharts-point-"+o),!$.styledMode){var ie=R.pointAttribs(this,o),ae=te($.options.chart.animation,D.animation);R.options.inactiveOtherPoints&&X(ie.opacity)&&((this.dataLabels||[]).forEach((function(s){s&&s.animate({opacity:ie.opacity},ae)})),this.connector&&this.connector.animate({opacity:ie.opacity},ae)),this.graphic.animate(ie,ae)}S&&this.graphic.animate(S,te($.options.chart.animation,j.animation,N.animation)),ee&&ee.hide()}else o&&j&&(O=Y.symbol||R.symbol,ee&&ee.currentSymbol!==O&&(ee=ee.destroy()),S&&(ee?ee[_?"animate":"attr"]({x:S.x,y:S.y}):O&&(R.stateMarkerGraphic=ee=$.renderer.symbol(O,S.x,S.y,S.width,S.height).add(R.markerGroup),ee.currentSymbol=O)),!$.styledMode&&ee&&"inactive"!==this.state&&ee.attr(R.pointAttribs(this,o))),ee&&(ee[o&&this.isInside?"show":"hide"](),ee.element.point=this,ee.addClass(this.getClassName(),!0));D=D.halo,S=(ee=this.graphic||ee)&&ee.visibility||"inherit",D&&D.size&&ee&&"hidden"!==S&&!this.isCluster?(Q||(R.halo=Q=$.renderer.path().add(ee.parentGroup)),Q.show()[_?"animate":"attr"]({d:this.haloPath(D.size)}),Q.attr({class:"highcharts-halo highcharts-color-"+te(this.colorIndex,R.colorIndex)+(this.className?" "+this.className:""),visibility:S,zIndex:-1}),Q.point=this,$.styledMode||Q.attr(K({fill:this.color||R.color,"fill-opacity":D.opacity},s.filterUserAttributes(D.attributes||{})))):Q&&Q.point&&Q.point.haloPath&&Q.animate({d:Q.point.haloPath(0)},null,Q.hide),W(this,"afterSetState",{state:o})}},g.prototype.haloPath=function(s){return this.series.chart.renderer.symbols.circle(Math.floor(this.plotX)-s,this.plotY-s,2*s,2*s)},g}()})),M(o,"Core/Pointer.js",[o["Core/Color/Color.js"],o["Core/Globals.js"],o["Core/Tooltip.js"],o["Core/Utilities.js"]],(function(s,o,_,S){var R=s.parse,O=o.charts,P=o.noop,D=S.addEvent,N=S.attr,V=S.css,j=S.defined,K=S.extend,W=S.find,U=S.fireEvent,Y=S.isNumber,$=S.isObject,X=S.objectEach,Z=S.offset,Q=S.pick,ee=S.splat;return s=function(){function a(s,o){this.lastValidTouch={},this.pinchDown=[],this.runChartClick=!1,this.eventsToUnbind=[],this.chart=s,this.hasDragged=!1,this.options=o,this.init(s,o)}return a.prototype.applyInactiveState=function(s){var o,_=[];(s||[]).forEach((function(s){o=s.series,_.push(o),o.linkedParent&&_.push(o.linkedParent),o.linkedSeries&&(_=_.concat(o.linkedSeries)),o.navigatorSeries&&_.push(o.navigatorSeries)})),this.chart.series.forEach((function(s){-1===_.indexOf(s)?s.setState("inactive",!0):s.options.inactiveOtherPoints&&s.setAllPointsToState("inactive")}))},a.prototype.destroy=function(){var s=this;this.eventsToUnbind.forEach((function(s){return s()})),this.eventsToUnbind=[],o.chartCount||(a.unbindDocumentMouseUp&&(a.unbindDocumentMouseUp=a.unbindDocumentMouseUp()),a.unbindDocumentTouchEnd&&(a.unbindDocumentTouchEnd=a.unbindDocumentTouchEnd())),clearInterval(s.tooltipTimeout),X(s,(function(o,_){s[_]=void 0}))},a.prototype.drag=function(s){var o=this.chart,_=o.options.chart,S=this.zoomHor,O=this.zoomVert,P=o.plotLeft,D=o.plotTop,N=o.plotWidth,V=o.plotHeight,j=this.mouseDownX||0,K=this.mouseDownY||0,W=$(_.panning)?_.panning&&_.panning.enabled:_.panning,U=_.panKey&&s[_.panKey+"Key"],Y=s.chartX,X=s.chartY,Z=this.selectionMarker;if((!Z||!Z.touch)&&(Y<P?Y=P:Y>P+N&&(Y=P+N),X<D?X=D:X>D+V&&(X=D+V),this.hasDragged=Math.sqrt(Math.pow(j-Y,2)+Math.pow(K-X,2)),10<this.hasDragged)){var Q=o.isInsidePlot(j-P,K-D,{visiblePlotOnly:!0});!o.hasCartesianSeries&&!o.mapView||!this.zoomX&&!this.zoomY||!Q||U||Z||(this.selectionMarker=Z=o.renderer.rect(P,D,S?1:N,O?1:V,0).attr({class:"highcharts-selection-marker",zIndex:7}).add(),o.styledMode||Z.attr({fill:_.selectionMarkerFill||R("#335cad").setOpacity(.25).get()})),Z&&S&&(S=Y-j,Z.attr({width:Math.abs(S),x:(0<S?0:S)+j})),Z&&O&&(S=X-K,Z.attr({height:Math.abs(S),y:(0<S?0:S)+K})),Q&&!Z&&W&&o.pan(s,_.panning)}},a.prototype.dragStart=function(s){var o=this.chart;o.mouseIsDown=s.type,o.cancelClick=!1,o.mouseDownX=this.mouseDownX=s.chartX,o.mouseDownY=this.mouseDownY=s.chartY},a.prototype.drop=function(s){var o=this,_=this.chart,S=this.hasPinched;if(this.selectionMarker){var R=this.selectionMarker,O=R.attr?R.attr("x"):R.x,P=R.attr?R.attr("y"):R.y,D=R.attr?R.attr("width"):R.width,N=R.attr?R.attr("height"):R.height,W={originalEvent:s,xAxis:[],yAxis:[],x:O,y:P,width:D,height:N},$=!!_.mapView;(this.hasDragged||S)&&(_.axes.forEach((function(_){if(_.zoomEnabled&&j(_.min)&&(S||o[{xAxis:"zoomX",yAxis:"zoomY"}[_.coll]])&&Y(O)&&Y(P)){var R=_.horiz,V="touchend"===s.type?_.minPixelPadding:0,K=_.toValue((R?O:P)+V);R=_.toValue((R?O+D:P+N)-V),W[_.coll].push({axis:_,min:Math.min(K,R),max:Math.max(K,R)}),$=!0}})),$&&U(_,"selection",W,(function(s){_.zoom(K(s,S?{animation:!1}:null))}))),Y(_.index)&&(this.selectionMarker=this.selectionMarker.destroy()),S&&this.scaleGroups()}_&&Y(_.index)&&(V(_.container,{cursor:_._cursor}),_.cancelClick=10<this.hasDragged,_.mouseIsDown=this.hasDragged=this.hasPinched=!1,this.pinchDown=[])},a.prototype.findNearestKDPoint=function(s,o,_){var S,R=this.chart,O=R.hoverPoint;return R=R.tooltip,O&&R&&R.isStickyOnContact()?O:(s.forEach((function(s){var R=!(s.noSharedTooltip&&o)&&0>s.options.findNearestPointBy.indexOf("y");if(s=s.searchPoint(_,R),(R=$(s,!0)&&s.series)&&!(R=!$(S,!0))){R=S.distX-s.distX;var O=S.dist-s.dist,P=(s.series.group&&s.series.group.zIndex)-(S.series.group&&S.series.group.zIndex);R=0<(0!==R&&o?R:0!==O?O:0!==P?P:S.series.index>s.series.index?-1:1)}R&&(S=s)})),S)},a.prototype.getChartCoordinatesFromPoint=function(s,o){var _=s.series,S=_.xAxis;_=_.yAxis;var R=s.shapeArgs;if(S&&_){var O=Q(s.clientX,s.plotX),P=s.plotY||0;return s.isNode&&R&&Y(R.x)&&Y(R.y)&&(O=R.x,P=R.y),o?{chartX:_.len+_.pos-P,chartY:S.len+S.pos-O}:{chartX:O+S.pos,chartY:P+_.pos}}if(R&&R.x&&R.y)return{chartX:R.x,chartY:R.y}},a.prototype.getChartPosition=function(){if(this.chartPosition)return this.chartPosition;var s=this.chart.container,o=Z(s);this.chartPosition={left:o.left,top:o.top,scaleX:1,scaleY:1};var _=s.offsetWidth;return s=s.offsetHeight,2<_&&2<s&&(this.chartPosition.scaleX=o.width/_,this.chartPosition.scaleY=o.height/s),this.chartPosition},a.prototype.getCoordinates=function(s){var o={xAxis:[],yAxis:[]};return this.chart.axes.forEach((function(_){o[_.isXAxis?"xAxis":"yAxis"].push({axis:_,value:_.toValue(s[_.horiz?"chartX":"chartY"])})})),o},a.prototype.getHoverData=function(s,o,_,S,R,O){var P=[];S=!(!S||!s);var D={chartX:O?O.chartX:void 0,chartY:O?O.chartY:void 0,shared:R};U(this,"beforeGetHoverData",D);var N=o&&!o.stickyTracking?[o]:_.filter((function(s){return D.filter?D.filter(s):s.visible&&!(!R&&s.directTouch)&&Q(s.options.enableMouseTracking,!0)&&s.stickyTracking})),V=S||!O?s:this.findNearestKDPoint(N,R,O);return o=V&&V.series,V&&(R&&!o.noSharedTooltip?(N=_.filter((function(s){return D.filter?D.filter(s):s.visible&&!(!R&&s.directTouch)&&Q(s.options.enableMouseTracking,!0)&&!s.noSharedTooltip}))).forEach((function(s){var o=W(s.points,(function(s){return s.x===V.x&&!s.isNull}));$(o)&&(s.chart.isBoosting&&(o=s.getPoint(o)),P.push(o))})):P.push(V)),U(this,"afterGetHoverData",D={hoverPoint:V}),{hoverPoint:D.hoverPoint,hoverSeries:o,hoverPoints:P}},a.prototype.getPointFromEvent=function(s){s=s.target;for(var o;s&&!o;)o=s.point,s=s.parentNode;return o},a.prototype.onTrackerMouseOut=function(s){s=s.relatedTarget||s.toElement;var o=this.chart.hoverSeries;this.isDirectTouch=!1,!o||!s||o.stickyTracking||this.inClass(s,"highcharts-tooltip")||this.inClass(s,"highcharts-series-"+o.index)&&this.inClass(s,"highcharts-tracker")||o.onMouseOut()},a.prototype.inClass=function(s,o){for(var _;s;){if(_=N(s,"class")){if(-1!==_.indexOf(o))return!0;if(-1!==_.indexOf("highcharts-container"))return!1}s=s.parentNode}},a.prototype.init=function(s,o){this.options=o,this.chart=s,this.runChartClick=!(!o.chart.events||!o.chart.events.click),this.pinchDown=[],this.lastValidTouch={},_&&(s.tooltip=new _(s,o.tooltip),this.followTouchMove=Q(o.tooltip.followTouchMove,!0)),this.setDOMEvents()},a.prototype.normalize=function(s,o){var _=s.touches,S=_?_.length?_.item(0):Q(_.changedTouches,s.changedTouches)[0]:s;return o||(o=this.getChartPosition()),_=S.pageX-o.left,S=S.pageY-o.top,_/=o.scaleX,S/=o.scaleY,K(s,{chartX:Math.round(_),chartY:Math.round(S)})},a.prototype.onContainerClick=function(s){var o=this.chart,_=o.hoverPoint;s=this.normalize(s);var S=o.plotLeft,R=o.plotTop;o.cancelClick||(_&&this.inClass(s.target,"highcharts-tracker")?(U(_.series,"click",K(s,{point:_})),o.hoverPoint&&_.firePointEvent("click",s)):(K(s,this.getCoordinates(s)),o.isInsidePlot(s.chartX-S,s.chartY-R,{visiblePlotOnly:!0})&&U(o,"click",s)))},a.prototype.onContainerMouseDown=function(s){var _=1==(1&(s.buttons||s.button));s=this.normalize(s),o.isFirefox&&0!==s.button&&this.onContainerMouseMove(s),(void 0===s.button||_)&&(this.zoomOption(s),_&&s.preventDefault&&s.preventDefault(),this.dragStart(s))},a.prototype.onContainerMouseLeave=function(s){var o=O[Q(a.hoverChartIndex,-1)],_=this.chart.tooltip;_&&_.shouldStickOnContact()&&this.inClass(s.relatedTarget,"highcharts-tooltip-container")||(s=this.normalize(s),o&&(s.relatedTarget||s.toElement)&&(o.pointer.reset(),o.pointer.chartPosition=void 0),_&&!_.isHidden&&this.reset())},a.prototype.onContainerMouseEnter=function(s){delete this.chartPosition},a.prototype.onContainerMouseMove=function(s){var o=this.chart;s=this.normalize(s),this.setHoverChartIndex(),s.preventDefault||(s.returnValue=!1),("mousedown"===o.mouseIsDown||this.touchSelect(s))&&this.drag(s),o.openMenu||!this.inClass(s.target,"highcharts-tracker")&&!o.isInsidePlot(s.chartX-o.plotLeft,s.chartY-o.plotTop,{visiblePlotOnly:!0})||(this.inClass(s.target,"highcharts-no-tooltip")?this.reset(!1,0):this.runPointActions(s))},a.prototype.onDocumentTouchEnd=function(s){var o=O[Q(a.hoverChartIndex,-1)];o&&o.pointer.drop(s)},a.prototype.onContainerTouchMove=function(s){this.touchSelect(s)?this.onContainerMouseMove(s):this.touch(s)},a.prototype.onContainerTouchStart=function(s){this.touchSelect(s)?this.onContainerMouseDown(s):(this.zoomOption(s),this.touch(s,!0))},a.prototype.onDocumentMouseMove=function(s){var o=this.chart,_=this.chartPosition;s=this.normalize(s,_);var S=o.tooltip;!_||S&&S.isStickyOnContact()||o.isInsidePlot(s.chartX-o.plotLeft,s.chartY-o.plotTop,{visiblePlotOnly:!0})||this.inClass(s.target,"highcharts-tracker")||this.reset()},a.prototype.onDocumentMouseUp=function(s){var o=O[Q(a.hoverChartIndex,-1)];o&&o.pointer.drop(s)},a.prototype.pinch=function(s){var o=this,_=o.chart,S=o.pinchDown,R=s.touches||[],O=R.length,D=o.lastValidTouch,N=o.hasZoom,V={},j=1===O&&(o.inClass(s.target,"highcharts-tracker")&&_.runTrackerClick||o.runChartClick),W={},Y=o.selectionMarker;1<O?o.initiated=!0:1===O&&this.followTouchMove&&(o.initiated=!1),N&&o.initiated&&!j&&!1!==s.cancelable&&s.preventDefault(),[].map.call(R,(function(s){return o.normalize(s)})),"touchstart"===s.type?([].forEach.call(R,(function(s,o){S[o]={chartX:s.chartX,chartY:s.chartY}})),D.x=[S[0].chartX,S[1]&&S[1].chartX],D.y=[S[0].chartY,S[1]&&S[1].chartY],_.axes.forEach((function(s){if(s.zoomEnabled){var o=_.bounds[s.horiz?"h":"v"],S=s.minPixelPadding,R=s.toPixels(Math.min(Q(s.options.min,s.dataMin),s.dataMin)),O=s.toPixels(Math.max(Q(s.options.max,s.dataMax),s.dataMax)),P=Math.max(R,O);o.min=Math.min(s.pos,Math.min(R,O)-S),o.max=Math.max(s.pos+s.len,P+S)}})),o.res=!0):o.followTouchMove&&1===O?this.runPointActions(o.normalize(s)):S.length&&(U(_,"touchpan",{originalEvent:s},(function(){Y||(o.selectionMarker=Y=K({destroy:P,touch:!0},_.plotBox)),o.pinchTranslate(S,R,V,Y,W,D),o.hasPinched=N,o.scaleGroups(V,W)})),o.res&&(o.res=!1,this.reset(!1,0)))},a.prototype.pinchTranslate=function(s,o,_,S,R,O){this.zoomHor&&this.pinchTranslateDirection(!0,s,o,_,S,R,O),this.zoomVert&&this.pinchTranslateDirection(!1,s,o,_,S,R,O)},a.prototype.pinchTranslateDirection=function(s,o,_,S,R,O,P,D){var N=this.chart,V=s?"x":"y",j=s?"X":"Y",K="chart"+j,W=s?"width":"height",U=N["plot"+(s?"Left":"Top")],Y=N.inverted,$=N.bounds[s?"h":"v"],X=1===o.length,Z=o[0][K],Q=!X&&o[1][K];o=function(){"number"==typeof ne&&20<Math.abs(Z-Q)&&(ie=D||Math.abs(ae-ne)/Math.abs(Z-Q)),te=(U-ae)/ie+Z,ee=N["plot"+(s?"Width":"Height")]/ie};var ee,te,ie=D||1,ae=_[0][K],ne=!X&&_[1][K];if(o(),(_=te)<$.min){_=$.min;var re=!0}else _+ee>$.max&&(_=$.max-ee,re=!0);re?(ae-=.8*(ae-P[V][0]),"number"==typeof ne&&(ne-=.8*(ne-P[V][1])),o()):P[V]=[ae,ne],Y||(O[V]=te-U,O[W]=ee),O=Y?1/ie:ie,R[W]=ee,R[V]=_,S[Y?s?"scaleY":"scaleX":"scale"+j]=ie,S["translate"+j]=O*U+(ae-O*Z)},a.prototype.reset=function(s,o){var _=this.chart,S=_.hoverSeries,R=_.hoverPoint,O=_.hoverPoints,P=_.tooltip,D=P&&P.shared?O:R;s&&D&&ee(D).forEach((function(o){o.series.isCartesian&&void 0===o.plotX&&(s=!1)})),s?P&&D&&ee(D).length&&(P.refresh(D),P.shared&&O?O.forEach((function(s){s.setState(s.state,!0),s.series.isCartesian&&(s.series.xAxis.crosshair&&s.series.xAxis.drawCrosshair(null,s),s.series.yAxis.crosshair&&s.series.yAxis.drawCrosshair(null,s))})):R&&(R.setState(R.state,!0),_.axes.forEach((function(s){s.crosshair&&R.series[s.coll]===s&&s.drawCrosshair(null,R)})))):(R&&R.onMouseOut(),O&&O.forEach((function(s){s.setState()})),S&&S.onMouseOut(),P&&P.hide(o),this.unDocMouseMove&&(this.unDocMouseMove=this.unDocMouseMove()),_.axes.forEach((function(s){s.hideCrosshair()})),this.hoverX=_.hoverPoints=_.hoverPoint=null)},a.prototype.runPointActions=function(s,o){var _=this.chart,S=_.tooltip&&_.tooltip.options.enabled?_.tooltip:void 0,R=!!S&&S.shared,P=o||_.hoverPoint,N=P&&P.series||_.hoverSeries;P=(o=this.getHoverData(P,N,_.series,(!s||"touchmove"!==s.type)&&(!!o||N&&N.directTouch&&this.isDirectTouch),R,s)).hoverPoint,N=o.hoverSeries;var V=o.hoverPoints;if(o=N&&N.tooltipOptions.followPointer&&!N.tooltipOptions.split,R=R&&N&&!N.noSharedTooltip,P&&(P!==_.hoverPoint||S&&S.isHidden)){if((_.hoverPoints||[]).forEach((function(s){-1===V.indexOf(s)&&s.setState()})),_.hoverSeries!==N&&N.onMouseOver(),this.applyInactiveState(V),(V||[]).forEach((function(s){s.setState("hover")})),_.hoverPoint&&_.hoverPoint.firePointEvent("mouseOut"),!P.series)return;_.hoverPoints=V,_.hoverPoint=P,P.firePointEvent("mouseOver"),S&&S.refresh(R?V:P,s)}else o&&S&&!S.isHidden&&(P=S.getAnchor([{}],s),_.isInsidePlot(P[0],P[1],{visiblePlotOnly:!0})&&S.updatePosition({plotX:P[0],plotY:P[1]}));this.unDocMouseMove||(this.unDocMouseMove=D(_.container.ownerDocument,"mousemove",(function(s){var o=O[a.hoverChartIndex];o&&o.pointer.onDocumentMouseMove(s)})),this.eventsToUnbind.push(this.unDocMouseMove)),_.axes.forEach((function(o){var S,R=Q((o.crosshair||{}).snap,!0);R&&((S=_.hoverPoint)&&S.series[o.coll]===o||(S=W(V,(function(s){return s.series[o.coll]===o})))),S||!R?o.drawCrosshair(s,S):o.hideCrosshair()}))},a.prototype.scaleGroups=function(s,o){var _=this.chart;_.series.forEach((function(S){var R=s||S.getPlotBox();S.group&&(S.xAxis&&S.xAxis.zoomEnabled||_.mapView)&&(S.group.attr(R),S.markerGroup&&(S.markerGroup.attr(R),S.markerGroup.clip(o?_.clipRect:null)),S.dataLabelsGroup&&S.dataLabelsGroup.attr(R))})),_.clipRect.attr(o||_.clipBox)},a.prototype.setDOMEvents=function(){var s=this,_=this.chart.container,S=_.ownerDocument;_.onmousedown=this.onContainerMouseDown.bind(this),_.onmousemove=this.onContainerMouseMove.bind(this),_.onclick=this.onContainerClick.bind(this),this.eventsToUnbind.push(D(_,"mouseenter",this.onContainerMouseEnter.bind(this))),this.eventsToUnbind.push(D(_,"mouseleave",this.onContainerMouseLeave.bind(this))),a.unbindDocumentMouseUp||(a.unbindDocumentMouseUp=D(S,"mouseup",this.onDocumentMouseUp.bind(this)));for(var R=this.chart.renderTo.parentElement;R&&"BODY"!==R.tagName;)this.eventsToUnbind.push(D(R,"scroll",(function(){delete s.chartPosition}))),R=R.parentElement;o.hasTouch&&(this.eventsToUnbind.push(D(_,"touchstart",this.onContainerTouchStart.bind(this),{passive:!1})),this.eventsToUnbind.push(D(_,"touchmove",this.onContainerTouchMove.bind(this),{passive:!1})),a.unbindDocumentTouchEnd||(a.unbindDocumentTouchEnd=D(S,"touchend",this.onDocumentTouchEnd.bind(this),{passive:!1})))},a.prototype.setHoverChartIndex=function(){var s=this.chart,_=o.charts[Q(a.hoverChartIndex,-1)];_&&_!==s&&_.pointer.onContainerMouseLeave({relatedTarget:!0}),_&&_.mouseIsDown||(a.hoverChartIndex=s.index)},a.prototype.touch=function(s,o){var _=this.chart;if(this.setHoverChartIndex(),1===s.touches.length)if(s=this.normalize(s),_.isInsidePlot(s.chartX-_.plotLeft,s.chartY-_.plotTop,{visiblePlotOnly:!0})&&!_.openMenu){if(o&&this.runPointActions(s),"touchmove"===s.type)var S=!!(o=this.pinchDown)[0]&&4<=Math.sqrt(Math.pow(o[0].chartX-s.chartX,2)+Math.pow(o[0].chartY-s.chartY,2));Q(S,!0)&&this.pinch(s)}else o&&this.reset();else 2===s.touches.length&&this.pinch(s)},a.prototype.touchSelect=function(s){return!(!this.chart.options.chart.zoomBySingleTouch||!s.touches||1!==s.touches.length)},a.prototype.zoomOption=function(s){var o=this.chart,_=o.options.chart;o=o.inverted;var S=_.zoomType||"";/touch/.test(s.type)&&(S=Q(_.pinchType,S)),this.zoomX=s=/x/.test(S),this.zoomY=_=/y/.test(S),this.zoomHor=s&&!o||_&&o,this.zoomVert=_&&!o||s&&o,this.hasZoom=s||_},a}()})),M(o,"Core/MSPointer.js",[o["Core/Globals.js"],o["Core/Pointer.js"],o["Core/Utilities.js"]],(function(s,o,_){function v(){var s=[];return s.item=function(s){return this[s]},j(W,(function(o){s.push({pageX:o.pageX,pageY:o.pageY,target:o.target})})),s}function y(s,_,S,O){var D=R[o.hoverChartIndex||NaN];"touch"!==s.pointerType&&s.pointerType!==s.MSPOINTER_TYPE_TOUCH||!D||(D=D.pointer,O(s),D[_]({type:S,target:s.currentTarget,preventDefault:P,touches:v()}))}var S=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function f(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(f.prototype=o.prototype,new f)}}(),R=s.charts,O=s.doc,P=s.noop,D=s.win,N=_.addEvent,V=_.css,j=_.objectEach,K=_.removeEvent,W={},U=!!D.PointerEvent;return function(o){function p(){return null!==o&&o.apply(this,arguments)||this}return S(p,o),p.isRequired=function(){return!(s.hasTouch||!D.PointerEvent&&!D.MSPointerEvent)},p.prototype.batchMSEvents=function(s){s(this.chart.container,U?"pointerdown":"MSPointerDown",this.onContainerPointerDown),s(this.chart.container,U?"pointermove":"MSPointerMove",this.onContainerPointerMove),s(O,U?"pointerup":"MSPointerUp",this.onDocumentPointerUp)},p.prototype.destroy=function(){this.batchMSEvents(K),o.prototype.destroy.call(this)},p.prototype.init=function(s,_){o.prototype.init.call(this,s,_),this.hasZoom&&V(s.container,{"-ms-touch-action":"none","touch-action":"none"})},p.prototype.onContainerPointerDown=function(s){y(s,"onContainerTouchStart","touchstart",(function(s){W[s.pointerId]={pageX:s.pageX,pageY:s.pageY,target:s.currentTarget}}))},p.prototype.onContainerPointerMove=function(s){y(s,"onContainerTouchMove","touchmove",(function(s){W[s.pointerId]={pageX:s.pageX,pageY:s.pageY},W[s.pointerId].target||(W[s.pointerId].target=s.currentTarget)}))},p.prototype.onDocumentPointerUp=function(s){y(s,"onDocumentTouchEnd","touchend",(function(s){delete W[s.pointerId]}))},p.prototype.setDOMEvents=function(){o.prototype.setDOMEvents.call(this),(this.hasZoom||this.followTouchMove)&&this.batchMSEvents(N)},p}(o)})),M(o,"Core/Legend/Legend.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/FormatUtilities.js"],o["Core/Globals.js"],o["Core/Series/Point.js"],o["Core/Renderer/RendererUtilities.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O){var P=s.animObject,D=s.setAnimation,N=o.format;s=_.isFirefox;var V=_.marginNames;_=_.win;var j=R.distribute,K=O.addEvent,W=O.createElement,U=O.css,Y=O.defined,$=O.discardElement,X=O.find,Z=O.fireEvent,Q=O.isNumber,ee=O.merge,te=O.pick,ie=O.relativeLength,ae=O.stableSort,ne=O.syncTimeout;return R=O.wrap,O=function(){function a(s,o){this.allItems=[],this.contentGroup=this.box=void 0,this.display=!1,this.group=void 0,this.offsetWidth=this.maxLegendWidth=this.maxItemWidth=this.legendWidth=this.legendHeight=this.lastLineHeight=this.lastItemY=this.itemY=this.itemX=this.itemMarginTop=this.itemMarginBottom=this.itemHeight=this.initialItemY=0,this.options={},this.padding=0,this.pages=[],this.proximate=!1,this.scrollGroup=void 0,this.widthOption=this.totalItemWidth=this.titleHeight=this.symbolWidth=this.symbolHeight=0,this.chart=s,this.init(s,o)}return a.prototype.init=function(s,o){this.chart=s,this.setOptions(o),o.enabled&&(this.render(),K(this.chart,"endResize",(function(){this.legend.positionCheckboxes()})),this.proximate?this.unchartrender=K(this.chart,"render",(function(){this.legend.proximatePositions(),this.legend.positionItems()})):this.unchartrender&&this.unchartrender())},a.prototype.setOptions=function(s){var o=te(s.padding,8);this.options=s,this.chart.styledMode||(this.itemStyle=s.itemStyle,this.itemHiddenStyle=ee(this.itemStyle,s.itemHiddenStyle)),this.itemMarginTop=s.itemMarginTop||0,this.itemMarginBottom=s.itemMarginBottom||0,this.padding=o,this.initialItemY=o-5,this.symbolWidth=te(s.symbolWidth,16),this.pages=[],this.proximate="proximate"===s.layout&&!this.chart.inverted,this.baseline=void 0},a.prototype.update=function(s,o){var _=this.chart;this.setOptions(ee(!0,this.options,s)),this.destroy(),_.isDirtyLegend=_.isDirtyBox=!0,te(o,!0)&&_.redraw(),Z(this,"afterUpdate")},a.prototype.colorizeItem=function(s,o){if(s.legendGroup[o?"removeClass":"addClass"]("highcharts-legend-item-hidden"),!this.chart.styledMode){var _=this.options,S=s.legendItem,R=s.legendLine,O=s.legendSymbol,P=this.itemHiddenStyle.color;_=o?_.itemStyle.color:P;var D=o&&s.color||P,N=s.options&&s.options.marker,V={fill:D};S&&S.css({fill:_,color:_}),R&&R.attr({stroke:D}),O&&(N&&O.isMarker&&(V=s.pointAttribs(),o||(V.stroke=V.fill=P)),O.attr(V))}Z(this,"afterColorizeItem",{item:s,visible:o})},a.prototype.positionItems=function(){this.allItems.forEach(this.positionItem,this),this.chart.isResizing||this.positionCheckboxes()},a.prototype.positionItem=function(s){var o=this,_=this.options,S=_.symbolPadding,R=!_.rtl,O=s._legendItemPos;_=O[0],O=O[1];var P=s.checkbox,D=s.legendGroup;D&&D.element&&(S={translateX:R?_:this.legendWidth-_-2*S-4,translateY:O},R=function(){Z(o,"afterPositionItem",{item:s})},Y(D.translateY)?D.animate(S,void 0,R):(D.attr(S),R())),P&&(P.x=_,P.y=O)},a.prototype.destroyItem=function(s){var o=s.checkbox;["legendItem","legendLine","legendSymbol","legendGroup"].forEach((function(o){s[o]&&(s[o]=s[o].destroy())})),o&&$(s.checkbox)},a.prototype.destroy=function(){function b(s){this[s]&&(this[s]=this[s].destroy())}this.getAllItems().forEach((function(s){["legendItem","legendGroup"].forEach(b,s)})),"clipRect up down pager nav box title group".split(" ").forEach(b,this),this.display=null},a.prototype.positionCheckboxes=function(){var s=this.group&&this.group.alignAttr,o=this.clipHeight||this.legendHeight,_=this.titleHeight;if(s){var S=s.translateY;this.allItems.forEach((function(R){var O=R.checkbox;if(O){var P=S+_+O.y+(this.scrollOffset||0)+3;U(O,{left:s.translateX+R.checkboxOffset+O.x-20+"px",top:P+"px",display:this.proximate||P>S-6&&P<S+o-6?"":"none"})}}),this)}},a.prototype.renderTitle=function(){var s=this.options,o=this.padding,_=s.title,S=0;_.text&&(this.title||(this.title=this.chart.renderer.label(_.text,o-3,o-4,null,null,null,s.useHTML,null,"legend-title").attr({zIndex:1}),this.chart.styledMode||this.title.css(_.style),this.title.add(this.group)),_.width||this.title.css({width:this.maxLegendWidth+"px"}),S=(s=this.title.getBBox()).height,this.offsetWidth=s.width,this.contentGroup.attr({translateY:S})),this.titleHeight=S},a.prototype.setText=function(s){var o=this.options;s.legendItem.attr({text:o.labelFormat?N(o.labelFormat,s,this.chart):o.labelFormatter.call(s)})},a.prototype.renderItem=function(s){var o=this.chart,_=o.renderer,S=this.options,R=this.symbolWidth,O=S.symbolPadding||0,P=this.itemStyle,D=this.itemHiddenStyle,N="horizontal"===S.layout?te(S.itemDistance,20):0,V=!S.rtl,j=!s.series,K=!j&&s.series.drawLegendSymbol?s.series:s,W=K.options,U=this.createCheckboxForItem&&W&&W.showCheckbox,Y=S.useHTML,$=s.options.className,X=s.legendItem;W=R+O+N+(U?20:0),X||(s.legendGroup=_.g("legend-item").addClass("highcharts-"+K.type+"-series highcharts-color-"+s.colorIndex+($?" "+$:"")+(j?" highcharts-series-"+s.index:"")).attr({zIndex:1}).add(this.scrollGroup),s.legendItem=X=_.text("",V?R+O:-O,this.baseline||0,Y),o.styledMode||X.css(ee(s.visible?P:D)),X.attr({align:V?"left":"right",zIndex:2}).add(s.legendGroup),this.baseline||(this.fontMetrics=_.fontMetrics(o.styledMode?12:P.fontSize,X),this.baseline=this.fontMetrics.f+3+this.itemMarginTop,X.attr("y",this.baseline),this.symbolHeight=S.symbolHeight||this.fontMetrics.f,S.squareSymbol&&(this.symbolWidth=te(S.symbolWidth,Math.max(this.symbolHeight,16)),W=this.symbolWidth+O+N+(U?20:0),V&&X.attr("x",this.symbolWidth+O))),K.drawLegendSymbol(this,s),this.setItemEvents&&this.setItemEvents(s,X,Y)),U&&!s.checkbox&&this.createCheckboxForItem&&this.createCheckboxForItem(s),this.colorizeItem(s,s.visible),!o.styledMode&&P.width||X.css({width:(S.itemWidth||this.widthOption||o.spacingBox.width)-W+"px"}),this.setText(s),o=X.getBBox(),_=this.fontMetrics&&this.fontMetrics.h||0,s.itemWidth=s.checkboxOffset=S.itemWidth||s.legendItemWidth||o.width+W,this.maxItemWidth=Math.max(this.maxItemWidth,s.itemWidth),this.totalItemWidth+=s.itemWidth,this.itemHeight=s.itemHeight=Math.round(s.legendItemHeight||(o.height>1.5*_?o.height:_))},a.prototype.layoutItem=function(s){var o=this.options,_=this.padding,S="horizontal"===o.layout,R=s.itemHeight,O=this.itemMarginBottom,P=this.itemMarginTop,D=S?te(o.itemDistance,20):0,N=this.maxLegendWidth;o=o.alignColumns&&this.totalItemWidth>N?this.maxItemWidth:s.itemWidth,S&&this.itemX-_+o>N&&(this.itemX=_,this.lastLineHeight&&(this.itemY+=P+this.lastLineHeight+O),this.lastLineHeight=0),this.lastItemY=P+this.itemY+O,this.lastLineHeight=Math.max(R,this.lastLineHeight),s._legendItemPos=[this.itemX,this.itemY],S?this.itemX+=o:(this.itemY+=P+R+O,this.lastLineHeight=R),this.offsetWidth=this.widthOption||Math.max((S?this.itemX-_-(s.checkbox?0:D):o)+_,this.offsetWidth)},a.prototype.getAllItems=function(){var s=[];return this.chart.series.forEach((function(o){var _=o&&o.options;o&&te(_.showInLegend,!Y(_.linkedTo)&&void 0,!0)&&(s=s.concat(o.legendItems||("point"===_.legendType?o.data:o)))})),Z(this,"afterGetAllItems",{allItems:s}),s},a.prototype.getAlignment=function(){var s=this.options;return this.proximate?s.align.charAt(0)+"tv":s.floating?"":s.align.charAt(0)+s.verticalAlign.charAt(0)+s.layout.charAt(0)},a.prototype.adjustMargins=function(s,o){var _=this.chart,S=this.options,R=this.getAlignment();R&&[/(lth|ct|rth)/,/(rtv|rm|rbv)/,/(rbh|cb|lbh)/,/(lbv|lm|ltv)/].forEach((function(O,P){O.test(R)&&!Y(s[P])&&(_[V[P]]=Math.max(_[V[P]],_.legend[(P+1)%2?"legendHeight":"legendWidth"]+[1,-1,-1,1][P]*S[P%2?"x":"y"]+te(S.margin,12)+o[P]+(_.titleOffset[P]||0)))}))},a.prototype.proximatePositions=function(){var s=this.chart,o=[],_="left"===this.options.align;this.allItems.forEach((function(S){var R,O=_;if(S.yAxis){S.xAxis.options.reversed&&(O=!O),S.points&&(R=X(O?S.points:S.points.slice(0).reverse(),(function(s){return Q(s.plotY)}))),O=this.itemMarginTop+S.legendItem.getBBox().height+this.itemMarginBottom;var P=S.yAxis.top-s.plotTop;S.visible?(R=R?R.plotY:S.yAxis.height,R+=P-.3*O):R=P+S.yAxis.height,o.push({target:R,size:O,item:S})}}),this),j(o,s.plotHeight).forEach((function(o){o.item._legendItemPos&&(o.item._legendItemPos[1]=s.plotTop-s.spacing[0]+o.pos)}))},a.prototype.render=function(){var s=this.chart,o=s.renderer,_=this.options,S=this.padding,R=this.getAllItems(),O=this.group,P=this.box;this.itemX=S,this.itemY=this.initialItemY,this.lastItemY=this.offsetWidth=0,this.widthOption=ie(_.width,s.spacingBox.width-S);var D=s.spacingBox.width-2*S-_.x;-1<["rm","lm"].indexOf(this.getAlignment().substring(0,2))&&(D/=2),this.maxLegendWidth=this.widthOption||D,O||(this.group=O=o.g("legend").addClass(_.className||"").attr({zIndex:7}).add(),this.contentGroup=o.g().attr({zIndex:1}).add(O),this.scrollGroup=o.g().add(this.contentGroup)),this.renderTitle(),ae(R,(function(s,o){return(s.options&&s.options.legendIndex||0)-(o.options&&o.options.legendIndex||0)})),_.reversed&&R.reverse(),this.allItems=R,this.display=D=!!R.length,this.itemHeight=this.totalItemWidth=this.maxItemWidth=this.lastLineHeight=0,R.forEach(this.renderItem,this),R.forEach(this.layoutItem,this),R=(this.widthOption||this.offsetWidth)+S;var N=this.lastItemY+this.lastLineHeight+this.titleHeight;N=this.handleOverflow(N),N+=S,P||(this.box=P=o.rect().addClass("highcharts-legend-box").attr({r:_.borderRadius}).add(O),P.isNew=!0),s.styledMode||P.attr({stroke:_.borderColor,"stroke-width":_.borderWidth||0,fill:_.backgroundColor||"none"}).shadow(_.shadow),0<R&&0<N&&(P[P.isNew?"attr":"animate"](P.crisp.call({},{x:0,y:0,width:R,height:N},P.strokeWidth())),P.isNew=!1),P[D?"show":"hide"](),s.styledMode&&"none"===O.getStyle("display")&&(R=N=0),this.legendWidth=R,this.legendHeight=N,D&&this.align(),this.proximate||this.positionItems(),Z(this,"afterRender")},a.prototype.align=function(s){void 0===s&&(s=this.chart.spacingBox);var o=this.chart,_=this.options,S=s.y;/(lth|ct|rth)/.test(this.getAlignment())&&0<o.titleOffset[0]?S+=o.titleOffset[0]:/(lbh|cb|rbh)/.test(this.getAlignment())&&0<o.titleOffset[2]&&(S-=o.titleOffset[2]),S!==s.y&&(s=ee(s,{y:S})),this.group.align(ee(_,{width:this.legendWidth,height:this.legendHeight,verticalAlign:this.proximate?"top":_.verticalAlign}),!0,s)},a.prototype.handleOverflow=function(s){var o,_,S=this,R=this.chart,O=R.renderer,P=this.options,D=P.y,N="top"===P.verticalAlign,V=this.padding,j=P.maxHeight,K=P.navigation,W=te(K.animation,!0),U=K.arrowSize||12,Y=this.pages,$=this.allItems,q=function(s){"number"==typeof s?Z.attr({height:s}):Z&&(S.clipRect=Z.destroy(),S.contentGroup.clip()),S.contentGroup.div&&(S.contentGroup.div.style.clip=s?"rect("+V+"px,9999px,"+(V+s)+"px,0)":"auto")},w=function(s){return S[s]=O.circle(0,0,1.3*U).translate(U/2,U/2).add(X),R.styledMode||S[s].attr("fill","rgba(0,0,0,0.0001)"),S[s]};D=R.spacingBox.height+(N?-D:D)-V;var X=this.nav,Z=this.clipRect;return"horizontal"!==P.layout||"middle"===P.verticalAlign||P.floating||(D/=2),j&&(D=Math.min(D,j)),Y.length=0,s&&0<D&&s>D&&!1!==K.enabled?(this.clipHeight=o=Math.max(D-20-this.titleHeight-V,0),this.currentPage=te(this.currentPage,1),this.fullHeight=s,$.forEach((function(s,S){var R=s._legendItemPos[1],O=Math.round(s.legendItem.getBBox().height),P=Y.length;(!P||R-Y[P-1]>o&&(_||R)!==Y[P-1])&&(Y.push(_||R),P++),s.pageIx=P-1,_&&($[S-1].pageIx=P-1),S===$.length-1&&R+O-Y[P-1]>o&&O<=o&&(Y.push(R),s.pageIx=P),R!==_&&(_=R)})),Z||(Z=S.clipRect=O.clipRect(0,V,9999,0),S.contentGroup.clip(Z)),q(o),X||(this.nav=X=O.g().attr({zIndex:1}).add(this.group),this.up=O.symbol("triangle",0,0,U,U).add(X),w("upTracker").on("click",(function(){S.scroll(-1,W)})),this.pager=O.text("",15,10).addClass("highcharts-legend-navigation"),R.styledMode||this.pager.css(K.style),this.pager.add(X),this.down=O.symbol("triangle-down",0,0,U,U).add(X),w("downTracker").on("click",(function(){S.scroll(1,W)}))),S.scroll(0),s=D):X&&(q(),this.nav=X.destroy(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0),s},a.prototype.scroll=function(s,o){var _=this,S=this.chart,R=this.pages,O=R.length,N=this.clipHeight,V=this.options.navigation,j=this.pager,K=this.padding,W=this.currentPage+s;W>O&&(W=O),0<W&&(void 0!==o&&D(o,S),this.nav.attr({translateX:K,translateY:N+this.padding+7+this.titleHeight,visibility:"visible"}),[this.up,this.upTracker].forEach((function(s){s.attr({class:1===W?"highcharts-legend-nav-inactive":"highcharts-legend-nav-active"})})),j.attr({text:W+"/"+O}),[this.down,this.downTracker].forEach((function(s){s.attr({x:18+this.pager.getBBox().width,class:W===O?"highcharts-legend-nav-inactive":"highcharts-legend-nav-active"})}),this),S.styledMode||(this.up.attr({fill:1===W?V.inactiveColor:V.activeColor}),this.upTracker.css({cursor:1===W?"default":"pointer"}),this.down.attr({fill:W===O?V.inactiveColor:V.activeColor}),this.downTracker.css({cursor:W===O?"default":"pointer"})),this.scrollOffset=-R[W-1]+this.initialItemY,this.scrollGroup.animate({translateY:this.scrollOffset}),this.currentPage=W,this.positionCheckboxes(),s=P(te(o,S.renderer.globalAnimation,!0)),ne((function(){Z(_,"afterScroll",{currentPage:W})}),s.duration))},a.prototype.setItemEvents=function(s,o,_){var R=this,O=R.chart.renderer.boxWrapper,P=s instanceof S,D="highcharts-legend-"+(P?"point":"series")+"-active",N=R.chart.styledMode,l=function(o){R.allItems.forEach((function(_){s!==_&&[_].concat(_.linkedSeries||[]).forEach((function(s){s.setState(o,!P)}))}))};(_?[o,s.legendSymbol]:[s.legendGroup]).forEach((function(_){_&&_.on("mouseover",(function(){s.visible&&l("inactive"),s.setState("hover"),s.visible&&O.addClass(D),N||o.css(R.options.itemHoverStyle)})).on("mouseout",(function(){R.chart.styledMode||o.css(ee(s.visible?R.itemStyle:R.itemHiddenStyle)),l(""),O.removeClass(D),s.setState()})).on("click",(function(o){var c=function(){s.setVisible&&s.setVisible(),l(s.visible?"inactive":"")};O.removeClass(D),o={browserEvent:o},s.firePointEvent?s.firePointEvent("legendItemClick",o,c):Z(s,"legendItemClick",o,c)}))}))},a.prototype.createCheckboxForItem=function(s){s.checkbox=W("input",{type:"checkbox",className:"highcharts-legend-checkbox",checked:s.selected,defaultChecked:s.selected},this.options.itemCheckboxStyle,this.chart.container),K(s.checkbox,"click",(function(o){Z(s.series||s,"checkboxClick",{checked:o.target.checked,item:s},(function(){s.select()}))}))},a}(),(/Trident\/7\.0/.test(_.navigator&&_.navigator.userAgent)||s)&&R(O.prototype,"positionItem",(function(s,o){var _=this,d=function(){o._legendItemPos&&s.call(_,o)};d(),_.bubbleLegend||setTimeout(d)})),O})),M(o,"Core/Series/SeriesRegistry.js",[o["Core/Globals.js"],o["Core/DefaultOptions.js"],o["Core/Series/Point.js"],o["Core/Utilities.js"]],(function(s,o,_,S){var R,O=o.defaultOptions,P=S.error,D=S.extendClass,N=S.merge;return function(o){function k(s,S){var R=O.plotOptions||{},P=S.defaultOptions;S.prototype.pointClass||(S.prototype.pointClass=_),S.prototype.type=s,P&&(R[s]=P),o.seriesTypes[s]=S}o.seriesTypes=s.seriesTypes,o.getSeries=function(s,_){void 0===_&&(_={});var S=s.options.chart;S=_.type||S.type||S.defaultSeriesType||"";var R=o.seriesTypes[S];return o||P(17,!0,s,{missingModuleFor:S}),"function"==typeof(S=new R).init&&S.init(s,_),S},o.registerSeriesType=k,o.seriesType=function(s,S,R,P,V){var j=O.plotOptions||{};return S=S||"",j[s]=N(j[S],R),k(s,D(o.seriesTypes[S]||function(){},P)),o.seriesTypes[s].prototype.type=s,V&&(o.seriesTypes[s].prototype.pointClass=D(_,V)),o.seriesTypes[s]}}(R||(R={})),R})),M(o,"Core/Chart/Chart.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/Axis/Axis.js"],o["Core/FormatUtilities.js"],o["Core/Foundation.js"],o["Core/Globals.js"],o["Core/Legend/Legend.js"],o["Core/MSPointer.js"],o["Core/DefaultOptions.js"],o["Core/Pointer.js"],o["Core/Renderer/RendererRegistry.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Renderer/SVG/SVGRenderer.js"],o["Core/Time.js"],o["Core/Utilities.js"],o["Core/Renderer/HTML/AST.js"]],(function(s,o,_,S,R,O,P,D,N,V,j,K,W,U,Y){var $=s.animate,X=s.animObject,Z=s.setAnimation,Q=_.numberFormat,ee=S.registerEventOptions,te=R.charts,ie=R.doc,ae=R.marginNames,ne=R.svg,re=R.win,se=D.defaultOptions,le=D.defaultTime,oe=j.seriesTypes,de=U.addEvent,ce=U.attr,he=U.cleanRecursively,ue=U.createElement,pe=U.css,fe=U.defined,ge=U.discardElement,me=U.erase,ve=U.error,ye=U.extend,_e=U.find,Se=U.fireEvent,be=U.getStyle,Ee=U.isArray,Te=U.isNumber,Ce=U.isObject,ke=U.isString,xe=U.merge,we=U.objectEach,Re=U.pick,Ie=U.pInt,Me=U.relativeLength,Oe=U.removeEvent,Ae=U.splat,Pe=U.syncTimeout,De=U.uniqueKey;return s=function(){function a(s,o,_){this.series=this.renderTo=this.renderer=this.pointer=this.pointCount=this.plotWidth=this.plotTop=this.plotLeft=this.plotHeight=this.plotBox=this.options=this.numberFormatter=this.margin=this.legend=this.labelCollectors=this.isResizing=this.index=this.eventOptions=this.container=this.colorCounter=this.clipBox=this.chartWidth=this.chartHeight=this.bounds=this.axisOffset=this.axes=void 0,this.sharedClips={},this.yAxis=this.xAxis=this.userOptions=this.titleOffset=this.time=this.symbolCounter=this.spacingBox=this.spacing=void 0,this.getArgs(s,o,_)}return a.chart=function(s,o,_){return new a(s,o,_)},a.prototype.getArgs=function(s,o,_){ke(s)||s.nodeName?(this.renderTo=s,this.init(o,_)):this.init(s,o)},a.prototype.init=function(s,o){var _=s.plotOptions||{};Se(this,"init",{args:arguments},(function(){var S=xe(se,s),O=S.chart;we(S.plotOptions,(function(s,o){Ce(s)&&(s.tooltip=_[o]&&xe(_[o].tooltip)||void 0)})),S.tooltip.userOptions=s.chart&&s.chart.forExport&&s.tooltip.userOptions||s.tooltip,this.userOptions=s,this.margin=[],this.spacing=[],this.bounds={h:{},v:{}},this.labelCollectors=[],this.callback=o,this.isResizing=0,this.options=S,this.axes=[],this.series=[],this.time=s.time&&Object.keys(s.time).length?new W(s.time):R.time,this.numberFormatter=O.numberFormatter||Q,this.styledMode=O.styledMode,this.hasCartesianSeries=O.showAxes,this.index=te.length,te.push(this),R.chartCount++,ee(this,O),this.xAxis=[],this.yAxis=[],this.pointCount=this.colorCounter=this.symbolCounter=0,Se(this,"afterInit"),this.firstRender()}))},a.prototype.initSeries=function(s){var o=this.options.chart;o=s.type||o.type||o.defaultSeriesType;var _=oe[o];return _||ve(17,!0,this,{missingModuleFor:o}),"function"==typeof(o=new _).init&&o.init(this,s),o},a.prototype.setSeriesData=function(){this.getSeriesOrderByLinks().forEach((function(s){s.points||s.data||!s.enabledDataSorting||s.setData(s.options.data,!1)}))},a.prototype.getSeriesOrderByLinks=function(){return this.series.concat().sort((function(s,o){return s.linkedSeries.length||o.linkedSeries.length?o.linkedSeries.length-s.linkedSeries.length:0}))},a.prototype.orderSeries=function(s){var o=this.series;s=s||0;for(var _=o.length;s<_;++s)o[s]&&(o[s].index=s,o[s].name=o[s].getName())},a.prototype.isInsidePlot=function(s,o,_){void 0===_&&(_={});var S=this.inverted,R=this.plotBox,O=this.plotLeft,P=this.plotTop,D=this.scrollablePlotBox,N=0,V=0;_.visiblePlotOnly&&this.scrollingContainer&&(N=(V=this.scrollingContainer).scrollLeft,V=V.scrollTop);var j=_.series;if(R=_.visiblePlotOnly&&D||R,s={x:D=_.inverted?o:s,y:o=_.inverted?s:o,isInsidePlot:!0},!_.ignoreX){var K=j&&(S?j.yAxis:j.xAxis)||{pos:O,len:1/0};(D=_.paneCoordinates?K.pos+D:O+D)>=Math.max(N+O,K.pos)&&D<=Math.min(N+O+R.width,K.pos+K.len)||(s.isInsidePlot=!1)}return!_.ignoreY&&s.isInsidePlot&&(S=j&&(S?j.xAxis:j.yAxis)||{pos:P,len:1/0},(_=_.paneCoordinates?S.pos+o:P+o)>=Math.max(V+P,S.pos)&&_<=Math.min(V+P+R.height,S.pos+S.len)||(s.isInsidePlot=!1)),Se(this,"afterIsInsidePlot",s),s.isInsidePlot},a.prototype.redraw=function(s){Se(this,"beforeRedraw");var o=this.hasCartesianSeries?this.axes:this.colorAxis||[],_=this.series,S=this.pointer,R=this.legend,O=this.userOptions.legend,P=this.renderer,D=P.isHidden(),N=[],V=this.isDirtyBox,j=this.isDirtyLegend;for(this.setResponsive&&this.setResponsive(!1),Z(!!this.hasRendered&&s,this),D&&this.temporaryDisplay(),this.layOutTitles(),s=_.length;s--;){var K=_[s];if(K.options.stacking||K.options.centerInCategory){var W=!0;if(K.isDirty){var U=!0;break}}}if(U)for(s=_.length;s--;)(K=_[s]).options.stacking&&(K.isDirty=!0);_.forEach((function(s){s.isDirty&&("point"===s.options.legendType?("function"==typeof s.updateTotals&&s.updateTotals(),j=!0):O&&(O.labelFormatter||O.labelFormat)&&(j=!0)),s.isDirtyData&&Se(s,"updatedData")})),j&&R&&R.options.enabled&&(R.render(),this.isDirtyLegend=!1),W&&this.getStacks(),o.forEach((function(s){s.updateNames(),s.setScale()})),this.getMargins(),o.forEach((function(s){s.isDirty&&(V=!0)})),o.forEach((function(s){var o=s.min+","+s.max;s.extKey!==o&&(s.extKey=o,N.push((function(){Se(s,"afterSetExtremes",ye(s.eventArgs,s.getExtremes())),delete s.eventArgs}))),(V||W)&&s.redraw()})),V&&this.drawChartBox(),Se(this,"predraw"),_.forEach((function(s){(V||s.isDirty)&&s.visible&&s.redraw(),s.isDirtyData=!1})),S&&S.reset(!0),P.draw(),Se(this,"redraw"),Se(this,"render"),D&&this.temporaryDisplay(!0),N.forEach((function(s){s.call()}))},a.prototype.get=function(s){function a(o){return o.id===s||o.options&&o.options.id===s}for(var o=this.series,_=_e(this.axes,a)||_e(this.series,a),S=0;!_&&S<o.length;S++)_=_e(o[S].points||[],a);return _},a.prototype.getAxes=function(){var s=this,_=this.options,S=_.xAxis=Ae(_.xAxis||{});_=_.yAxis=Ae(_.yAxis||{}),Se(this,"getAxes"),S.forEach((function(s,o){s.index=o,s.isX=!0})),_.forEach((function(s,o){s.index=o})),S.concat(_).forEach((function(_){new o(s,_)})),Se(this,"afterGetAxes")},a.prototype.getSelectedPoints=function(){return this.series.reduce((function(s,o){return o.getPointsCollection().forEach((function(o){Re(o.selectedStaging,o.selected)&&s.push(o)})),s}),[])},a.prototype.getSelectedSeries=function(){return this.series.filter((function(s){return s.selected}))},a.prototype.setTitle=function(s,o,_){this.applyDescription("title",s),this.applyDescription("subtitle",o),this.applyDescription("caption",void 0),this.layOutTitles(_)},a.prototype.applyDescription=function(s,o){var _=this,S="title"===s?{color:"#333333",fontSize:this.options.isStock?"16px":"18px"}:{color:"#666666"};S=this.options[s]=xe(!this.styledMode&&{style:S},this.options[s],o);var R=this[s];R&&o&&(this[s]=R=R.destroy()),S&&!R&&((R=this.renderer.text(S.text,0,0,S.useHTML).attr({align:S.align,class:"highcharts-"+s,zIndex:S.zIndex||4}).add()).update=function(o){_[{title:"setTitle",subtitle:"setSubtitle",caption:"setCaption"}[s]](o)},this.styledMode||R.css(S.style),this[s]=R)},a.prototype.layOutTitles=function(s){var o=[0,0,0],_=this.renderer,S=this.spacingBox;["title","subtitle","caption"].forEach((function(s){var R,O=this[s],P=this.options[s],D=P.verticalAlign||"top";if(s="title"===s?"top"===D?-3:0:"top"===D?o[0]+2:0,O){this.styledMode||(R=P.style&&P.style.fontSize),R=_.fontMetrics(R,O).b,O.css({width:(P.width||S.width+(P.widthAdjust||0))+"px"});var N=Math.round(O.getBBox(P.useHTML).height);O.align(ye({y:"bottom"===D?R:s+R,height:N},P),!1,"spacingBox"),P.floating||("top"===D?o[0]=Math.ceil(o[0]+N):"bottom"===D&&(o[2]=Math.ceil(o[2]+N)))}}),this),o[0]&&"top"===(this.options.title.verticalAlign||"top")&&(o[0]+=this.options.title.margin),o[2]&&"bottom"===this.options.caption.verticalAlign&&(o[2]+=this.options.caption.margin);var R=!this.titleOffset||this.titleOffset.join(",")!==o.join(",");this.titleOffset=o,Se(this,"afterLayOutTitles"),!this.isDirtyBox&&R&&(this.isDirtyBox=this.isDirtyLegend=R,this.hasRendered&&Re(s,!0)&&this.isDirtyBox&&this.redraw())},a.prototype.getChartSize=function(){var s=this.options.chart,o=s.width;s=s.height;var _=this.renderTo;fe(o)||(this.containerWidth=be(_,"width")),fe(s)||(this.containerHeight=be(_,"height")),this.chartWidth=Math.max(0,o||this.containerWidth||600),this.chartHeight=Math.max(0,Me(s,this.chartWidth)||(1<this.containerHeight?this.containerHeight:400))},a.prototype.temporaryDisplay=function(s){var o=this.renderTo;if(s)for(;o&&o.style;)o.hcOrigStyle&&(pe(o,o.hcOrigStyle),delete o.hcOrigStyle),o.hcOrigDetached&&(ie.body.removeChild(o),o.hcOrigDetached=!1),o=o.parentNode;else for(;o&&o.style&&(ie.body.contains(o)||o.parentNode||(o.hcOrigDetached=!0,ie.body.appendChild(o)),("none"===be(o,"display",!1)||o.hcOricDetached)&&(o.hcOrigStyle={display:o.style.display,height:o.style.height,overflow:o.style.overflow},s={display:"block",overflow:"hidden"},o!==this.renderTo&&(s.height=0),pe(o,s),o.offsetWidth||o.style.setProperty("display","block","important")),(o=o.parentNode)!==ie.body););},a.prototype.setClassName=function(s){this.container.className="highcharts-container "+(s||"")},a.prototype.getContainer=function(){var s,o=this.options,_=o.chart,S=De(),R=this.renderTo;R||(this.renderTo=R=_.renderTo),ke(R)&&(this.renderTo=R=ie.getElementById(R)),R||ve(13,!0,this);var O=Ie(ce(R,"data-highcharts-chart"));Te(O)&&te[O]&&te[O].hasRendered&&te[O].destroy(),ce(R,"data-highcharts-chart",this.index),R.innerHTML=Y.emptyHTML,_.skipClone||R.offsetWidth||this.temporaryDisplay(),this.getChartSize(),O=this.chartWidth;var P=this.chartHeight;if(pe(R,{overflow:"hidden"}),this.styledMode||(s=ye({position:"relative",overflow:"hidden",width:O+"px",height:P+"px",textAlign:"left",lineHeight:"normal",zIndex:0,"-webkit-tap-highlight-color":"rgba(0,0,0,0)",userSelect:"none","touch-action":"manipulation",outline:"none"},_.style||{})),this.container=S=ue("div",{id:S},s,R),this._cursor=S.style.cursor,this.renderer=new(_.renderer||!ne?V.getRendererType(_.renderer):K)(S,O,P,void 0,_.forExport,o.exporting&&o.exporting.allowHTML,this.styledMode),Z(void 0,this),this.setClassName(_.className),this.styledMode)for(var D in o.defs)this.renderer.definition(o.defs[D]);else this.renderer.setStyle(_.style);this.renderer.chartIndex=this.index,Se(this,"afterGetContainer")},a.prototype.getMargins=function(s){var o=this.spacing,_=this.margin,S=this.titleOffset;this.resetMargins(),S[0]&&!fe(_[0])&&(this.plotTop=Math.max(this.plotTop,S[0]+o[0])),S[2]&&!fe(_[2])&&(this.marginBottom=Math.max(this.marginBottom,S[2]+o[2])),this.legend&&this.legend.display&&this.legend.adjustMargins(_,o),Se(this,"getMargins"),s||this.getAxisMargins()},a.prototype.getAxisMargins=function(){var s=this,o=s.axisOffset=[0,0,0,0],_=s.colorAxis,S=s.margin,e=function(s){s.forEach((function(s){s.visible&&s.getOffset()}))};s.hasCartesianSeries?e(s.axes):_&&_.length&&e(_),ae.forEach((function(_,R){fe(S[R])||(s[_]+=o[R])})),s.setChartSize()},a.prototype.reflow=function(s){var o=this,_=o.options.chart,S=o.renderTo,R=fe(_.width)&&fe(_.height),O=_.width||be(S,"width");_=_.height||be(S,"height"),S=s?s.target:re,delete o.pointer.chartPosition,R||o.isPrinting||!O||!_||S!==re&&S!==ie||(O===o.containerWidth&&_===o.containerHeight||(U.clearTimeout(o.reflowTimeout),o.reflowTimeout=Pe((function(){o.container&&o.setSize(void 0,void 0,!1)}),s?100:0)),o.containerWidth=O,o.containerHeight=_)},a.prototype.setReflow=function(s){var o=this;!1===s||this.unbindReflow?!1===s&&this.unbindReflow&&(this.unbindReflow=this.unbindReflow()):(this.unbindReflow=de(re,"resize",(function(s){o.options&&o.reflow(s)})),de(this,"destroy",this.unbindReflow))},a.prototype.setSize=function(s,o,_){var S=this,R=S.renderer;S.isResizing+=1,Z(_,S),_=R.globalAnimation,S.oldChartHeight=S.chartHeight,S.oldChartWidth=S.chartWidth,void 0!==s&&(S.options.chart.width=s),void 0!==o&&(S.options.chart.height=o),S.getChartSize(),S.styledMode||(_?$:pe)(S.container,{width:S.chartWidth+"px",height:S.chartHeight+"px"},_),S.setChartSize(!0),R.setSize(S.chartWidth,S.chartHeight,_),S.axes.forEach((function(s){s.isDirty=!0,s.setScale()})),S.isDirtyLegend=!0,S.isDirtyBox=!0,S.layOutTitles(),S.getMargins(),S.redraw(_),S.oldChartHeight=null,Se(S,"resize"),Pe((function(){S&&Se(S,"endResize",null,(function(){--S.isResizing}))}),X(_).duration)},a.prototype.setChartSize=function(s){var o,_,S,R,O=this.inverted,P=this.renderer,D=this.chartWidth,N=this.chartHeight,V=this.options.chart,j=this.spacing,K=this.clipOffset;this.plotLeft=o=Math.round(this.plotLeft),this.plotTop=_=Math.round(this.plotTop),this.plotWidth=S=Math.max(0,Math.round(D-o-this.marginRight)),this.plotHeight=R=Math.max(0,Math.round(N-_-this.marginBottom)),this.plotSizeX=O?R:S,this.plotSizeY=O?S:R,this.plotBorderWidth=V.plotBorderWidth||0,this.spacingBox=P.spacingBox={x:j[3],y:j[0],width:D-j[3]-j[1],height:N-j[0]-j[2]},this.plotBox=P.plotBox={x:o,y:_,width:S,height:R},O=2*Math.floor(this.plotBorderWidth/2),D=Math.ceil(Math.max(O,K[3])/2),N=Math.ceil(Math.max(O,K[0])/2),this.clipBox={x:D,y:N,width:Math.floor(this.plotSizeX-Math.max(O,K[1])/2-D),height:Math.max(0,Math.floor(this.plotSizeY-Math.max(O,K[2])/2-N))},s||(this.axes.forEach((function(s){s.setAxisSize(),s.setAxisTranslation()})),P.alignElements()),Se(this,"afterSetChartSize",{skipAxes:s})},a.prototype.resetMargins=function(){Se(this,"resetMargins");var s=this,o=s.options.chart;["margin","spacing"].forEach((function(_){var S=o[_],R=Ce(S)?S:[S,S,S,S];["Top","Right","Bottom","Left"].forEach((function(S,O){s[_][O]=Re(o[_+S],R[O])}))})),ae.forEach((function(o,_){s[o]=Re(s.margin[_],s.spacing[_])})),s.axisOffset=[0,0,0,0],s.clipOffset=[0,0,0,0]},a.prototype.drawChartBox=function(){var s,o=this.options.chart,_=this.renderer,S=this.chartWidth,R=this.chartHeight,O=this.styledMode,P=this.plotBGImage,D=o.backgroundColor,N=o.plotBackgroundColor,V=o.plotBackgroundImage,j=this.plotLeft,K=this.plotTop,W=this.plotWidth,U=this.plotHeight,Y=this.plotBox,$=this.clipRect,X=this.clipBox,Z=this.chartBackground,Q=this.plotBackground,ee=this.plotBorder,te="animate";if(Z||(this.chartBackground=Z=_.rect().addClass("highcharts-background").add(),te="attr"),O)var ie=s=Z.strokeWidth();else s=(ie=o.borderWidth||0)+(o.shadow?8:0),D={fill:D||"none"},(ie||Z["stroke-width"])&&(D.stroke=o.borderColor,D["stroke-width"]=ie),Z.attr(D).shadow(o.shadow);Z[te]({x:s/2,y:s/2,width:S-s-ie%2,height:R-s-ie%2,r:o.borderRadius}),te="animate",Q||(te="attr",this.plotBackground=Q=_.rect().addClass("highcharts-plot-background").add()),Q[te](Y),O||(Q.attr({fill:N||"none"}).shadow(o.plotShadow),V&&(P?(V!==P.attr("href")&&P.attr("href",V),P.animate(Y)):this.plotBGImage=_.image(V,j,K,W,U).add())),$?$.animate({width:X.width,height:X.height}):this.clipRect=_.clipRect(X),te="animate",ee||(te="attr",this.plotBorder=ee=_.rect().addClass("highcharts-plot-border").attr({zIndex:1}).add()),O||ee.attr({stroke:o.plotBorderColor,"stroke-width":o.plotBorderWidth||0,fill:"none"}),ee[te](ee.crisp({x:j,y:K,width:W,height:U},-ee.strokeWidth())),this.isDirtyBox=!1,Se(this,"afterDrawChartBox")},a.prototype.propFromSeries=function(){var s,o,_,S=this,R=S.options.chart,O=S.options.series;["inverted","angular","polar"].forEach((function(P){for(o=oe[R.type||R.defaultSeriesType],_=R[P]||o&&o.prototype[P],s=O&&O.length;!_&&s--;)(o=oe[O[s].type])&&o.prototype[P]&&(_=!0);S[P]=_}))},a.prototype.linkSeries=function(){var s=this,o=s.series;o.forEach((function(s){s.linkedSeries.length=0})),o.forEach((function(o){var _=o.options.linkedTo;ke(_)&&(_=":previous"===_?s.series[o.index-1]:s.get(_))&&_.linkedParent!==o&&(_.linkedSeries.push(o),o.linkedParent=_,_.enabledDataSorting&&o.setDataSortingOptions(),o.visible=Re(o.options.visible,_.options.visible,o.visible))})),Se(this,"afterLinkSeries")},a.prototype.renderSeries=function(){this.series.forEach((function(s){s.translate(),s.render()}))},a.prototype.renderLabels=function(){var s=this,o=s.options.labels;o.items&&o.items.forEach((function(_){var S=ye(o.style,_.style),R=Ie(S.left)+s.plotLeft,O=Ie(S.top)+s.plotTop+12;delete S.left,delete S.top,s.renderer.text(_.html,R,O).attr({zIndex:2}).css(S).add()}))},a.prototype.render=function(){var s=this.axes,o=this.colorAxis,_=this.renderer,S=this.options,e=function(s){s.forEach((function(s){s.visible&&s.render()}))},R=0;this.setTitle(),this.legend=new O(this,S.legend),this.getStacks&&this.getStacks(),this.getMargins(!0),this.setChartSize(),S=this.plotWidth,s.some((function(s){if(s.horiz&&s.visible&&s.options.labels.enabled&&s.series.length)return R=21,!0}));var P=this.plotHeight=Math.max(this.plotHeight-R,0);s.forEach((function(s){s.setScale()})),this.getAxisMargins();var D=1.1<S/this.plotWidth,N=1.05<P/this.plotHeight;(D||N)&&(s.forEach((function(s){(s.horiz&&D||!s.horiz&&N)&&s.setTickInterval(!0)})),this.getMargins()),this.drawChartBox(),this.hasCartesianSeries?e(s):o&&o.length&&e(o),this.seriesGroup||(this.seriesGroup=_.g("series-group").attr({zIndex:3}).add()),this.renderSeries(),this.renderLabels(),this.addCredits(),this.setResponsive&&this.setResponsive(),this.hasRendered=!0},a.prototype.addCredits=function(s){var o=this,_=xe(!0,this.options.credits,s);_.enabled&&!this.credits&&(this.credits=this.renderer.text(_.text+(this.mapCredits||""),0,0).addClass("highcharts-credits").on("click",(function(){_.href&&(re.location.href=_.href)})).attr({align:_.position.align,zIndex:8}),o.styledMode||this.credits.css(_.style),this.credits.add().align(_.position),this.credits.update=function(s){o.credits=o.credits.destroy(),o.addCredits(s)})},a.prototype.destroy=function(){var s,o=this,_=o.axes,S=o.series,O=o.container,P=O&&O.parentNode;for(Se(o,"destroy"),o.renderer.forExport?me(te,o):te[o.index]=void 0,R.chartCount--,o.renderTo.removeAttribute("data-highcharts-chart"),Oe(o),s=_.length;s--;)_[s]=_[s].destroy();for(this.scroller&&this.scroller.destroy&&this.scroller.destroy(),s=S.length;s--;)S[s]=S[s].destroy();"title subtitle chartBackground plotBackground plotBGImage plotBorder seriesGroup clipRect credits pointer rangeSelector legend resetZoomButton tooltip renderer".split(" ").forEach((function(s){var _=o[s];_&&_.destroy&&(o[s]=_.destroy())})),O&&(O.innerHTML=Y.emptyHTML,Oe(O),P&&ge(O)),we(o,(function(s,_){delete o[_]}))},a.prototype.firstRender=function(){var s=this,o=s.options;s.isReadyToRender&&!s.isReadyToRender()||(s.getContainer(),s.resetMargins(),s.setChartSize(),s.propFromSeries(),s.getAxes(),(Ee(o.series)?o.series:[]).forEach((function(o){s.initSeries(o)})),s.linkSeries(),s.setSeriesData(),Se(s,"beforeRender"),N&&(P.isRequired()?s.pointer=new P(s,o):s.pointer=new N(s,o)),s.render(),s.pointer.getChartPosition(),s.renderer.imgCount||s.hasLoaded||s.onload(),s.temporaryDisplay(!0))},a.prototype.onload=function(){this.callbacks.concat([this.callback]).forEach((function(s){s&&void 0!==this.index&&s.apply(this,[this])}),this),Se(this,"load"),Se(this,"render"),fe(this.index)&&this.setReflow(this.options.chart.reflow),this.hasLoaded=!0},a.prototype.addSeries=function(s,o,_){var S,R=this;return s&&(o=Re(o,!0),Se(R,"addSeries",{options:s},(function(){S=R.initSeries(s),R.isDirtyLegend=!0,R.linkSeries(),S.enabledDataSorting&&S.setData(s.data,!1),Se(R,"afterAddSeries",{series:S}),o&&R.redraw(_)}))),S},a.prototype.addAxis=function(s,o,_,S){return this.createAxis(o?"xAxis":"yAxis",{axis:s,redraw:_,animation:S})},a.prototype.addColorAxis=function(s,o,_){return this.createAxis("colorAxis",{axis:s,redraw:o,animation:_})},a.prototype.createAxis=function(s,_){return s=new o(this,xe(_.axis,{index:this[s].length,isX:"xAxis"===s})),Re(_.redraw,!0)&&this.redraw(_.animation),s},a.prototype.showLoading=function(s){var o=this,_=o.options,S=_.loading,e=function(){R&&pe(R,{left:o.plotLeft+"px",top:o.plotTop+"px",width:o.plotWidth+"px",height:o.plotHeight+"px"})},R=o.loadingDiv,O=o.loadingSpan;R||(o.loadingDiv=R=ue("div",{className:"highcharts-loading highcharts-loading-hidden"},null,o.container)),O||(o.loadingSpan=O=ue("span",{className:"highcharts-loading-inner"},null,R),de(o,"redraw",e)),R.className="highcharts-loading",Y.setElementHTML(O,Re(s,_.lang.loading,"")),o.styledMode||(pe(R,ye(S.style,{zIndex:10})),pe(O,S.labelStyle),o.loadingShown||(pe(R,{opacity:0,display:""}),$(R,{opacity:S.style.opacity||.5},{duration:S.showDuration||0}))),o.loadingShown=!0,e()},a.prototype.hideLoading=function(){var s=this.options,o=this.loadingDiv;o&&(o.className="highcharts-loading highcharts-loading-hidden",this.styledMode||$(o,{opacity:0},{duration:s.loading.hideDuration||100,complete:function(){pe(o,{display:"none"})}})),this.loadingShown=!1},a.prototype.update=function(s,o,_,S){var R,O,P=this,D={credits:"addCredits",title:"setTitle",subtitle:"setSubtitle",caption:"setCaption"},N=s.isResponsiveOptions,V=[];Se(P,"update",{options:s}),N||P.setResponsive(!1,!0),s=he(s,P.options),P.userOptions=xe(P.userOptions,s);var j=s.chart;if(j){if(xe(!0,P.options.chart,j),"className"in j&&P.setClassName(j.className),"reflow"in j&&P.setReflow(j.reflow),"inverted"in j||"polar"in j||"type"in j){P.propFromSeries();var K=!0}"alignTicks"in j&&(K=!0),"events"in j&&ee(this,j),we(j,(function(s,o){-1!==P.propsRequireUpdateSeries.indexOf("chart."+o)&&(R=!0),-1!==P.propsRequireDirtyBox.indexOf(o)&&(P.isDirtyBox=!0),-1!==P.propsRequireReflow.indexOf(o)&&(N?P.isDirtyBox=!0:O=!0)})),!P.styledMode&&j.style&&P.renderer.setStyle(P.options.chart.style||{})}!P.styledMode&&s.colors&&(this.options.colors=s.colors),s.time&&(this.time===le&&(this.time=new W(s.time)),xe(!0,P.options.time,s.time)),we(s,(function(o,_){P[_]&&"function"==typeof P[_].update?P[_].update(o,!1):"function"==typeof P[D[_]]?P[D[_]](o):"colors"!==_&&-1===P.collectionsWithUpdate.indexOf(_)&&xe(!0,P.options[_],s[_]),"chart"!==_&&-1!==P.propsRequireUpdateSeries.indexOf(_)&&(R=!0)})),this.collectionsWithUpdate.forEach((function(o){if(s[o]){var S=[];P[o].forEach((function(s,o){s.options.isInternal||S.push(Re(s.options.index,o))})),Ae(s[o]).forEach((function(s,R){var O,D=fe(s.id);D&&(O=P.get(s.id)),!O&&P[o]&&(O=P[o][S?S[R]:R])&&D&&fe(O.options.id)&&(O=void 0),O&&O.coll===o&&(O.update(s,!1),_&&(O.touched=!0)),!O&&_&&P.collectionsWithInit[o]&&(P.collectionsWithInit[o][0].apply(P,[s].concat(P.collectionsWithInit[o][1]||[]).concat([!1])).touched=!0)})),_&&P[o].forEach((function(s){s.touched||s.options.isInternal?delete s.touched:V.push(s)}))}})),V.forEach((function(s){s.chart&&s.remove&&s.remove(!1)})),K&&P.axes.forEach((function(s){s.update({},!1)})),R&&P.getSeriesOrderByLinks().forEach((function(s){s.chart&&s.update({},!1)}),this),K=j&&j.width,j=j&&(ke(j.height)?Me(j.height,K||P.chartWidth):j.height),O||Te(K)&&K!==P.chartWidth||Te(j)&&j!==P.chartHeight?P.setSize(K,j,S):Re(o,!0)&&P.redraw(S),Se(P,"afterUpdate",{options:s,redraw:o,animation:S})},a.prototype.setSubtitle=function(s,o){this.applyDescription("subtitle",s),this.layOutTitles(o)},a.prototype.setCaption=function(s,o){this.applyDescription("caption",s),this.layOutTitles(o)},a.prototype.showResetZoom=function(){function b(){s.zoomOut()}var s=this,o=se.lang,_=s.options.chart.resetZoomButton,S=_.theme,R=S.states,O="chart"===_.relativeTo||"spacingBox"===_.relativeTo?null:"scrollablePlotBox";Se(this,"beforeShowResetZoom",null,(function(){s.resetZoomButton=s.renderer.button(o.resetZoom,null,null,b,S,R&&R.hover).attr({align:_.position.align,title:o.resetZoomTitle}).addClass("highcharts-reset-zoom").add().align(_.position,!1,O)})),Se(this,"afterShowResetZoom")},a.prototype.zoomOut=function(){Se(this,"selection",{resetSelection:!0},this.zoom)},a.prototype.zoom=function(s){var o,_=this,S=_.pointer,R=_.inverted?S.mouseDownX:S.mouseDownY,O=!1;!s||s.resetSelection?(_.axes.forEach((function(s){o=s.zoom()})),S.initiated=!1):s.xAxis.concat(s.yAxis).forEach((function(s){var P=s.axis,D=_.inverted?P.left:P.top,N=_.inverted?D+P.width:D+P.height,V=P.isXAxis,j=!1;(!V&&R>=D&&R<=N||V||!fe(R))&&(j=!0),S[V?"zoomX":"zoomY"]&&j&&(o=P.zoom(s.min,s.max),P.displayBtn&&(O=!0))}));var P=_.resetZoomButton;O&&!P?_.showResetZoom():!O&&Ce(P)&&(_.resetZoomButton=P.destroy()),o&&_.redraw(Re(_.options.chart.animation,s&&s.animation,100>_.pointCount))},a.prototype.pan=function(s,o){var _=this,S=_.hoverPoints;o="object"==typeof o?o:{enabled:o,type:"x"};var R=_.options.chart,O=_.options.mapNavigation&&_.options.mapNavigation.enabled;R&&R.panning&&(R.panning=o);var P,D=o.type;Se(this,"pan",{originalEvent:s},(function(){S&&S.forEach((function(s){s.setState()}));var o=_.xAxis;"xy"===D?o=o.concat(_.yAxis):"y"===D&&(o=_.yAxis);var R={};o.forEach((function(o){if(o.options.panningEnabled&&!o.options.isInternal){var S=o.horiz,N=s[S?"chartX":"chartY"],V=_[S=S?"mouseDownX":"mouseDownY"],j=o.minPointOffset||0,K=o.reversed&&!_.inverted||!o.reversed&&_.inverted?-1:1,W=o.getExtremes(),U=o.toValue(V-N,!0)+j*K,Y=o.toValue(V+o.len-N,!0)-(j*K||o.isXAxis&&o.pointRangePadding||0),$=Y<U;K=o.hasVerticalPanning(),V=$?Y:U,U=$?U:Y;var X=o.panningState;!K||o.isXAxis||X&&!X.isDirty||o.series.forEach((function(s){var o=s.getProcessedData(!0);o=s.getExtremes(o.yData,!0),X||(X={startMin:Number.MAX_VALUE,startMax:-Number.MAX_VALUE}),Te(o.dataMin)&&Te(o.dataMax)&&(X.startMin=Math.min(Re(s.options.threshold,1/0),o.dataMin,X.startMin),X.startMax=Math.max(Re(s.options.threshold,-1/0),o.dataMax,X.startMax))})),K=Math.min(Re(X&&X.startMin,W.dataMin),j?W.min:o.toValue(o.toPixels(W.min)-o.minPixelPadding)),Y=Math.max(Re(X&&X.startMax,W.dataMax),j?W.max:o.toValue(o.toPixels(W.max)+o.minPixelPadding)),o.panningState=X,o.isOrdinal||(0<(j=K-V)&&(U+=j,V=K),0<(j=U-Y)&&(U=Y,V-=j),o.series.length&&V!==W.min&&U!==W.max&&V>=K&&U<=Y&&(o.setExtremes(V,U,!1,!1,{trigger:"pan"}),_.resetZoomButton||O||V===K||U===Y||!D.match("y")||(_.showResetZoom(),o.displayBtn=!1),P=!0),R[S]=N)}})),we(R,(function(s,o){_[o]=s})),P&&_.redraw(!1),pe(_.container,{cursor:"move"})}))},a}(),ye(s.prototype,{callbacks:[],collectionsWithInit:{xAxis:[s.prototype.addAxis,[!0]],yAxis:[s.prototype.addAxis,[!1]],series:[s.prototype.addSeries]},collectionsWithUpdate:["xAxis","yAxis","series"],propsRequireDirtyBox:"backgroundColor borderColor borderWidth borderRadius plotBackgroundColor plotBackgroundImage plotBorderColor plotBorderWidth plotShadow shadow".split(" "),propsRequireReflow:"margin marginTop marginRight marginBottom marginLeft spacing spacingTop spacingRight spacingBottom spacingLeft".split(" "),propsRequireUpdateSeries:"chart.inverted chart.polar chart.ignoreHiddenSeries chart.type colors plotOptions time tooltip".split(" ")}),s})),M(o,"Core/Legend/LegendSymbol.js",[o["Core/Utilities.js"]],(function(s){var o,_=s.merge,S=s.pick;return function(s){s.drawLineMarker=function(s){var o=this.options,R=s.symbolWidth,O=s.symbolHeight,P=O/2,D=this.chart.renderer,N=this.legendGroup;s=s.baseline-Math.round(.3*s.fontMetrics.b);var V={},j=o.marker;this.chart.styledMode||(V={"stroke-width":o.lineWidth||0},o.dashStyle&&(V.dashstyle=o.dashStyle)),this.legendLine=D.path([["M",0,s],["L",R,s]]).addClass("highcharts-graph").attr(V).add(N),j&&!1!==j.enabled&&R&&(o=Math.min(S(j.radius,P),P),0===this.symbol.indexOf("url")&&(j=_(j,{width:O,height:O}),o=0),this.legendSymbol=R=D.symbol(this.symbol,R/2-o,s-o,2*o,2*o,j).addClass("highcharts-point").add(N),R.isMarker=!0)},s.drawRectangle=function(s,o){var _=s.symbolHeight,R=s.options.squareSymbol;o.legendSymbol=this.chart.renderer.rect(R?(s.symbolWidth-_)/2:0,s.baseline-_+1,R?_:s.symbolWidth,_,S(s.options.symbolRadius,_/2)).addClass("highcharts-point").attr({zIndex:3}).add(o.legendGroup)}}(o||(o={})),o})),M(o,"Core/Series/SeriesDefaults.js",[],(function(){return{lineWidth:2,allowPointSelect:!1,crisp:!0,showCheckbox:!1,animation:{duration:1e3},events:{},marker:{enabledThreshold:2,lineColor:"#ffffff",lineWidth:0,radius:4,states:{normal:{animation:!0},hover:{animation:{duration:50},enabled:!0,radiusPlus:2,lineWidthPlus:1},select:{fillColor:"#cccccc",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:{animation:{},align:"center",defer:!0,formatter:function(){var s=this.series.chart.numberFormatter;return"number"!=typeof this.y?"":s(this.y,-1)},padding:5,style:{fontSize:"11px",fontWeight:"bold",color:"contrast",textOutline:"1px contrast"},verticalAlign:"bottom",x:0,y:0},cropThreshold:300,opacity:1,pointRange:0,softThreshold:!0,states:{normal:{animation:!0},hover:{animation:{duration:50},lineWidthPlus:1,marker:{},halo:{size:10,opacity:.25}},select:{animation:{duration:0}},inactive:{animation:{duration:50},opacity:.2}},stickyTracking:!0,turboThreshold:1e3,findNearestPointBy:"x"}})),M(o,"Core/Series/Series.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/DefaultOptions.js"],o["Core/Foundation.js"],o["Core/Globals.js"],o["Core/Legend/LegendSymbol.js"],o["Core/Series/Point.js"],o["Core/Series/SeriesDefaults.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Renderer/SVG/SVGElement.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O,P,D,N,V){var j=s.animObject,K=s.setAnimation,W=o.defaultOptions,U=_.registerEventOptions,Y=S.hasTouch,$=S.svg,X=S.win,Z=D.seriesTypes,Q=V.addEvent,ee=V.arrayMax,te=V.arrayMin,ie=V.clamp,ae=V.cleanRecursively,ne=V.correctFloat,re=V.defined,se=V.erase,le=V.error,oe=V.extend,de=V.find,ce=V.fireEvent,he=V.getNestedProperty,ue=V.isArray,pe=V.isNumber,fe=V.isString,ge=V.merge,me=V.objectEach,ve=V.pick,ye=V.removeEvent,_e=V.splat,Se=V.syncTimeout;return s=function(){function a(){this.zones=this.yAxis=this.xAxis=this.userOptions=this.tooltipOptions=this.processedYData=this.processedXData=this.points=this.options=this.linkedSeries=this.index=this.eventsToUnbind=this.eventOptions=this.data=this.chart=this._i=void 0}return a.prototype.init=function(s,o){ce(this,"init",{options:o});var _=this,S=s.series;this.eventsToUnbind=[],_.chart=s,_.options=_.setOptions(o),o=_.options,_.linkedSeries=[],_.bindAxes(),oe(_,{name:o.name,state:"",visible:!1!==o.visible,selected:!0===o.selected}),U(this,o);var R,O=o.events;(O&&O.click||o.point&&o.point.events&&o.point.events.click||o.allowPointSelect)&&(s.runTrackerClick=!0),_.getColor(),_.getSymbol(),_.parallelArrays.forEach((function(s){_[s+"Data"]||(_[s+"Data"]=[])})),_.isCartesian&&(s.hasCartesianSeries=!0),S.length&&(R=S[S.length-1]),_._i=ve(R&&R._i,-1)+1,_.opacity=_.options.opacity,s.orderSeries(this.insert(S)),o.dataSorting&&o.dataSorting.enabled?_.setDataSortingOptions():_.points||_.data||_.setData(o.data,!1),ce(this,"afterInit")},a.prototype.is=function(s){return Z[s]&&this instanceof Z[s]},a.prototype.insert=function(s){var o,_=this.options.index;if(pe(_)){for(o=s.length;o--;)if(_>=ve(s[o].options.index,s[o]._i)){s.splice(o+1,0,this);break}-1===o&&s.unshift(this),o+=1}else s.push(this);return ve(o,s.length-1)},a.prototype.bindAxes=function(){var s,o=this,_=o.options,S=o.chart;ce(this,"bindAxes",null,(function(){(o.axisTypes||[]).forEach((function(R){var O=0;S[R].forEach((function(S){s=S.options,(_[R]===O&&!s.isInternal||void 0!==_[R]&&_[R]===s.id||void 0===_[R]&&0===s.index)&&(o.insert(S.series),o[R]=S,S.isDirty=!0),s.isInternal||O++})),o[R]||o.optionalAxis===R||le(18,!0,S)}))})),ce(this,"afterBindAxes")},a.prototype.updateParallelArrays=function(s,o){var _=s.series,S=arguments,R=pe(o)?function(S){var R="y"===S&&_.toYData?_.toYData(s):s[S];_[S+"Data"][o]=R}:function(s){Array.prototype[o].apply(_[s+"Data"],Array.prototype.slice.call(S,2))};_.parallelArrays.forEach(R)},a.prototype.hasData=function(){return this.visible&&void 0!==this.dataMax&&void 0!==this.dataMin||this.visible&&this.yData&&0<this.yData.length},a.prototype.autoIncrement=function(s){var o,_=this.options,S=_.pointIntervalUnit,R=_.relativeXValue,O=this.chart.time,P=this.xIncrement;return P=ve(P,_.pointStart,0),this.pointInterval=o=ve(this.pointInterval,_.pointInterval,1),R&&pe(s)&&(o*=s),S&&(_=new O.Date(P),"day"===S?O.set("Date",_,O.get("Date",_)+o):"month"===S?O.set("Month",_,O.get("Month",_)+o):"year"===S&&O.set("FullYear",_,O.get("FullYear",_)+o),o=_.getTime()-P),R&&pe(s)?P+o:(this.xIncrement=P+o,P)},a.prototype.setDataSortingOptions=function(){var s=this.options;oe(this,{requireSorting:!1,sorted:!1,enabledDataSorting:!0,allowDG:!1}),re(s.pointRange)||(s.pointRange=1)},a.prototype.setOptions=function(s){var o=this.chart,_=o.options,S=_.plotOptions,R=o.userOptions||{};s=ge(s),o=o.styledMode;var O={plotOptions:S,userOptions:s};ce(this,"setOptions",O);var P=O.plotOptions[this.type],D=R.plotOptions||{};return this.userOptions=O.userOptions,R=ge(P,S.series,R.plotOptions&&R.plotOptions[this.type],s),this.tooltipOptions=ge(W.tooltip,W.plotOptions.series&&W.plotOptions.series.tooltip,W.plotOptions[this.type].tooltip,_.tooltip.userOptions,S.series&&S.series.tooltip,S[this.type].tooltip,s.tooltip),this.stickyTracking=ve(s.stickyTracking,D[this.type]&&D[this.type].stickyTracking,D.series&&D.series.stickyTracking,!(!this.tooltipOptions.shared||this.noSharedTooltip)||R.stickyTracking),null===P.marker&&delete R.marker,this.zoneAxis=R.zoneAxis,S=this.zones=(R.zones||[]).slice(),!R.negativeColor&&!R.negativeFillColor||R.zones||(_={value:R[this.zoneAxis+"Threshold"]||R.threshold||0,className:"highcharts-negative"},o||(_.color=R.negativeColor,_.fillColor=R.negativeFillColor),S.push(_)),S.length&&re(S[S.length-1].value)&&S.push(o?{}:{color:this.color,fillColor:this.fillColor}),ce(this,"afterSetOptions",{options:R}),R},a.prototype.getName=function(){return ve(this.options.name,"Series "+(this.index+1))},a.prototype.getCyclic=function(s,o,_){var S=this.chart,R=this.userOptions,O=s+"Index",P=s+"Counter",D=_?_.length:ve(S.options.chart[s+"Count"],S[s+"Count"]);if(!o){var N=ve(R[O],R["_"+O]);re(N)||(S.series.length||(S[P]=0),R["_"+O]=N=S[P]%D,S[P]+=1),_&&(o=_[N])}void 0!==N&&(this[O]=N),this[s]=o},a.prototype.getColor=function(){this.chart.styledMode?this.getCyclic("color"):this.options.colorByPoint?this.color="#cccccc":this.getCyclic("color",this.options.color||W.plotOptions[this.type].color,this.chart.options.colors)},a.prototype.getPointsCollection=function(){return(this.hasGroupedData?this.points:this.data)||[]},a.prototype.getSymbol=function(){this.getCyclic("symbol",this.options.marker.symbol,this.chart.options.symbols)},a.prototype.findPointIndex=function(s,o){var _,S,R=s.id,P=s.x,D=this.points,N=this.options.dataSorting;if(R)(N=this.chart.get(R))instanceof O&&(_=N);else if((this.linkedParent||this.enabledDataSorting||this.options.relativeXValue)&&(_=function(o){return!o.touched&&o.index===s.index},N&&N.matchByName?_=function(o){return!o.touched&&o.name===s.name}:this.options.relativeXValue&&(_=function(o){return!o.touched&&o.options.x===s.x}),!(_=de(D,_))))return;if(_){var V=_&&_.index;void 0!==V&&(S=!0)}return void 0===V&&pe(P)&&(V=this.xData.indexOf(P,o)),-1!==V&&void 0!==V&&this.cropped&&(V=V>=this.cropStart?V-this.cropStart:V),!S&&pe(V)&&D[V]&&D[V].touched&&(V=void 0),V},a.prototype.updateData=function(s,o){var _,S,R,O=this.options,P=O.dataSorting,D=this.points,N=[],V=this.requireSorting,j=s.length===D.length,K=!0;if(this.xIncrement=null,s.forEach((function(s,o){var S=re(s)&&this.pointClass.prototype.optionsToObject.call({series:this},s)||{},K=S.x;S.id||pe(K)?(-1===(S=this.findPointIndex(S,R))||void 0===S?N.push(s):D[S]&&s!==O.data[S]?(D[S].update(s,!1,null,!1),D[S].touched=!0,V&&(R=S+1)):D[S]&&(D[S].touched=!0),(!j||o!==S||P&&P.enabled||this.hasDerivedData)&&(_=!0)):N.push(s)}),this),_)for(s=D.length;s--;)(S=D[s])&&!S.touched&&S.remove&&S.remove(!1,o);else!j||P&&P.enabled?K=!1:(s.forEach((function(s,o){s!==D[o].y&&D[o].update&&D[o].update(s,!1,null,!1)})),N.length=0);return D.forEach((function(s){s&&(s.touched=!1)})),!!K&&(N.forEach((function(s){this.addPoint(s,!1,null,null,!1)}),this),null===this.xIncrement&&this.xData&&this.xData.length&&(this.xIncrement=ee(this.xData),this.autoIncrement()),!0)},a.prototype.setData=function(s,o,_,S){var R=this,O=R.points,P=O&&O.length||0,D=R.options,N=R.chart,V=D.dataSorting,j=R.xAxis,K=D.turboThreshold,W=this.xData,U=this.yData,Y=R.pointArrayMap;Y=Y&&Y.length;var $,X=D.keys,Z=0,Q=1,ee=null,te=(s=s||[]).length;if(o=ve(o,!0),V&&V.enabled&&(s=this.sortData(s)),!1!==S&&te&&P&&!R.cropped&&!R.hasGroupedData&&R.visible&&!R.isSeriesBoosting&&($=this.updateData(s,_)),!$){if(R.xIncrement=null,R.colorCounter=0,this.parallelArrays.forEach((function(s){R[s+"Data"].length=0})),K&&te>K)if(ee=R.getFirstValidPoint(s),pe(ee))for(_=0;_<te;_++)W[_]=this.autoIncrement(),U[_]=s[_];else if(ue(ee))if(Y)if(ee.length===Y)for(_=0;_<te;_++)W[_]=this.autoIncrement(),U[_]=s[_];else for(_=0;_<te;_++)S=s[_],W[_]=S[0],U[_]=S.slice(1,Y+1);else if(X&&(Z=0<=(Z=X.indexOf("x"))?Z:0,Q=0<=(Q=X.indexOf("y"))?Q:1),1===ee.length&&(Q=0),Z===Q)for(_=0;_<te;_++)W[_]=this.autoIncrement(),U[_]=s[_][Q];else for(_=0;_<te;_++)S=s[_],W[_]=S[Z],U[_]=S[Q];else le(12,!1,N);else for(_=0;_<te;_++)void 0!==s[_]&&(S={series:R},R.pointClass.prototype.applyOptions.apply(S,[s[_]]),R.updateParallelArrays(S,_));for(U&&fe(U[0])&&le(14,!0,N),R.data=[],R.options.data=R.userOptions.data=s,_=P;_--;)O[_]&&O[_].destroy&&O[_].destroy();j&&(j.minRange=j.userMinRange),R.isDirty=N.isDirtyBox=!0,R.isDirtyData=!!O,_=!1}"point"===D.legendType&&(this.processData(),this.generatePoints()),o&&N.redraw(_)},a.prototype.sortData=function(s){var o=this,_=o.options.dataSorting.sortKey||"y",d=function(s,o){return re(o)&&s.pointClass.prototype.optionsToObject.call({series:s},o)||{}};return s.forEach((function(_,S){s[S]=d(o,_),s[S].index=S}),this),s.concat().sort((function(s,o){return s=he(_,s),(o=he(_,o))<s?-1:o>s?1:0})).forEach((function(s,o){s.x=o}),this),o.linkedSeries&&o.linkedSeries.forEach((function(o){var _=o.options,S=_.data;_.dataSorting&&_.dataSorting.enabled||!S||(S.forEach((function(_,R){S[R]=d(o,_),s[R]&&(S[R].x=s[R].x,S[R].index=R)})),o.setData(S,!1))})),s},a.prototype.getProcessedData=function(s){var o=this.xAxis,_=this.options,S=_.cropThreshold,R=s||this.getExtremesFromAll||_.getExtremesFromAll,O=this.isCartesian;s=o&&o.val2lin,_=!(!o||!o.logarithmic);var P=0,D=this.xData,N=this.yData,V=this.requireSorting,j=!1,K=D.length;if(o){var W=(j=o.getExtremes()).min,U=j.max;j=o.categories&&!o.names.length}if(O&&this.sorted&&!R&&(!S||K>S||this.forceCrop))if(D[K-1]<W||D[0]>U)D=[],N=[];else if(this.yData&&(D[0]<W||D[K-1]>U)){var Y=this.cropData(this.xData,this.yData,W,U);D=Y.xData,N=Y.yData,P=Y.start,Y=!0}for(S=D.length||1;--S;)if(0<(o=_?s(D[S])-s(D[S-1]):D[S]-D[S-1])&&(void 0===$||o<$))var $=o;else 0>o&&V&&!j&&(le(15,!1,this.chart),V=!1);return{xData:D,yData:N,cropped:Y,cropStart:P,closestPointRange:$}},a.prototype.processData=function(s){var o=this.xAxis;if(this.isCartesian&&!this.isDirty&&!o.isDirty&&!this.yAxis.isDirty&&!s)return!1;s=this.getProcessedData(),this.cropped=s.cropped,this.cropStart=s.cropStart,this.processedXData=s.xData,this.processedYData=s.yData,this.closestPointRange=this.basePointRange=s.closestPointRange,ce(this,"afterProcessData")},a.prototype.cropData=function(s,o,_,S,R){var O,P=s.length,D=0,N=P;for(R=ve(R,this.cropShoulder),O=0;O<P;O++)if(s[O]>=_){D=Math.max(0,O-R);break}for(_=O;_<P;_++)if(s[_]>S){N=_+R;break}return{xData:s.slice(D,N),yData:o.slice(D,N),start:D,end:N}},a.prototype.generatePoints=function(){var s=this.options,o=s.data,_=this.processedXData,S=this.processedYData,R=this.pointClass,O=_.length,P=this.cropStart||0,D=this.hasGroupedData,N=s.keys,V=[];s=s.dataGrouping&&s.dataGrouping.groupAll?P:0;var j,K,W=this.data;if(!W&&!D){var U=[];U.length=o.length,W=this.data=U}for(N&&D&&(this.options.keys=!1),K=0;K<O;K++){if(U=P+K,D){var Y=(new R).init(this,[_[K]].concat(_e(S[K])));Y.dataGroup=this.groupMap[s+K],Y.dataGroup.options&&(Y.options=Y.dataGroup.options,oe(Y,Y.dataGroup.options),delete Y.dataLabels)}else(Y=W[U])||void 0===o[U]||(W[U]=Y=(new R).init(this,o[U],_[K]));Y&&(Y.index=D?s+K:U,V[K]=Y)}if(this.options.keys=N,W&&(O!==(j=W.length)||D))for(K=0;K<j;K++)K!==P||D||(K+=O),W[K]&&(W[K].destroyElements(),W[K].plotX=void 0);this.data=W,this.points=V,ce(this,"afterGeneratePoints")},a.prototype.getXExtremes=function(s){return{min:te(s),max:ee(s)}},a.prototype.getExtremes=function(s,o){var _=this.xAxis,S=this.yAxis,R=this.processedXData||this.xData,O=[],P=this.requireSorting?this.cropShoulder:0;S=!!S&&S.positiveValuesOnly;var D,N=0,V=0,j=0,K=(s=s||this.stackedYData||this.processedYData||[]).length;if(_){var W=_.getExtremes();N=W.min,V=W.max}for(D=0;D<K;D++){var U=R[D];W=s[D];var Y=(pe(W)||ue(W))&&(W.length||0<W||!S);if(U=o||this.getExtremesFromAll||this.options.getExtremesFromAll||this.cropped||!_||(R[D+P]||U)>=N&&(R[D-P]||U)<=V,Y&&U)if(Y=W.length)for(;Y--;)pe(W[Y])&&(O[j++]=W[Y]);else O[j++]=W}return s={activeYData:O,dataMin:te(O),dataMax:ee(O)},ce(this,"afterGetExtremes",{dataExtremes:s}),s},a.prototype.applyExtremes=function(){var s=this.getExtremes();return this.dataMin=s.dataMin,this.dataMax=s.dataMax,s},a.prototype.getFirstValidPoint=function(s){for(var o=s.length,_=0,S=null;null===S&&_<o;)S=s[_],_++;return S},a.prototype.translate=function(){this.processedXData||this.processData(),this.generatePoints();var s,o,_=this.options,S=_.stacking,R=this.xAxis,O=R.categories,P=this.enabledDataSorting,D=this.yAxis,N=this.points,V=N.length,j=this.pointPlacementToXValue(),K=!!j,W=_.threshold,U=_.startFromThreshold?W:0,Y=this.zoneAxis||"y",$=Number.MAX_VALUE;for(s=0;s<V;s++){var X=N[s],Z=X.x,Q=void 0,ee=void 0,te=X.y,ae=X.low,se=S&&D.stacking&&D.stacking.stacks[(this.negStacks&&te<(U?0:W)?"-":"")+this.stackKey];if((D.positiveValuesOnly&&!D.validatePositiveValue(te)||R.positiveValuesOnly&&!R.validatePositiveValue(Z))&&(X.isNull=!0),X.plotX=o=ne(ie(R.translate(Z,0,0,0,1,j,"flags"===this.type),-1e5,1e5)),S&&this.visible&&se&&se[Z]){var le=this.getStackIndicator(le,Z,this.index);X.isNull||(ee=(Q=se[Z]).points[le.key])}if(ue(ee)&&(ae=ee[0],te=ee[1],ae===U&&le.key===se[Z].base&&(ae=ve(pe(W)&&W,D.min)),D.positiveValuesOnly&&0>=ae&&(ae=null),X.total=X.stackTotal=Q.total,X.percentage=Q.total&&X.y/Q.total*100,X.stackY=te,this.irregularWidths||Q.setOffset(this.pointXOffset||0,this.barW||0)),X.yBottom=re(ae)?ie(D.translate(ae,0,1,0,1),-1e5,1e5):null,this.dataModify&&(te=this.dataModify.modifyValue(te,s)),X.plotY=void 0,pe(te)&&(void 0!==(Q=D.translate(te,!1,!0,!1,!0))&&(X.plotY=ie(Q,-1e5,1e5))),X.isInside=this.isPointInside(X),X.clientX=K?ne(R.translate(Z,0,0,0,1,j)):o,X.negative=X[Y]<(_[Y+"Threshold"]||W||0),X.category=O&&void 0!==O[X.x]?O[X.x]:X.x,!X.isNull&&!1!==X.visible){void 0!==oe&&($=Math.min($,Math.abs(o-oe)));var oe=o}X.zone=this.zones.length?X.getZone():void 0,!X.graphic&&this.group&&P&&(X.isNew=!0)}this.closestPointRangePx=$,ce(this,"afterTranslate")},a.prototype.getValidPoints=function(s,o,_){var S=this.chart;return(s||this.points||[]).filter((function(s){return!(o&&!S.isInsidePlot(s.plotX,s.plotY,{inverted:S.inverted}))&&(!1!==s.visible&&(_||!s.isNull))}))},a.prototype.getClipBox=function(){var s=this.chart,o=this.xAxis,_=this.yAxis,S=ge(s.clipBox);return o&&o.len!==s.plotSizeX&&(S.width=o.len),_&&_.len!==s.plotSizeY&&(S.height=_.len),S},a.prototype.getSharedClipKey=function(){return this.sharedClipKey=(this.options.xAxis||0)+","+(this.options.yAxis||0)},a.prototype.setClip=function(){var s=this.chart,o=this.group,_=this.markerGroup,S=s.sharedClips;s=s.renderer;var R=this.getClipBox(),O=this.getSharedClipKey(),P=S[O];P?P.animate(R):S[O]=P=s.clipRect(R),o&&o.clip(!1===this.options.clip?void 0:P),_&&_.clip()},a.prototype.animate=function(s){var o=this.chart,_=this.group,S=this.markerGroup,R=o.inverted,O=j(this.options.animation),P=[this.getSharedClipKey(),O.duration,O.easing,O.defer].join(),D=o.sharedClips[P],N=o.sharedClips[P+"m"];if(s&&_)O=this.getClipBox(),D?D.attr("height",O.height):(O.width=0,R&&(O.x=o.plotHeight),D=o.renderer.clipRect(O),o.sharedClips[P]=D,N=o.renderer.clipRect({x:R?(o.plotSizeX||0)+99:-99,y:R?-o.plotLeft:-o.plotTop,width:99,height:R?o.chartWidth:o.chartHeight}),o.sharedClips[P+"m"]=N),_.clip(D),S&&S.clip(N);else if(D&&!D.hasClass("highcharts-animating")){o=this.getClipBox();var V=O.step;S&&S.element.childNodes.length&&(O.step=function(s,o){V&&V.apply(o,arguments),N&&N.element&&N.attr(o.prop,"width"===o.prop?s+99:s)}),D.addClass("highcharts-animating").animate(o,O)}},a.prototype.afterAnimate=function(){var s=this;this.setClip(),me(this.chart.sharedClips,(function(o,_,S){o&&!s.chart.container.querySelector('[clip-path="url(#'+o.id+')"]')&&(o.destroy(),delete S[_])})),this.finishedAnimating=!0,ce(this,"afterAnimate")},a.prototype.drawPoints=function(){var s,o,_=this.points,S=this.chart,R=this.options.marker,O=this[this.specialGroup]||this.markerGroup,P=this.xAxis,D=ve(R.enabled,!(P&&!P.isRadial)||null,this.closestPointRangePx>=R.enabledThreshold*R.radius);if(!1!==R.enabled||this._hasPointMarkers)for(s=0;s<_.length;s++){var N=_[s],V=(o=N.graphic)?"animate":"attr",j=N.marker||{},K=!!N.marker;if((D&&void 0===j.enabled||j.enabled)&&!N.isNull&&!1!==N.visible){var W=ve(j.symbol,this.symbol,"rect"),U=this.markerAttribs(N,N.selected&&"select");this.enabledDataSorting&&(N.startXPos=P.reversed?-(U.width||0):P.width);var Y=!1!==N.isInside;o?o[Y?"show":"hide"](Y).animate(U):Y&&(0<(U.width||0)||N.hasImage)&&(N.graphic=o=S.renderer.symbol(W,U.x,U.y,U.width,U.height,K?j:R).add(O),this.enabledDataSorting&&S.hasRendered&&(o.attr({x:N.startXPos}),V="animate")),o&&"animate"===V&&o[Y?"show":"hide"](Y).animate(U),o&&!S.styledMode&&o[V](this.pointAttribs(N,N.selected&&"select")),o&&o.addClass(N.getClassName(),!0)}else o&&(N.graphic=o.destroy())}},a.prototype.markerAttribs=function(s,o){var _=this.options,S=_.marker,R=s.marker||{},O=R.symbol||S.symbol,P=ve(R.radius,S.radius);return o&&(S=S.states[o],o=R.states&&R.states[o],P=ve(o&&o.radius,S&&S.radius,P+(S&&S.radiusPlus||0))),s.hasImage=O&&0===O.indexOf("url"),s.hasImage&&(P=0),s={x:_.crisp?Math.floor(s.plotX-P):s.plotX-P,y:s.plotY-P},P&&(s.width=s.height=2*P),s},a.prototype.pointAttribs=function(s,o){var _=this.options.marker,S=s&&s.options,R=S&&S.marker||{},O=S&&S.color,P=s&&s.color,D=s&&s.zone&&s.zone.color,N=this.color;return s=ve(R.lineWidth,_.lineWidth),S=1,N=O||D||P||N,O=R.fillColor||_.fillColor||N,P=R.lineColor||_.lineColor||N,o=o||"normal",_=_.states[o]||{},o=R.states&&R.states[o]||{},s=ve(o.lineWidth,_.lineWidth,s+ve(o.lineWidthPlus,_.lineWidthPlus,0)),O=o.fillColor||_.fillColor||O,{stroke:P=o.lineColor||_.lineColor||P,"stroke-width":s,fill:O,opacity:S=ve(o.opacity,_.opacity,S)}},a.prototype.destroy=function(s){var o,_,S,R=this,O=R.chart,P=/AppleWebKit\/533/.test(X.navigator.userAgent),D=R.data||[];for(ce(R,"destroy"),this.removeEvents(s),(R.axisTypes||[]).forEach((function(s){(S=R[s])&&S.series&&(se(S.series,R),S.isDirty=S.forceRedraw=!0)})),R.legendItem&&R.chart.legend.destroyItem(R),o=D.length;o--;)(_=D[o])&&_.destroy&&_.destroy();R.clips&&R.clips.forEach((function(s){return s.destroy()})),V.clearTimeout(R.animationTimeout),me(R,(function(s,o){s instanceof N&&!s.survive&&s[P&&"group"===o?"hide":"destroy"]()})),O.hoverSeries===R&&(O.hoverSeries=void 0),se(O.series,R),O.orderSeries(),me(R,(function(o,_){s&&"hcEvents"===_||delete R[_]}))},a.prototype.applyZones=function(){var s,o,_,S,R,O,P,D,N=this,V=this.chart,j=V.renderer,K=this.zones,W=this.clips||[],U=this.graph,Y=this.area,$=Math.max(V.chartWidth,V.chartHeight),X=this[(this.zoneAxis||"y")+"Axis"],Z=V.inverted,Q=!1;if(K.length&&(U||Y)&&X&&void 0!==X.min){var ee=X.reversed,te=X.horiz;U&&!this.showLine&&U.hide(),Y&&Y.hide();var ae=X.getExtremes();K.forEach((function(K,ne){s=ee?te?V.plotWidth:0:te?0:X.toPixels(ae.min)||0,s=ie(ve(o,s),0,$),o=ie(Math.round(X.toPixels(ve(K.value,ae.max),!0)||0),0,$),Q&&(s=o=X.toPixels(ae.max)),S=Math.abs(s-o),R=Math.min(s,o),O=Math.max(s,o),X.isXAxis?(_={x:Z?O:R,y:0,width:S,height:$},te||(_.x=V.plotHeight-_.x)):(_={x:0,y:Z?O:R,width:$,height:S},te&&(_.y=V.plotWidth-_.y)),Z&&j.isVML&&(_=X.isXAxis?{x:0,y:ee?R:O,height:_.width,width:V.chartWidth}:{x:_.y-V.plotLeft-V.spacingBox.x,y:0,width:_.height,height:V.chartHeight}),W[ne]?W[ne].animate(_):W[ne]=j.clipRect(_),P=N["zone-area-"+ne],D=N["zone-graph-"+ne],U&&D&&D.clip(W[ne]),Y&&P&&P.clip(W[ne]),Q=K.value>ae.max,N.resetZones&&0===o&&(o=void 0)})),this.clips=W}else N.visible&&(U&&U.show(!0),Y&&Y.show(!0))},a.prototype.invertGroups=function(s){function b(){["group","markerGroup"].forEach((function(S){o[S]&&(_.renderer.isVML&&o[S].attr({width:o.yAxis.len,height:o.xAxis.len}),o[S].width=o.yAxis.len,o[S].height=o.xAxis.len,o[S].invert(!o.isRadialSeries&&s))}))}var o=this,_=o.chart;o.xAxis&&(o.eventsToUnbind.push(Q(_,"resize",b)),b(),o.invertGroups=b)},a.prototype.plotGroup=function(s,o,_,S,R){var O=this[s],P=!O;return _={visibility:_,zIndex:S||.1},void 0===this.opacity||this.chart.styledMode||"inactive"===this.state||(_.opacity=this.opacity),P&&(this[s]=O=this.chart.renderer.g().add(R)),O.addClass("highcharts-"+o+" highcharts-series-"+this.index+" highcharts-"+this.type+"-series "+(re(this.colorIndex)?"highcharts-color-"+this.colorIndex+" ":"")+(this.options.className||"")+(O.hasClass("highcharts-tracker")?" highcharts-tracker":""),!0),O.attr(_)[P?"attr":"animate"](this.getPlotBox()),O},a.prototype.getPlotBox=function(){var s=this.chart,o=this.xAxis,_=this.yAxis;return s.inverted&&(o=_,_=this.xAxis),{translateX:o?o.left:s.plotLeft,translateY:_?_.top:s.plotTop,scaleX:1,scaleY:1}},a.prototype.removeEvents=function(s){s||ye(this),this.eventsToUnbind.length&&(this.eventsToUnbind.forEach((function(s){s()})),this.eventsToUnbind.length=0)},a.prototype.render=function(){var s=this,o=s.chart,_=s.options,S=j(_.animation),R=s.visible?"inherit":"hidden",O=_.zIndex,P=s.hasRendered,D=o.seriesGroup,N=o.inverted;o=!s.finishedAnimating&&o.renderer.isSVG?S.duration:0,ce(this,"render");var V=s.plotGroup("group","series",R,O,D);s.markerGroup=s.plotGroup("markerGroup","markers",R,O,D),!1!==_.clip&&s.setClip(),s.animate&&o&&s.animate(!0),V.inverted=!!ve(s.invertible,s.isCartesian)&&N,s.drawGraph&&(s.drawGraph(),s.applyZones()),s.visible&&s.drawPoints(),s.drawDataLabels&&s.drawDataLabels(),s.redrawPoints&&s.redrawPoints(),s.drawTracker&&!1!==s.options.enableMouseTracking&&s.drawTracker(),s.invertGroups(N),s.animate&&o&&s.animate(),P||(o&&S.defer&&(o+=S.defer),s.animationTimeout=Se((function(){s.afterAnimate()}),o||0)),s.isDirty=!1,s.hasRendered=!0,ce(s,"afterRender")},a.prototype.redraw=function(){var s=this.chart,o=this.isDirty||this.isDirtyData,_=this.group,S=this.xAxis,R=this.yAxis;_&&(s.inverted&&_.attr({width:s.plotWidth,height:s.plotHeight}),_.animate({translateX:ve(S&&S.left,s.plotLeft),translateY:ve(R&&R.top,s.plotTop)})),this.translate(),this.render(),o&&delete this.kdTree},a.prototype.searchPoint=function(s,o){var _=this.xAxis,S=this.yAxis,R=this.chart.inverted;return this.searchKDTree({clientX:R?_.len-s.chartY+_.pos:s.chartX-_.pos,plotY:R?S.len-s.chartX+S.pos:s.chartY-S.pos},o,s)},a.prototype.buildKDTree=function(s){this.buildingKdTree=!0;var o=this,_=-1<o.options.findNearestPointBy.indexOf("y")?2:1;delete o.kdTree,Se((function(){o.kdTree=function b(s,_,S){var R=s&&s.length;if(R){var O=o.kdAxisArray[_%S];return s.sort((function(s,o){return s[O]-o[O]})),{point:s[R=Math.floor(R/2)],left:b(s.slice(0,R),_+1,S),right:b(s.slice(R+1),_+1,S)}}}(o.getValidPoints(null,!o.directTouch),_,_),o.buildingKdTree=!1}),o.options.kdNow||s&&"touchstart"===s.type?0:1)},a.prototype.searchKDTree=function(s,o,_){var S=this,R=this.kdAxisArray[0],O=this.kdAxisArray[1],P=o?"distX":"dist";if(o=-1<S.options.findNearestPointBy.indexOf("y")?2:1,this.kdTree||this.buildingKdTree||this.buildKDTree(_),this.kdTree)return function d(s,o,_,D){var N=o.point,V=S.kdAxisArray[_%D],j=N,K=re(s[R])&&re(N[R])?Math.pow(s[R]-N[R],2):null,W=re(s[O])&&re(N[O])?Math.pow(s[O]-N[O],2):null;return W=(K||0)+(W||0),N.dist=re(W)?Math.sqrt(W):Number.MAX_VALUE,N.distX=re(K)?Math.sqrt(K):Number.MAX_VALUE,K=0>(V=s[V]-N[V])?"right":"left",o[W=0>V?"left":"right"]&&(j=(W=d(s,o[W],_+1,D))[P]<j[P]?W:N),o[K]&&Math.sqrt(V*V)<j[P]&&(j=(s=d(s,o[K],_+1,D))[P]<j[P]?s:j),j}(s,this.kdTree,o,o)},a.prototype.pointPlacementToXValue=function(){var s=this.options,o=s.pointRange,_=this.xAxis;return"between"===(s=s.pointPlacement)&&(s=_.reversed?-.5:.5),pe(s)?s*(o||_.pointRange):0},a.prototype.isPointInside=function(s){var o=this.chart,_=this.xAxis,S=this.yAxis;return void 0!==s.plotY&&void 0!==s.plotX&&0<=s.plotY&&s.plotY<=(S?S.len:o.plotHeight)&&0<=s.plotX&&s.plotX<=(_?_.len:o.plotWidth)},a.prototype.drawTracker=function(){var s=this,o=s.options,_=o.trackByArea,S=[].concat(_?s.areaPath:s.graphPath),R=s.chart,O=R.pointer,P=R.renderer,D=R.options.tooltip.snap,N=s.tracker,k=function(o){R.hoverSeries!==s&&s.onMouseOver()},V="rgba(192,192,192,"+($?1e-4:.002)+")";N?N.attr({d:S}):s.graph&&(s.tracker=P.path(S).attr({visibility:s.visible?"visible":"hidden",zIndex:2}).addClass(_?"highcharts-tracker-area":"highcharts-tracker-line").add(s.group),R.styledMode||s.tracker.attr({"stroke-linecap":"round","stroke-linejoin":"round",stroke:V,fill:_?V:"none","stroke-width":s.graph.strokeWidth()+(_?0:2*D)}),[s.tracker,s.markerGroup,s.dataLabelsGroup].forEach((function(s){s&&(s.addClass("highcharts-tracker").on("mouseover",k).on("mouseout",(function(s){O.onTrackerMouseOut(s)})),o.cursor&&!R.styledMode&&s.css({cursor:o.cursor}),Y)&&s.on("touchstart",k)}))),ce(this,"afterDrawTracker")},a.prototype.addPoint=function(s,o,_,S,R){var O=this.options,P=this.data,D=this.chart,N=this.xAxis;N=N&&N.hasNames&&N.names;var V,j=O.data,K=this.xData;o=ve(o,!0);var W={series:this};this.pointClass.prototype.applyOptions.apply(W,[s]);var U=W.x,Y=K.length;if(this.requireSorting&&U<K[Y-1])for(V=!0;Y&&K[Y-1]>U;)Y--;this.updateParallelArrays(W,"splice",Y,0,0),this.updateParallelArrays(W,Y),N&&W.name&&(N[U]=W.name),j.splice(Y,0,s),V&&(this.data.splice(Y,0,null),this.processData()),"point"===O.legendType&&this.generatePoints(),_&&(P[0]&&P[0].remove?P[0].remove(!1):(P.shift(),this.updateParallelArrays(W,"shift"),j.shift())),!1!==R&&ce(this,"addPoint",{point:W}),this.isDirtyData=this.isDirty=!0,o&&D.redraw(S)},a.prototype.removePoint=function(s,o,_){var S=this,R=S.data,O=R[s],P=S.points,D=S.chart,k=function(){P&&P.length===R.length&&P.splice(s,1),R.splice(s,1),S.options.data.splice(s,1),S.updateParallelArrays(O||{series:S},"splice",s,1),O&&O.destroy(),S.isDirty=!0,S.isDirtyData=!0,o&&D.redraw()};K(_,D),o=ve(o,!0),O?O.firePointEvent("remove",null,k):k()},a.prototype.remove=function(s,o,_,S){function e(){R.destroy(S),O.isDirtyLegend=O.isDirtyBox=!0,O.linkSeries(),ve(s,!0)&&O.redraw(o)}var R=this,O=R.chart;!1!==_?ce(R,"remove",null,e):e()},a.prototype.update=function(s,o){s=ae(s,this.userOptions),ce(this,"update",{options:s});var _,S=this,R=S.chart,O=S.userOptions,P=S.initialType||S.type,D=R.options.plotOptions,N=Z[P].prototype,V=S.finishedAnimating&&{animation:!1},j={},K=["eventOptions","navigatorSeries","baseSeries"],W=s.type||O.type||R.options.chart.type,U=!(this.hasDerivedData||W&&W!==this.type||void 0!==s.pointStart||void 0!==s.pointInterval||void 0!==s.relativeXValue||S.hasOptionChanged("dataGrouping")||S.hasOptionChanged("pointStart")||S.hasOptionChanged("pointInterval")||S.hasOptionChanged("pointIntervalUnit")||S.hasOptionChanged("keys"));if(W=W||P,U&&(K.push("data","isDirtyData","points","processedXData","processedYData","xIncrement","cropped","_hasPointMarkers","_hasPointLabels","clips","nodes","layout","mapMap","mapData","minY","maxY","minX","maxX"),!1!==s.visible&&K.push("area","graph"),S.parallelArrays.forEach((function(s){K.push(s+"Data")})),s.data&&(s.dataSorting&&oe(S.options.dataSorting,s.dataSorting),this.setData(s.data,!1))),s=ge(O,V,{index:void 0===O.index?S.index:O.index,pointStart:ve(D&&D.series&&D.series.pointStart,O.pointStart,S.xData[0])},!U&&{data:S.options.data},s),U&&s.data&&(s.data=S.options.data),(K=["group","markerGroup","dataLabelsGroup","transformGroup"].concat(K)).forEach((function(s){K[s]=S[s],delete S[s]})),D=!1,Z[W]){if(D=W!==S.type,S.remove(!1,!1,!1,!0),D)if(Object.setPrototypeOf)Object.setPrototypeOf(S,Z[W].prototype);else{for(_ in V=Object.hasOwnProperty.call(S,"hcEvents")&&S.hcEvents,N)S[_]=void 0;oe(S,Z[W].prototype),V?S.hcEvents=V:delete S.hcEvents}}else le(17,!0,R,{missingModuleFor:W});if(K.forEach((function(s){S[s]=K[s]})),S.init(R,s),U&&this.points){var Y=S.options;!1===Y.visible?(j.graphic=1,j.dataLabel=1):S._hasPointLabels||(s=Y.marker,N=Y.dataLabels,!s||!1!==s.enabled&&(O.marker&&O.marker.symbol)===s.symbol||(j.graphic=1),N&&!1===N.enabled&&(j.dataLabel=1)),this.points.forEach((function(s){s&&s.series&&(s.resolveColor(),Object.keys(j).length&&s.destroyElements(j),!1===Y.showInLegend&&s.legendItem&&R.legend.destroyItem(s))}),this)}S.initialType=P,R.linkSeries(),D&&S.linkedSeries.length&&(S.isDirtyData=!0),ce(this,"afterUpdate"),ve(o,!0)&&R.redraw(!!U&&void 0)},a.prototype.setName=function(s){this.name=this.options.name=this.userOptions.name=s,this.chart.isDirtyLegend=!0},a.prototype.hasOptionChanged=function(s){var o=this.options[s],_=this.chart.options.plotOptions,S=this.userOptions[s];return S?o!==S:o!==ve(_&&_[this.type]&&_[this.type][s],_&&_.series&&_.series[s],o)},a.prototype.onMouseOver=function(){var s=this.chart,o=s.hoverSeries;s.pointer.setHoverChartIndex(),o&&o!==this&&o.onMouseOut(),this.options.events.mouseOver&&ce(this,"mouseOver"),this.setState("hover"),s.hoverSeries=this},a.prototype.onMouseOut=function(){var s=this.options,o=this.chart,_=o.tooltip,S=o.hoverPoint;o.hoverSeries=null,S&&S.onMouseOut(),this&&s.events.mouseOut&&ce(this,"mouseOut"),!_||this.stickyTracking||_.shared&&!this.noSharedTooltip||_.hide(),o.series.forEach((function(s){s.setState("",!0)}))},a.prototype.setState=function(s,o){var _=this,S=_.options,R=_.graph,O=S.inactiveOtherPoints,P=S.states,D=ve(P[s||"normal"]&&P[s||"normal"].animation,_.chart.options.chart.animation),N=S.lineWidth,V=0,j=S.opacity;if(s=s||"",_.state!==s&&([_.group,_.markerGroup,_.dataLabelsGroup].forEach((function(o){o&&(_.state&&o.removeClass("highcharts-series-"+_.state),s&&o.addClass("highcharts-series-"+s))})),_.state=s,!_.chart.styledMode)){if(P[s]&&!1===P[s].enabled)return;if(s&&(N=P[s].lineWidth||N+(P[s].lineWidthPlus||0),j=ve(P[s].opacity,j)),R&&!R.dashstyle)for(S={"stroke-width":N},R.animate(S,D);_["zone-graph-"+V];)_["zone-graph-"+V].animate(S,D),V+=1;O||[_.group,_.markerGroup,_.dataLabelsGroup,_.labelBySeries].forEach((function(s){s&&s.animate({opacity:j},D)}))}o&&O&&_.points&&_.setAllPointsToState(s||void 0)},a.prototype.setAllPointsToState=function(s){this.points.forEach((function(o){o.setState&&o.setState(s)}))},a.prototype.setVisible=function(s,o){var _=this,S=_.chart,R=_.legendItem,O=S.options.chart.ignoreHiddenSeries,P=_.visible,D=(_.visible=s=_.options.visible=_.userOptions.visible=void 0===s?!P:s)?"show":"hide";["group","dataLabelsGroup","markerGroup","tracker","tt"].forEach((function(s){_[s]&&_[s][D]()})),S.hoverSeries!==_&&(S.hoverPoint&&S.hoverPoint.series)!==_||_.onMouseOut(),R&&S.legend.colorizeItem(_,s),_.isDirty=!0,_.options.stacking&&S.series.forEach((function(s){s.options.stacking&&s.visible&&(s.isDirty=!0)})),_.linkedSeries.forEach((function(o){o.setVisible(s,!1)})),O&&(S.isDirtyBox=!0),ce(_,D),!1!==o&&S.redraw()},a.prototype.show=function(){this.setVisible(!0)},a.prototype.hide=function(){this.setVisible(!1)},a.prototype.select=function(s){this.selected=s=this.options.selected=void 0===s?!this.selected:s,this.checkbox&&(this.checkbox.checked=s),ce(this,s?"select":"unselect")},a.prototype.shouldShowTooltip=function(s,o,_){return void 0===_&&(_={}),_.series=this,_.visiblePlotOnly=!0,this.chart.isInsidePlot(s,o,_)},a.defaultOptions=P,a}(),oe(s.prototype,{axisTypes:["xAxis","yAxis"],coll:"series",colorCounter:0,cropShoulder:1,directTouch:!1,drawLegendSymbol:R.drawLineMarker,isCartesian:!0,kdAxisArray:["clientX","plotY"],parallelArrays:["x","y"],pointClass:O,requireSorting:!0,sorted:!0}),D.series=s,s})),M(o,"Extensions/ScrollablePlotArea.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/Axis/Axis.js"],o["Core/Chart/Chart.js"],o["Core/Series/Series.js"],o["Core/Renderer/RendererRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O){var P=s.stop,D=O.addEvent,N=O.createElement,V=O.merge,j=O.pick;D(_,"afterSetChartSize",(function(s){var _=this.options.chart.scrollablePlotArea,S=_&&_.minWidth;if(_=_&&_.minHeight,!this.renderer.forExport){if(S){if(this.scrollablePixelsX=S=Math.max(0,S-this.chartWidth)){this.scrollablePlotBox=this.renderer.scrollablePlotBox=V(this.plotBox),this.plotBox.width=this.plotWidth+=S,this.inverted?this.clipBox.height+=S:this.clipBox.width+=S;var R={1:{name:"right",value:S}}}}else _&&(this.scrollablePixelsY=S=Math.max(0,_-this.chartHeight))&&(this.scrollablePlotBox=this.renderer.scrollablePlotBox=V(this.plotBox),this.plotBox.height=this.plotHeight+=S,this.inverted?this.clipBox.width+=S:this.clipBox.height+=S,R={2:{name:"bottom",value:S}});R&&!s.skipAxes&&this.axes.forEach((function(s){R[s.side]?s.getPlotLinePath=function(){var _=R[s.side].name,S=this[_];this[_]=S-R[s.side].value;var O=o.prototype.getPlotLinePath.apply(this,arguments);return this[_]=S,O}:(s.setAxisSize(),s.setAxisTranslation())}))}})),D(_,"render",(function(){this.scrollablePixelsX||this.scrollablePixelsY?(this.setUpScrolling&&this.setUpScrolling(),this.applyFixed()):this.fixedDiv&&this.applyFixed()})),_.prototype.setUpScrolling=function(){var s=this,o={WebkitOverflowScrolling:"touch",overflowX:"hidden",overflowY:"hidden"};this.scrollablePixelsX&&(o.overflowX="auto"),this.scrollablePixelsY&&(o.overflowY="auto"),this.scrollingParent=N("div",{className:"highcharts-scrolling-parent"},{position:"relative"},this.renderTo),this.scrollingContainer=N("div",{className:"highcharts-scrolling"},o,this.scrollingParent),D(this.scrollingContainer,"scroll",(function(){s.pointer&&delete s.pointer.chartPosition})),this.innerContainer=N("div",{className:"highcharts-inner-container"},null,this.scrollingContainer),this.innerContainer.appendChild(this.container),this.setUpScrolling=null},_.prototype.moveFixedElements=function(){var s,o=this.container,_=this.fixedRenderer,S=".highcharts-contextbutton .highcharts-credits .highcharts-legend .highcharts-legend-checkbox .highcharts-navigator-series .highcharts-navigator-xaxis .highcharts-navigator-yaxis .highcharts-navigator .highcharts-reset-zoom .highcharts-drillup-button .highcharts-scrollbar .highcharts-subtitle .highcharts-title".split(" ");this.scrollablePixelsX&&!this.inverted?s=".highcharts-yaxis":this.scrollablePixelsX&&this.inverted||this.scrollablePixelsY&&!this.inverted?s=".highcharts-xaxis":this.scrollablePixelsY&&this.inverted&&(s=".highcharts-yaxis"),s&&S.push(s+":not(.highcharts-radial-axis)",s+"-labels:not(.highcharts-radial-axis-labels)"),S.forEach((function(s){[].forEach.call(o.querySelectorAll(s),(function(s){(s.namespaceURI===_.SVG_NS?_.box:_.box.parentNode).appendChild(s),s.style.pointerEvents="auto"}))}))},_.prototype.applyFixed=function(){var s=!this.fixedDiv,o=this.options.chart,_=o.scrollablePlotArea,S=R.getRendererType();s?(this.fixedDiv=N("div",{className:"highcharts-fixed"},{position:"absolute",overflow:"hidden",pointerEvents:"none",zIndex:(o.style&&o.style.zIndex||0)+2,top:0},null,!0),this.scrollingContainer&&this.scrollingContainer.parentNode.insertBefore(this.fixedDiv,this.scrollingContainer),this.renderTo.style.overflow="visible",this.fixedRenderer=o=new S(this.fixedDiv,this.chartWidth,this.chartHeight,this.options.chart.style),this.scrollableMask=o.path().attr({fill:this.options.chart.backgroundColor||"#fff","fill-opacity":j(_.opacity,.85),zIndex:-1}).addClass("highcharts-scrollable-mask").add(),D(this,"afterShowResetZoom",this.moveFixedElements),D(this,"afterDrilldown",this.moveFixedElements),D(this,"afterLayOutTitles",this.moveFixedElements)):this.fixedRenderer.setSize(this.chartWidth,this.chartHeight),(this.scrollableDirty||s)&&(this.scrollableDirty=!1,this.moveFixedElements()),o=this.chartWidth+(this.scrollablePixelsX||0),S=this.chartHeight+(this.scrollablePixelsY||0),P(this.container),this.container.style.width=o+"px",this.container.style.height=S+"px",this.renderer.boxWrapper.attr({width:o,height:S,viewBox:[0,0,o,S].join(" ")}),this.chartBackground.attr({width:o,height:S}),this.scrollingContainer.style.height=this.chartHeight+"px",s&&(_.scrollPositionX&&(this.scrollingContainer.scrollLeft=this.scrollablePixelsX*_.scrollPositionX),_.scrollPositionY&&(this.scrollingContainer.scrollTop=this.scrollablePixelsY*_.scrollPositionY)),S=this.axisOffset,s=this.plotTop-S[0]-1,_=this.plotLeft-S[3]-1,o=this.plotTop+this.plotHeight+S[2]+1,S=this.plotLeft+this.plotWidth+S[1]+1;var O=this.plotLeft+this.plotWidth-(this.scrollablePixelsX||0),V=this.plotTop+this.plotHeight-(this.scrollablePixelsY||0);s=this.scrollablePixelsX?[["M",0,s],["L",this.plotLeft-1,s],["L",this.plotLeft-1,o],["L",0,o],["Z"],["M",O,s],["L",this.chartWidth,s],["L",this.chartWidth,o],["L",O,o],["Z"]]:this.scrollablePixelsY?[["M",_,0],["L",_,this.plotTop-1],["L",S,this.plotTop-1],["L",S,0],["Z"],["M",_,V],["L",_,this.chartHeight],["L",S,this.chartHeight],["L",S,V],["Z"]]:[["M",0,0]],"adjustHeight"!==this.redrawTrigger&&this.scrollableMask.attr({d:s})},D(o,"afterInit",(function(){this.chart.scrollableDirty=!0})),D(S,"show",(function(){this.chart.scrollableDirty=!0}))})),M(o,"Core/Axis/StackingAxis.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/Axis/Axis.js"],o["Core/Utilities.js"]],(function(s,o,_){var S,R=s.getDeferredAnimation,O=_.addEvent,P=_.destroyObjectProperties,D=_.fireEvent,N=_.isNumber,V=_.objectEach;return function(s){function e(){var s=this.stacking;if(s){var o=s.stacks;V(o,(function(s,_){P(s),o[_]=null})),s&&s.stackTotalGroup&&s.stackTotalGroup.destroy()}}function c(){this.stacking||(this.stacking=new _(this))}var o=[];s.compose=function(s){return-1===o.indexOf(s)&&(o.push(s),O(s,"init",c),O(s,"destroy",e)),s};var _=function(){function a(s){this.oldStacks={},this.stacks={},this.stacksTouched=0,this.axis=s}return a.prototype.buildStacks=function(){var s,o=this.axis,_=o.series,S=o.options.reversedStacks,R=_.length;if(!o.isXAxis){for(this.usePercentage=!1,s=R;s--;){var O=_[S?s:R-s-1];O.setStackedPoints(),O.setGroupedPoints()}for(s=0;s<R;s++)_[s].modifyStacks();D(o,"afterBuildStacks")}},a.prototype.cleanStacks=function(){if(!this.axis.isXAxis){if(this.oldStacks)var s=this.stacks=this.oldStacks;V(s,(function(s){V(s,(function(s){s.cumulative=s.total}))}))}},a.prototype.resetStacks=function(){var s=this,o=s.stacks;s.axis.isXAxis||V(o,(function(o){V(o,(function(_,S){N(_.touched)&&_.touched<s.stacksTouched?(_.destroy(),delete o[S]):(_.total=null,_.cumulative=null)}))}))},a.prototype.renderStackTotals=function(){var s=this.axis,o=s.chart,_=o.renderer,S=this.stacks;s=R(o,s.options.stackLabels&&s.options.stackLabels.animation||!1);var O=this.stackTotalGroup=this.stackTotalGroup||_.g("stack-labels").attr({visibility:"visible",zIndex:6,opacity:0}).add();O.translate(o.plotLeft,o.plotTop),V(S,(function(s){V(s,(function(s){s.render(O)}))})),O.animate({opacity:1},s)},a}();s.Additions=_}(S||(S={})),S})),M(o,"Extensions/Stacking.js",[o["Core/Axis/Axis.js"],o["Core/Chart/Chart.js"],o["Core/FormatUtilities.js"],o["Core/Globals.js"],o["Core/Series/Series.js"],o["Core/Axis/StackingAxis.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O,P){var D=_.format,N=P.correctFloat,V=P.defined,j=P.destroyObjectProperties,K=P.isArray,W=P.isNumber,U=P.objectEach,Y=P.pick,$=function(){function a(s,o,_,S,R){var O=s.chart.inverted;this.axis=s,this.isNegative=_,this.options=o=o||{},this.x=S,this.total=null,this.points={},this.hasValidPoints=!1,this.stack=R,this.rightCliff=this.leftCliff=0,this.alignOptions={align:o.align||(O?_?"left":"right":"center"),verticalAlign:o.verticalAlign||(O?"middle":_?"bottom":"top"),y:o.y,x:o.x},this.textAlign=o.textAlign||(O?_?"right":"left":"center")}return a.prototype.destroy=function(){j(this,this.axis)},a.prototype.render=function(s){var o=this.axis.chart,_=this.options,S=_.format;S=S?D(S,this,o):_.formatter.call(this),this.label?this.label.attr({text:S,visibility:"hidden"}):(this.label=o.renderer.label(S,null,null,_.shape,null,null,_.useHTML,!1,"stack-labels"),S={r:_.borderRadius||0,text:S,rotation:_.rotation,padding:Y(_.padding,5),visibility:"hidden"},o.styledMode||(S.fill=_.backgroundColor,S.stroke=_.borderColor,S["stroke-width"]=_.borderWidth,this.label.css(_.style)),this.label.attr(S),this.label.added||this.label.add(s)),this.label.labelrank=o.plotSizeY},a.prototype.setOffset=function(s,o,_,S,O){var P=this.axis,D=P.chart;S=P.translate(P.stacking.usePercentage?100:S||this.total,0,0,0,1),_=P.translate(_||0),_=V(S)&&Math.abs(S-_),s=Y(O,D.xAxis[0].translate(this.x))+s,P=V(S)&&this.getStackBox(D,this,s,S,o,_,P),o=this.label,_=this.isNegative,s="justify"===Y(this.options.overflow,"justify");var N=this.textAlign;o&&P&&(O=o.getBBox(),S=o.padding,N="left"===N?D.inverted?-S:S:"right"===N?O.width:D.inverted&&"center"===N?O.width/2:D.inverted?_?O.width+S:-S:O.width/2,_=D.inverted?O.height/2:_?-S:O.height,this.alignOptions.x=Y(this.options.x,0),this.alignOptions.y=Y(this.options.y,0),P.x-=N,P.y-=_,o.align(this.alignOptions,null,P),D.isInsidePlot(o.alignAttr.x+N-this.alignOptions.x,o.alignAttr.y+_-this.alignOptions.y)?o.show():(o.alignAttr.y=-9999,s=!1),s&&R.prototype.justifyDataLabel.call(this.axis,o,this.alignOptions,o.alignAttr,O,P),o.attr({x:o.alignAttr.x,y:o.alignAttr.y}),Y(!s&&this.options.crop,!0)&&((D=W(o.x)&&W(o.y)&&D.isInsidePlot(o.x-S+o.width,o.y)&&D.isInsidePlot(o.x+S,o.y))||o.hide()))},a.prototype.getStackBox=function(s,o,_,S,R,O,P){var D=o.axis.reversed,N=s.inverted,V=P.height+P.pos-(N?s.plotLeft:s.plotTop);return o=o.isNegative&&!D||!o.isNegative&&D,{x:N?o?S-P.right:S-O+P.pos-s.plotLeft:_+s.xAxis[0].transB-s.plotLeft,y:N?P.height-_-R:o?V-S-O:V-S,width:N?O:R,height:N?R:O}},a}();return o.prototype.getStacks=function(){var s=this,o=s.inverted;s.yAxis.forEach((function(s){s.stacking&&s.stacking.stacks&&s.hasVisibleSeries&&(s.stacking.oldStacks=s.stacking.stacks)})),s.series.forEach((function(_){var S=_.xAxis&&_.xAxis.options||{};!_.options.stacking||!0!==_.visible&&!1!==s.options.chart.ignoreHiddenSeries||(_.stackKey=[_.type,Y(_.options.stack,""),o?S.top:S.left,o?S.height:S.width].join())}))},O.compose(s),R.prototype.setGroupedPoints=function(){var s=this.yAxis.stacking;this.options.centerInCategory&&(this.is("column")||this.is("columnrange"))&&!this.options.stacking&&1<this.chart.series.length?R.prototype.setStackedPoints.call(this,"group"):s&&U(s.stacks,(function(o,_){"group"===_.slice(-5)&&(U(o,(function(s){return s.destroy()})),delete s.stacks[_])}))},R.prototype.setStackedPoints=function(s){var o=s||this.options.stacking;if(o&&(!0===this.visible||!1===this.chart.options.chart.ignoreHiddenSeries)){var _=this.processedXData,S=this.processedYData,R=[],O=S.length,P=this.options,D=P.threshold,j=Y(P.startFromThreshold&&D,0);P=P.stack;var W,U,X="-"+(s=s?this.type+","+o:this.stackKey),Z=this.negStacks,Q=this.yAxis,ee=Q.stacking.stacks,te=Q.stacking.oldStacks;for(Q.stacking.stacksTouched+=1,U=0;U<O;U++){var ie=_[U],ae=S[U],ne=this.getStackIndicator(ne,ie,this.index),re=ne.key,se=(W=Z&&ae<(j?0:D))?X:s;ee[se]||(ee[se]={}),ee[se][ie]||(te[se]&&te[se][ie]?(ee[se][ie]=te[se][ie],ee[se][ie].total=null):ee[se][ie]=new $(Q,Q.options.stackLabels,W,ie,P)),se=ee[se][ie],null!==ae?(se.points[re]=se.points[this.index]=[Y(se.cumulative,j)],V(se.cumulative)||(se.base=re),se.touched=Q.stacking.stacksTouched,0<ne.index&&!1===this.singleStacks&&(se.points[re][0]=se.points[this.index+","+ie+",0"][0])):se.points[re]=se.points[this.index]=null,"percent"===o?(W=W?s:X,Z&&ee[W]&&ee[W][ie]?(W=ee[W][ie],se.total=W.total=Math.max(W.total,se.total)+Math.abs(ae)||0):se.total=N(se.total+(Math.abs(ae)||0))):"group"===o?(K(ae)&&(ae=ae[0]),null!==ae&&(se.total=(se.total||0)+1)):se.total=N(se.total+(ae||0)),se.cumulative="group"===o?(se.total||1)-1:Y(se.cumulative,j)+(ae||0),null!==ae&&(se.points[re].push(se.cumulative),R[U]=se.cumulative,se.hasValidPoints=!0)}"percent"===o&&(Q.stacking.usePercentage=!0),"group"!==o&&(this.stackedYData=R),Q.stacking.oldStacks={}}},R.prototype.modifyStacks=function(){var s,o=this,_=o.stackKey,S=o.yAxis.stacking.stacks,R=o.processedXData,O=o.options.stacking;o[O+"Stacker"]&&[_,"-"+_].forEach((function(_){for(var P,D,N=R.length;N--;)P=R[N],s=o.getStackIndicator(s,P,o.index,_),(D=(P=S[_]&&S[_][P])&&P.points[s.key])&&o[O+"Stacker"](D,P,N)}))},R.prototype.percentStacker=function(s,o,_){o=o.total?100/o.total:0,s[0]=N(s[0]*o),s[1]=N(s[1]*o),this.stackedYData[_]=s[1]},R.prototype.getStackIndicator=function(s,o,_,S){return!V(s)||s.x!==o||S&&s.key!==S?s={x:o,index:0,key:S}:s.index++,s.key=[_,o,s.index].join(),s},S.StackItem=$,S.StackItem})),M(o,"Series/Line/LineSeries.js",[o["Core/Series/Series.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_){var S=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function n(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),R=_.defined,O=_.merge;return _=function(o){function A(){var s=null!==o&&o.apply(this,arguments)||this;return s.data=void 0,s.options=void 0,s.points=void 0,s}return S(A,o),A.prototype.drawGraph=function(){var s=this,o=this.options,_=(this.gappedPath||this.getGraphPath).call(this),S=this.chart.styledMode,R=[["graph","highcharts-graph"]];S||R[0].push(o.lineColor||this.color||"#cccccc",o.dashStyle),(R=s.getZonesGraphs(R)).forEach((function(R,O){var P=R[0],D=s[P],N=D?"animate":"attr";D?(D.endX=s.preventGraphAnimation?null:_.xMap,D.animate({d:_})):_.length&&(s[P]=D=s.chart.renderer.path(_).addClass(R[1]).attr({zIndex:1}).add(s.group)),D&&!S&&(P={stroke:R[2],"stroke-width":o.lineWidth,fill:s.fillGraph&&s.color||"none"},R[3]?P.dashstyle=R[3]:"square"!==o.linecap&&(P["stroke-linecap"]=P["stroke-linejoin"]="round"),D[N](P).shadow(2>O&&o.shadow)),D&&(D.startX=_.xMap,D.isArea=_.isArea)}))},A.prototype.getGraphPath=function(s,o,_){var S,O=this,P=O.options,D=[],N=[],V=P.step,j=(s=s||O.points).reversed;return j&&s.reverse(),(V={right:1,center:2}[V]||V&&3)&&j&&(V=4-V),(s=this.getValidPoints(s,!1,!(P.connectNulls&&!o&&!_))).forEach((function(j,K){var W=j.plotX,U=j.plotY,Y=s[K-1];(j.leftCliff||Y&&Y.rightCliff)&&!_&&(S=!0),j.isNull&&!R(o)&&0<K?S=!P.connectNulls:j.isNull&&!o?S=!0:(0===K||S?K=[["M",j.plotX,j.plotY]]:O.getPointSpline?K=[O.getPointSpline(s,j,K)]:V?(K=1===V?[["L",Y.plotX,U]]:2===V?[["L",(Y.plotX+W)/2,Y.plotY],["L",(Y.plotX+W)/2,U]]:[["L",W,Y.plotY]]).push(["L",W,U]):K=[["L",W,U]],N.push(j.x),V&&(N.push(j.x),2===V&&N.push(j.x)),D.push.apply(D,K),S=!1)})),D.xMap=N,O.graphPath=D},A.prototype.getZonesGraphs=function(s){return this.zones.forEach((function(o,_){_=["zone-graph-"+_,"highcharts-graph highcharts-zone-graph-"+_+" "+(o.className||"")],this.chart.styledMode||_.push(o.color||this.color,o.dashStyle||this.options.dashStyle),s.push(_)}),this),s},A.defaultOptions=O(s.defaultOptions,{}),A}(s),o.registerSeriesType("line",_),_})),M(o,"Series/Area/AreaSeries.js",[o["Core/Color/Color.js"],o["Core/Legend/LegendSymbol.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_,S){var R=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function h(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(h.prototype=o.prototype,new h)}}(),O=s.parse,P=_.seriesTypes.line;s=S.extend;var D=S.merge,N=S.objectEach,V=S.pick;return S=function(s){function e(){var o=null!==s&&s.apply(this,arguments)||this;return o.data=void 0,o.options=void 0,o.points=void 0,o}return R(e,s),e.prototype.drawGraph=function(){this.areaPath=[],s.prototype.drawGraph.apply(this);var o=this,_=this.areaPath,S=this.options,R=[["area","highcharts-area",this.color,S.fillColor]];this.zones.forEach((function(s,_){R.push(["zone-area-"+_,"highcharts-area highcharts-zone-area-"+_+" "+s.className,s.color||o.color,s.fillColor||S.fillColor])})),R.forEach((function(s){var R=s[0],P=o[R],D=P?"animate":"attr",N={};P?(P.endX=o.preventGraphAnimation?null:_.xMap,P.animate({d:_})):(N.zIndex=0,(P=o[R]=o.chart.renderer.path(_).addClass(s[1]).add(o.group)).isArea=!0),o.chart.styledMode||(N.fill=V(s[3],O(s[2]).setOpacity(V(S.fillOpacity,.75)).get())),P[D](N),P.startX=_.xMap,P.shiftUnit=S.step?2:1}))},e.prototype.getGraphPath=function(s){var o,_=P.prototype.getGraphPath,S=this.options,R=S.stacking,O=this.yAxis,D=[],N=[],j=this.index,K=O.stacking.stacks[this.stackKey],W=S.threshold,U=Math.round(O.getThreshold(S.threshold));S=V(S.connectNulls,"percent"===R);var g=function(o,_,S){var P=s[o];o=R&&K[P.x].points[j];var V=P[S+"Null"]||0;if(S=P[S+"Cliff"]||0,P=!0,S||V){var Y=(V?o[0]:o[1])+S,X=o[0]+S;P=!!V}else!R&&s[_]&&s[_].isNull&&(Y=X=W);void 0!==Y&&(N.push({plotX:$,plotY:null===Y?U:O.getThreshold(Y),isNull:P,isCliff:!0}),D.push({plotX:$,plotY:null===X?U:O.getThreshold(X),doCurve:!1}))};for(s=s||this.points,R&&(s=this.getStackPoints(s)),o=0;o<s.length;o++){R||(s[o].leftCliff=s[o].rightCliff=s[o].leftNull=s[o].rightNull=void 0);var Y=s[o].isNull,$=V(s[o].rectPlotX,s[o].plotX),X=R?V(s[o].yBottom,U):U;Y&&!S||(S||g(o,o-1,"left"),Y&&!R&&S||(N.push(s[o]),D.push({x:o,plotX:$,plotY:X})),S||g(o,o+1,"right"))}return o=_.call(this,N,!0,!0),D.reversed=!0,(X=(Y=_.call(this,D,!0,!0))[0])&&"M"===X[0]&&(Y[0]=["L",X[1],X[2]]),(Y=o.concat(Y)).length&&Y.push(["Z"]),_=_.call(this,N,!1,S),Y.xMap=o.xMap,this.areaPath=Y,_},e.prototype.getStackPoints=function(s){var o=this,_=[],S=[],R=this.xAxis,O=this.yAxis,P=O.stacking.stacks[this.stackKey],D={},j=O.series,K=j.length,W=O.options.reversedStacks?1:-1,U=j.indexOf(o);if(s=s||this.points,this.options.stacking){for(var Y=0;Y<s.length;Y++)s[Y].leftNull=s[Y].rightNull=void 0,D[s[Y].x]=s[Y];N(P,(function(s,o){null!==s.total&&S.push(o)})),S.sort((function(s,o){return s-o}));var $=j.map((function(s){return s.visible}));S.forEach((function(s,N){var Y,X,Z=0;if(D[s]&&!D[s].isNull)_.push(D[s]),[-1,1].forEach((function(_){var R=1===_?"rightNull":"leftNull",O=0,V=P[S[N+_]];if(V)for(var Z=U;0<=Z&&Z<K;){var Q=j[Z].index;(Y=V.points[Q])||(Q===o.index?D[s][R]=!0:$[Z]&&(X=P[s].points[Q])&&(O-=X[1]-X[0])),Z+=W}D[s][1===_?"rightCliff":"leftCliff"]=O}));else{for(var Q=U;0<=Q&&Q<K;){if(Y=P[s].points[j[Q].index]){Z=Y[1];break}Q+=W}Z=V(Z,0),Z=O.translate(Z,0,1,0,1),_.push({isNull:!0,plotX:R.translate(s,0,0,0,1),x:s,plotY:Z,yBottom:Z})}}))}return _},e.defaultOptions=D(P.defaultOptions,{threshold:0}),e}(P),s(S.prototype,{singleStacks:!1,drawLegendSymbol:o.drawRectangle}),_.registerSeriesType("area",S),S})),M(o,"Series/Spline/SplineSeries.js",[o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o){var _=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function n(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),S=s.seriesTypes.line,R=o.merge,O=o.pick;return o=function(s){function u(){var o=null!==s&&s.apply(this,arguments)||this;return o.data=void 0,o.options=void 0,o.points=void 0,o}return _(u,s),u.prototype.getPointSpline=function(s,o,_){var S=o.plotX||0,R=o.plotY||0,P=s[_-1];if(_=s[_+1],P&&!P.isNull&&!1!==P.doCurve&&!o.isCliff&&_&&!_.isNull&&!1!==_.doCurve&&!o.isCliff){s=P.plotY||0;var D=_.plotX||0;_=_.plotY||0;var N=0,V=(1.5*S+(P.plotX||0))/2.5,j=(1.5*R+s)/2.5,K=(1.5*R+_)/2.5;(D=(1.5*S+D)/2.5)!==V&&(N=(K-j)*(D-S)/(D-V)+R-K),K+=N,(j+=N)>s&&j>R?K=2*R-(j=Math.max(s,R)):j<s&&j<R&&(K=2*R-(j=Math.min(s,R))),K>_&&K>R?j=2*R-(K=Math.max(_,R)):K<_&&K<R&&(j=2*R-(K=Math.min(_,R))),o.rightContX=D,o.rightContY=K}return o=["C",O(P.rightContX,P.plotX,0),O(P.rightContY,P.plotY,0),O(V,S,0),O(j,R,0),S,R],P.rightContX=P.rightContY=void 0,o},u.defaultOptions=R(S.defaultOptions),u}(S),s.registerSeriesType("spline",o),o})),M(o,"Series/AreaSpline/AreaSplineSeries.js",[o["Series/Area/AreaSeries.js"],o["Series/Spline/SplineSeries.js"],o["Core/Legend/LegendSymbol.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R){var O=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function c(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(c.prototype=o.prototype,new c)}}(),P=s.prototype,D=R.extend,N=R.merge;return D((R=function(_){function k(){var s=null!==_&&_.apply(this,arguments)||this;return s.data=void 0,s.points=void 0,s.options=void 0,s}return O(k,_),k.defaultOptions=N(o.defaultOptions,s.defaultOptions),k}(o)).prototype,{getGraphPath:P.getGraphPath,getStackPoints:P.getStackPoints,drawGraph:P.drawGraph,drawLegendSymbol:_.drawRectangle}),S.registerSeriesType("areaspline",R),R})),M(o,"Series/Column/ColumnSeries.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/Color/Color.js"],o["Core/Globals.js"],o["Core/Legend/LegendSymbol.js"],o["Core/Series/Series.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O,P){var D=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function e(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}(),N=s.animObject,V=o.parse,j=_.hasTouch;s=_.noop;var K=P.clamp,W=P.css,U=P.defined,Y=P.extend,$=P.fireEvent,X=P.isArray,Z=P.isNumber,Q=P.merge,ee=P.pick,te=P.objectEach;return P=function(s){function l(){var o=null!==s&&s.apply(this,arguments)||this;return o.borderWidth=void 0,o.data=void 0,o.group=void 0,o.options=void 0,o.points=void 0,o}return D(l,s),l.prototype.animate=function(s){var o=this,_=this.yAxis,S=o.options,R=this.chart.inverted,O={},P=R?"translateX":"translateY";if(s)O.scaleY=.001,s=K(_.toPixels(S.threshold),_.pos,_.pos+_.len),R?O.translateX=s-_.len:O.translateY=s,o.clipBox&&o.setClip(),o.group.attr(O);else{var D=Number(o.group.attr(P));o.group.animate({scaleY:1},Y(N(o.options.animation),{step:function(s,S){o.group&&(O[P]=D+S.pos*(_.pos-D),o.group.attr(O))}}))}},l.prototype.init=function(o,_){s.prototype.init.apply(this,arguments);var S=this;(o=S.chart).hasRendered&&o.series.forEach((function(s){s.type===S.type&&(s.isDirty=!0)}))},l.prototype.getColumnMetrics=function(){var s=this,o=s.options,_=s.xAxis,S=s.yAxis,R=_.options.reversedStacks;R=_.reversed&&!R||!_.reversed&&R;var O,P={},D=0;!1===o.grouping?D=1:s.chart.series.forEach((function(o){var _=o.yAxis,R=o.options;if(o.type===s.type&&(o.visible||!s.chart.options.chart.ignoreHiddenSeries)&&S.len===_.len&&S.pos===_.pos){if(R.stacking&&"group"!==R.stacking){O=o.stackKey,void 0===P[O]&&(P[O]=D++);var N=P[O]}else!1!==R.grouping&&(N=D++);o.columnIndex=N}}));var N=Math.min(Math.abs(_.transA)*(_.ordinal&&_.ordinal.slope||o.pointRange||_.closestPointRange||_.tickInterval||1),_.len),V=N*o.groupPadding,j=(N-2*V)/(D||1);return o=Math.min(o.maxPointWidth||_.len,ee(o.pointWidth,j*(1-2*o.pointPadding))),s.columnMetrics={width:o,offset:(j-o)/2+(V+((s.columnIndex||0)+(R?1:0))*j-N/2)*(R?-1:1),paddedWidth:j,columnCount:D},s.columnMetrics},l.prototype.crispCol=function(s,o,_,S){var R=this.chart,O=this.borderWidth,P=-(O%2?.5:0);return O=O%2?.5:1,R.inverted&&R.renderer.isVML&&(O+=1),this.options.crisp&&(_=Math.round(s+_)+P,_-=s=Math.round(s)+P),S=Math.round(o+S)+O,P=.5>=Math.abs(o)&&.5<S,S-=o=Math.round(o)+O,P&&S&&(--o,S+=1),{x:s,y:o,width:_,height:S}},l.prototype.adjustForMissingColumns=function(s,o,_,S){var R=this,O=this.options.stacking;if(!_.isNull&&1<S.columnCount){var P=0,D=0;te(this.yAxis.stacking&&this.yAxis.stacking.stacks,(function(s){if("number"==typeof _.x&&(s=s[_.x.toString()])){var o=s.points[R.index],S=s.total;O?(o&&(P=D),s.hasValidPoints&&D++):X(o)&&(P=o[1],D=S||0)}})),s=(_.plotX||0)+((D-1)*S.paddedWidth+o)/2-o-P*S.paddedWidth}return s},l.prototype.translate=function(){var s=this,o=s.chart,_=s.options,S=s.dense=2>s.closestPointRange*s.xAxis.transA;S=s.borderWidth=ee(_.borderWidth,S?0:1);var O=s.xAxis,P=s.yAxis,D=_.threshold,N=s.translatedThreshold=P.getThreshold(D),V=ee(_.minPointLength,5),j=s.getColumnMetrics(),W=j.width,Y=s.pointXOffset=j.offset,$=s.dataMin,X=s.dataMax,Q=s.barW=Math.max(W,1+2*S);o.inverted&&(N-=.5),_.pointPadding&&(Q=Math.ceil(Q)),R.prototype.translate.apply(s),s.points.forEach((function(S){var R=ee(S.yBottom,N),te=999+Math.abs(R),ie=S.plotX||0;te=K(S.plotY,-te,P.len+te);var ae=Math.min(te,R),ne=Math.max(te,R)-ae,re=W,se=ie+Y,le=Q;V&&Math.abs(ne)<V&&(ne=V,ie=!P.reversed&&!S.negative||P.reversed&&S.negative,Z(D)&&Z(X)&&S.y===D&&X<=D&&(P.min||0)<D&&($!==X||(P.max||0)<=D)&&(ie=!ie),ae=Math.abs(ae-N)>V?R-V:N-(ie?V:0)),U(S.options.pointWidth)&&(re=le=Math.ceil(S.options.pointWidth),se-=Math.round((re-W)/2)),_.centerInCategory&&(se=s.adjustForMissingColumns(se,re,S,j)),S.barX=se,S.pointWidth=re,S.tooltipPos=o.inverted?[K(P.len+P.pos-o.plotLeft-te,P.pos-o.plotLeft,P.len+P.pos-o.plotLeft),O.len+O.pos-o.plotTop-se-le/2,ne]:[O.left-o.plotLeft+se+le/2,K(te+P.pos-o.plotTop,P.pos-o.plotTop,P.len+P.pos-o.plotTop),ne],S.shapeType=s.pointClass.prototype.shapeType||"rect",S.shapeArgs=s.crispCol.apply(s,S.isNull?[se,N,le,0]:[se,ae,le,ne])}))},l.prototype.drawGraph=function(){this.group[this.dense?"addClass":"removeClass"]("highcharts-dense-data")},l.prototype.pointAttribs=function(s,o){var _=this.options,S=this.pointAttrToOptions||{},R=S.stroke||"borderColor",O=S["stroke-width"]||"borderWidth",P=s&&s.color||this.color,D=s&&s[R]||_[R]||P;S=s&&s.options.dashStyle||_.dashStyle;var N=s&&s[O]||_[O]||this[O]||0,j=ee(s&&s.opacity,_.opacity,1);if(s&&this.zones.length){var K=s.getZone();P=s.options.color||K&&(K.color||s.nonZonedColor)||this.color,K&&(D=K.borderColor||D,S=K.dashStyle||S,N=K.borderWidth||N)}return o&&s&&(o=(s=Q(_.states[o],s.options.states&&s.options.states[o]||{})).brightness,P=s.color||void 0!==o&&V(P).brighten(s.brightness).get()||P,D=s[R]||D,N=s[O]||N,S=s.dashStyle||S,j=ee(s.opacity,j)),R={fill:P,stroke:D,"stroke-width":N,opacity:j},S&&(R.dashstyle=S),R},l.prototype.drawPoints=function(){var s,o=this,_=this.chart,S=o.options,R=_.renderer,O=S.animationLimit||250;o.points.forEach((function(P){var D=P.graphic,N=!!D,V=D&&_.pointCount<O?"animate":"attr";Z(P.plotY)&&null!==P.y?(s=P.shapeArgs,D&&P.hasNewShapeType()&&(D=D.destroy()),o.enabledDataSorting&&(P.startXPos=o.xAxis.reversed?-(s&&s.width||0):o.xAxis.width),D||(P.graphic=D=R[P.shapeType](s).add(P.group||o.group))&&o.enabledDataSorting&&_.hasRendered&&_.pointCount<O&&(D.attr({x:P.startXPos}),N=!0,V="animate"),D&&N&&D[V](Q(s)),S.borderRadius&&D[V]({r:S.borderRadius}),_.styledMode||D[V](o.pointAttribs(P,P.selected&&"select")).shadow(!1!==P.allowShadow&&S.shadow,null,S.stacking&&!S.borderRadius),D&&(D.addClass(P.getClassName(),!0),D.attr({visibility:P.visible?"inherit":"hidden"}))):D&&(P.graphic=D.destroy())}))},l.prototype.drawTracker=function(){var s,o=this,_=o.chart,S=_.pointer,f=function(s){var o=S.getPointFromEvent(s);void 0!==o&&(S.isDirectTouch=!0,o.onMouseOver(s))};o.points.forEach((function(o){s=X(o.dataLabels)?o.dataLabels:o.dataLabel?[o.dataLabel]:[],o.graphic&&(o.graphic.element.point=o),s.forEach((function(s){s.div?s.div.point=o:s.element.point=o}))})),o._hasTracking||(o.trackerGroups.forEach((function(s){o[s]&&(o[s].addClass("highcharts-tracker").on("mouseover",f).on("mouseout",(function(s){S.onTrackerMouseOut(s)})),j&&o[s].on("touchstart",f),!_.styledMode&&o.options.cursor&&o[s].css(W).css({cursor:o.options.cursor}))})),o._hasTracking=!0),$(this,"afterDrawTracker")},l.prototype.remove=function(){var s=this,o=s.chart;o.hasRendered&&o.series.forEach((function(o){o.type===s.type&&(o.isDirty=!0)})),R.prototype.remove.apply(s,arguments)},l.defaultOptions=Q(R.defaultOptions,{borderRadius:0,centerInCategory:!1,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{halo:!1,brightness:.1},select:{color:"#cccccc",borderColor:"#000000"}},dataLabels:{align:void 0,verticalAlign:void 0,y:void 0},startFromThreshold:!0,stickyTracking:!1,tooltip:{distance:6},threshold:0,borderColor:"#ffffff"}),l}(R),Y(P.prototype,{cropShoulder:0,directTouch:!0,drawLegendSymbol:S.drawRectangle,getSymbol:s,negStacks:!0,trackerGroups:["group","dataLabelsGroup"]}),O.registerSeriesType("column",P),P})),M(o,"Core/Series/DataLabel.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/FormatUtilities.js"],o["Core/Utilities.js"]],(function(s,o,_){var S,R=s.getDeferredAnimation,O=o.format,P=_.defined,D=_.extend,N=_.fireEvent,V=_.isArray,j=_.merge,K=_.objectEach,W=_.pick,U=_.splat;return function(s){function f(s,o,_,S,R){var O=this,P=this.chart,N=this.isCartesian&&P.inverted,V=this.enabledDataSorting,j=W(s.dlBox&&s.dlBox.centerX,s.plotX,-9999),K=W(s.plotY,-9999),U=o.getBBox(),Y=_.rotation,$=_.align,X=P.isInsidePlot(j,Math.round(K),{inverted:N,paneCoordinates:!0,series:O}),v=function(_){V&&O.xAxis&&!Z&&O.setDataLabelStartPos(s,o,R,X,_)},Z="justify"===W(_.overflow,V?"none":"justify"),Q=this.visible&&!1!==s.visible&&(s.series.forceDL||V&&!Z||X||W(_.inside,!!this.options.stacking)&&S&&P.isInsidePlot(j,N?S.x+1:S.y+S.height-1,{inverted:N,paneCoordinates:!0,series:O}));if(Q){var ee=P.renderer.fontMetrics(P.styledMode?void 0:_.style.fontSize,o).b;S=D({x:N?this.yAxis.len-K:j,y:Math.round(N?this.xAxis.len-j:K),width:0,height:0},S),D(_,{width:U.width,height:U.height}),Y?(Z=!1,j=P.renderer.rotCorr(ee,Y),v(j={x:S.x+(_.x||0)+S.width/2+j.x,y:S.y+(_.y||0)+{top:0,middle:.5,bottom:1}[_.verticalAlign]*S.height}),o[R?"attr":"animate"](j).attr({align:$}),v=180<(v=(Y+720)%360)&&360>v,"left"===$?j.y-=v?U.height:0:"center"===$?(j.x-=U.width/2,j.y-=U.height/2):"right"===$&&(j.x-=U.width,j.y-=v?0:U.height),o.placed=!0,o.alignAttr=j):(v(S),o.align(_,void 0,S),j=o.alignAttr),Z&&0<=S.height?this.justifyDataLabel(o,_,j,U,S,R):W(_.crop,!0)&&(Q=P.isInsidePlot(j.x,j.y,{paneCoordinates:!0,series:O})&&P.isInsidePlot(j.x+U.width,j.y+U.height,{paneCoordinates:!0,series:O})),_.shape&&!Y&&o[R?"attr":"animate"]({anchorX:N?P.plotWidth-s.plotY:s.plotX,anchorY:N?P.plotHeight-s.plotX:s.plotY})}R&&V&&(o.placed=!1),Q||V&&!Z||(o.hide(!0),o.placed=!1)}function u(){var s=this,o=s.chart,_=s.options,S=s.points,D=s.hasRendered||0,j=o.renderer,Y=_.dataLabels,$=Y.animation;if($=Y.defer?R(o,$,s):{defer:0,duration:0},Y=z(z(o.options.plotOptions&&o.options.plotOptions.series&&o.options.plotOptions.series.dataLabels,o.options.plotOptions&&o.options.plotOptions[s.type]&&o.options.plotOptions[s.type].dataLabels),Y),N(this,"drawDataLabels"),V(Y)||Y.enabled||s._hasPointLabels){var X=s.plotGroup("dataLabelsGroup","data-labels",D?"inherit":"hidden",Y.zIndex||6);X.attr({opacity:+D}),!D&&(D=s.dataLabelsGroup)&&(s.visible&&X.show(!0),D[_.animation?"animate":"attr"]({opacity:1},$)),S.forEach((function(S){U(z(Y,S.dlOptions||S.options&&S.options.dataLabels)).forEach((function(R,D){var N=R.enabled&&(!S.isNull||S.dataLabelOnNull)&&function h(s,o){var _=o.filter;return!_||(o=_.operator,s=s[_.property],_=_.value,">"===o&&s>_||"<"===o&&s<_||">="===o&&s>=_||"<="===o&&s<=_||"=="===o&&s==_||"==="===o&&s===_)}(S,R),V=S.connectors?S.connectors[D]:S.connector,U=S.dataLabels?S.dataLabels[D]:S.dataLabel,Y=W(R.distance,S.labelDistance),$=!U;if(N){var Z=S.getLabelConfig(),Q=W(R[S.formatPrefix+"Format"],R.format);Z=P(Q)?O(Q,Z,o):(R[S.formatPrefix+"Formatter"]||R.formatter).call(Z,R),Q=R.style;var ee=R.rotation;o.styledMode||(Q.color=W(R.color,Q.color,s.color,"#000000"),"contrast"===Q.color?(S.contrastColor=j.getContrast(S.color||s.color),Q.color=!P(Y)&&R.inside||0>Y||_.stacking?S.contrastColor:"#000000"):delete S.contrastColor,_.cursor&&(Q.cursor=_.cursor));var te={r:R.borderRadius||0,rotation:ee,padding:R.padding,zIndex:1};o.styledMode||(te.fill=R.backgroundColor,te.stroke=R.borderColor,te["stroke-width"]=R.borderWidth),K(te,(function(s,o){void 0===s&&delete te[o]}))}!U||N&&P(Z)&&!!U.div==!!R.useHTML||(S.dataLabel=U=S.dataLabel&&S.dataLabel.destroy(),S.dataLabels&&(1===S.dataLabels.length?delete S.dataLabels:delete S.dataLabels[D]),D||delete S.dataLabel,V&&(S.connector=S.connector.destroy(),S.connectors&&(1===S.connectors.length?delete S.connectors:delete S.connectors[D]))),N&&P(Z)&&(U?te.text=Z:(S.dataLabels=S.dataLabels||[],U=S.dataLabels[D]=ee?j.text(Z,0,-9999,R.useHTML).addClass("highcharts-data-label"):j.label(Z,0,-9999,R.shape,null,null,R.useHTML,null,"data-label"),D||(S.dataLabel=U),U.addClass(" highcharts-data-label-color-"+S.colorIndex+" "+(R.className||"")+(R.useHTML?" highcharts-tracker":""))),U.options=R,U.attr(te),o.styledMode||U.css(Q).shadow(R.shadow),U.added||U.add(X),R.textPath&&!R.useHTML&&(U.setTextPath(S.getDataLabelPath&&S.getDataLabelPath(U)||S.graphic,R.textPath),S.dataLabelPath&&!R.textPath.enabled&&(S.dataLabelPath=S.dataLabelPath.destroy())),s.alignDataLabel(S,U,R,null,$))}))}))}N(this,"afterDrawDataLabels")}function t(s,o,_,S,R,O){var P=this.chart,D=o.align,N=o.verticalAlign,V=s.box?0:s.padding||0,j=o.x;j=void 0===j?0:j;var K=o.y;K=void 0===K?0:K;var W=(_.x||0)+V;if(0>W){"right"===D&&0<=j?(o.align="left",o.inside=!0):j-=W;var U=!0}return(W=(_.x||0)+S.width-V)>P.plotWidth&&("left"===D&&0>=j?(o.align="right",o.inside=!0):j+=P.plotWidth-W,U=!0),0>(W=_.y+V)&&("bottom"===N&&0<=K?(o.verticalAlign="top",o.inside=!0):K-=W,U=!0),(W=(_.y||0)+S.height-V)>P.plotHeight&&("top"===N&&0>=K?(o.verticalAlign="bottom",o.inside=!0):K+=P.plotHeight-W,U=!0),U&&(o.x=j,o.y=K,s.placed=!O,s.align(o,void 0,R)),U}function z(s,o){var _,S=[];if(V(s)&&!V(o))S=s.map((function(s){return j(s,o)}));else if(V(o)&&!V(s))S=o.map((function(o){return j(s,o)}));else if(V(s)||V(o))for(_=Math.max(s.length,o.length);_--;)S[_]=j(s[_],o[_]);else S=j(s,o);return S}function C(s,o,_,S,R){var O=this.chart,P=O.inverted,D=this.xAxis,N=D.reversed,V=P?o.height/2:o.width/2;s=(s=s.pointWidth)?s/2:0,o.startXPos=P?R.x:N?-V-s:D.width-V+s,o.startYPos=P?N?this.yAxis.height-V+s:-V-s:R.y,S?"hidden"===o.visibility&&(o.show(),o.attr({opacity:0}).animate({opacity:1})):o.attr({opacity:1}).animate({opacity:0},void 0,o.hide),O.hasRendered&&(_&&o.attr({x:o.startXPos,y:o.startYPos}),o.placed=!0)}var o=[];s.compose=function(s){if(-1===o.indexOf(s)){var _=s.prototype;o.push(s),_.alignDataLabel=f,_.drawDataLabels=u,_.justifyDataLabel=t,_.setDataLabelStartPos=C}}}(S||(S={})),S})),M(o,"Series/Column/ColumnDataLabel.js",[o["Core/Series/DataLabel.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_){var S,R=o.series,O=_.merge,P=_.pick;return function(o){function q(s,o,_,S,D){var N=this.chart.inverted,V=s.series,j=(V.xAxis?V.xAxis.len:this.chart.plotSizeX)||0;V=(V.yAxis?V.yAxis.len:this.chart.plotSizeY)||0;var K=s.dlBox||s.shapeArgs,W=P(s.below,s.plotY>P(this.translatedThreshold,V)),U=P(_.inside,!!this.options.stacking);K&&(0>(S=O(K)).y&&(S.height+=S.y,S.y=0),0<(K=S.y+S.height-V)&&K<S.height&&(S.height-=K),N&&(S={x:V-S.y-S.height,y:j-S.x-S.width,width:S.height,height:S.width}),U||(N?(S.x+=W?0:S.width,S.width=0):(S.y+=W?S.height:0,S.height=0))),_.align=P(_.align,!N||U?"center":W?"right":"left"),_.verticalAlign=P(_.verticalAlign,N||U?"middle":W?"top":"bottom"),R.prototype.alignDataLabel.call(this,s,o,_,S,D),_.inside&&s.contrastColor&&o.css({color:s.contrastColor})}var _=[];o.compose=function(o){s.compose(R),-1===_.indexOf(o)&&(_.push(o),o.prototype.alignDataLabel=q)}}(S||(S={})),S})),M(o,"Series/Bar/BarSeries.js",[o["Series/Column/ColumnSeries.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_){var S=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function n(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}(),R=_.extend,O=_.merge;return _=function(o){function y(){var s=null!==o&&o.apply(this,arguments)||this;return s.data=void 0,s.options=void 0,s.points=void 0,s}return S(y,o),y.defaultOptions=O(s.defaultOptions,{}),y}(s),R(_.prototype,{inverted:!0}),o.registerSeriesType("bar",_),_})),M(o,"Series/Scatter/ScatterSeries.js",[o["Series/Column/ColumnSeries.js"],o["Series/Line/LineSeries.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_,S){var R=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function e(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}(),O=S.addEvent,P=S.extend,D=S.merge;return P((S=function(s){function n(){var o=null!==s&&s.apply(this,arguments)||this;return o.data=void 0,o.options=void 0,o.points=void 0,o}return R(n,s),n.prototype.applyJitter=function(){var s=this,o=this.options.jitter,_=this.points.length;o&&this.points.forEach((function(S,R){["x","y"].forEach((function(O,P){var D="plot"+O.toUpperCase();if(o[O]&&!S.isNull){var N=s[O+"Axis"],V=o[O]*N.transA;if(N&&!N.isLog){var j=Math.max(0,S[D]-V);N=Math.min(N.len,S[D]+V),P=1e4*Math.sin(R+P*_),S[D]=j+(N-j)*(P-Math.floor(P)),"x"===O&&(S.clientX=S.plotX)}}}))}))},n.prototype.drawGraph=function(){this.options.lineWidth?s.prototype.drawGraph.call(this):this.graph&&(this.graph=this.graph.destroy())},n.defaultOptions=D(o.defaultOptions,{lineWidth:0,findNearestPointBy:"xy",jitter:{x:0,y:0},marker:{enabled:!0},tooltip:{headerFormat:'<span style="color:{point.color}">●</span> <span style="font-size: 10px"> {series.name}</span><br/>',pointFormat:"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>"}}),n}(o)).prototype,{drawTracker:s.prototype.drawTracker,sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:["group","markerGroup","dataLabelsGroup"],takeOrdinalPosition:!1}),O(S,"afterTranslate",(function(){this.applyJitter()})),_.registerSeriesType("scatter",S),S})),M(o,"Series/CenteredUtilities.js",[o["Core/Globals.js"],o["Core/Series/Series.js"],o["Core/Utilities.js"]],(function(s,o,_){var S,R=s.deg2rad,O=_.isNumber,P=_.pick,D=_.relativeLength;return function(s){s.getCenter=function(){var s=this.options,_=this.chart,S=2*(s.slicedOffset||0),R=_.plotWidth-2*S,O=_.plotHeight-2*S,N=s.center,V=Math.min(R,O),j=s.size,K=s.innerSize||0;for("string"==typeof j&&(j=parseFloat(j)),"string"==typeof K&&(K=parseFloat(K)),s=[P(N[0],"50%"),P(N[1],"50%"),P(j&&0>j?void 0:s.size,"100%"),P(K&&0>K?void 0:s.innerSize||0,"0%")],!_.angular||this instanceof o||(s[3]=0),N=0;4>N;++N)j=s[N],_=2>N||2===N&&/%$/.test(j),s[N]=D(j,[R,O,V,s[2]][N])+(_?S:0);return s[3]>s[2]&&(s[3]=s[2]),s},s.getStartAndEndRadians=function(s,o){return s=O(s)?s:0,o=O(o)&&o>s&&360>o-s?o:s+360,{start:R*(s+-90),end:R*(o+-90)}}}(S||(S={})),S})),M(o,"Series/Pie/PiePoint.js",[o["Core/Animation/AnimationUtilities.js"],o["Core/Series/Point.js"],o["Core/Utilities.js"]],(function(s,o,_){var S=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function h(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(h.prototype=o.prototype,new h)}}(),R=s.setAnimation,O=_.addEvent,P=_.defined;s=_.extend;var D=_.isNumber,N=_.pick,V=_.relativeLength;return o=function(s){function e(){var o=null!==s&&s.apply(this,arguments)||this;return o.labelDistance=void 0,o.options=void 0,o.series=void 0,o}return S(e,s),e.prototype.getConnectorPath=function(){var s=this.labelPosition,o=this.series.options.dataLabels,_=this.connectorShapes,S=o.connectorShape;return _[S]&&(S=_[S]),S.call(this,{x:s.final.x,y:s.final.y,alignment:s.alignment},s.connectorPosition,o)},e.prototype.getTranslate=function(){return this.sliced?this.slicedTranslation:{translateX:0,translateY:0}},e.prototype.haloPath=function(s){var o=this.shapeArgs;return this.sliced||!this.visible?[]:this.series.chart.renderer.symbols.arc(o.x,o.y,o.r+s,o.r+s,{innerR:o.r-1,start:o.start,end:o.end})},e.prototype.init=function(){var o=this;s.prototype.init.apply(this,arguments),this.name=N(this.name,"Slice");var e=function(s){o.slice("select"===s.type)};return O(this,"select",e),O(this,"unselect",e),this},e.prototype.isValid=function(){return D(this.y)&&0<=this.y},e.prototype.setVisible=function(s,o){var _=this,S=this.series,R=S.chart,O=S.options.ignoreHiddenPoint;o=N(o,O),s!==this.visible&&(this.visible=this.options.visible=s=void 0===s?!this.visible:s,S.options.data[S.data.indexOf(this)]=this.options,["graphic","dataLabel","connector","shadowGroup"].forEach((function(o){_[o]&&_[o][s?"show":"hide"](s)})),this.legendItem&&R.legend.colorizeItem(this,s),s||"hover"!==this.state||this.setState(""),O&&(S.isDirty=!0),o&&R.redraw())},e.prototype.slice=function(s,o,_){var S=this.series;R(_,S.chart),N(o,!0),this.sliced=this.options.sliced=P(s)?s:!this.sliced,S.options.data[S.data.indexOf(this)]=this.options,this.graphic&&this.graphic.animate(this.getTranslate()),this.shadowGroup&&this.shadowGroup.animate(this.getTranslate())},e}(o),s(o.prototype,{connectorShapes:{fixedOffset:function(s,o,_){var S=o.breakAt;return o=o.touchingSliceAt,[["M",s.x,s.y],_.softConnector?["C",s.x+("left"===s.alignment?-5:5),s.y,2*S.x-o.x,2*S.y-o.y,S.x,S.y]:["L",S.x,S.y],["L",o.x,o.y]]},straight:function(s,o){return o=o.touchingSliceAt,[["M",s.x,s.y],["L",o.x,o.y]]},crookedLine:function(s,o,_){o=o.touchingSliceAt;var S=this.series,R=S.center[0],O=S.chart.plotWidth,P=S.chart.plotLeft;S=s.alignment;var D=this.shapeArgs.r;return _=V(_.crookDistance,1),_=["L",O="left"===S?R+D+(O+P-R-D)*(1-_):P+(R-D)*_,s.y],R=!0,("left"===S?O>s.x||O<o.x:O<s.x||O>o.x)&&(R=!1),s=[["M",s.x,s.y]],R&&s.push(_),s.push(["L",o.x,o.y]),s}}}),o})),M(o,"Series/Pie/PieSeries.js",[o["Series/CenteredUtilities.js"],o["Series/Column/ColumnSeries.js"],o["Core/Globals.js"],o["Core/Legend/LegendSymbol.js"],o["Series/Pie/PiePoint.js"],o["Core/Series/Series.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Renderer/SVG/Symbols.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R,O,P,D,N){var V=this&&this.__extends||function(){var a=function(s,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,o){s.__proto__=o}||function(s,o){for(var _ in o)o.hasOwnProperty(_)&&(s[_]=o[_])})(s,o)};return function(s,o){function f(){this.constructor=s}a(s,o),s.prototype=null===o?Object.create(o):(f.prototype=o.prototype,new f)}}(),j=s.getStartAndEndRadians;_=_.noop;var K=N.clamp,W=N.extend,U=N.fireEvent,Y=N.merge,$=N.pick,X=N.relativeLength;return N=function(s){function c(){var o=null!==s&&s.apply(this,arguments)||this;return o.center=void 0,o.data=void 0,o.maxLabelDistance=void 0,o.options=void 0,o.points=void 0,o}return V(c,s),c.prototype.animate=function(s){var o=this,_=o.points,S=o.startAngleRad;s||_.forEach((function(s){var _=s.graphic,R=s.shapeArgs;_&&R&&(_.attr({r:$(s.startR,o.center&&o.center[3]/2),start:S,end:S}),_.animate({r:R.r,start:R.start,end:R.end},o.options.animation))}))},c.prototype.drawEmpty=function(){var s=this.startAngleRad,o=this.endAngleRad,_=this.options;if(0===this.total&&this.center){var S=this.center[0],R=this.center[1];this.graph||(this.graph=this.chart.renderer.arc(S,R,this.center[1]/2,0,s,o).addClass("highcharts-empty-series").add(this.group)),this.graph.attr({d:D.arc(S,R,this.center[2]/2,0,{start:s,end:o,innerR:this.center[3]/2})}),this.chart.styledMode||this.graph.attr({"stroke-width":_.borderWidth,fill:_.fillColor||"none",stroke:_.color||"#cccccc"})}else this.graph&&(this.graph=this.graph.destroy())},c.prototype.drawPoints=function(){var s=this.chart.renderer;this.points.forEach((function(o){o.graphic&&o.hasNewShapeType()&&(o.graphic=o.graphic.destroy()),o.graphic||(o.graphic=s[o.shapeType](o.shapeArgs).add(o.series.group),o.delayedRendering=!0)}))},c.prototype.generatePoints=function(){s.prototype.generatePoints.call(this),this.updateTotals()},c.prototype.getX=function(s,o,_){var S=this.center,R=this.radii?this.radii[_.index]||0:S[2]/2;return s=Math.asin(K((s-S[1])/(R+_.labelDistance),-1,1)),S[0]+(o?-1:1)*Math.cos(s)*(R+_.labelDistance)+(0<_.labelDistance?(o?-1:1)*this.options.dataLabels.padding:0)},c.prototype.hasData=function(){return!!this.processedXData.length},c.prototype.redrawPoints=function(){var s,o,_,S,R=this,O=R.chart,P=O.renderer,D=R.options.shadow;this.drawEmpty(),!D||R.shadowGroup||O.styledMode||(R.shadowGroup=P.g("shadow").attr({zIndex:-1}).add(R.group)),R.points.forEach((function(N){var V={};if(o=N.graphic,!N.isNull&&o){var j=void 0;S=N.shapeArgs,s=N.getTranslate(),O.styledMode||(j=N.shadowGroup,D&&!j&&(j=N.shadowGroup=P.g("shadow").add(R.shadowGroup)),j&&j.attr(s),_=R.pointAttribs(N,N.selected&&"select")),N.delayedRendering?(o.setRadialReference(R.center).attr(S).attr(s),O.styledMode||o.attr(_).attr({"stroke-linejoin":"round"}).shadow(D,j),N.delayedRendering=!1):(o.setRadialReference(R.center),O.styledMode||Y(!0,V,_),Y(!0,V,S,s),o.animate(V)),o.attr({visibility:N.visible?"inherit":"hidden"}),o.addClass(N.getClassName(),!0)}else o&&(N.graphic=o.destroy())}))},c.prototype.sortByAngle=function(s,o){s.sort((function(s,_){return void 0!==s.angle&&(_.angle-s.angle)*o}))},c.prototype.translate=function(s){this.generatePoints();var o=this.options,_=o.slicedOffset,S=_+(o.borderWidth||0),R=j(o.startAngle,o.endAngle),O=this.startAngleRad=R.start;R=(this.endAngleRad=R.end)-O;var P=this.points,D=o.dataLabels.distance;o=o.ignoreHiddenPoint;var N,V=P.length,K=0;for(s||(this.center=s=this.getCenter()),N=0;N<V;N++){var W=P[N],Y=O+K*R;!W.isValid()||o&&!W.visible||(K+=W.percentage/100);var Z=O+K*R,Q={x:s[0],y:s[1],r:s[2]/2,innerR:s[3]/2,start:Math.round(1e3*Y)/1e3,end:Math.round(1e3*Z)/1e3};W.shapeType="arc",W.shapeArgs=Q,W.labelDistance=$(W.options.dataLabels&&W.options.dataLabels.distance,D),W.labelDistance=X(W.labelDistance,Q.r),this.maxLabelDistance=Math.max(this.maxLabelDistance||0,W.labelDistance),(Z=(Z+Y)/2)>1.5*Math.PI?Z-=2*Math.PI:Z<-Math.PI/2&&(Z+=2*Math.PI),W.slicedTranslation={translateX:Math.round(Math.cos(Z)*_),translateY:Math.round(Math.sin(Z)*_)},Q=Math.cos(Z)*s[2]/2;var ee=Math.sin(Z)*s[2]/2;W.tooltipPos=[s[0]+.7*Q,s[1]+.7*ee],W.half=Z<-Math.PI/2||Z>Math.PI/2?1:0,W.angle=Z,Y=Math.min(S,W.labelDistance/5),W.labelPosition={natural:{x:s[0]+Q+Math.cos(Z)*W.labelDistance,y:s[1]+ee+Math.sin(Z)*W.labelDistance},final:{},alignment:0>W.labelDistance?"center":W.half?"right":"left",connectorPosition:{breakAt:{x:s[0]+Q+Math.cos(Z)*Y,y:s[1]+ee+Math.sin(Z)*Y},touchingSliceAt:{x:s[0]+Q,y:s[1]+ee}}}}U(this,"afterTranslate")},c.prototype.updateTotals=function(){var s,o=this.points,_=o.length,S=this.options.ignoreHiddenPoint,R=0;for(s=0;s<_;s++){var O=o[s];!O.isValid()||S&&!O.visible||(R+=O.y)}for(this.total=R,s=0;s<_;s++)(O=o[s]).percentage=0<R&&(O.visible||!S)?O.y/R*100:0,O.total=R},c.defaultOptions=Y(O.defaultOptions,{center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{allowOverlap:!0,connectorPadding:5,connectorShape:"fixedOffset",crookDistance:"70%",distance:30,enabled:!0,formatter:function(){return this.point.isNull?void 0:this.point.name},softConnector:!0,x:0},fillColor:void 0,ignoreHiddenPoint:!0,inactiveOtherPoints:!0,legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10,stickyTracking:!1,tooltip:{followPointer:!0},borderColor:"#ffffff",borderWidth:1,lineWidth:void 0,states:{hover:{brightness:.1}}}),c}(O),W(N.prototype,{axisTypes:[],directTouch:!0,drawGraph:void 0,drawLegendSymbol:S.drawRectangle,drawTracker:o.prototype.drawTracker,getCenter:s.getCenter,getSymbol:_,isCartesian:!1,noSharedTooltip:!0,pointAttribs:o.prototype.pointAttribs,pointClass:R,requireSorting:!1,searchPoint:_,trackerGroups:["group","dataLabelsGroup"]}),P.registerSeriesType("pie",N),N})),M(o,"Series/Pie/PieDataLabel.js",[o["Core/Series/DataLabel.js"],o["Core/Globals.js"],o["Core/Renderer/RendererUtilities.js"],o["Core/Series/SeriesRegistry.js"],o["Core/Utilities.js"]],(function(s,o,_,S,R){var O,P=o.noop,D=_.distribute,N=S.series,V=R.arrayMax,j=R.clamp,K=R.defined,W=R.merge,U=R.pick,Y=R.relativeLength;return function(o){function p(){var s,o,_,S,R,O,P,j,Y,$,X,Z,Q=this,ee=Q.data,te=Q.chart,ie=Q.options.dataLabels||{},ae=ie.connectorPadding,ne=te.plotWidth,re=te.plotHeight,se=te.plotLeft,le=Math.round(te.chartWidth/3),oe=Q.center,de=oe[2]/2,ce=oe[1],he=[[],[]],ue=[0,0,0,0],pe=Q.dataLabelPositioners;Q.visible&&(ie.enabled||Q._hasPointLabels)&&(ee.forEach((function(s){s.dataLabel&&s.visible&&s.dataLabel.shortened&&(s.dataLabel.attr({width:"auto"}).css({width:"auto",textOverflow:"clip"}),s.dataLabel.shortened=!1)})),N.prototype.drawDataLabels.apply(Q),ee.forEach((function(s){s.dataLabel&&(s.visible?(he[s.half].push(s),s.dataLabel._pos=null,!K(ie.style.width)&&!K(s.options.dataLabels&&s.options.dataLabels.style&&s.options.dataLabels.style.width)&&s.dataLabel.getBBox().width>le&&(s.dataLabel.css({width:Math.round(.7*le)+"px"}),s.dataLabel.shortened=!0)):(s.dataLabel=s.dataLabel.destroy(),s.dataLabels&&1===s.dataLabels.length&&delete s.dataLabels))})),he.forEach((function(o,_){var N,V=o.length,W=[];if(V){if(Q.sortByAngle(o,_-.5),0<Q.maxLabelDistance){var ee=Math.max(0,ce-de-Q.maxLabelDistance),le=Math.min(ce+de+Q.maxLabelDistance,te.plotHeight);o.forEach((function(s){0<s.labelDistance&&s.dataLabel&&(s.top=Math.max(0,ce-de-s.labelDistance),s.bottom=Math.min(ce+de+s.labelDistance,te.plotHeight),N=s.dataLabel.getBBox().height||21,s.distributeBox={target:s.labelPosition.natural.y-s.top+N/2,size:N,rank:s.y},W.push(s.distributeBox))})),D(W,ee=le+N-ee,ee/5)}for(X=0;X<V;X++){if(s=o[X],O=s.labelPosition,S=s.dataLabel,$=!1===s.visible?"hidden":"inherit",Y=ee=O.natural.y,W&&K(s.distributeBox)&&(void 0===s.distributeBox.pos?$="hidden":(P=s.distributeBox.size,Y=pe.radialDistributionY(s))),delete s.positionIndex,ie.justify)j=pe.justify(s,de,oe);else switch(ie.alignTo){case"connectors":j=pe.alignToConnectors(o,_,ne,se);break;case"plotEdges":j=pe.alignToPlotEdges(S,_,ne,se);break;default:j=pe.radialDistributionX(Q,s,Y,ee)}S._attr={visibility:$,align:O.alignment},Z=s.options.dataLabels||{},S._pos={x:j+U(Z.x,ie.x)+({left:ae,right:-ae}[O.alignment]||0),y:Y+U(Z.y,ie.y)-10},O.final.x=j,O.final.y=Y,U(ie.crop,!0)&&(R=S.getBBox().width,ee=null,j-R<ae&&1===_?(ee=Math.round(R-j+ae),ue[3]=Math.max(ee,ue[3])):j+R>ne-ae&&0===_&&(ee=Math.round(j+R-ne+ae),ue[1]=Math.max(ee,ue[1])),0>Y-P/2?ue[0]=Math.max(Math.round(P/2-Y),ue[0]):Y+P/2>re&&(ue[2]=Math.max(Math.round(Y+P/2-re),ue[2])),S.sideOverflow=ee)}}})),0===V(ue)||this.verifyDataLabelOverflow(ue))&&(this.placeDataLabels(),this.points.forEach((function(s){var R;(Z=W(ie,s.options.dataLabels),o=U(Z.connectorWidth,1))&&(_=s.connector,(S=s.dataLabel)&&S._pos&&s.visible&&0<s.labelDistance?($=S._attr.visibility,(R=!_)&&(s.connector=_=te.renderer.path().addClass("highcharts-data-label-connector highcharts-color-"+s.colorIndex+(s.className?" "+s.className:"")).add(Q.dataLabelsGroup),te.styledMode||_.attr({"stroke-width":o,stroke:Z.connectorColor||s.color||"#666666"})),_[R?"attr":"animate"]({d:s.getConnectorPath()}),_.attr("visibility",$)):_&&(s.connector=_.destroy()))})))}function u(){this.points.forEach((function(s){var o,_=s.dataLabel;_&&s.visible&&((o=_._pos)?(_.sideOverflow&&(_._attr.width=Math.max(_.getBBox().width-_.sideOverflow,0),_.css({width:_._attr.width+"px",textOverflow:(this.options.dataLabels.style||{}).textOverflow||"ellipsis"}),_.shortened=!0),_.attr(_._attr),_[_.moved?"animate":"attr"](o),_.moved=!0):_&&_.attr({y:-9999})),delete s.distributeBox}),this)}function t(s){var o=this.center,_=this.options,S=_.center,R=_.minSize||80,O=null!==_.size;if(!O){if(null!==S[0])var P=Math.max(o[2]-Math.max(s[1],s[3]),R);else P=Math.max(o[2]-s[1]-s[3],R),o[0]+=(s[3]-s[1])/2;null!==S[1]?P=j(P,R,o[2]-Math.max(s[0],s[2])):(P=j(P,R,o[2]-s[0]-s[2]),o[1]+=(s[0]-s[2])/2),P<o[2]?(o[2]=P,o[3]=Math.min(Y(_.innerSize||0,P),P),this.translate(o),this.drawDataLabels&&this.drawDataLabels()):O=!0}return O}var _=[],S={radialDistributionY:function(s){return s.top+s.distributeBox.pos},radialDistributionX:function(s,o,_,S){return s.getX(_<o.top+2||_>o.bottom-2?S:_,o.half,o)},justify:function(s,o,_){return _[0]+(s.half?-1:1)*(o+s.labelDistance)},alignToPlotEdges:function(s,o,_,S){return s=s.getBBox().width,o?s+S:_-s-S},alignToConnectors:function(s,o,_,S){var R,O=0;return s.forEach((function(s){(R=s.dataLabel.getBBox().width)>O&&(O=R)})),o?O+S:_-O-S}};o.compose=function(o){s.compose(N),-1===_.indexOf(o)&&(_.push(o),(o=o.prototype).dataLabelPositioners=S,o.alignDataLabel=P,o.drawDataLabels=p,o.placeDataLabels=u,o.verifyDataLabelOverflow=t)}}(O||(O={})),O})),M(o,"Extensions/OverlappingDataLabels.js",[o["Core/Chart/Chart.js"],o["Core/Utilities.js"]],(function(s,o){function v(s,o){var _=!1;if(s){var R=s.newOpacity;s.oldOpacity!==R&&(s.alignAttr&&s.placed?(s[R?"removeClass":"addClass"]("highcharts-data-label-hidden"),_=!0,s.alignAttr.opacity=R,s[s.isOld?"animate":"attr"](s.alignAttr,null,(function(){o.styledMode||s.css({pointerEvents:R?"auto":"none"})})),S(o,"afterHideOverlappingLabel")):s.attr({opacity:R})),s.isOld=!0}return _}var _=o.addEvent,S=o.fireEvent,R=o.isArray,O=o.isNumber,P=o.objectEach,D=o.pick;_(s,"render",(function(){var s=this,o=[];(this.labelCollectors||[]).forEach((function(s){o=o.concat(s())})),(this.yAxis||[]).forEach((function(s){s.stacking&&s.options.stackLabels&&!s.options.stackLabels.allowOverlap&&P(s.stacking.stacks,(function(s){P(s,(function(s){s.label&&"hidden"!==s.label.visibility&&o.push(s.label)}))}))})),(this.series||[]).forEach((function(_){var S=_.options.dataLabels;_.visible&&(!1!==S.enabled||_._hasPointLabels)&&((S=function(_){return _.forEach((function(_){_.visible&&(R(_.dataLabels)?_.dataLabels:_.dataLabel?[_.dataLabel]:[]).forEach((function(S){var R=S.options;S.labelrank=D(R.labelrank,_.labelrank,_.shapeArgs&&_.shapeArgs.height),R.allowOverlap?(S.oldOpacity=S.opacity,S.newOpacity=1,v(S,s)):o.push(S)}))}))})(_.nodes||[]),S(_.points))})),this.hideOverlappingLabels(o)})),s.prototype.hideOverlappingLabels=function(s){var o,_,R,P=this,D=s.length,N=P.renderer,V=!1,q=function(s){var o,_,S=s.box?0:s.padding||0,R=o=0;if(s&&(!s.alignAttr||s.placed)){var P=s.alignAttr||{x:s.attr("x"),y:s.attr("y")},D=s.parentGroup;s.width||(o=s.getBBox(),s.width=o.width,s.height=o.height,o=N.fontMetrics(null,s.element).h);var V=s.width-2*S;return(_={left:"0",center:"0.5",right:"1"}[s.alignValue])?R=+_*V:O(s.x)&&Math.round(s.x)!==s.translateX&&(R=s.x-s.translateX),{x:P.x+(D.translateX||0)+S-(R||0),y:P.y+(D.translateY||0)+S-o,width:s.width-2*S,height:s.height-2*S}}};for(_=0;_<D;_++)(o=s[_])&&(o.oldOpacity=o.opacity,o.newOpacity=1,o.absoluteBox=q(o));for(s.sort((function(s,o){return(o.labelrank||0)-(s.labelrank||0)})),_=0;_<D;_++){var j=(q=s[_])&&q.absoluteBox;for(o=_+1;o<D;++o){var K=(R=s[o])&&R.absoluteBox;!j||!K||q===R||0===q.newOpacity||0===R.newOpacity||K.x>=j.x+j.width||K.x+K.width<=j.x||K.y>=j.y+j.height||K.y+K.height<=j.y||((q.labelrank<R.labelrank?q:R).newOpacity=0)}}s.forEach((function(s){v(s,P)&&(V=!0)})),V&&S(P,"afterHideAllOverlappingLabels")}})),M(o,"Core/Responsive.js",[o["Core/Utilities.js"]],(function(s){var o,_=s.extend,S=s.find,R=s.isArray,O=s.isObject,P=s.merge,D=s.objectEach,N=s.pick,V=s.splat,j=s.uniqueKey;return function(s){var o=[];s.compose=function(s){return-1===o.indexOf(s)&&(o.push(s),_(s.prototype,K.prototype)),s};var K=function(){function a(){}return a.prototype.currentOptions=function(s){var o=this,_={};return function c(s,_,S,P){var N;D(s,(function(s,D){if(!P&&-1<o.collectionsWithUpdate.indexOf(D)&&_[D])for(s=V(s),S[D]=[],N=0;N<Math.max(s.length,_[D].length);N++)_[D][N]&&(void 0===s[N]?S[D][N]=_[D][N]:(S[D][N]={},c(s[N],_[D][N],S[D][N],P+1)));else O(s)?(S[D]=R(s)?[]:{},c(s,_[D]||{},S[D],P+1)):S[D]=void 0===_[D]?null:_[D]}))}(s,this.options,_,0),_},a.prototype.matchResponsiveRule=function(s,o){var _=s.condition;(_.callback||function(){return this.chartWidth<=N(_.maxWidth,Number.MAX_VALUE)&&this.chartHeight<=N(_.maxHeight,Number.MAX_VALUE)&&this.chartWidth>=N(_.minWidth,0)&&this.chartHeight>=N(_.minHeight,0)}).call(this)&&o.push(s._id)},a.prototype.setResponsive=function(s,o){var _=this,R=this.options.responsive,O=this.currentResponsive,D=[];!o&&R&&R.rules&&R.rules.forEach((function(s){void 0===s._id&&(s._id=j()),_.matchResponsiveRule(s,D)}),this),(o=P.apply(void 0,D.map((function(s){return S((R||{}).rules||[],(function(o){return o._id===s}))})).map((function(s){return s&&s.chartOptions})))).isResponsiveOptions=!0,(D=D.toString()||void 0)!==(O&&O.ruleIds)&&(O&&this.update(O.undoOptions,s,!0),D?((O=this.currentOptions(o)).isResponsiveOptions=!0,this.currentResponsive={ruleIds:D,mergedOptions:o,undoOptions:O},this.update(o,s,!0)):this.currentResponsive=void 0)},a}()}(o||(o={})),o})),M(o,"masters/highcharts.src.js",[o["Core/Globals.js"],o["Core/Utilities.js"],o["Core/DefaultOptions.js"],o["Core/Animation/Fx.js"],o["Core/Animation/AnimationUtilities.js"],o["Core/Renderer/HTML/AST.js"],o["Core/FormatUtilities.js"],o["Core/Renderer/RendererUtilities.js"],o["Core/Renderer/SVG/SVGElement.js"],o["Core/Renderer/SVG/SVGRenderer.js"],o["Core/Renderer/HTML/HTMLElement.js"],o["Core/Renderer/HTML/HTMLRenderer.js"],o["Core/Axis/Axis.js"],o["Core/Axis/DateTimeAxis.js"],o["Core/Axis/LogarithmicAxis.js"],o["Core/Axis/PlotLineOrBand/PlotLineOrBand.js"],o["Core/Axis/Tick.js"],o["Core/Tooltip.js"],o["Core/Series/Point.js"],o["Core/Pointer.js"],o["Core/MSPointer.js"],o["Core/Legend/Legend.js"],o["Core/Chart/Chart.js"],o["Core/Series/Series.js"],o["Core/Series/SeriesRegistry.js"],o["Series/Column/ColumnSeries.js"],o["Series/Column/ColumnDataLabel.js"],o["Series/Pie/PieSeries.js"],o["Series/Pie/PieDataLabel.js"],o["Core/Series/DataLabel.js"],o["Core/Responsive.js"],o["Core/Color/Color.js"],o["Core/Time.js"]],(function(s,o,_,S,R,O,P,D,N,V,j,K,W,U,Y,$,X,Z,Q,ee,te,ie,ae,ne,re,se,le,oe,de,ce,he,ue,pe){return s.animate=R.animate,s.animObject=R.animObject,s.getDeferredAnimation=R.getDeferredAnimation,s.setAnimation=R.setAnimation,s.stop=R.stop,s.timers=S.timers,s.AST=O,s.Axis=W,s.Chart=ae,s.chart=ae.chart,s.Fx=S,s.Legend=ie,s.PlotLineOrBand=$,s.Point=Q,s.Pointer=te.isRequired()?te:ee,s.Series=ne,s.SVGElement=N,s.SVGRenderer=V,s.Tick=X,s.Time=pe,s.Tooltip=Z,s.Color=ue,s.color=ue.parse,K.compose(V),j.compose(N),s.defaultOptions=_.defaultOptions,s.getOptions=_.getOptions,s.time=_.defaultTime,s.setOptions=_.setOptions,s.dateFormat=P.dateFormat,s.format=P.format,s.numberFormat=P.numberFormat,s.addEvent=o.addEvent,s.arrayMax=o.arrayMax,s.arrayMin=o.arrayMin,s.attr=o.attr,s.clearTimeout=o.clearTimeout,s.correctFloat=o.correctFloat,s.createElement=o.createElement,s.css=o.css,s.defined=o.defined,s.destroyObjectProperties=o.destroyObjectProperties,s.discardElement=o.discardElement,s.distribute=D.distribute,s.erase=o.erase,s.error=o.error,s.extend=o.extend,s.extendClass=o.extendClass,s.find=o.find,s.fireEvent=o.fireEvent,s.getMagnitude=o.getMagnitude,s.getStyle=o.getStyle,s.inArray=o.inArray,s.isArray=o.isArray,s.isClass=o.isClass,s.isDOMElement=o.isDOMElement,s.isFunction=o.isFunction,s.isNumber=o.isNumber,s.isObject=o.isObject,s.isString=o.isString,s.keys=o.keys,s.merge=o.merge,s.normalizeTickInterval=o.normalizeTickInterval,s.objectEach=o.objectEach,s.offset=o.offset,s.pad=o.pad,s.pick=o.pick,s.pInt=o.pInt,s.relativeLength=o.relativeLength,s.removeEvent=o.removeEvent,s.seriesType=re.seriesType,s.splat=o.splat,s.stableSort=o.stableSort,s.syncTimeout=o.syncTimeout,s.timeUnits=o.timeUnits,s.uniqueKey=o.uniqueKey,s.useSerialIds=o.useSerialIds,s.wrap=o.wrap,le.compose(se),ce.compose(ne),U.compose(W),Y.compose(W),de.compose(oe),$.compose(W),he.compose(ae),s})),o["masters/highcharts.src.js"]._modules=o,o["masters/highcharts.src.js"]}))}}); |