(function () {
  //Inject code v5.2

  var highcharts = document.createElement('script');
  var injectVersion = 5;
  var cdn = 'https://code.highcharts.com/';
  var loaded = 0;  
  var encodedUrl = encodeURI('https://https://app.everviz.com//show/MCzKFq77y');
  var chartCreated = false;
  var chart = false;
  var delayGen = 0;
  var scripts = [
    "highcharts.js",
    "modules/stock.js",
    "highcharts-more.js",
    "highcharts-3d.js",
    "modules/data.js",
    "modules/exporting.js",
    "modules/funnel.js",
    "modules/solid-gauge.js",
    "modules/export-data.js",
    "modules/accessibility.js"
  ];

  const inEmbedCode = window.location.pathname.indexOf('/embed/') > -1;
  const inEverviz = window.location.origin === 'https://app.everviz.com';
  const loadHighchartsModules = inEverviz && !inEmbedCode;

  var legacyElementClassName = 'highcharts-MCzKFq77y';
  var elementClassName = 'everviz-MCzKFq77y';
  var externalCSS = [
    "https://app.everviz.com/fonts/Ga2jPQJjN/font.css",
    "https://app.everviz.com/resources/css/highcharts-data-table.css"
  ];

  var extraScripts = [
  "https://app.everviz.com/resources/js/everviz-tooltip-helper.js",
  "https://app.everviz.com/resources/js/highcharts-scroll-animation.js",
  "https://app.everviz.com/resources/js/everviz-utils.js",
  "https://app.everviz.com/resources/js/highcharts-overrides.js",
  ];

  var options = {"colors":["#FF495E","#28277E","#6D5BD1","#F9DCE7","#AEC8FA","#DDD8F5"],"chart":{"style":{"fontFamily":"Athletics-Regular","color":"#7142ff","fontSize":"16px"},"type":"scatter","polar":false,"width":700},"title":{"text":"Change in the level of risk of Government plans","align":"left","style":{"color":"#000000","fontSize":"22px"}},"subtitle":{"text":"<div>CCC's policy assessment for the period 2028-2032</div>","align":"left","style":{"color":"#000000","fontSize":"16px"},"useHTML":true},"credits":{"text":"","href":""},"plotOptions":{"series":{"borderRadius":2,"pointPadding":0.01,"groupPadding":0.05,"borderWidth":0,"shadow":false,"marker":{"enabled":true},"lineWidth":0,"states":{"select":{"color":"#EFFFEF","borderColor":"black","dashStyle":"dot"}},"label":{"enabled":false},"dataLabels":{"enabled":true,"format":"{point.label}"}},"column":{"groupPadding":0.2},"scatter":{"tooltip":{}}},"legend":{"align":"center","verticalAlign":"bottom","itemMarginBottom":10,"x":0,"symbolRadius":2,"itemStyle":{"fontFamily":"Athletics-Regular","fontSize":"16px","color":"#7142ff","fontWeight":"bold"},"layout":"horizontal"},"series":[{"data":[],"turboThreshold":0,"type":"column","stacking":"stream","showInLegend":true,"color":"#a1d800","itemPadding":0.1,"tooltip":{"valueSuffix":""}},{"data":[],"turboThreshold":0,"type":"column","stacking":"stream","color":"#ffff4b","tooltip":{"valueSuffix":""}},{"data":[],"turboThreshold":0,"type":"column","stacking":"stream","color":"#ffac00","tooltip":{"valueSuffix":""}},{"data":[],"turboThreshold":0,"type":"column","stacking":"stream","color":"#ff2000","tooltip":{"valueSuffix":""}},{"data":[],"turboThreshold":0,"type":"column","stacking":"stream","fillOpacity":"","showInLegend":false,"opacity":0,"color":"#28004900","tooltip":{"valueSuffix":"","enabled":false},"enableMouseTracking":false},{"data":[],"turboThreshold":0,"type":"column","stacking":"stream","yAxis":1,"opacity":1,"color":"#7142ff","tooltip":{"pointFormat":"<div><span style=\"color: rgb(0, 0, 0); font-size: 12px;\"><span style=\"color: {point.color}\">●</span> {series.name}: </span><strong style=\"color: rgb(0, 0, 0); font-size: 12px;\">{point.extra}&nbsp;Mt</strong></div>","valueSuffix":"","enabled":false,"animation":false},"enableMouseTracking":false},{"data":[],"turboThreshold":0,"type":"column","stacking":"stream","yAxis":1,"opacity":0,"showInLegend":false,"tooltip":{"valueSuffix":"","enabled":false,"animation":false,"followPointer":false},"enableMouseTracking":false},{"data":[],"turboThreshold":0,"color":"#280049","marker":{"radius":6},"tooltip":{"valueSuffix":"","headerFormat":"<span style=\"font-size: 0.8em\">{point.extra}</span><br/>"},"enableMouseTracking":false},{"data":[],"turboThreshold":0,"color":"#999999","marker":{"symbol":"circle","enabled":true,"radius":6},"tooltip":{"valueSuffix":"","headerFormat":"<span style=\"font-size: 0.8em\">{point.extra}</span><br/>","headerShape":"callout"},"enableMouseTracking":false},{"data":[],"turboThreshold":0,"marker":{"symbol":null,"enabled":false},"showInLegend":false}],"lang":{"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"numericSymbols":["k","M","G","T","P","E"]},"tooltip":{"pointFormat":"<div><span style=\"color: rgb(0, 0, 0); font-size: 12px;\"><span style=\"color: {point.color}\">●</span> {series.name}: </span><strong style=\"color: rgb(0, 0, 0); font-size: 12px;\">{point.y}</strong><span style=\"color: rgb(0, 0, 0); font-size: 12px;\">&nbsp;Mt</span></div>","footerFormat":"","useHTML":true,"style":{"fontWeight":null,"fontSize":null,"color":null},"valueDecimals":1,"shared":false,"valueSuffix":" ","enabled":true,"valuePrefix":"","headerFormat":"<div><span style=\"font-size: 0.8em\">{point.key}</span><br></div>"},"everviz":{"tooltip":{"useEvervizHelper":true,"options":{"vars":{}}}},"caption":{"text":"<div>Notes: (1) This assessment uses Government plans listed in Annex B, tables 5 &amp; 6 of the Government's Carbon Budget Delivery Plan (CBDP). See the CCC's Monitoring Framework for the assessment criteria. (2) The baseline is an adjustment to the Government’s CBDP baseline, with the impact of some policies removed so that they can be assessed. Refer to our 2023 UK Progress Report for notes on our methodology. (3) We have adjusted the Government’s published CBDP pathway and baseline for land use to account for methodological changes between the 1990-2019 and 1990-2020 inventories. (4) The CBDP projections include only the quantified plans. Unquantified plans may lead to further emissions reductions. (5) Policy updates since June 2023 included in the quantified assessment include: the delayed phase-out date for fossil-fuel cars and vans (2030 to 2035), the confirmed ZEV mandate the delayed phase-put date for oil and LPG boilers (2026 to 2035); the exemption of 20% of homes on the 2035 gas boiler phase out; scrapping EPC C by 2028 for private rented homes; increase of the Boiler Upgrade Scheme grant per boiler; the recent failed offshore wind auction and the Tata Steel deal for Port Talbot. (6) The assessment considers average annual emissions over the 5th Carbon Budget period (2028-2032), and is compared against the UK's Nationally Determined Contribution (NDC) in 2030, which, for comparability, includes international aviation and shipping from the Government's Carbon Budget Delivery Plan.</div>","style":{"color":"#7142ff","fontSize":"12px"},"useHTML":true},"exporting":{"url":"https://api.everviz.com/export"},"xAxis":{"gridLineColor":"#999999","gridLineWidth":0,"labels":{"enabled":true,"style":{"color":"#7142ff","fontSize":"16px"}},"lineColor":"#999999","lineWidth":0.5,"title":{"style":{"fontSize":"12px"}}},"yAxis":[{"visible":true,"ceiling":500,"gridLineColor":"#999999","floor":0,"min":0,"max":500,"title":{"text":"Average annual emissions (MtCO₂e)","style":{"fontSize":"16px","fontWeight":"bold","color":"#7142ff"}},"gridLineWidth":0.5,"labels":{"style":{"color":"#7142ff","fontSize":"16px"}},"tickInterval":50,"tickAmount":11},{"everviz":1,"ceiling":500,"min":0,"max":500,"visible":false,"tickInterval":50,"tickAmount":11}],"data":{"csv":"\"Category\";\"Credible plans\";\"Some risks\";\"Significant risks\";\"Insufficient plans\";\"Residual emissions for plot\";\"NDC\";\"Residual target for plot\";\"Government pathway\";\"Emissions if no action\";\"NDC\"\n\"June 2023 assessment\";41.8;51.3;39.4;30.3;310.7;3;303.59;310.7;473;303.6\n\"October 2023 assessment (excluding PM speech)\";51.8;42;45.1;23.9;310.7;3;303.59;310.7;473;303.6\n\"October 2023 assessment (including PM speech)\";47.3;44.8;42.1;28.7;310.7;3;303.59;310.7;473;303.6","seriesMapping":[{"x":0,"y":1},{"x":0,"y":2},{"x":0,"y":3},{"x":0,"y":4},{"x":0,"y":5},{"x":0,"y":6},{"x":0,"y":7},{"x":0,"y":8},{"x":0,"y":9},{"x":0,"y":10}]},"stockTools":{"gui":{"enabled":false}}};
  var optionsStub;
  
  var templateDataSettings = {};

  var pluginCode = {};;

  function isScriptAlreadyIncluded(src){

    var scripts = document.getElementsByTagName("script");
    for (var i = 0; i < scripts.length; i++) {
      if (scripts[i].hasAttribute('src')) {
        const scriptTag = scripts[i].getAttribute('src') || '';
        if ((scriptTag.indexOf(src) >= 0) || 
            (scriptTag.indexOf('highcharts.src.js') > -1 && src === 'highcharts.js') ||
            ((scriptTag.indexOf('stock/highstock.js') > -1) && src === 'modules/highstock.js') ||
             (loadHighchartsModules && src === 'highcharts.js')) {
          return true;
        }
      }
    }
    return false;
  }

  function loadCSS() {
    var cssLength = externalCSS.length;
    for(var i=0; i < cssLength; i++) {
      var css = document.createElement('link');
      css.rel  = 'stylesheet';
      css.type = "text/css";
      css.href = externalCSS[i];
      document.body.appendChild(css);
    }
  }

  function allScriptsIncluded(){
    var allScripts = scripts.concat(extraScripts);
    var haveAllScriptsBeenIncluded = true;
    var scriptsToUse = document.getElementsByTagName("script");
    for(var n=0;n<allScripts.length;n++) {
      if (!isScriptAlreadyIncluded(allScripts[n], scriptsToUse)) {
        haveAllScriptsBeenIncluded = false;
        break;
      }
    }
    return haveAllScriptsBeenIncluded;
  }

  function modifyOptions(){
    if (options.data && !options.data.complete) {
      options.data.complete = function(chartOptions) {
        const keys = Object.keys(templateDataSettings || {});
        keys.forEach(function(key) {
          const serie = chartOptions.series[key];
          (serie.data || []).forEach(function(d, i) {
            if (templateDataSettings[key].data && templateDataSettings[key].data[i]) {
              window["everviz"].merge(d, templateDataSettings[key].data[i]);
            }
          })
        })

        if (options && options.chart && options.chart.type === 'packedbubble') {
          chartOptions.series.forEach((series) => {
            series.data = series.data.filter((point) => point.value);
          });
        }

        return chartOptions;
      }
    }
    
    optionsStub = window["everviz"].createStub(options);
    window["everviz"].merge(options, pluginCode);
    if ('Chart' === 'Map') window["everviz"].modifyMapType(options);
  }

  function createChart() {
    if(chartCreated) return;

    var hasProj4 = extraScripts.indexOf('https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js') > -1;

    if (!allScriptsIncluded() || 
      (hasProj4 && !window.proj4) || 
      !window["everviz"].merge ||
      !window["everviz"].createStub) {
      setTimeout(createChart, 200);
      return;
    }  

    modifyOptions();

    if (hasProj4) delayGen = 100;

    if (typeof window['Highcharts'] !== 'undefined') {
      
    if (window['everviz'] && window['everviz'].tooltipFormatter && 
        options.everviz && options.everviz.tooltip){
      if (!options.tooltip) options.tooltip = {};
      options.tooltip.formatter = window['everviz'].tooltipFormatter;
    }


    if (options.yAxis && options.yAxis.length === 1) options.yAxis = options.yAxis[0];
    if (options.xAxis && options.xAxis.length === 1) options.xAxis = options.xAxis[0];
    if (options.zAxis && options.zAxis.length === 1) options.zAxis = options.zAxis[0];

    /*
// Sample of extending options:
Highcharts.merge(true, options, {
    chart: {
        backgroundColor: "#bada55"
    },
    plotOptions: {
        series: {
            cursor: "pointer",
            events: {
                click: function(event) {
                    alert(this.name + " clicked\n" +
                          "Alt: " + event.altKey + "\n" +
                          "Control: " + event.ctrlKey + "\n" +
                          "Shift: " + event.shiftKey + "\n");
                }
            }
        }
    }
});
*/


      if (options && (options.lang || options.global)) {
        Highcharts.setOptions({
          global: options.global || {},
          lang: options.lang || {}
        });
      }

      if (Highcharts.Annotation) {
        Highcharts.Annotation.ControlPoint.prototype.redraw = function (animation) {
          this.graphic[animation ? 'animate' : 'attr'](
              this.options.positioner ? this.options.positioner.call(this, this.target) : null
          );
        };
      }

      chartCreated = true;
      window.HighchartsCloud.hasLoaded = true; 
      setTimeout(function(){
          if (window["everviz"] && window["everviz"].pendingAnim) {
            //TODO: change to using classes instead.
            //Bit of work to do there due to backward compatibility
            const elements = document.querySelectorAll(
              '#' + elementClassName + 
              ', #' + legacyElementClassName
            );
            const elementsArray = Array.prototype.slice.call(elements);
            elementsArray.forEach(function(element, elementIndex) {

              window["everviz"].updateRenderTo(optionsStub, element);
              chart = new Highcharts.Chart(optionsStub);
              

              window["everviz"].pendingAnim({
                id: element.id + '-' + elementIndex, 
                loaded: false,
                options: options,
                appear:function(){
                  window["everviz"].updateRenderTo(options, element);
                  chart = new Highcharts.Chart(options); 

                },
                element: element
              });
            });

          } else {
            const element = document.querySelector('#' + legacyElementClassName);

            if (element) chart = new Highcharts.Chart(legacyElementClassName, options);  
            else chart = new Highcharts.Chart(elementClassName, options);  

            
          }
      }, delayGen);
    }
  }

  function check(scripts, cb) {
    if (loaded === scripts.length) {
      if (cb) {
        cb();
      } else {


        //Create first project
        if (!window.HighchartsCloud.versions ||
           (window.HighchartsCloud.versions && window.HighchartsCloud.versions.length !== window.HighchartsCloud.ondone.length)) {
             
          for (var i = 0; i < window.HighchartsCloud.ondone.length; i++) {
            try {
              window.HighchartsCloud.ondone[i]();
            } catch(e) {
              console.error(e);
            }
          }
        } else {
          if (window.HighchartsCloud.stack.length) {
            window.HighchartsCloud.stack[0]();
            window.HighchartsCloud.stack.shift();
            const shouldRenderNextChart = window.HighchartsCloud.stack.length > 0;
            if (shouldRenderNextChart) {
              window.HighchartsCloud.stack[0](true);
            }
          }
        }
        
      }
    }
  }

  function loadScript(s, scripts, cb) {
    if (!s) next();
    
    function next() {
      ++loaded;
      if (loaded < scripts.length) {
        loadScript(scripts[loaded], scripts, cb);
      }
      check(scripts, cb);
    }

    if (isScriptAlreadyIncluded(s)) {
      return next();
    }

    var n = document.createElement('script');

    n.onload = function () {
      next();
    };

    if (s.indexOf('http') >= 0) {
      n.src = s;
    } else {
      n.src = cdn + s;
    }
    document.body.appendChild(n);
  }

  function loadExtraScripts(){
    if (extraScripts.length > 0) {
      loaded = 0;
      loadScript(extraScripts[0], extraScripts);
    } else {
      check(scripts);
    }
  }

  function loadExtraScriptsAndMakeChart(isUsingStack){
    loaded = 0;
    loadCSS();
    if (extraScripts.length > 0) {
      if (isUsingStack) {
        window.HighchartsCloud.stack[0] = createChart;
        loadScript(extraScripts[0], extraScripts);
      }
      else loadScript(extraScripts[0], extraScripts, createChart);
    } else {
      check(extraScripts);
    }
  }

  function getAllScripts(){
    var evervizScripts = [];
    var allScripts = scripts.map(function(script) {
      return 'highcharts/'+ script.replace('highcharts/highcharts.js', 'highcharts.js').replace('.js', '');
    }).concat(
      extraScripts.map(function(script) {
        if (script.indexOf('https://code.highcharts.com/') > -1) {
          return 'highcharts/'+ script.replace('https://code.highcharts.com/', '').replace('.js', '');
        } else if (script.indexOf('https://app.everviz.com/') > -1) {
          evervizScripts.push(script);
          return null;
        } else return script;
      }).filter(function(s) {
        return s !== null;
      })
    );

    allScripts.forEach(function(script) {
      if (window.HighchartsCloud.allScripts)
        window.HighchartsCloud.allScripts[script] = 1
    });

    return {
      allHighchartsScripts: allScripts,
      evervizScripts: evervizScripts
    }
  }

  function loadRequireJSScript(){
    require.config({
      packages: [{
        name: 'highcharts',
        main: 'highcharts'
      }],
      paths: {
        'highcharts': 'https://code.highcharts.com'
      }
    });

    const allScripts = getAllScripts();

    require(
      allScripts.allHighchartsScripts,
      function (Highcharts) {
        //Attach highcharts to the window for use in the everviz scripts
        window.Highcharts = Highcharts;
        if (allScripts && allScripts.evervizScripts.length) {
          require(allScripts.evervizScripts, function(){
            createChart();
            loadCSS();
          })
        } else {
          createChart();
          loadCSS();
        }
      }
    );
  }

  function loadInitialScript(){
    if (window['require'] && typeof require === "function" && typeof require.specified === "function") {
      loadRequireJSScript();
    } else {
      getAllScripts()
      loadScript(scripts[0], scripts, loadExtraScripts);
      loadCSS();
    }
  }

  if (typeof window['HighchartsCloud'] === 'undefined') {
    window.HighchartsCloud = {
      ondone: [createChart],
      stack: [createChart],
      hasWrapped: false,
      hasLoaded: false,
      externalCSS: externalCSS,
      versions: [injectVersion],
      types: ['chart'],
      allScripts: {},
      projectUUIDs: {'MCzKFq77y': 1},
    };

    loadInitialScript();

  } else {
    if (window.HighchartsCloud.externalCSS) window.HighchartsCloud.externalCSS.push(externalCSS);
    if (!window.HighchartsCloud.hasLoaded) {
      if (!window.HighchartsCloud.projectUUIDs) window.HighchartsCloud.projectUUIDs = {};

      if (!window.HighchartsCloud.projectUUIDs['MCzKFq77y']) {

        window.HighchartsCloud.projectUUIDs['MCzKFq77y'] = 1;
        window.HighchartsCloud.ondone.push(loadExtraScriptsAndMakeChart);
        if (window.HighchartsCloud.stack) {
          window.HighchartsCloud.stack.push(loadExtraScriptsAndMakeChart);
          window.HighchartsCloud.versions.push(injectVersion);
          window.HighchartsCloud.types.push('chart');
        }

      }
      if (window['require'] && typeof require === "function" && typeof require.specified === "function") {
        getAllScripts()
        loadRequireJSScript();
      }
    }
    else {
      if (window['require'] && typeof require === "function" && typeof require.specified === "function") {
        loadRequireJSScript();
      } else {
        getAllScripts()
        loadExtraScriptsAndMakeChart();
      }
    }
  }

}());
