var writtenNumberUtil=function(){function t(n,s){var tt,b,k,d,v,nt,a,it,c,rt,ut,p,ft,et,ot,st,g;if(s=s||{},s=f(s,u),n<0)return"";n=Math.round(+n);var l=e,y=l.useLongScale?i:r,w=l.units,h;if(!(w instanceof Array)){tt=w;w=[];y=Object.keys(tt);for(a in y)w.push(tt[y[a]]),y[a]=Math.pow(10,parseInt(y[a]))}if(b=l.base,k=s.alternativeBase?l.alternativeBase[s.alternativeBase]:{},l.unitExceptions[n])return l.unitExceptions[n];if(k[n])return k[n];if(b[n])return b[n];if(n<100)return o(n,l,h,b,k,s);for(d=n%100,v=[],d&&(!s.noAnd||l.andException&&l.andException[10]?v.push(l.unitSeparator+t(d,s)):v.push(t(d,s))),a=0,it=w.length;a<it;a++)if(c=Math.floor(n/y[a]),rt=a===it-1?1e6:y[a+1]/y[a],c%=rt,h=w[a],c){if(nt=y[a],h.useBaseInstead){ut=h.useBaseException.indexOf(c)>-1&&(h.useBaseExceptionWhenNoTrailingNumbers?a===0&&v.length:!0);ut?v.push(c>1&&h.plural?h.plural:h.singular):v.push(k[c*y[a]]||b[c*y[a]]);continue}if(typeof h=="string"?p=h:c===1||h.useSingularEnding&&c%10==1&&(!h.avoidEndingRules||h.avoidEndingRules.indexOf(c)<0)?p=h.singular:h.few&&(c>1&&c<5||h.useFewEnding&&c%10>1&&c%10<5&&(!h.avoidEndingRules||h.avoidEndingRules.indexOf(c)<0))?p=h.few:(p=h.plural&&(!h.avoidInNumberPlural||!d)?h.plural:h.singular,p=c===2&&h.dual?h.dual:p,p=c>10&&h.restrictedPlural?h.singular:p),h.avoidPrefixException&&h.avoidPrefixException.indexOf(c)>-1){v.push(p);continue}ft=l.unitExceptions[c];et=ft||t(c,f({noAnd:!(l.andException&&l.andException[c]||h.andException)&&!0,alternativeBase:h.useAlternativeBase},s));n-=c*y[a];v.push(et+" "+p)}if(ot=nt*Math.floor(n/nt),st=n-ot,l.andWhenTrailing&&nt&&0<st&&v[0].indexOf(l.unitSeparator)!==0&&(v=[v[0],l.unitSeparator.replace(/\s+$/,"")].concat(v.slice(1))),l.allSeparator)for(g=0;g<v.length-1;g++)v[g]=l.allSeparator+v[g];return v.reverse().join(" ")}function o(n,i,r,u,f,e){var o=Math.floor(n/10)*10;return(r=n-o,r)?f[o]||u[o]+i.baseSeparator+t(r,e):f[o]||u[o]}function f(n,t){var u,f,i,e,r;for(n==null&&(n={}),u={},f=Object.keys(t),i=0,e=f.length;i<e;i++)r=f[i],u[r]=n[r]||t[r];return u}for(var i,u,e={useLongScale:!1,baseSeparator:"-",unitSeparator:"and ",base:{"0":"zero","1":"one","2":"two","3":"three","4":"four","5":"five","6":"six","7":"seven","8":"eight","9":"nine","10":"ten","11":"eleven","12":"twelve","13":"thirteen","14":"fourteen","15":"fifteen","16":"sixteen","17":"seventeen","18":"eighteen","19":"nineteen","20":"twenty","30":"thirty","40":"forty","50":"fifty","60":"sixty","70":"seventy","80":"eighty","90":"ninety"},units:["hundred","thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion"],unitExceptions:[]},r=[100],n=1;n<=16;n++)r.push(Math.pow(10,n*3));for(i=[100,1e3],n=1;n<=15;n++)i.push(Math.pow(10,n*6));return u={noAnd:!1,alternativeBase:null,lang:"en"},{writtenNumber:t}}(window,document,window.jQuery),nammGeneral=function(){var n=function(n){return n=n||"",n.toLowerCase().replace(" parish","").replace(" county","").replace("saint ","").replace("st ","").replace("st. ","").trim()};return{specialYear:-1,getNormalizedCountyName:n}}(window,document,window.jQuery),nammRouter=function(n,t,i){function r(n,t){switch(n){case"facts":f(t);break;case"home":default:u()}}function u(){i("#facts-view").hide();i("#home-view").show();nammSidebar.reset();nammMapCarouselModule.reset()}function f(n){nammFactsTiles.loadTiles(n.year,n.country,n.stateAbbreviation,n.stateName);i("#home-view").hide();i("#facts-view").show()}return{navigateTo:r}}(window,document,window.jQuery),nammBubbleClusterMap=function(n,t,i){function f(n,t){var f=i(window).width(),u=null;f<768?(u=t.smallScreen,r=3.5):f<992?(u=t.mediumScreen,r=2.5):f<1200?(u=t.largeScreen,r=2):(u=t.extraLargeScreen,r=2);var e=i.map(u.bubbleLevels,function(n){return n.bubbleSize}),o=Math.min.apply(Math,e),s=Math.max.apply(Math,e),h=Math.abs(s-o);return am4core.array.each(u.bubbleLevels,function(n){n.valueToMigrate=n.bubbleSize/h}),u.minBubbleSize=o,u.maxBubbleSize=s,am4core.array.each(n,function(n){for(var i=!1,t=0;t<u.bubbleLevels.length;t++)if(n.Number<u.bubbleLevels[t].maxValue){n.NumericalFact=u.bubbleLevels[t].valueToMigrate;i=!0;break}i||(n.NumericalFact=u.bubbleLevels[u.bubbleLevels.length-1].valueToMigrate)}),u}function c(n,t,u){var s=n.series.push(new am4maps.MapImageSeries),f,e;s.dataFields.value="numericalFact";f=s.mapImages.template;f.verticalCenter="middle";f.horizontalCenter="middle";f.propertyFields.latitude="lat";f.propertyFields.longitude="long";var h=function(n,t){var r=i.grep(t.children.values,function(t){return t.className===n});return r&&r.length?r[0]:{}},c=function(n){var t=n.target.parent,i=t.globalScale<=1?r:1,u=h("Circle",t),f=h("Label",t);u.nonScaling=!1;f.nonScaling=!1;u.scale=i;f.scale=i},l=function(n){var t=n.target.parent,i=1,r=h("Circle",t),u=h("Label",t);r.nonScaling=!0;u.nonScaling=!0;r.scale=i;u.scale=i},o=f.createChild(am4core.Circle);o.verticalCenter="middle";o.horizontalCenter="middle";o.nonScaling=!u;f.focusable=!1;o.events.on("down",function(n){c(n)});o.events.on("up",function(n){l(n)});e=f.createChild(am4core.Label);e.text="{numericalFactFormatted}";e.verticalCenter="middle";e.horizontalCenter="middle";e.nonScaling=!u;e.events.on("down",function(n){c(n)});e.events.on("up",function(n){l(n)});return s.heatRules.push({target:o,property:"radius",min:t.minBubbleSize,max:t.maxBubbleSize}),s.heatRules.push({target:e,property:"fontSize",min:t.minFontSize,max:t.maxFontSize}),s}function e(n,t,i){i.chart.maxPanOut=0;am4core.array.each(n,function(n){var r={state:n.Location.State,stateName:n.Location.State_Name,numericalFact:n.NumericalFact,numericalFactFormatted:n.NumberFormatted,lat:n.Location.Lat,long:n.Location.Long},u;t[r.state]==undefined&&(u=i.getPolygonById("US-"+r.state),u&&(t[r.state]={numericalFact:r.numericalFact,name:r.stateName,numericalFactFormatted:r.numericalFactFormatted,lat:r.lat,long:r.long,markerData:[]},t.US.markerData.push(t[r.state])))})}function l(n,t,r){r.chart.maxPanOut=.2;am4core.array.each(r.data,function(u){var f={id:u.id,name:u.name,normalizedName:nammGeneral.getNormalizedCountyName(u.name),numericalFact:null,numericalFactFormatted:null,lat:null,long:null},e=i.grep(n,function(n){return nammGeneral.getNormalizedCountyName(n.Location.County)===f.normalizedName}),o=r.getPolygonById(f.id);e&&e.length&&o&&t[f.id]==undefined&&(e=e[0],f.numericalFact=e.NumericalFact,f.numericalFactFormatted=e.NumberFormatted,f.lat=o.visualLatitude||e.Lat,f.long=o.visualLongitude||e.Long,t[f.id]={numericalFact:f.numericalFact,name:f.name,numericalFactFormatted:f.numericalFactFormatted,lat:f.lat,long:f.long,markerData:[]},t.US.markerData.push(t[f.id]))})}function o(n,t,i,r,u,f,e,o,s){function y(){h.seriesContainer.draggable=h.zoomLevel===1?!1:!0}var h,l,v,p;am4core.useTheme(am4themes_animated);h=am4core.create(n,am4maps.MapChart);h.tapToActivate=!0;h.maxZoomLevel=4.5;h.draggable=!1;h.events.on("zoomlevelchanged",y);h.geodata=t;h.projection=i;l=h.series.push(new am4maps.MapPolygonSeries);l.useGeodata=!0;l.calculateVisualCenter=!0;v=l.mapPolygons.template;v.tooltipText="{name}";l.tooltip.getFillFromObject=!1;l.tooltip.background.fill=am4core.color("#FFFFFF");l.tooltip.label.fill=am4core.color("#000000");p=v.states.create("hover");l.calculateVisualCenter=!0;v.tooltipPosition="fixed";v.events.on("focus",function(n){n.target.isHover=!0});h.events.on("ready",function(){var n={},t,i;n.US={markerData:[],series:c(h,u,e)};f(r,n,l);n.US.series.data=n.US.markerData;t=l.data.sort(a).map(function(n){return n.name});i=l.mapPolygons.values;i.forEach(function(n){var i=n.polygon.dataItem.dataContext,u=o?nammGeneral.getNormalizedCountyName(i.name):i.name,f=function(n){var t=n.find(function(n){return n.Location.hasOwnProperty("State_Name")?n.Location.State_Name===u:n.Location.County_Name===u});return t?t.Number:""}(r);n.readerDescription=u+" "+writtenNumberUtil.writtenNumber(f)+(s.toLowerCase()==="branded service stations"?s:" U S Dollars");n.tabindex=t.indexOf(i.name)+1})});return h}function a(n,t){return n.name<t.name?-1:n.name>t.name?1:0}var u="parish",s="county",h="state",r=null;return{serviceStationsByCountrySize:{smallScreen:{bubbleLevels:[{maxValue:100,bubbleSize:10},{maxValue:1e3,bubbleSize:12},{maxValue:null,bubbleSize:15}],minFontSize:7,maxFontSize:8},mediumScreen:{bubbleLevels:[{maxValue:100,bubbleSize:12},{maxValue:1e3,bubbleSize:19},{maxValue:null,bubbleSize:29}],minFontSize:9,maxFontSize:12},largeScreen:{bubbleLevels:[{maxValue:100,bubbleSize:12},{maxValue:1e3,bubbleSize:14},{maxValue:null,bubbleSize:20}],minFontSize:9,maxFontSize:10},extraLargeScreen:{bubbleLevels:[{maxValue:100,bubbleSize:15},{maxValue:1e3,bubbleSize:24},{maxValue:null,bubbleSize:35}],minFontSize:11,maxFontSize:16}},serviceStationsByStateSize:{smallScreen:{bubbleLevels:[{maxValue:10,bubbleSize:8},{maxValue:100,bubbleSize:10},{maxValue:null,bubbleSize:15}],minFontSize:7,maxFontSize:8},mediumScreen:{bubbleLevels:[{maxValue:10,bubbleSize:10},{maxValue:100,bubbleSize:12},{maxValue:null,bubbleSize:18}],minFontSize:9,maxFontSize:12},largeScreen:{bubbleLevels:[{maxValue:10,bubbleSize:10},{maxValue:100,bubbleSize:12},{maxValue:null,bubbleSize:18}],minFontSize:9,maxFontSize:10},extraLargeScreen:{bubbleLevels:[{maxValue:10,bubbleSize:12},{maxValue:100,bubbleSize:15},{maxValue:null,bubbleSize:23}],minFontSize:11,maxFontSize:16}},socialInvestmentsSize:{smallScreen:{bubbleLevels:[{maxValue:1e5,bubbleSize:9},{maxValue:1e6,bubbleSize:11},{maxValue:1e7,bubbleSize:14},{maxValue:null,bubbleSize:20}],minFontSize:4,maxFontSize:10},mediumScreen:{bubbleLevels:[{maxValue:1e5,bubbleSize:14},{maxValue:1e6,bubbleSize:20},{maxValue:1e7,bubbleSize:30},{maxValue:null,bubbleSize:38}],minFontSize:7,maxFontSize:16},largeScreen:{bubbleLevels:[{maxValue:1e5,bubbleSize:10},{maxValue:1e6,bubbleSize:14},{maxValue:1e7,bubbleSize:18},{maxValue:null,bubbleSize:25}],minFontSize:5,maxFontSize:11},extraLargeScreen:{bubbleLevels:[{maxValue:1e5,bubbleSize:14},{maxValue:1e6,bubbleSize:21},{maxValue:1e7,bubbleSize:31},{maxValue:null,bubbleSize:42}],minFontSize:7,maxFontSize:19}},suppliersSize:{smallScreen:{bubbleLevels:[{maxValue:1e7,bubbleSize:9},{maxValue:1e8,bubbleSize:11},{maxValue:1e9,bubbleSize:14},{maxValue:null,bubbleSize:20}],minFontSize:4,maxFontSize:10},mediumScreen:{bubbleLevels:[{maxValue:1e7,bubbleSize:14},{maxValue:1e8,bubbleSize:20},{maxValue:1e9,bubbleSize:30},{maxValue:null,bubbleSize:38}],minFontSize:7,maxFontSize:16},largeScreen:{bubbleLevels:[{maxValue:1e7,bubbleSize:10},{maxValue:1e8,bubbleSize:14},{maxValue:1e9,bubbleSize:18},{maxValue:null,bubbleSize:25}],minFontSize:5,maxFontSize:11},extraLargeScreen:{bubbleLevels:[{maxValue:1e7,bubbleSize:14},{maxValue:1e8,bubbleSize:21},{maxValue:1e9,bubbleSize:31},{maxValue:null,bubbleSize:42}],minFontSize:6,maxFontSize:18}},createCountryMap:function(n,t,r,u,s){var h=JSON.parse(i("#"+t).val()),c=f(h,r);return o(n,am4geodata_usaLow,new am4maps.projections.AlbersUsa,h,c,e,u,!1,s)},createCountryStateMap:function(t,r,c,a,v,y){var w=f(r,a),b=c?n["am4geodata_region_usa_"+c.toLowerCase()+"Low"]:am4geodata_usaLow,k=c?new am4maps.projections.Miller:new am4maps.projections.AlbersUsa,d=c?l:e,g=c&&r&&r.length&&r[0].Location.County.toLowerCase().indexOf(u)!==-1?u:s,p=y;return p+=c?c.toLowerCase()!=="dc"?" by "+g:"":" by "+h,i(".namm.namm-bubble-cluster .chart-legend .legend-1").text(p),o(t,b,k,r,w,d,v,Boolean(c),y)}}}(window,document,window.jQuery),nammDataRangeMap=function(n,t,i,r){function o(n){function e(){t.seriesContainer.draggable=t.zoomLevel===1?!1:!0}var f="#"+n.containerId+" ~ .data-range-legend:first",t;r.options.autoSetClassName=!0;r.useTheme(am4themes_animated);t=r.create(n.containerId,am4maps.MapChart);t.tapToActivate=!0;t.maxZoomLevel=4.5;t.draggable=!1;t.events.on("zoomlevelchanged",e);return i.getJSON("/assets/namm/resources/heat-data-ranges.json",function(r){if(n.state)u=r.StateRanges,i(f+" .data-range-heading").html(n.type.toLowerCase()+" by "+(n.state.toLowerCase()==="la"?"parish":"county")).show(),h(t,n.data,n.type,n.state);else{var e=n.dataId?JSON.parse(i("#"+n.dataId).val()):{States:n.data};u=r.CountryRanges;i(f+" .data-range-title").html(n.dataId?e.TotalValueFormatted:"").show();i(f+" .data-range-heading").html(n.dataId?e.Legend:n.type.toLowerCase()+" by state").show();s(t,e,n.type)}u.forEach(function(n){i(f+" .range-"+n.level).children(".range-color").css("background-color",n.color);i(f+" .range-"+n.level).children(".range-label").html(n.rangeMin.toString()+(+n.rangeMax!=Infinity?"-"+n.rangeMax:"+"))})}),t}function s(n,t,i){var o,s,h;t.States.forEach(function(n){n.id=n.Location.Country+"-"+n.Location.State});n.geodata=am4geodata_usaLow;n.projection=new am4maps.projections.AlbersUsa;n.maxPanOut=0;o=n.series.push(new am4maps.MapPolygonSeries);o.useGeodata=!0;o.data=t.States;s=o.mapPolygons.template;s.tooltipHTML="<span>{name}<\/span><br/><span>{NumberFormatted}<\/span>";s.tooltipText="{name} \n{NumberFormatted}";o.tooltip.getFillFromObject=!1;o.tooltip.background.fill=r.color("#FFFFFF");o.tooltip.label.fill=r.color("#000000");n.events.on("ready",function(){var n=t.States.sort(f).map(function(n){return n.name}),r=o.mapPolygons.values;r.forEach(function(t){var r=t.polygon.dataItem.dataContext;t.readerDescription=r.name+" "+r.NumberFormatted+" "+i;t.tabindex=n.indexOf(r.name)+1})});h=s.states.create("hover");o.calculateVisualCenter=!0;s.tooltipPosition="fixed";s.events.on("focus",function(n){n.target.isHover=!0});o.data.forEach(function(n){n.fill=e(u,n.Number)});s.propertyFields.fill="fill"}function f(n,t){return n.name<t.name?-1:n.name>t.name?1:0}function h(t,i,o,s){var h,c,l;t.geodata=n["am4geodata_region_usa_"+s.toLowerCase()+"Low"];t.projection=new am4maps.projections.Miller;t.maxPanOut=.2;h=t.series.push(new am4maps.MapPolygonSeries);h.useGeodata=!0;c=h.mapPolygons.template;c.tooltipHTML="<span>{name}<\/span><br/><span>{NumberFormatted}<\/span>";c.tooltipText="{name} \n{NumberFormatted}";h.tooltip.horizontalCenter="middle";h.tooltip.getFillFromObject=!1;h.tooltip.background.fill=r.color("#FFFFFF");h.tooltip.label.fill=r.color("#000000");t.events.on("ready",function(){h.data.sort(f).forEach(function(n){var r=nammGeneral.getNormalizedCountyName(n.name),t=i.find(function(n){var t=nammGeneral.getNormalizedCountyName(n.Location.County);return t===r});n.fill=e(u,t?t.Number:null);n.NumberFormatted=t?t.NumberFormatted:""});h.invalidateData();setTimeout(function(){var n=h.data.map(function(n){return n.name}),t=h.mapPolygons.values;t.forEach(function(t){var i=t.polygon.dataItem.dataContext;t.readerDescription=i.name+(s.toLowerCase()==="la"?" parish":" county")+" "+(i.NumberFormatted||0)+" "+o;t.tabindex=n.indexOf(i.name)+1})},100)});l=c.states.create("hover");h.calculateVisualCenter=!0;c.tooltipPosition="fixed";c.events.on("focus",function(n){n.target.isHover=!0});c.propertyFields.fill="fill"}function e(n,t){if(!t)return n[0].color;var i=n.find(function(n){return t>=+n.rangeMin&&t<=+n.rangeMax});return i.color}var u;return{createMap:o}}(window,document,window.jQuery,am4core),nammMapCarouselModule=function(n,t,i){function o(){r=i("#namm-map-carousel-loader");r.css("background-color",e[0]);r.addClass("is-loading");u=i("#namm-map-carousel");f=i("#namm-map-carousel > div").length-1;u.slick(s);u.on("beforeChange",function(n,t,i,u){r.css("background-color",e[u]);r.removeClass("is-loading")});u.on("afterChange",function(n,t,i){r.addClass("is-loading");i===f&&u.slick("slickSetOption","autoplay",!1,!1)})}function h(){r.removeClass("is-loading");u.slick("unslick");setTimeout(function(){o()},200)}var u,r,f,e=["#2296cc","#0FB2B4","#E21735"],s={autoplay:!0,autoplaySpeed:5e3,infinite:!1,arrows:!1,draggable:!1,swipe:!1,fade:!0,adaptiveHeight:!0};return i(t).ready(function(){o()}),{reset:h}}(window,document,window.jQuery),nammSidebar=function(n,t,i){function v(){i("#states-dropdown-trigger").click(p);i("#state-list li a").click(w);i("#state-list-filter-input").keyup(function(n){a(n.target.value)});i("#state-list-filter-clear").click(c);f.click(y)}function y(n){n.preventDefault();nammRouter.navigateTo("home")}function p(){i("#year-data-dropdown-list").hide();i("#namm-sidebar-state-list-overlay").css("display","block");setTimeout(function(){i("#namm-sidebar-state-list").addClass("shown");i("#state-list-filter-input").focus();u=i("#state-list li");i(n).keydown(function(n){var i=n.which;i===40?(r?(r.removeClass("selected"),next=r.nextAll("li:visible").first(),r=next.length>0?next.addClass("selected"):u.eq(0).addClass("selected")):r=u.filter(":visible").first().addClass("selected"),h(t.getElementById("state-list"),r[0])):i===38?(r?(r.removeClass("selected"),next=r.prevAll("li:visible").first(),r=next.length>0?next.addClass("selected"):u.last().addClass("selected")):r=u.filter(":visible").last().addClass("selected"),h(t.getElementById("state-list"),r[0])):i===13&&r&&(r.find("a").click(),r.removeClass("selected"),r=null)})})}function h(n,t){let i=n.scrollTop+n.offsetTop,u=i+n.clientHeight,r=t.offsetTop,f=r+t.clientHeight;r<i?n.scrollTop-=i-r:f>u&&(n.scrollTop+=f-u)}function c(){i("#namm-sidebar-state-list").removeClass("shown");setTimeout(function(){i("#namm-sidebar-state-list-overlay").css("display","none");i("#state-list-filter-input").val("");a("")},200);i(n).off("keydown")}function w(n){n.preventDefault();var t=n.data&&n.data.bindEl?n.data.bindEl.data("state"):i(n.target).data("state"),u=n.data&&n.data.bindEl?n.data.bindEl.data("description"):t?t.Intro:i(n.target).data("description"),r={year:i("#selected-year-value").data("selectedyear"),country:t?t.Country:"US",stateAbbreviation:t?t.Abbreviation:"",stateName:t?t.Name:"all states"};i("#states-dropdown-trigger #selected-state-name").html(t?t.Name.toLowerCase():"all states");i("#year-data-dropdown-trigger #selected-year-value").html(r.year);i("#states-dropdown-trigger").data("selectedStateAbbreviation",r.stateAbbreviation);i("#states-dropdown-trigger").data("selectedStateName",r.stateName);i("#states-dropdown-trigger").data("selectedCountry",r.country);i("#sidebar-description").html(u);i("#view-level").val(2);e();nammRouter.navigateTo("facts",r);c()}function l(){i("#year-data-dropdown-list").slideToggle(100)}function b(n){if(n){i("#selected-year-value").data("selectedyear",n);i("#selected-year-value").html(n);var t=i("#states-dropdown-trigger").data("selectedStateAbbreviation"),r=i("#states-dropdown-trigger").data("selectedStateName"),u=i("#states-dropdown-trigger").data("selectedCountry");nammFactsTiles.loadTiles(n,u,t,r)}l()}function e(){o=parseInt(i("#view-level").val());o===2?(i("#sidebar-title").hide(),i("#sidebar-description").show(),f.show(),i("#year-data-dropdown-container").css("visibility","visible")):(i("#sidebar-description").hide(),f.hide(),i("#year-data-dropdown-container").css("visibility","hidden"),i("#sidebar-title").show())}function k(){JSON.parse(i("#years").val()).length>=2&&(i("#year-data-dropdown-trigger #year-dropdown-carrot").css("display","inline-block"),i("#year-data-dropdown-trigger").addClass("active-dropdown"),i("#year-data-dropdown-trigger").click(l),i("#year-data-dropdown-list #year-list li").click(function(){b(i(this).attr("data-value"))}))}function d(){var n=i("#sidebar-view").clone(!0);return n.find(".sidebar-subhead").first().html(n.find(".sidebar-subhead").first().html().split(" ").slice(1).join(" ")),n[0].outerHTML}function g(){i("#states-dropdown-trigger #selected-state-name").html("select state");i("#sidebar-description").html("");i("#view-level").val(1);e()}function a(n){var f,u,t,e,o;for(f=document.getElementById("state-list"),u=f.getElementsByTagName("li"),n!==s&&r&&(r.removeClass("selected"),r=null),t=0;t<u.length;t++)e=u[t].textContent||u[t].innerText,o=i(u[t]).find("a").data("abbreviation")||"",u[t].style.display=e.toUpperCase().includes(n.toUpperCase())||o.toUpperCase().includes(n.toUpperCase())?"":"none";s=n}let o;var u,r,s="",f=i("#back-home");return i(document).ready(function(){v();e();k()}),{getViewHtml:d,reset:g}}(window,document,window.jQuery),nammFooter=function(n){function t(t,i,r,u,f,e){var o=n("#selected-year-value").data("selectedyear"),s=n("#namm-service-station-last-execution-date-"+t).val(),h=i?i.toLowerCase()==="la"?"parish":"county":"county / parish",c=r?(e?"*":"")+"Employee population represented is based on "+h+" of residence.":"",l=u?(e?"**":"")+"Retirees refer to employees that retired at or after age 50 and had 10 or more years of health and welfare eligibility.":"",a=o===nammGeneral.specialYear&&s&&f?(e?"***":"")+"Service station data as of "+s+"."+(e?" All other data as of December 31, "+nammGeneral.specialYear+".":""):"Data as of December 31, "+o+".";n("#namm-footer-employees-disclaimer-"+t).text(c);n("#namm-footer-retirees-disclaimer-"+t).text(l);n("#namm-footer-service-stations-disclaimer-"+t).text(a)}function i(t){var i=n("#namm-footer-"+t).first();return i[0].outerHTML}return{initialize:t,getViewHtml:i}}(window.jQuery),nammFactsTiles=function(n,t,i){function et(){ot()}function ot(){l.click(st);i(u).unbind("keyup").keyup(function(n){var t=n.which;t===13&&i(n.target).click()})}function st(){var r=t.title,u=JSON.parse(i(this).data("currentstate")).stateName;t.title="Chevron's impact in "+u;n.print();t.title=r}function ht(){var t="",n;return i(u).filter(":not(:visible)").addClass("marked-for-removal"),n=i(u).clone(),n=n.filter(":not(.marked-for-removal)"),i(u).filter(".marked-for-removal").removeClass("marked-for-removal"),n.filter(".marked-for-removal").removeClass("marked-for-removal"),n.each(function(r,u){i(u).addClass("tile-"+(r+1)+"-of-"+n.length);t+=i(u)[0].outerHTML}),t}function ct(){return y}function lt(){i(v).text("");r=[];s={};s[o]=0;s[e]=0;i(f).show();i(u).hide();i(u).removeClass("full-height");i(u).removeClass("full-width");i(f).removeClass("full-width");i(u).removeClass("half-height");i(u).removeClass("half-width");i(f).removeClass("half-width");h(p,o);h(b,o);h(k,o);h(w,e);h(d,e)}function h(n,t){var r=f+"#"+t,u;i(r).find(n).length===0&&(u=f+"#"+(t===o?e:o),i(r).append(i(n)),i(u).find(n).remove())}function a(n){i(n.oppositeTower).append(i(n.selector));i(n.tower).find(n.selector).remove()}function nt(n){return i.grep(r,function(t){return t.tower===f+"#"+n})}function c(n,t,u,h){var v=!1,l,a,c;if(t[u+"FactNumber"]&&t[u+"FactNumber"].replace("$","")!=="0"){for(l="",a=1;a<=(h||0);a++)l+="*";i(n).show();c=i(n).closest(".tower").attr("id");y.push(i(n).data("fact"));s[c]+=1;r.push({selector:n,tower:f+"#"+c,oppositeTower:f+"#"+(c===o?e:o)});i(n+" .top").html(t[u+"Top"]);i(n+" .fact-number").html(t[u+"FactNumber"]);i(n+" .fact-unit").html(t[u+"FactUnit"]);i(n+" .footer-1").html(t[u+"Footer"]+l);i(n+" .footer-2").html(t[u+"Footer2"]);v=!0}return v}function at(){var t=nt(o),n=nt(e);r.length===1?(i(r[0].oppositeTower).hide(),i(r[0].selector).addClass("full-height"),i(r[0].tower).addClass("full-width")):r.length===2?(s[o]!==s[e]&&a(r[1]),i(r[0].selector).addClass("full-height"),i(r[1].selector).addClass("full-height"),i(f).addClass("half-width")):r.length===3?(s[e]===0?(a(r[2]),i(r[0].selector).addClass("half-height"),i(r[1].selector).addClass("half-height"),i(r[2].selector).addClass("full-height")):s[e]===2?(a(n[1]),i(t[0].selector).addClass("half-height"),i(n[0].selector).addClass("full-height"),i(n[1].selector).addClass("half-height")):s[e]===1&&i(n[0].selector).addClass("full-height"),i(f).addClass("half-width")):r.length===4?(s[e]===1&&a(t[2]),i(n[0].selector).addClass("half-height"),i(f).addClass("half-width")):r.length===5&&i(f).addClass("half-width")}function vt(n,t,r,f){lt();y=[];var e="/api/sitecore/Namm/",o={year:n,countryCode:t};r?(e+="StateFacts",o.stateCode=r):e+="CountryFacts";i(u).each(function(){i(this).data("currentstate",JSON.stringify({stateCode:r,stateName:f}));i(this).data("currentyear",n)});l.data("currentstate",JSON.stringify({stateCode:r,stateName:f}));l.attr("disabled","disabled");i.ajax({url:e,type:"get",data:o,beforeSend:function(){i(v).text("");i("#namm-tiles-loader").show()},success:function(t){var e=n===nammGeneral.specialYear,o=c(p,t,tt,1),u,f;c(w,t,it);u=c(b,t,rt,2);c(k,t,ut);f=c(d,t,ft,e?3:0);nammFooter.initialize("tiles",r,o,u,f,!0);at();setTimeout(function(){i(".namm-facts-tiles-wrapper #print-page-facts").html(ht())},100);l.attr("disabled",!1)},error:function(n){i(v).text("There was an error trying to load facts, please try again later");console.log(n)},complete:function(){i("#namm-tiles-loader").hide()}})}var u=".namm.namm-facts-tiles .tile",f=".namm.namm-facts-tiles .tower",v=".namm.namm-facts-tiles-wrapper #error-wrapper",o="tower-1",e="tower-2",p=".namm.namm-facts-tiles .tile.employees",w=".namm.namm-facts-tiles .tile.social-investments",b=".namm.namm-facts-tiles .tile.retirees",k=".namm.namm-facts-tiles .tile.suppliers",d=".namm.namm-facts-tiles .tile.facilities",tt="Employees",it="SocialInvestment",rt="Retirees",ut="Suppliers",ft="Facilities",g=200,r=null,s=null,y=[],l=i("#download-fact-button");return i(t).ready(et),i(u).bind("mouseenter focus",function(){i(this).find(".icon,.top").slideUp(g);i(this).find(".fact").addClass("hovered")}),i(u).bind("mouseleave blur",function(){i(this).find(".icon,.top").slideDown(g);i(this).find(".fact").removeClass("hovered")}),{loadTiles:vt,getAvailableFacts:ct}}(window,document,window.jQuery),nammExpandedFactModal=function(n,t,i){function l(){u&&(u.dispose(),u=null)}function h(n){n?(c.css("background-image","url("+n+")"),c.show()):c.hide()}function r(n,t){t?n.parent().css({visibility:"visible",height:"100%"}):n.parent().css({visibility:"hidden",height:0})}function v(n,t,c){var a="/api/sitecore/Namm/",p={year:c,stateCode:t},v=c,y=!1;switch(n){case"employees":a+=t?"EmployeesForState":"EmployeesForCountry";break;case"retirees":a+=t?"RetireesForState":"RetireesForCountry";break;case"facilities":a+=t?"FacilitiesForState":"FacilitiesForCountry";break;case"suppliers":y=t?!0:!1;a+=t?"SpendingForState":"SpendingForCountry";break;case"social-investments":y=t?!0:!1;a+=t?"SocialInvestmentForState":"SocialInvestmentForCountry"}i.ajax({url:a,type:"get",data:p,success:function(i){l();switch(n){case"employees":case"retirees":r(f,!0);r(e,!1);r(o,!1);r(s,!1);h(!1);u=nammDataRangeMap.createMap({containerId:"modal-content-map",data:i,type:n,state:t});break;case"facilities":r(f,!1);r(e,!0);r(o,!1);r(s,!1);h(!1);u=nammBubbleClusterMap.createCountryStateMap("state-service-station-map",i,t,t?nammBubbleClusterMap.serviceStationsByStateSize:nammBubbleClusterMap.serviceStationsByCountrySize,!1,"branded service stations");v=v===nammGeneral.specialYear?v+1:v;break;case"suppliers":r(f,!1);r(e,!1);r(o,!1);r(s,!t);h(t?"/-/media/chevron/namm/images/Supplier_Spend.png":!1);t||(u=nammBubbleClusterMap.createCountryStateMap("state-supplier-map",i,t,nammBubbleClusterMap.suppliersSize,!1,"supplier spend"));break;case"social-investments":r(f,!1);r(e,!1);r(o,!t);r(s,!1);h(t?"/-/media/chevron/namm/images/Social_Investment.png":!1);t||(u=nammBubbleClusterMap.createCountryStateMap("state-social-investment-map",i,t,nammBubbleClusterMap.socialInvestmentsSize,!1,"social investments"))}nammModalSidebar.populateData({stat:i&&i.length?y?i[0].NumberFormatted:i[0].TotalNumberFormatted:"",count:i&&i.length?i[0].TotalCountFormatted:"",stat2:i&&i.length&&!t?i[0].CustomAmount1Formatted:"",year:v,isLocal:y})},error:function(n){console.log(n)}})}var f=i("#modal-content-map"),a=i("#modal-content-map ~ #data-range-legend > #data-range-heading"),e=i("#state-service-station-map"),o=i("#state-social-investment-map"),s=i("#state-supplier-map"),c=i("#modal-content-image"),u=null;i("#expandedFactModal").on("shown.bs.modal",function(n){nammModalSidebar.init(n)});i("#expandedFactModal").on("hidden.bs.modal",function(){l();f.html("");a.html("");nammModalSidebar.clear()});return{loadData:v}}(window,document,window.jQuery),nammModalSidebar=function(n,t,i){function k(n){d();var t=nammFactsTiles.getAvailableFacts();c=JSON.parse(i(n.relatedTarget).data("currentstate"));currentYear=JSON.parse(i(n.relatedTarget).data("currentyear"));r=w.filter(function(n){return t.indexOf(n.id)!==-1});r.length<2&&b.hide();y.html(c.stateName.toLowerCase());u=r.find(function(t){return t.id===i(n.relatedTarget).data("fact")});v()}function d(){f.parent().click(it);e.parent().click(rt)}function g(){f.parent().off("click");e.parent().off("click")}function v(){h.html(u.intro());a.attr("src",u.icon);a.attr("alt",u.name);r.length>1&&(r[r.indexOf(u)+1]?(e.html(r[r.indexOf(u)+1].name),o(e,!0)):r.length!==2?(e.html(r[0].name),o(e,!0)):o(e,!1),r[r.indexOf(u)-1]?(f.html(r[r.indexOf(u)-1].name),o(f,!0)):r.length!==2?(f.html(r[r.length-1].name),o(f,!0)):o(f,!1));nammExpandedFactModal.loadData(u.id,c.stateCode,currentYear)}function o(n,t){n.toggle(t);n.siblings("span").toggle(t)}function nt(n){l.html(n.stat);l.show();u.id==="suppliers"&&n.count?h.html(u.intro(n.count,n.isLocal)):u.id==="social-investments"&&n.stat&&n.stat2?h.html(u.intro(n.stat,n.stat2)):h.html(u.intro(n.stat));p.html(n.year)}function tt(){l.html("");h.html("");a.attr("src","");e.html("");f.html("");y.html("");p.html("");u=null;c=null;currentYear=null;g()}function it(n){n.preventDefault();u=r[r.indexOf(u)-1]||r[r.length-1];v()}function rt(n){n.preventDefault();u=r[r.indexOf(u)+1]||r[0];v()}var s="/-/media/chevron/namm/icons/",w=[{id:"employees",name:"employees",intro:function(n){return n===1?"employee":"employees"},icon:s+"People_blue_rgb.png"},{id:"retirees",name:"retirees",intro:function(n){return n===1?"retiree":"retirees"},icon:s+"Achievement_blue_rgb.png"},{id:"social-investments",name:"social investments",intro:function(n,t){var i="in social investment partnerships and programs focused on economic development, health and education";return t&&(i+=", including "+t+" of general support within the U.S."),i},icon:s+"Partnerships_stakeholders_red_rgb.png"},{id:"suppliers",name:"supplier spend",intro:function(n,t){return"spent with "+n+(t?" locally registered ":" U.S.-based ")+(n===1?"supplier":"suppliers")},icon:s+"Building_local_capacity_purple_rgb.png"},{id:"facilities",name:"service stations",intro:function(n){return"branded service "+(n===1?"station":"stations")},icon:s+"Products_services_teal_rgb.png"}],c,u,r,y=i("#fact-eyebrow #current-state"),p=i("#fact-eyebrow #current-year"),b=i("#fact-footer-links"),f=i("#previous-fact #previous-fact-name"),e=i("#next-fact #next-fact-name"),l=i("#fact-content-info #fact-content-stat"),h=i("#fact-content-info #fact-content-caption"),a=i("#fact-content-info #fact-icon");return i("#modal-sidebar-btn-close").click(function(){i("#expandedFactModal").modal("hide")}),{init:k,populateData:nt,clear:tt}}(window,document,window.jQuery),nammModalContent=function(n,t,i){var r;i("#expandedFactModal").on("shown.bs.modal",function(n){r=i(n.relatedTarget).data("currentstate")})}(window,document,window.jQuery)