/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}([function(e,t,r){e.exports=r(3)(1465)},function(e,t,r){"use strict";(function(e){function n(t,r){const n=t.split(":").pop();if(!n)return void r.debug(`Unable to decode ${n}`);let o;try{o=e.from(n,"base64").toString("utf8")}catch{return void r.debug(`base64 decoding failed on ${n}`)}const l=o.split("$");if(l.length<3)return void r.debug(`Expected at least 3 parts in ${o}`);const[s,d]=i(l[0]),[a,u]=i(l[1],d),[c,p]=i(l[2],d);return{host:s,defaultPort:d,elasticsearchUrl:`https://${a}.${s}:${u}`,kibanaUrl:`https://${c}.${s}:${p}`}}function i(e,t="443"){const[r,n=t]=e.split(":");return[r,n]}r.d(t,"a",(function(){return n}))}).call(this,r(8).Buffer)},function(e,t){e.exports=__kbnSharedDeps__.EmotionReact},function(e,t){e.exports=__kbnSharedDeps_npm__},function(e,t){e.exports=__kbnSharedDeps__.React},function(e,t){e.exports=__kbnSharedDeps__.Rxjs},function(e,t,r){r(7),__kbnBundles__.define("plugin/cloud/public",r,9)},function(e,t,r){r.p=window.__kbnPublicPath__.cloud},function(e,t,r){e.exports=r(3)(2943)},function(e,t,r){"use strict";r.r(t),r.d(t,"plugin",(function(){return p}));var n=r(0),i=r.n(n),o=r(4),l=r.n(o),s=r(5);function d(e){if(e)return e.split("/").pop()}var a=r(1);function u(e,t){return e&&t?`${e}${t}`:""}var c=r(2);class plugin_CloudPlugin{constructor(e){var t;i()(this,"config",void 0),i()(this,"isCloudEnabled",void 0),i()(this,"isServerlessEnabled",void 0),i()(this,"contextProviders",[]),i()(this,"logger",void 0),this.initializerContext=e,this.config=this.initializerContext.config.get(),this.isCloudEnabled="string"==typeof this.config.id,this.isServerlessEnabled=!(null===(t=this.config.serverless)||void 0===t||!t.project_id),this.logger=e.logger.get()}setup(e){var t,r,n,i,o;!function(e,t){if(!t.id)return;const{id:r,trial_end_date:n,is_elastic_staff_owned:i}=t;e.registerContextProvider({name:"Cloud Deployment Metadata",context$:Object(s.of)({cloudId:r,deploymentId:d(t.deployment_url),cloudTrialEndDate:n,cloudIsElasticStaffOwned:i}),schema:{cloudId:{type:"keyword",_meta:{description:"The Cloud ID"}},deploymentId:{type:"keyword",_meta:{description:"The Deployment ID",optional:!0}},cloudTrialEndDate:{type:"date",_meta:{description:"When the Elastic Cloud trial ends/ended",optional:!0}},cloudIsElasticStaffOwned:{type:"boolean",_meta:{description:"`true` if the owner of the deployment is an Elastician",optional:!0}}}})}(e.analytics,this.config);const{id:l,cname:u,base_url:c,trial_end_date:p,is_elastic_staff_owned:f}=this.config;let h;return l&&(h=Object(a.a)(l,this.logger)),{cloudId:l,deploymentId:d(this.config.deployment_url),cname:u,baseUrl:c,...this.getCloudUrls(),elasticsearchUrl:null===(t=h)||void 0===t?void 0:t.elasticsearchUrl,kibanaUrl:null===(r=h)||void 0===r?void 0:r.kibanaUrl,cloudHost:null===(n=h)||void 0===n?void 0:n.host,cloudDefaultPort:null===(i=h)||void 0===i?void 0:i.defaultPort,trialEndDate:p?new Date(p):void 0,isElasticStaffOwned:f,isCloudEnabled:this.isCloudEnabled,isServerlessEnabled:this.isServerlessEnabled,serverless:{projectId:null===(o=this.config.serverless)||void 0===o?void 0:o.project_id},registerCloudService:e=>{this.contextProviders.push(e)}}}start(e){var t,r,n;e.chrome.setHelpSupportUrl("https://cloud.elastic.co/support");const{deploymentUrl:i,profileUrl:o,billingUrl:s,organizationUrl:d,performanceUrl:u,usersAndRolesUrl:p,projectsUrl:f}=this.getCloudUrls();let h;return this.config.id&&(h=Object(a.a)(this.config.id,this.logger)),{CloudContextProvider:({children:e})=>Object(c.jsx)(l.a.Fragment,null,this.contextProviders.reduce(((e,t)=>Object(c.jsx)(t,null," ",e," ")),e)),isCloudEnabled:this.isCloudEnabled,cloudId:this.config.id,billingUrl:s,deploymentUrl:i,profileUrl:o,organizationUrl:d,projectsUrl:f,elasticsearchUrl:null===(t=h)||void 0===t?void 0:t.elasticsearchUrl,kibanaUrl:null===(r=h)||void 0===r?void 0:r.kibanaUrl,isServerlessEnabled:this.isServerlessEnabled,serverless:{projectId:null===(n=this.config.serverless)||void 0===n?void 0:n.project_id},performanceUrl:u,usersAndRolesUrl:p}}stop(){}getCloudUrls(){const{profile_url:e,billing_url:t,organization_url:r,deployment_url:n,base_url:i,performance_url:o,users_and_roles_url:l,projects_url:s}=this.config,d=u(i,n);return{deploymentUrl:d,profileUrl:u(i,e),billingUrl:u(i,t),organizationUrl:u(i,r),snapshotsUrl:`${d}/elasticsearch/snapshots/`,performanceUrl:u(i,o),usersAndRolesUrl:u(i,l),projectsUrl:u(i,s)}}}function p(e){return new plugin_CloudPlugin(e)}}]);