(function () {
  //Inject code v3.0.3

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

  var cdn = 'https://code.highcharts.com/';
  var loaded = 0;  
  var encodedUrl = encodeURI('https://https://app.everviz.com//show/O4pfO1Kzt');
  var chartCreated = 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"
    /* "modules/series-label.js" */
  ];

  var externalCSS = [
    "https://app.everviz.com/static/fonts/gordita/style.css",
    "https://app.everviz.com/resources/css/highcharts-data-table.css"
  ];

  var extraScripts = [
  "https://code.highcharts.com/modules/annotations.js",
  "https://code.highcharts.com/modules/annotations-advanced.js",
  "https://app.everviz.com/resources/js/highcharts-scroll-animation.js",
  "https://app.everviz.com/resources/js/everviz-utils.js"
  ];

  var options = {"title":{"text":"","align":"left","x":10},"subtitle":{"text":"","align":"left","x":10},"colors":["#F54644","#FCE033","#235A61","#4241EB","#0DD6CC","#C44CD6","#FF9655","#FFF263","#6AF9C4"],"legend":{"align":"left","verticalAlign":"top","itemMarginBottom":10,"x":0,"symbolRadius":2,"itemStyle":{"color":"#333333","cursor":"pointer","fontSize":"15px","fontWeight":"","textOverflow":"ellipsis","fontFamily":"\"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif"}},"plotOptions":{"series":{"marker":{"enabled":false},"lineWidth":3,"allowPointSelect":true,"states":{"select":{"color":"#EFFFEF","borderColor":"black","dashStyle":"dot"}}}},"chart":{"backgroundColor":""},"exporting":{"enabled":false},"credits":{"text":"everviz.com","href":"https://everviz.com","enabled":false},"series":[{"data":[],"turboThreshold":0,"_colorIndex":0,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":1,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":2,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":3,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":4,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":5,"_symbolIndex":0,"type":"line"},{"data":[],"turboThreshold":0,"_colorIndex":6,"_symbolIndex":0,"type":"line"}],"stockTools":{"gui":{"enabled":false}},"navigation":{"bindingsClassName":"tools-container"},"labels":{"items":[]},"pane":{"background":[]},"responsive":{"rules":[]},"annotations":[],"yAxis":{"title":{"text":""},"labels":{"format":"{value}"}},"data":{"csv":"﻿x;President Trump;Vice President Pence;Congress;The CDC;The UN;WHO;My State Government\n;;;;;;;\n3/1/20;12;;11;63;;;\n3/5/20;2;;6;56;;;\n3/9/20;0;6;7;58;23;48;43\n3/14/20;1;7;6;58;22;49;46\n3/16/20;4;12;25;63;26;58;55\n3/20/20;14;17;27;66;30;56;55\n3/22/20;10;16;23;66;30;56;53\n3/26/20;9;15;0;70;27;58;50\n3/29/20;7;15;25;68;30;57;57\n4/1/20;2;14;19;66;28;53;57\n4/5/20;1;8;16;69;27;54;57\n4/12/20;-4;10;17;62;23;35;58\n4/19/20;2;12;3;66;16;25;52\n4/26/20;-8;5;12;60;18;27;46\n5/3/20;-9;1;5;56;18;25;43\n5/10/20;-7;0;-3;51;14;22;37\n5/17/20;-7;-2;-3;48;11;20;38\n5/25/20;-6;4;-7;46;12;17;39\n6/1/20;-12;1;-6;44;12;16;34\n6/7/20;-13;-3;-9;49;15;18;37\n6/14/20;-18;-8;-10;47;14;21;33\n6/21/20;-17;-8;-12;48;10;21;32\n6/29/20;-18;-9;-12;45;13;23;29\n7/4/20;-17;-7;-17;42;11;20;30\n7/12/20;-19;-9;-19;44;7;20;26\n7/19/20;-20;-11;-26;44;11;19;25\n7/26/20;-23;-12;-19;47;13;25;24\n8/2/20;-18;-6;-25;42;11;22;27\n8/10/20;-21;-11;-28;42;10;22;25\n8/17/20;-14;-7;-27;45;12;20;26\n8/23/20;-16;-6;-24;46;13;24;30\n8/30/20;-18;-9;-20;38;13;23;27\n9/6/20;-14;-4;-25;32;12;15;24\n9/13/20;-13;-3;-25;39;9;25;26\n9/20/20;-14;-9;-21;40;14;25;22\n9/27/20;-14;-7;-22;35;14;21;27\n10/4/20;-14;-3;-22;38;11;24;23\n10/10/20;-11;-7;-24;40;13;26;25\n10/18/20;-17;-10;-24;37;11;23;24\n10/25/20;-19;-11;-25;43;13;24;22\n10/31/20;-16;-8;-22;39;13;23;29\n11/9/20;-16;-6;-23;40;13;19;28\n11/14/20;-20;-12;-24;43;12;23;18\n11/23/20;-18;-12;-29;41;9;20;17\n11/29/20;-13;-8;-24;41;12;21;15\n12/6/20;-17;-7;-22;44;15;24;21\n12/12/20;-13;-1;-20;45;15;28;25","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}]}};
  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')) {
          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 = function(options) {
        const keys = Object.keys(templateDataSettings || {});
        keys.forEach(function(key) {
          const serie = options.series[key];
          (serie.data || []).forEach(function(d, i) {
            if (templateDataSettings[key].data && templateDataSettings[key].data[i]) {
              window["everviz"].merge(d, templateDataSettings[key].data[i]);
            }
          })
        })  
        return options;
      }
    }
    
    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)) {
      setTimeout(createChart, 200);
      return;
    }  

    modifyOptions();

    if (hasProj4) delayGen = 100;

    if (typeof window['Highcharts'] !== 'undefined') {
      

      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) {

          var chart = new Highcharts.Chart('highcharts-O4pfO1Kzt', optionsStub); 
          window["everviz"].pendingAnim({
            id: 'highcharts-O4pfO1Kzt', 
            loaded: false,
            options: options,
            appear:function(){
              chart.destroy();
              chart = new Highcharts.Chart('highcharts-O4pfO1Kzt', options); 
            },
            element: document.querySelector('#highcharts-O4pfO1Kzt')
          });
        } else {
          new Highcharts.Chart('highcharts-O4pfO1Kzt', options);   
        }
      }, delayGen);
    }
  }

  function check(scripts, cb) {
    if (loaded === scripts.length) {
      if (cb) {
        cb();
      } else {
        for (var i = 0; i < window.HighchartsCloud.ondone.length; i++) {
          try {
            window.HighchartsCloud.ondone[i]();
          } catch(e) {
            console.error(e);
          }
        }
      }
    }
  }

  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('https') >= 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(){
    loaded = 0;
    loadCSS();
    if (extraScripts.length > 0) {
      loadScript(extraScripts[0], extraScripts, createChart);
    } else {
      check(extraScripts);
    }
  }

  if (typeof window['HighchartsCloud'] === 'undefined') {
    window.HighchartsCloud = {
      ondone: [createChart],
      hasWrapped: false,
      hasLoaded: false
    };

    loadScript(scripts[0], scripts, loadExtraScripts);
    loadCSS();

  } else {
    if (!window.HighchartsCloud.hasLoaded) window.HighchartsCloud.ondone.push(loadExtraScriptsAndMakeChart);
    else loadExtraScriptsAndMakeChart();
  }

}());
