var zipatlas={P1:(n)=>{return n.toLocaleString('en-US',{style:'percent',minimumFractionDigits:1,maximumFractionDigits:1});},P2:(n)=>{return n.toLocaleString('en-US',{style:'percent',minimumFractionDigits:2,maximumFractionDigits:2});},N0:(n)=>{return n.toLocaleString("en-US");},N1:(n)=>{return n.toLocaleString("en-US",{style:'decimal',minimumFractionDigits:1,maximumFractionDigits:1});},N2:(n)=>{return n.toLocaleString("en-US",{style:'decimal',minimumFractionDigits:2,maximumFractionDigits:2});},C0:(n)=>{return n.toLocaleString('en-US',{style:'currency',currency:'USD',minimumFractionDigits:0,maximumFractionDigits:0});},C2:(n)=>{return n.toLocaleString('en-US',{style:'currency',currency:'USD',minimumFractionDigits:2,maximumFractionDigits:2});},data:null,type:null,e:{div:null,chart:null},ext:{css:(u,cb)=>{const l=document.createElement('link');l.rel='stylesheet';l.type='text/css';if(cb){l.onload=()=>{cb();};}l.href=u;document.head.appendChild(l);},js:(u,cb)=>{const s=document.createElement('script');if(cb){s.onload=()=>{cb();};}s.src=u;document.head.appendChild(s);}},get:async(u)=>{try{const response=await fetch(u);const results=response.json();return results;}catch(e){return{status:'ERROR',message:'Fetch API Error',details:e.message};}},wait:(cond,cb)=>{if(cond()){cb();}else{setTimeout(()=>{zipatlas.wait(cond,cb);},50);}}};zipatlas.zchart={ar:(rules)=>{const st=document.createElement('style');document.head.appendChild(st);const ss=st.sheet;for(let i=0;i{if(!v){return false;}if(typeof v==='string'||v instanceof String){return v.match(/^\s*$/)==null;}return false;},palette:['fba95b','e87870','649fdd','ad7bb1','25a5b7','8093e1','f56693'],init:()=>{zipatlas.zchart.color.len=zipatlas.zchart.palette.length;const rules=[];for(let i=1;i<=zipatlas.zchart.palette.length;i++){const c=zipatlas.zchart.palette[i-1];rules.push([['.zipatlas div.zipatlas-bar.zipatlas-c-'+i],['background-color','#'+c]],[['.zipatlas div.zipatlas-bar.zipatlas-c-'+i+'.zipatlas-v','.zipatlas div.zipatlas-bar.zipatlas-c-'+i+':hover'],['box-shadow','0px 0px 6px #fff, 0px 0px 2px #fff, 0px 0px 5px #'+c+', 0px 0px 10px #'+c+', 0px 0px 15px #'+c]]);}for(let i=1;i<=30;i++){const d=Math.round(5*(i-1))/100;rules.push([['.zipatlas div[ch="c"] > div:nth-child('+i+') div.zipatlas-bar','.zipatlas div[ch="h"] > div:nth-child('+i+') div.zipatlas-bar'],['transition','box-shadow 0.15s ease-in-out, width 0.5s cubic-bezier(.43,1.39,.57,.97) '+' '+d+'s']]);}zipatlas.zchart.ar(rules);},color:{len:0,ix:0,get:()=>{return(zipatlas.zchart.color.ix++% zipatlas.zchart.color.len)+1;},mf:[3,7]},cf:(c)=>{return{c:isNaN(c)?((c=='S')?zipatlas.zchart.color.get():''):Number(c),a:c!='S'&& c!='M'&&(typeof c==='string'||c instanceof String)?JSON.parse(c):[]};},ox:0.45,sp:50,spx:10,gx:(x)=>{let m=x;let v=x;let p=0;while(v>1){v/=10;p++;}let t=[0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.75,1];for(let i=0;i0){m*=10;p--;}return m;},ff:(f)=>{let ff=(n)=>{return zipatlas.N0(n);};if(f){switch(f){case'N0':ff=(n)=>{return zipatlas.N0(n);};break;case'N1':ff=(n)=>{return zipatlas.N1(n);};break;case'N2':ff=(n)=>{return zipatlas.N2(n);};break;case'C0':ff=(n)=>{return zipatlas.C0(n);};break;case'C2':ff=(n)=>{return zipatlas.C2(n);};break;case'P1':ff=(n)=>{return zipatlas.P1(n);};break;case'P2':ff=(n)=>{return zipatlas.P2(n);};break;}}return ff;},dff:(f)=>{return(n)=>{return n.N0();};}};zipatlas.zchart.HBar=function(_c){const data=(_c.ip)?_c.dp:_c.ds;const ffp=(_c.ffp)?zipatlas.zchart.ff(_c.ffp):zipatlas.zchart.dff();const ffs=(_c.ffs)?zipatlas.zchart.ff(_c.ffs):zipatlas.zchart.dff();const ff=(_c.ip)?ffp:ffs;const tt_f=(i)=>{if(_c.dp[i]<0){return'-';}return _c.ds && _c.ds.length==_c.dp.length?''+ffp(_c.dp[i])+' | '+ffs(_c.ds[i])+'':''+ffp(_c.dp[i])+'';};const d={n:Math.min(...data),x:Math.max(...data)};d.d=(d.x-d.n);d.m=(d.x+d.n)/2;const c={n:0,x:zipatlas.zchart.gx(d.x)};c.d=(c.x-c.n);c.m=(c.x+c.n)/2;const tt_l=document.createElement('div');tt_l.textContent=_c.l[0];const tt_v=document.createElement('div');tt_v.innerHTML=tt_f(0);const tt_m=document.createElement('div');tt_m.textContent=_c.m+':';tt_m.classList.add('zipatlas-r');const tt=document.createElement('div');tt.classList.add('zipatlas-tt');tt.appendChild(tt_l);tt.appendChild(tt_m);tt.appendChild(tt_v);if(_c.t && zipatlas.zchart.hasValue(_c.t)){const tt_t=document.createElement('div');tt_t.textContent=_c.t+':';tt_t.classList.add('zipatlas-r');tt.appendChild(tt_t);}else{tt_l.style.gridColumn='1 / 3';}const br=[];const ts=[];const tr=_c.e.querySelectorAll('div');const sc=document.createElement('div');sc.classList.add('zipatlas-scale');const sc_n=document.createElement('div');const sc_m=document.createElement('div');const sc_x=document.createElement('div');sc_n.textContent=ff(c.n);sc_m.textContent=ff(c.m);sc_x.textContent=ff(c.x);sc.appendChild(sc_n);sc.appendChild(sc_m);sc.appendChild(sc_x);_c.e.insertBefore(sc,tr[0]);_c.e.appendChild(tt);const cd=zipatlas.zchart.cf(_c.c);const cf=(i)=>{switch(_c.c){case'S':return cd.c;case'M':return zipatlas.zchart.color.get();default:{if(!isNaN(_c.c)){return cd.c;}else if(typeof _c.c==='string'||_c.c instanceof String){return cd.a[i];}else{console.error('Invalid color format');}}}};let tm=null;for(let i=0;i{clearTimeout(tm);tt_l.innerHTML=_c.l[i];tt_v.innerHTML=tt_f(i);setTimeout(()=>{const wa=[];for(let i=0;it.offsetWidth-tt.offsetWidth){l=t.offsetWidth-tt.offsetWidth;}tt.style.left=l+'px';tt.style.top=(t.offsetTop-tt.offsetHeight)+'px';if(!tt.classList.contains('zipatlas-v')){tt.classList.add('zipatlas-v');}},0);};const off=()=>{tm=setTimeout(()=>{if(tt.classList.contains('zipatlas-v')){tt.classList.remove('zipatlas-v');}},50);};['touchmove','mouseover'].forEach((e)=>{b.addEventListener(e,()=>{on();});});b.addEventListener('mouseout',()=>{off();});t.appendChild(b);br.push(b);ts.push(ti);}const fit=(active)=>{const wa=[];for(let i=0;i{fit(true);});setTimeout(()=>{fit();setTimeout(()=>{fit(true);},0);},0);};zipatlas.zchart.Comp=function(_c){const data_1=(_c.ip)?_c.dp_1:_c.ds_1;const data_2=(_c.ip)?_c.dp_2:_c.ds_2;const ffp=(_c.ffp)?zipatlas.zchart.ff(_c.ffp):zipatlas.zchart.dff();const ffs=(_c.ffs)?zipatlas.zchart.ff(_c.ffs):zipatlas.zchart.dff();const ff=(_c.ip)?ffp:ffs;const tt_f_1=(i)=>{if(_c.ds_1[i]<0){return'-';}return _c.ds_1 && _c.ds_1.length==_c.dp_1.length?''+ffp(_c.dp_1[i])+' | '+ffs(_c.ds_1[i])+'':''+ffp(_c.dp_1[i])+'';};const tt_f_2=(i)=>{if(_c.ds_2[i]<0){return'-';}return _c.ds_2 && _c.ds_2.length==_c.dp_2.length?''+ffp(_c.dp_2[i])+' | '+ffs(_c.ds_2[i])+'':''+ffp(_c.dp_2[i])+'';};const d_1={n:Math.min(...data_1),x:Math.max(...data_1)};d_1.d=(d_1.x-d_1.n);d_1.m=(d_1.x+d_1.n)/2;const d_2={n:Math.min(...data_2),x:Math.max(...data_2)};d_2.d=(d_2.x-d_2.n);d_2.m=(d_2.x+d_2.n)/2;const c={n:0,x:zipatlas.zchart.gx(Math.max(d_1.x,d_2.x))};c.d=(c.x-c.n);c.m=(c.x+c.n)/2;const tt_l=document.createElement('div');tt_l.textContent=_c.l[0];const tt_v_1=document.createElement('div');const tt_v_2=document.createElement('div');tt_v_1.innerHTML=tt_f_1(0);tt_v_2.innerHTML=tt_f_2(0);const tt_m_1=document.createElement('div');const tt_m_2=document.createElement('div');tt_m_1.classList.add('zipatlas-r');tt_m_2.classList.add('zipatlas-r');tt_m_1.textContent=_c.m[0]+':';tt_m_2.textContent=_c.m[1]+':';const tt=document.createElement('div');tt.classList.add('zipatlas-tt');tt.appendChild(tt_l);tt.appendChild(tt_m_1);tt.appendChild(tt_v_1);tt.appendChild(tt_m_2);tt.appendChild(tt_v_2);if(_c.t && zipatlas.zchart.hasValue(_c.t)){const tt_t=document.createElement('div');tt_t.textContent=_c.t+':';tt_t.classList.add('zipatlas-r');tt.insertBefore(tt_t,tt_l);}else{tt_l.style.gridColumn='1 / 3';}const br_1=[];const br_2=[];const ts=[];const tr=_c.e.querySelectorAll('div');const sc_1=document.createElement('div');const sc_2=document.createElement('div');sc_1.textContent=ff(c.x);sc_2.textContent=ff(c.x);const sc=document.createElement('div');sc.classList.add('zipatlas-scale');sc.appendChild(sc_1);sc.appendChild(sc_2);_c.e.insertBefore(sc,tr[0]);_c.e.appendChild(tt);const cf=_c.c && Array.isArray(_c.c)&& _c.c.length>=2?_c.c:zipatlas.zchart.color.mf;let tm=null;for(let i=0;i{tt_l.innerHTML=_c.l[i];tt_v_1.innerHTML=tt_f_1(i);tt_v_2.innerHTML=tt_f_2(i);};const on_1=()=>{clearTimeout(tm);tt_u();setTimeout(()=>{const wa=[];for(let i=0;it.offsetWidth-tt.offsetWidth){l=t.offsetWidth-tt.offsetWidth;}tt.style.left=l+'px';tt.style.top=(t.offsetTop-tt.offsetHeight)+'px';_c.e.querySelectorAll('.zipatlas-bar.zipatlas-v').forEach((e)=>{e.classList.remove('zipatlas-v');});if(!b_2.classList.contains('zipatlas-v')){b_2.classList.add('zipatlas-v');}if(!tt.classList.contains('zipatlas-v')){tt.classList.add('zipatlas-v');}},0);};const on_2=()=>{clearTimeout(tm);tt_u();setTimeout(()=>{const wa=[];for(let i=0;it.offsetWidth-tt.offsetWidth){l=t.offsetWidth-tt.offsetWidth;}tt.style.left=l+'px';tt.style.top=(t.offsetTop-tt.offsetHeight)+'px';_c.e.querySelectorAll('.zipatlas-bar.zipatlas-v').forEach((e)=>{e.classList.remove('zipatlas-v');});if(!b_1.classList.contains('zipatlas-v')){b_1.classList.add('zipatlas-v');}if(!tt.classList.contains('zipatlas-v')){tt.classList.add('zipatlas-v');}},0);};const off=()=>{_c.e.querySelectorAll('.zipatlas-bar.zipatlas-v').forEach((e)=>{e.classList.remove('zipatlas-v');});tm=setTimeout(()=>{if(tt.classList.contains('zipatlas-v')){tt.classList.remove('zipatlas-v');}},50);};['touchmove','mouseover'].forEach((e)=>{b_1.addEventListener((e),()=>{on_1();});b_2.addEventListener((e),()=>{on_2();});});[b_1,b_2].forEach((e)=>{e.addEventListener('mouseout',()=>{off();});});t.appendChild(b_1);t.appendChild(b_2);br_1.push(b_1);br_2.push(b_2);ts.push(ti);}const fit=(active)=>{const wa=[];for(let i=0;i{fit(true);});setTimeout(()=>{fit();setTimeout(()=>{fit(true);},0);},0);};zipatlas.zchart.toTagL=function(s){return s.toLowerCase().replace(/(^[^\w]+\b|\b[^\w]+$)/g,'').replace(/[^\w]+/g,'-');};zipatlas.zchart.helpers={};zipatlas.zchart.helpers.colors=['#ed294f','#2688db','#ebad17','#1e95af','#d020e0','#01be75','#e9d716','#169d00','#ed691a','#1822e7','#bb0e3f','#a5c300'];zipatlas.zchart.obgmx=0.75;zipatlas.zchart.obgmn=0.5;zipatlas.zchart.obgd=zipatlas.zchart.obgmx-zipatlas.zchart.obgmn;zipatlas.zchart.obormx=0.85;zipatlas.zchart.obormn=0.6;zipatlas.zchart.obord=zipatlas.zchart.obormx-zipatlas.zchart.obormn;zipatlas.zchart.helpers.group_colors={};zipatlas.zchart.helpers.getGroupColor=(gn)=>{if(zipatlas.zchart.helpers.group_colors.hasOwnProperty(gn)){return zipatlas.zchart.helpers.group_colors[gn];}let color=zipatlas.zchart.helpers.colors[Object.keys(zipatlas.zchart.helpers.group_colors).length % zipatlas.zchart.helpers.colors.length];zipatlas.zchart.helpers.group_colors[gn]=color;return color;};zipatlas.zchart.helpers.omin=0.25;zipatlas.zchart.helpers.omax=0.6;zipatlas.zchart.helpers.odelta=zipatlas.zchart.helpers.omax-zipatlas.zchart.helpers.omin;zipatlas.zchart.helpers.colorFromValue=(gn,v,r,ct)=>{let c=zipatlas.zchart.helpers.getGroupColor(gn);let a=(1-(r/(v+r)))*zipatlas.zchart.helpers.odelta+zipatlas.zchart.helpers.omin;if(ct>0){a+=(ct+zipatlas.zchart.helpers.odelta)/(ct+1);}return Chart.helpers.color(c).alpha(a).rgbString();};zipatlas.zchart.helpers.getCtxColor=(ctx,max,ct)=>{let i=ctx.dataset.data[ctx.dataIndex];if(!i){return;}switch(i.l){case 0:return zipatlas.zchart.helpers.colorFromValue(i.g,i.v,max,ct);case 1:let d=i._data;if(zipatlas.zchart.toTagL(d.group)==zipatlas.zchart.toTagL(d.name)){return'transparent';}if(ct==0){return Chart.helpers.color('white').alpha(0.5).rgbString();}return Chart.helpers.color('white').alpha(0.8).rgbString();default:return'transparent';}};zipatlas.zchart.TMap=(_c)=>{const ff=zipatlas.zchart.ff(_c.v);const _d=_c.d;const _m=Math.max.apply(Math,_d.map((_d)=>{return _d[_c.k];}))/10;const config={type:'treemap',data:{datasets:[{tree:_c.d,key:_c.k,groups:_c.g,backgroundColor:(ctx)=>{return zipatlas.zchart.helpers.getCtxColor(ctx,_m,0);},borderColor:(ctx)=>{return zipatlas.zchart.helpers.getCtxColor(ctx,_m,2);},hoverBackgroundColor:(ctx)=>{return zipatlas.zchart.helpers.getCtxColor(ctx,_m,0.5);},spacing:1,borderWidth:1}]},options:{maintainAspectRatio:false,title:{display:false},plugins:{legend:{display:false},tooltip:{callbacks:{title:(i)=>{return _c.t;},label:(i)=>{let v=i.dataset.data[i.dataIndex];if(v.l==0){return v.g+': '+ff(v.v);}if(_c.s.hasOwnProperty(zipatlas.zchart.toTagL(v.g))){return v.g+': '+ff(v.v);}return'';}}}}}};return new Chart(_c.e,config);};zipatlas.log=async()=>{const l=window.location;const p={protocol:l.protocol,host:l.hostname,path:l.pathname,query:l.search,url:l.href};const send=async(p)=>{try{const response=await fetch('https://zipatlas.com/api/embed/log',{method:'POST',cache:'no-cache',headers:{'Content-Type':'application/json'},body:JSON.stringify(p)});const results=response.json();return results;}catch(e){return{status:'ERROR',message:'Log Fetch API Error',details:e.message};}};const response=await send(p);},zipatlas.zchart.css_ok=false;zipatlas.render=()=>{zipatlas.e.div.innerHTML=zipatlas.data.html;setTimeout(()=>{for(let i=0;i{zipatlas.ext.js('https://zipatlas.com/js/chart.treemap.js',()=>{js=true;});});const c={e:el,d:JSON.parse(ch.d),s:JSON.parse(ch.s),g:JSON.parse(ch.g),k:ch.k,t:ch.t};zipatlas.wait(()=>{return js;},()=>{zipatlas.zchart.TMap(c);});}break}}var da=zipatlas.e.div.parentElement.querySelector('.zipatlas-attr');if(!da){const err='WARING: ZipAtlas.com Attribution Removed';console.error(err);alert(err);return;}zipatlas.e.div.parentElement.removeChild(da);zipatlas.e.div.appendChild(da);},0);};zipatlas.init=async(e,s)=>{zipatlas.zchart.init();zipatlas.ext.css('https://zipatlas.com/api/embed/chart.css',()=>{zipatlas.zchart.css_ok=true;});const c=document.createElement('div');c.classList.add('zipatlas');s.parentElement.insertBefore(c,s);zipatlas.e.div=c;zipatlas.data=await zipatlas.get('https://zipatlas.com/api/embed/data.json?'+e);zipatlas.wait(()=>{return zipatlas.zchart.css_ok;},async()=>{if(zipatlas.data.status=='OK'){zipatlas.render();}else{console.error('ERROR',zipatlas.data);}await zipatlas.log();});};