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

  var highcharts = document.createElement('script');
  var injectVersion = 6;
  var cdn = 'https://code.highcharts.com/';
  var loaded = 0;  
  var encodedUrl = encodeURI('https://https://app.everviz.com//show/_YLzJhs_K');
  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"
  ];

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

  var legacyElementClassName = 'highcharts-_YLzJhs_K';
  var elementClassName = 'everviz-_YLzJhs_K';
  var externalCSS = [
    "https://app.everviz.com/resources/css/highcharts-small-screen-annotations.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-small-screen-annotations.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",
  "https://app.everviz.com/resources/js/highcharts-resize.js",
  ];

  var options = {"title":{"style":{"fontFamily":"\"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif","color":"#333333","fontSize":"18px","fontWeight":"normal","fontStyle":"normal"},"text":"II-03c: Shares of All Bachelor’s Degrees Awarded in Selected Academic Fields","margin":11,"y":22},"subtitle":{"style":{"fontFamily":"\"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif","color":"#666666","fontSize":"14px","fontWeight":"normal","fontStyle":"normal"},"text":"<div>1987–2022</div>","useHTML":true},"plotOptions":{"series":{"allowPointSelect":true,"states":{"hover":{"color":"#a4edba"},"select":{"color":"#EFFFEF","borderColor":"black","dashStyle":"dot"}},"label":{"enabled":false}},"line":{"marker":{"symbol":"circle","enabled":false},"lineWidth":3,"tooltip":{"valueDecimals":1,"valueSuffix":"%"}}},"credits":{"href":"humanitiesindicators.org","style":{"fontSize":"11px","cursor":"pointer","color":"#999999","fontFamily":"\"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, Arial, Helvetica, sans-serif"},"text":"<div>Humanities Indicators, 2024 | American Academy of Arts &amp; Sciences</div>","useHTML":true},"colors":["#4b803e","#f47b2a","#46ad9b","#f5cb23","#b80d31","#482078","#d3556b","#1b5fab","#9ab92e","#ffa600","#793381","#a9a9a9","#183a7e"],"series":[{"data":[],"turboThreshold":0,"type":"line","marker":{"symbol":"circle","enabled":false},"name":"Humanities"},{"turboThreshold":0,"marker":{"symbol":"circle","enabled":false},"type":"line","name":"Behavioral & Social   Sciences","data":[]},{"turboThreshold":0,"marker":{"symbol":"circle","enabled":false},"type":"line","name":"Business & Management","data":[]},{"turboThreshold":0,"marker":{"symbol":"circle","enabled":false},"type":"line","name":"Education","data":[]},{"turboThreshold":0,"marker":{"symbol":"circle","enabled":false},"type":"line","name":"Engineering","data":[]},{"turboThreshold":0,"marker":{"enabled":false},"type":"line","name":"Fine & Performing Arts","data":[]},{"turboThreshold":0,"marker":{"symbol":"circle","enabled":false},"type":"line","name":"Health & Medical Sciences","data":[]},{"turboThreshold":0,"marker":{"symbol":"circle","enabled":false},"type":"line","name":"Natural Sciences","data":[]},{"turboThreshold":0,"marker":{"symbol":"circle","enabled":false},"type":"line","name":"Other/Unknown","data":[]}],"stockTools":{"gui":{"enabled":false}},"navigation":{"bindingsClassName":"tools-container","events":{}},"pane":{"background":[]},"responsive":{"rules":[]},"chart":{"plotBorderWidth":1,"borderColor":"#ffffff","type":"line","height":770},"yAxis":{"title":{"style":{"fontFamily":"Lucida Sans Unicode","color":"#000","fontSize":"12px","fontWeight":"bold","fontStyle":"normal"},"text":"Percent"},"ceiling":30,"softMax":50,"tickInterval":10,"max":100,"tickWidth":false,"min":0,"maxZoom":30},"xAxis":{"title":{"style":{"fontFamily":"Lucida Sans Unicode","color":"#212121","fontSize":"12px","fontWeight":"bold","fontStyle":"normal"}}},"labels":{"items":[]},"annotations":[],"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"]},"legend":{"itemStyle":{"fontFamily":"Default","color":"#333333","fontSize":"12px","fontWeight":"normal","fontStyle":"normal","cursor":"pointer","textOverflow":"ellipsis"}},"exporting":{"url":"https://api.everviz.com/export","sourceHeight":null},"tooltip":{},"data":{"csv":";\"Humanities\";\"Behavioral & Social   Sciences\";\"Business & Management\";\"Education\";\"Engineering\";\"Fine & Performing Arts\";\"Health & Medical Sciences\";\"Natural Sciences\";\"Other/Unknown\"\n1987;12;12.8;24.7;9;11.4;3.4;6.4;7.8;12.6\n1988;12.5;13.2;24.8;9.3;10.5;3.4;6.2;7.4;12.6\n1989;13.3;13.8;24.6;9.7;9.5;3.4;6.1;7;12.7\n1990;14;14.5;24;10.1;8.7;3.5;5.9;6.7;12.5\n1991;14.5;14.9;23.2;10.2;7.9;3.5;6.7;6.7;12.4\n1992;15.1;15.3;23;9.8;7.6;3.6;6.1;6.9;12.7\n1993;15.1;15.3;22.5;9.6;7.4;3.6;6.3;7.1;13.1\n1994;14.6;15.3;21.6;9.6;7.4;3.8;6.7;7.6;13.4\n1995;14.4;15.3;20.7;9.6;7.5;3.7;7;8.1;13.7\n1996;14.3;15.2;20;9.6;7.4;3.7;7.4;8.5;13.8\n1997;14.1;15.1;19.8;9.5;7.5;3.8;7.5;8.7;14\n1998;14.3;14.9;20.1;9.6;7.5;3.9;7.3;8.7;13.8\n1999;14.3;14.7;20.4;9.6;7.4;4.1;7;8.5;13.9\n2000;14.3;14.4;21.2;9.4;7.8;4.4;6.5;8.1;13.8\n2001;14.5;14.4;21.7;9.2;8.3;4.5;6.1;7.8;13.5\n2002;14.6;14.4;22;9;8.5;4.8;5.6;7.6;13.4\n2003;14.7;14.7;22.2;8.7;9;4.8;5.3;7.4;13.2\n2004;14.8;14.9;22.4;8.5;8.8;5.1;5.3;7.3;12.9\n2005;14.8;15.1;22;8.3;8.4;5.2;5.6;7.5;13.1\n2006;14.7;15;21.8;8.3;7.8;5.1;6.2;7.8;13.3\n2007;14.6;14.9;21.8;8;7.2;5.1;6.7;8.2;13.6\n2008;14.4;15;21.7;7.7;6.9;5.1;7.1;8.3;13.6\n2009;14.3;14.8;22;7.5;6.8;5.1;7.5;8.4;13.6\n2010;14;14.8;22;7.2;6.9;5.1;7.8;8.6;13.6\n2011;13.5;14.9;21.5;7;7.1;5;8.4;8.9;13.7\n2012;13.1;14.9;20.7;6.9;7.3;4.9;9.2;9.2;13.9\n2013;12.6;14.9;19.8;6.7;7.6;4.9;9.9;9.5;14.1\n2014;12;14.8;19.4;6.3;8;4.7;10.7;9.8;14.2\n2015;11.4;14.4;19.4;5.9;8.4;4.6;11.5;10.1;14.2\n2016;10.9;14;19.5;5.6;9;4.4;12;10.4;14.1\n2017;10.5;13.7;19.6;5.5;9.7;4.3;12.2;10.6;13.9\n2018;10.1;13.6;19.7;5.3;10.3;4.2;12.4;10.7;13.7\n2019;9.9;13.4;19.5;5.2;10.9;4.1;12.6;10.7;13.6\n2020;9.7;13.4;19.2;5.2;11.2;4.1;12.7;11;13.4\n2021;9.3;13.5;19.1;5.3;11.4;4;13.1;11.1;13.3\n2022;8.8;13.6;18.8;5.4;11.7;4.1;13.2;11.3;13.2","seriesMapping":[{"x":0,"y":1,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9},{"x":0,"y":2,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9},{"x":0,"y":3,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9},{"x":0,"y":4,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9},{"x":0,"y":5,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9},{"x":0,"y":6,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9},{"x":0,"y":7,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9},{"x":0,"y":8,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9},{"x":0,"y":9,"humanities":1,"behavioral_social_sciences":2,"business_management":3,"education":4,"engineering":5,"fine_performing_arts":6,"health_medical_sciences":7,"natural_sciences":8,"other_unknown":9}],"decimalPoint":".","assignDataFields":[]}};
  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);
              const stubbedChart = new Highcharts.Chart(optionsStub);
              

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

                },
                element: element
              });
            });

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

            if (element) new Highcharts.Chart(legacyElementClassName, options)
            else 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: {'_YLzJhs_K': 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['_YLzJhs_K']) {

        window.HighchartsCloud.projectUUIDs['_YLzJhs_K'] = 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();
      }
    }
  }

}());
