var hcfcd,__extends,channelGraphics;(function(n){var t=function(){function n(){this._listeners=[]}return n.prototype.add=function(n){this._listeners.push(n)},n.prototype.remove=function(n){if(typeof n=="function"){for(var t=0,i=this._listeners.length;t<i;i++)if(this._listeners[t]===n){this._listeners.splice(t,1);break}}else this._listeners=[]},n.prototype.trigger=function(){for(var u,i,t,f,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(u={},i=this._listeners.slice(0),t=0,f=i.length;t<f;t++)i[t].apply(u,r||[])},n}();n.TypedEvent=t})(hcfcd||(hcfcd={}));!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.moment=t()}(this,function(){"use strict";function i(){return kf.apply(null,arguments)}function pe(n){kf=n}function ui(n){return"[object Array]"===Object.prototype.toString.call(n)}function fi(n){return n instanceof Date||"[object Date]"===Object.prototype.toString.call(n)}function we(n,t){for(var r=[],i=0;i<n.length;++i)r.push(t(n[i],i));return r}function ft(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function ei(n,t){for(var i in t)ft(t,i)&&(n[i]=t[i]);return ft(t,"toString")&&(n.toString=t.toString),ft(t,"valueOf")&&(n.valueOf=t.valueOf),n}function kt(n,t,i,r){return gu(n,t,i,r,!0).utc()}function be(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(n){return null==n._pf&&(n._pf=be()),n._pf}function iu(n){if(null==n._isValid){var t=e(n);n._isValid=!(isNaN(n._d.getTime())||!(t.overflow<0)||t.empty||t.invalidMonth||t.invalidWeekday||t.nullInput||t.invalidFormat||t.userInvalidated);n._strict&&(n._isValid=n._isValid&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)}return n._isValid}function ru(n){var t=kt(NaN);return null!=n?ei(e(t),n):e(t).userInvalidated=!0,t}function ki(n,t){var u,i,r;if("undefined"!=typeof t._isAMomentObject&&(n._isAMomentObject=t._isAMomentObject),"undefined"!=typeof t._i&&(n._i=t._i),"undefined"!=typeof t._f&&(n._f=t._f),"undefined"!=typeof t._l&&(n._l=t._l),"undefined"!=typeof t._strict&&(n._strict=t._strict),"undefined"!=typeof t._tzm&&(n._tzm=t._tzm),"undefined"!=typeof t._isUTC&&(n._isUTC=t._isUTC),"undefined"!=typeof t._offset&&(n._offset=t._offset),"undefined"!=typeof t._pf&&(n._pf=e(t)),"undefined"!=typeof t._locale&&(n._locale=t._locale),cr.length>0)for(u in cr)i=cr[u],r=t[i],"undefined"!=typeof r&&(n[i]=r);return n}function dt(n){ki(this,n);this._d=new Date(null!=n._d?n._d.getTime():NaN);lr===!1&&(lr=!0,i.updateOffset(this),lr=!1)}function nt(n){return n instanceof dt||null!=n&&null!=n._isAMomentObject}function v(n){return 0>n?Math.ceil(n):Math.floor(n)}function s(n){var t=+n,i=0;return 0!==t&&isFinite(t)&&(i=v(t)),i}function uu(n,t,i){for(var f=Math.min(n.length,t.length),e=Math.abs(n.length-t.length),u=0,r=0;f>r;r++)(i&&n[r]!==t[r]||!i&&s(n[r])!==s(t[r]))&&u++;return u+e}function fu(){}function eu(n){return n?n.toLowerCase().replace("_","-"):n}function ke(n){for(var i,t,f,r,u=0;u<n.length;){for(r=eu(n[u]).split("-"),i=r.length,t=eu(n[u+1]),t=t?t.split("-"):null;i>0;){if(f=ou(r.slice(0,i).join("-")))return f;if(t&&t.length>=i&&uu(r,t,!0)>=i-1)break;i--}u++}return null}function ou(n){var t=null;if(!ct[n]&&"undefined"!=typeof module&&module&&module.exports)try{t=li._abbr;require("./locale/"+n);gt(t)}catch(i){}return ct[n]}function gt(n,t){var i;return n&&(i="undefined"==typeof t?et(n):su(n,t),i&&(li=i)),li._abbr}function su(n,t){return null!==t?(t.abbr=n,ct[n]=ct[n]||new fu,ct[n].set(t),gt(n),ct[n]):(delete ct[n],null)}function et(n){var t;if(n&&n._locale&&n._locale._abbr&&(n=n._locale._abbr),!n)return li;if(!ui(n)){if(t=ou(n))return t;n=[n]}return ke(n)}function l(n,t){var i=n.toLowerCase();ii[i]=ii[i+"s"]=ii[t]=n}function p(n){if("string"==typeof n)return ii[n]||ii[n.toLowerCase()]}function hu(n){var i,t,r={};for(t in n)ft(n,t)&&(i=p(t),i&&(r[i]=n[t]));return r}function yt(n,t){return function(r){return null!=r?(cu(this,n,r),i.updateOffset(this,t),this):oi(this,n)}}function oi(n,t){return n._d["get"+(n._isUTC?"UTC":"")+t]()}function cu(n,t,i){return n._d["set"+(n._isUTC?"UTC":"")+t](i)}function lu(n,t){var i;if("object"==typeof n)for(i in n)this.set(i,n[i]);else if(n=p(n),"function"==typeof this[n])return this[n](t);return this}function di(n,t,i){var r=""+Math.abs(n),u=t-r.length,f=n>=0;return(f?i?"+":"":"-")+Math.pow(10,Math.max(0,u)).toString().substr(1)+r}function r(n,t,i,r){var u=r;"string"==typeof r&&(u=function(){return this[r]()});n&&(wt[n]=u);t&&(wt[t[0]]=function(){return di(u.apply(this,arguments),t[1],t[2])});i&&(wt[i]=function(){return this.localeData().ordinal(u.apply(this,arguments),n)})}function de(n){return n.match(/\[[\s\S]/)?n.replace(/^\[|\]$/g,""):n.replace(/\\/g,"")}function ge(n){for(var i=n.match(df),t=0,r=i.length;r>t;t++)i[t]=wt[i[t]]?wt[i[t]]:de(i[t]);return function(u){var f="";for(t=0;r>t;t++)f+=i[t]instanceof Function?i[t].call(u,n):i[t];return f}}function gi(n,t){return n.isValid()?(t=au(t,n.localeData()),ar[t]=ar[t]||ge(t),ar[t](n)):n.localeData().invalidDate()}function au(n,t){function r(n){return t.longDateFormat(n)||n}var i=5;for(ai.lastIndex=0;i>=0&&ai.test(n);)n=n.replace(ai,r),ai.lastIndex=0,i-=1;return n}function no(n){return"function"==typeof n&&"[object Function]"===Object.prototype.toString.call(n)}function t(n,t,i){pr[n]=no(t)?t:function(n){return n&&i?i:t}}function to(n,t){return ft(pr,n)?pr[n](t._strict,t._locale):new RegExp(io(n))}function io(n){return n.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(n,t,i,r,u){return t||i||r||u}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function c(n,t){var i,r=t;for("string"==typeof n&&(n=[n]),"number"==typeof t&&(r=function(n,i){i[t]=s(n)}),i=0;i<n.length;i++)wr[n[i]]=r}function ni(n,t){c(n,function(n,i,r,u){r._w=r._w||{};t(n,r._w,r,u)})}function ro(n,t,i){null!=t&&ft(wr,n)&&wr[n](t,i._a,i,n)}function nr(n,t){return new Date(Date.UTC(n,t+1,0)).getUTCDate()}function uo(n){return this._months[n.month()]}function fo(n){return this._monthsShort[n.month()]}function eo(n,t,i){var r,u,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;12>r;r++)if((u=kt([2e3,r]),i&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(u,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(u,"").replace(".","")+"$","i")),i||this._monthsParse[r]||(f="^"+this.months(u,"")+"|^"+this.monthsShort(u,""),this._monthsParse[r]=new RegExp(f.replace(".",""),"i")),i&&"MMMM"===t&&this._longMonthsParse[r].test(n))||i&&"MMM"===t&&this._shortMonthsParse[r].test(n)||!i&&this._monthsParse[r].test(n))return r}function vu(n,t){var i;return"string"==typeof t&&(t=n.localeData().monthsParse(t),"number"!=typeof t)?n:(i=Math.min(n.date(),nr(n.year(),t)),n._d["set"+(n._isUTC?"UTC":"")+"Month"](t,i),n)}function yu(n){return null!=n?(vu(this,n),i.updateOffset(this,!0),this):oi(this,"Month")}function oo(){return nr(this.year(),this.month())}function tr(n){var i,t=n._a;return t&&-2===e(n).overflow&&(i=t[d]<0||t[d]>11?d:t[k]<1||t[k]>nr(t[b],t[d])?k:t[a]<0||t[a]>24||24===t[a]&&(0!==t[lt]||0!==t[at]||0!==t[vt])?a:t[lt]<0||t[lt]>59?lt:t[at]<0||t[at]>59?at:t[vt]<0||t[vt]>999?vt:-1,e(n)._overflowDayOfYear&&(b>i||i>k)&&(i=k),e(n).overflow=i),n}function pu(n){i.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+n)}function w(n,t){var i=!0;return ei(function(){return i&&(pu(n+"\n"+(new Error).stack),i=!1),t.apply(this,arguments)},t)}function so(n,t){te[n]||(pu(t),te[n]=!0)}function wu(n){var t,i,r=n._i,u=fa.exec(r);if(u){for(e(n).iso=!0,t=0,i=br.length;i>t;t++)if(br[t][1].exec(r)){n._f=br[t][0];break}for(t=0,i=kr.length;i>t;t++)if(kr[t][1].exec(r)){n._f+=(u[6]||" ")+kr[t][0];break}r.match(bi)&&(n._f+="Z");ur(n)}else n._isValid=!1}function ho(n){var t=ea.exec(n._i);return null!==t?void(n._d=new Date(+t[1])):(wu(n),void(n._isValid===!1&&(delete n._isValid,i.createFromInputFallback(n))))}function co(n,t,i,r,u,f,e){var o=new Date(n,t,i,r,u,f,e);return 1970>n&&o.setFullYear(n),o}function ir(n){var t=new Date(Date.UTC.apply(null,arguments));return 1970>n&&t.setUTCFullYear(n),t}function bu(n){return ku(n)?366:365}function ku(n){return n%4==0&&n%100!=0||n%400==0}function lo(){return ku(this.year())}function ot(n,t,i){var u,f=i-t,r=i-n.day();return r>f&&(r-=7),f-7>r&&(r+=7),u=o(n).add(r,"d"),{week:Math.ceil(u.dayOfYear()/7),year:u.year()}}function ao(n){return ot(n,this._week.dow,this._week.doy).week}function vo(){return this._week.dow}function yo(){return this._week.doy}function po(n){var t=this.localeData().week(this);return null==n?t:this.add(7*(n-t),"d")}function wo(n){var t=ot(this,1,4).week;return null==n?t:this.add(7*(n-t),"d")}function bo(n,t,i,r,u){var f,o=6+u-r,s=ir(n,0,1+o),e=s.getUTCDay();return u>e&&(e+=7),i=null!=i?1*i:u,f=1+o+7*(t-1)-e+i,{year:f>0?n:n-1,dayOfYear:f>0?f:bu(n-1)+f}}function ko(n){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==n?t:this.add(n-t,"d")}function pt(n,t,i){return null!=n?n:null!=t?t:i}function go(n){var t=new Date;return n._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function rr(n){var t,i,r,u,f=[];if(!n._d){for(r=go(n),n._w&&null==n._a[k]&&null==n._a[d]&&ns(n),n._dayOfYear&&(u=pt(n._a[b],r[b]),n._dayOfYear>bu(u)&&(e(n)._overflowDayOfYear=!0),i=ir(u,0,n._dayOfYear),n._a[d]=i.getUTCMonth(),n._a[k]=i.getUTCDate()),t=0;3>t&&null==n._a[t];++t)n._a[t]=f[t]=r[t];for(;7>t;t++)n._a[t]=f[t]=null==n._a[t]?2===t?1:0:n._a[t];24===n._a[a]&&0===n._a[lt]&&0===n._a[at]&&0===n._a[vt]&&(n._nextDay=!0,n._a[a]=0);n._d=(n._useUTC?ir:co).apply(null,f);null!=n._tzm&&n._d.setUTCMinutes(n._d.getUTCMinutes()-n._tzm);n._nextDay&&(n._a[a]=24)}}function ns(n){var t,e,u,r,i,f,s;t=n._w;null!=t.GG||null!=t.W||null!=t.E?(i=1,f=4,e=pt(t.GG,n._a[b],ot(o(),1,4).year),u=pt(t.W,1),r=pt(t.E,1)):(i=n._locale._week.dow,f=n._locale._week.doy,e=pt(t.gg,n._a[b],ot(o(),i,f).year),u=pt(t.w,1),null!=t.d?(r=t.d,i>r&&++u):r=null!=t.e?t.e+i:i);s=bo(e,u,r,f,i);n._a[b]=s.year;n._dayOfYear=s.dayOfYear}function ur(n){if(n._f===i.ISO_8601)return void wu(n);n._a=[];e(n).empty=!0;for(var t,u,s,r=""+n._i,c=r.length,h=0,o=au(n._f,n._locale).match(df)||[],f=0;f<o.length;f++)u=o[f],t=(r.match(to(u,n))||[])[0],t&&(s=r.substr(0,r.indexOf(t)),s.length>0&&e(n).unusedInput.push(s),r=r.slice(r.indexOf(t)+t.length),h+=t.length),wt[u]?(t?e(n).empty=!1:e(n).unusedTokens.push(u),ro(u,t,n)):n._strict&&!t&&e(n).unusedTokens.push(u);e(n).charsLeftOver=c-h;r.length>0&&e(n).unusedInput.push(r);e(n).bigHour===!0&&n._a[a]<=12&&n._a[a]>0&&(e(n).bigHour=void 0);n._a[a]=ts(n._locale,n._a[a],n._meridiem);rr(n);tr(n)}function ts(n,t,i){var r;return null==i?t:null!=n.meridiemHour?n.meridiemHour(t,i):null!=n.isPM?(r=n.isPM(i),r&&12>t&&(t+=12),r||12!==t||(t=0),t):t}function is(n){var t,f,u,r,i;if(0===n._f.length)return e(n).invalidFormat=!0,void(n._d=new Date(NaN));for(r=0;r<n._f.length;r++)i=0,t=ki({},n),null!=n._useUTC&&(t._useUTC=n._useUTC),t._f=n._f[r],ur(t),iu(t)&&(i+=e(t).charsLeftOver,i+=10*e(t).unusedTokens.length,e(t).score=i,(null==u||u>i)&&(u=i,f=t));ei(n,f||t)}function rs(n){if(!n._d){var t=hu(n._i);n._a=[t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond];rr(n)}}function us(n){var t=new dt(tr(du(n)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function du(n){var t=n._i,i=n._f;return n._locale=n._locale||et(n._l),null===t||void 0===i&&""===t?ru({nullInput:!0}):("string"==typeof t&&(n._i=t=n._locale.preparse(t)),nt(t)?new dt(tr(t)):(ui(i)?is(n):i?ur(n):fi(t)?n._d=t:fs(n),n))}function fs(n){var t=n._i;void 0===t?n._d=new Date:fi(t)?n._d=new Date(+t):"string"==typeof t?ho(n):ui(t)?(n._a=we(t.slice(0),function(n){return parseInt(n,10)}),rr(n)):"object"==typeof t?rs(n):"number"==typeof t?n._d=new Date(t):i.createFromInputFallback(n)}function gu(n,t,i,r,u){var f={};return"boolean"==typeof i&&(r=i,i=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=u,f._l=i,f._i=n,f._f=t,f._strict=r,us(f)}function o(n,t,i,r){return gu(n,t,i,r,!1)}function nf(n,t){var r,i;if(1===t.length&&ui(t[0])&&(t=t[0]),!t.length)return o();for(r=t[0],i=1;i<t.length;++i)(!t[i].isValid()||t[i][n](r))&&(r=t[i]);return r}function es(){var n=[].slice.call(arguments,0);return nf("isBefore",n)}function os(){var n=[].slice.call(arguments,0);return nf("isAfter",n)}function si(n){var t=hu(n),i=t.year||0,r=t.quarter||0,u=t.month||0,f=t.week||0,e=t.day||0,o=t.hour||0,s=t.minute||0,h=t.second||0,c=t.millisecond||0;this._milliseconds=+c+1e3*h+6e4*s+36e5*o;this._days=+e+7*f;this._months=+u+3*r+12*i;this._data={};this._locale=et();this._bubble()}function fr(n){return n instanceof si}function tf(n,t){r(n,0,0,function(){var n=this.utcOffset(),i="+";return 0>n&&(n=-n,i="-"),i+di(~~(n/60),2)+t+di(~~n%60,2)})}function er(n){var i=(n||"").match(bi)||[],u=i[i.length-1]||[],t=(u+"").match(fe)||["-",0,0],r=+(60*t[1])+s(t[2]);return"+"===t[0]?r:-r}function or(n,t){var r,u;return t._isUTC?(r=t.clone(),u=(nt(n)||fi(n)?+n:+o(n))-+r,r._d.setTime(+r._d+u),i.updateOffset(r,!1),r):o(n).local()}function sr(n){return 15*-Math.round(n._d.getTimezoneOffset()/15)}function ss(n,t){var r,u=this._offset||0;return null!=n?("string"==typeof n&&(n=er(n)),Math.abs(n)<16&&(n=60*n),!this._isUTC&&t&&(r=sr(this)),this._offset=n,this._isUTC=!0,null!=r&&this.add(r,"m"),u!==n&&(!t||this._changeInProgress?ef(this,tt(n-u,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,i.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?u:sr(this)}function hs(n,t){return null!=n?("string"!=typeof n&&(n=-n),this.utcOffset(n,t),this):-this.utcOffset()}function cs(n){return this.utcOffset(0,n)}function ls(n){return this._isUTC&&(this.utcOffset(0,n),this._isUTC=!1,n&&this.subtract(sr(this),"m")),this}function as(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(er(this._i)),this}function vs(n){return n=n?o(n).utcOffset():0,(this.utcOffset()-n)%60==0}function ys(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function ps(){var n,t;return"undefined"!=typeof this._isDSTShifted?this._isDSTShifted:(n={},(ki(n,this),n=du(n),n._a)?(t=n._isUTC?kt(n._a):o(n._a),this._isDSTShifted=this.isValid()&&uu(n._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted)}function ws(){return!this._isUTC}function bs(){return this._isUTC}function rf(){return this._isUTC&&0===this._offset}function tt(n,t){var u,f,e,i=n,r=null;return fr(n)?i={ms:n._milliseconds,d:n._days,M:n._months}:"number"==typeof n?(i={},t?i[t]=n:i.milliseconds=n):(r=ee.exec(n))?(u="-"===r[1]?-1:1,i={y:0,d:s(r[k])*u,h:s(r[a])*u,m:s(r[lt])*u,s:s(r[at])*u,ms:s(r[vt])*u}):(r=oe.exec(n))?(u="-"===r[1]?-1:1,i={y:st(r[2],u),M:st(r[3],u),d:st(r[4],u),h:st(r[5],u),m:st(r[6],u),s:st(r[7],u),w:st(r[8],u)}):null==i?i={}:"object"==typeof i&&("from"in i||"to"in i)&&(e=ks(o(i.from),o(i.to)),i={},i.ms=e.milliseconds,i.M=e.months),f=new si(i),fr(n)&&ft(n,"_locale")&&(f._locale=n._locale),f}function st(n,t){var i=n&&parseFloat(n.replace(",","."));return(isNaN(i)?0:i)*t}function uf(n,t){var i={milliseconds:0,months:0};return i.months=t.month()-n.month()+12*(t.year()-n.year()),n.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+n.clone().add(i.months,"M"),i}function ks(n,t){var i;return t=or(t,n),n.isBefore(t)?i=uf(n,t):(i=uf(t,n),i.milliseconds=-i.milliseconds,i.months=-i.months),i}function ff(n,t){return function(i,r){var u,f;return null===r||isNaN(+r)||(so(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),f=i,i=r,r=f),i="string"==typeof i?+i:i,u=tt(i,r),ef(this,u,n),this}}function ef(n,t,r,u){var o=t._milliseconds,f=t._days,e=t._months;u=null==u?!0:u;o&&n._d.setTime(+n._d+o*r);f&&cu(n,"Date",oi(n,"Date")+f*r);e&&vu(n,oi(n,"Month")+e*r);u&&i.updateOffset(n,f||e)}function ds(n,t){var r=n||o(),f=or(r,this).startOf("day"),i=this.diff(f,"days",!0),u=-6>i?"sameElse":-1>i?"lastWeek":0>i?"lastDay":1>i?"sameDay":2>i?"nextDay":7>i?"nextWeek":"sameElse";return this.format(t&&t[u]||this.localeData().calendar(u,this,o(r)))}function gs(){return new dt(this)}function nh(n,t){var i;return t=p("undefined"!=typeof t?t:"millisecond"),"millisecond"===t?(n=nt(n)?n:o(n),+this>+n):(i=nt(n)?+n:+o(n),i<+this.clone().startOf(t))}function th(n,t){var i;return t=p("undefined"!=typeof t?t:"millisecond"),"millisecond"===t?(n=nt(n)?n:o(n),+n>+this):(i=nt(n)?+n:+o(n),+this.clone().endOf(t)<i)}function ih(n,t,i){return this.isAfter(n,i)&&this.isBefore(t,i)}function rh(n,t){var i;return t=p(t||"millisecond"),"millisecond"===t?(n=nt(n)?n:o(n),+this==+n):(i=+o(n),+this.clone().startOf(t)<=i&&i<=+this.clone().endOf(t))}function uh(n,t,i){var r,u,f=or(n,this),e=6e4*(f.utcOffset()-this.utcOffset());return t=p(t),"year"===t||"month"===t||"quarter"===t?(u=fh(this,f),"quarter"===t?u/=3:"year"===t&&(u/=12)):(r=this-f,u="second"===t?r/1e3:"minute"===t?r/6e4:"hour"===t?r/36e5:"day"===t?(r-e)/864e5:"week"===t?(r-e)/6048e5:r),i?u:v(u)}function fh(n,t){var r,f,u=12*(t.year()-n.year())+(t.month()-n.month()),i=n.clone().add(u,"months");return 0>t-i?(r=n.clone().add(u-1,"months"),f=(t-i)/(i-r)):(r=n.clone().add(u+1,"months"),f=(t-i)/(r-i)),-(u+f)}function eh(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function of(){var n=this.clone().utc();return 0<n.year()&&n.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():gi(n,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):gi(n,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function oh(n){var t=gi(this,n||i.defaultFormat);return this.localeData().postformat(t)}function sh(n,t){return this.isValid()?tt({to:this,from:n}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function hh(n){return this.from(o(),n)}function ch(n,t){return this.isValid()?tt({from:this,to:n}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function lh(n){return this.to(o(),n)}function sf(n){var t;return void 0===n?this._locale._abbr:(t=et(n),null!=t&&(this._locale=t),this)}function hf(){return this._locale}function ah(n){switch(n=p(n)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===n&&this.weekday(0),"isoWeek"===n&&this.isoWeekday(1),"quarter"===n&&this.month(3*Math.floor(this.month()/3)),this}function vh(n){return n=p(n),void 0===n||"millisecond"===n?this:this.startOf(n).add(1,"isoWeek"===n?"week":n).subtract(1,"ms")}function yh(){return+this._d-6e4*(this._offset||0)}function ph(){return Math.floor(+this/1e3)}function wh(){return this._offset?new Date(+this):this._d}function bh(){var n=this;return[n.year(),n.month(),n.date(),n.hour(),n.minute(),n.second(),n.millisecond()]}function kh(){var n=this;return{years:n.year(),months:n.month(),date:n.date(),hours:n.hours(),minutes:n.minutes(),seconds:n.seconds(),milliseconds:n.milliseconds()}}function dh(){return iu(this)}function gh(){return ei({},e(this))}function nc(){return e(this).overflow}function hi(n,t){r(0,[n,n.length],0,t)}function cf(n,t,i){return ot(o([n,11,31+t-i]),t,i).week}function tc(n){var t=ot(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==n?t:this.add(n-t,"y")}function ic(n){var t=ot(this,1,4).year;return null==n?t:this.add(n-t,"y")}function rc(){return cf(this.year(),1,4)}function uc(){var n=this.localeData()._week;return cf(this.year(),n.dow,n.doy)}function fc(n){return null==n?Math.ceil((this.month()+1)/3):this.month(3*(n-1)+this.month()%3)}function ec(n,t){return"string"!=typeof n?n:isNaN(n)?(n=t.weekdaysParse(n),"number"==typeof n?n:null):parseInt(n,10)}function oc(n){return this._weekdays[n.day()]}function sc(n){return this._weekdaysShort[n.day()]}function hc(n){return this._weekdaysMin[n.day()]}function cc(n){var t,i,r;for(this._weekdaysParse=this._weekdaysParse||[],t=0;7>t;t++)if(this._weekdaysParse[t]||(i=o([2e3,1]).day(t),r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[t]=new RegExp(r.replace(".",""),"i")),this._weekdaysParse[t].test(n))return t}function lc(n){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=n?(n=ec(n,this.localeData()),this.add(n-t,"d")):t}function ac(n){var t=(this.day()+7-this.localeData()._week.dow)%7;return null==n?t:this.add(n-t,"d")}function vc(n){return null==n?this.day()||7:this.day(this.day()%7?n:n-7)}function lf(n,t){r(n,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function af(n,t){return t._meridiemParse}function yc(n){return"p"===(n+"").toLowerCase().charAt(0)}function pc(n,t,i){return n>11?i?"pm":"PM":i?"am":"AM"}function wc(n,t){t[vt]=s(1e3*("0."+n))}function bc(){return this._isUTC?"UTC":""}function kc(){return this._isUTC?"Coordinated Universal Time":""}function dc(n){return o(1e3*n)}function gc(){return o.apply(null,arguments).parseZone()}function nl(n,t,i){var r=this._calendar[n];return"function"==typeof r?r.call(t,i):r}function tl(n){var t=this._longDateFormat[n],i=this._longDateFormat[n.toUpperCase()];return t||!i?t:(this._longDateFormat[n]=i.replace(/MMMM|MM|DD|dddd/g,function(n){return n.slice(1)}),this._longDateFormat[n])}function il(){return this._invalidDate}function rl(n){return this._ordinal.replace("%d",n)}function vf(n){return n}function ul(n,t,i,r){var u=this._relativeTime[i];return"function"==typeof u?u(n,t,i,r):u.replace(/%d/i,n)}function fl(n,t){var i=this._relativeTime[n>0?"future":"past"];return"function"==typeof i?i(t):i.replace(/%s/i,t)}function el(n){var t;for(var i in n)t=n[i],"function"==typeof t?this[i]=t:this["_"+i]=t;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function yf(n,t,i,r){var u=et(),f=kt().set(r,t);return u[i](f,n)}function ti(n,t,i,r,u){if("number"==typeof n&&(t=n,n=void 0),n=n||"",null!=t)return yf(n,t,i,u);for(var e=[],f=0;r>f;f++)e[f]=yf(n,f,i,u);return e}function ol(n,t){return ti(n,t,"months",12,"month")}function sl(n,t){return ti(n,t,"monthsShort",12,"month")}function hl(n,t){return ti(n,t,"weekdays",7,"day")}function cl(n,t){return ti(n,t,"weekdaysShort",7,"day")}function ll(n,t){return ti(n,t,"weekdaysMin",7,"day")}function al(){var n=this._data;return this._milliseconds=g(this._milliseconds),this._days=g(this._days),this._months=g(this._months),n.milliseconds=g(n.milliseconds),n.seconds=g(n.seconds),n.minutes=g(n.minutes),n.hours=g(n.hours),n.months=g(n.months),n.years=g(n.years),this}function pf(n,t,i,r){var u=tt(t,i);return n._milliseconds+=r*u._milliseconds,n._days+=r*u._days,n._months+=r*u._months,n._bubble()}function vl(n,t){return pf(this,n,t,1)}function yl(n,t){return pf(this,n,t,-1)}function wf(n){return 0>n?Math.floor(n):Math.ceil(n)}function pl(){var u,f,e,s,o,r=this._milliseconds,n=this._days,t=this._months,i=this._data;return r>=0&&n>=0&&t>=0||0>=r&&0>=n&&0>=t||(r+=864e5*wf(hr(t)+n),n=0,t=0),i.milliseconds=r%1e3,u=v(r/1e3),i.seconds=u%60,f=v(u/60),i.minutes=f%60,e=v(f/60),i.hours=e%24,n+=v(e/24),o=v(bf(n)),t+=o,n-=wf(hr(o)),s=v(t/12),t%=12,i.days=n,i.months=t,i.years=s,this}function bf(n){return 4800*n/146097}function hr(n){return 146097*n/4800}function wl(n){var t,r,i=this._milliseconds;if(n=p(n),"month"===n||"year"===n)return t=this._days+i/864e5,r=this._months+bf(t),"month"===n?r:r/12;switch(t=this._days+Math.round(hr(this._months)),n){case"week":return t/7+i/6048e5;case"day":return t+i/864e5;case"hour":return 24*t+i/36e5;case"minute":return 1440*t+i/6e4;case"second":return 86400*t+i/1e3;case"millisecond":return Math.floor(864e5*t)+i;default:throw new Error("Unknown unit "+n);}}function bl(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*s(this._months/12)}function it(n){return function(){return this.as(n)}}function kl(n){return n=p(n),this[n+"s"]()}function ht(n){return function(){return this._data[n]}}function dl(){return v(this.days()/7)}function gl(n,t,i,r,u){return u.relativeTime(t||1,!!i,n,r)}function na(n,t,i){var r=tt(n).abs(),h=bt(r.as("s")),f=bt(r.as("m")),e=bt(r.as("h")),o=bt(r.as("d")),s=bt(r.as("M")),c=bt(r.as("y")),u=h<ut.s&&["s",h]||1===f&&["m"]||f<ut.m&&["mm",f]||1===e&&["h"]||e<ut.h&&["hh",e]||1===o&&["d"]||o<ut.d&&["dd",o]||1===s&&["M"]||s<ut.M&&["MM",s]||1===c&&["y"]||["yy",c];return u[2]=t,u[3]=+n>0,u[4]=i,gl.apply(null,u)}function ta(n,t){return void 0===ut[n]?!1:void 0===t?ut[n]:(ut[n]=t,!0)}function ia(n){var t=this.localeData(),i=na(this,!n,t);return n&&(i=t.pastFuture(+this,i)),t.postformat(i)}function ci(){var n,e,o,t=tu(this._milliseconds)/1e3,a=tu(this._days),i=tu(this._months);n=v(t/60);e=v(n/60);t%=60;n%=60;o=v(i/12);i%=12;var s=o,h=i,c=a,r=e,u=n,f=t,l=this.asSeconds();return l?(0>l?"-":"")+"P"+(s?s+"Y":"")+(h?h+"M":"")+(c?c+"D":"")+(r||u||f?"T":"")+(r?r+"H":"")+(u?u+"M":"")+(f?f+"S":""):"P0D"}var kf,li,cr=i.momentProperties=[],lr=!1,ct={},ii={},df=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ai=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ar={},wt={},gf=/\d/,y=/\d\d/,ne=/\d{3}/,vr=/\d{4}/,vi=/[+-]?\d{6}/,h=/\d\d?/,yi=/\d{1,3}/,yr=/\d{1,4}/,pi=/[+-]?\d{1,6}/,wi=/[+-]?\d+/,bi=/Z|[+-]\d\d:?\d\d/gi,ri=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,pr={},wr={},b=0,d=1,k=2,a=3,lt=4,at=5,vt=6,dr,ie,re,ue,fe,ee,oe,se,he,gr,nu,ce,le,ae,ve,rt,ye,n;r("M",["MM",2],"Mo",function(){return this.month()+1});r("MMM",0,0,function(n){return this.localeData().monthsShort(this,n)});r("MMMM",0,0,function(n){return this.localeData().months(this,n)});l("month","M");t("M",h);t("MM",h,y);t("MMM",ri);t("MMMM",ri);c(["M","MM"],function(n,t){t[d]=s(n)-1});c(["MMM","MMMM"],function(n,t,i,r){var u=i._locale.monthsParse(n,r,i._strict);null!=u?t[d]=u:e(i).invalidMonth=n});var ra="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ua="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),te={};i.suppressDeprecationWarnings=!1;var fa=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,br=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],kr=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],ea=/^\/?Date\((\-?\d+)/i;i.createFromInputFallback=w("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(n){n._d=new Date(n._i+(n._useUTC?" UTC":""))});r(0,["YY",2],0,function(){return this.year()%100});r(0,["YYYY",4],0,"year");r(0,["YYYYY",5],0,"year");r(0,["YYYYYY",6,!0],0,"year");l("year","y");t("Y",wi);t("YY",h,y);t("YYYY",yr,vr);t("YYYYY",pi,vi);t("YYYYYY",pi,vi);c(["YYYYY","YYYYYY"],b);c("YYYY",function(n,t){t[b]=2===n.length?i.parseTwoDigitYear(n):s(n)});c("YY",function(n,t){t[b]=i.parseTwoDigitYear(n)});i.parseTwoDigitYear=function(n){return s(n)+(s(n)>68?1900:2e3)};dr=yt("FullYear",!1);r("w",["ww",2],"wo","week");r("W",["WW",2],"Wo","isoWeek");l("week","w");l("isoWeek","W");t("w",h);t("ww",h,y);t("W",h);t("WW",h,y);ni(["w","ww","W","WW"],function(n,t,i,r){t[r.substr(0,1)]=s(n)});ie={dow:0,doy:6};r("DDD",["DDDD",3],"DDDo","dayOfYear");l("dayOfYear","DDD");t("DDD",yi);t("DDDD",ne);c(["DDD","DDDD"],function(n,t,i){i._dayOfYear=s(n)});i.ISO_8601=function(){};re=w("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var n=o.apply(null,arguments);return this>n?this:n});ue=w("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var n=o.apply(null,arguments);return n>this?this:n});tf("Z",":");tf("ZZ","");t("Z",bi);t("ZZ",bi);c(["Z","ZZ"],function(n,t,i){i._useUTC=!0;i._tzm=er(n)});fe=/([\+\-]|\d\d)/gi;i.updateOffset=function(){};ee=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;oe=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;tt.fn=si.prototype;se=ff(1,"add");he=ff(-1,"subtract");i.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";gr=w("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(n){return void 0===n?this.localeData():this.locale(n)});r(0,["gg",2],0,function(){return this.weekYear()%100});r(0,["GG",2],0,function(){return this.isoWeekYear()%100});hi("gggg","weekYear");hi("ggggg","weekYear");hi("GGGG","isoWeekYear");hi("GGGGG","isoWeekYear");l("weekYear","gg");l("isoWeekYear","GG");t("G",wi);t("g",wi);t("GG",h,y);t("gg",h,y);t("GGGG",yr,vr);t("gggg",yr,vr);t("GGGGG",pi,vi);t("ggggg",pi,vi);ni(["gggg","ggggg","GGGG","GGGGG"],function(n,t,i,r){t[r.substr(0,2)]=s(n)});ni(["gg","GG"],function(n,t,r,u){t[u]=i.parseTwoDigitYear(n)});r("Q",0,0,"quarter");l("quarter","Q");t("Q",gf);c("Q",function(n,t){t[d]=3*(s(n)-1)});r("D",["DD",2],"Do","date");l("date","D");t("D",h);t("DD",h,y);t("Do",function(n,t){return n?t._ordinalParse:t._ordinalParseLenient});c(["D","DD"],k);c("Do",function(n,t){t[k]=s(n.match(h)[0],10)});nu=yt("Date",!0);r("d",0,"do","day");r("dd",0,0,function(n){return this.localeData().weekdaysMin(this,n)});r("ddd",0,0,function(n){return this.localeData().weekdaysShort(this,n)});r("dddd",0,0,function(n){return this.localeData().weekdays(this,n)});r("e",0,0,"weekday");r("E",0,0,"isoWeekday");l("day","d");l("weekday","e");l("isoWeekday","E");t("d",h);t("e",h);t("E",h);t("dd",ri);t("ddd",ri);t("dddd",ri);ni(["dd","ddd","dddd"],function(n,t,i){var r=i._locale.weekdaysParse(n);null!=r?t.d=r:e(i).invalidWeekday=n});ni(["d","e","E"],function(n,t,i,r){t[r]=s(n)});var oa="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),sa="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ha="Su_Mo_Tu_We_Th_Fr_Sa".split("_");for(r("H",["HH",2],0,"hour"),r("h",["hh",2],0,function(){return this.hours()%12||12}),lf("a",!0),lf("A",!1),l("hour","h"),t("a",af),t("A",af),t("H",h),t("h",h),t("HH",h,y),t("hh",h,y),c(["H","HH"],a),c(["a","A"],function(n,t,i){i._isPm=i._locale.isPM(n);i._meridiem=n}),c(["h","hh"],function(n,t,i){t[a]=s(n);e(i).bigHour=!0}),ce=/[ap]\.?m?\.?/i,le=yt("Hours",!0),r("m",["mm",2],0,"minute"),l("minute","m"),t("m",h),t("mm",h,y),c(["m","mm"],lt),ae=yt("Minutes",!1),r("s",["ss",2],0,"second"),l("second","s"),t("s",h),t("ss",h,y),c(["s","ss"],at),ve=yt("Seconds",!1),r("S",0,0,function(){return~~(this.millisecond()/100)}),r(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),r(0,["SSS",3],0,"millisecond"),r(0,["SSSS",4],0,function(){return 10*this.millisecond()}),r(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),r(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),r(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),r(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),r(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),l("millisecond","ms"),t("S",yi,gf),t("SS",yi,y),t("SSS",yi,ne),rt="SSSS";rt.length<=9;rt+="S")t(rt,/\d+/);for(rt="S";rt.length<=9;rt+="S")c(rt,wc);ye=yt("Milliseconds",!1);r("z",0,0,"zoneAbbr");r("zz",0,0,"zoneName");n=dt.prototype;n.add=se;n.calendar=ds;n.clone=gs;n.diff=uh;n.endOf=vh;n.format=oh;n.from=sh;n.fromNow=hh;n.to=ch;n.toNow=lh;n.get=lu;n.invalidAt=nc;n.isAfter=nh;n.isBefore=th;n.isBetween=ih;n.isSame=rh;n.isValid=dh;n.lang=gr;n.locale=sf;n.localeData=hf;n.max=ue;n.min=re;n.parsingFlags=gh;n.set=lu;n.startOf=ah;n.subtract=he;n.toArray=bh;n.toObject=kh;n.toDate=wh;n.toISOString=of;n.toJSON=of;n.toString=eh;n.unix=ph;n.valueOf=yh;n.year=dr;n.isLeapYear=lo;n.weekYear=tc;n.isoWeekYear=ic;n.quarter=n.quarters=fc;n.month=yu;n.daysInMonth=oo;n.week=n.weeks=po;n.isoWeek=n.isoWeeks=wo;n.weeksInYear=uc;n.isoWeeksInYear=rc;n.date=nu;n.day=n.days=lc;n.weekday=ac;n.isoWeekday=vc;n.dayOfYear=ko;n.hour=n.hours=le;n.minute=n.minutes=ae;n.second=n.seconds=ve;n.millisecond=n.milliseconds=ye;n.utcOffset=ss;n.utc=cs;n.local=ls;n.parseZone=as;n.hasAlignedHourOffset=vs;n.isDST=ys;n.isDSTShifted=ps;n.isLocal=ws;n.isUtcOffset=bs;n.isUtc=rf;n.isUTC=rf;n.zoneAbbr=bc;n.zoneName=kc;n.dates=w("dates accessor is deprecated. Use date instead.",nu);n.months=w("months accessor is deprecated. Use month instead",yu);n.years=w("years accessor is deprecated. Use year instead",dr);n.zone=w("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",hs);var ca=n,u=fu.prototype;u._calendar={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};u.calendar=nl;u._longDateFormat={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};u.longDateFormat=tl;u._invalidDate="Invalid date";u.invalidDate=il;u._ordinal="%d";u.ordinal=rl;u._ordinalParse=/\d{1,2}/;u.preparse=vf;u.postformat=vf;u._relativeTime={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};u.relativeTime=ul;u.pastFuture=fl;u.set=el;u.months=uo;u._months=ra;u.monthsShort=fo;u._monthsShort=ua;u.monthsParse=eo;u.week=ao;u._week=ie;u.firstDayOfYear=yo;u.firstDayOfWeek=vo;u.weekdays=oc;u._weekdays=oa;u.weekdaysMin=hc;u._weekdaysMin=ha;u.weekdaysShort=sc;u._weekdaysShort=sa;u.weekdaysParse=cc;u.isPM=yc;u._meridiemParse=ce;u.meridiem=pc;gt("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(n){var t=n%10,i=1===s(n%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return n+i}});i.lang=w("moment.lang is deprecated. Use moment.locale instead.",gt);i.langData=w("moment.langData is deprecated. Use moment.localeData instead.",et);var g=Math.abs,la=it("ms"),aa=it("s"),va=it("m"),ya=it("h"),pa=it("d"),wa=it("w"),ba=it("M"),ka=it("y"),da=ht("milliseconds"),ga=ht("seconds"),nv=ht("minutes"),tv=ht("hours"),iv=ht("days"),rv=ht("months"),uv=ht("years"),bt=Math.round,ut={s:45,m:45,h:22,d:26,M:11},tu=Math.abs,f=si.prototype;return f.abs=al,f.add=vl,f.subtract=yl,f.as=wl,f.asMilliseconds=la,f.asSeconds=aa,f.asMinutes=va,f.asHours=ya,f.asDays=pa,f.asWeeks=wa,f.asMonths=ba,f.asYears=ka,f.valueOf=bl,f._bubble=pl,f.get=kl,f.milliseconds=da,f.seconds=ga,f.minutes=nv,f.hours=tv,f.days=iv,f.weeks=dl,f.months=rv,f.years=uv,f.humanize=ia,f.toISOString=ci,f.toString=ci,f.toJSON=ci,f.locale=sf,f.localeData=hf,f.toIsoString=w("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ci),f.lang=gr,r("X",0,0,"unix"),r("x",0,0,"valueOf"),t("x",wi),t("X",/[+-]?\d+(\.\d{1,3})?/),c("X",function(n,t,i){i._d=new Date(1e3*parseFloat(n,10))}),c("x",function(n,t,i){i._d=new Date(s(n))}),i.version="2.10.6",pe(o),i.fn=ca,i.min=es,i.max=os,i.utc=kt,i.unix=dc,i.months=ol,i.isDate=fi,i.locale=gt,i.invalid=ru,i.duration=tt,i.isMoment=nt,i.weekdays=hl,i.parseZone=gc,i.localeData=et,i.isDuration=fr,i.monthsShort=sl,i.weekdaysMin=ll,i.defineLocale=su,i.weekdaysShort=cl,i.normalizeUnits=p,i.relativeTimeThreshold=ta,i});__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(){function n(n,t,i,r){var u=this,f,e;this.closeInfoBox=function(){$("#infoBox").css("visibility","hidden")};this.getDetailURL=function(n){var t="";return u.dataStatus.isCurrent||(t="?From="+moment(new Date(u.dataStatus.timeEnd)).format("l LTS")),t+=t.length>0?"&":"?",t+="span="+(typeof u.dataStatus.timeSpan=="undefined"?"2 days":u.dataStatus.timeSpan),n.RegionId!=null&&n.RegionId!=""&&(t+="&r="+n.RegionId),t+="&v="+u.dataStatus.visualization,u.appPath+"GageDetail/Index/"+n.SiteId+t};this.showInfoBox=function(n){u.$infoBox.html(n);u.$infoBox.css("visibility","visible")};this.repositionInfoBox=function(n,t,i){var f=document.getElementById("mapDiv").offsetWidth,r=u.map.tryLocationToPixel(i,Microsoft.Maps.PixelReference.control),e=u.$infoBox.width()+n;r.x+e>f?u.$infoBox.css("left",f-e):u.$infoBox.css("left",r.x+n);u.$infoBox.css("top",r.y-(u.$infoBox.height()+t))};this.generatePin=function(n,t,i,r){var f=new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(i,r),n),e,o,s;return $.extend(f,t),f.metadata=t,u.hasTouchEvents&&(e=Rx.Observable.fromEventPattern(function(n){return Microsoft.Maps.Events.addHandler(f,"click",n)},function(){Microsoft.Maps.Events.removeHandler(arguments[1])}),e.subscribe(u.siteMouseovers)),o=Rx.Observable.fromEventPattern(function(n){return Microsoft.Maps.Events.addHandler(f,"mouseover",n)},function(){Microsoft.Maps.Events.removeHandler(arguments[1])}),s=Rx.Observable.fromEventPattern(function(n){return Microsoft.Maps.Events.addHandler(f,"mouseout",n)},function(){Microsoft.Maps.Events.removeHandler(arguments[1])}),o.subscribe(u.siteMouseovers),s.subscribe(u.siteMouseouts),f};this.moveInfoBox=function(n){u.repositionInfoBox(u.infoBoxOffsetX,u.infoBoxOffsetY,n.getLocation())};this.displayEventInfo=function(){};this.map=r.map;this.primaryLayer=n;this.alternateLayer=t;this.appPath=r.appPath;this.hasTouchEvents=r.hasTouchEvents;this.siteMouseovers=new Rx.Subject;this.siteMouseouts=new Rx.Subject;this.siteMouseclicks=new Rx.Subject;this.pushPinMouseClickEvents=this.siteMouseclicks.filter(function(n){return n.targetType=="pushpin"}).map(function(n){return{site:n.target,element:n.target}});this.pushPinMouseOverEvents=this.siteMouseovers.filter(function(n){return n.targetType=="pushpin"}).map(function(n){return{site:n.target,element:n.target}});this.hasTouchEvents&&(f=Rx.Observable.fromEventPattern(function(n){Microsoft.Maps.Events.addHandler(r.map,"click",n)},function(){Microsoft.Maps.Events.removeHandler(arguments[1])}),f.subscribe(this.siteMouseouts));e=this;e.$infoBox=$("#infoBox");i&&(this.onStatusChange=i,this.onStatusChange.add(function(n){u.dataStatus=n}))}return n.prototype.launchDetailPage=function(n){window.open(this.getDetailURL(n))},n}(),u=function(n){function t(t,i,r,u){var f=n.call(this,t,i,r,u)||this;return f.displayEventInfo=function(n){var r=n.AllowSubscription==!0?"More information & alert signup":"More information",t='<br /><a href="'+f.getDetailURL(n)+'" target="_blank">'+r+"<\/a>",i;i=n.Description&&n.Description.length>0?"Site "+n.SiteId+": "+n.Location+"<br />"+n.Description+t:"Site "+n.SiteId+": "+n.Location+t;f.showInfoBox(i)},f.infoBoxOffsetX=3,f.infoBoxOffsetY=25,f}return __extends(t,n),t.prototype.renderSite=function(n,t){var o=this.appPath+"GenerateGraphic/PushPinTransparent",r=n.RainfallText.length>0?n.RainfallText:n.Rainfall.toFixed(2),f={icon:null,anchor:new Microsoft.Maps.Point(23,13)},e={icon:null,anchor:new Microsoft.Maps.Point(18,9)},u={"default":{boxColor:"#fdfdfd",borderColor:"#f02929",borderWidth:"1",textColor:"#083b83",textShadow:"#000"},noRain:{boxColor:"#fdfdfd",borderColor:"#f02929",borderWidth:"0",textColor:"#547AA8",textShadow:"#000"},mostRain:{boxColor:"#AD1F1F",borderColor:"#3D6FB5",borderWidth:"2",textColor:"#fff",textShadow:"#000"}},i=u.default;getParameterByName("analysis")&&u[t]&&(i=u[t]);f.icon='<svg xmlns="http://www.w3.org/2000/svg" width="50" height="28">\n                                <g>\n                                <rect style="fill:#000;" fill-opacity="0.3"  x="3" y="3" width="45" height="22" rx="3" ry="3" />\n                                <rect style="fill: '+i.boxColor+'" stroke="'+i.borderColor+'" stroke-width="'+i.borderWidth+'" x="0.5" y="0.5" width="45" height="22" rx="3" ry="3" />\n                                <text style="font-size: 15px; font-family: Arial, Helvetica, sans-serif; text-anchor: middle;" fill="'+i.textShadow+'" fill-opacity="0.18" x="24" y="16" dy="0.1em">'+r+'<\/text>\n                                <text style="font-size: 15px; font-family: Arial, Helvetica, sans-serif; text-anchor: middle;" fill="'+i.textColor+'" x="23" y="15" dy="0.1em">'+r+"<\/text>\n                          <\/g>\n                          <\/svg>";e.icon='<svg xmlns="http://www.w3.org/2000/svg" width="40" height="23">\n                                <g>\n                                <rect style="fill:#000;" fill-opacity="0.3"  x="3" y="3" width="36" height="17" rx="3" ry="3" />\n                                <rect style="fill:'+i.boxColor+'" stroke="'+i.borderColor+'" stroke-width="'+i.borderWidth+'" x="0.5" y="0.5" width="36" height="17" rx="3" ry="3" />\n                                <text style="font-size: 12px; font-family: Arial, Helvetica, sans-serif; text-anchor: middle;" fill="'+i.textShadow+'" fill-opacity="0.18" x="19" y="13" dy="0.1em">'+r+'<\/text>\n                                <text style="font-size: 12px; font-family: Arial, Helvetica, sans-serif; text-anchor: middle;" fill="'+i.textColor+'" x="18" y="12" dy="0.1em">'+r+"<\/text>\n                          <\/g>\n                          <\/svg>";this.primaryLayer.add(this.generatePin(f,n,n.Latitude,n.Longitude));this.alternateLayer.add(this.generatePin(e,n,n.AltLat,n.AltLong))},t.prototype.sortSite=function(n,t){return t.Rainfall-n.Rainfall},t.prototype.createQuantiles=function(){},t.prototype.viewModelMap=function(n){return n},t.prototype.modelFilter=function(n){return n.Rainfall!=null&&n.RainfallText!=null},t}(t),r,i;n.RainLayerGenerator=u;r=function(t){function i(n,i,r,u){var f=t.call(this,n,i,r,u)||this;return f.displayEventInfo=function(n,t){var u=$(t.getIcon()),e,i,r,o,s;u.attr("data-sensorid")&&(e=parseInt(u.attr("data-sensorid")),i=n.StreamData.filter(function(n){return n.SensorId==e}).pop(),f.crossSection.selectAll("a.infobox-more-information").attr("href",f.getDetailURL(n)),r="",i.HasChannelData?(f.crossSection.select(".infobox-graphicContainer").style("display","block"),channelGraphics.CrossSection.render(f.crossSection.select(".infobox-graphicContainer"),i,{width:125,height:50,showLabels:!1}),o=i.SiteType=="Dam"||i.SiteType=="Spillway"?"Spillway":"Bank",s=i.LevelFromTob<0?Math.abs(i.LevelFromTob)+" feet below":i.LevelFromTob+" feet over",r="<br />Water level is "+s+" Top of "+o):f.crossSection.select(".infobox-graphicContainer").style("display","none"),f.crossSection.select(".infobox-site-information").html("Site "+n.SiteId+": Sensor "+i.SensorId+": "+n.Location+" "+r),n.Description&&f.crossSection.select(".infobox-site-description").html("<br />"+n.Description),f.showInfoBox(f.crossSection.html()))},f.infoBoxOffsetX=5,f.infoBoxOffsetY=22,f.crossSection=d3.select(document.createElement("div")),f.crossSection.html(d3.select("#crossSectionTemplateInfoBox").html()),f}return __extends(i,t),i.generateGraphic=function(n,t){var r={SensorId:1,TOB:10,BOC:0,FloodWarningLevel:7,CurrentLevel:t||5};return n=="siteError"?r.CurrentLevel=10:n=="siteWarning"&&(r.CurrentLevel=8),i.generatePushpinOptions(r).icon},i.generatePushpinOptions=function(n,t){var r=7,i=23,u=2,f=t||1,o=document.createElement("div"),h=d3.select(o),s=d3.scale.linear().domain([n.BOC,n.TOB]).range([i,1]).clamp(!0),c=d3.scale.linear().domain([n.BOC,n.FloodWarningLevel-.001,n.FloodWarningLevel,n.TOB-.001,n.TOB]).range(["#5A8BCE","#3D6FB5","orange","orange","red"]),l=d3.scale.linear().domain([n.BOC,(n.BOC+n.FloodWarningLevel)/2]).range(["#F5F5F0","#fff"]),e=h.append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",Math.ceil(r*f)+u).attr("height",Math.ceil(i*f)+u).attr("viewBox","0 0 "+(r+u)+" "+(i+u)+" ").attr("data-sensorid",n.SensorId.toString());return e.append("rect").attr("width",r).attr("height",i).attr("fill","#000").attr("fill-opacity","0.3").attr("x",3).attr("y",3),e.append("rect").attr("width",r).attr("height",i).attr("fill",l(n.CurrentLevel)).attr("stroke","#222"),e.append("rect").attr("x",.5).attr("width",r-1).attr("y",s(n.CurrentLevel)-.5).attr("height",i-s(n.CurrentLevel)).attr("fill",c(n.CurrentLevel)),{icon:o.innerHTML,width:Math.round(r*f),height:Math.round(i*f)}},i.prototype.renderSite=function(t){t.StreamData.sort(i.sortSensor).forEach(function(r){var u={};if(r.FloodCategory=="noFloodCategory")u.icon=n.SurfaceBoxLayerGenerator.generateGraphic(r.FloodCategory).innerHTML,u.anchor=new Microsoft.Maps.Point(8,8);else{var e=d3.scale.linear().domain([r.BOC,r.TOB]).range([1,1.5]).clamp(!0),o=e(r.CurrentLevel),f=i.generatePushpinOptions(r,o);u.icon=f.icon;u.anchor=new Microsoft.Maps.Point(f.width,f.height)}this.primaryLayer.add(this.generatePin(u,t,t.Position.Latitude,t.Position.Longitude));this.alternateLayer.add(this.generatePin(u,t,t.AltPosition.Latitude,t.AltPosition.Longitude))},this)},i.prototype.sortSite=function(n,t){return i.sortSensor(n.MostAlarmingSensor,t.MostAlarmingSensor)},i.sortSensor=function(n,t){return t.Rank==n.Rank?t.LevelFromTob-n.LevelFromTob:t.Rank-n.Rank},i.prototype.createQuantiles=function(){},i.prototype.viewModelMap=function(n){var i=n.StreamData.map(function(t){var r="noFloodCategory",u=10,i=t.ChannelInfo,f=i.FloodLevelIndicator,e=i.TOB!=null&&i.BOC!=null,o=!i.NoFloodCategory&&e;return o&&(t.CurrentLevel>=i.TOB?(r="siteError",u=400):t.CurrentLevel>=f?(r="siteWarning",u=300):(r="siteNormal",u=200)),{CurrentLevel:t.CurrentLevel,CurrentReadingDate:t.CurrentReadingDate,SensorId:i.SensorId,TOB:i.TOB,BOC:i.BOC,ChannelHeight:i.TOB-i.BOC,WaterHeight:t.CurrentLevel-i.BOC,FloodWarningLevel:f,FloodCategory:r,Rank:u,LevelFromTob:(t.CurrentLevel-i.TOB).toFixed(2),HasChannelData:e,CanDisplayStatus:o,SiteType:n.SiteType}}),t=i[0];return i.forEach(function(n){n.Rank>=t.Rank&&n.LevelFromTob>t.LevelFromTob&&(t=n)}),{SiteId:n.SiteId,Location:n.Location,LocationText:n.LocationText,Position:{Latitude:n.Latitude,Longitude:n.Longitude},AltPosition:{Latitude:n.AltLat,Longitude:n.AltLong},Description:n.Description&&n.Description.length>0?n.Description:null,StreamData:i,MostAlarmingSensor:t}},i.prototype.modelFilter=function(n){return n.StreamData!=null},i}(t);n.SurfaceLayerGenerator=r;i=function(n){function t(t,i,r,u){var f=n.call(this,t,i,r,u)||this;return f.minBufferBetweenIcons=4,f.displayEventInfo=function(n){f.crossSection.selectAll("a.infobox-more-information").attr("href",f.getDetailURL(n));var i="",r=n.StreamData.filter(function(n){return n}),t;t=r.length>1?n.StreamData.sort(function(n,t){return t.Position>n.Position?-1:1}).filter(function(n){return n.HasChannelData}):n.StreamData.filter(function(n){return n.HasChannelData});t.length?(f.crossSection.select(".infobox-graphicContainer").style("display","block"),channelGraphics.CrossSection.render(f.crossSection.select(".infobox-graphicContainer"),t,{width:125,height:50,showLabels:!1},n.OrSiteId),i=t.map(function(){}).join("")):f.crossSection.select(".infobox-graphicContainer").style("display","none");f.crossSection.select(".infobox-site-information").html("Site "+n.SiteId+": "+n.Location+" "+i);n.Description?f.crossSection.select(".infobox-site-description").html("<br />"+n.Description):f.crossSection.select(".infobox-site-description").html("");f.showInfoBox(f.crossSection.html())},f.infoBoxOffsetX=-3,f.infoBoxOffsetY=19,f.crossSection=d3.select(document.createElement("div")),f.crossSection.html(d3.select("#crossSectionTemplateInfoBox").html()),f}return __extends(t,n),t.generateGraphic=function(n){var r=document.createElement("div"),i=t.iconInfo[n]||t.iconInfo.noFloodCategory,u=d3.select(r).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("preserveAspectRatio","xMinYMin meet").attr("viewBox","0 0 "+i.width+" "+i.height).attr("width",i.width).attr("height",i.height);return u.append(function(){return t.getSensorIcon(n)}),r},t.prototype.renderSite=function(n){var o=this,f=document.createElement("div"),e=d3.select(f).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("preserveAspectRatio","xMinYMin meet"),h=e.selectAll("g").data(n.StreamData).enter().append(function(n){return getParameterByName("analysis")&&n.CurrentGageTrend!=null?t.getSensorIconForGageTrend(n.FloodCategory,n.CurrentGageTrend.toFixed(2)):t.getSensorIcon(n.FloodCategory)}).attr("transform",function(n,t){return"translate("+t*(17+o.minBufferBetweenIcons)+",0)"}),s=n.StreamData.map(function(n){return t.iconInfo[n.FloodCategory]||t.iconInfo.noFloodCategory}),i=s.reduce(function(n,t,i){return n+17+i*o.minBufferBetweenIcons},0),r=s.reduce(function(n,t){return Math.max(n,t.height)},0),u;e.attr("viewBox","0 0 "+i+" "+r).attr("width",i*1).attr("height",r*1).append("defs").append("marker").attr("id","arrow").attr("markerWidth",6).attr("markerHeight",12).attr("viewBox","0 0 9 12").attr("refX",6).attr("refY",6).attr("orient","auto").append("path").attr("d","M2,2 L10,6 L2,10 L6,6 L2,2").attr("style","fill: black;stroke:#FFFFFF;stroke-width:0.5px");u={icon:f.innerHTML,anchor:new Microsoft.Maps.Point(i/2,r/2)};this.alternateLayer.add(this.generatePin(u,n,n.Latitude,n.Longitude));e.attr("viewBox","0 0 "+i+" "+r).attr("width",i*1.6).attr("height",r*1.6).append("defs").append("marker").attr("id","arrow").attr("markerWidth",6).attr("markerHeight",12).attr("viewBox","0 0 9 12").attr("refX",6).attr("refY",6).attr("orient","auto").append("path").attr("d","M2,2 L10,6 L2,10 L6,6 L2,2").attr("style","fill: black;stroke:#FFFFFF;stroke-width:0.5px");u={icon:f.innerHTML,anchor:new Microsoft.Maps.Point(i*1.6/2,r*1.6/2)};this.primaryLayer.add(this.generatePin(u,n,n.Latitude,n.Longitude))},t.getSensorIcon=function(n){var t=d3.select(document.createElementNS("http://www.w3.org/2000/svg","g"));switch(n){case"":case"noFloodCategory":t.append("rect").attr("x",0).attr("y",0).attr("width",14).attr("height",14).attr("stroke","#000").attr("stroke-width","1").style("fill","#ADB5FD");break;case"siteNormal":t.append("rect").attr("x",0).attr("y",0).attr("width",14).attr("height",14).attr("stroke","#000").attr("stroke-width","1").style("fill","#008000");break;case"siteWarning":t.append("path").attr("d",d3.svg.symbol().type("triangle-up").size(Math.pow(11,2))).attr("transform","translate(8,7)").style("stroke","black").style("fill","#ffff00");t.append("line").attr("x1",8).attr("y1",5).attr("x2",8).attr("y2",9).attr("stroke","#000").attr("stroke-width",2).attr("stroke-linecap","round");t.append("line").attr("x1",8).attr("y1",11).attr("x2",8).attr("y2",13).attr("stroke","#000").attr("stroke-width",2);break;case"siteError":t.append("ellipse").attr("cx",8).attr("cy",8).attr("rx",8).attr("ry",8).style("fill","#f00").style("stroke","#e50000");t.append("line").attr("x1",8).attr("y1",3).attr("x2",8).attr("y2",10).attr("stroke","#fff").attr("stroke-width",2.5);t.append("line").attr("x1",8).attr("y1",11).attr("x2",8).attr("y2",13).attr("stroke","#fff").attr("stroke-width",2.5)}return t.node()},t.getSensorIconForGageTrend=function(n,i){var r=d3.select(document.createElementNS("http://www.w3.org/2000/svg","g")),u=.06,f=-.06,e=0;getParameterByName("UpThreshold")&&(u=parseFloat(getParameterByName("UpThreshold")));getParameterByName("DownThreshold")&&(f=parseFloat(getParameterByName("DownThreshold")));switch(n){case"":case"noFloodCategory":r.append("rect").attr("x",0).attr("y",0).attr("width",14).attr("height",14).attr("stroke","#000").attr("stroke-width","1").style("fill","#ADB5FD");i>=u?t.Drawline(r,8,11,8,3,"black"):i<=f?t.Drawline(r,8,1,8,9,"black"):i==e&&t.WriteText(r,2,10,7,"----","black");break;case"siteNormal":r.append("rect").attr("x",0).attr("y",0).attr("width",14).attr("height",14).attr("stroke","#000").attr("stroke-width","1").style("fill","#008000");i>=u?t.Drawline(r,8,11,8,3,"white"):i<=f?t.Drawline(r,8,1,8,9,"white"):i==e&&t.WriteText(r,2,10,7,"----","white");break;case"siteWarning":r.append("path").attr("d",d3.svg.symbol().type("triangle-up").size(Math.pow(11,2))).attr("transform","translate(8,7)").style("stroke","black").style("fill","#ffff00");i>=u?t.Drawline(r,8,12,8,8,"black"):i<=f?t.Drawline(r,8,3,8,9,"black"):i==e?t.WriteText(r,3,12,7,"----","black"):(r.append("line").attr("x1",8).attr("y1",5).attr("x2",8).attr("y2",9).attr("stroke","#000").attr("stroke-width",2).attr("stroke-linecap","round"),r.append("line").attr("x1",8).attr("y1",11).attr("x2",8).attr("y2",13).attr("stroke","#000").attr("stroke-width",2));break;case"siteError":r.append("ellipse").attr("cx",8).attr("cy",8).attr("rx",8).attr("ry",8).style("fill","#f00").style("stroke","#e50000");i>=u?t.Drawline(r,8,12,8,3,"black"):i<=f?t.Drawline(r,8,3,8,11,"black"):i==e?t.WriteText(r,2,10,7,"----","black"):(r.append("line").attr("x1",8).attr("y1",3).attr("x2",8).attr("y2",10).attr("stroke","#fff").attr("stroke-width",2.5),r.append("line").attr("x1",8).attr("y1",11).attr("x2",8).attr("y2",13).attr("stroke","#fff").attr("stroke-width",2.5))}return r.node()},t.Drawline=function(n,t,i,r,u,f){return n.append("line").attr("x1",t).attr("y1",i).attr("x2",r).attr("y2",u).attr("stroke",f).attr("stroke-width",2).attr("marker-end","url(#arrow)"),n},t.WriteText=function(n,t,i,r,u,f){return n.append("text").attr("x",t).attr("y",i).attr("stroke",f).attr("font-size",r).text(u),n},t.prototype.sortSite=function(n,t){return t.MostAlarmingSensor.Rank==n.MostAlarmingSensor.Rank?t.MostAlarmingSensor.LevelFromTob-n.MostAlarmingSensor.LevelFromTob:t.MostAlarmingSensor.Rank-n.MostAlarmingSensor.Rank},t.prototype.createQuantiles=function(){},t.prototype.viewModelMap=function(n){var i=n.StreamData.map(function(t){var r="noFloodCategory",u=1,i=t.ChannelInfo,f=i.FloodLevelIndicator,s=i.FLLevelIndicator,e=i.TOB!=null&&i.BOC!=null,o=!i.NoFloodCategory&&e;return o&&(t.CurrentLevel>=s?(r="siteError",u=4):t.CurrentLevel>=f?(r="siteWarning",u=3):(r="siteNormal",u=2)),{CurrentLevel:t.CurrentLevel,CurrentGageTrend:t.CurrentGageTrend,CurrentReadingDate:t.CurrentReadingDate,SensorId:i.SensorId,TOB:i.TOB,BOC:i.BOC,FloodWarningLevel:f,FloodCategory:r,Rank:u,LevelFromTob:Number((t.CurrentLevel-i.TOB).toFixed(2)),HasChannelData:e,CanDisplayStatus:o,SiteType:n.SiteType,Position:i.Position}}),t=i[0];return i.forEach(function(n){n.Rank>=t.Rank&&n.LevelFromTob>t.LevelFromTob&&(t=n)}),{SiteId:n.SiteId,OrSiteId:n.OrSiteId,Location:n.Location,LocationText:n.LocationText,Latitude:n.Latitude,Longitude:n.Longitude,Description:n.Description&&n.Description.length>0?n.Description:null,StreamData:i,MostAlarmingSensor:t}},t.prototype.modelFilter=function(n){return n.StreamData!=null},t}(t);i.iconInfo={siteNormal:{width:14,height:14},noFloodCategory:{width:14,height:14},siteWarning:{width:17,height:16},siteError:{width:17,height:16}};n.SurfaceBoxLayerGenerator=i}(hcfcd||(hcfcd={})),function(n){var i=function(){function n(n,t){this.measure=n;this.unit=t}return n}(),r=function(){function n(){}return n}(),u,f=function(){function f(i){this.isHistorical=!1;this.timeStart="";this.timeEnd="";this.upperRangeValue=527040;this.historicalInterval=1;this.onSitesChange=new n.TypedEvent;this.onStatusChange=new n.TypedEvent;this.currentSiteType="rainfall";this.model=i;var r=this;this.mapping=new t(this.model,function(){var n=r});u=this.appPath=i.appPath;this.isHistorical=i.IsHistorical;this.currentSiteType=i.SelectedFeature;this.infoBoxMouseovers=new Rx.Subject;this.infoBoxMouseouts=new Rx.Subject;this.layerChanges=new Rx.Subject}return f.prototype.parseGeoJson=function(n){return n.map(function(n){var i=n.geometry,f=i.coordinates,r=i.coordinates,e=r[0],o=r[1],s=i.offset,h=i.Text,u=f.map(function(n,t){return n-s[t]}),c=u[0],l=u[1],t=n.properties;return t.Longitude=e,t.Latitude=o,t.AltLong=c,t.AltLat=l,t.Location=h,t})},f.prototype.getRegionSites=function(){var t=this.model.currentTimeSelection.value,n=this;$.ajax({type:"GET",url:this.appPath+"Home/GetSiteRecentData",data:{regionId:this.getRegions(),timeSpan:t,dt:(new Date).setMinutes(0,0,0)},success:function(t){n.updateSites(n.parseGeoJson(t.features),t.properties.DataRange.StartDate,t.properties.DataRange.EndDate,!0)},traditional:!0})},f.prototype.setHistoricalValues=function(n,t){this.historicalInterval=n;this.historicalEndDate=t},f.prototype.setSiteType=function(n){this.currentSiteType=n;this.renderLayer(this.currentPeriod.start,this.currentPeriod.end,!this.isHistorical)},f.prototype.getSiteType=function(){return this.currentSiteType},f.prototype.getSites=function(){var i=this.historicalInterval,r=this.model.currentUnitsSelection.value,n,t=this;n=moment(this.historicalEndDate).format("l LTS");$.ajax({type:"POST",url:this.appPath+"Home/GetSiteHistoricRainfall",data:{regionId:this.getRegions(),endDate:n,interval:i,unit:"mi",dt:(new Date).getTime()},success:function(n){t.updateSites(t.parseGeoJson(n.features),n.properties.DataRange.StartDate,n.properties.DataRange.EndDate,!1)},traditional:!0})},f.prototype.getRegions=function(){var n=this.selectedAgencies.value;return n.length==0&&(n[0]=0),n},f.prototype.regionChange=function(n){this.selectedAgencies=n;this.mapping.regionChange(this.selectedAgencies.value);this.isHistorical?this.getSites():this.getRegionSites()},f.prototype.updateSites=function(n,t,i,r){this.allSites=n.map(function(n){return $.extend(n,{LocationText:n.SiteId+":"+n.Location}),n});this.currentPeriod={start:t,end:i};this.renderLayer(t,i,r)},f.prototype.renderLayer=function(t,i,r){if(!this.rainLayerGenerator){this.$infoBox=$("#infoBox");Rx.Observable.fromEvent(this.$infoBox,"mouseover").subscribe(this.infoBoxMouseovers);Rx.Observable.fromEvent(this.$infoBox,"mouseout").subscribe(this.infoBoxMouseouts);Rx.Observable.fromEvent($("input:radio[name=rainlayer]"),"change").subscribe(this.layerChanges);var u={appPath:this.appPath,closeInfoBox:this.mapping.closeInfoBox,map:this.mapping.map,hasTouchEvents:this.mapping.hasTouchEvents,isHistorical:this.isHistorical,infoBoxMouseovers:this.infoBoxMouseovers,infoBoxMouseouts:this.infoBoxMouseouts};this.rainLayerGenerator=new n.RainLayerGenerator(this.mapping.rainfallLayer,this.mapping.rainAltLayer,this.onStatusChange,u);this.surfaceLayerGenerator=new n.SurfaceLayerGenerator(this.mapping.rainfallLayer,this.mapping.rainAltLayer,this.onStatusChange,u);this.surfaceBoxLayerGenerator=new n.SurfaceBoxLayerGenerator(this.mapping.rainfallLayer,this.mapping.rainAltLayer,this.onStatusChange,u)}switch(this.currentSiteType){case"rainfall":this.updateMapSites(this.rainLayerGenerator,t,i,r);break;case"surface":this.updateMapSites(this.surfaceLayerGenerator,t,i,r);break;case"surfaceBox":this.updateMapSites(this.surfaceBoxLayerGenerator,t,i,r)}},f.prototype.updateMapSites=function(n,t,i,r){var f,u=[],l=this,a,e,o,s,h,c,w,b;if(this.mapping.removeSitePins(),a=Rx.Observable.fromArray(this.allSites).filter(n.modelFilter).map(n.viewModelMap).subscribe(function(n){u.push(n)}),u.length>0){f=u.sort(n.sortSite);var v=f[f.length-1].Rainfall,y=f[0].Rainfall,p=function(n,t,i){var r=n,f=t+.01,u=i;return function(n){var t=(f-r)/u.length;return u[Math.floor((n-r)/t)]}}(v,y,["leastRain","middleRain1","middleRain2","middleRain3","mostRain"]);for(e=0;e<u.length;e++)o=u[e],s=o.Rainfall>0?p(o.Rainfall):"noRain",n.renderSite(o,s,l.mapping.map.getZoom())}this.anyHover=Rx.Observable.merge(n.pushPinMouseOverEvents,this.infoBoxMouseovers);this.anyOuts=Rx.Observable.merge(n.siteMouseouts,this.infoBoxMouseouts);h=this;c=this.anyOuts.flatMapLatest(function(n){return Rx.Observable.return(n.target).delay(1e3).takeUntil(h.anyHover)});c.merge(this.layerChanges).subscribe(n.closeInfoBox);w=n.pushPinMouseClickEvents.subscribe(function(t){n.launchDetailPage(t.site)});b=n.pushPinMouseOverEvents.subscribe(function(t){n.displayEventInfo(t.site,t.element);n.moveInfoBox(t.site,t.element)});this.onSitesChange.trigger(u);this.mapping.addSitePins();this.timeStart=t;this.timeEnd=i;this.updateStatus(r)},f.prototype.mapIsReady=function(){this.updateStatus(!this.isHistorical)},f.prototype.findAgency=function(n){for(var t=0;t<this.model.Regions.length;t++)if(this.model.Regions[t].PK_Region==n)return this.model.Regions[t];return null},f.prototype.updateStatus=function(n){this.mapping.isHistorical=this.isHistorical=!n;var t=new r;t.isCurrent=n;t.agency=this.selectedAgencies&&this.selectedAgencies.value.length==1?this.findAgency(this.selectedAgencies.value[0]).RegionName:"";t.timeStart=this.timeStart;t.timeEnd=this.timeEnd;t.visualization=this.currentSiteType;n?t.timeSpan=this.model.currentTimeSelection.text:t.prettyUnit=this.getPrettyUnits(this.historicalInterval,this.model.currentUnitsSelection.value);this.onStatusChange.trigger(t)},f.prototype.getPrettyUnits=function(n,t){var r=n,u=t,e=1440,o=60,f;return r>=e?(r=r/e,u=r==1?"Day":"Days"):r>=o?(r=r/o,u=r==1?"Hour":"Hours"):u=r==1?"Minute":"Minutes",f=new Number(r+""),r=f.toFixed?parseFloat(f.toFixed(2)):r=Math.round(r*100)/100,new i(r,u)},f}(),t;n.Data=f;t=function(){function t(t,i){var r=this;this.altZoomLevel=12;this.credentials="";this.addressLocator="";this.countiesUrl="";this.watershedUrl="";this.watershedOpacity=.9;this.channelsUrl="";this.majorChannelsUrl="";this.channelsOpacity=.5;this.inundationOpacity=.95;this.inundationUrl="";this.inundationEnabled=!1;this.latitude=29.7751825;this.longitude=-95.3102505;this.isHistorical=!1;this.isIE8=!1;this.hasTouchEvents=!1;this.defaultRegionWindow="";this.rainIsVisible=!0;this.inundationLayerFound=!1;this.onGeocodeComplete=new n.TypedEvent;this.onMapEvent=new n.TypedEvent;this.loadArcGisCacheLayer=function(n,t,i,u){var f,e;if(u=u||{n:30.631,w:-96.193,s:28.768,e:-94.355},f=r,f[t])return f[t].setOptions(i),f[t];e={mercator:new Microsoft.Maps.TileSource({uriConstructor:n+"/tile/{zoom}/{y}/{x}",bounds:Microsoft.Maps.LocationRect.fromEdges(u.n,u.w,u.s,u.e)}),zIndex:1001};f[t]=new Microsoft.Maps.TileLayer(e);f[t].setOptions(i);f.map.layers.insert(f[t])};this.zoomLevelTest=function(){r.setSitePinVisibility(r.map.getZoom());r.setChannelLayerVisibility(r.map.getZoom(),$("#chkChannels").prop("checked"))};this.displayAddressInfo=function(n){var t,u,i;n.targetType==="pushpin"&&(t=r.map.tryLocationToPixel(n.target.getLocation(),Microsoft.Maps.PixelReference.control),u=document.getElementById("infoBox"),u.innerHTML=n.target.Address,i=document.getElementById("mapDiv").offsetWidth,$("#infoBox").css("top",t.y-20),t.x+210>i?$("#infoBox").css("left",i-210):$("#infoBox").css("left",t.x+10),clearTimeout(r.infoBoxTimeout),$("#infoBox").css("visibility","visible"),n.target.mousepointer=5)};this.closeInfoBox=function(){r.infoBoxTimeout=setTimeout(function(){$("#infoBox").css("visibility","hidden")},1750)};this.mapIsReady=function(){var n=r,t=r.map;r.getEsriMap();Microsoft.Maps.Events.addHandler(r.map,"maptypechanged",function(t){n.onMapEvent.trigger({eventType:"Change Basemap",detail:t.newMapTypeId=="a"?"Aerial":t.newMapTypeId=="r"?"Road":t.newMapTypeId})})};this.defaultRegionWindow=t.DefaultRegionWindow;this.addressLocator=t.BingAddressLocator;this.countiesUrl=t.CountiesLayerURL;this.watershedUrl=t.WatershedLayerURL;this.channelsUrl=t.ChannelsLayerURL;this.majorChannelsUrl=t.MajorChannelsLayerURL;this.watershedOpacity=parseFloat(t.WatershedOpacity);this.channelsOpacity=parseFloat(t.ChannelsOpacity);this.inundationOpacity=parseFloat(t.InundationOpacity);this.inundationUrl=t.InundationURL;this.inundationEnabled=t.InundationEnabled;this.appPath=t.appPath;this.credentials=t.BingMapCredentials;this.regions=t.Regions;this.isHistorical=t.isHistorical;this.onMapReady=i}return t.prototype.clickGeocode=function(n){var t=this;this.map.getCredentials(function(i){n.length>0&&$.getJSON(t.addressLocator+n.replace(/\./g,"")+"?output=json&key="+i+"&jsonp=?",function(n){t.geocodeCallback(t,n)})})},t.prototype.geocodeCallback=function(n,t){var f=0,l,i,e,u,s,h,o,r,c;if(n.removeAddressPins(),n.onGeocodeComplete.trigger(t),t&&t.resourceSets&&t.resourceSets.length>0&&t.resourceSets[0].resources&&t.resourceSets[0].resources.length>0){for(l=t.resourceSets[0].resources[0].bbox,i=0,e=65,u=[],i=0;i<t.resourceSets[0].resources.length;i++)t.resourceSets[0].resources[i].address.countryRegion==="United States"&&t.resourceSets[0].resources[i].address.adminDistrict==="TX"&&(f++,s=t.resourceSets[0].resources[i].address.formattedAddress,h={Address:s},o=new Microsoft.Maps.Location(t.resourceSets[0].resources[i].point.coordinates[0],t.resourceSets[0].resources[i].point.coordinates[1]),r=new Microsoft.Maps.Pushpin(o),$.extend(r,h),Microsoft.Maps.Events.addHandler(r,"mouseover",n.displayAddressInfo),Microsoft.Maps.Events.addHandler(r,"mouseout",n.closeInfoBox),u.push(o),r.setOptions({text:String.fromCharCode(e)}),n.addressLayer.add(r),e++);f>0&&(c=Microsoft.Maps.LocationRect.fromLocations(u),f===1?n.addressZoom(u[0].latitude,u[0].longitude):n.map.setView({bounds:c}))}},t.prototype.addressZoom=function(n,t){this.map.setView({center:new Microsoft.Maps.Location(n,t),zoom:13})},t.prototype.zoomToGage=function(n){this.map.setView({center:new Microsoft.Maps.Location(n.Latitude,n.Longitude),zoom:15})},t.prototype.toggleLayer=function(n){var t=this;switch(n.val()){case"counties":this.countiesLayer.setVisible(n.prop("checked"));break;case"channels":this.setChannelLayerVisibility(t.map.getZoom(),n.prop("checked"));break;case"watersheds":this.loadArcGisCacheLayer(this.watershedUrl,"watershedLayer",{zIndex:1001,visible:n.prop("checked"),opacity:this.watershedOpacity},{n:30.76,w:-95.99,s:29.45,e:-94.85});break;case"rainfall":this.rainIsVisible=n.prop("checked");t.setSitePinVisibility(t.map.getZoom());break;case"inundation":this.setInundationLayerVisibility(t.map.getZoom(),n.prop("checked"))}},t.prototype.regionChange=function(n){var t,r,u=!1,i;if(n.length>1)t=this.defaultRegionWindow.split(",");else if(n.length===1){for(i=0;i<this.regions.length;i++)if(this.regions[i].PK_Region==n[0]){t=this.regions[i].Window.split(",");this.regions[i].PK_Region==1&&(u=!0);break}}else t=this.defaultRegionWindow.split(",");r=Microsoft.Maps.LocationRect.fromLocations([new Microsoft.Maps.Location(Number(t[2]),Number(t[1])),new Microsoft.Maps.Location(Number(t[4]),Number(t[1])),new Microsoft.Maps.Location(Number(t[4]),Number(t[3]))]);this.map.setView({bounds:r});this.map.setView({zoom:10});getParameterByName("agencyview")==="1"&&u&&this.map.setView({zoom:10})},t.prototype.removeSitePins=function(){this.rainfallLayer.clear();this.rainAltLayer.clear();this.map.layers.remove(this.rainfallLayer);this.map.layers.remove(this.rainAltLayer)},t.prototype.addSitePins=function(){this.map.layers.insert(this.rainfallLayer);this.map.layers.insert(this.rainAltLayer);this.setSitePinVisibility(this.map.getZoom())},t.prototype.removeAddressPins=function(){this.addressLayer.clear()},t.prototype.removeInundationLayer=function(){this.currentInundationLayer&&this.map.layers.remove(this.currentInundationLayer)},t.prototype.addInundationLayer=function(n,t){var i=this.currentInundationLayer?this.currentInundationLayer.getVisible():!1;this.removeInundationLayer();this.currentInundationLayer=new Microsoft.Maps.TileLayer({downloadTimeout:2e4,opacity:this.inundationOpacity,visible:i,mercator:new Microsoft.Maps.TileSource({uriConstructor:this.inundationUrl+"Tiles/"+n+"/{quadkey}",minZoom:9,maxZoom:16,bounds:Microsoft.Maps.LocationRect.fromEdges(30.233104,-96.026848,29.32,-94.764181)})});this.currentInundationLayer.metadata={name:n};this.map.layers.insert(this.currentInundationLayer);t&&t(!0)},t.prototype.statusChange=function(n,t){var i=this;if(this.inundationEnabled){var f=moment(n,"MM/DD/YYYY hh:mm A"),e=parseInt(f.format("mm"))>30?"30":"00",r=""+f.format("YYYYMMDDHH")+e,u=this.inundationUrl+"Layer/Exists/"+r;this.currentInundationLayer&&u===this.currentInundationLayer.metadata.name&&(u!=this.currentInundationLayer.metadata.name||this.inundationLayerFound)||$.ajax({url:u,success:function(n){if(i.inundationLayerFound=n==="true",i.inundationLayerFound)i.addInundationLayer(r,t);else{var o=f.subtract(30,"m");e=parseInt(o.format("mm"))>30?"30":"00";r=""+f.format("YYYYMMDDHH")+e;u=i.inundationUrl+"Layer/Exists/"+r;$.ajax({url:u,success:function(n){i.inundationLayerFound=n==="true";i.inundationLayerFound?i.addInundationLayer(r,t):(o=f.subtract(30,"m"),e=parseInt(o.format("mm"))>30?"30":"00",r=""+f.format("YYYYMMDDHH")+e,u=i.inundationUrl+"Layer/Exists/"+r,$.ajax({url:u,success:function(n){i.inundationLayerFound=n==="true";i.inundationLayerFound?i.addInundationLayer(r,t):(i.removeInundationLayer(),t&&t(!1))},dataType:"text"}))},dataType:"text"})}},dataType:"text"})}},t.prototype.setChannelLayerVisibility=function(n,t){var i={zIndex:1003,visible:!1,opacity:this.channelsOpacity},r={n:30.2,w:-95.975,s:29.49,e:-94.9};t?(i.visible=n>13,this.loadArcGisCacheLayer(this.channelsUrl,"channelsLayer",i,r),i.visible=!i.visible,this.loadArcGisCacheLayer(this.majorChannelsUrl,"majorChannelsLayer",i,r)):(this.loadArcGisCacheLayer(this.channelsUrl,"channelsLayer",i,r),this.loadArcGisCacheLayer(this.majorChannelsUrl,"majorChannelsLayer",i,r))},t.prototype.setInundationLayerVisibility=function(n,t){this.currentInundationLayer.setVisible(t)},t.prototype.setInundationLayerOpacity=function(n){this.inundationOpacity=n;console.log(n);this.currentInundationLayer&&this.currentInundationLayer.setOpacity(n)},t.prototype.setSitePinVisibility=function(n){n>13&&n<=17?$("#mapDiv").removeClass("largestMapIndicator").addClass("largeMapIndicator"):n>17?$("#mapDiv").removeClass("largeMapIndicator").addClass("largestMapIndicator"):$("#mapDiv").removeClass("largeMapIndicator").removeClass("largestMapIndicator");n<this.altZoomLevel?(this.rainAltLayer.setVisible(this.rainIsVisible),this.rainfallLayer.setVisible(!1)):(this.rainAltLayer.setVisible(!1),this.rainfallLayer.setVisible(this.rainIsVisible))},t.prototype.modifyPinAppearance=function(){$.each($(".MicrosoftMap").find("div"),function(){var n=$(this);n.children().length===0&&n.css("color")==="#fff"&&n.text().length<8&&n.css("color","#083B83")})},t.prototype.getEsriMap=function(){this.loadArcGisCacheLayer(this.countiesUrl,"countiesLayer",{zIndex:1002},{n:30.631,w:-96.193,s:28.768,e:-94.355});var n=this;Microsoft.Maps.Events.addHandler(this.map,"viewchangeend",function(){var t=n;n.zoomLevelTest.apply(t,arguments)})},t.prototype.getMap=function(n){this.map=new Microsoft.Maps.Map(n,{credentials:this.credentials,mapTypeId:Microsoft.Maps.MapTypeId.road,disableStreetside:!0,zoom:10,enableClickableLogo:!1,showDashboard:getParameterByName("agencyview")!=="1"});this.rainfallLayer=new Microsoft.Maps.Layer("rainfall");this.rainfallLayer.setZIndex(1006);this.rainAltLayer=new Microsoft.Maps.Layer("rainalt");this.rainAltLayer.setZIndex(1005);this.addressLayer=new Microsoft.Maps.Layer("address");this.addressLayer.setZIndex(1004);this.map.layers.insert(this.addressLayer);var t=this;$(document).ready(function(){t.mapIsReady.apply(t,arguments);t.map.setView({zoom:10})})},t}();n.Mapping=t}(hcfcd||(hcfcd={})),function(n,t){function b(t){var r=n(t.item).find("> .k-link").text();_gaq.push(["_trackEvent","Rainfall Data","TabChanged",r]);r==="Current"?i.getRegionSites():h()&&i.getSites()}function a(){n("#ResetAgencyViewLink").hide()}function v(){n("#ResetAgencyViewLink").show()}function tt(){n("#chkInundation").closest("tr").show()}function it(){var n=window.open(i.appPath+"Help","name","height=600,width=900,resizable=yes,scrollbars=yes,status=yes");window.focus&&n.focus()}for(var e=null,r=null,c=null,u=null,o=null,w=moment(Date.now()),i=new hcfcd.Data(t),l=0,f=0;f<t.TimeSpan.length;f++)if(t.TimeSpan[f].PK_Period===t.SelectedTimeSpan){l=f;break}var k=function(n){var r=n.sender.dataItem(n.item);_gaq.push(["_trackEvent","Rainfall Data","Time Span Changed",r.PeriodName]);t.currentTimeSelection={value:r.PK_Period,text:r.PeriodName};i.getRegionSites()},d=function(n){var i=n.sender.dataItem(n.item);_gaq.push(["_trackEvent","Unit Selections","Unit Changed",i.Location]);t.currentUnitsSelection=i},g=function(n){var r=n.sender.dataItem(n.item);r.SiteId&&r.SiteId!=""&&(_gaq.push(["_trackEvent","Gage Selections","Gage Changed",r.Location]),t.currentGageSelection=r,i.mapping.zoomToGage(t.currentGageSelection))},nt=function(t){n("#printLegendContainer").html(n("#print"+t+"Legend").html());_gaq.push(["_trackEvent","Site Type Selections","Type Changed",t]);i.setSiteType(t);switch(t){case"rainfall":n(".legendOption.typeLabel").html("RAINFALL DATA");n(".rainfallLegend").show();n(".surfaceLevelTitles").hide();n(".surfaceLevelLegendItem").hide();n(".surfaceLevelLegendBoxItem").hide();break;case"surfaceBox":case"surface":n(".legendOption.typeLabel").html("SURFACE LEVEL DATA");n(".surfaceLevelTitles").show();n(".rainfallLegend").hide();n(".surfaceLevelLegendItem").hide();n(".surfaceLevelLegendBoxItem").hide();t=="surface"?n(".surfaceLevelLegendItem").show():n(".surfaceLevelLegendBoxItem").show()}};var y=function(){var f,t,e,r,u;n(this).prop("checked")?n(this).parent().addClass("k-state-selected"):n(this).parent().removeClass("k-state-selected");f="";n.trim(n(this).parent().find("label").html())=="ALL"?(t=n(this).prop("checked"),e=n(this).closest("ul").find("input[type='checkbox']"),e.each(function(){this.checked=t;t?(n(this).parent().addClass("k-state-selected"),f="ALL"):n(this).parent().removeClass("k-state-selected")})):(r=n(this).closest("ul").find("li")[0],n(r).removeClass("k-state-selected"),n(r).find("input[type='checkbox']")[0].checked=!1);u=s();_gaq.push(["_trackEvent","Gage Selections","Agency Changed",n("#ddlRegion").data("kendoDropDownList").text()]);i.regionChange(u);u.value.length===1?v():a()},s=function(){var t="",r=[],i;return n(".customCheckList").find("li").each(function(i){n(this).hasClass("k-state-selected")&&(i===0?t="ALL":(t!=="ALL"&&(t.length>0&&(t+=", "),t+=n(this).find("label").html()),r.push(parseInt(n(this).find("input").val()))))}),i={text:t,value:r},n("#ddlRegion").data("kendoDropDownList").text(i.text),i},rt=function(){var n=r.value();n||(n=new Date,r.max(n),r.value(n))},ut=function(){i.mapping.removeAddressPins();n("#addressResultsContainer").html("")},et=function(){var s=i.mapping.map,l=s.getBounds(),a=s.getZoom(),r,f,h,c,e,o;r=i.getRegions();i.isHistorical?(h=u.value(),c=t.currentUnitsSelection.value,f="historical=1&regionId="+r.join(",")+"&endDate="+moment(new Date(n("#dtEnd").data("kendoDateTimePicker").value())).format("l LTS")+"&interval="+h+"&unit="+c):f="historical=0&regionId="+r.join(",")+"&timeSpan="+t.currentTimeSelection.value;e=i.appPath+"PrintMap/Static?"+f;e+="&feature="+i.getSiteType();o=window.open(e);o.status=o.opener.status},p=function(){var r=t.currentUnitsSelection.value,n=i.upperRangeValue;return r==="hh"?n=i.upperRangeValue/60-1:r==="dd"&&(n=i.upperRangeValue/1440),n-1},h=function(){var e="",s=t.currentUnitsSelection.value,f=u.value(),h=p();return s==="hh"?f=60*f:s==="dd"&&(f=1440*f),f>0&&f<=i.upperRangeValue||(e.length>0&&(e+="<\/br>"),e+='You must enter a number for "Count back ___ '+t.currentUnitsSelection.text+'" that is between 1 and '+(h-1)),e.length>0?(n("#messageWindow div:first").html(e),o.open().center(),!1):(i.setHistoricalValues(f,r.value()),!0)},ft=function(t){t?(n("#chkInundation").removeAttr("disabled"),n("#chkInundation").parent().parent().find(".checkbox-label").css("color","#000"),n("#inundationCheckboxLabel").html("Inundation Map"),n("#chkInundation").prop("checked")&&(n("#inundationSlider").show(),n(".inundationLegendBoxItem").show())):(n("#chkInundation").attr("disabled","true"),n("#chkInundation").parent().parent().find(".checkbox-label").css("color","#aaa"),n("#inundationSlider").hide(),n("#inundationCheckboxLabel").html("Inundation Map not Available (No inundation at this time)"),n(".inundationLegendBoxItem").hide())};n(document).ready(function(){function ui(){"use strict";n.ajax({type:"POST",url:i.appPath+"Alerts/GetAlerts",dataType:"html",success:function(t){n("#alertsContainer").empty();n("#alertsContainer").html(t);n("div.ticker").jTicker({interval:45});n("div.ticker").click(function(){_gaq.push(["_trackEvent","Alerts","Clicked","In webpage for "+moment.duration(w.diff(moment(Date.now()))).humanize()])})}})}var pt,et,kt,wt,ct,lt,at,ot,vt,st,ht,yt,bt;i.onStatusChange.add(function(t){var r="",u=document.getElementById("printDetail"),f=t.agency.length>0?" as reported by "+t.agency:"",e;i.getSiteType()==="rainfall"?(n("#chkRainfall").prop("checked")||n("#chkRainfall").prop("checked",!0),t.isCurrent?(window.status=r="Showing rainfall for the last "+t.timeSpan+" (before "+t.timeEnd+")",u.innerHTML="Rainfall for the last "+t.timeSpan+f+" (before "+t.timeEnd+")"):(window.status=r="Showing rainfall for "+t.prettyUnit.measure+" "+t.prettyUnit.unit+" from "+t.timeStart+"  to  "+t.timeEnd,u.innerHTML="Rainfall for "+t.prettyUnit.measure+" "+t.prettyUnit.unit+" from "+t.timeStart+" to "+t.timeEnd+f)):i.getSiteType()==="surface"?(window.status=r="Showing water level in channels at "+t.timeEnd,u.innerHTML="Surface water level in channels at "+t.timeEnd+f):(window.status=r="Showing channel status at "+t.timeEnd,u.innerHTML="Surface channel status at "+t.timeEnd+f);n(".hcfcd-status-bar").html("<span>"+r+"<\/span>");i.mapping.inundationEnabled&&(e=i.mapping.statusChange(t.timeEnd,ft))});i.mapping.inundationEnabled&&tt();i.mapping.onMapEvent.add(function(n){n.eventType==="Change Basemap"&&_gaq.push(["_trackEvent",n.eventType,"Button Clicked",n.detail])});i.mapping.onGeocodeComplete.add(function(t){var e,f,u,r;if(n("#addressResultsContainer").html(""),t&&t.resourceSets&&t.resourceSets.length>0&&t.resourceSets[0].resources&&t.resourceSets[0].resources.length>0){for(f=0,u='<table style="font-size:1em;">',r=0;r<t.resourceSets[0].resources.length;r++)t.resourceSets[0].resources[r].address.countryRegion==="United States"&&t.resourceSets[0].resources[r].address.adminDistrict==="TX"&&(f++,e=t.resourceSets[0].resources[r].address.formattedAddress,u+='<tr><td><a href="#" class="addressPoint" data-lat="'+t.resourceSets[0].resources[r].point.coordinates[0]+'" data-lng="'+t.resourceSets[0].resources[r].point.coordinates[1]+'">'+e+"<\/a><\/td><\/tr>");u+="<\/table>";f>0?(n("#addressResultsContainer").html(u),n("#addressResultsContainer").find(".addressPoint").each(function(){n(this).click(function(t){t.preventDefault();i.mapping.addressZoom(n(this).attr("data-lat"),n(this).attr("data-lng"))})})):n("#addressResultsContainer").html("No Address Search Results Found")}});try{document.createEvent("TouchEvent");i.mapping.hasTouchEvents=!0}catch(fi){i.mapping.hasTouchEvents=!1}n("#printLegendContainer").html(n("#printrainfallLegend").html());n(".legendnoFloodCategory").html(hcfcd.SurfaceBoxLayerGenerator.generateGraphic("noFloodCategory").innerHTML);n(".legendnoFlooding").html(hcfcd.SurfaceBoxLayerGenerator.generateGraphic("siteNormal").innerHTML);n(".legendsiteWarning").html(hcfcd.SurfaceBoxLayerGenerator.generateGraphic("siteWarning").innerHTML);n(".legendsiteError").html(hcfcd.SurfaceBoxLayerGenerator.generateGraphic("siteError").innerHTML);n(".legendNoFloodLow").html(hcfcd.SurfaceLayerGenerator.generateGraphic("siteNormal",2));n(".legendNoFloodMed").html(hcfcd.SurfaceLayerGenerator.generateGraphic("siteNormal",4.5));n(".legendNoFloodMedHigh").html(hcfcd.SurfaceLayerGenerator.generateGraphic("siteNormal",6.5));n(".legendNoFloodHigh").html(hcfcd.SurfaceLayerGenerator.generateGraphic("siteWarning"));n(".legendOutOfBank").html(hcfcd.SurfaceLayerGenerator.generateGraphic("siteError"));n("#lnkClearSearch").click(function(t){return t.preventDefault(),_gaq.push(["_trackEvent","Address Search","Click","Clear Search"]),n("#txtAddress").val(""),ut(),!1});n("#ResetAgencyViewLink").click(function(n){n.preventDefault();_gaq.push(["_trackEvent","Link","Click","Reset to Agency View"]);i.regionChange(s())});n("#chkChannels").bind("click",function(){var t=n(this);_gaq.push(["_trackEvent","Map View Options","CheckChanged","Channels-"+t.prop("checked")]);i.mapping.toggleLayer(t)});n("#chkWatersheds").bind("click",function(){var t=n(this);_gaq.push(["_trackEvent","Map View Options","CheckChanged","Watersheds-"+t.prop("checked")]);i.mapping.toggleLayer(t)});n("#chkInundation").bind("click",function(){var t=n(this);_gaq.push(["_trackEvent","Map View Options","CheckChanged","Inundation-"+t.prop("checked")]);i.mapping.toggleLayer(t);t.prop("checked")?(n("#inundationSlider").show(),n("#chkChannelStatus").prop("checked")||n("#chkChannelStatus").trigger("click")):n("#inundationSlider").hide()});pt=function(t){t!==i.mapping.inundationOpacity&&i.mapping.setInundationLayerOpacity(t);n("#inundationSubLegend1").css("background-color","rgba(169, 231, 240, "+t+")");n("#inundationSubLegend2").css("background-color","rgba(3, 193, 229, "+t+")");n("#inundationSubLegend3").css("background-color","rgba(25, 86, 173, "+t+")");n("#inundationSubLegend4").css("background-color","rgba(72, 19, 104, "+t+")")};et=document.getElementById("inundationSlider");window.noUiSlider.create(et,{start:[i.mapping.inundationOpacity*100],step:1,range:{min:0,max:100}});et.noUiSlider.on("update",function(){pt(et.noUiSlider.get()/100)});for(n("#chkRainfall").bind("click",function(){var t=n(this);_gaq.push(["_trackEvent","Map View Options","CheckChanged","Rainfall-"+t.prop("checked")]);i.mapping.toggleLayer(t);n("#chkInundation").prop("checked")&&n("#chkInundation").trigger("click")}),n("#lnkHelp").click(function(n){n.preventDefault();_gaq.push(["_trackEvent","Link","Click","Help"]);it()}),kt=n("#rainTab").kendoTabStrip({animation:!1,select:b}).data("kendoTabStrip"),wt=t.EndDate==null?new Date:moment(new Date(t.EndDate)).isValid()?moment(new Date(t.EndDate)).toDate():new Date,e=n("#ddlTimeSpan").kendoDropDownList({dataTextField:"PeriodName",dataValueField:"PK_Period",dataSource:t.TimeSpan,index:l,select:k}).data("kendoDropDownList"),t.currentTimeSelection={value:e.value(),text:e.text()},n("#btnRefreshData").click(function(n){n.preventDefault();_gaq.push(["_trackEvent","Link","Click","Refresh Data - Rainfall"]);i.getRegionSites()}),n("#ddlTimeSpan-list").css("width","102px"),u=n("#txtAmount").kendoNumericTextBox({format:"#",min:1,max:i.upperRangeValue,value:t.Interval,step:1}).data("kendoNumericTextBox"),ct=[{text:"day(s)",value:"dd"},{text:"hour(s)",value:"hh"},{text:"minute(s)",value:"mm"}],lt=0,ct.forEach(function(n,i){t.Unit===n.value&&(lt=i)}),at=n("#drpUnits").kendoDropDownList({dataTextField:"text",dataValueField:"value",index:lt,dataSource:ct,select:d}).data("kendoDropDownList"),t.currentUnitsSelection={value:at.value(),text:at.text()},u.max(p()),r=n("#dtEnd").kendoDateTimePicker({value:wt,change:rt,min:new Date(1986,1,1),max:new Date,parseFormats:["MM/dd/yyyy hh:mmtt","MM/dd/yyyy HH:mm","MM/dd/yyyy","HH:mm tt"]}).data("kendoDateTimePicker"),n("#btnShowHistorical").click(function(n){n.preventDefault();h()&&(_gaq.push(["_trackEvent","Rainfall Data","Button Clicked","Show Historical"]),i.getSites())}),ot=[{text:"Rainfall",value:"rainfall"},{text:"Channel Status",value:"surfaceBox"}],(getParameterByName("levels")||t.SelectedFeature==="surface")&&(n("#chkChannelLevels").closest("tr").css("display",""),ot.push({text:"Water Levels",value:"surface"})),vt=0,ot.forEach(function(i,r){t.SelectedFeature===i.value&&(vt=r,n("#printLegendContainer").html(n("#print"+i.value+"Legend").html()))}),n("input:radio[name=rainlayer]").change(function(t){var i=n(t.target).val();ot.forEach(function(n,t){i===n.value&&(vt=t)});nt(i)}),n("input:checkbox[name=chkBoxInundation]").change(function(){n("#chkInundation").prop("checked")?n(".inundationLegendBoxItem").show():n(".inundationLegendBoxItem").hide()}),c=n("#ddlGage").kendoDropDownList({dataTextField:"LocationText",dataValueField:"SiteId",optionLabel:{LocationText:"(Select Site)",dataValue:null},select:g}).data("kendoDropDownList"),n("#ddlGage-list").css("width","420px"),i.onSitesChange.add(function(n){c.dataSource.data(n.sort(function(n,t){return n.SiteId-t.SiteId}))}),st=[],ht=0;ht<t.Regions.length;ht++)st.push(String(t.Regions[ht].PK_Region));var dt=n("#ddlRegion").kendoDropDownList({dataSource:t.Regions,dataTextField:"RegionName",dataValueField:"PK_Region",select:y}).data("kendoDropDownList"),f=n("#regionSelectPopup"),gt=kendo.template(n("#regionSelectTemplate").html());n.each(t.Regions,function(t,i){n(".customCheckList").append(gt({listName:i.RegionName,itemValue:i.PK_Region}))});n.each(st,function(t,i){n(".customCheckList").find("li").each(function(){var t=n(this).find("input[type='checkbox']");t.val()===i&&(t[0].checked=!0,n(this).addClass("k-state-selected"))})});n(".customCheckList li input").change(y);n(".customCheckList li").hover(function(){n(this).addClass("k-state-hover")},function(){n(this).removeClass("k-state-hover")});dt.bind("open",function(n){n.preventDefault();f.css("top",n.sender.wrapper.position().top+n.sender.wrapper.height()-3).css("left",n.sender.wrapper.position().left).show("fast",function(){})});var ni=function(){f.hide()},ti=Rx.Observable.fromEvent(f.find("input[type=button]"),"click").map(function(n){return Rx.Observable.return(n)}),ii=Rx.Observable.fromEvent(f,"mouseover"),ei=new Rx.Subject,ri=Rx.Observable.fromEvent(f,"mouseout").filter(function(){return f.css("display")!=="none"}).flatMapLatest(function(n){return Rx.Observable.return(n).delay(1e3).takeUntil(ii)});ri.merge(ti).subscribe(ni);st.length===1?v():a();n("#txtAddress").bind("keypress",function(t){var r=t.keyCode?t.keyCode:t.which;r==13&&(t.preventDefault(),i.mapping.clickGeocode(n("#txtAddress").val()))});n("#btnSearch").click(function(t){t.preventDefault();_gaq.push(["_trackEvent","Address Search","Click","Find"]);i.mapping.clickGeocode(n("#txtAddress").val())});yt=n("#windowDisclaimer").kendoWindow({title:!1,visible:!1,modal:!0,draggable:!1,height:275,minWidth:245,resizable:!1,open:function(){this.wrapper.css("top","200px")}}).data("kendoWindow");o=n("#messageWindow").kendoWindow({title:!1,visible:!1,modal:!0,draggable:!1,minWidth:245,resizable:!1,open:function(){this.wrapper.css("top","200px")}}).data("kendoWindow");n("#messageWindow >div >button").click(function(){o.close()});n("#btnDisclaimer").click(function(n){n.preventDefault();_gaq.push(["_trackEvent","Link","Click","Disclaimer"]);yt.center().open()});n("#btnIAgree").click(function(n){n.preventDefault();_gaq.push(["_trackEvent","Disclaimer","Button Clicked","I Agree"]);yt.close()});bt=n("#latestDataUnavailable").kendoWindow({title:!1,visible:!1,modal:!0,draggable:!1,resizable:!1,open:function(){this.wrapper.css("top","200px")}}).data("kendoWindow");n("#btnCloseDataUnavailable").click(function(n){n.preventDefault();bt.close()});n(document).on("click",".k-overlay",function(){var t=n(".k-window-content.k-content",n(this).next("div.k-widget.k-window"));t!=null&&t.length!=0&&t.data("kendoWindow").close()});n(window).load(function(){i.mapping.getMap(document.getElementById("mapDiv"));i.isHistorical&&h();i.regionChange(s());getParameterByName("agencyview")==="1"&&n(".hcfcd-status-bar").css("padding-left","160px");var t=getParameterByName("feature").toLowerCase();t==="surfacebox"?n("#chkChannelStatus").prop("checked",!0):t==="surface"?n("#chkChannelLevels").prop("checked",!0):t==="rainfall"&&n("#chkRainfall").prop("checked",!0)});Rx.Observable.timer(1e3,9e5).subscribe(ui)})}(jQuery,indexPageModel),function(n){"use strict";n.fn.jTicker=function(t){typeof t=="undefined"&&(t={});var r=n.extend({},n.fn.jTicker.defaults,t),i=n(this),c,o,u,s,h,f,e,l;if(i.length&&i.children().length){for(r.tickerId=i[0].id,n.fn.jTicker.settings[r.tickerId]={},i.parent()[0].className!=="wrap"&&(c=i.wrap('<div class="wrap"><\/div>')),i.parent().parent()[0].className!=="container"&&(o=i.parent().wrap('<div class="container" />')),n('<div class="label">Weather Alert<\/div>').insertBefore(o),u=i[0].firstChild;u;)s=u.nextSibling,u.nodeType===3&&i[0].removeChild(u),u=s;h=i.children().first().outerWidth(!0);n.fn.jTicker.settings[r.tickerId].shiftLeftAt=h;n.fn.jTicker.settings[r.tickerId].left=0;n.fn.jTicker.settings[r.tickerId].runId=null;i.width(2*screen.availWidth);f=function(){e();var t=n.fn.jTicker.settings[r.tickerId];t.left-=r.speed;t.left<=t.shiftLeftAt*-1&&(t.left=0,i.append(i.children()[0]),t.shiftLeftAt=i.children().first().outerWidth(!0));i.css("left",t.left);t.runId=setTimeout(f,r.interval);n.fn.jTicker.settings[r.tickerId]=t};e=function(){var t=n.fn.jTicker.settings[r.tickerId];t.runId&&clearTimeout(t.runId);t.runId=null;n.fn.jTicker.settings[r.tickerId]=t};l=function(){e();f()};i.hover(e,f);f()}};n.fn.jTicker.settings={};n.fn.jTicker.defaults={tickerId:null,url:null,speed:1,interval:20}}(jQuery);!function(){function ll(n){return n&&(n.ownerDocument||n.document||n).documentElement}function bt(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function nr(n,t){return t>n?-1:n>t?1:n>=t?0:NaN}function si(n){return null===n?NaN:+n}function ct(n){return!isNaN(n)}function al(n){return{left:function(t,i,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var f=r+u>>>1;n(t[f],i)<0?r=f+1:u=f}return r},right:function(t,i,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var f=r+u>>>1;n(t[f],i)>0?u=f:r=f+1}return r}}}function uk(n){return n.length}function fk(n){for(var t=1;n*t%1;)t*=10;return t}function vl(n,t){for(var i in t)Object.defineProperty(n.prototype,i,{value:t[i],enumerable:!1})}function lt(){this._=Object.create(null)}function ar(n){return(n+="")===nb||n[0]===gf?gf+n:n}function vu(n){return(n+="")[0]===gf?n.slice(1):n}function yl(n){return ar(n)in this._}function pl(n){return(n=ar(n))in this._&&delete this._[n]}function wl(){var n=[];for(var t in this._)n.push(vu(t));return n}function bl(){var n=0;for(var t in this._)++n;return n}function kl(){for(var n in this._)return!1;return!0}function fo(){this._=Object.create(null)}function v(n){return n}function ek(n,t,i){return function(){var r=i.apply(t,arguments);return r===t?n:r}}function eo(n,t){var i,u,r;if(t in n)return t;for(t=t.charAt(0).toUpperCase()+t.slice(1),i=0,u=gh.length;u>i;++i)if(r=gh[i]+t,r in n)return r}function l(){}function oo(){}function dl(n){function r(){for(var i,r=t,u=-1,f=r.length;++u<f;)(i=r[u].on)&&i.apply(this,arguments);return n}var t=[],i=new lt;return r.on=function(r,u){var e,f=i.get(r);return arguments.length<2?f&&f.on:(f&&(f.on=null,t=t.slice(0,e=t.indexOf(f)).concat(t.slice(e+1)),i.remove(r)),u&&t.push(i.set(r,{on:u})),n)},r}function kt(){n.event.preventDefault()}function so(){for(var i,t=n.event;i=t.sourceEvent;)t=i;return t}function ho(t){for(var i=new oo,r=0,u=arguments.length;++r<u;)i[arguments[r]]=dl(i);return i.of=function(r,u){return function(f){try{var e=f.sourceEvent=n.event;f.target=t;n.event=f;i[f.type].apply(r,u)}finally{n.event=e}}},i}function dt(n){return ne(n,e),n}function co(n){return"function"==typeof n?n:function(){return nc(n,this)}}function gl(n){return"function"==typeof n?n:function(){return tc(n,this)}}function na(t,i){function r(){this.removeAttribute(t)}function u(){this.removeAttributeNS(t.space,t.local)}function f(){this.setAttribute(t,i)}function e(){this.setAttributeNS(t.space,t.local,i)}function o(){var n=i.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function s(){var n=i.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}return t=n.ns.qualify(t),null==i?t.local?u:r:"function"==typeof i?t.local?s:o:t.local?e:f}function ta(n){return n.trim().replace(/\s+/g," ")}function ia(t){return new RegExp("(?:^|\\s+)"+n.requote(t)+"(?:\\s+|$)","g")}function ra(n){return(n+"").trim().split(/^|\s+/)}function ua(n,t){function r(){for(var r=-1;++r<i;)n[r](this,t)}function u(){for(var r=-1,u=t.apply(this,arguments);++r<i;)n[r](this,u)}n=ra(n).map(ok);var i=n.length;return"function"==typeof t?u:r}function ok(n){var t=ia(n);return function(i,r){if(u=i.classList)return r?u.add(n):u.remove(n);var u=i.getAttribute("class")||"";r?(t.lastIndex=0,t.test(u)||i.setAttribute("class",ta(u+" "+n))):i.setAttribute("class",ta(u.replace(t," ")))}}function fa(n,t,i){function r(){this.style.removeProperty(n)}function u(){this.style.setProperty(n,t,i)}function f(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,i)}return null==t?r:"function"==typeof t?f:u}function ea(n,t){function i(){delete this[n]}function r(){this[n]=t}function u(){var i=t.apply(this,arguments);null==i?delete this[n]:this[n]=i}return null==t?i:"function"==typeof t?u:r}function oa(t){function i(){var n=this.ownerDocument,i=this.namespaceURI;return i?n.createElementNS(i,t):n.createElement(t)}function r(){return this.ownerDocument.createElementNS(t.space,t.local)}return"function"==typeof t?t:(t=n.ns.qualify(t)).local?r:i}function sk(){var n=this.parentNode;n&&n.removeChild(this)}function lo(n){return{__data__:n}}function sa(n){return function(){return ic(this,n)}}function hk(n){return arguments.length||(n=nr),function(t,i){return t&&i?n(t.__data__,i.__data__):!t-!i}}function at(n,t){for(var i=0,u=n.length;u>i;i++)for(var f,e=n[i],r=0,o=e.length;o>r;r++)(f=e[r])&&t(f,r,i);return n}function ha(n){return ne(n,ot),n}function ck(n){var t,i;return function(r,u,f){var e,o=n[f].update,s=o.length;for(f!=i&&(i=f,t=0),u>=t&&(t=u+1);!(e=o[t])&&++t<s;);return e}}function ca(t,i,r){function o(){var n=this[u];n&&(this.removeEventListener(t,n,n.$),delete this[u])}function h(){var n=s(i,ti(arguments));o.call(this);this.addEventListener(t,this[u]=n,n.$=r);n._=i}function c(){var u,f=new RegExp("^__on([^.]+)"+n.requote(t)+"$"),i,r;for(i in this)(u=i.match(f))&&(r=this[i],this.removeEventListener(u[1],r,r.$),delete this[i])}var u="__on"+t,f=t.indexOf("."),s=la,e;return f>0&&(t=t.slice(0,f)),e=ie.get(t),e&&(t=e,s=lk),f?i?h:o:i?l:c}function la(t,i){return function(r){var u=n.event;n.event=r;i[0]=this.__data__;try{t.apply(this,i)}finally{n.event=u}}}function lk(n,t){var i=la(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||i.call(t,n)}}function yu(t){var i=".dragsuppress-"+ ++tb,f="click"+i,u=n.select(bt(t)).on("touchmove"+i,kt).on("dragstart"+i,kt).on("selectstart"+i,kt),r,e;return(null==pi&&(pi="onselectstart"in t?!1:eo(t.style,"userSelect")),pi)&&(r=ll(t).style,e=r[pi],r[pi]="none"),function(n){if(u.on(i,null),pi&&(r[pi]=e),n){var t=function(){u.on(f,null)};u.on(f,function(){kt();t()},!0);setTimeout(t,0)}}}function ao(t,i){var u,r,f,e,o;return(i.changedTouches&&(i=i.changedTouches[0]),u=t.ownerSVGElement||t,u.createSVGPoint)?(r=u.createSVGPoint(),0>re&&(f=bt(t),(f.scrollX||f.scrollY)&&(u=n.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"),e=u[0][0].getScreenCTM(),re=!(e.f||e.e),u.remove())),re?(r.x=i.pageX,r.y=i.pageY):(r.x=i.clientX,r.y=i.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]):(o=t.getBoundingClientRect(),[i.clientX-o.left-t.clientLeft,i.clientY-o.top-t.clientTop])}function ak(){return n.event.changedTouches[0].identifier}function aa(n){return n>0?1:0>n?-1:0}function vo(n,t,i){return(t[0]-n[0])*(i[1]-n[1])-(t[1]-n[1])*(i[0]-n[0])}function va(n){return n>1?0:-1>n?f:Math.acos(n)}function gt(n){return n>1?h:-1>n?-h:Math.asin(n)}function vk(n){return((n=Math.exp(n))-1/n)/2}function ya(n){return((n=Math.exp(n))+1/n)/2}function yk(n){return((n=Math.exp(2*n))-1)/(n+1)}function pa(n){return(n=Math.sin(n/2))*n}function hi(){}function ft(n,t,i){return this instanceof ft?(this.h=+n,this.s=+t,void(this.l=+i)):arguments.length<2?n instanceof ft?new ft(n.h,n.s,n.l):da(""+n,ga,ft):new ft(n,t,i)}function yo(n,t,i){function e(n){return n>360?n-=360:0>n&&(n+=360),60>n?r+(u-r)*n/60:180>n?u:240>n?r+(u-r)*(240-n)/60:r}function f(n){return Math.round(255*e(n))}var r,u;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,i=0>i?0:i>1?1:i,u=.5>=i?i*(1+t):i+t-i*t,r=2*i-u,new b(f(n+120),f(n),f(n-120))}function tt(t,i,r){return this instanceof tt?(this.h=+t,this.c=+i,void(this.l=+r)):arguments.length<2?t instanceof tt?new tt(t.h,t.c,t.l):t instanceof it?ba(t.l,t.a,t.b):ba((t=nv((t=n.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new tt(t,i,r)}function po(n,t,i){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new it(i,Math.cos(n*=u)*t,Math.sin(n)*t)}function it(n,t,i){return this instanceof it?(this.l=+n,this.a=+t,void(this.b=+i)):arguments.length<2?n instanceof it?new it(n.l,n.a,n.b):n instanceof tt?po(n.h,n.c,n.l):nv((n=b(n)).r,n.g,n.b):new it(n,t,i)}function wa(n,t,i){var r=(n+16)/116,u=r+t/500,f=r-i/200;return u=wo(u)*rb,r=wo(r)*ub,f=wo(f)*fb,new b(ko(3.2404542*u-1.5371385*r-.4985314*f),ko(-.969266*u+1.8760108*r+.041556*f),ko(.0556434*u-.2040259*r+1.0572252*f))}function ba(n,t,i){return n>0?new tt(Math.atan2(i,t)*s,Math.sqrt(t*t+i*i),n):new tt(NaN,NaN,n)}function wo(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function bo(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function ko(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function b(n,t,i){return this instanceof b?(this.r=~~n,this.g=~~t,void(this.b=~~i)):arguments.length<2?n instanceof b?new b(n.r,n.g,n.b):da(""+n,b,yo):new b(n,t,i)}function ka(n){return new b(n>>16,n>>8&255,255&n)}function pu(n){return ka(n)+""}function tr(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function da(n,t,i){var s,u,r,f=0,e=0,o=0;if(s=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(u=s[2].split(","),s[1]){case"hsl":return i(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(ns(u[0]),ns(u[1]),ns(u[2]))}return(r=fu.get(n))?t(r.r,r.g,r.b):(null==n||"#"!==n.charAt(0)||isNaN(r=parseInt(n.slice(1),16))||(4===n.length?(f=(3840&r)>>4,f=f>>4|f,e=240&r,e=e>>4|e,o=15&r,o=o<<4|o):7===n.length&&(f=(16711680&r)>>16,e=(65280&r)>>8,o=255&r)),t(f,e,o))}function ga(n,t,i){var f,s,e=Math.min(n/=255,t/=255,i/=255),r=Math.max(n,t,i),u=r-e,o=(r+e)/2;return u?(s=.5>o?u/(r+e):u/(2-r-e),f=n==r?(t-i)/u+(i>t?6:0):t==r?(i-n)/u+2:(n-t)/u+4,f*=60):(f=NaN,s=o>0&&1>o?0:f),new ft(f,s,o)}function nv(n,t,i){n=go(n);t=go(t);i=go(i);var u=bo((.4124564*n+.3575761*t+.1804375*i)/rb),r=bo((.2126729*n+.7151522*t+.072175*i)/ub),f=bo((.0193339*n+.119192*t+.9503041*i)/fb);return it(116*r-16,500*(u-r),200*(r-f))}function go(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function ns(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function o(n){return"function"==typeof n?n:function(){return n}}function ts(n){return function(t,i,r){return 2===arguments.length&&"function"==typeof i&&(r=i,i=null),wu(t,i,n,r)}}function wu(t,i,r,u){function c(){var t,n=e.status;if(!n&&wk(e)||n>=200&&300>n||304===n){try{t=r.call(f,e)}catch(i){return void s.error.call(f,i)}s.load.call(f,t)}else s.error.call(f,e)}var f={},s=n.dispatch("beforesend","progress","load","error"),o={},e=new XMLHttpRequest,h=null;return!this.XDomainRequest||"withCredentials"in e||!/^(http(s)?:)?\/\//.test(t)||(e=new XDomainRequest),"onload"in e?e.onload=e.onerror=c:e.onreadystatechange=function(){e.readyState>3&&c()},e.onprogress=function(t){var i=n.event;n.event=t;try{s.progress.call(f,e)}finally{n.event=i}},f.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?o[n]:(null==t?delete o[n]:o[n]=t+"",f)},f.mimeType=function(n){return arguments.length?(i=null==n?null:n+"",f):i},f.responseType=function(n){return arguments.length?(h=n,f):h},f.response=function(n){return r=n,f},["get","post"].forEach(function(n){f[n]=function(){return f.send.apply(f,[n].concat(ti(arguments)))}}),f.send=function(n,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),e.open(n,t,!0),null==i||"accept"in o||(o.accept=i+",*/*"),e.setRequestHeader)for(var c in o)e.setRequestHeader(c,o[c]);return null!=i&&e.overrideMimeType&&e.overrideMimeType(i),null!=h&&(e.responseType=h),null!=u&&f.on("error",u).on("load",function(n){u(null,n)}),s.beforesend.call(f,e),e.send(null==r?null:r),f},f.abort=function(){return e.abort(),f},n.rebind(f,s,"on"),null==u?f:f.get(pk(u))}function pk(n){return 1===n.length?function(t,i){n(null==t?i:null)}:n}function wk(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function is(){var t=tv(),n=iv()-t;n>24?(isFinite(n)&&(clearTimeout(ae),ae=setTimeout(is,n)),le=0):(le=1,sc(is))}function tv(){var n=Date.now();for(pt=he;pt;)n>=pt.t&&(pt.f=pt.c(n-pt.t)),pt=pt.n;return n}function iv(){for(var t,n=he,i=1/0;n;)n.f?n=t?t.n=n.n:he=n.n:(n.t<i&&(i=n.t),n=(t=n).n);return ce=t,i}function rs(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function bk(n,t){var i=Math.pow(10,3*r(8-t));return{scale:t>8?function(n){return n/i}:function(n){return n*i},symbol:n}}function kk(t){var e=t.decimal,r=t.thousands,i=t.grouping,u=t.currency,f=i&&r?function(n,t){for(var f=n.length,o=[],s=0,u=i[0],e=0;f>0&&u>0&&(e+u+1>t&&(u=Math.max(1,t-e)),o.push(n.substring(f-=u,f+u)),!((e+=u+1)>t));)u=i[s=(s+1)%i.length];return o.reverse().join(r)}:v;return function(t){var o=ob.exec(t),y=o[1]||" ",s=o[2]||">",b=o[3]||"-",k=o[4]||"",l=o[5],p=+o[6],w=o[7],r=o[8],i=o[9],h=1,a="",c="",d=!1,g=!0,v;switch(r&&(r=+r.substring(1)),(l||"0"===y&&"="===s)&&(l=y="0",s="="),i){case"n":w=!0;i="g";break;case"%":h=100;c="%";i="f";break;case"p":h=100;c="%";i="r";break;case"b":case"o":case"x":case"X":"#"===k&&(a="0"+i.toLowerCase());case"c":g=!1;case"d":d=!0;r=0;break;case"s":h=-1;i="r"}return"$"===k&&(a=u[0],c=u[1]),"r"!=i||r||(i="g"),null!=r&&("g"==i?r=Math.max(1,Math.min(21,r)):("e"==i||"f"==i)&&(r=Math.max(0,Math.min(20,r)))),i=drt.get(i)||dk,v=l&&w,function(t){var ft=c,k,ut,u,nt,it,rt,tt,o;return d&&t%1?"":(k=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===b?"":b,0>h?(ut=n.formatPrefix(t,r),t=ut.scale(t),ft=ut.symbol+c):t*=h,t=i(t,r),it=t.lastIndexOf("."),0>it?(rt=g?t.lastIndexOf("e"):-1,0>rt?(u=t,nt=""):(u=t.substring(0,rt),nt=t.substring(rt))):(u=t.substring(0,it),nt=e+t.substring(it+1)),!l&&w&&(u=f(u,1/0)),tt=a.length+u.length+nt.length+(v?0:k.length),o=p>tt?new Array(tt=p-tt+1).join(y):"",v&&(u=f(o+u,o.length?p-nt.length:1/0)),k+=a,t=u+nt,("<"===s?k+t+o:">"===s?o+k+t:"^"===s?o.substring(0,tt>>=1)+k+t+o.substring(tt):k+(v?t:o+t))+ft)}}}function dk(n){return n+""}function vt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ci(n,t,i){function e(t){var i=n(t),r=f(i,1);return r-t>t-i?i:r}function u(i){return t(i=n(new y(i-1)),1),i}function f(n,i){return t(n=new y(+n),i),n}function o(n,r,f){var e=u(n),o=[];if(f>1)for(;r>e;)i(e)%f||o.push(new Date(+e)),t(e,1);else for(;r>e;)o.push(new Date(+e)),t(e,1);return o}function s(n,t,i){try{y=vt;var r=new vt;return r._=n,o(r,t,i)}finally{y=Date}}n.floor=n;n.round=e;n.ceil=u;n.offset=f;n.range=o;var r=n.utc=bu(n);return r.floor=r,r.round=bu(e),r.ceil=bu(u),r.offset=bu(f),r.range=s,n}function bu(n){return function(t,i){try{y=vt;var r=new vt;return r._=t,n(r,i)._}finally{y=Date}}}function gk(t){function r(n){function t(t){for(var f,o,h,e=[],r=-1,s=0;++r<i;)37===n.charCodeAt(r)&&(e.push(n.slice(s,r)),null!=(o=sb[f=n.charAt(++r)])&&(f=n.charAt(++r)),(h=u[f])&&(f=h(t,null==o?"e"===f?" ":"0":o)),e.push(f),s=r+1);return e.push(n.slice(s,r)),e.join("")}var i=n.length;return t.parse=function(t){var i={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},e=f(i,n,t,0),u,r;return e!=t.length?null:("p"in i&&(i.H=i.H%12+12*i.p),u=null!=i.Z&&y!==vt,r=new(u?vt:y),"j"in i?r.setFullYear(i.y,0,i.j):"w"in i&&("W"in i||"U"in i)?(r.setFullYear(i.y,0,1),r.setFullYear(i.y,0,"W"in i?(i.w+6)%7+7*i.W-(r.getDay()+5)%7:i.w+7*i.U-(r.getDay()+6)%7)):r.setFullYear(i.y,i.m,i.d),r.setHours(i.H+(i.Z/100|0),i.M+i.Z%100,i.S,i.L),u?r._:r)},t.toString=function(){return n},t}function f(n,t,i,r){for(var f,e,o,u=0,s=t.length,h=i.length;s>u;){if(r>=h)return-1;if(f=t.charCodeAt(u++),37===f){if(o=t.charAt(u++),e=k[o in sb?t.charAt(u++):o],!e||(r=e(n,i,r))<0)return-1}else if(f!=i.charCodeAt(r++))return-1}return r}function d(n,t,i){v.lastIndex=0;var r=v.exec(t.slice(i));return r?(n.w=ct.get(r[0].toLowerCase()),i+r[0].length):-1}function g(n,t,i){a.lastIndex=0;var r=a.exec(t.slice(i));return r?(n.w=ht.get(r[0].toLowerCase()),i+r[0].length):-1}function nt(n,t,i){b.lastIndex=0;var r=b.exec(t.slice(i));return r?(n.m=at.get(r[0].toLowerCase()),i+r[0].length):-1}function tt(n,t,i){p.lastIndex=0;var r=p.exec(t.slice(i));return r?(n.m=lt.get(r[0].toLowerCase()),i+r[0].length):-1}function it(n,t,i){return f(n,u.c.toString(),t,i)}function rt(n,t,i){return f(n,u.x.toString(),t,i)}function ut(n,t,i){return f(n,u.X.toString(),t,i)}function ft(n,t,i){var r=l.get(t.slice(i,i+=2).toLowerCase());return null==r?-1:(n.p=r,i)}var et=t.dateTime,ot=t.date,st=t.time,c=t.periods,e=t.days,o=t.shortDays,s=t.months,h=t.shortMonths,u,k;r.utc=function(n){function t(n){try{y=vt;var t=new y;return t._=n,i(t)}finally{y=Date}}var i=r(n);return t.parse=function(n){try{y=vt;var t=i.parse(n);return t&&t._}finally{y=Date}},t.toString=i.toString,t};r.multi=r.utc.multi=yd;var l=n.map(),a=ku(e),ht=du(e),v=ku(o),ct=du(o),p=ku(s),lt=du(s),b=ku(h),at=du(h);return c.forEach(function(n,t){l.set(n.toLowerCase(),t)}),u={a:function(n){return o[n.getDay()]},A:function(n){return e[n.getDay()]},b:function(n){return h[n.getMonth()]},B:function(n){return s[n.getMonth()]},c:r(et),d:function(n,t){return w(n.getDate(),t,2)},e:function(n,t){return w(n.getDate(),t,2)},H:function(n,t){return w(n.getHours(),t,2)},I:function(n,t){return w(n.getHours()%12||12,t,2)},j:function(n,t){return w(1+i.dayOfYear(n),t,3)},L:function(n,t){return w(n.getMilliseconds(),t,3)},m:function(n,t){return w(n.getMonth()+1,t,2)},M:function(n,t){return w(n.getMinutes(),t,2)},p:function(n){return c[+(n.getHours()>=12)]},S:function(n,t){return w(n.getSeconds(),t,2)},U:function(n,t){return w(i.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return w(i.mondayOfYear(n),t,2)},x:r(ot),X:r(st),y:function(n,t){return w(n.getFullYear()%100,t,2)},Y:function(n,t){return w(n.getFullYear()%1e4,t,4)},Z:ad,"%":function(){return"%"}},k={a:d,A:g,b:nt,B:tt,c:it,d:rv,e:rv,H:uv,I:uv,j:sd,L:ld,m:od,M:hd,p:ft,S:cd,U:td,w:nd,W:id,x:rt,X:ut,y:ud,Y:rd,Z:fd,"%":vd},r}function w(n,t,i){var u=0>n?"-":"",r=(u?-n:n)+"",f=r.length;return u+(i>f?new Array(i-f+1).join(t)+r:r)}function ku(t){return new RegExp("^(?:"+t.map(n.requote).join("|")+")","i")}function du(n){for(var i=new lt,t=-1,r=n.length;++t<r;)i.set(n[t].toLowerCase(),t);return i}function nd(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+1));return r?(n.w=+r[0],i+r[0].length):-1}function td(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i));return r?(n.U=+r[0],i+r[0].length):-1}function id(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i));return r?(n.W=+r[0],i+r[0].length):-1}function rd(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+4));return r?(n.y=+r[0],i+r[0].length):-1}function ud(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+2));return r?(n.y=ed(+r[0]),i+r[0].length):-1}function fd(n,t,i){return/^[+-]\d{4}$/.test(t=t.slice(i,i+5))?(n.Z=-t,i+5):-1}function ed(n){return n+(n>68?1900:2e3)}function od(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+2));return r?(n.m=r[0]-1,i+r[0].length):-1}function rv(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+2));return r?(n.d=+r[0],i+r[0].length):-1}function sd(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+3));return r?(n.j=+r[0],i+r[0].length):-1}function uv(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+2));return r?(n.H=+r[0],i+r[0].length):-1}function hd(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+2));return r?(n.M=+r[0],i+r[0].length):-1}function cd(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+2));return r?(n.S=+r[0],i+r[0].length):-1}function ld(n,t,i){c.lastIndex=0;var r=c.exec(t.slice(i,i+3));return r?(n.L=+r[0],i+r[0].length):-1}function ad(n){var t=n.getTimezoneOffset(),i=t>0?"-":"+",u=r(t)/60|0,f=r(t)%60;return i+w(u,"0",2)+w(f,"0",2)}function vd(n,t,i){hb.lastIndex=0;var r=hb.exec(t.slice(i,i+1));return r?i+r[0].length:-1}function yd(n){for(var i=n.length,t=-1;++t<i;)n[t][0]=this(n[t][0]);return function(t){for(var r=0,i=n[r];!i[1](t);)i=n[++r];return i[0](t)}}function us(){}function fv(n,t,i){var r=i.s=n+t,u=r-n,f=r-u;i.t=n-f+(t-u)}function gu(n,t){n&&lc.hasOwnProperty(n.type)&&lc[n.type](n,t)}function fs(n,t,i){var r,u=-1,f=n.length-i;for(t.lineStart();++u<f;)r=n[u],t.point(r[0],r[1],r[2]);t.lineEnd()}function ev(n,t){var i=-1,r=n.length;for(t.polygonStart();++i<r;)fs(n[i],t,1);t.polygonEnd()}function pd(){function r(r,e){r*=u;e=e*u/2+f/4;var o=r-n,s=o>=0?1:-1,h=s*o,c=Math.cos(e),l=Math.sin(e),a=i*l,v=t*c+a*Math.cos(h),y=a*s*Math.sin(h);ii.add(Math.atan2(y,v));n=r;t=c;i=l}var e,o,n,t,i;k.point=function(s,h){k.point=r;n=(e=s)*u;t=Math.cos(h=(o=h)*u/2+f/4);i=Math.sin(h)};k.lineEnd=function(){r(e,o)}}function li(n){var t=n[0],i=n[1],r=Math.cos(i);return[r*Math.cos(t),r*Math.sin(t),Math.sin(i)]}function nf(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function ir(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function es(n,t){n[0]+=t[0];n[1]+=t[1];n[2]+=t[2]}function tf(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function rf(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t;n[1]/=t;n[2]/=t}function uf(n){return[Math.atan2(n[1],n[0]),gt(n[2])]}function ff(n,i){return r(n[0]-i[0])<t&&r(n[1]-i[1])<t}function os(n,t){n*=u;var i=Math.cos(t*=u);vr(i*Math.cos(n),i*Math.sin(n),Math.sin(t))}function vr(n,t,i){++ou;wi+=(n-wi)/ou;bi+=(t-bi)/ou;wt+=(i-wt)/ou}function ov(){function r(r,f){r*=u;var c=Math.cos(f*=u),o=c*Math.cos(r),s=c*Math.sin(r),h=Math.sin(f),e=Math.atan2(Math.sqrt((e=t*h-i*s)*e+(e=i*o-n*h)*e+(e=n*s-t*o)*e),n*o+t*s+i*h);ye+=e;ri+=e*(n+(n=o));ui+=e*(t+(t=s));ht+=e*(i+(i=h));vr(n,t,i)}var n,t,i;rt.point=function(f,e){f*=u;var o=Math.cos(e*=u);n=o*Math.cos(f);t=o*Math.sin(f);i=Math.sin(e);rt.point=r;vr(n,t,i)}}function sv(){rt.point=os}function wd(){function r(r,f){r*=u;var p=Math.cos(f*=u),e=p*Math.cos(r),o=p*Math.sin(r),s=Math.sin(f),c=t*s-i*o,l=i*e-n*s,a=n*o-t*e,v=Math.sqrt(c*c+l*l+a*a),w=n*e+t*o+i*s,y=v&&-va(w)/v,h=Math.atan2(v,w);sr+=y*c;hr+=y*l;fi+=y*a;ye+=h;ri+=h*(n+(n=e));ui+=h*(t+(t=o));ht+=h*(i+(i=s));vr(n,t,i)}var f,e,n,t,i;rt.point=function(o,s){f=o;e=s;rt.point=r;o*=u;var h=Math.cos(s*=u);n=h*Math.cos(o);t=h*Math.sin(o);i=Math.sin(s);vr(n,t,i)};rt.lineEnd=function(){r(f,e);rt.lineEnd=sv;rt.point=os}}function hv(n,t){function i(i,r){return i=n(i,r),t(i[0],i[1])}return n.invert&&t.invert&&(i.invert=function(i,r){return i=t.invert(i,r),i&&n.invert(i[0],i[1])}),i}function rr(){return!0}function cv(n,t,i,r,u){var h=[],s=[],o,l,v,f,c,a,e;if(n.forEach(function(n){var o,i,f,e,t,r;if(!((o=n.length-1)<=0)){if(i=n[0],f=n[o],ff(i,f)){for(u.lineStart(),e=0;o>e;++e)u.point((i=n[e])[0],i[1]);return void u.lineEnd()}t=new ef(i,n,null,!0);r=new ef(i,null,t,!1);t.o=r;h.push(t);s.push(r);t=new ef(f,n,null,!1);r=new ef(f,null,t,!0);t.o=r;h.push(t);s.push(r)}}),s.sort(t),lv(h),lv(s),h.length){for(var e=0,y=i,a=s.length;a>e;++e)s[e].e=y=!y;for(v=h[0];;){for(f=v,c=!0;f.v;)if((f=f.n)===v)return;o=f.z;u.lineStart();do{if(f.v=f.o.v=!0,f.e){if(c)for(e=0,a=o.length;a>e;++e)u.point((l=o[e])[0],l[1]);else r(f.x,f.n.x,1,u);f=f.n}else{if(c)for(o=f.p.z,e=o.length-1;e>=0;--e)u.point((l=o[e])[0],l[1]);else r(f.x,f.p.x,-1,u);f=f.p}f=f.o;o=f.z;c=!c}while(!f.v);u.lineEnd()}}}function lv(n){if(r=n.length){for(var r,t,u=0,i=n[0];++u<r;)i.n=t=n[u],t.p=i,i=t;i.n=t=n[0];t.p=i}}function ef(n,t,i,r){this.x=n;this.z=t;this.o=i;this.e=r;this.v=!1;this.n=this.p=null}function av(t,i,r,u){return function(f,e){function v(n,i){var r=f(n,i);t(n=r[0],i=r[1])&&e.point(n,i)}function d(n,t){var i=f(n,t);y.point(i[0],i[1])}function p(){o.point=d;y.lineStart()}function w(){o.point=v;y.lineEnd()}function b(n,t){c.push([n,t]);var i=f(n,t);a.point(i[0],i[1])}function g(){a.lineStart();c=[]}function nt(){var f,t,r;b(c[0][0],c[0][1]);a.lineEnd();var i,u=a.clean(),n=k.buffer(),t=n.length;if(c.pop(),l.push(c),c=null,t)if(1&u){if(i=n[0],t=i.length-1,r=-1,t>0){for(s||(e.polygonStart(),s=!0),e.lineStart();++r<t;)e.point((f=i[r])[0],f[1]);e.lineEnd()}}else t>1&&2&u&&n.push(n.pop().concat(n.shift())),h.push(n.filter(bd))}var h,l,c,y=i(e),tt=f.invert(u[0],u[1]),o={point:v,lineStart:p,lineEnd:w,polygonStart:function(){o.point=b;o.lineStart=g;o.lineEnd=nt;h=[];l=[]},polygonEnd:function(){o.point=v;o.lineStart=p;o.lineEnd=w;h=n.merge(h);var t=tg(tt,l);h.length?(s||(e.polygonStart(),s=!0),cv(h,kd,t,r,e)):t&&(s||(e.polygonStart(),s=!0),e.lineStart(),r(null,null,1,e),e.lineEnd());s&&(e.polygonEnd(),s=!1);h=l=null},sphere:function(){e.polygonStart();e.lineStart();r(null,null,1,e);e.lineEnd();e.polygonEnd()}},k=vv(),a=i(k),s=!1;return o}}function bd(n){return n.length>1}function vv(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,i){t.push([n,i])},lineEnd:l,buffer:function(){var i=n;return n=[],t=null,i},rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))}}}function kd(n,i){return((n=n.x)[0]<0?n[1]-h-t:h-n[1])-((i=i.x)[0]<0?i[1]-h-t:h-i[1])}function dd(n){var o,u=NaN,i=NaN,e=NaN;return{lineStart:function(){n.lineStart();o=1},point:function(s,c){var l=s>0?f:-f,a=r(s-u);r(a-f)<t?(n.point(u,i=(i+c)/2>0?h:-h),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(l,i),n.point(s,i),o=0):e!==l&&a>=f&&(r(u-e)<t&&(u-=e*t),r(s-l)<t&&(s-=l*t),i=gd(u,i,s,c),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(l,i),o=0);n.point(u=s,i=c);e=l},lineEnd:function(){n.lineEnd();u=i=NaN},clean:function(){return 2-o}}}function gd(n,i,u,f){var e,o,s=Math.sin(n-u);return r(s)>t?Math.atan((Math.sin(i)*(o=Math.cos(f))*Math.sin(u)-Math.sin(f)*(e=Math.cos(i))*Math.sin(n))/(e*o*s)):(i+f)/2}function ng(n,i,u,e){var o,s;null==n?(o=u*h,e.point(-f,o),e.point(0,o),e.point(f,o),e.point(f,0),e.point(f,-o),e.point(0,-o),e.point(-f,-o),e.point(-f,0),e.point(-f,o)):r(n[0]-i[0])>t?(s=n[0]<i[0]?f:-f,o=u*s/2,e.point(-s,o),e.point(0,o),e.point(s,o)):e.point(i[0],i[1])}function tg(n,i){var e=n[0],nt=n[1],ct=[Math.sin(e),-Math.cos(e),0],a=0,tt=0,o,it,s,v,u,k,d;for(ii.reset(),o=0,it=i.length;it>o;++o)if(s=i[o],v=s.length,v)for(var h=s[0],y=h[0],rt=h[1]/2+f/4,ut=Math.sin(rt),ft=Math.cos(rt),c=1;;){c===v&&(c=0);n=s[c];var p=n[0],et=n[1]/2+f/4,ot=Math.sin(et),st=Math.cos(et),r=p-y,w=r>=0?1:-1,b=w*r,l=b>f,ht=ut*ot;if((ii.add(Math.atan2(ht*w*Math.sin(b),ft*st+ht*Math.cos(b))),a+=l?r+w*g:r,l^y>=e^p>=e)&&(u=ir(li(h),li(n)),rf(u),k=ir(ct,u),rf(k),d=(l^r>=0?-1:1)*gt(k[2]),(nt>d||nt===d&&(u[0]||u[1]))&&(tt+=l^r>=0?1:-1)),!c++)break;y=p;ut=ot;ft=st;h=n}return(-t>a||t>a&&0>ii)^1&tt}function ig(n){function s(n,t){return Math.cos(n)*Math.cos(t)>i}function c(n){var i,a,r,c,u;return{lineStart:function(){c=r=!1;u=1},point:function(v,y){var w,p=[v,y],b=s(v,y),d=e?b?0:h(v,y):b?h(v+(0>v?f:-f),y):0,k;(!i&&(c=r=b)&&n.lineStart(),b!==r&&(w=o(i,p),(ff(i,w)||ff(p,w))&&(p[0]+=t,p[1]+=t,b=s(p[0],p[1]))),b!==r)?(u=0,b?(n.lineStart(),w=o(p,i),n.point(w[0],w[1])):(w=o(i,p),n.point(w[0],w[1]),n.lineEnd()),i=w):l&&i&&e^b&&(d&a||!(k=o(p,i,!0))||(u=0,e?(n.lineStart(),n.point(k[0][0],k[0][1]),n.point(k[1][0],k[1][1]),n.lineEnd()):(n.point(k[1][0],k[1][1]),n.lineEnd(),n.lineStart(),n.point(k[0][0],k[0][1]))));!b||i&&ff(i,p)||n.point(p[0],p[1]);i=p;r=b;a=d},lineEnd:function(){r&&n.lineEnd();i=null},clean:function(){return u|(c&&r)<<1}}}function o(n,u,e){var et=li(n),ot=li(u),rt=[1,0,0],a=ir(et,ot),ut=nf(a,a),b=a[0],k=ut-b*b,g,o,it;if(!k)return!e&&n;var st=i*ut/k,ht=-i*b/k,ct=ir(rt,a),s=tf(rt,st),lt=tf(a,ht);es(s,lt);var v=ct,p=nf(s,v),d=nf(v,v),ft=p*p-d*(nf(s,s)-1);if(!(0>ft)){if(g=Math.sqrt(ft),o=tf(v,(-p-g)/d),es(o,s),o=uf(o),!e)return o;var w,h=n[0],y=u[0],c=n[1],l=u[1];h>y&&(w=h,h=y,y=w);var nt=y-h,tt=r(nt-f)<t,at=tt||t>nt;if(!tt&&c>l&&(w=c,c=l,l=w),at?tt?c+l>0^o[1]<(r(o[0]-h)<t?c:l):c<=o[1]&&o[1]<=l:nt>f^(h<=o[0]&&o[0]<=y))return it=tf(v,(-p+g)/d),es(it,s),[o,uf(it)]}}function h(t,i){var u=e?n:f-n,r=0;return-u>t?r|=1:t>u&&(r|=2),-u>i?r|=4:i>u&&(r|=8),r}var i=Math.cos(n),e=i>0,l=r(i)>t,a=ls(n,6*u);return av(s,c,a,e?[0,-n]:[-f,n-f])}function yv(n,t,i,r){return function(u){var f,a=u.a,v=u.b,c=a.x,l=a.y,y=v.x,p=v.y,e=0,o=1,s=y-c,h=p-l;if(f=n-c,s||!(f>0)){if(f/=s,0>s){if(e>f)return;o>f&&(o=f)}else if(s>0){if(f>o)return;f>e&&(e=f)}if(f=i-c,s||!(0>f)){if(f/=s,0>s){if(f>o)return;f>e&&(e=f)}else if(s>0){if(e>f)return;o>f&&(o=f)}if(f=t-l,h||!(f>0)){if(f/=h,0>h){if(e>f)return;o>f&&(o=f)}else if(h>0){if(f>o)return;f>e&&(e=f)}if(f=r-l,h||!(0>f)){if(f/=h,0>h){if(f>o)return;f>e&&(e=f)}else if(h>0){if(e>f)return;o>f&&(o=f)}return e>0&&(u.a={x:c+e*s,y:l+e*h}),1>o&&(u.b={x:c+o*s,y:l+o*h}),u}}}}}}function pv(i,u,f,e){function o(n,e){return r(n[0]-i)<t?e>0?0:3:r(n[0]-f)<t?e>0?2:1:r(n[1]-u)<t?e>0?1:0:e>0?3:2}function h(n,t){return s(n.x,t.x)}function s(n,t){var i=o(n,1),r=o(t,1);return i!==r?i-r:0===i?t[1]-n[1]:1===i?n[0]-t[0]:2===i?n[1]-t[1]:t[0]-n[0]}return function(t){function ft(n){for(var r=0,s=c.length,u=n[1],f=0;s>f;++f)for(var t,e=1,o=c[f],h=o.length,i=o[0];h>e;++e)t=o[e],i[1]<=u?t[1]>u&&vo(i,t,n)>0&&++r:t[1]<=u&&vo(i,t,n)<0&&--r,i=t;return 0!==r}function d(n,t,r,h){var c=0,l=0;if(null==n||(c=o(n,r))!==(l=o(t,r))||s(n,t)<0^r>0){do h.point(0===c||3===c?i:f,c>1?e:u);while((c=(c+r+4)%4)!==l)}else h.point(t[0],t[1])}function g(n,t){return n>=i&&f>=n&&t>=u&&e>=t}function nt(n,i){g(n,i)&&t.point(n,i)}function et(){k.point=tt;c&&c.push(v=[]);w=!0;l=!1;y=p=NaN}function ot(){r&&(tt(it,rt),ut&&l&&b.rejoin(),r.push(b.buffer()));k.point=nt;l&&t.lineEnd()}function tt(n,i){var r,u;n=Math.max(-pe,Math.min(pe,n));i=Math.max(-pe,Math.min(pe,i));r=g(n,i);(c&&v.push([n,i]),w)?(it=n,rt=i,ut=r,w=!1,r&&(t.lineStart(),t.point(n,i))):r&&l?t.point(n,i):(u={a:{x:y,y:p},b:{x:n,y:i}},ht(u)?(l||(t.lineStart(),t.point(u.a.x,u.a.y)),t.point(u.b.x,u.b.y),r||t.lineEnd(),a=!1):r&&(t.lineStart(),t.point(n,i),a=!1));y=n;p=i;l=r}var r,c,v,it,rt,ut,y,p,l,w,a,st=t,b=vv(),ht=yv(i,u,f,e),k={point:nt,lineStart:et,lineEnd:ot,polygonStart:function(){t=b;r=[];c=[];a=!0},polygonEnd:function(){t=st;r=n.merge(r);var u=ft([i,e]),f=a&&u,o=r.length;(f||o)&&(t.polygonStart(),f&&(t.lineStart(),d(null,null,1,t),t.lineEnd()),o&&cv(r,h,u,d,t),t.polygonEnd());r=c=v=null}};return k}}function ss(n){var t=0,i=f/3,r=hs(n),u=r(t,i);return u.parallels=function(n){return arguments.length?r(t=n[0]*f/180,i=n[1]*f/180):[t/f*180,i/f*180]},u}function wv(n,t){function f(n,t){var r=Math.sqrt(u-2*i*Math.sin(t))/i;return[r*Math.sin(n*=i),e-r*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,u=1+r*(2*i-r),e=Math.sqrt(u)/i;return f.invert=function(n,t){var r=e-t;return[Math.atan2(n,r)/i,gt((u-(n*n+r*r)*i*i)/(2*i))]},f}function rg(){function i(i,r){vc+=t*i-n*r;n=i;t=r}var r,u,n,t;ei.point=function(f,e){ei.point=i;r=n=f;u=t=e};ei.lineEnd=function(){i(r,u)}}function ug(n,t){we>n&&(we=n);n>ke&&(ke=n);be>t&&(be=t);t>de&&(de=t)}function fg(){function i(n,i){t.push("M",n,",",i,u)}function f(i,r){t.push("M",i,",",r);n.point=e}function e(n,i){t.push("L",n,",",i)}function r(){n.point=i}function o(){t.push("Z")}var u=bv(4.5),t=[],n={point:i,lineStart:function(){n.point=f},lineEnd:r,polygonStart:function(){n.lineEnd=o},polygonEnd:function(){n.lineEnd=r;n.point=i},pointRadius:function(t){return u=bv(t),n},result:function(){if(t.length){var n=t.join("");return t=[],n}}};return n}function bv(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function ai(n,t){wi+=n;bi+=t;++wt}function kv(){function i(i,r){var f=i-n,e=r-t,u=Math.sqrt(f*f+e*e);ri+=u*(n+i)/2;ui+=u*(t+r)/2;ht+=u;ai(n=i,t=r)}var n,t;ut.point=function(r,u){ut.point=i;ai(n=r,t=u)}}function dv(){ut.point=ai}function eg(){function i(i,r){var f=i-n,e=r-t,u=Math.sqrt(f*f+e*e);ri+=u*(n+i)/2;ui+=u*(t+r)/2;ht+=u;u=t*i-n*r;sr+=u*(n+i);hr+=u*(t+r);fi+=3*u;ai(n=i,t=r)}var r,u,n,t;ut.point=function(f,e){ut.point=i;ai(r=n=f,u=t=e)};ut.lineEnd=function(){i(r,u)}}function og(n){function i(t,i){n.moveTo(t+r,i);n.arc(t,i,r,0,g)}function f(i,r){n.moveTo(i,r);t.point=e}function e(t,i){n.lineTo(t,i)}function u(){t.point=i}function o(){n.closePath()}var r=4.5,t={point:i,lineStart:function(){t.point=f},lineEnd:u,polygonStart:function(){t.lineEnd=o},polygonEnd:function(){t.lineEnd=u;t.point=i},pointRadius:function(n){return r=n,t},result:l};return t}function gv(n){function o(n){return(e?h:s)(n)}function s(t){return ty(t,function(i,r){i=n(i,r);t.point(i[0],i[1])})}function h(t){function y(i,r){i=n(i,r);t.point(i[0],i[1])}function c(){u=NaN;r.point=l;t.lineStart()}function l(r,c){var l=li([r,c]),a=n(r,c);i(u,f,v,o,s,h,u=a[0],f=a[1],v=r,o=l[0],s=l[1],h=l[2],e,t);t.point(u,f)}function a(){r.point=y;t.lineEnd()}function nt(){c();r.point=tt;r.lineEnd=it}function tt(n,t){l(p=n,rt=t);w=u;b=f;k=o;d=s;g=h;r.point=l}function it(){i(u,f,v,o,s,h,w,b,p,k,d,g,e,t);r.lineEnd=a;a()}var p,rt,w,b,k,d,g,v,u,f,o,s,h,r={point:y,lineStart:c,lineEnd:a,polygonStart:function(){t.polygonStart();r.lineStart=nt},polygonEnd:function(){t.polygonEnd();r.lineStart=c}};return r}function i(u,e,o,s,h,l,a,v,y,p,w,b,k,d){var it=a-u,rt=v-e,et=it*it+rt*rt;if(et>4*f&&k--){var nt=s+p,tt=h+w,g=l+b,ot=Math.sqrt(nt*nt+tt*tt+g*g),vt=Math.asin(g/=ot),st=r(r(g)-1)<t||r(o-y)<t?(o+y)/2:Math.atan2(tt,nt),ht=n(st,vt),ut=ht[0],ft=ht[1],ct=ut-u,lt=ft-e,at=rt*ct-it*lt;(at*at/et>f||r((it*ct+rt*lt)/et-.5)>.3||c>s*p+h*w+l*b)&&(i(u,e,o,s,h,l,ut,ft,st,nt/=ot,tt/=ot,g,k,d),d.point(ut,ft),i(ut,ft,st,nt,tt,g,a,v,y,p,w,b,k,d))}}var f=.5,c=Math.cos(30*u),e=16;return o.precision=function(n){return arguments.length?(e=(f=n*n)>0&&16,o):Math.sqrt(f)},o}function sg(n){var t=gv(function(t,i){return n([t*s,i*s])});return function(n){return iy(t(n))}}function ny(n){this.stream=n}function ty(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ni(n){return hs(function(){return n})()}function hs(t){function i(n){return n=a(n[0]*u,n[1]*u),[n[0]*r+h,c-n[1]*r]}function et(n){return n=a.invert((n[0]-h)/r,(c-n[1])/r),n&&[n[0]*s,n[1]*s]}function e(){a=hv(tt=cs(k,d,g),o);var n=o(w,b);return h=y-n[0]*r,c=p+n[1]*r,l()}function l(){return f&&(f.valid=!1,f=null),i}var o,tt,a,h,c,f,it=gv(function(n,t){return n=o(n,t),[n[0]*r+h,c-n[1]*r]}),r=150,y=480,p=250,w=0,b=0,k=0,d=0,g=0,rt=cb,ut=v,nt=null,ft=null;return i.stream=function(n){return f&&(f.valid=!1),f=iy(rt(tt,it(ut(n)))),f.valid=!0,f},i.clipAngle=function(n){return arguments.length?(rt=null==n?(nt=n,cb):ig((nt=+n)*u),l()):nt},i.clipExtent=function(n){return arguments.length?(ft=n,ut=n?pv(n[0][0],n[0][1],n[1][0],n[1][1]):v,l()):ft},i.scale=function(n){return arguments.length?(r=+n,e()):r},i.translate=function(n){return arguments.length?(y=+n[0],p=+n[1],e()):[y,p]},i.center=function(n){return arguments.length?(w=n[0]%360*u,b=n[1]%360*u,e()):[w*s,b*s]},i.rotate=function(n){return arguments.length?(k=n[0]%360*u,d=n[1]%360*u,g=n.length>2?n[2]%360*u:0,e()):[k*s,d*s,g*s]},n.rebind(i,it,"precision"),function(){return o=t.apply(this,arguments),i.invert=o.invert&&et,e()}}function iy(n){return ty(n,function(t,i){n.point(t*u,i*u)})}function yr(n,t){return[n,t]}function ry(n,t){return[n>f?n-g:-f>n?n+g:n,t]}function cs(n,t,i){return n?t||i?hv(fy(n),ey(t,i)):fy(n):t||i?ey(t,i):ry}function uy(n){return function(t,i){return t+=n,[t>f?t-g:-f>t?t+g:t,i]}}function fy(n){var t=uy(n);return t.invert=uy(-n),t}function ey(n,t){function e(n,t){var e=Math.cos(t),o=Math.cos(n)*e,s=Math.sin(n)*e,h=Math.sin(t),c=h*i+o*r;return[Math.atan2(s*u-c*f,o*i-h*r),gt(c*u+s*f)]}var i=Math.cos(n),r=Math.sin(n),u=Math.cos(t),f=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),o=Math.cos(n)*e,s=Math.sin(n)*e,h=Math.sin(t),c=h*u-s*f;return[Math.atan2(s*u+h*f,o*i+c*r),gt(c*i-o*r)]},e}function ls(n,t){var i=Math.cos(n),r=Math.sin(n);return function(u,f,e,o){var h=e*t,c,s;for(null!=u?(u=oy(i,u),f=oy(i,f),(e>0?f>u:u>f)&&(u+=e*g)):(u=n+e*g,f=n-.5*h),s=u;e>0?s>f:f>s;s-=h)o.point((c=uf([i,-r*Math.cos(s),-r*Math.sin(s)]))[0],c[1])}}function oy(n,i){var r=li(i),u;return r[0]-=n,rf(r),u=va(-r[1]),((-r[2]<0?-u:u)+2*Math.PI-t)%(2*Math.PI)}function sy(i,r,u){var f=n.range(i,r-t,u).concat(r);return function(n){return f.map(function(t){return[n,t]})}}function hy(i,r,u){var f=n.range(i,r-t,u).concat(r);return function(n){return f.map(function(t){return[t,n]})}}function as(n){return n.source}function vs(n){return n.target}function hg(n,t,i,r){var f=Math.cos(t),c=Math.sin(t),e=Math.cos(r),l=Math.sin(r),a=f*Math.cos(n),v=f*Math.sin(n),y=e*Math.cos(i),p=e*Math.sin(i),u=2*Math.asin(Math.sqrt(pa(r-t)+f*e*pa(i-n))),o=1/Math.sin(u),h=u?function(n){var t=Math.sin(n*=u)*o,i=Math.sin(u-n)*o,r=i*a+t*y,f=i*v+t*p,e=i*c+t*l;return[Math.atan2(f,r)*s,Math.atan2(e,Math.sqrt(r*r+f*f))*s]}:function(){return[n*s,t*s]};return h.distance=u,h}function cg(){function f(f,e){var h=Math.sin(e*=u),s=Math.cos(e),o=r((f*=u)-i),c=Math.cos(o);yc+=Math.atan2(Math.sqrt((o=s*Math.sin(o))*o+(o=t*h-n*s*c)*o),n*h+t*s*c);i=f;n=h;t=s}var i,n,t;ki.point=function(r,e){i=r*u;n=Math.sin(e*=u);t=Math.cos(e);ki.point=f};ki.lineEnd=function(){ki.point=ki.lineEnd=l}}function pr(n,t){function i(t,i){var f=Math.cos(t),r=Math.cos(i),u=n(f*r);return[u*r*Math.sin(t),u*Math.sin(i)]}return i.invert=function(n,i){var r=Math.sqrt(n*n+i*i),u=t(r),f=Math.sin(u),e=Math.cos(u);return[Math.atan2(n*f,r*e),Math.asin(r&&i*f/r)]},i}function cy(n,i){function o(n,i){u>0?-h+t>i&&(i=-h+t):i>h-t&&(i=h-t);var f=u/Math.pow(e(i),r);return[f*Math.sin(r*n),u-f*Math.cos(r*n)]}var s=Math.cos(n),e=function(n){return Math.tan(f/4+n/2)},r=n===i?Math.sin(n):Math.log(s/Math.cos(i))/Math.log(e(i)/e(n)),u=s*Math.pow(e(n),r)/r;return r?(o.invert=function(n,t){var i=u-t,f=aa(r)*Math.sqrt(n*n+i*i);return[Math.atan2(n,i)/r,2*Math.atan(Math.pow(u/f,1/r))-h]},o):of}function ly(n,i){function e(n,t){var i=f-t;return[i*Math.sin(u*n),f-i*Math.cos(u*n)]}var o=Math.cos(n),u=n===i?Math.sin(n):(o-Math.cos(i))/(i-n),f=o/u+n;return r(u)<t?yr:(e.invert=function(n,t){var i=f-t;return[Math.atan2(n,i)/u,f-aa(u)*Math.sqrt(n*n+i*i)]},e)}function of(n,t){return[n,Math.log(Math.tan(f/4+t/2))]}function ay(n){var i,t=ni(n),r=t.scale,u=t.translate,e=t.clipExtent;return t.scale=function(){var n=r.apply(t,arguments);return n===t?i?t.clipExtent(null):t:n},t.translate=function(){var n=u.apply(t,arguments);return n===t?i?t.clipExtent(null):t:n},t.clipExtent=function(n){var h=e.apply(t,arguments),o,s;return h===t?(i=null==n)&&(o=f*r(),s=u(),e([[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]])):i&&(h=null),h},t.clipExtent(null)}function ys(n,t){return[Math.log(Math.tan(f/4+t/2)),-n]}function ur(n){return n[0]}function wr(n){return n[1]}function vy(n){for(var u=n.length,i=[0,1],t=2,r=2;u>r;r++){for(;t>1&&vo(n[i[t-2]],n[i[t-1]],n[r])<=0;)--t;i[t++]=r}return i.slice(0,t)}function lg(n,t){return n[0]-t[0]||n[1]-t[1]}function ps(n,t,i){return(i[0]-t[0])*(n[1]-t[1])<(i[1]-t[1])*(n[0]-t[0])}function ws(n,t,i,r){var u=n[0],e=i[0],o=t[0]-u,s=r[0]-e,f=n[1],h=i[1],c=t[1]-f,l=r[1]-h,a=(s*(f-h)-l*(u-e))/(l*o-s*c);return[u+a*o,f+a*c]}function yy(n){var t=n[0],i=n[n.length-1];return!(t[0]-i[0]||t[1]-i[1])}function ag(){cf(this);this.edge=this.site=this.circle=null}function py(n){var t=nl.pop()||new ag;return t.site=n,t}function bs(n){er(n);lr.remove(n);nl.push(n);cf(n)}function vg(n){var a=n.circle,o=a.x,s=a.cy,v={x:o,y:s},h=n.P,c=n.N,f=[n],u,i,e,l;for(bs(n),u=h;u.circle&&r(o-u.circle.x)<t&&r(s-u.circle.cy)<t;)h=u.P,f.unshift(u),bs(u),u=h;for(f.unshift(u),er(u),i=c;i.circle&&r(o-i.circle.x)<t&&r(s-i.circle.cy)<t;)c=i.N,f.push(i),bs(i),i=c;for(f.push(i),er(i),l=f.length,e=1;l>e;++e)i=f[e],u=f[e-1],sf(i.edge,u.site,i.site,v);u=f[0];i=f[l-1];i.edge=br(u.site,i.site,null,v);fr(u);fr(i)}function yg(n){for(var f,i,r,a,v,b=n.x,k=n.y,u=lr._;u;)if(a=wy(u,k)-b,a>t)u=u.L;else{if(v=b-pg(u,k),!(v>t)){a>-t?(i=u.P,r=u):v>-t?(i=u,r=u.N):i=r=u;break}if(!u.R){i=u;break}u=u.R}if(f=py(n),lr.insert(i,f),i||r){if(i===r)return er(i),r=py(i.site),lr.insert(f,r),f.edge=r.edge=br(i.site,f.site),fr(i),void fr(r);if(!r)return void(f.edge=br(i.site,f.site));er(i);er(r);var e=i.site,y=e.x,p=e.y,o=n.x-y,s=n.y-p,h=r.site,c=h.x-y,l=h.y-p,d=2*(o*l-s*c),g=o*o+s*s,nt=c*c+l*l,w={x:(l*g-s*nt)/d+y,y:(o*nt-c*g)/d+p};sf(r.edge,e,h,w);f.edge=br(e,n,null,w);r.edge=br(n,h,null,w);fr(i);fr(r)}}function wy(n,t){var i=n.site,u=i.x,l=i.y,f=l-t,e;if(!f)return u;if(e=n.P,!e)return-1/0;i=e.site;var o=i.x,a=i.y,r=a-t;if(!r)return o;var s=o-u,h=1/f-1/r,c=s/r;return h?(-c+Math.sqrt(c*c-2*h*(s*s/(-2*r)-a+r/2+l-f/2)))/h+u:(u+o)/2}function pg(n,t){var r=n.N,i;return r?wy(r,t):(i=n.site,i.y===t?i.x:1/0)}function by(n){this.site=n;this.edges=[]}function wg(n){for(var i,u,f,e,o,s,h,y,w,p,c=n[0][0],l=n[1][0],a=n[0][1],v=n[1][1],b=di,k=b.length;k--;)if(o=b[k],o&&o.prepare())for(h=o.edges,y=h.length,s=0;y>s;)p=h[s].end(),f=p.x,e=p.y,w=h[++s%y].start(),i=w.x,u=w.y,(r(f-i)>t||r(e-u)>t)&&(h.splice(s,0,new hf(gg(o.site,p,r(f-c)<t&&v-e>t?{x:c,y:r(i-c)<t?u:v}:r(e-v)<t&&l-f>t?{x:r(u-v)<t?i:l,y:v}:r(f-l)<t&&e-a>t?{x:l,y:r(i-l)<t?u:a}:r(e-a)<t&&f-c>t?{x:r(u-a)<t?i:c,y:a}:null),o.site,null)),++y)}function ky(n,t){return t.angle-n.angle}function bg(){cf(this);this.x=this.y=this.arc=this.site=this.cy=null}function fr(n){var w=n.P,b=n.N,u,t;if(w&&b){var s=w.site,h=n.site,c=b.site;if(s!==c){var l=h.x,a=h.y,f=s.x-l,e=s.y-a,o=c.x-l,r=c.y-a,v=2*(f*r-e*o);if(!(v>=-rc)){var k=f*f+e*e,d=o*o+r*r,y=(r*k-e*d)/v,p=(f*d-o*k)/v,r=p+a,i=tl.pop()||new bg;for(i.arc=n,i.site=h,i.x=y+l,i.y=r+Math.sqrt(y*y+p*p),i.cy=r,n.circle=i,u=null,t=hu._;t;)if(i.y<t.y||i.y===t.y&&i.x<=t.x){if(!t.L){u=t.P;break}t=t.L}else{if(!t.R){u=t;break}t=t.R}hu.insert(u,i);u||(gc=i)}}}}function er(n){var t=n.circle;t&&(t.P||(gc=t.N),hu.remove(t),tl.push(t),cf(t),n.circle=null)}function kg(n){for(var i,u=cr,e=yv(n[0][0],n[0][1],n[1][0],n[1][1]),f=u.length;f--;)i=u[f],(!dg(i,n)||!e(i)||r(i.a.x-i.b.x)<t&&r(i.a.y-i.b.y)<t)&&(i.a=i.b=null,u.splice(f,1))}function dg(n,t){var f=n.b;if(f)return!0;var r,u,i=n.a,h=t[0][0],c=t[1][0],e=t[0][1],o=t[1][1],p=n.l,w=n.r,l=p.x,a=p.y,v=w.x,y=w.y,s=(l+v)/2,b=(a+y)/2;if(y===a){if(h>s||s>=c)return;if(l>v){if(i){if(i.y>=o)return}else i={x:s,y:e};f={x:s,y:o}}else{if(i){if(i.y<e)return}else i={x:s,y:o};f={x:s,y:e}}}else if(r=(l-v)/(y-a),u=b-r*s,-1>r||r>1)if(l>v){if(i){if(i.y>=o)return}else i={x:(e-u)/r,y:e};f={x:(o-u)/r,y:o}}else{if(i){if(i.y<e)return}else i={x:(o-u)/r,y:o};f={x:(e-u)/r,y:e}}else if(y>a){if(i){if(i.x>=c)return}else i={x:h,y:r*h+u};f={x:c,y:r*c+u}}else{if(i){if(i.x<h)return}else i={x:c,y:r*c+u};f={x:h,y:r*h+u}}return n.a=i,n.b=f,!0}function dy(n,t){this.l=n;this.r=t;this.a=this.b=null}function br(n,t,i,r){var u=new dy(n,t);return cr.push(u),i&&sf(u,n,t,i),r&&sf(u,t,n,r),di[n.i].edges.push(new hf(u,n,t)),di[t.i].edges.push(new hf(u,t,n)),u}function gg(n,t,i){var r=new dy(n,null);return r.a=t,r.b=i,cr.push(r),r}function sf(n,t,i,r){n.a||n.b?n.l===i?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=i)}function hf(n,t,i){var r=n.a,u=n.b;this.edge=n;this.site=t;this.angle=i?Math.atan2(i.y-t.y,i.x-t.x):n.l===t?Math.atan2(u.x-r.x,r.y-u.y):Math.atan2(r.x-u.x,u.y-r.y)}function ks(){this._=null}function cf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function kr(n,t){var i=t,r=t.R,u=i.U;u?u.L===i?u.L=r:u.R=r:n._=r;r.U=u;i.U=r;i.R=r.L;i.R&&(i.R.U=i);r.L=i}function dr(n,t){var i=t,r=t.L,u=i.U;u?u.L===i?u.L=r:u.R=r:n._=r;r.U=u;i.U=r;i.L=r.R;i.L&&(i.L.U=i);r.R=i}function gy(n){for(;n.L;)n=n.L;return n}function ds(n,t){var u,f,r,i=n.sort(nn).pop(),e;for(cr=[],di=new Array(n.length),lr=new ks,hu=new ks;;)if(r=gc,i&&(!r||i.y<r.y||i.y===r.y&&i.x<r.x))(i.x!==u||i.y!==f)&&(di[i.i]=new by(i),yg(i),u=i.x,f=i.y),i=n.pop();else{if(!r)break;vg(r.arc)}return t&&(kg(t),wg(t)),e={cells:di,edges:cr},lr=hu=cr=di=null,e}function nn(n,t){return t.y-n.y||t.x-n.x}function tn(n,t,i){return(n.x-i.x)*(t.y-n.y)-(n.x-t.x)*(i.y-n.y)}function rn(n){return n.x}function un(n){return n.y}function np(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function gr(n,t,i,r,u,f){if(!n(t,i,r,u,f)){var o=.5*(i+u),s=.5*(r+f),e=t.nodes;e[0]&&gr(n,e[0],i,r,o,s);e[1]&&gr(n,e[1],o,r,u,s);e[2]&&gr(n,e[2],i,s,o,f);e[3]&&gr(n,e[3],o,s,u,f)}}function fn(n,t,i,r,u,f,e){var s,h=1/0;return function o(n,c,l,a,v){var y;if(!(c>f||l>e||r>a||u>v)){if(k=n.point){var k,d=t-n.x,g=i-n.y,nt=d*d+g*g;h>nt&&(y=Math.sqrt(h=nt),r=t-y,u=i-y,f=t+y,e=i+y,s=k)}for(var tt=n.nodes,p=.5*(c+a),w=.5*(l+v),it=t>=p,rt=i>=w,b=rt<<1|it,ut=b+4;ut>b;++b)if(n=tt[3&b])switch(3&b){case 0:o(n,c,l,p,w);break;case 1:o(n,p,l,a,w);break;case 2:o(n,c,w,p,v);break;case 3:o(n,p,w,a,v)}}}(n,r,u,f,e),s}function gs(t,i){t=n.rgb(t);i=n.rgb(i);var r=t.r,u=t.g,f=t.b,e=i.r-r,o=i.g-u,s=i.b-f;return function(n){return"#"+tr(Math.round(r+e*n))+tr(Math.round(u+o*n))+tr(Math.round(f+s*n))}}function tp(n,t){var i,u={},r={};for(i in n)i in t?u[i]=vi(n[i],t[i]):r[i]=n[i];for(i in t)i in n||(r[i]=t[i]);return function(n){for(i in u)r[i]=u[i](n);return r}}function yt(n,t){return n=+n,t=+t,function(i){return n*(1-i)+t*i}}function ip(n,t){var s,f,u,e=ge.lastIndex=no.lastIndex=0,r=-1,i=[],o=[];for(n+="",t+="";(s=ge.exec(n))&&(f=no.exec(t));)(u=f.index)>e&&(u=t.slice(e,u),i[r]?i[r]+=u:i[++r]=u),(s=s[0])===(f=f[0])?i[r]?i[r]+=f:i[++r]=f:(i[++r]=null,o.push({i:r,x:yt(s,f)})),e=no.lastIndex;return e<t.length&&(u=t.slice(e),i[r]?i[r]+=u:i[++r]=u),i.length<2?o[0]?(t=o[0].x,function(n){return t(n)+""}):function(){return t}:(t=o.length,function(n){for(var u,r=0;t>r;++r)i[(u=o[r]).i]=u.x(n);return i.join("")})}function vi(t,i){for(var r,u=n.interpolators.length;--u>=0&&!(r=n.interpolators[u](t,i)););return r}function lf(n,t){for(var u=[],r=[],e=n.length,o=t.length,f=Math.min(n.length,t.length),i=0;f>i;++i)u.push(vi(n[i],t[i]));for(;e>i;++i)r[i]=n[i];for(;o>i;++i)r[i]=t[i];return function(n){for(i=0;f>i;++i)r[i]=u[i](n);return r}}function en(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function rp(n){return function(t){return 1-n(1-t)}}function up(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function on(n){return n*n}function sn(n){return n*n*n}function hn(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,i=t*n;return 4*(.5>n?i:3*(n-t)+i-.75)}function cn(n){return function(t){return Math.pow(t,n)}}function ln(n){return 1-Math.cos(n*h)}function an(n){return Math.pow(2,10*(n-1))}function vn(n){return 1-Math.sqrt(1-n*n)}function yn(n,t){var i;return arguments.length<2&&(t=.45),arguments.length?i=t/g*Math.asin(1/n):(n=1,i=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-i)*g/t)}}function pn(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function wn(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function bn(t,i){t=n.hcl(t);i=n.hcl(i);var u=t.h,f=t.c,o=t.l,r=i.h-u,e=i.c-f,s=i.l-o;return isNaN(e)&&(e=0,f=isNaN(f)?i.c:f),isNaN(r)?(r=0,u=isNaN(u)?i.h:u):r>180?r-=360:-180>r&&(r+=360),function(n){return po(u+r*n,f+e*n,o+s*n)+""}}function kn(t,i){t=n.hsl(t);i=n.hsl(i);var u=t.h,f=t.s,o=t.l,r=i.h-u,e=i.s-f,s=i.l-o;return isNaN(e)&&(e=0,f=isNaN(f)?i.s:f),isNaN(r)?(r=0,u=isNaN(u)?i.h:u):r>180?r-=360:-180>r&&(r+=360),function(n){return yo(u+r*n,f+e*n,o+s*n)+""}}function dn(t,i){t=n.lab(t);i=n.lab(i);var r=t.l,u=t.a,f=t.b,e=i.l-r,o=i.a-u,s=i.b-f;return function(n){return wa(r+e*n,u+o*n,f+s*n)+""}}function fp(n,t){return t-=n,function(i){return Math.round(n+t*i)}}function ep(n){var t=[n.a,n.b],i=[n.c,n.d],r=sp(t),u=op(t,i),f=sp(gn(i,t,-u))||0;t[0]*i[1]<i[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,u*=-1);this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-i[0],i[1]))*s;this.translate=[n.e,n.f];this.scale=[r,f];this.skew=f?Math.atan2(u,f)*s:0}function op(n,t){return n[0]*t[0]+n[1]*t[1]}function sp(n){var t=Math.sqrt(op(n,n));return t&&(n[0]/=t,n[1]/=t),t}function gn(n,t,i){return n[0]+=i*t[0],n[1]+=i*t[1],n}function hp(t,i){var s,r=[],o=[],c=n.transform(t),l=n.transform(i),a=c.translate,u=l.translate,h=c.rotate,f=l.rotate,p=c.skew,v=l.skew,y=c.scale,e=l.scale;return a[0]!=u[0]||a[1]!=u[1]?(r.push("translate(",null,",",null,")"),o.push({i:1,x:yt(a[0],u[0])},{i:3,x:yt(a[1],u[1])})):r.push(u[0]||u[1]?"translate("+u+")":""),h!=f?(h-f>180?f+=360:f-h>180&&(h+=360),o.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:yt(h,f)})):f&&r.push(r.pop()+"rotate("+f+")"),p!=v?o.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:yt(p,v)}):v&&r.push(r.pop()+"skewX("+v+")"),y[0]!=e[0]||y[1]!=e[1]?(s=r.push(r.pop()+"scale(",null,",",null,")"),o.push({i:s-4,x:yt(y[0],e[0])},{i:s-2,x:yt(y[1],e[1])})):(1!=e[0]||1!=e[1])&&r.push(r.pop()+"scale("+e+")"),s=o.length,function(n){for(var t,i=-1;++i<s;)r[(t=o[i]).i]=t.x(n);return r.join("")}}function ntt(n,t){return t=(t-=n=+n)||1/t,function(i){return(i-n)/t}}function ttt(n,t){return t=(t-=n=+n)||1/t,function(i){return Math.max(0,Math.min(1,(i-n)/t))}}function itt(n){for(var f,t=n.source,i=n.target,u=rtt(t,i),r=[t];t!==u;)t=t.parent,r.push(t);for(f=r.length;i!==u;)r.splice(f,0,i),i=i.parent;return r}function cp(n){for(var i=[],t=n.parent;null!=t;)i.push(n),n=t,t=t.parent;return i.push(n),i}function rtt(n,t){if(n===t)return n;for(var r=cp(n),u=cp(t),i=r.pop(),f=u.pop(),e=null;i===f;)e=i,i=r.pop(),f=u.pop();return e}function utt(n){n.fixed|=2}function ftt(n){n.fixed&=-7}function ett(n){n.fixed|=4;n.px=n.x;n.py=n.y}function ott(n){n.fixed&=-5}function lp(n,t,i){var f=0,e=0,u;if(n.charge=0,!n.leaf)for(var r,o=n.nodes,h=o.length,s=-1;++s<h;)r=o[s],null!=r&&(lp(r,t,i),n.charge+=r.charge,f+=r.charge*r.cx,e+=r.charge*r.cy);n.point&&(n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5),u=t*i[n.point.index],n.charge+=n.pointCharge=u,f+=u*n.point.x,e+=u*n.point.y);n.cx=f/n.charge;n.cy=e/n.charge}function nu(t,i){return n.rebind(t,i,"sort","children","value"),t.nodes=t,t.links=ltt,t}function tu(n,t){for(var r,u,i=[n];null!=(n=i.pop());)if(t(n),(u=n.children)&&(r=u.length))for(;--r>=0;)i.push(u[r])}function et(n,t){for(var e,u,f,i=[n],r=[];null!=(n=i.pop());)if(r.push(n),(u=n.children)&&(e=u.length))for(f=-1;++f<e;)i.push(u[f]);for(;null!=(n=r.pop());)t(n)}function stt(n){return n.children}function htt(n){return n.value}function ctt(n,t){return t.value-n.value}function ltt(t){return n.merge(t.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function att(n){return n.x}function vtt(n){return n.y}function ytt(n,t,i){n.y0=t;n.y=i}function nh(t){return n.range(t.length)}function th(n){for(var t=-1,r=n[0].length,i=[];++t<r;)i[t]=0;return i}function ptt(n){for(var i,t=1,r=0,u=n[0][1],f=n.length;f>t;++t)(i=n[t][1])>u&&(r=t,u=i);return r}function wtt(n){return n.reduce(btt,0)}function btt(n,t){return n+t[1]}function ktt(n,t){return ap(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ap(n,t){for(var i=-1,r=+n[0],f=(n[1]-r)/t,u=[];++i<=t;)u[i]=f*i+r;return u}function dtt(t){return[n.min(t),n.max(t)]}function gtt(n,t){return n.value-t.value}function ih(n,t){var i=n._pack_next;n._pack_next=t;t._pack_prev=n;t._pack_next=i;i._pack_prev=t}function vp(n,t){n._pack_next=t;t._pack_prev=n}function yp(n,t){var i=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>i*i+r*r}function pp(n){function h(n){c=Math.min(n.x-n.r,c);l=Math.max(n.x+n.r,l);a=Math.min(n.y-n.r,a);v=Math.max(n.y+n.r,v)}if((u=n.children)&&(s=u.length)){var u,i,r,t,f,e,o,s,c=1/0,l=-1/0,a=1/0,v=-1/0;if(u.forEach(nit),i=u[0],i.x=-i.r,i.y=0,h(i),s>1&&(r=u[1],r.x=r.r,r.y=0,h(r),s>2))for(t=u[2],bp(i,r,t),h(t),ih(i,t),i._pack_prev=t,ih(t,r),r=i._pack_next,f=3;s>f;f++){bp(i,r,t=u[f]);var y=0,p=1,w=1;for(e=r._pack_next;e!==r;e=e._pack_next,p++)if(yp(e,t)){y=1;break}if(1==y)for(o=i._pack_prev;o!==e._pack_prev&&!yp(o,t);o=o._pack_prev,w++);y?(w>p||p==w&&r.r<i.r?vp(i,r=e):vp(i=o,r),f--):(ih(i,t),r=t,h(t))}var k=(c+l)/2,d=(a+v)/2,b=0;for(f=0;s>f;f++)t=u[f],t.x-=k,t.y-=d,b=Math.max(b,t.r+Math.sqrt(t.x*t.x+t.y*t.y));n.r=b;u.forEach(tit)}}function nit(n){n._pack_next=n._pack_prev=n}function tit(n){delete n._pack_next;delete n._pack_prev}function wp(n,t,i,r){var u=n.children,f,e;if(n.x=t+=r*n.x,n.y=i+=r*n.y,n.r*=r,u)for(f=-1,e=u.length;++f<e;)wp(u[f],t,i,r)}function bp(n,t,i){var r=n.r+i.r,f=t.x-n.x,e=t.y-n.y,u,o,s,h;r&&(f||e)?(u=t.r+i.r,o=f*f+e*e,u*=u,r*=r,s=.5+(r-u)/(2*o),h=Math.sqrt(Math.max(0,2*u*(r+o)-(r-=o)*r-u*u))/(2*o),i.x=n.x+s*f+h*e,i.y=n.y+s*e-h*f):(i.x=n.x+r,i.y=n.y)}function kp(n,t){return n.parent==t.parent?1:2}function rh(n){var t=n.children;return t.length?t[0]:n.t}function uh(n){var t,i=n.children;return(t=i.length)?i[t-1]:n.t}function iit(n,t,i){var r=i/(t.i-n.i);t.c-=r;t.s+=i;n.c+=r;t.z+=i;t.m+=i}function rit(n){for(var t,i=0,f=0,r=n.children,u=r.length;--u>=0;)t=r[u],t.z+=i,t.m+=i,i+=t.s+(f+=t.c)}function uit(n,t,i){return n.a.parent===t.parent?n.a:i}function fit(t){return 1+n.max(t,function(n){return n.y})}function eit(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function dp(n){var t=n.children;return t&&t.length?dp(t[0]):n}function gp(n){var i,t=n.children;return t&&(i=t.length)?gp(t[i-1]):n}function fh(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function nw(n,t){var u=n.x+t[3],f=n.y+t[0],i=n.dx-t[1]-t[3],r=n.dy-t[0]-t[2];return 0>i&&(u+=i/2,i=0),0>r&&(f+=r/2,r=0),{x:u,y:f,dx:i,dy:r}}function or(n){var t=n[0],i=n[n.length-1];return i>t?[t,i]:[i,t]}function af(n){return n.rangeExtent?n.rangeExtent():or(n.range())}function oit(n,t,i,r){var u=i(n[0],n[1]),f=r(t[0],t[1]);return function(n){return f(u(n))}}function eh(n,t){var i,r=0,u=n.length-1,f=n[r],e=n[u];return f>e&&(i=r,r=u,u=i,i=f,f=e,e=i),n[r]=t.floor(f),n[u]=t.ceil(e),n}function sit(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:pb}function hit(t,i,r,u){var o=[],s=[],f=0,e=Math.min(t.length,i.length)-1;for(t[e]<t[0]&&(t=t.slice().reverse(),i=i.slice().reverse());++f<=e;)o.push(r(t[f-1],t[f])),s.push(u(i[f-1],i[f]));return function(i){var r=n.bisect(t,i,1,e)-1;return s[r](o[r](i))}}function tw(n,t,i,r){function f(){var f=Math.min(n.length,t.length)>2?hit:oit,s=r?ttt:ntt;return e=f(n,t,s,i),o=f(t,n,s,vi),u}function u(n){return e(n)}var e,o;return u.invert=function(n){return o(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),f()):n},u.range=function(n){return arguments.length?(t=n,f()):t},u.rangeRound=function(n){return u.range(n).interpolate(fp)},u.clamp=function(n){return arguments.length?(r=n,f()):r},u.interpolate=function(n){return arguments.length?(i=n,f()):i},u.ticks=function(t){return sh(n,t)},u.tickFormat=function(t,i){return hh(n,t,i)},u.nice=function(t){return iw(n,t),f()},u.copy=function(){return tw(n,t,i,r)},f()}function oh(t,i){return n.rebind(t,i,"range","rangeRound","interpolate","clamp")}function iw(n,t){return eh(n,sit(iu(n,t)[2]))}function iu(n,t){null==t&&(t=10);var r=or(n),f=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(f/t)/Math.LN10)),u=t/f*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function sh(t,i){return n.range.apply(n,iu(t,i))}function hh(t,i,u){var e=iu(t,i),f,o;if(u){if(f=ob.exec(u),f.shift(),"s"===f[8])return o=n.formatPrefix(Math.max(r(e[0]),r(e[1]))),f[7]||(f[7]="."+vf(o.scale(e[2]))),f[8]="f",u=n.format(f.join("")),function(n){return u(o.scale(n))+o.symbol};f[7]||(f[7]="."+cit(f[8],e));u=f.join("")}else u=",."+vf(e[2])+"f";return n.format(u)}function vf(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function cit(n,t){var i=vf(t[2]);return n in wb?Math.abs(i-vf(Math.max(r(t[0]),r(t[1]))))+ +("e"!==n):i-2*("%"===n)}function rw(t,i,r,u){function e(n){return(r?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(i)}function o(n){return r?Math.pow(i,n):-Math.pow(i,-n)}function f(n){return t(e(n))}return f.invert=function(n){return o(t.invert(n))},f.domain=function(n){return arguments.length?(r=n[0]>=0,t.domain((u=n.map(Number)).map(e)),f):u},f.base=function(n){return arguments.length?(i=+n,t.domain(u.map(e)),f):i},f.nice=function(){var n=eh(u.map(e),r?Math:bb);return t.domain(n),u=n.map(o),f},f.ticks=function(){var h=or(u),t=[],c=h[0],l=h[1],n=Math.floor(e(c)),s=Math.ceil(e(l)),a=i%1?2:i,f;if(isFinite(s-n)){if(r){for(;s>n;n++)for(f=1;a>f;f++)t.push(o(n)*f);t.push(o(n))}else for(t.push(o(n));n++<s;)for(f=a-1;f>0;f--)t.push(o(n)*f);for(n=0;t[n]<c;n++);for(s=t.length;t[s-1]>l;s--);t=t.slice(n,s)}return t},f.tickFormat=function(t,i){if(!arguments.length)return rl;arguments.length<2?i=rl:"function"!=typeof i&&(i=n.format(i));var u,s=Math.max(.1,t/f.ticks().length),h=r?(u=1e-12,Math.ceil):(u=-1e-12,Math.floor);return function(n){return n/o(h(e(n)+u))<=s?i(n):""}},f.copy=function(){return rw(t.copy(),i,r,u)},oh(f,t)}function uw(n,t,i){function r(t){return n(u(t))}var u=yf(t),f=yf(1/t);return r.invert=function(t){return f(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((i=t.map(Number)).map(u)),r):i},r.ticks=function(n){return sh(i,n)},r.tickFormat=function(n,t){return hh(i,n,t)},r.nice=function(n){return r.domain(iw(i,n))},r.exponent=function(e){return arguments.length?(u=yf(t=e),f=yf(1/t),n.domain(i.map(u)),r):t},r.copy=function(){return uw(n.copy(),t,i)},oh(r,n)}function yf(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function fw(t,i){function r(n){return u[((e.get(n)||("range"===i.t?e.set(n,t.push(n)):NaN))-1)%u.length]}function o(i,r){return n.range(t.length).map(function(n){return i+r*n})}var e,u,f;return r.domain=function(n){if(!arguments.length)return t;t=[];e=new lt;for(var u,f=-1,o=n.length;++f<o;)e.has(u=n[f])||e.set(u,t.push(u));return r[i.t].apply(r,i.a)},r.range=function(n){return arguments.length?(u=n,f=0,i={t:"range",a:arguments},r):u},r.rangePoints=function(n,e){arguments.length<2&&(e=0);var s=n[0],h=n[1],c=t.length<2?(s=(s+h)/2,0):(h-s)/(t.length-1+e);return u=o(s+c*e/2,c),f=0,i={t:"rangePoints",a:arguments},r},r.rangeRoundPoints=function(n,e){arguments.length<2&&(e=0);var s=n[0],h=n[1],c=t.length<2?(s=h=Math.round((s+h)/2),0):(h-s)/(t.length-1+e)|0;return u=o(s+Math.round(c*e/2+(h-s-(t.length-1+e)*c)/2),c),f=0,i={t:"rangeRoundPoints",a:arguments},r},r.rangeBands=function(n,e,s){arguments.length<2&&(e=0);arguments.length<3&&(s=e);var h=n[1]<n[0],l=n[+h],a=n[1-h],c=(a-l)/(t.length-e+2*s);return u=o(l+c*s,c),h&&u.reverse(),f=c*(1-e),i={t:"rangeBands",a:arguments},r},r.rangeRoundBands=function(n,e,s){arguments.length<2&&(e=0);arguments.length<3&&(s=e);var h=n[1]<n[0],c=n[+h],a=n[1-h],l=Math.floor((a-c)/(t.length-e+2*s));return u=o(c+Math.round((a-c-(t.length-e)*l)/2),l),h&&u.reverse(),f=Math.round(l*(1-e)),i={t:"rangeRoundBands",a:arguments},r},r.rangeBand=function(){return f},r.rangeExtent=function(){return or(i.a[0])},r.copy=function(){return fw(t,i)},r.domain(t)}function ew(t,i){function f(){var f=0,e=i.length;for(r=[];++f<e;)r[f-1]=n.quantile(t,f/e);return u}function u(t){if(!isNaN(t=+t))return i[n.bisect(r,t)]}var r;return u.domain=function(n){return arguments.length?(t=n.map(si).filter(ct).sort(nr),f()):t},u.range=function(n){return arguments.length?(i=n,f()):i},u.quantiles=function(){return r},u.invertExtent=function(n){return n=i.indexOf(n),0>n?[NaN,NaN]:[n>0?r[n-1]:t[0],n<r.length?r[n]:t[t.length-1]]},u.copy=function(){return ew(t,i)},f()}function ow(n,t,i){function r(t){return i[Math.max(0,Math.min(e,Math.floor(u*(t-n))))]}function f(){return u=i.length/(t-n),e=i.length-1,r}var u,e;return r.domain=function(i){return arguments.length?(n=+i[0],t=+i[i.length-1],f()):[n,t]},r.range=function(n){return arguments.length?(i=n,f()):i},r.invertExtent=function(t){return t=i.indexOf(t),t=0>t?NaN:t/u+n,[t,t+1/u]},r.copy=function(){return ow(n,t,i)},f()}function sw(t,i){function r(r){if(r>=r)return i[n.bisect(t,r)]}return r.domain=function(n){return arguments.length?(t=n,r):t},r.range=function(n){return arguments.length?(i=n,r):i},r.invertExtent=function(n){return n=i.indexOf(n),[t[n-1],t[n]]},r.copy=function(){return sw(t,i)},r}function hw(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(i){return arguments.length?(n=i.map(t),t):n},t.ticks=function(t){return sh(n,t)},t.tickFormat=function(t,i){return hh(n,t,i)},t.copy=function(){return hw(n)},t}function lit(){return 0}function ait(n){return n.innerRadius}function vit(n){return n.outerRadius}function cw(n){return n.startAngle}function lw(n){return n.endAngle}function yit(n){return n&&n.padAngle}function pf(n,t,i,r){return(n-i)*t-(t-r)*n>0?0:1}function wf(n,t,i,r,u){var v=n[0]-t[0],y=n[1]-t[1],nt=(u?r:-r)/Math.sqrt(v*v+y*y),p=nt*y,w=-nt*v,b=n[0]+p,k=n[1]+w,d=t[0]+p,g=t[1]+w,tt=(b+d)/2,it=(k+g)/2,e=d-b,f=g-k,s=e*e+f*f,h=i-r,o=b*g-d*k,c=(0>f?-1:1)*Math.sqrt(h*h*s-o*o),l=(o*f-e*c)/s,a=(-o*e-f*c)/s,rt=(o*f+e*c)/s,ut=(-o*e+f*c)/s,ft=l-tt,et=a-it,ot=rt-tt,st=ut-it;return ft*ft+et*et>ot*ot+st*st&&(l=rt,a=ut),[[l-p,a-w],[l*i/h,a*i/h]]}function aw(n){function t(t){function a(){l.push("M",i(n(s),e))}for(var c,l=[],s=[],h=-1,v=t.length,y=o(r),p=o(u);++h<v;)f.call(this,c=t[h],h)?s.push([+y.call(this,c,h),+p.call(this,c,h)]):s.length&&(a(),s=[]);return s.length&&a(),l.length?l.join(""):null}var r=ur,u=wr,f=rr,i=d,s=i.key,e=.7;return t.x=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(u=n,t):u},t.defined=function(n){return arguments.length?(f=n,t):f},t.interpolate=function(n){return arguments.length?(s="function"==typeof n?i=n:(i=to.get(n)||d).key,t):s},t.tension=function(n){return arguments.length?(e=n,t):e},t}function d(n){return n.join("L")}function pit(n){return d(n)+"Z"}function wit(n){for(var r=0,u=n.length,t=n[0],i=[t[0],",",t[1]];++r<u;)i.push("H",(t[0]+(t=n[r])[0])/2,"V",t[1]);return u>1&&i.push("H",t[0]),i.join("")}function ch(n){for(var i=0,u=n.length,t=n[0],r=[t[0],",",t[1]];++i<u;)r.push("V",(t=n[i])[1],"H",t[0]);return r.join("")}function lh(n){for(var i=0,u=n.length,t=n[0],r=[t[0],",",t[1]];++i<u;)r.push("H",(t=n[i])[0],"V",t[1]);return r.join("")}function bit(n,t){return n.length<4?d(n):n[1]+bf(n.slice(1,-1),ah(n,t))}function kit(n,t){return n.length<3?d(n):n[0]+bf((n.push(n[0]),n),ah([n[n.length-2]].concat(n,[n[1]]),t))}function dit(n,t){return n.length<3?d(n):n[0]+bf(n,ah(n,t))}function bf(n,t){var o,h;if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return d(n);var c=n.length!=t.length,f="",s=n[0],i=n[1],e=t[0],r=e,u=1;if(c&&(f+="Q"+(i[0]-2*e[0]/3)+","+(i[1]-2*e[1]/3)+","+i[0]+","+i[1],s=n[1],u=2),t.length>1)for(r=t[1],i=n[u],u++,f+="C"+(s[0]+e[0])+","+(s[1]+e[1])+","+(i[0]-r[0])+","+(i[1]-r[1])+","+i[0]+","+i[1],o=2;o<t.length;o++,u++)i=n[u],r=t[o],f+="S"+(i[0]-r[0])+","+(i[1]-r[1])+","+i[0]+","+i[1];return c&&(h=n[u],f+="Q"+(i[0]+2*r[0]/3)+","+(i[1]+2*r[1]/3)+","+h[0]+","+h[1]),f}function ah(n,t){for(var r,u=[],f=(1-t)/2,e=n[0],i=n[1],o=1,s=n.length;++o<s;)r=e,e=i,i=n[o],u.push([f*(i[0]-r[0]),f*(i[1]-r[1])]);return u}function vw(n){if(n.length<3)return d(n);var o=1,s=n.length,t=n[0],i=t[0],r=t[1],u=[i,i,i,(t=n[1])[0]],f=[r,r,r,t[1]],e=[i,",",r,"L",nt(oi,u),",",nt(oi,f)];for(n.push(n[s-1]);++o<=s;)t=n[o],u.shift(),u.push(t[0]),f.shift(),f.push(t[1]),vh(e,u,f);return n.pop(),e.push("L",t),e.join("")}function git(n){if(n.length<4)return d(n);for(var t,f=[],i=-1,e=n.length,r=[0],u=[0];++i<3;)t=n[i],r.push(t[0]),u.push(t[1]);for(f.push(nt(oi,r)+","+nt(oi,u)),--i;++i<e;)t=n[i],r.shift(),r.push(t[0]),u.shift(),u.push(t[1]),vh(f,r,u);return f.join("")}function nrt(n){for(var f,t,i=-1,e=n.length,o=e+4,r=[],u=[];++i<4;)t=n[i%e],r.push(t[0]),u.push(t[1]);for(f=[nt(oi,r),",",nt(oi,u)],--i;++i<o;)t=n[i%e],r.shift(),r.push(t[0]),u.shift(),u.push(t[1]),vh(f,r,u);return f.join("")}function trt(n,t){var i=n.length-1;if(i)for(var r,u,e=n[0][0],o=n[0][1],s=n[i][0]-e,h=n[i][1]-o,f=-1;++f<=i;)r=n[f],u=f/i,r[0]=t*r[0]+(1-t)*(e+u*s),r[1]=t*r[1]+(1-t)*(o+u*h);return vw(n)}function nt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function vh(n,t,i){n.push("C",nt(kb,t),",",nt(kb,i),",",nt(db,t),",",nt(db,i),",",nt(oi,t),",",nt(oi,i))}function yh(n,t){return(t[1]-n[1])/(t[0]-n[0])}function irt(n){for(var t=0,e=n.length-1,i=[],f=n[0],r=n[1],u=i[0]=yh(f,r);++t<e;)i[t]=(u+(u=yh(f=r,r=n[t+1])))/2;return i[t]=u,i}function rrt(n){for(var e,o,s,u,c=[],f=irt(n),i=-1,h=n.length-1;++i<h;)e=yh(n[i],n[i+1]),r(e)<t?f[i]=f[i+1]=0:(o=f[i]/e,s=f[i+1]/e,u=o*o+s*s,u>9&&(u=3*e/Math.sqrt(u),f[i]=u*o,f[i+1]=u*s));for(i=-1;++i<=h;)u=(n[Math.min(h,i+1)][0]-n[Math.max(0,i-1)][0])/(6*(1+f[i]*f[i])),c.push([u||0,f[i]*u||0]);return c}function urt(n){return n.length<3?d(n):n[0]+bf(n,rrt(n))}function yw(n){for(var t,i,r,u=-1,f=n.length;++u<f;)t=n[u],i=t[0],r=t[1]-h,t[0]=i*Math.cos(r),t[1]=i*Math.sin(r);return n}function pw(n){function t(t){function b(){p.push("M",i(n(w),s),a,l(n(y.reverse()),s),"Z")}for(var v,k,d,p=[],y=[],w=[],c=-1,g=t.length,nt=o(f),tt=o(e),it=f===r?function(){return k}:o(r),rt=e===u?function(){return d}:o(u);++c<g;)h.call(this,v=t[c],c)?(y.push([k=+nt.call(this,v,c),d=+tt.call(this,v,c)]),w.push([+it.call(this,v,c),+rt.call(this,v,c)])):y.length&&(b(),y=[],w=[]);return y.length&&b(),p.length?p.join(""):null}var f=ur,r=ur,e=0,u=wr,h=rr,i=d,c=i.key,l=i,a="L",s=.7;return t.x=function(n){return arguments.length?(f=r=n,t):r},t.x0=function(n){return arguments.length?(f=n,t):f},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(e=u=n,t):u},t.y0=function(n){return arguments.length?(e=n,t):e},t.y1=function(n){return arguments.length?(u=n,t):u},t.defined=function(n){return arguments.length?(h=n,t):h},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?i=n:(i=to.get(n)||d).key,l=i.reverse||i,a=i.closed?"M":"L",t):c},t.tension=function(n){return arguments.length?(s=n,t):s},t}function frt(n){return n.radius}function ww(n){return[n.x,n.y]}function ert(n){return function(){var t=n.apply(this,arguments),i=t[0],r=t[1]-h;return[i*Math.cos(r),i*Math.sin(r)]}}function ort(){return 64}function srt(){return"circle"}function bw(n){var t=Math.sqrt(n/f);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function kw(n){return function(){var t,i;(t=this[n])&&(i=t[t.active])&&(--t.count?delete t[t.active]:delete this[n],t.active+=.5,i.event&&i.event.interrupt.call(this,this.__data__,i.index))}}function ru(n,t,i){return ne(n,a),n.namespace=t,n.id=i,n}function ph(n,t,i,r){var u=n.id,f=n.namespace;return at(n,"function"==typeof i?function(n,e,o){n[f][u].tween.set(t,r(i.call(n,n.__data__,e,o)))}:(i=r(i),function(n){n[f][u].tween.set(t,i)}))}function hrt(n){return null==n&&(n=""),function(){this.textContent=n}}function wh(n){return null==n?"__transition__":"__transition_"+n+"__"}function kf(t,i,r,u,f){var e=t[r]||(t[r]={active:0,count:0}),o=e[u],s;o||(s=f.time,o=e[u]={tween:new lt,time:s,delay:f.delay,duration:f.duration,ease:f.ease,index:i},f=null,++e.count,n.timer(function(f){function a(r){if(e.active>u)return y();var f=e[e.active];f&&(--e.count,delete e[e.active],f.event&&f.event.interrupt.call(t,t.__data__,f.index));e.active=u;o.event&&o.event.start.call(t,t.__data__,i);o.tween.forEach(function(n,r){(r=r.call(t,t.__data__,i))&&l.push(r)});w=o.ease;p=o.duration;n.timer(function(){return c.c=v(r||1)?rr:v,1},0,s)}function v(n){if(e.active!==u)return 1;for(var r=n/p,s=w(r),f=l.length;f>0;)l[--f].call(t,s);if(r>=1)return(o.event&&o.event.end.call(t,t.__data__,i),y())}function y(){return--e.count?delete e[u]:delete t[r],1}var p,w,h=o.delay,c=pt,l=[];return c.t=h+s,f>=h?a(f-h):void(c.c=a)},0,s))}function crt(n,t,i){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:i(n))+",0)"})}function lrt(n,t,i){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:i(n))+")"})}function bh(n){return n.toISOString()}function kh(t,i,r){function u(n){return t(n)}function f(t,r){var e=t[1]-t[0],f=e/r,u=n.bisect(uo,f);return u==uo.length?[i.year,iu(t.map(function(n){return n/31536e6}),r)[2]]:u?i[f/uo[u-1]<uo[u]/f?u-1:u]:[lut,iu(t,r)[2]]}return u.invert=function(n){return yi(t.invert(n))},u.domain=function(n){return arguments.length?(t.domain(n),u):t.domain().map(yi)},u.nice=function(n,t){function r(i){return!isNaN(i)&&!n.range(i,yi(+i+1),t).length}var e=u.domain(),o=or(e),i=null==n?f(o,10):"number"==typeof n&&f(o,n);return i&&(n=i[0],t=i[1]),u.domain(eh(e,t>1?{floor:function(t){for(;r(t=n.floor(t));)t=yi(t-1);return t},ceil:function(t){for(;r(t=n.ceil(t));)t=yi(+t+1);return t}}:n))},u.ticks=function(n,t){var i=or(u.domain()),r=null==n?f(i,10):"number"==typeof n?f(i,n):!n.range&&[{range:n},t];return r&&(n=r[0],t=r[1]),n.range(i[0],yi(+i[1]+1),1>t?1:t)},u.tickFormat=function(){return r},u.copy=function(){return kh(t.copy(),i,r)},oh(u,t)}function yi(n){return new Date(n)}function art(n){return JSON.parse(n.responseText)}function vrt(n){var t=p.createRange();return t.selectNode(p.body),t.createContextualFragment(n.responseText)}var n={version:"3.5.6"},dw=[].slice,ti=function(n){return dw.call(n)},p=this.document,dh,r,nb,gf,gh,e,te,ot,ie,pi,tb,re,fe,fc,ec,ee,oe,uu,fu,he,ce,le,ae,pt,sc,eb,st,hc,eu,cc,lc,ve,ii,k,yc,ki,pc,wc,bc,kc,dc,su,cr,di,lr,gc,hu,nl,tl,cu,ge,no,ab,il,vb,yb,pb,wb,rl,bb,lu,to,ul,au,fl,el,nk,cl,rk;if(p)try{ti(p.documentElement.childNodes)[0].nodeType}catch(aut){ti=function(n){for(var t=n.length,i=new Array(t);t--;)i[t]=n[t];return i}}if(Date.now||(Date.now=function(){return+new Date}),p)try{p.createElement("DIV").style.setProperty("opacity",0,"")}catch(vut){var df=this.Element.prototype,yrt=df.setAttribute,prt=df.setAttributeNS,gw=this.CSSStyleDeclaration.prototype,wrt=gw.setProperty;df.setAttribute=function(n,t){yrt.call(this,n,t+"")};df.setAttributeNS=function(n,t,i){prt.call(this,n,t,i+"")};gw.setProperty=function(n,t,i){wrt.call(this,n,t+"",i)}}n.ascending=nr;n.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:NaN};n.min=function(n,t){var u,i,r=-1,f=n.length;if(1===arguments.length){for(;++r<f;)if(null!=(i=n[r])&&i>=i){u=i;break}for(;++r<f;)null!=(i=n[r])&&u>i&&(u=i)}else{for(;++r<f;)if(null!=(i=t.call(n,n[r],r))&&i>=i){u=i;break}for(;++r<f;)null!=(i=t.call(n,n[r],r))&&u>i&&(u=i)}return u};n.max=function(n,t){var u,i,r=-1,f=n.length;if(1===arguments.length){for(;++r<f;)if(null!=(i=n[r])&&i>=i){u=i;break}for(;++r<f;)null!=(i=n[r])&&i>u&&(u=i)}else{for(;++r<f;)if(null!=(i=t.call(n,n[r],r))&&i>=i){u=i;break}for(;++r<f;)null!=(i=t.call(n,n[r],r))&&i>u&&(u=i)}return u};n.extent=function(n,t){var u,i,f,r=-1,e=n.length;if(1===arguments.length){for(;++r<e;)if(null!=(i=n[r])&&i>=i){u=f=i;break}for(;++r<e;)null!=(i=n[r])&&(u>i&&(u=i),i>f&&(f=i))}else{for(;++r<e;)if(null!=(i=t.call(n,n[r],r))&&i>=i){u=f=i;break}for(;++r<e;)null!=(i=t.call(n,n[r],r))&&(u>i&&(u=i),i>f&&(f=i))}return[u,f]};n.sum=function(n,t){var r,u=0,f=n.length,i=-1;if(1===arguments.length)for(;++i<f;)ct(r=+n[i])&&(u+=r);else for(;++i<f;)ct(r=+t.call(n,n[i],i))&&(u+=r);return u};n.mean=function(n,t){var r,f=0,e=n.length,i=-1,u=e;if(1===arguments.length)for(;++i<e;)ct(r=si(n[i]))?f+=r:--u;else for(;++i<e;)ct(r=si(t.call(n,n[i],i)))?f+=r:--u;if(u)return f/u};n.quantile=function(n,t){var u=(n.length-1)*t+1,i=Math.floor(u),r=+n[i-1],f=u-i;return f?r+f*(n[i]-r):r};n.median=function(t,i){var u,f=[],e=t.length,r=-1;if(1===arguments.length)for(;++r<e;)ct(u=si(t[r]))&&f.push(u);else for(;++r<e;)ct(u=si(i.call(t,t[r],r)))&&f.push(u);if(f.length)return n.quantile(f.sort(nr),.5)};n.variance=function(n,t){var i,r,s=n.length,u=0,o=0,f=-1,e=0;if(1===arguments.length)for(;++f<s;)ct(i=si(n[f]))&&(r=i-u,u+=r/++e,o+=r*(i-u));else for(;++f<s;)ct(i=si(t.call(n,n[f],f)))&&(r=i-u,u+=r/++e,o+=r*(i-u));if(e>1)return o/(e-1)};n.deviation=function(){var t=n.variance.apply(this,arguments);return t?Math.sqrt(t):t};dh=al(nr);n.bisectLeft=dh.left;n.bisect=n.bisectRight=dh.right;n.bisector=function(n){return al(1===n.length?function(t,i){return nr(n(t),i)}:n)};n.shuffle=function(n,t,i){(r=arguments.length)<3&&(i=n.length,2>r&&(t=0));for(var f,u,r=i-t;r;)u=Math.random()*r--|0,f=n[r+t],n[r+t]=n[u+t],n[u+t]=f;return n};n.permute=function(n,t){for(var i=t.length,r=new Array(i);i--;)r[i]=n[t[i]];return r};n.pairs=function(n){for(var f,t=0,i=n.length-1,r=n[0],u=new Array(0>i?0:i);i>t;)u[t]=[f=r,r=n[++t]];return u};n.zip=function(){var r,t,e;if(!(r=arguments.length))return[];for(var i=-1,u=n.min(arguments,uk),f=new Array(u);++i<u;)for(t=-1,e=f[i]=new Array(r);++t<r;)e[t]=arguments[t][i];return f};n.transpose=function(t){return n.zip.apply(n,t)};n.keys=function(n){var t=[];for(var i in n)t.push(i);return t};n.values=function(n){var t=[];for(var i in n)t.push(n[i]);return t};n.entries=function(n){var t=[];for(var i in n)t.push({key:i,value:n[i]});return t};n.merge=function(n){for(var t,i,r,u=n.length,e=-1,f=0;++e<u;)f+=n[e].length;for(i=new Array(f);--u>=0;)for(r=n[u],t=r.length;--t>=0;)i[--f]=r[t];return i};r=Math.abs;n.range=function(n,t,i){if(arguments.length<3&&(i=1,arguments.length<2&&(t=n,n=0)),(t-n)/i==1/0)throw new Error("infinite range");var f,e=[],u=fk(r(i)),o=-1;if(n*=u,t*=u,i*=u,0>i)for(;(f=n+i*++o)>t;)e.push(f/u);else for(;(f=n+i*++o)<t;)e.push(f/u);return e};n.map=function(n,t){var r=new lt,e,i,u,f;if(n instanceof lt)n.forEach(function(n,t){r.set(n,t)});else if(Array.isArray(n))if(i=-1,u=n.length,1===arguments.length)for(;++i<u;)r.set(i,n[i]);else for(;++i<u;)r.set(t.call(n,e=n[i],i),e);else for(f in n)r.set(f,n[f]);return r};nb="__proto__";gf="\x00";vl(lt,{has:yl,get:function(n){return this._[ar(n)]},set:function(n,t){return this._[ar(n)]=t},remove:pl,keys:wl,values:function(){var n=[];for(var t in this._)n.push(this._[t]);return n},entries:function(){var n=[];for(var t in this._)n.push({key:vu(t),value:this._[t]});return n},size:bl,empty:kl,forEach:function(n){for(var t in this._)n.call(this,vu(t),this._[t])}});n.nest=function(){function r(n,e,o){if(o>=i.length)return f?f.call(t,e):u?e.sort(u):e;for(var l,s,h,a,v=-1,y=e.length,p=i[o++],c=new lt;++v<y;)(a=c.get(l=p(s=e[v])))?a.push(s):c.set(l,[s]);return n?(s=n(),h=function(t,i){s.set(t,r(n,i,o))}):(s={},h=function(t,i){s[t]=r(n,i,o)}),c.forEach(h),s}function e(n,t){if(t>=i.length)return n;var r=[],u=o[t++];return n.forEach(function(n,i){r.push({key:n,values:e(i,t)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var u,f,t={},i=[],o=[];return t.map=function(n,t){return r(t,n,0)},t.entries=function(t){return e(r(n.map,t,0),0)},t.key=function(n){return i.push(n),t},t.sortKeys=function(n){return o[i.length-1]=n,t},t.sortValues=function(n){return u=n,t},t.rollup=function(n){return f=n,t},t};n.set=function(n){var i=new fo,t,r;if(n)for(t=0,r=n.length;r>t;++t)i.add(n[t]);return i};vl(fo,{has:yl,add:function(n){return this._[ar(n+="")]=!0,n},remove:pl,values:wl,size:bl,empty:kl,forEach:function(n){for(var t in this._)n.call(this,vu(t))}});n.behavior={};n.rebind=function(n,t){for(var i,r=1,u=arguments.length;++r<u;)n[i=arguments[r]]=ek(n,t,t[i]);return n};gh=["webkit","ms","moz","Moz","o","O"];n.dispatch=function(){for(var n=new oo,t=-1,i=arguments.length;++t<i;)n[arguments[t]]=dl(n);return n};oo.prototype.on=function(n,t){var r=n.indexOf("."),i="";if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n)return arguments.length<2?this[n].on(i):this[n].on(i,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(i,null);return this}};n.event=null;n.requote=function(n){return n.replace(brt,"\\$&")};var brt=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ne={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var i in t)n[i]=t[i]},nc=function(n,t){return t.querySelector(n)},tc=function(n,t){return t.querySelectorAll(n)},ic=function(n,t){var i=n.matches||n[eo(n,"matchesSelector")];return(ic=function(n,t){return i.call(n,t)})(n,t)};"function"==typeof Sizzle&&(nc=function(n,t){return Sizzle(n,t)[0]||null},tc=Sizzle,ic=Sizzle.matchesSelector);n.selection=function(){return n.select(p.documentElement)};e=n.selection.prototype=[];e.select=function(n){var i,f,e,t,o=[],r,s,u,h;for(n=co(n),r=-1,s=this.length;++r<s;)for(o.push(i=[]),i.parentNode=(e=this[r]).parentNode,u=-1,h=e.length;++u<h;)(t=e[u])?(i.push(f=n.call(t,t.__data__,u,r)),f&&"__data__"in t&&(f.__data__=t.__data__)):i.push(null);return dt(o)};e.selectAll=function(n){var u,t,f=[],i,e;for(n=gl(n),i=-1,e=this.length;++i<e;)for(var o=this[i],r=-1,s=o.length;++r<s;)(t=o[r])&&(f.push(u=ti(n.call(t,t.__data__,r,i))),u.parentNode=t);return dt(f)};te={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};n.ns={prefix:te,qualify:function(n){var t=n.indexOf(":"),i=n;return t>=0&&(i=n.slice(0,t),n=n.slice(t+1)),te.hasOwnProperty(i)?{space:te[i],local:n}:n}};e.attr=function(t,i){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=n.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(i in t)this.each(na(i,t[i]));return this}return this.each(na(t,i))};e.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var r=this.node(),u=(n=ra(n)).length,i=-1;if(t=r.classList){for(;++i<u;)if(!t.contains(n[i]))return!1}else for(t=r.getAttribute("class");++i<u;)if(!ia(n[i]).test(t))return!1;return!0}for(t in n)this.each(ua(t,n[t]));return this}return this.each(ua(n,t))};e.style=function(n,t,i){var r=arguments.length,u;if(3>r){if("string"!=typeof n){2>r&&(t="");for(i in n)this.each(fa(i,n[i],t));return this}if(2>r)return u=this.node(),bt(u).getComputedStyle(u,null).getPropertyValue(n);i=""}return this.each(fa(n,t,i))};e.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(ea(t,n[t]));return this}return this.each(ea(n,t))};e.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent};e.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML};e.append=function(n){return n=oa(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})};e.insert=function(n,t){return n=oa(n),t=co(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})};e.remove=function(){return this.each(sk)};e.data=function(n,t){function e(n,i){var r,u,e,o=n.length,a=i.length,b=Math.min(o,a),v=new Array(a),c=new Array(a),y=new Array(o),p,l,w;if(t){for(l=new lt,w=new Array(o),r=-1;++r<o;)l.has(p=t.call(u=n[r],u.__data__,r))?y[r]=u:l.set(p,u),w[r]=p;for(r=-1;++r<a;)(u=l.get(p=t.call(i,e=i[r],r)))?u!==!0&&(v[r]=u,u.__data__=e):c[r]=lo(e),l.set(p,!0);for(r=-1;++r<o;)l.get(w[r])!==!0&&(y[r]=n[r])}else{for(r=-1;++r<b;)u=n[r],e=i[r],u?(u.__data__=e,v[r]=u):c[r]=lo(e);for(;a>r;++r)c[r]=lo(i[r]);for(;o>r;++r)y[r]=n[r]}c.update=v;c.parentNode=v.parentNode=y.parentNode=n.parentNode;s.push(c);f.push(v);h.push(y)}var r,o,i=-1,u=this.length;if(!arguments.length){for(n=new Array(u=(r=this[0]).length);++i<u;)(o=r[i])&&(n[i]=o.__data__);return n}var s=ha([]),f=dt([]),h=dt([]);if("function"==typeof n)for(;++i<u;)e(r=this[i],n.call(r,r.parentNode.__data__,i));else for(;++i<u;)e(r=this[i],n);return f.enter=function(){return s},f.exit=function(){return h},f};e.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")};e.filter=function(n){var u,f,r,e=[],t,o,i,s;for("function"!=typeof n&&(n=sa(n)),t=0,o=this.length;o>t;t++)for(e.push(u=[]),u.parentNode=(f=this[t]).parentNode,i=0,s=f.length;s>i;i++)(r=f[i])&&n.call(r,r.__data__,i,t)&&u.push(r);return dt(e)};e.order=function(){for(var i=-1,f=this.length;++i<f;)for(var t,r=this[i],u=r.length-1,n=r[u];--u>=0;)(t=r[u])&&(n&&n!==t.nextSibling&&n.parentNode.insertBefore(t,n),n=t);return this};e.sort=function(n){n=hk.apply(this,arguments);for(var t=-1,i=this.length;++t<i;)this[t].sort(n);return this.order()};e.each=function(n){return at(this,function(t,i,r){n.call(t,t.__data__,i,r)})};e.call=function(n){var t=ti(arguments);return n.apply(t[0]=this,t),this};e.empty=function(){return!this.node()};e.node=function(){for(var i,n=0,r=this.length;r>n;n++)for(var u=this[n],t=0,f=u.length;f>t;t++)if(i=u[t],i)return i;return null};e.size=function(){var n=0;return at(this,function(){++n}),n};ot=[];n.selection.enter=ha;n.selection.enter.prototype=ot;ot.append=e.append;ot.empty=e.empty;ot.node=e.node;ot.call=e.call;ot.size=e.size;ot.select=function(n){for(var i,h,r,e,o,t,u,s=[],f=-1,c=this.length;++f<c;)for(o=(t=this[f]).update,s.push(r=[]),r.parentNode=t.parentNode,i=-1,h=t.length;++i<h;)(u=t[i])?(r.push(o[i]=e=n.call(t.parentNode,u.__data__,i,f)),e.__data__=u.__data__):r.push(null);return dt(s)};ot.insert=function(n,t){return arguments.length<2&&(t=ck(this)),e.insert.call(this,n,t)};n.select=function(n){var t;return"string"==typeof n?(t=[nc(n,p)],t.parentNode=p.documentElement):(t=[n],t.parentNode=ll(n)),dt([t])};n.selectAll=function(n){var t;return"string"==typeof n?(t=ti(tc(n,p)),t.parentNode=p.documentElement):(t=n,t.parentNode=null),dt([t])};e.on=function(n,t,i){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(i in n)this.each(ca(i,n[i],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;i=!1}return this.each(ca(n,t,i))};ie=n.map({mouseenter:"mouseover",mouseleave:"mouseout"});p&&ie.forEach(function(n){"on"+n in p&&ie.remove(n)});tb=0;n.mouse=function(n){return ao(n,so())};re=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;n.touch=function(n,t,i){if(arguments.length<3&&(i=t,t=so().changedTouches),t)for(var u,r=0,f=t.length;f>r;++r)if((u=t[r]).identifier===i)return ao(n,u)};n.behavior.drag=function(){function t(){this.on("mousedown.drag",f).on("touchstart.drag",e)}function r(t,r,f,e,o){return function(){function b(){var t,i,n=r(y,h);n&&(t=n[0]-c[0],i=n[1]-c[1],w|=t|i,c=n,p({type:"drag",x:n[0]+s[0],y:n[1]+s[1],dx:t,dy:i}))}function k(){r(y,h)&&(d.on(e+l,null).on(o+l,null),g(w&&n.event.target===v),p({type:"dragend"}))}var s,a=this,v=n.event.target,y=a.parentNode,p=u.of(a,arguments),w=0,h=t(),l=".drag"+(null==h?"":"-"+h),d=n.select(f(v)).on(e+l,b).on(o+l,k),g=yu(v),c=r(y,h);i?(s=i.apply(a,arguments),s=[s.x-c[0],s.y-c[1]]):s=[0,0];p({type:"dragstart"})}}var u=ho(t,"drag","dragstart","dragend"),i=null,f=r(l,n.mouse,bt,"mousemove","mouseup"),e=r(ak,n.touch,v,"touchmove","touchend");return t.origin=function(n){return arguments.length?(i=n,t):i},n.rebind(t,u,"on")};n.touches=function(n,t){return arguments.length<2&&(t=so().touches),t?ti(t).map(function(t){var i=ao(n,t);return i.identifier=t.identifier,i}):[]};var t=1e-6,rc=t*t,f=Math.PI,g=2*f,krt=g-t,h=f/2,u=f/180,s=180/f,ue=Math.SQRT2,uc=2,ib=4;n.interpolateZoom=function(n,t){function v(n){var t=n*p,r,h;return y?(r=ya(u),h=i/(uc*c)*(r*yk(ue*t+u)-vk(u)),[o+h*f,s+h*e,i*r/ya(ue*t+u)]):[o+n*f,s+n*e,i*Math.exp(ue*t)]}var o=n[0],s=n[1],i=n[2],w=t[0],b=t[1],r=t[2],f=w-o,e=b-s,h=f*f+e*e,c=Math.sqrt(h),l=(r*r-i*i+ib*h)/(2*i*uc*c),a=(r*r-i*i-ib*h)/(2*r*uc*c),u=Math.log(Math.sqrt(l*l+1)-l),k=Math.log(Math.sqrt(a*a+1)-a),y=k-u,p=(y||Math.log(r/i))/ue;return v.duration=1e3*p,v};n.behavior.zoom=function(){function i(n){n.on(it,ft).on(fc+".zoom",at).on("dblclick.zoom",vt).on(rt,et)}function s(n){return[(n[0]-t.x)/t.k,(n[1]-t.y)/t.k]}function lt(n){return[n[0]*t.k+t.x,n[1]*t.k+t.y]}function b(n){t.k=Math.max(y[0],Math.min(y[1],n))}function h(n,i){i=lt(i);t.x+=n[0]-i[0];t.y+=n[1]-i[1]}function ut(u,f,e,o){u.__chart__={x:t.x,y:t.y,k:t.k};b(Math.pow(2,o));h(r=f,e);u=n.select(u);w>0&&(u=u.transition().duration(w));u.call(i.event)}function k(){l&&l.domain(nt.range().map(function(n){return(n-t.x)/t.k}).map(nt.invert));a&&a.domain(tt.range().map(function(n){return(n-t.y)/t.k}).map(tt.invert))}function f(n){st++||n({type:"zoomstart"})}function e(n){k();n({type:"zoom",scale:t.k,translate:[t.x,t.y]})}function u(n){--st||(n({type:"zoomend"}),r=null)}function ft(){function c(){r=1;h(n.mouse(t),y);e(i)}function l(){v.on(ht,null).on(ct,null);p(r&&n.event.target===a);u(i)}var t=this,a=n.event.target,i=o.of(t,arguments),r=0,v=n.select(bt(t)).on(ht,c).on(ct,l),y=s(n.mouse(t)),p=yu(t);ro.call(t);f(i)}function et(){function v(){var u=n.touches(i);return p=t.k,u.forEach(function(n){n.identifier in r&&(r[n.identifier]=s(n))}),u}function y(){var s=n.event.target,u,o,f;n.select(s).on(tt,d).on(ot,nt);w.push(s);for(var h=n.event.changedTouches,e=0,p=h.length;p>e;++e)r[h[e].identifier]=null;if(u=v(),o=Date.now(),1===u.length)500>o-g&&(f=u[0],ut(i,f,r[f.identifier],Math.floor(Math.log(t.k)/Math.LN2)+1),kt()),g=o;else if(u.length>1){var f=u[0],c=u[1],a=f[0]-c[0],y=f[1]-c[1];l=a*a+y*y}}function d(){var t,f,u,o,v=n.touches(i),a,y,s,w;for(ro.call(i),a=0,y=v.length;y>a;++a,o=null)if(u=v[a],o=r[u.identifier]){if(f)break;t=u;f=o}o&&(s=(s=u[0]-t[0])*s+(s=u[1]-t[1])*s,w=l&&Math.sqrt(s/l),t=[(t[0]+u[0])/2,(t[1]+u[1])/2],f=[(f[0]+o[0])/2,(f[1]+o[1])/2],b(w*p));g=null;h(t,f);e(c)}function nt(){var e;if(n.event.touches.length){for(var i=n.event.changedTouches,t=0,f=i.length;f>t;++t)delete r[i[t].identifier];for(e in r)return void v()}n.selectAll(w).on(a,null);k.on(it,ft).on(rt,et);st();u(c)}var p,i=this,c=o.of(i,arguments),r={},l=0,a=".zoom-"+n.event.changedTouches[0].identifier,tt="touchmove"+a,ot="touchend"+a,w=[],k=n.select(i),st=yu(i);y();f(c);k.on(it,null).on(rt,y)}function at(){var i=o.of(this,arguments);c?clearTimeout(c):(ro.call(this),ot=s(r=d||n.mouse(this)),f(i));c=setTimeout(function(){c=null;u(i)},50);kt();b(Math.pow(2,.002*fe())*t.k);h(r,ot);e(i)}function vt(){var i=n.mouse(this),r=Math.log(t.k)/Math.LN2;ut(this,i,s(i),n.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var ot,r,d,c,g,nt,l,tt,a,t={x:0,y:0,k:1},v=[960,500],y=ec,w=250,st=0,it="mousedown.zoom",ht="mousemove.zoom",ct="mouseup.zoom",rt="touchstart.zoom",o=ho(i,"zoomstart","zoom","zoomend");return fc||(fc="onwheel"in p?(fe=function(){return-n.event.deltaY*(n.event.deltaMode?120:1)},"wheel"):"onmousewheel"in p?(fe=function(){return n.event.wheelDelta},"mousewheel"):(fe=function(){return-n.event.detail},"MozMousePixelScroll")),i.event=function(i){i.each(function(){var i=o.of(this,arguments),s=t;gi?n.select(this).transition().each("start.zoom",function(){t=this.__chart__||{x:0,y:0,k:1};f(i)}).tween("zoom:zoom",function(){var u=v[0],h=v[1],f=r?r[0]:u/2,o=r?r[1]:h/2,c=n.interpolateZoom([(f-t.x)/t.k,(o-t.y)/t.k,u/t.k],[(f-s.x)/s.k,(o-s.y)/s.k,u/s.k]);return function(n){var r=c(n),s=u/r[2];this.__chart__=t={x:f-r[0]*s,y:o-r[1]*s,k:s};e(i)}}).each("interrupt.zoom",function(){u(i)}).each("end.zoom",function(){u(i)}):(this.__chart__=t,f(i),e(i),u(i))})},i.translate=function(n){return arguments.length?(t={x:+n[0],y:+n[1],k:t.k},k(),i):[t.x,t.y]},i.scale=function(n){return arguments.length?(t={x:t.x,y:t.y,k:+n},k(),i):t.k},i.scaleExtent=function(n){return arguments.length?(y=null==n?ec:[+n[0],+n[1]],i):y},i.center=function(n){return arguments.length?(d=n&&[+n[0],+n[1]],i):d},i.size=function(n){return arguments.length?(v=n&&[+n[0],+n[1]],i):v},i.duration=function(n){return arguments.length?(w=+n,i):w},i.x=function(n){return arguments.length?(l=n,nt=n.copy(),t={x:0,y:0,k:1},i):l},i.y=function(n){return arguments.length?(a=n,tt=n.copy(),t={x:0,y:0,k:1},i):a},n.rebind(i,o,"on")};ec=[0,1/0];n.color=hi;hi.prototype.toString=function(){return this.rgb()+""};n.hsl=ft;ee=ft.prototype=new hi;ee.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new ft(this.h,this.s,this.l/n)};ee.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new ft(this.h,this.s,n*this.l)};ee.rgb=function(){return yo(this.h,this.s,this.l)};n.hcl=tt;oe=tt.prototype=new hi;oe.brighter=function(n){return new tt(this.h,this.c,Math.min(100,this.l+se*(arguments.length?n:1)))};oe.darker=function(n){return new tt(this.h,this.c,Math.max(0,this.l-se*(arguments.length?n:1)))};oe.rgb=function(){return po(this.h,this.c,this.l).rgb()};n.lab=it;var se=18,rb=.95047,ub=1,fb=1.08883,oc=it.prototype=new hi;oc.brighter=function(n){return new it(Math.min(100,this.l+se*(arguments.length?n:1)),this.a,this.b)};oc.darker=function(n){return new it(Math.max(0,this.l-se*(arguments.length?n:1)),this.a,this.b)};oc.rgb=function(){return wa(this.l,this.a,this.b)};n.rgb=b;uu=b.prototype=new hi;uu.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var i=this.r,r=this.g,u=this.b,t=30;return i||r||u?(i&&t>i&&(i=t),r&&t>r&&(r=t),u&&t>u&&(u=t),new b(Math.min(255,i/n),Math.min(255,r/n),Math.min(255,u/n))):new b(t,t,t)};uu.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new b(n*this.r,n*this.g,n*this.b)};uu.hsl=function(){return ga(this.r,this.g,this.b)};uu.toString=function(){return"#"+tr(this.r)+tr(this.g)+tr(this.b)};fu=n.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});fu.forEach(function(n,t){fu.set(n,ka(t))});n.functor=o;n.xhr=ts(v);n.dsv=function(n,t){function i(n,i,r){arguments.length<3&&(r=i,i=null);var e=wu(n,t,null==i?u:f(i),r);return e.row=function(n){return arguments.length?e.response(null==(i=n)?u:f(n)):i},e}function u(n){return i.parse(n.responseText)}function f(n){return function(t){return i.parse(t.responseText,n)}}function e(t){return t.map(r).join(n)}function r(n){return o.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var o=new RegExp('["'+n+"\n]"),s=n.charCodeAt(0);return i.parse=function(n,t){var r;return i.parseRows(n,function(n,i){if(r)return r(n,i-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,i){return t(u(n),i)}:u})},i.parseRows=function(n,t){function h(){var f,t,u,h;if(i>=o)return e;if(r)return r=!1,c;if(f=i,34===n.charCodeAt(f)){for(t=f;t++<o;)if(34===n.charCodeAt(t)){if(34!==n.charCodeAt(t+1))break;++t}return i=t+2,u=n.charCodeAt(t+1),13===u?(r=!0,10===n.charCodeAt(t+2)&&++i):10===u&&(r=!0),n.slice(f+1,t).replace(/""/g,'"')}for(;o>i;){if(u=n.charCodeAt(i++),h=1,10===u)r=!0;else if(13===u)r=!0,10===n.charCodeAt(i)&&(++i,++h);else if(u!==s)continue;return n.slice(f,i-h)}return n.slice(f)}for(var f,u,r,c={},e={},l=[],o=n.length,i=0,a=0;(u=h())!==e;){for(f=[];u!==c&&u!==e;)f.push(u),u=h();t&&null==(f=t(f,a++))||l.push(f)}return l},i.format=function(t){if(Array.isArray(t[0]))return i.formatRows(t);var f=new fo,u=[];return t.forEach(function(n){for(var t in n)f.has(t)||u.push(f.add(t))}),[u.map(r).join(n)].concat(t.map(function(t){return u.map(function(n){return r(t[n])}).join(n)})).join("\n")},i.formatRows=function(n){return n.map(e).join("\n")},i};n.csv=n.dsv(",","text/csv");n.tsv=n.dsv("\t","text/tab-separated-values");sc=this[eo(this,"requestAnimationFrame")]||function(n){setTimeout(n,17)};n.timer=function(n,t,i){var u=arguments.length,f,r;2>u&&(t=0);3>u&&(i=Date.now());f=i+t;r={c:n,t:f,f:!1,n:null};ce?ce.n=r:he=r;ce=r;le||(ae=clearTimeout(ae),le=1,sc(is))};n.timer.flush=function(){tv();iv()};n.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};eb=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(bk);n.formatPrefix=function(t,i){var r=0;return t&&(0>t&&(t*=-1),i&&(t=n.round(t,rs(t,i))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),eb[8+r/3]};var ob=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,drt=n.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(t,i){return(t=n.round(t,rs(t,i))).toFixed(Math.max(0,Math.min(20,rs(t*(1+1e-15),i))))}}),i=n.time={},y=Date;vt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){st.setUTCDate.apply(this._,arguments)},setDay:function(){st.setUTCDay.apply(this._,arguments)},setFullYear:function(){st.setUTCFullYear.apply(this._,arguments)},setHours:function(){st.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){st.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){st.setUTCMinutes.apply(this._,arguments)},setMonth:function(){st.setUTCMonth.apply(this._,arguments)},setSeconds:function(){st.setUTCSeconds.apply(this._,arguments)},setTime:function(){st.setTime.apply(this._,arguments)}};st=Date.prototype;i.year=ci(function(n){return n=i.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()});i.years=i.year.range;i.years.utc=i.year.utc.range;i.day=ci(function(n){var t=new y(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1});i.days=i.day.range;i.days.utc=i.day.utc.range;i.dayOfYear=function(n){var t=i.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)};["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var r=i[n]=ci(function(n){return(n=i.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var r=i.year(n).getDay();return Math.floor((i.dayOfYear(n)+(r+t)%7)/7)-(r!==t)});i[n+"s"]=r.range;i[n+"s"].utc=r.utc.range;i[n+"OfYear"]=function(n){var r=i.year(n).getDay();return Math.floor((i.dayOfYear(n)+(r+t)%7)/7)}});i.week=i.sunday;i.weeks=i.sunday.range;i.weeks.utc=i.sunday.utc.range;i.weekOfYear=i.sundayOfYear;var sb={"-":"",_:" ",0:"0"},c=/^\s*\d+/,hb=/^%/;n.locale=function(n){return{numberFormat:kk(n),timeFormat:gk(n)}};hc=n.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});n.format=hc.numberFormat;n.geo={};us.prototype={s:0,t:0,add:function(n){fv(n,this.t,eu);fv(eu.s,this.s,this);this.s?this.t+=eu.t:this.s=eu.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};eu=new us;n.geo.stream=function(n,t){n&&cc.hasOwnProperty(n.type)?cc[n.type](n,t):gu(n,t)};cc={Feature:function(n,t){gu(n.geometry,t)},FeatureCollection:function(n,t){for(var i=n.features,r=-1,u=i.length;++r<u;)gu(i[r].geometry,t)}};lc={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates;t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var i=n.coordinates,r=-1,u=i.length;++r<u;)n=i[r],t.point(n[0],n[1],n[2])},LineString:function(n,t){fs(n.coordinates,t,0)},MultiLineString:function(n,t){for(var i=n.coordinates,r=-1,u=i.length;++r<u;)fs(i[r],t,0)},Polygon:function(n,t){ev(n.coordinates,t)},MultiPolygon:function(n,t){for(var i=n.coordinates,r=-1,u=i.length;++r<u;)ev(i[r],t)},GeometryCollection:function(n,t){for(var i=n.geometries,r=-1,u=i.length;++r<u;)gu(i[r],t)}};n.geo.area=function(t){return ve=0,n.geo.stream(t,k),ve};ii=new us;k={sphere:function(){ve+=4*f},point:l,lineStart:l,lineEnd:l,polygonStart:function(){ii.reset();k.lineStart=pd},polygonEnd:function(){var n=2*ii;ve+=0>n?4*f+n:n;k.lineStart=k.lineEnd=k.point=l}};n.geo.bounds=function(){function w(n,t){v.push(l=[i=n,f=n]);o>t&&(o=t);t>h&&(h=t)}function b(n,t){var d=li([n*u,t*u]),v;if(y){var b=ir(y,d),nt=[b[1],-b[0],0],c=ir(nt,b);rf(c);c=uf(c);var g=n-a,p=g>0?1:-1,l=c[0]*s*p,k=r(g)>180;k^(l>p*a&&p*n>l)?(v=c[1]*s,v>h&&(h=v)):(l=(l+360)%360-180,k^(l>p*a&&p*n>l))?(v=-c[1]*s,o>v&&(o=v)):(o>t&&(o=t),t>h&&(h=t));k?a>n?e(i,n)>e(i,f)&&(f=n):e(n,f)>e(i,f)&&(i=n):f>=i?(i>n&&(i=n),n>f&&(f=n)):n>a?e(i,n)>e(i,f)&&(f=n):e(n,f)>e(i,f)&&(i=n)}else w(n,t);y=d;a=n}function d(){c.point=b}function g(){l[0]=i;l[1]=f;c.point=w;y=null}function nt(n,t){if(y){var i=n-a;p+=r(i)>180?i+(i>0?360:-360):i}else it=n,rt=t;k.point(n,t);b(n,t)}function ut(){k.lineStart()}function ft(){nt(it,rt);k.lineEnd();r(p)>t&&(i=-(f=180));l[0]=i;l[1]=f;y=null}function e(n,t){return(t-=n)<0?t+360:t}function et(n,t){return n[0]-t[0]}function tt(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var i,o,f,h,a,it,rt,y,p,v,l,c={point:w,lineStart:d,lineEnd:g,polygonStart:function(){c.point=nt;c.lineStart=ut;c.lineEnd=ft;p=0;k.polygonStart()},polygonEnd:function(){k.polygonEnd();c.point=w;c.lineStart=d;c.lineEnd=g;0>ii?(i=-(f=180),o=-(h=90)):p>t?h=90:-t>p&&(o=-90);l[0]=i;l[1]=f}};return function(t){var a;if(h=f=-(i=o=1/0),v=[],n.geo.stream(t,c),a=v.length,a){v.sort(et);for(var u,s=1,r=v[0],y=[r];a>s;++s)u=v[s],tt(u[0],r)||tt(u[1],r)?(e(r[0],u[1])>e(r[0],r[1])&&(r[1]=u[1]),e(u[0],r[1])>e(r[0],r[1])&&(r[0]=u[0])):y.push(r=u);for(var p,u,w=-1/0,a=y.length-1,s=0,r=y[a];a>=s;r=u,++s)u=y[s],(p=e(r[1],u[0]))>w&&(w=p,i=u[0],f=r[1])}return v=l=null,1/0===i||1/0===o?[[NaN,NaN],[NaN,NaN]]:[[i,o],[f,h]]}}();n.geo.centroid=function(i){ou=ye=wi=bi=wt=ri=ui=ht=sr=hr=fi=0;n.geo.stream(i,rt);var r=sr,u=hr,f=fi,e=r*r+u*u+f*f;return rc>e&&(r=ri,u=ui,f=ht,t>ye&&(r=wi,u=bi,f=wt),e=r*r+u*u+f*f,rc>e)?[NaN,NaN]:[Math.atan2(u,r)*s,gt(f/Math.sqrt(e))*s]};var ou,ye,wi,bi,wt,ri,ui,ht,sr,hr,fi,rt={sphere:l,point:os,lineStart:ov,lineEnd:sv,polygonStart:function(){rt.lineStart=wd},polygonEnd:function(){rt.lineStart=ov}},cb=av(rr,dd,ng,[-f,-f/2]),pe=1e9;n.geo.clipExtent=function(){var t,i,r,u,n,f,e={stream:function(t){return n&&(n.valid=!1),n=f(t),n.valid=!0,n},extent:function(o){return arguments.length?(f=pv(t=+o[0][0],i=+o[0][1],r=+o[1][0],u=+o[1][1]),n&&(n.valid=!1,n=null),e):[[t,i],[r,u]]}};return e.extent([[0,0],[960,500]])};(n.geo.conicEqualArea=function(){return ss(wv)}).raw=wv;n.geo.albers=function(){return n.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)};n.geo.albersUsa=function(){function r(n){var t=n[0],i=n[1];return u=null,s(t,i),u||(h(t,i),u)||c(t,i),u}var u,s,h,c,i=n.geo.albers(),f=n.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),e=n.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),o={point:function(n,t){u=[n,t]}};return r.invert=function(n){var u=i.scale(),o=i.translate(),t=(n[0]-o[0])/u,r=(n[1]-o[1])/u;return(r>=.12&&.234>r&&t>=-.425&&-.214>t?f:r>=.166&&.234>r&&t>=-.214&&-.115>t?e:i).invert(n)},r.stream=function(n){var t=i.stream(n),r=f.stream(n),u=e.stream(n);return{point:function(n,i){t.point(n,i);r.point(n,i);u.point(n,i)},sphere:function(){t.sphere();r.sphere();u.sphere()},lineStart:function(){t.lineStart();r.lineStart();u.lineStart()},lineEnd:function(){t.lineEnd();r.lineEnd();u.lineEnd()},polygonStart:function(){t.polygonStart();r.polygonStart();u.polygonStart()},polygonEnd:function(){t.polygonEnd();r.polygonEnd();u.polygonEnd()}}},r.precision=function(n){return arguments.length?(i.precision(n),f.precision(n),e.precision(n),r):i.precision()},r.scale=function(n){return arguments.length?(i.scale(n),f.scale(.35*n),e.scale(n),r.translate(i.translate())):i.scale()},r.translate=function(n){if(!arguments.length)return i.translate();var u=i.scale(),l=+n[0],a=+n[1];return s=i.translate(n).clipExtent([[l-.455*u,a-.238*u],[l+.455*u,a+.238*u]]).stream(o).point,h=f.translate([l-.307*u,a+.201*u]).clipExtent([[l-.425*u+t,a+.12*u+t],[l-.214*u-t,a+.234*u-t]]).stream(o).point,c=e.translate([l-.205*u,a+.212*u]).clipExtent([[l-.214*u+t,a+.166*u+t],[l-.115*u-t,a+.234*u-t]]).stream(o).point,r},r.scale(1070)};var ac,vc,we,be,ke,de,ei={point:l,lineStart:l,lineEnd:l,polygonStart:function(){vc=0;ei.lineStart=rg},polygonEnd:function(){ei.lineStart=ei.lineEnd=ei.point=l;ac+=r(vc/2)}},grt={point:ug,lineStart:l,lineEnd:l,polygonStart:l,polygonEnd:l},ut={point:ai,lineStart:kv,lineEnd:dv,polygonStart:function(){ut.lineStart=eg},polygonEnd:function(){ut.point=ai;ut.lineStart=kv;ut.lineEnd=dv}};n.geo.path=function(){function t(t){return t&&("function"==typeof r&&i.pointRadius(+r.apply(this,arguments)),f&&f.valid||(f=u(i)),n.geo.stream(t,f)),i.result()}function e(){return f=null,t}var o,s,u,i,f,r=4.5;return t.area=function(t){return ac=0,n.geo.stream(t,u(ei)),ac},t.centroid=function(t){return wi=bi=wt=ri=ui=ht=sr=hr=fi=0,n.geo.stream(t,u(ut)),fi?[sr/fi,hr/fi]:ht?[ri/ht,ui/ht]:wt?[wi/wt,bi/wt]:[NaN,NaN]},t.bounds=function(t){return ke=de=-(we=be=1/0),n.geo.stream(t,u(grt)),[[we,be],[ke,de]]},t.projection=function(n){return arguments.length?(u=(o=n)?n.stream||sg(n):v,e()):o},t.context=function(n){return arguments.length?(i=null==(s=n)?new fg:new og(n),"function"!=typeof r&&i.pointRadius(r),e()):s},t.pointRadius=function(n){return arguments.length?(r="function"==typeof n?n:(i.pointRadius(+n),+n),t):r},t.projection(n.geo.albersUsa()).context(null)};n.geo.transform=function(n){return{stream:function(t){var i=new ny(t);for(var r in n)i[r]=n[r];return i}}};ny.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};n.geo.projection=ni;n.geo.projectionMutator=hs;(n.geo.equirectangular=function(){return ni(yr)}).raw=yr.invert=yr;n.geo.rotation=function(n){function t(t){return t=n(t[0]*u,t[1]*u),t[0]*=s,t[1]*=s,t}return n=cs(n[0]%360*u,n[1]*u,n.length>2?n[2]*u:0),t.invert=function(t){return t=n.invert(t[0]*u,t[1]*u),t[0]*=s,t[1]*=s,t},t};ry.invert=yr;n.geo.circle=function(){function n(){var n="function"==typeof t?t.apply(this,arguments):t,f=cs(-n[0]*u,-n[1]*u,0).invert,i=[];return r(null,null,1,{point:function(n,t){i.push(n=f(n,t));n[0]*=s;n[1]*=s}}),{type:"Polygon",coordinates:[i]}}var i,r,t=[0,0],f=6;return n.origin=function(i){return arguments.length?(t=i,n):t},n.angle=function(t){return arguments.length?(r=ls((i=+t)*u,f*u),n):i},n.precision=function(t){return arguments.length?(r=ls(i*u,(f=+t)*u),n):f},n.angle(90)};n.geo.distance=function(n,t){var i,f=(t[0]-n[0])*u,e=n[1]*u,o=t[1]*u,a=Math.sin(f),s=Math.cos(f),h=Math.sin(e),c=Math.cos(e),l=Math.sin(o),r=Math.cos(o);return Math.atan2(Math.sqrt((i=r*a)*i+(i=c*l-h*r*s)*i),h*l+c*r*s)};n.geo.graticule=function(){function i(){return{type:"MultiLineString",coordinates:d()}}function d(){return n.range(Math.ceil(f/v)*v,u,v).map(b).concat(n.range(Math.ceil(o/y)*y,e,y).map(k)).concat(n.range(Math.ceil(h/a)*a,s,a).filter(function(n){return r(n%v)>t}).map(g)).concat(n.range(Math.ceil(l/w)*w,c,w).filter(function(n){return r(n%y)>t}).map(nt))}var s,h,u,f,c,l,e,o,g,nt,b,k,a=10,w=a,v=90,y=360,p=2.5;return i.lines=function(){return d().map(function(n){return{type:"LineString",coordinates:n}})},i.outline=function(){return{type:"Polygon",coordinates:[b(f).concat(k(e).slice(1),b(u).reverse().slice(1),k(o).reverse().slice(1))]}},i.extent=function(n){return arguments.length?i.majorExtent(n).minorExtent(n):i.minorExtent()},i.majorExtent=function(n){return arguments.length?(f=+n[0][0],u=+n[1][0],o=+n[0][1],e=+n[1][1],f>u&&(n=f,f=u,u=n),o>e&&(n=o,o=e,e=n),i.precision(p)):[[f,o],[u,e]]},i.minorExtent=function(n){return arguments.length?(h=+n[0][0],s=+n[1][0],l=+n[0][1],c=+n[1][1],h>s&&(n=h,h=s,s=n),l>c&&(n=l,l=c,c=n),i.precision(p)):[[h,l],[s,c]]},i.step=function(n){return arguments.length?i.majorStep(n).minorStep(n):i.minorStep()},i.majorStep=function(n){return arguments.length?(v=+n[0],y=+n[1],i):[v,y]},i.minorStep=function(n){return arguments.length?(a=+n[0],w=+n[1],i):[a,w]},i.precision=function(n){return arguments.length?(p=+n,g=sy(l,c,90),nt=hy(h,s,p),b=sy(o,e,90),k=hy(f,u,p),i):p},i.majorExtent([[-180,-90+t],[180,90-t]]).minorExtent([[-180,-80-t],[180,80+t]])};n.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[u||i.apply(this,arguments),f||r.apply(this,arguments)]}}var u,f,i=as,r=vs;return t.distance=function(){return n.geo.distance(u||i.apply(this,arguments),f||r.apply(this,arguments))},t.source=function(n){return arguments.length?(i=n,u="function"==typeof n?null:n,t):i},t.target=function(n){return arguments.length?(r=n,f="function"==typeof n?null:n,t):r},t.precision=function(){return arguments.length?t:0},t};n.geo.interpolate=function(n,t){return hg(n[0]*u,n[1]*u,t[0]*u,t[1]*u)};n.geo.length=function(t){return yc=0,n.geo.stream(t,ki),yc};ki={sphere:l,point:l,lineStart:cg,lineEnd:l,polygonStart:l,polygonEnd:l};pc=pr(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(n.geo.azimuthalEqualArea=function(){return ni(pc)}).raw=pc;wc=pr(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},v);(n.geo.azimuthalEquidistant=function(){return ni(wc)}).raw=wc;(n.geo.conicConformal=function(){return ss(cy)}).raw=cy;(n.geo.conicEquidistant=function(){return ss(ly)}).raw=ly;bc=pr(function(n){return 1/n},Math.atan);(n.geo.gnomonic=function(){return ni(bc)}).raw=bc;of.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-h]};(n.geo.mercator=function(){return ay(of)}).raw=of;kc=pr(function(){return 1},Math.asin);(n.geo.orthographic=function(){return ni(kc)}).raw=kc;dc=pr(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(n.geo.stereographic=function(){return ni(dc)}).raw=dc;ys.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-h]};(n.geo.transverseMercator=function(){var n=ay(ys),i=n.center,t=n.rotate;return n.center=function(n){return n?i([-n[1],n[0]]):(n=i(),[n[1],-n[0]])},n.rotate=function(n){return n?t([n[0],n[1],n.length>2?n[2]+90:90]):(n=t(),[n[0],n[1],n[2]-90])},t([0,0,90])}).raw=ys;n.geom={};n.geom.hull=function(n){function t(n){if(n.length<3)return[];for(var l=o(i),a=o(r),h=n.length,u=[],c=[],t=0;h>t;t++)u.push([+l.call(this,n[t],t),+a.call(this,n[t],t),t]);for(u.sort(lg),t=0;h>t;t++)c.push([u[t][0],-u[t][1]]);var f=vy(u),e=vy(c),v=e[0]===f[0],y=e[e.length-1]===f[f.length-1],s=[];for(t=f.length-1;t>=0;--t)s.push(n[u[f[t]][2]]);for(t=+v;t<e.length-y;++t)s.push(n[u[e[t]][2]]);return s}var i=ur,r=wr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(i=n,t):i},t.y=function(n){return arguments.length?(r=n,t):r},t)};n.geom.polygon=function(n){return ne(n,su),n};su=n.geom.polygon.prototype=[];su.area=function(){for(var t,i=-1,r=this.length,n=this[r-1],u=0;++i<r;)t=n,n=this[i],u+=t[1]*n[0]-t[0]*n[1];return.5*u};su.centroid=function(n){var i,r,u=-1,f=this.length,e=0,o=0,t=this[f-1];for(arguments.length||(n=-1/(6*this.area()));++u<f;)i=t,t=this[u],r=i[0]*t[1]-t[0]*i[1],e+=(i[0]+t[0])*r,o+=(i[1]+t[1])*r;return[e*n,o*n]};su.clip=function(n){for(var f,e,o,t,i,r,s=yy(n),h=-1,c=this.length-yy(this),u=this[c-1];++h<c;){for(f=n.slice(),n.length=0,t=this[h],i=f[(o=f.length-s)-1],e=-1;++e<o;)r=f[e],ps(r,u,t)?(ps(i,u,t)||n.push(ws(i,r,u,t)),n.push(r)):ps(i,u,t)&&n.push(ws(i,r,u,t)),i=r;s&&n.push(n[0]);u=t}return n};nl=[];tl=[];by.prototype.prepare=function(){for(var t,n=this.edges,i=n.length;i--;)t=n[i].edge,t.b&&t.a||n.splice(i,1);return n.sort(ky),n.length};hf.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}};ks.prototype={insert:function(n,t){var i,r,u;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;i=n}else this._?(n=gy(this._),t.P=null,t.N=n,n.P=n.L=t,i=n):(t.P=t.N=null,this._=t,i=null);for(t.L=t.R=null,t.U=i,t.C=!0,n=t;i&&i.C;)r=i.U,i===r.L?(u=r.R,u&&u.C?(i.C=u.C=!1,r.C=!0,n=r):(n===i.R&&(kr(this,i),n=i,i=n.U),i.C=!1,r.C=!0,dr(this,r))):(u=r.L,u&&u.C?(i.C=u.C=!1,r.C=!0,n=r):(n===i.L&&(dr(this,i),n=i,i=n.U),i.C=!1,r.C=!0,kr(this,r))),i=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P);n.P&&(n.P.N=n.N);n.N=n.P=null;var t,r,e,i=n.U,f=n.L,u=n.R;if(r=f?u?gy(u):f:u,i?i.L===n?i.L=r:i.R=r:this._=r,f&&u?(e=r.C,r.C=n.C,r.L=f,f.U=r,r!==u?(i=r.U,r.U=n.U,n=r.R,i.L=n,r.R=u,u.U=r):(r.U=i,i=r,n=r.R)):(e=n.C,n=r),n&&(n.U=i),!e){if(n&&n.C)return void(n.C=!1);do{if(n===this._)break;if(n===i.L){if(t=i.R,t.C&&(t.C=!1,i.C=!0,kr(this,i),t=i.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,dr(this,t),t=i.R);t.C=i.C;i.C=t.R.C=!1;kr(this,i);n=this._;break}}else if(t=i.L,t.C&&(t.C=!1,i.C=!0,dr(this,i),t=i.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,kr(this,t),t=i.L);t.C=i.C;i.C=t.L.C=!1;dr(this,i);n=this._;break}t.C=!0;n=i;i=i.U}while(!n.C);n&&(n.C=!1)}}};n.geom.voronoi=function(n){function i(n){var o=new Array(n.length),t=r[0][0],i=r[0][1],f=r[1][0],e=r[1][1];return ds(u(n),r).cells.forEach(function(r,u){var h=r.edges,s=r.site,c=o[u]=h.length?h.map(function(n){var t=n.start();return[t.x,t.y]}):s.x>=t&&s.x<=f&&s.y>=i&&s.y<=e?[[t,e],[f,e],[f,i],[t,i]]:[];c.point=n[u]}),o}function u(n){return n.map(function(n,i){return{x:Math.round(s(n,i)/t)*t,y:Math.round(h(n,i)/t)*t,i:i}})}var f=ur,e=wr,s=f,h=e,r=cu;return n?i(n):(i.links=function(n){return ds(u(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},i.triangles=function(n){var t=[];return ds(u(n)).cells.forEach(function(i,r){for(var l,e,o=i.site,s=i.edges.sort(ky),h=-1,c=s.length,u=s[c-1].edge,f=u.l===o?u.r:u.l;++h<c;)l=u,e=f,u=s[h].edge,f=u.l===o?u.r:u.l,r<e.i&&r<f.i&&tn(o,e,f)<0&&t.push([n[r],n[e.i],n[f.i]])}),t},i.x=function(n){return arguments.length?(s=o(f=n),i):f},i.y=function(n){return arguments.length?(h=o(e=n),i):e},i.clipExtent=function(n){return arguments.length?(r=null==n?cu:n,i):r===cu?null:r},i.size=function(n){return arguments.length?i.clipExtent(n&&[[0,0],n]):r===cu?null:r&&r[1]},i)};cu=[[-1e6,-1e6],[1e6,1e6]];n.geom.delaunay=function(t){return n.geom.voronoi().triangles(t)};n.geom.quadtree=function(n,t,i,u,f){function e(n){function it(n,t,i,u,f,e,o,s){var h,c,l;isNaN(i)||isNaN(u)||(n.leaf?(h=n.x,c=n.y,null!=h?r(h-i)+r(c-u)<.01?nt(n,t,i,u,f,e,o,s):(l=n.point,n.x=n.y=n.point=null,nt(n,l,h,c,f,e,o,s),nt(n,t,i,u,f,e,o,s)):(n.x=i,n.y=u,n.point=t)):nt(n,t,i,u,f,e,o,s))}function nt(n,t,i,r,u,f,e,o){var s=.5*(u+e),h=.5*(f+o),c=i>=s,l=r>=h,a=l<<1|c;n.leaf=!1;n=n.nodes[a]||(n.nodes[a]=np());c?u=s:e=s;l?f=h:o=h;it(n,t,i,r,u,f,e,o)}var l,d,g,e,tt,a,v,y,p,ft=o(s),et=o(h),b,k,rt,ut,w;if(null!=t)a=t,v=i,y=u,p=f;else if(y=p=-(a=v=1/0),d=[],g=[],tt=n.length,c)for(e=0;tt>e;++e)l=n[e],l.x<a&&(a=l.x),l.y<v&&(v=l.y),l.x>y&&(y=l.x),l.y>p&&(p=l.y),d.push(l.x),g.push(l.y);else for(e=0;tt>e;++e)b=+ft(l=n[e],e),k=+et(l,e),a>b&&(a=b),v>k&&(v=k),b>y&&(y=b),k>p&&(p=k),d.push(b),g.push(k);if(rt=y-a,ut=p-v,rt>ut?p=v+rt:y=a+ut,w=np(),w.add=function(n){it(w,n,+ft(n,++e),+et(n,e),a,v,y,p)},w.visit=function(n){gr(n,w,a,v,y,p)},w.find=function(n){return fn(w,n[0],n[1],a,v,y,p)},e=-1,null==t){for(;++e<tt;)it(w,n[e],d[e],g[e],a,v,y,p);--e}else n.forEach(w.add);return d=g=n=l=null,w}var c,s=ur,h=wr;return(c=arguments.length)?(s=rn,h=un,3===c&&(f=i,u=t,i=t=0),e(n)):(e.x=function(n){return arguments.length?(s=n,e):s},e.y=function(n){return arguments.length?(h=n,e):h},e.extent=function(n){return arguments.length?(null==n?t=i=u=f=null:(t=+n[0][0],i=+n[0][1],u=+n[1][0],f=+n[1][1]),e):null==t?null:[[t,i],[u,f]]},e.size=function(n){return arguments.length?(null==n?t=i=u=f=null:(t=i=0,u=+n[0],f=+n[1]),e):null==t?null:[u-t,f-i]},e)};n.interpolateRgb=gs;n.interpolateObject=tp;n.interpolateNumber=yt;n.interpolateString=ip;ge=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;no=new RegExp(ge.source,"g");n.interpolate=vi;n.interpolators=[function(n,t){var i=typeof t;return("string"===i?fu.has(t.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(t)?gs:ip:t instanceof hi?gs:Array.isArray(t)?lf:"object"===i&&isNaN(t)?tp:yt)(n,t)}];n.interpolateArray=lf;var lb=function(){return v},nut=n.map({linear:lb,poly:cn,quad:function(){return on},cubic:function(){return sn},sin:function(){return ln},exp:function(){return an},circle:function(){return vn},elastic:yn,back:pn,bounce:function(){return wn}}),tut=n.map({"in":v,out:rp,"in-out":up,"out-in":function(n){return up(rp(n))}});n.ease=function(n){var t=n.indexOf("-"),i=t>=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return i=nut.get(i)||lb,r=tut.get(r)||v,en(r(i.apply(null,dw.call(arguments,1))))};n.interpolateHcl=bn;n.interpolateHsl=kn;n.interpolateLab=dn;n.interpolateRound=fp;n.transform=function(t){var i=p.createElementNS(n.ns.prefix.svg,"g");return(n.transform=function(n){if(null!=n){i.setAttribute("transform",n);var t=i.transform.baseVal.consolidate()}return new ep(t?t.matrix:ab)})(t)};ep.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};ab={a:1,b:0,c:0,d:1,e:0,f:0};n.interpolateTransform=hp;n.layout={};n.layout.bundle=function(){return function(n){for(var t=[],i=-1,r=n.length;++i<r;)t.push(itt(n[i]));return t}};n.layout.chord=function(){function c(){var v,t,b,c,a,k={},d=[],it=n.range(r),nt=[],p,w;for(i=[],u=[],v=0,c=-1;++c<r;){for(t=0,a=-1;++a<r;)t+=f[c][a];d.push(t);nt.push(n.range(r));v+=t}for(e&&it.sort(function(n,t){return e(d[n],d[t])}),o&&nt.forEach(function(n,t){n.sort(function(n,i){return o(f[t][n],f[t][i])})}),v=(g-h*r)/v,t=0,c=-1;++c<r;){for(b=t,a=-1;++a<r;){var y=it[c],tt=nt[y][a],rt=f[y][tt],ut=t,ft=t+=rt*v;k[y+"-"+tt]={index:y,subindex:tt,startAngle:ut,endAngle:ft,value:rt}}u[y]={index:y,startAngle:b,endAngle:t,value:(t-b)/v};t+=h}for(c=-1;++c<r;)for(a=c-1;++a<r;)p=k[c+"-"+a],w=k[a+"-"+c],(p.value||w.value)&&i.push(p.value<w.value?{source:w,target:p}:{source:p,target:w});s&&l()}function l(){i.sort(function(n,t){return s((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var i,u,f,r,e,o,s,t={},h=0;return t.matrix=function(n){return arguments.length?(r=(f=n)&&f.length,i=u=null,t):f},t.padding=function(n){return arguments.length?(h=n,i=u=null,t):h},t.sortGroups=function(n){return arguments.length?(e=n,i=u=null,t):e},t.sortSubgroups=function(n){return arguments.length?(o=n,i=null,t):o},t.sortChords=function(n){return arguments.length?(s=n,i&&l(),t):s},t.chords=function(){return i||c(),i},t.groups=function(){return u||c(),u},t};n.layout.force=function(){function d(n){return function(t,i,r,u){var e;if(t.point!==n){var o=t.cx-n.x,s=t.cy-n.y,h=u-i,f=o*o+s*s;if(f>h*h/k)return w>f&&(e=t.charge/f,n.px-=o*e,n.py-=s*e),!0;t.point&&f&&w>f&&(e=t.pointCharge/f,n.px-=o*e,n.py-=s*e)}return!t.charge}}function g(i){i.px=n.event.x;i.py=n.event.y;t.resume()}var h,r,c,l,a,t={},y=n.dispatch("start","tick","end"),f=[1,1],p=.9,o=iut,s=rut,e=-30,w=uut,b=.1,k=.64,i=[],u=[];return t.tick=function(){if((r*=.99)<.005)return y.end({type:"end",alpha:r=0}),!0;for(var tt,t,w,g,k,s,h,v,nt=i.length,it=u.length,o=0;it>o;++o)t=u[o],w=t.source,g=t.target,h=g.x-w.x,v=g.y-w.y,(k=h*h+v*v)&&(k=r*l[o]*((k=Math.sqrt(k))-c[o])/k,h*=k,v*=k,g.x-=h*(s=w.weight/(g.weight+w.weight)),g.y-=v*s,w.x+=h*(s=1-s),w.y+=v*s);if((s=r*b)&&(h=f[0]/2,v=f[1]/2,o=-1,s))for(;++o<nt;)t=i[o],t.x+=(h-t.x)*s,t.y+=(v-t.y)*s;if(e)for(lp(tt=n.geom.quadtree(i),r,a),o=-1;++o<nt;)(t=i[o]).fixed||tt.visit(d(t));for(o=-1;++o<nt;)t=i[o],t.fixed?(t.x=t.px,t.y=t.py):(t.x-=(t.px-(t.px=t.x))*p,t.y-=(t.py-(t.py=t.y))*p);y.tick({type:"tick",alpha:r})},t.nodes=function(n){return arguments.length?(i=n,t):i},t.links=function(n){return arguments.length?(u=n,t):u},t.size=function(n){return arguments.length?(f=n,t):f},t.linkDistance=function(n){return arguments.length?(o="function"==typeof n?n:+n,t):o},t.distance=t.linkDistance,t.linkStrength=function(n){return arguments.length?(s="function"==typeof n?n:+n,t):s},t.friction=function(n){return arguments.length?(p=+n,t):p},t.charge=function(n){return arguments.length?(e="function"==typeof n?n:+n,t):e},t.chargeDistance=function(n){return arguments.length?(w=n*n,t):Math.sqrt(w)},t.gravity=function(n){return arguments.length?(b=+n,t):b},t.theta=function(n){return arguments.length?(k=n*n,t):Math.sqrt(k)},t.alpha=function(i){return arguments.length?(i=+i,r?r=i>0?i:0:i>0&&(y.start({type:"start",alpha:r=i}),n.timer(t.tick)),t):r},t.start=function(){function p(t,i){var f;if(!h){for(h=new Array(v),r=0;v>r;++r)h[r]=[];for(r=0;y>r;++r)f=u[r],h[f.source.index].push(f.target),h[f.target.index].push(f.source)}for(var e,o=h[n],r=-1,s=o.length;++r<s;)if(!isNaN(e=o[r][t]))return e;return Math.random()*i}for(var h,r,v=i.length,y=u.length,w=f[0],b=f[1],n=0;v>n;++n)(r=i[n]).index=n,r.weight=0;for(n=0;y>n;++n)r=u[n],"number"==typeof r.source&&(r.source=i[r.source]),"number"==typeof r.target&&(r.target=i[r.target]),++r.source.weight,++r.target.weight;for(n=0;v>n;++n)r=i[n],isNaN(r.x)&&(r.x=p("x",w)),isNaN(r.y)&&(r.y=p("y",b)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(c=[],"function"==typeof o)for(n=0;y>n;++n)c[n]=+o.call(this,u[n],n);else for(n=0;y>n;++n)c[n]=o;if(l=[],"function"==typeof s)for(n=0;y>n;++n)l[n]=+s.call(this,u[n],n);else for(n=0;y>n;++n)l[n]=s;if(a=[],"function"==typeof e)for(n=0;v>n;++n)a[n]=+e.call(this,i[n],n);else for(n=0;v>n;++n)a[n]=e;return t.resume()},t.resume=function(){return t.alpha(.1)},t.stop=function(){return t.alpha(0)},t.drag=function(){return h||(h=n.behavior.drag().origin(v).on("dragstart.force",utt).on("drag.force",g).on("dragend.force",ftt)),arguments.length?void this.on("mouseover.force",ett).on("mouseout.force",ott).call(h):h},n.rebind(t,y,"on")};var iut=20,rut=1,uut=1/0;n.layout.hierarchy=function(){function n(u){var f,h=[u],c=[],o,e,s;for(u.depth=0;null!=(f=h.pop());)if(c.push(f),(e=r.call(n,f,f.depth))&&(o=e.length)){for(;--o>=0;)h.push(s=e[o]),s.parent=f,s.depth=f.depth+1;t&&(f.value=0);f.children=e}else t&&(f.value=+t.call(n,f,f.depth)||0),delete f.children;return et(u,function(n){var r,u;i&&(r=n.children)&&r.sort(i);t&&(u=n.parent)&&(u.value+=n.value)}),c}var i=ctt,r=stt,t=htt;return n.sort=function(t){return arguments.length?(i=t,n):i},n.children=function(t){return arguments.length?(r=t,n):r},n.value=function(i){return arguments.length?(t=i,n):t},n.revalue=function(i){return t&&(tu(i,function(n){n.children&&(n.value=0)}),et(i,function(i){var r;i.children||(i.value=+t.call(n,i,i.depth)||0);(r=i.parent)&&(r.value+=i.value)})),i},n};n.layout.partition=function(){function r(n,t,i,u){var f=n.children,o,s,h,e;if(n.x=t,n.y=n.depth*u,n.dx=i,n.dy=u,f&&(o=f.length))for(e=-1,i=n.value?i/n.value:0;++e<o;)r(s=f[e],t,h=s.value*i,u),t+=h}function u(n){var t=n.children,i=0,f,r;if(t&&(f=t.length))for(r=-1;++r<f;)i=Math.max(i,u(t[r]));return 1+i}function i(n,i){var e=f.call(this,n,i);return r(e[0],0,t[0],t[1]/u(e[0])),e}var f=n.layout.hierarchy(),t=[1,1];return i.size=function(n){return arguments.length?(t=n,i):t},nu(i,f)};n.layout.pie=function(){function t(o){var a,h=o.length,s=o.map(function(n,i){return+e.call(t,n,i)}),c=+("function"==typeof r?r.apply(this,arguments):r),l=("function"==typeof u?u.apply(this,arguments):u)-c,v=Math.min(Math.abs(l)/h,+("function"==typeof f?f.apply(this,arguments):f)),y=v*(0>l?-1:1),b=(l-h*y)/n.sum(s),p=n.range(h),w=[];return null!=i&&p.sort(i===il?function(n,t){return s[t]-s[n]}:function(n,t){return i(o[n],o[t])}),p.forEach(function(n){w[n]={data:o[n],value:a=s[n],startAngle:c,endAngle:c+=a*b+y,padAngle:v}}),w}var e=Number,i=il,r=0,u=g,f=0;return t.value=function(n){return arguments.length?(e=n,t):e},t.sort=function(n){return arguments.length?(i=n,t):i},t.startAngle=function(n){return arguments.length?(r=n,t):r},t.endAngle=function(n){return arguments.length?(u=n,t):u},t.padAngle=function(n){return arguments.length?(f=n,t):f},t};il={};n.layout.stack=function(){function t(s,h){var p,v,c,w,b,k;if(!(p=s.length))return s;var a=s.map(function(n,i){return r.call(t,n,i)}),l=a.map(function(n){return n.map(function(n,i){return[e.call(t,n,i),o.call(t,n,i)]})}),y=u.call(t,l,h);for(a=n.permute(a,y),l=n.permute(l,y),b=f.call(t,l,h),k=a[0].length,c=0;k>c;++c)for(i.call(t,a[0][c],w=b[c],l[0][c][1]),v=1;p>v;++v)i.call(t,a[v][c],w+=l[v-1][c][1],l[v][c][1]);return s}var r=v,u=nh,f=th,i=ytt,e=att,o=vtt;return t.values=function(n){return arguments.length?(r=n,t):r},t.order=function(n){return arguments.length?(u="function"==typeof n?n:vb.get(n)||nh,t):u},t.offset=function(n){return arguments.length?(f="function"==typeof n?n:yb.get(n)||th,t):f},t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(o=n,t):o},t.out=function(n){return arguments.length?(i=n,t):i},t};vb=n.map({"inside-out":function(t){for(var i,u=t.length,f=t.map(ptt),e=t.map(wtt),l=n.range(u).sort(function(n,t){return f[n]-f[t]}),o=0,s=0,h=[],c=[],r=0;u>r;++r)i=l[r],s>o?(o+=e[i],h.push(i)):(s+=e[i],c.push(i));return c.reverse().concat(h)},reverse:function(t){return n.range(t.length).reverse()},"default":nh});yb=n.map({silhouette:function(n){for(var r,i,s=n.length,f=n[0].length,e=[],u=0,o=[],t=0;f>t;++t){for(r=0,i=0;s>r;r++)i+=n[r][t][1];i>u&&(u=i);e.push(i)}for(t=0;f>t;++t)o[t]=(u-e[t])/2;return o},wiggle:function(n){var i,t,r,u,h,c,f,e,o,a=n.length,l=n[0],v=l.length,s=[];for(s[0]=e=o=0,t=1;v>t;++t){for(i=0,u=0;a>i;++i)u+=n[i][t][1];for(i=0,h=0,f=l[t][0]-l[t-1][0];a>i;++i){for(r=0,c=(n[i][t][1]-n[i][t-1][1])/(2*f);i>r;++r)c+=(n[r][t][1]-n[r][t-1][1])/f;h+=c*n[i][t][1]}s[t]=e-=u?h/u*f:0;o>e&&(o=e)}for(t=0;v>t;++t)s[t]-=o;return s},expand:function(n){for(var t,r,u=n.length,f=n[0].length,o=1/u,e=[],i=0;f>i;++i){for(t=0,r=0;u>t;t++)r+=n[t][i][1];if(r)for(t=0;u>t;t++)n[t][i][1]/=r;else for(t=0;u>t;t++)n[t][i][1]=o}for(i=0;f>i;++i)e[i]=0;return e},zero:th});n.layout.histogram=function(){function t(t,e){for(var o,s,l=[],h=t.map(r,this),a=u.call(this,h,e),c=f.call(this,a,h,e),e=-1,y=h.length,v=c.length-1,p=i?1:1/y;++e<v;)o=l[e]=[],o.dx=c[e+1]-(o.x=c[e]),o.y=0;if(v>0)for(e=-1;++e<y;)s=h[e],s>=a[0]&&s<=a[1]&&(o=l[n.bisect(c,s,1,v)-1],o.y+=p,o.push(t[e]));return l}var i=!0,r=Number,u=dtt,f=ktt;return t.value=function(n){return arguments.length?(r=n,t):r},t.range=function(n){return arguments.length?(u=o(n),t):u},t.bins=function(n){return arguments.length?(f="number"==typeof n?function(t){return ap(t,n)}:o(n),t):f},t.frequency=function(n){return arguments.length?(i=!!n,t):i},t};n.layout.pack=function(){function i(n,i){var c=f.call(this,n,i),e=c[0],o=u[0],s=u[1],l=null==t?Math.sqrt:"function"==typeof t?t:function(){return t},h;return(e.x=e.y=0,et(e,function(n){n.r=+l(n.value)}),et(e,pp),r)&&(h=r*(t?1:Math.max(2*e.r/o,2*e.r/s))/2,et(e,function(n){n.r+=h}),et(e,pp),et(e,function(n){n.r-=h})),wp(e,o/2,s/2,t?1:1/Math.max(2*e.r/o,2*e.r/s)),c}var t,f=n.layout.hierarchy().sort(gtt),r=0,u=[1,1];return i.size=function(n){return arguments.length?(u=n,i):u},i.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,i):t},i.padding=function(n){return arguments.length?(r=+n,i):r},nu(i,f)};n.layout.tree=function(){function i(n,i){var p=e.call(this,n,i),c=p[0],v=o(c);if(et(v,s),v.parent.m=-v.z,tu(v,h),u)tu(c,f);else{var l=c,a=c,y=c;tu(c,function(n){n.x<l.x&&(l=n);n.x>a.x&&(a=n);n.depth>y.depth&&(y=n)});var w=r(l,a)/2-l.x,b=t[0]/(a.x+r(a,l)/2+w),k=t[1]/(y.depth||1);tu(c,function(n){n.x=(n.x+w)*b;n.y=n.depth*k})}return p}function o(n){for(var u,f={A:null,children:[n]},e=[f];null!=(u=e.pop());)for(var i,r=u.children,t=0,o=r.length;o>t;++t)e.push((r[t]=i={_:r[t],parent:u,children:(i=r[t].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:t}).a=i);return f.children[0]}function s(n){var i=n.children,f=n.parent.children,t=n.i?f[n.i-1]:null,u;i.length?(rit(n),u=(i[0].z+i[i.length-1].z)/2,t?(n.z=t.z+r(n._,t._),n.m=n.z-u):n.z=u):t&&(n.z=t.z+r(n._,t._));n.parent.A=c(n,t,n.parent.A||f[0])}function h(n){n._.x=n.z+n.parent.m;n.m+=n.parent.m}function c(n,t,i){if(t){for(var s,u=n,e=n,f=t,o=u.parent.children[0],h=u.m,c=e.m,l=f.m,a=o.m;f=uh(f),u=rh(u),f&&u;)o=rh(o),e=uh(e),e.a=n,s=f.z+l-u.z-h+r(f._,u._),s>0&&(iit(uit(f,n,i),n,s),h+=s,c+=s),l+=f.m,h+=u.m,a+=o.m,c+=e.m;f&&!uh(e)&&(e.t=f,e.m+=l-c);u&&!rh(o)&&(o.t=u,o.m+=h-a,i=n)}return i}function f(n){n.x*=t[0];n.y=n.depth*t[1]}var e=n.layout.hierarchy().sort(null).value(null),r=kp,t=[1,1],u=null;return i.separation=function(n){return arguments.length?(r=n,i):r},i.size=function(n){return arguments.length?(u=null==(t=n)?f:null,i):u?null:t},i.nodeSize=function(n){return arguments.length?(u=null==(t=n)?null:f,i):u?t:null},nu(i,e)};n.layout.cluster=function(){function i(n,i){var o,c=f.call(this,n,i),e=c[0],a=0;et(e,function(n){var t=n.children;t&&t.length?(n.x=eit(t),n.y=fit(t)):(n.x=o?a+=r(n,o):0,n.y=0,o=n)});var s=dp(e),h=gp(e),l=s.x-r(s,h)/2,v=h.x+r(h,s)/2;return et(e,u?function(n){n.x=(n.x-e.x)*t[0];n.y=(e.y-n.y)*t[1]}:function(n){n.x=(n.x-l)/(v-l)*t[0];n.y=(1-(e.y?n.y/e.y:1))*t[1]}),c}var f=n.layout.hierarchy().sort(null).value(null),r=kp,t=[1,1],u=!1;return i.separation=function(n){return arguments.length?(r=n,i):r},i.size=function(n){return arguments.length?(u=null==(t=n),i):u?null:t},i.nodeSize=function(n){return arguments.length?(u=null!=(t=n),i):u?t:null},nu(i,f)};n.layout.treemap=function(){function o(n,t){for(var r,i,u=-1,f=n.length;++u<f;)i=(r=n[u]).value*(0>t?0:t),r.area=isNaN(i)||0>=i?0:i}function a(n){var u=n.children;if(u&&u.length){var l,v,y,r=c(n),t=[],f=u.slice(),h=1/0,e="slice"===i?r.dx:"dice"===i?r.dy:"slice-dice"===i?1&n.depth?r.dy:r.dx:Math.min(r.dx,r.dy);for(o(f,r.dx*r.dy/n.value),t.area=0;(y=f.length)>0;)t.push(l=f[y-1]),t.area+=l.area,"squarify"!==i||(v=p(t,e))<=h?(f.pop(),h=v):(t.area-=t.pop().area,s(t,e,r,!1),e=Math.min(r.dx,r.dy),t.length=t.area=0,h=1/0);t.length&&(s(t,e,r,!0),t.length=t.area=0);u.forEach(a)}}function v(n){var u=n.children;if(u&&u.length){var i,r=c(n),f=u.slice(),t=[];for(o(f,r.dx*r.dy/n.value),t.area=0;i=f.pop();)t.push(i),t.area+=i.area,null!=i.z&&(s(t,i.z?r.dx:r.dy,r,!f.length),t.length=t.area=0);u.forEach(v)}}function p(n,t){for(var i,r=n.area,u=0,f=1/0,o=-1,s=n.length;++o<s;)(i=n[o].area)&&(f>i&&(f=i),i>u&&(u=i));return r*=r,t*=t,r?Math.max(t*u*e/r,r/(t*f*e)):1/0}function s(n,t,i,r){var f,h=-1,c=n.length,o=i.x,s=i.y,e=t?u(n.area/t):0;if(t==i.dx){for((r||e>i.dy)&&(e=i.dy);++h<c;)f=n[h],f.x=o,f.y=s,f.dy=e,o+=f.dx=Math.min(i.x+i.dx-o,e?u(f.area/e):0);f.z=!0;f.dx+=i.x+i.dx-o;i.y+=e;i.dy-=e}else{for((r||e>i.dx)&&(e=i.dx);++h<c;)f=n[h],f.x=o,f.y=s,f.dx=e,s+=f.dy=Math.min(i.y+i.dy-s,e?u(f.area/e):0);f.z=!1;f.dy+=i.y+i.dy-s;i.x+=e;i.dx-=e}}function t(n){var i=r||h(n),t=i[0];return t.x=0,t.y=0,t.dx=f[0],t.dy=f[1],r&&h.revalue(t),o([t],t.dx*t.dy/t.value),(r?v:a)(t),l&&(r=i),i}var r,h=n.layout.hierarchy(),u=Math.round,f=[1,1],y=null,c=fh,l=!1,i="squarify",e=.5*(1+Math.sqrt(5));return t.size=function(n){return arguments.length?(f=n,t):f},t.padding=function(n){function u(i){var r=n.call(t,i,i.depth);return null==r?fh(i):nw(i,"number"==typeof r?[r,r,r,r]:r)}function i(t){return nw(t,n)}if(!arguments.length)return y;var r;return c=null==(y=n)?fh:"function"==(r=typeof n)?u:"number"===r?(n=[n,n,n,n],i):i,t},t.round=function(n){return arguments.length?(u=n?Math.round:Number,t):u!=Number},t.sticky=function(n){return arguments.length?(l=n,r=null,t):l},t.ratio=function(n){return arguments.length?(e=n,t):e},t.mode=function(n){return arguments.length?(i=n+"",t):i},nu(t,h)};n.random={normal:function(n,t){var i=arguments.length;return 2>i&&(t=1),1>i&&(n=0),function(){var r,u,i;do r=2*Math.random()-1,u=2*Math.random()-1,i=r*r+u*u;while(!i||i>1);return n+t*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=n.random.normal.apply(n,arguments);return function(){return Math.exp(t())}},bates:function(t){var i=n.random.irwinHall(t);return function(){return i()/t}},irwinHall:function(n){return function(){for(var t=0,i=0;n>i;i++)t+=Math.random();return t}}};n.scale={};pb={floor:v,ceil:v};n.scale.linear=function(){return tw([0,1],[0,1],vi,!1)};wb={s:1,g:1,p:1,r:1,e:1};n.scale.log=function(){return rw(n.scale.linear().domain([0,1]),10,!0,[1,10])};rl=n.format(".0e");bb={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};n.scale.pow=function(){return uw(n.scale.linear(),1,[0,1])};n.scale.sqrt=function(){return n.scale.pow().exponent(.5)};n.scale.ordinal=function(){return fw([],{t:"range",a:[[]]})};n.scale.category10=function(){return n.scale.ordinal().range(fut)};n.scale.category20=function(){return n.scale.ordinal().range(eut)};n.scale.category20b=function(){return n.scale.ordinal().range(out)};n.scale.category20c=function(){return n.scale.ordinal().range(sut)};var fut=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(pu),eut=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(pu),out=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(pu),sut=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(pu);n.scale.quantile=function(){return ew([],[])};n.scale.quantize=function(){return ow(0,1,[0,1])};n.scale.threshold=function(){return sw([.5],[0,1])};n.scale.identity=function(){return hw([0,1])};n.svg={};n.svg.arc=function(){function n(){var n=Math.max(0,+t.apply(this,arguments)),o=Math.max(0,+i.apply(this,arguments)),g=u.apply(this,arguments)-h,nt=e.apply(this,arguments)-h,ei=Math.abs(nt-g),a=g>nt?0:1,wt,bt,kt,dt;if(n>o&&(et=o,o=n,n=et),ei>=krt)return l(o,a)+(n?l(n,1-a):"")+"Z";var et,ot,yt,pt,v,y,p,rt,b,k,d,st,ht=0,ut=0,w=[];if(((pt=(+c.apply(this,arguments)||0)/2)&&(yt=r===lu?Math.sqrt(n*n+o*o):+r.apply(this,arguments),a||(ut*=-1),o&&(ut=gt(yt/o*Math.sin(pt))),n&&(ht=gt(yt/n*Math.sin(pt)))),o)?(v=o*Math.cos(g+ut),y=o*Math.sin(g+ut),p=o*Math.cos(nt-ut),rt=o*Math.sin(nt-ut),wt=Math.abs(nt-g-2*ut)<=f?0:1,ut&&pf(v,y,p,rt)===a^wt&&(bt=(g+nt)/2,v=o*Math.cos(bt),y=o*Math.sin(bt),p=rt=null)):v=y=0,n?(b=n*Math.cos(nt-ht),k=n*Math.sin(nt-ht),d=n*Math.cos(g+ht),st=n*Math.sin(g+ht),kt=Math.abs(g-nt+2*ht)<=f?0:1,ht&&pf(b,k,d,st)===1-a^kt&&(dt=(g+nt)/2,b=n*Math.cos(dt),k=n*Math.sin(dt),d=st=null)):b=k=0,(et=Math.min(Math.abs(o-n)/2,+s.apply(this,arguments)))>.001){ot=o>n^a?0:1;var ft=null==d?[b,k]:null==p?[v,y]:ws([v,y],[d,st],[p,rt],[b,k]),ni=v-ft[0],ti=y-ft[1],ii=p-ft[0],ri=rt-ft[1],ui=1/Math.sin(Math.acos((ni*ii+ti*ri)/(Math.sqrt(ni*ni+ti*ti)*Math.sqrt(ii*ii+ri*ri)))/2),fi=Math.sqrt(ft[0]*ft[0]+ft[1]*ft[1]);if(null!=p){var tt=Math.min(et,(o-fi)/(ui+1)),ct=wf(null==d?[b,k]:[d,st],[v,y],o,tt,a),lt=wf([p,rt],[b,k],o,tt,a);et===tt?w.push("M",ct[0],"A",tt,",",tt," 0 0,",ot," ",ct[1],"A",o,",",o," 0 ",1-a^pf(ct[1][0],ct[1][1],lt[1][0],lt[1][1]),",",a," ",lt[1],"A",tt,",",tt," 0 0,",ot," ",lt[0]):w.push("M",ct[0],"A",tt,",",tt," 0 1,",ot," ",lt[0])}else w.push("M",v,",",y);if(null!=d){var it=Math.min(et,(n-fi)/(ui-1)),at=wf([v,y],[d,st],n,-it,a),vt=wf([b,k],null==p?[v,y]:[p,rt],n,-it,a);et===it?w.push("L",vt[0],"A",it,",",it," 0 0,",ot," ",vt[1],"A",n,",",n," 0 ",a^pf(vt[1][0],vt[1][1],at[1][0],at[1][1]),",",1-a," ",at[1],"A",it,",",it," 0 0,",ot," ",at[0]):w.push("L",vt[0],"A",it,",",it," 0 0,",ot," ",at[0])}else w.push("L",b,",",k)}else w.push("M",v,",",y),null!=p&&w.push("A",o,",",o," 0 ",wt,",",a," ",p,",",rt),w.push("L",b,",",k),null!=d&&w.push("A",n,",",n," 0 ",kt,",",1-a," ",d,",",st);return w.push("Z"),w.join("")}function l(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var t=ait,i=vit,s=lit,r=lu,u=cw,e=lw,c=yit;return n.innerRadius=function(i){return arguments.length?(t=o(i),n):t},n.outerRadius=function(t){return arguments.length?(i=o(t),n):i},n.cornerRadius=function(t){return arguments.length?(s=o(t),n):s},n.padRadius=function(t){return arguments.length?(r=t==lu?lu:o(t),n):r},n.startAngle=function(t){return arguments.length?(u=o(t),n):u},n.endAngle=function(t){return arguments.length?(e=o(t),n):e},n.padAngle=function(t){return arguments.length?(c=o(t),n):c},n.centroid=function(){var n=(+t.apply(this,arguments)+ +i.apply(this,arguments))/2,r=(+u.apply(this,arguments)+ +e.apply(this,arguments))/2-h;return[Math.cos(r)*n,Math.sin(r)*n]},n};lu="auto";n.svg.line=function(){return aw(v)};to=n.map({linear:d,"linear-closed":pit,step:wit,"step-before":ch,"step-after":lh,basis:vw,"basis-open":git,"basis-closed":nrt,bundle:trt,cardinal:dit,"cardinal-open":bit,"cardinal-closed":kit,monotone:urt});to.forEach(function(n,t){t.key=n;t.closed=/-closed$/.test(n)});var kb=[0,2/3,1/3,0],db=[0,1/3,2/3,0],oi=[0,1/6,2/3,1/6];n.svg.line.radial=function(){var n=aw(yw);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n};ch.reverse=lh;lh.reverse=ch;n.svg.area=function(){return pw(v)};n.svg.area.radial=function(){var n=pw(yw);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n};n.svg.chord=function(){function n(n,u){var f=c(this,i,n,u),e=c(this,r,n,u);return"M"+f.p0+l(f.r,f.p1,f.a1-f.a0)+(a(f,e)?t(f.r,f.p1,f.r,f.p0):t(f.r,f.p1,e.r,e.p0)+l(e.r,e.p1,e.a1-e.a0)+t(e.r,e.p1,f.r,f.p0))+"Z"}function c(n,t,i,r){var o=t.call(n,i,r),f=u.call(n,o,r),c=e.call(n,o,r)-h,l=s.call(n,o,r)-h;return{r:f,a0:c,a1:l,p0:[f*Math.cos(c),f*Math.sin(c)],p1:[f*Math.cos(l),f*Math.sin(l)]}}function a(n,t){return n.a0==t.a0&&n.a1==t.a1}function l(n,t,i){return"A"+n+","+n+" 0 "+ +(i>f)+",1 "+t}function t(n,t,i,r){return"Q 0,0 "+r}var i=as,r=vs,u=frt,e=cw,s=lw;return n.radius=function(t){return arguments.length?(u=o(t),n):u},n.source=function(t){return arguments.length?(i=o(t),n):i},n.target=function(t){return arguments.length?(r=o(t),n):r},n.startAngle=function(t){return arguments.length?(e=o(t),n):e},n.endAngle=function(t){return arguments.length?(s=o(t),n):s},n};n.svg.diagonal=function(){function n(n,u){var e=t.call(this,n,u),o=i.call(this,n,u),s=(e.y+o.y)/2,f=[e,{x:e.x,y:s},{x:o.x,y:s},o];return f=f.map(r),"M"+f[0]+"C"+f[1]+" "+f[2]+" "+f[3]}var t=as,i=vs,r=ww;return n.source=function(i){return arguments.length?(t=o(i),n):t},n.target=function(t){return arguments.length?(i=o(t),n):i},n.projection=function(t){return arguments.length?(r=t,n):r},n};n.svg.diagonal.radial=function(){var t=n.svg.diagonal(),i=ww,r=t.projection;return t.projection=function(n){return arguments.length?r(ert(i=n)):i},t};n.svg.symbol=function(){function n(n,r){return(ul.get(t.call(this,n,r))||bw)(i.call(this,n,r))}var t=srt,i=ort;return n.type=function(i){return arguments.length?(t=o(i),n):t},n.size=function(t){return arguments.length?(i=o(t),n):i},n};ul=n.map({circle:bw,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*fl)),i=t*fl;return"M0,"+-t+"L"+i+",0 0,"+t+" "+-i+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/au),i=t*au/2;return"M0,"+i+"L"+t+","+-i+" "+-t+","+-i+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/au),i=t*au/2;return"M0,"+-i+"L"+t+","+i+" "+-t+","+i+"Z"}});n.svg.symbolTypes=ul.keys();au=Math.sqrt(3);fl=Math.tan(30*u);e.transition=function(n){for(var r,t,u=gi||++gb,f=wh(n),e=[],h=io||{time:Date.now(),ease:hn,delay:0,duration:250},o=-1,c=this.length;++o<c;){e.push(r=[]);for(var s=this[o],i=-1,l=s.length;++i<l;)(t=s[i])&&kf(t,i,f,u,h),r.push(t)}return ru(e,f,u)};e.interrupt=function(n){return this.each(null==n?ro:kw(wh(n)))};var gi,io,ro=kw(wh()),a=[],gb=0;a.call=e.call;a.empty=e.empty;a.node=e.node;a.size=e.size;n.transition=function(t,i){return t&&t.transition?gi?t.transition(i):t:n.selection().transition(t)};n.transition.prototype=a;a.select=function(n){var f,i,t,e=this.id,o=this.namespace,s=[],r,h;for(n=co(n),r=-1,h=this.length;++r<h;){s.push(f=[]);for(var c=this[r],u=-1,l=c.length;++u<l;)(t=c[u])&&(i=n.call(t,t.__data__,u,r))?("__data__"in t&&(i.__data__=t.__data__),kf(i,u,o,e,t[o][e]),f.push(i)):f.push(null)}return ru(s,o,e)};a.selectAll=function(n){var h,u,t,f,c,e=this.id,o=this.namespace,l=[],i,a,r,y;for(n=gl(n),i=-1,a=this.length;++i<a;)for(var v=this[i],s=-1,p=v.length;++s<p;)if(t=v[s])for(c=t[o][e],u=n.call(t,t.__data__,s,i),l.push(h=[]),r=-1,y=u.length;++r<y;)(f=u[r])&&kf(f,r,o,e,c),h.push(f);return ru(l,o,e)};a.filter=function(n){var u,f,i,e=[],t,o;for("function"!=typeof n&&(n=sa(n)),t=0,o=this.length;o>t;t++){e.push(u=[]);for(var f=this[t],r=0,s=f.length;s>r;r++)(i=f[r])&&n.call(i,i.__data__,r,t)&&u.push(i)}return ru(e,this.namespace,this.id)};a.tween=function(n,t){var i=this.id,r=this.namespace;return arguments.length<2?this.node()[r][i].tween.get(n):at(this,null==t?function(t){t[r][i].tween.remove(n)}:function(u){u[r][i].tween.set(n,t)})};a.attr=function(t,i){function f(){this.removeAttribute(r)}function e(){this.removeAttributeNS(r.space,r.local)}function o(n){return null==n?f:(n+="",function(){var t,i=this.getAttribute(r);return i!==n&&(t=u(i,n),function(n){this.setAttribute(r,t(n))})})}function s(n){return null==n?e:(n+="",function(){var t,i=this.getAttributeNS(r.space,r.local);return i!==n&&(t=u(i,n),function(n){this.setAttributeNS(r.space,r.local,t(n))})})}if(arguments.length<2){for(i in t)this.attr(i,t[i]);return this}var u="transform"==t?hp:vi,r=n.ns.qualify(t);return ph(this,"attr."+t,i,r.local?s:o)};a.attrTween=function(t,i){function u(n,t){var u=i.call(this,n,t,this.getAttribute(r));return u&&function(n){this.setAttribute(r,u(n))}}function f(n,t){var u=i.call(this,n,t,this.getAttributeNS(r.space,r.local));return u&&function(n){this.setAttributeNS(r.space,r.local,u(n))}}var r=n.ns.qualify(t);return this.tween("attr."+t,r.local?f:u)};a.style=function(n,t,i){function u(){this.style.removeProperty(n)}function f(t){return null==t?u:(t+="",function(){var r,u=bt(this).getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(r=vi(u,t),function(t){this.style.setProperty(n,r(t),i)})})}var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(i in n)this.style(i,n[i],t);return this}i=""}return ph(this,"style."+n,t,f)};a.styleTween=function(n,t,i){function r(r,u){var f=t.call(this,r,u,bt(this).getComputedStyle(this,null).getPropertyValue(n));return f&&function(t){this.style.setProperty(n,f(t),i)}}return arguments.length<3&&(i=""),this.tween("style."+n,r)};a.text=function(n){return ph(this,"text",n,hrt)};a.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})};a.ease=function(t){var i=this.id,r=this.namespace;return arguments.length<1?this.node()[r][i].ease:("function"!=typeof t&&(t=n.ease.apply(n,arguments)),at(this,function(n){n[r][i].ease=t}))};a.delay=function(n){var t=this.id,i=this.namespace;return arguments.length<1?this.node()[i][t].delay:at(this,"function"==typeof n?function(r,u,f){r[i][t].delay=+n.call(r,r.__data__,u,f)}:(n=+n,function(r){r[i][t].delay=n}))};a.duration=function(n){var t=this.id,i=this.namespace;return arguments.length<1?this.node()[i][t].duration:at(this,"function"==typeof n?function(r,u,f){r[i][t].duration=Math.max(1,n.call(r,r.__data__,u,f))}:(n=Math.max(1,n),function(r){r[i][t].duration=n}))};a.each=function(t,i){var r=this.id,u=this.namespace,f,e;if(arguments.length<2){f=io;e=gi;try{gi=r;at(this,function(n,i,f){io=n[u][r];t.call(n,n.__data__,i,f)})}finally{io=f;gi=e}}else at(this,function(f){var e=f[u][r];(e.event||(e.event=n.dispatch("start","end","interrupt"))).on(t,i)});return this};a.transition=function(){for(var f,e,t,n,h=this.id,o=++gb,r=this.namespace,s=[],u=0,c=this.length;c>u;u++){s.push(f=[]);for(var e=this[u],i=0,l=e.length;l>i;i++)(t=e[i])&&(n=t[r][h],kf(t,i,r,o,{time:n.time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration})),f.push(t)}return ru(s,r,o)};n.svg.axis=function(){function i(i){i.each(function(){var a,rt=n.select(this),y=this.__chart__||o,i=this.__chart__=o.copy(),ht=null==h?i.ticks?i.ticks.apply(i,s):i.domain():h,ct=null==e?i.tickFormat?i.tickFormat.apply(i,s):v:e,w=rt.selectAll(".tick").data(ht,i),p=w.enter().insert("g",".domain").attr("class","tick").style("opacity",t),lt=n.transition(w.exit()).style("opacity",t).remove(),g=n.transition(w.order()).style("opacity",1),ut=Math.max(r,0)+c,b=af(i),ft=rt.selectAll(".domain").data([0]),et=(ft.enter().append("path").attr("class","domain"),n.transition(ft)),it,st;p.append("line");p.append("text");var nt,tt,k,d,at=p.select("line"),vt=g.select("line"),ot=w.select("text").text(ct),yt=p.select("text"),pt=g.select("text"),l="top"===f||"left"===f?-1:1;("bottom"===f||"top"===f?(a=crt,nt="x",k="y",tt="x2",d="y2",ot.attr("dy",0>l?"0em":".71em").style("text-anchor","middle"),et.attr("d","M"+b[0]+","+l*u+"V0H"+b[1]+"V"+l*u)):(a=lrt,nt="y",k="x",tt="y2",d="x2",ot.attr("dy",".32em").style("text-anchor",0>l?"end":"start"),et.attr("d","M"+l*u+","+b[0]+"H0V"+b[1]+"H"+l*u)),at.attr(d,l*r),yt.attr(k,l*ut),vt.attr(tt,0).attr(d,l*r),pt.attr(nt,0).attr(k,l*ut),i.rangeBand)?(it=i,st=it.rangeBand()/2,y=i=function(n){return it(n)+st}):y.rangeBand?y=i:lt.call(a,i,y);p.call(a,y,i);g.call(a,i,i)})}var e,o=n.scale.linear(),f=el,r=6,u=6,c=3,s=[10],h=null;return i.scale=function(n){return arguments.length?(o=n,i):o},i.orient=function(n){return arguments.length?(f=n in nk?n+"":el,i):f},i.ticks=function(){return arguments.length?(s=arguments,i):s},i.tickValues=function(n){return arguments.length?(h=n,i):h},i.tickFormat=function(n){return arguments.length?(e=n,i):e},i.tickSize=function(n){var t=arguments.length;return t?(r=+n,u=+arguments[t-1],i):r},i.innerTickSize=function(n){return arguments.length?(r=+n,i):r},i.outerTickSize=function(n){return arguments.length?(u=+n,i):u},i.tickPadding=function(n){return arguments.length?(c=+n,i):c},i.tickSubdivide=function(){return arguments.length&&i},i};el="bottom";nk={top:1,right:1,bottom:1,left:1};n.svg.brush=function(){function f(t){t.each(function(){var i=n.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",w).on("touchstart.brush",w),h=i.selectAll(".background").data([0]),e,t,o,s;h.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");e=i.selectAll(".resize").data(l,v);e.exit().remove();e.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return hut[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");e.style("display",f.empty()?"none":null);o=n.transition(i);s=n.transition(h);r&&(t=af(r),s.attr("x",t[0]).attr("width",t[1]-t[0]),y(o));u&&(t=af(u),s.attr("y",t[0]).attr("height",t[1]-t[0]),p(o));a(o)})}function a(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+t[+/e$/.test(n)]+","+i[+/^s/.test(n)]+")"})}function y(n){n.select(".extent").attr("x",t[0]);n.selectAll(".extent,.n>rect,.s>rect").attr("width",t[1]-t[0])}function p(n){n.select(".extent").attr("y",i[0]);n.selectAll(".extent,.e>rect,.w>rect").attr("height",i[1]-i[0])}function w(){function st(){32==n.event.keyCode&&(w||(v=null,l[0]-=t[1],l[1]-=i[1],w=2),kt())}function ht(){32==n.event.keyCode&&2==w&&(l[0]+=t[1],l[1]+=i[1],w=0,kt())}function g(){var f=n.mouse(b),e=!1;nt&&(f[0]+=nt[0],f[1]+=nt[1]);w||(n.event.altKey?(v||(v=[(t[0]+t[1])/2,(i[0]+i[1])/2]),l[0]=t[+(f[0]<v[0])],l[1]=i[+(f[1]<v[1])]):v=null);ct&&et(f,r,0)&&(y(k),e=!0);lt&&et(f,u,1)&&(p(k),e=!0);e&&(a(k),it({type:"brush",mode:w?"move":"resize"}))}function et(n,r,u){var f,y,k=af(r),p=k[0],b=k[1],c=l[u],a=u?i:t,d=a[1]-a[0];return w&&(p-=c,b-=d+c),f=(u?h:s)?Math.max(p,Math.min(b,n[u])):n[u],w?y=(f+=c)+d:(v&&(c=Math.max(p,Math.min(b,2*v[u]-f))),f>c?(y=f,f=c):y=c),a[0]!=f||a[1]!=y?(u?o=null:e=null,a[0]=f,a[1]=y,!0):void 0}function ot(){g();k.style("pointer-events","all").selectAll(".resize").style("display",f.empty()?"none":null);n.select("body").style("cursor",null);rt.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);at();it({type:"brushend"})}var v,nt,b=this,tt=n.select(n.event.target),it=c.of(b,arguments),k=n.select(b),d=tt.datum(),ct=!/^(n|s)$/.test(d)&&r,lt=!/^(e|w)$/.test(d)&&u,w=tt.classed("extent"),at=yu(b),l=n.mouse(b),rt=n.select(bt(b)).on("keydown.brush",st).on("keyup.brush",ht),ut,ft;(n.event.changedTouches?rt.on("touchmove.brush",g).on("touchend.brush",ot):rt.on("mousemove.brush",g).on("mouseup.brush",ot),k.interrupt().selectAll("*").interrupt(),w)?(l[0]=t[0]-l[0],l[1]=i[0]-l[1]):d?(ut=+/w$/.test(d),ft=+/^n/.test(d),nt=[t[1-ut]-l[0],i[1-ft]-l[1]],l[0]=t[ut],l[1]=i[ft]):n.event.altKey&&(v=l.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null);n.select("body").style("cursor",tt.style("cursor"));it({type:"brushstart"});g()}var e,o,c=ho(f,"brushstart","brush","brushend"),r=null,u=null,t=[0,0],i=[0,0],s=!0,h=!0,l=ol[0];return f.event=function(r){r.each(function(){var u=c.of(this,arguments),r={x:t,y:i,i:e,j:o},f=this.__chart__||r;this.__chart__=r;gi?n.select(this).transition().each("start.brush",function(){e=f.i;o=f.j;t=f.x;i=f.y;u({type:"brushstart"})}).tween("brush:brush",function(){var n=lf(t,r.x),f=lf(i,r.y);return e=o=null,function(e){t=r.x=n(e);i=r.y=f(e);u({type:"brush",mode:"resize"})}}).each("end.brush",function(){e=r.i;o=r.j;u({type:"brush",mode:"resize"});u({type:"brushend"})}):(u({type:"brushstart"}),u({type:"brush",mode:"resize"}),u({type:"brushend"}))})},f.x=function(n){return arguments.length?(r=n,l=ol[!r<<1|!u],f):r},f.y=function(n){return arguments.length?(u=n,l=ol[!r<<1|!u],f):u},f.clamp=function(n){return arguments.length?(r&&u?(s=!!n[0],h=!!n[1]):r?s=!!n:u&&(h=!!n),f):r&&u?[s,h]:r?s:u?h:null},f.extent=function(n){var s,h,c,l,a;return arguments.length?(r&&(s=n[0],h=n[1],u&&(s=s[0],h=h[0]),e=[s,h],r.invert&&(s=r(s),h=r(h)),s>h&&(a=s,s=h,h=a),(s!=t[0]||h!=t[1])&&(t=[s,h])),u&&(c=n[0],l=n[1],r&&(c=c[1],l=l[1]),o=[c,l],u.invert&&(c=u(c),l=u(l)),c>l&&(a=c,c=l,l=a),(c!=i[0]||l!=i[1])&&(i=[c,l])),f):(r&&(e?(s=e[0],h=e[1]):(s=t[0],h=t[1],r.invert&&(s=r.invert(s),h=r.invert(h)),s>h&&(a=s,s=h,h=a))),u&&(o?(c=o[0],l=o[1]):(c=i[0],l=i[1],u.invert&&(c=u.invert(c),l=u.invert(l)),c>l&&(a=c,c=l,l=a))),r&&u?[[s,c],[h,l]]:r?[s,h]:u&&[c,l])},f.clear=function(){return f.empty()||(t=[0,0],i=[0,0],e=o=null),f},f.empty=function(){return!!r&&t[0]==t[1]||!!u&&i[0]==i[1]},n.rebind(f,c,"on")};var hut={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},ol=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],sl=i.format=hc.timeFormat,tk=sl.utc,ik=tk("%Y-%m-%dT%H:%M:%S.%LZ");sl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?bh:ik;bh.parse=function(n){var t=new Date(n);return isNaN(t)?null:t};bh.toString=ik.toString;i.second=ci(function(n){return new y(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()});i.seconds=i.second.range;i.seconds.utc=i.second.utc.range;i.minute=ci(function(n){return new y(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()});i.minutes=i.minute.range;i.minutes.utc=i.minute.utc.range;i.hour=ci(function(n){var t=n.getTimezoneOffset()/60;return new y(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()});i.hours=i.hour.range;i.hours.utc=i.hour.utc.range;i.month=ci(function(n){return n=i.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()});i.months=i.month.range;i.months.utc=i.month.utc.range;var uo=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],hl=[[i.second,1],[i.second,5],[i.second,15],[i.second,30],[i.minute,1],[i.minute,5],[i.minute,15],[i.minute,30],[i.hour,1],[i.hour,3],[i.hour,6],[i.hour,12],[i.day,1],[i.day,2],[i.week,1],[i.month,1],[i.month,3],[i.year,1]],cut=sl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",rr]]),lut={range:function(t,i,r){return n.range(Math.ceil(t/r)*r,+i,r).map(yi)},floor:v,ceil:v};hl.year=i.year;i.scale=function(){return kh(n.scale.linear(),hl,cut)};cl=hl.map(function(n){return[n[0].utc,n[1]]});rk=tk.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",rr]]);cl.year=i.year.utc;i.scale.utc=function(){return kh(n.scale.linear(),cl,rk)};n.text=ts(function(n){return n.responseText});n.json=function(n,t){return wu(n,"application/json",art,t)};n.html=function(n,t){return wu(n,"text/html",vrt,t)};n.xml=ts(function(n){return n.responseXML});"function"==typeof define&&define.amd?define(n):"object"==typeof module&&module.exports&&(module.exports=n);this.d3=n}();__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var i,t;(function(n){n[n.Channel=0]="Channel";n[n.Dam=1]="Dam";n[n.Gate=2]="Gate";n[n.Spillway=3]="Spillway";n[n.Levee=4]="Levee"})(i=n.CrossSectionType||(n.CrossSectionType={}));t=function(){function n(t,i,r){this.chartMargin={top:30,left:0,bottom:0,right:0};this._renderLabels=function(n){var t=[],i;n instanceof Array?t=n:t.push(n);t=t.map(function(n){return{text:n.text,coordinates:n.coordinates||{x:0,y:0},anchor:n.anchor||"start",title:n.title||"",stroke:n.stroke||!1,cssClass:n.cssClass||""}});i=t.filter(function(n){return n.stroke===!0});this._svg.selectAll(".crossection-label-stroke").data(i,function(n){return n.text+"-Stroke"}).enter().append("text").attr("class",function(n){return"crossection-label-stroke "+n.cssClass}).attr("x",function(n){return n.coordinates.x}).attr("y",function(n){return n.coordinates.y}).attr("text-anchor",function(n){return n.anchor}).text(function(n){return n.text});this._svg.selectAll(".crossection-label-reg").data(t,function(n){return n.text}).enter().append("text").attr("class",function(n){return"crossection-label-reg "+n.cssClass}).attr("x",function(n){return n.coordinates.x}).attr("y",function(n){return n.coordinates.y}).attr("text-anchor",function(n){return n.anchor}).text(function(n){return n.text}).append("title").text(function(n){return n.title})};var u=r.width,o=u===void 0?n.viewPortWidth:u,f=r.height,s=f===void 0?n.viewPortHeight:f,e=r.showLabels,h=e===void 0?!0:e;this.container=t;this.width=o;this.height=s;this.showLabels=h;this.showLabels||(n.viewPortHeight=65,this.chartMargin={top:0,left:0,bottom:0,right:0});i instanceof Array?this.sensors=i:(this.sensors=[],this.sensors.push(i));this.sensors!=null&&(n.crossSectionStyles=this.sensors[0].Or_Site_Id==201?d3.select("head").append("style").html("\n                        .channelLine { fill:  #b9b9b5; stroke: #666; }\n                        .channelWater { fill: #b900a5; }\n                        .channelWaterRight { fill: url(#channelGradient);  }\n                        .spillwayWater { fill: url(#spillwayGradient);}\n                        .crossection-sensor-label { font-size:12px; }\n                        .crossection-sensor-sublabel { font-size:11px; }\n                        .crossection-label { font-family: Verdana; font-size: 14px; fill: #573f13; }\n                        .crossection-label-tob { }\n                        .crossection-label-stroke { stroke: #FFF; stroke-width: 2px; stroke-linejoin: round; }\n                        .gate { stroke: #ff0000; stroke-width: 2; stroke-dasharray: 5, 3;}\n                "):d3.select("head").append("style").html("\n                        .channelLine { fill:  #b9b9b5; stroke: #666; }\n                        .channelWater { fill: url(#channelGradient);}\n                        .channelWaterRight { fill: #b900a5; }\n                        .spillwayWater { fill: url(#spillwayGradient);}\n                        .crossection-sensor-label { font-size:12px; }\n                        .crossection-sensor-sublabel { font-size:11px; }\n                        .crossection-label { font-family: Verdana; font-size: 14px; fill: #573f13; }\n                        .crossection-label-tob { }\n                        .crossection-label-stroke { stroke: #FFF; stroke-width: 2px; stroke-linejoin: round; }\n                        .gate { stroke: #ff0000; stroke-width: 2; stroke-dasharray: 5, 3;}\n                "))}return n.prototype._getScaledPath=function(n,t,i){return n.split(" ").map(function(n){return n.split(",").map(function(n){return/\d/.test(n)?n:t(i[n])}).join(",")}).join(" ")},n}();t.render=function(n,t,o,s){var h=t instanceof Array?i[t[0].SiteType]:i[t.SiteType];switch(h){case i.Channel:new r(n,t,o,s);break;case i.Dam:new f(n,t,o);break;case i.Gate:new r(n,t,o,s);break;case i.Spillway:new u(n,t,o);break;case i.Levee:new e(n,t,o,s)}};t.crossSectionStyles=null;t.viewPortWidth=250;t.viewPortHeight=95;n.CrossSection=t;var r=function(n){function i(i,r,u,f){var e=n.call(this,i,r,u)||this;return e.channelPathPoints="0,TOB 51,TOB 100,BOC 151,BOC 200,TOB 249,TOB",e.graph=function(n){var t=this;this._svg.selectAll(".channelWater").data(n,function(n){return n.SensorId}).attr("y",function(n){return t.channelScale(n.CurrentLevel)}).attr("height",function(n){return t.graphHeight-t.channelScale(n.CurrentLevel)})},e.initalizeGraphic=function(n){var f,e,u;this.container.selectAll("*").remove();this._svg=this.container.append("svg").attr("width",this.width).attr("height",this.height).attr("viewBox","0 0 "+t.viewPortWidth+" "+t.viewPortHeight).append("g").attr("transform","translate("+this.chartMargin.left+","+this.chartMargin.top+")");f=this._svg.append("defs").append("linearGradient").attr("id","channelGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%").attr("spreadMethod","pad");f.append("stop").attr("offset","0%").attr("stop-color","#b0dceb").attr("stop-opacity",1);f.append("stop").attr("offset","100%").attr("stop-color","#a3cbd9").attr("stop-opacity",1);this._svg.append("clipPath").attr("id","lineClip").append("polygon").attr("points","0,0 "+this.channelPathPoints+" 249,0 0,0").attr("class","channelLine");var r=this.channelScale,s=this.sensors,e=d3.scale.ordinal().domain(["0","1"]).range(["channelWater channelWaterLeft","channelWater channelWaterRight"]);n!=null&&(e=n==201?d3.scale.ordinal().domain(["0","1"]).range(["channelWater channelWaterRight","channelWater channelWaterLeft"]):d3.scale.ordinal().domain(["0","1"]).range(["channelWater channelWaterLeft","channelWater channelWaterRight"]));var o=d3.scale.ordinal().domain(["0",(s.length-1).toString()]).rangeBands([0,t.viewPortWidth]),i=this,h=function(n,t){var i=t<0?Math.abs(t)+" feet below":t+" feet over",r=n==="Spillway"||n==="Dam"?"Spillway":"Bank";return"Water level is "+i+" Top of "+r},c=this._svg.selectAll("channelWater").data(this.sensors,function(n){return n.SensorId}).enter().append("rect").attr("class",function(n,t){return e(t)}).attr("x",function(n,t){return o(t)}).attr("y",function(n){return r(n.CurrentLevel)}).attr("clip-path","url(#lineClip)").attr("height",function(n){return i.graphHeight-r(n.CurrentLevel)}).attr("width",function(){return o.rangeBand()}).append("title").text(function(n){return h(n.SiteType,n.LevelFromTob)});this._svg.append("polygon").attr("class","channelLine").attr("points","0,"+this.graphHeight+" "+this.channelPathPoints+" 249,"+this.graphHeight+" 0,"+this.graphHeight);this.showLabels&&(u=this.sensors.filter(function(n){return n.label}).map(function(n,t){return{text:n.label,anchor:n.labelPosition||"start",coordinates:{x:t==0?0:i.width,y:-15},title:"Sensor located on "+n.label+" side",cssClass:"crossection-sensor-label"}}),u.push({coordinates:{x:0,y:r(this.sensors[0].TOB)-2},stroke:!0,cssClass:"crossection-label"}),u.push({text:"BOS",coordinates:{x:50,y:r(this.sensors[0].BOC)},title:"Bottom of Stream",cssClass:"crossection-label"}),this._renderLabels(u));this.sensors.length>1&&this._svg.append("path").attr("class","gate").attr("d",function(){var r=t.viewPortWidth/2,n=i.channelScale(i.sensors[0].TOB),u=i.channelScale(i.sensors[0].BOC);return"M "+r+" "+n+" l 0 "+(u-n)})},e.graphWidth=t.viewPortWidth-e.chartMargin.left-e.chartMargin.right,e.graphHeight=t.viewPortHeight-e.chartMargin.top-e.chartMargin.bottom,e.channelScale=d3.scale.linear().range([e.graphHeight-5,10,0]).domain([e.sensors[0].BOC,e.sensors[0].TOB,e.sensors[0].TOB+1]).clamp(!0),e.channelPathPoints=e._getScaledPath(e.channelPathPoints,e.channelScale,e.sensors[0]),e.initalizeGraphic(f),e}return __extends(i,n),i}(t),u=function(n){function i(i,r,u){var f=n.call(this,i,r,u)||this;return f.channelPathPoints="0,BOC 42,BOC 83,TOB 125,TOB 125,BOC 249,BOC",f.graph=function(n){var t=this;this._svg.selectAll(".spillwayWater").data([n]).aatr("x",0).attr("y",function(){return t.spillwayScale(n)}).attr("clip-path","url(#spillwayClip)").attr("height",function(){return t.graphHeight-t.spillwayScale(n)}).attr("width",function(){return t.sensor.CurrentLevel>t.sensor.TOB?250:83})},f.initalizeGraphic=function(){var u,e,o,i,f;this.container.selectAll("*").remove();this._svg=this.container.append("svg").attr("width",this.width).attr("height",this.height).attr("viewBox","0 0 "+t.viewPortWidth+" "+t.viewPortHeight).append("g").attr("transform","translate("+this.chartMargin.left+","+this.chartMargin.top+")");u=this._svg.append("defs").append("linearGradient").attr("id","spillwayGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%").attr("spreadMethod","pad");u.append("stop").attr("offset","0%").attr("stop-color","#b0dceb").attr("stop-opacity",1);u.append("stop").attr("offset","100%").attr("stop-color","#a3cbd9").attr("stop-opacity",1);var r=this.spillwayScale,s=this.spillwayClipWidth,n=this;this._svg.append("clipPath").attr("id","spillwayClip").append("polygon").attr("points",function(){var e=n.sensor.CurrentLevel;if(n.sensor.CurrentLevel-n.sensor.TOB<=.001)return n._getScaledPath("0,TOB 0,BOC 42,BOC 83,TOB 125,TOB 125,BOC 125,TOB 0,TOB",n.spillwayScale,n.sensors[0]);var t=+s(n.sensor.CurrentLevel-n.sensor.TOB).toFixed(1),u=n.channelPathPoints,r=59-t,i=6-t,f=[[249,r],[130+t,r],[126+t,i+5],[125+t,i+4],[124+t,i+3],[123+t,i+2],[122+t,i+1],[121+t,i],[125,i],[0,i]].map(function(n){return n.join(",")}).join(" ");return"0,0 "+u+" "+f}).attr("class","spillwayClip");e=this._svg.append("rect").attr("class","spillwayWater").attr("x",0).attr("y",function(){return r(n.sensor.CurrentLevel)}).attr("clip-path","url(#spillwayClip)").attr("height",function(){return r(n.sensor.BOC)-r(n.sensor.CurrentLevel)}).attr("width",250);o=this.sensor.LevelFromTob<0?Math.abs(this.sensor.LevelFromTob)+" feet below":this.sensor.LevelFromTob+" feet over";e.append("title").text("Water level is "+o+" Top of Spillway");this._svg.append("polygon").attr("class","channelLine").attr("points","0,65 "+this.channelPathPoints+" 249,65 0,65");this.showLabels&&(i=this.sensors.filter(function(n){return n.label}).map(function(n){return{text:n.label,anchor:n.labelPosition||"start",coordinates:{x:0,y:-15},title:n.label+" side",cssClass:"crossection-sensor-label"}}),i=i.concat(this.sensors.filter(function(n){return n.downstreamLabel}).map(function(t){return{text:t.downstreamLabel,anchor:"end",coordinates:{x:n.width,y:-15},title:t.downstreamLabel+" side",cssClass:"crossection-sensor-label"}})),f=this.sensor.TOB_Label!=null&&this.sensor.TOB_Label!=undefined&&this.sensor.TOB_Label!=""?this.sensor.TOB_Label:"Spillway",i.push({text:f,coordinates:{x:105,y:r(this.sensor.TOB)-7},title:f+" (Elevation: "+this.sensor.TOB+" ft)",stroke:!0,anchor:"middle",cssClass:"crossection-label"}),this._renderLabels(i))},f.graphWidth=t.viewPortWidth-f.chartMargin.left-f.chartMargin.right,f.graphHeight=t.viewPortHeight-f.chartMargin.top-f.chartMargin.bottom,f.sensor=f.sensors[0],f.spillwayScale=d3.scale.linear().range([f.graphHeight-5,10,0]).domain([f.sensor.BOC,f.sensor.TOB,f.sensor.TOB+10]).clamp(!0),f.spillwayClipWidth=d3.scale.linear().range([0,6]).domain([0,2]).clamp(!0),f.channelPathPoints=f._getScaledPath(f.channelPathPoints,f.spillwayScale,f.sensors[0]),f.initalizeGraphic(),f}return __extends(i,n),i}(t),f=function(n){function i(i,u,f){var e=n.call(this,i,u,f)||this;return e.channelPathPoints="0,BOC 51,BOC 100,TOB 151,TOB 200,BOC 249,BOC",e.graph=function(n){var t=this;this._svg.selectAll(".channelWater").data([n]).attr("y",function(){return t.channelScale(n)}).attr("height",function(){return r.viewPortHeight-t.channelScale(n)})},e.initalizeGraphic=function(){var u,n,f;this.container.selectAll("*").remove();this._svg=this.container.append("svg").attr("width",this.width).attr("height",this.height).attr("viewBox","0 0 "+t.viewPortWidth+" "+t.viewPortHeight).append("g").attr("transform","translate("+this.chartMargin.left+","+this.chartMargin.top+")");u=this._svg.append("defs").append("linearGradient").attr("id","channelGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%").attr("spreadMethod","pad");u.append("stop").attr("offset","0%").attr("stop-color","#b0dceb").attr("stop-opacity",1);u.append("stop").attr("offset","100%").attr("stop-color","#a3cbd9").attr("stop-opacity",1);this._svg.append("clipPath").attr("id","lineClip").append("polygon").attr("points","0,10 "+this.channelPathPoints+" 249,10 0,10").attr("class","channelLine");var i=this.channelScale,r=this,e=this._svg.append("rect").attr("class","channelWater").attr("x",0).attr("y",function(){return i(r.sensor.CurrentLevel)}).attr("clip-path","url(#lineClip)").attr("height",function(){return i(r.sensor.BOC)-i(r.sensor.CurrentLevel)}).attr("width",151),o=this.sensor.LevelFromTob<0?Math.abs(this.sensor.LevelFromTob)+" feet below":this.sensor.LevelFromTob+" feet over";e.append("title").text("Water level is "+o+" Top of Spillway");this._svg.append("polygon").attr("class","channelLine").attr("points","0,65 "+this.channelPathPoints+" 249,65 0,65");this.showLabels&&(n=this.sensors.filter(function(n){return n.label}).map(function(n){return{text:n.label,anchor:n.labelPosition||"start",coordinates:{x:0,y:-15},title:n.label+" side",cssClass:"crossection-sensor-label"}}),n=n.concat(this.sensors.filter(function(n){return n.downstreamLabel}).map(function(n){return{text:n.downstreamLabel,anchor:"end",coordinates:{x:r.width,y:-15},title:n.downstreamLabel+" side",cssClass:"crossection-sensor-label"}})),f=this.sensor.TOB_Label!=null&&this.sensor.TOB_Label!=undefined&&this.sensor.TOB_Label!=""?this.sensor.TOB_Label:"Top of Spillway",n.push({text:f,coordinates:{x:125,y:i(this.sensor.TOB)-7},title:f+" (Elevation: "+this.sensor.TOB+" ft)",stroke:!0,anchor:"middle",cssClass:"crossection-label"}),this._renderLabels(n))},e.graphWidth=t.viewPortWidth-e.chartMargin.left-e.chartMargin.right,e.graphHeight=t.viewPortHeight-e.chartMargin.top-e.chartMargin.bottom,e.sensor=e.sensors[0],e.channelScale=d3.scale.linear().range([e.graphHeight-5,20,14]).domain([e.sensor.BOC,e.sensor.TOB,e.sensor.TOB+5]).clamp(!0),e.channelPathPoints=e._getScaledPath(e.channelPathPoints,e.channelScale,e.sensors[0]),e.initalizeGraphic(),e}return __extends(i,n),i}(t),e=function(n){function i(i,r,u,f){var e=n.call(this,i,r,u)||this;return e.channelPathPoints="0,BOC 51,BOC 100,TOB 151,TOB 200,BOC 249,BOC",e.graph=function(n){var t=this;this._svg.selectAll(".channelWater").data(n,function(n){return n.SensorId}).attr("y",function(n){return t.channelScale(n.CurrentLevel)}).attr("height",function(n){return t.graphHeight-t.channelScale(n.CurrentLevel)})},e.initalizeGraphic=function(n){var r,o,i,e;this.container.selectAll("*").remove();this._svg=this.container.append("svg").attr("width",this.width).attr("height",this.height).attr("viewBox","0 0 "+t.viewPortWidth+" "+t.viewPortHeight).append("g").attr("transform","translate("+this.chartMargin.left+","+this.chartMargin.top+")");r=this._svg.append("defs").append("linearGradient").attr("id","channelGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%").attr("spreadMethod","pad");r.append("stop").attr("offset","0%").attr("stop-color","#b0dceb").attr("stop-opacity",1);r.append("stop").attr("offset","100%").attr("stop-color","#a3cbd9").attr("stop-opacity",1);this._svg.append("clipPath").attr("id","lineClip").append("polygon").attr("points","0,10 "+this.channelPathPoints+" 249,10 0,10").attr("class","channelLine");var u=this.channelScale,h=this.sensors,o=d3.scale.ordinal().domain(["0","1"]).range(["channelWater channelWaterLeft","channelWater channelWaterRight"]);n!=null&&(o=n==201?d3.scale.ordinal().domain(["0","1"]).range(["channelWater channelWaterRight","channelWater channelWaterLeft"]):d3.scale.ordinal().domain(["0","1"]).range(["channelWater channelWaterLeft","channelWater channelWaterRight"]));var s=d3.scale.ordinal().domain(["0",(h.length-1).toString()]).rangeBands([0,t.viewPortWidth]),f=this,c=function(n,t){var i=t<0?Math.abs(t)+" feet below":t+" feet over";return"Water level is "+i+" Top of Bank"},l=this._svg.selectAll("channelWater").data(this.sensors,function(n){return n.SensorId}).enter().append("rect").attr("class",function(n,t){return o(t)}).attr("x",function(n,t){return s(t)}).attr("y",function(n){return u(n.CurrentLevel)}).attr("clip-path","url(#lineClip)").attr("height",function(n){return f.graphHeight-u(n.CurrentLevel)}).attr("width",function(){return s.rangeBand()}).append("title").text(function(n){return c(n.SiteType,n.LevelFromTob)});this._svg.append("polygon").attr("class","channelLine").attr("points","0,65 "+this.channelPathPoints+" 249,65 0,65");this.showLabels&&(i=this.sensors.filter(function(n){return n.label}).map(function(n,t){return{text:n.label,anchor:n.labelPosition||"start",coordinates:{x:t==0?0:f.width,y:-17},title:"Sensor located on "+n.label+" side",cssClass:"crossection-sensor-label"}}),i=i.concat(this.sensors.map(function(n,t){return{text:t==0?"(Inside Levee)":"(Outside Levee)",anchor:n.labelPosition||"start",coordinates:{x:t==0?0:f.width,y:-3},title:"Sensor located on "+n.label+" side",cssClass:"crossection-sensor-sublabel"}})),e=this.sensors[0].TOB_Label!=null&&this.sensors[0].TOB_Label!=undefined&&this.sensors[0].TOB_Label!=""?this.sensors[0].TOB_Label:"Top of Levee",i.push({text:e,coordinates:{x:125,y:u(this.sensors[0].TOB)-6},title:e+" (Elevation: "+this.sensors[0].TOB+" ft)",stroke:!0,anchor:"middle",cssClass:"crossection-label"}),this._renderLabels(i))},e.graphWidth=t.viewPortWidth-e.chartMargin.left-e.chartMargin.right,e.graphHeight=t.viewPortHeight-e.chartMargin.top-e.chartMargin.bottom,e.channelScale=d3.scale.linear().range([e.graphHeight-5,20,14]).domain([e.sensors[0].BOC,e.sensors[0].TOB,e.sensors[0].TOB+5]).clamp(!0),e.channelPathPoints=e._getScaledPath(e.channelPathPoints,e.channelScale,e.sensors[0]),e.initalizeGraphic(f),e}return __extends(i,n),i}(t)}(channelGraphics||(channelGraphics={}));!function(n){"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?module.exports=n():window.noUiSlider=n()}(function(){"use strict";function k(n){return"object"==typeof n&&"function"==typeof n.to&&"function"==typeof n.from}function d(n){n.parentElement.removeChild(n)}function c(n){return null!==n&&void 0!==n}function l(n){n.preventDefault()}function g(n){return n.filter(function(n){return!this[n]&&(this[n]=!0)},{})}function nt(n,t){return Math.round(n/t)*t}function tt(n,t){var r=n.getBoundingClientRect(),u=n.ownerDocument,f=u.documentElement,i=y(u);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(i.x=0),t?r.top+i.y-f.clientTop:r.left+i.x-f.clientLeft}function i(n){return"number"==typeof n&&!isNaN(n)&&isFinite(n)}function a(n,i,r){r>0&&(t(n,i),setTimeout(function(){u(n,i)},r))}function v(n){return Math.max(Math.min(n,100),0)}function e(n){return Array.isArray(n)?n:[n]}function it(n){n=String(n);var t=n.split(".");return t.length>1?t[1].length:0}function t(n,t){n.classList?n.classList.add(t):n.className+=" "+t}function u(n,t){n.classList?n.classList.remove(t):n.className=n.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function rt(n,t){return n.classList?n.classList.contains(t):new RegExp("\\b"+t+"\\b").test(n.className)}function y(n){var t=void 0!==window.pageXOffset,i="CSS1Compat"===(n.compatMode||"");return{x:t?window.pageXOffset:i?n.documentElement.scrollLeft:n.body.scrollLeft,y:t?window.pageYOffset:i?n.documentElement.scrollTop:n.body.scrollTop}}function ut(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function ft(){var n=!1,t;try{t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("test",null,t)}catch(n){}return n}function et(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function o(n,t){return 100/(t-n)}function s(n,t){return 100*t/(n[1]-n[0])}function ot(n,t){return s(n,n[0]<0?t+Math.abs(n[0]):t-n[0])}function st(n,t){return t*(n[1]-n[0])/100+n[0]}function f(n,t){for(var i=1;n>=t[i];)i+=1;return i}function ht(n,t,i){if(i>=n.slice(-1)[0])return 100;var r=f(i,n),e=n[r-1],s=n[r],u=t[r-1],h=t[r];return u+ot([e,s],i)/o(u,h)}function ct(n,t,i){if(i>=100)return n.slice(-1)[0];var r=f(i,t),e=n[r-1],s=n[r],u=t[r-1];return st([e,s],(i-u)*o(u,t[r]))}function lt(n,t,i,r){if(100===r)return r;var u=f(r,n),e=n[u-1],o=n[u];return i?r-e>(o-e)/2?o:e:t[u-1]?n[u-1]+nt(r-n[u-1],t[u-1]):r}function at(t,r,u){var f;if("number"==typeof r&&(r=[r]),!Array.isArray(r))throw new Error("noUiSlider ("+n+"): 'range' contains invalid value.");if(f="min"===t?0:"max"===t?100:parseFloat(t),!i(f)||!i(r[0]))throw new Error("noUiSlider ("+n+"): 'range' value isn't numeric.");u.xPct.push(f);u.xVal.push(r[0]);f?u.xSteps.push(!isNaN(r[1])&&r[1]):isNaN(r[1])||(u.xSteps[0]=r[1]);u.xHighestCompleteStep.push(0)}function vt(n,t,i){if(!t)return!0;i.xSteps[n]=s([i.xVal[n],i.xVal[n+1]],t)/o(i.xPct[n],i.xPct[n+1]);var r=(i.xVal[n+1]-i.xVal[n])/i.xNumSteps[n],u=Math.ceil(Number(r.toFixed(3))-1),f=i.xVal[n]+i.xNumSteps[n]*u;i.xHighestCompleteStep[n]=f}function r(n,t,i){this.xPct=[];this.xVal=[];this.xSteps=[i||!1];this.xNumSteps=[!1];this.xHighestCompleteStep=[];this.snap=t;var r,u=[];for(r in n)n.hasOwnProperty(r)&&u.push([n[r],r]);for(u.length&&"object"==typeof u[0][0]?u.sort(function(n,t){return n[0][0]-t[0][0]}):u.sort(function(n,t){return n[0]-t[0]}),r=0;r<u.length;r++)at(u[r][1],u[r][0],this);for(this.xNumSteps=this.xSteps.slice(0),r=0;r<this.xNumSteps.length;r++)vt(r,this.xNumSteps[r],this)}function p(t){if(k(t))return!0;throw new Error("noUiSlider ("+n+"): 'format' requires 'to' and 'from' methods.");}function yt(t,r){if(!i(r))throw new Error("noUiSlider ("+n+"): 'step' is not numeric.");t.singleStep=r}function pt(t,i){if("object"!=typeof i||Array.isArray(i))throw new Error("noUiSlider ("+n+"): 'range' is not an object.");if(void 0===i.min||void 0===i.max)throw new Error("noUiSlider ("+n+"): Missing 'min' or 'max' in 'range'.");if(i.min===i.max)throw new Error("noUiSlider ("+n+"): 'range' 'min' and 'max' cannot be equal.");t.spectrum=new r(i,t.snap,t.singleStep)}function wt(t,i){if(i=e(i),!Array.isArray(i)||!i.length)throw new Error("noUiSlider ("+n+"): 'start' option is incorrect.");t.handles=i.length;t.start=i}function bt(t,i){if(t.snap=i,"boolean"!=typeof i)throw new Error("noUiSlider ("+n+"): 'snap' option must be a boolean.");}function kt(t,i){if(t.animate=i,"boolean"!=typeof i)throw new Error("noUiSlider ("+n+"): 'animate' option must be a boolean.");}function dt(t,i){if(t.animationDuration=i,"number"!=typeof i)throw new Error("noUiSlider ("+n+"): 'animationDuration' option must be a number.");}function gt(t,i){var u,r=[!1];if("lower"===i?i=[!0,!1]:"upper"===i&&(i=[!1,!0]),!0===i||!1===i){for(u=1;u<t.handles;u++)r.push(i);r.push(!1)}else{if(!Array.isArray(i)||!i.length||i.length!==t.handles+1)throw new Error("noUiSlider ("+n+"): 'connect' option doesn't match handle count.");r=i}t.connect=r}function ni(t,i){switch(i){case"horizontal":t.ort=0;break;case"vertical":t.ort=1;break;default:throw new Error("noUiSlider ("+n+"): 'orientation' option is invalid.");}}function w(t,r){if(!i(r))throw new Error("noUiSlider ("+n+"): 'margin' option must be numeric.");if(0!==r&&(t.margin=t.spectrum.getMargin(r),!t.margin))throw new Error("noUiSlider ("+n+"): 'margin' option is only supported on linear sliders.");}function ti(t,r){if(!i(r))throw new Error("noUiSlider ("+n+"): 'limit' option must be numeric.");if(t.limit=t.spectrum.getMargin(r),!t.limit||t.handles<2)throw new Error("noUiSlider ("+n+"): 'limit' option is only supported on linear sliders with 2 or more handles.");}function ii(t,r){if(!i(r)&&!Array.isArray(r))throw new Error("noUiSlider ("+n+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(Array.isArray(r)&&2!==r.length&&!i(r[0])&&!i(r[1]))throw new Error("noUiSlider ("+n+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(0!==r){if(Array.isArray(r)||(r=[r,r]),t.padding=[t.spectrum.getMargin(r[0]),t.spectrum.getMargin(r[1])],!1===t.padding[0]||!1===t.padding[1])throw new Error("noUiSlider ("+n+"): 'padding' option is only supported on linear sliders.");if(t.padding[0]<0||t.padding[1]<0)throw new Error("noUiSlider ("+n+"): 'padding' option must be a positive number(s).");if(t.padding[0]+t.padding[1]>=100)throw new Error("noUiSlider ("+n+"): 'padding' option must not exceed 100% of the range.");}}function ri(t,i){switch(i){case"ltr":t.dir=0;break;case"rtl":t.dir=1;break;default:throw new Error("noUiSlider ("+n+"): 'direction' option was not recognized.");}}function ui(t,i){if("string"!=typeof i)throw new Error("noUiSlider ("+n+"): 'behaviour' must be a string containing options.");var f=i.indexOf("tap")>=0,e=i.indexOf("drag")>=0,r=i.indexOf("fixed")>=0,u=i.indexOf("snap")>=0,o=i.indexOf("hover")>=0;if(r){if(2!==t.handles)throw new Error("noUiSlider ("+n+"): 'fixed' behaviour must be used with 2 handles");w(t,t.start[1]-t.start[0])}t.events={tap:f||u,drag:e,fixed:r,snap:u,hover:o}}function fi(t,i){if(!1!==i)if(!0===i){t.tooltips=[];for(var r=0;r<t.handles;r++)t.tooltips.push(!0)}else{if(t.tooltips=e(i),t.tooltips.length!==t.handles)throw new Error("noUiSlider ("+n+"): must pass a formatter for all handles.");t.tooltips.forEach(function(t){if("boolean"!=typeof t&&("object"!=typeof t||"function"!=typeof t.to))throw new Error("noUiSlider ("+n+"): 'tooltips' must be passed a formatter or 'false'.");})}}function ei(n,t){n.ariaFormat=t;p(t)}function oi(n,t){n.format=t;p(t)}function si(t,i){if("string"!=typeof i&&!1!==i)throw new Error("noUiSlider ("+n+"): 'cssPrefix' must be a string or `false`.");t.cssPrefix=i}function hi(t,i){if("object"!=typeof i)throw new Error("noUiSlider ("+n+"): 'cssClasses' must be an object.");if("string"==typeof t.cssPrefix){t.cssClasses={};for(var r in i)i.hasOwnProperty(r)&&(t.cssClasses[r]=t.cssPrefix+i[r])}else t.cssClasses=i}function b(t){var i={margin:0,limit:0,padding:0,animate:!0,animationDuration:300,ariaFormat:h,format:h},r={step:{r:!1,t:yt},start:{r:!0,t:wt},connect:{r:!0,t:gt},direction:{r:!0,t:ri},snap:{r:!1,t:bt},animate:{r:!1,t:kt},animationDuration:{r:!1,t:dt},range:{r:!0,t:pt},orientation:{r:!1,t:ni},margin:{r:!1,t:w},limit:{r:!1,t:ti},padding:{r:!1,t:ii},behaviour:{r:!0,t:ui},ariaFormat:{r:!1,t:ei},format:{r:!1,t:oi},tooltips:{r:!1,t:fi},cssPrefix:{r:!0,t:si},cssClasses:{r:!0,t:hi}},u={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal",cssPrefix:"noUi-",cssClasses:{target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"}},e;t.format&&!t.ariaFormat&&(t.ariaFormat=t.format);Object.keys(r).forEach(function(f){if(!c(t[f])&&void 0===u[f]){if(r[f].r)throw new Error("noUiSlider ("+n+"): '"+f+"' is required.");return!0}r[f].t(i,c(t[f])?t[f]:u[f])});i.pips=t.pips;var f=document.createElement("div"),o=void 0!==f.style.msTransform,s=void 0!==f.style.transform;return i.transformRule=s?"transform":o?"msTransform":"webkitTransform",e=[["left","top"],["right","bottom"]],i.style=e[i.dir][i.ort],i}function ci(i,r,f){function k(n,i){var r=ct.createElement("div");return i&&t(r,i),n.appendChild(r),r}function pi(n,i){var f=k(n,r.cssClasses.origin),u=k(f,r.cssClasses.handle);return u.setAttribute("data-handle",i),u.setAttribute("tabindex","0"),u.setAttribute("role","slider"),u.setAttribute("aria-orientation",r.ort?"vertical":"horizontal"),0===i?t(u,r.cssClasses.handleLower):i===r.handles-1&&t(u,r.cssClasses.handleUpper),f}function fi(n,t){return!!t&&k(n,r.cssClasses.connect)}function wi(n,t){var u=k(t,r.cssClasses.connects),i;for(o=[],it=[],it.push(fi(u,n[0])),i=0;i<r.handles;i++)o.push(pi(t,i)),ht[i]=i,it.push(fi(u,n[i+1]))}function bi(n){t(n,r.cssClasses.target);0===r.dir?t(n,r.cssClasses.ltr):t(n,r.cssClasses.rtl);0===r.ort?t(n,r.cssClasses.horizontal):t(n,r.cssClasses.vertical);nt=k(n,r.cssClasses.base)}function ki(n,t){return!!r.tooltips[t]&&k(n.firstChild,r.cssClasses.tooltip)}function di(){var n=o.map(ki);ti("update",function(t,i,u){if(n[i]){var f=t[i];!0!==r.tooltips[i]&&(f=r.tooltips[i].to(u[i]));n[i].innerHTML=f}})}function gi(){ti("update",function(n,t,i,u,f){ht.forEach(function(n){var t=o[n],u=at(h,n,0,!0,!0,!0),e=at(h,n,100,!0,!0,!0),s=f[n],c=r.ariaFormat.to(i[n]);t.children[0].setAttribute("aria-valuemin",u.toFixed(1));t.children[0].setAttribute("aria-valuemax",e.toFixed(1));t.children[0].setAttribute("aria-valuenow",s.toFixed(1));t.children[0].setAttribute("aria-valuetext",c)})})}function nr(t,i,r){if("range"===t||"steps"===t)return s.xVal;if("count"===t){if(i<2)throw new Error("noUiSlider ("+n+"): 'values' (>= 2) required for mode 'count'.");var u=i-1,f=100/u;for(i=[];u--;)i[u]=u*f;i.push(100);t="positions"}return"positions"===t?i.map(function(n){return s.fromStepping(r?s.getStep(n):n)}):"values"===t?r?i.map(function(n){return s.fromStepping(s.getStep(s.toStepping(n)))}):i:void 0}function tr(n,t,i){function c(n,t){return(n+t).toFixed(7)/1}var r={},f=s.xVal[0],e=s.xVal[s.xVal.length-1],o=!1,h=!1,u=0;return i=g(i.slice().sort(function(n,t){return n-t})),i[0]!==f&&(i.unshift(f),o=!0),i[i.length-1]!==e&&(i.push(e),h=!0),i.forEach(function(f,e){var a,l,v,y,w,g,b,nt,k,tt,d=f,p=i[e+1];if("steps"===t&&(a=s.xNumSteps[e]),a||(a=p-d),!1!==d&&void 0!==p)for(a=Math.max(a,1e-7),l=d;l<=p;l=c(l,a)){for(y=s.toStepping(l),w=y-u,nt=w/n,k=Math.round(nt),tt=w/k,v=1;v<=k;v+=1)g=u+v*tt,r[g.toFixed(5)]=["x",0];b=i.indexOf(l)>-1?1:"steps"===t?2:0;!e&&o&&(b=0);l===p&&h||(r[y.toFixed(5)]=[l,b]);u=y}}),r}function ir(n,i,u){function e(n,t){var i=t===r.cssClasses.value,u=i?c:l,f=i?s:h;return t+" "+u[r.ort]+" "+f[n]}function o(n,t){t[1]=t[1]&&i?i(t[0],t[1]):t[1];var o=k(f,!1);o.className=e(t[1],r.cssClasses.marker);o.style[r.style]=n+"%";t[1]&&(o=k(f,!1),o.className=e(t[1],r.cssClasses.value),o.setAttribute("data-value",t[0]),o.style[r.style]=n+"%",o.innerText=u.to(t[0]))}var f=ct.createElement("div"),s=[r.cssClasses.valueNormal,r.cssClasses.valueLarge,r.cssClasses.valueSub],h=[r.cssClasses.markerNormal,r.cssClasses.markerLarge,r.cssClasses.markerSub],c=[r.cssClasses.valueHorizontal,r.cssClasses.valueVertical],l=[r.cssClasses.markerHorizontal,r.cssClasses.markerVertical];return t(f,r.cssClasses.pips),t(f,0===r.ort?r.cssClasses.pipsHorizontal:r.cssClasses.pipsVertical),Object.keys(n).forEach(function(t){o(t,n[t])}),f}function ei(){wt&&(d(wt),wt=null)}function dt(n){ei();var t=n.mode,i=n.density||1,r=n.filter||!1,u=n.values||!1,f=n.stepped||!1,e=nr(t,u,f),o=tr(i,t,e),s=n.format||{to:Math.round};return wt=c.appendChild(ir(o,r,s))}function oi(){var n=nt.getBoundingClientRect(),t="offset"+["Width","Height"][r.ort];return 0===r.ort?n.width||nt[t]:n.height||nt[t]}function ot(n,t,i,u){var f=function(f){return!!(f=rr(f,u.pageOffset,u.target||t))&&!(c.hasAttribute("disabled")&&!u.doNotReject)&&!(rt(c,r.cssClasses.tap)&&!u.doNotReject)&&!(n===st.start&&void 0!==f.buttons&&f.buttons>1)&&(!u.hover||!f.buttons)&&(yi||f.preventDefault(),f.calcPoint=f.points[r.ort],void i(f,u))},e=[];return n.split(" ").forEach(function(n){t.addEventListener(n,f,!!yi&&{passive:!0});e.push([n,f])}),e}function rr(n,t,i){var r,u,c=0===n.type.indexOf("touch"),h=0===n.type.indexOf("mouse"),o=0===n.type.indexOf("pointer"),s,f,e;if(0===n.type.indexOf("MSPointer")&&(o=!0),c)if(s=function(n){return n.target===i||i.contains(n.target)},"touchstart"===n.type){if(f=Array.prototype.filter.call(n.touches,s),f.length>1)return!1;r=f[0].pageX;u=f[0].pageY}else{if(e=Array.prototype.find.call(n.changedTouches,s),!e)return!1;r=e.pageX;u=e.pageY}return t=t||y(ct),(h||o)&&(r=n.clientX+t.x,u=n.clientY+t.y),n.pageOffset=t,n.points=[r,u],n.cursor=h||o,n}function si(n){var i=n-tt(nt,r.ort),t=100*i/oi();return t=v(t),r.dir?100-t:t}function ur(n){var t=100,i=!1;return o.forEach(function(r,u){if(!r.hasAttribute("disabled")){var f=Math.abs(h[u]-n);(f<t||100===f&&100===t)&&(i=u,t=f)}}),i}function fr(n,t){"mouseout"===n.type&&"HTML"===n.target.nodeName&&null===n.relatedTarget&&gt(n,t)}function er(n,t){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===n.buttons&&0!==t.buttonsProperty)return gt(n,t);var i=(r.dir?-1:1)*(n.calcPoint-t.startCalcPoint);ci(i>0,100*i/t.baseSize,t.locations,t.handleNumbers)}function gt(n,t){t.handle&&(u(t.handle,r.cssClasses.active),ui-=1);t.listeners.forEach(function(n){bt.removeEventListener(n[0],n[1])});0===ui&&(u(c,r.cssClasses.drag),ri(),n.cursor&&(kt.style.cursor="",kt.removeEventListener("selectstart",l)));t.handleNumbers.forEach(function(n){p("change",n);p("set",n);p("end",n)})}function ni(n,i){var u,e;if(1===i.handleNumbers.length){if(e=o[i.handleNumbers[0]],e.hasAttribute("disabled"))return!1;u=e.children[0];ui+=1;t(u,r.cssClasses.active)}n.stopPropagation();var f=[],s=ot(st.move,bt,er,{target:n.target,handle:u,listeners:f,startCalcPoint:n.calcPoint,baseSize:oi(),pageOffset:n.pageOffset,handleNumbers:i.handleNumbers,buttonsProperty:n.buttons,locations:h.slice()}),a=ot(st.end,bt,gt,{target:n.target,handle:u,listeners:f,doNotReject:!0,handleNumbers:i.handleNumbers}),v=ot("mouseout",bt,fr,{target:n.target,handle:u,listeners:f,doNotReject:!0,handleNumbers:i.handleNumbers});f.push.apply(f,s.concat(a,v));n.cursor&&(kt.style.cursor=getComputedStyle(n.target).cursor,o.length>1&&t(c,r.cssClasses.drag),kt.addEventListener("selectstart",l,!1));i.handleNumbers.forEach(function(n){p("start",n)})}function or(n){n.stopPropagation();var i=si(n.calcPoint),t=ur(i);if(!1===t)return!1;r.events.snap||a(c,r.cssClasses.tap,r.animationDuration);vt(t,i,!0,!0);ri();p("slide",t,!0);p("update",t,!0);p("change",t,!0);p("set",t,!0);r.events.snap&&ni(n,{handleNumbers:[t]})}function sr(n){var t=si(n.calcPoint),i=s.getStep(t),r=s.fromStepping(i);Object.keys(w).forEach(function(n){"hover"===n.split(".")[0]&&w[n].forEach(function(n){n.call(pt,r)})})}function hr(n){n.fixed||o.forEach(function(n,t){ot(st.start,n.children[0],ni,{handleNumbers:[t]})});n.tap&&ot(st.start,nt,or,{});n.hover&&ot(st.move,nt,sr,{hover:!0});n.drag&&it.forEach(function(i,u){if(!1!==i&&0!==u&&u!==it.length-1){var e=o[u-1],s=o[u],f=[i];t(i,r.cssClasses.draggable);n.fixed&&(f.push(e.children[0]),f.push(s.children[0]));f.forEach(function(n){ot(st.start,n,ni,{handles:[e,s],handleNumbers:[u-1,u]})})}})}function ti(n,t){w[n]=w[n]||[];w[n].push(t);"update"===n.split(".")[0]&&o.forEach(function(n,t){p("update",t)})}function cr(n){var t=n&&n.split(".")[0],i=t&&n.substring(t.length);Object.keys(w).forEach(function(n){var r=n.split(".")[0],u=n.substring(r.length);t&&t!==r||i&&i!==u||delete w[n]})}function p(n,t,i){Object.keys(w).forEach(function(u){var f=u.split(".")[0];n===f&&w[u].forEach(function(n){n.call(pt,lt.map(r.format.to),t,lt.slice(),i||!1,h.slice())})})}function hi(n){return n+"%"}function at(n,t,i,u,f,e){return o.length>1&&(u&&t>0&&(i=Math.max(i,n[t-1]+r.margin)),f&&t<o.length-1&&(i=Math.min(i,n[t+1]-r.margin))),o.length>1&&r.limit&&(u&&t>0&&(i=Math.min(i,n[t-1]+r.limit)),f&&t<o.length-1&&(i=Math.max(i,n[t+1]-r.limit))),r.padding&&(0===t&&(i=Math.max(i,r.padding[0])),t===o.length-1&&(i=Math.min(i,100-r.padding[1]))),i=s.getStep(i),!((i=v(i))===n[t]&&!e)&&i}function ii(n,t){var i=r.ort;return(i?t:n)+", "+(i?n:t)}function ci(n,t,i,r){var u=i.slice(),e=[!n,n],o=[n,!n],f;r=r.slice();n&&r.reverse();r.length>1?r.forEach(function(n,i){var r=at(u,n,u[n]+t,e[i],o[i],!1);!1===r?t=0:(t=r-u[n],u[n]=r)}):e=o=[!0];f=!1;r.forEach(function(n,r){f=vt(n,i[n]+t,e[r],o[r])||f});f&&r.forEach(function(n){p("update",n);p("slide",n)})}function li(n,t){return r.dir?100-n-t:n}function lr(n,t){h[n]=t;lt[n]=s.fromStepping(t);var i="translate("+ii(hi(li(t,0)-kr),"0")+")";o[n].style[r.transformRule]=i;ai(n);ai(n+1)}function ri(){ht.forEach(function(n){var t=h[n]>50?-1:1,i=3+(o.length+t*n);o[n].style.zIndex=i})}function vt(n,t,i,r){return!1!==(t=at(h,n,t,i,r,!1))&&(lr(n,t),!0)}function ai(n){var t,i;if(it[n]){t=0;i=100;0!==n&&(t=h[n-1]);n!==it.length-1&&(i=h[n]);var u=i-t,f="translate("+ii(hi(li(t,u)),"0")+")",e="scale("+ii(u/100,"1")+")";it[n].style[r.transformRule]=f+" "+e}}function ar(n,t){return null===n||!1===n||void 0===n?h[t]:("number"==typeof n&&(n=String(n)),n=r.format.from(n),n=s.toStepping(n),!1===n||isNaN(n)?h[t]:n)}function yt(n,t){var i=e(n),u=void 0===h[0];t=void 0===t||!!t;r.animate&&!u&&a(c,r.cssClasses.tap,r.animationDuration);ht.forEach(function(n){vt(n,ar(i[n],n),!0,!1)});ht.forEach(function(n){vt(n,h[n],!0,!0)});ri();ht.forEach(function(n){p("update",n);null!==i[n]&&t&&p("set",n)})}function vr(n){yt(r.start,n)}function vi(){var n=lt.map(r.format.to);return 1===n.length?n[0]:n}function yr(){for(var n in r.cssClasses)r.cssClasses.hasOwnProperty(n)&&u(c,r.cssClasses[n]);for(;c.firstChild;)c.removeChild(c.firstChild);delete c.noUiSlider}function pr(){return h.map(function(n,t){var r=s.getNearbySteps(n),f=lt[t],i=r.thisStep.step,u=null,e;return!1!==i&&f+i>r.stepAfter.startValue&&(i=r.stepAfter.startValue-f),u=f>r.thisStep.startValue?r.thisStep.step:!1!==r.stepBefore.step&&f-r.stepBefore.highestStep,100===n?i=null:0===n&&(u=null),e=s.countStepDecimals(),null!==i&&!1!==i&&(i=Number(i.toFixed(e))),null!==u&&!1!==u&&(u=Number(u.toFixed(e))),[u,i]})}function wr(n,t){var e=vi(),u=["margin","limit","padding","range","animate","snap","step","format"],i;u.forEach(function(t){void 0!==n[t]&&(f[t]=n[t])});i=b(f);u.forEach(function(t){void 0!==n[t]&&(r[t]=i[t])});s=i.spectrum;r.margin=i.margin;r.limit=i.limit;r.padding=i.padding;r.pips&&dt(r.pips);h=[];yt(n.start||e,t)}var nt,o,it,pt,wt,st=ut(),br=et(),yi=br&&ft(),c=i,h=[],ht=[],ui=0,s=r.spectrum,lt=[],w={},ct=i.ownerDocument,bt=ct.documentElement,kt=ct.body,kr="rtl"===ct.dir||1===r.ort?0:100;return bi(c),wi(r.connect,nt),hr(r.events),yt(r.start),pt={destroy:yr,steps:pr,on:ti,off:cr,get:vi,set:yt,reset:vr,__moveHandles:function(n,t,i){ci(n,t,h,i)},options:f,updateOptions:wr,target:c,removePips:ei,pips:dt},r.pips&&dt(r.pips),r.tooltips&&di(),gi(),pt}function li(t,i){if(!t||!t.nodeName)throw new Error("noUiSlider ("+n+"): create requires a single element, got: "+t);if(t.noUiSlider)throw new Error("noUiSlider ("+n+"): Slider was already initialized.");var u=b(i,t),r=ci(t,u,i);return t.noUiSlider=r,r}var n="11.1.0",h;return r.prototype.getMargin=function(t){var i=this.xNumSteps[0];if(i&&t/i%1!=0)throw new Error("noUiSlider ("+n+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&s(this.xVal,t)},r.prototype.toStepping=function(n){return ht(this.xVal,this.xPct,n)},r.prototype.fromStepping=function(n){return ct(this.xVal,this.xPct,n)},r.prototype.getStep=function(n){return lt(this.xPct,this.xSteps,this.snap,n)},r.prototype.getNearbySteps=function(n){var t=f(n,this.xPct);return{stepBefore:{startValue:this.xVal[t-2],step:this.xNumSteps[t-2],highestStep:this.xHighestCompleteStep[t-2]},thisStep:{startValue:this.xVal[t-1],step:this.xNumSteps[t-1],highestStep:this.xHighestCompleteStep[t-1]},stepAfter:{startValue:this.xVal[+t],step:this.xNumSteps[+t],highestStep:this.xHighestCompleteStep[+t]}}},r.prototype.countStepDecimals=function(){var n=this.xNumSteps.map(it);return Math.max.apply(null,n)},r.prototype.convert=function(n){return this.getStep(this.toStepping(n))},h={to:function(n){return void 0!==n&&n.toFixed(2)},from:Number},{version:n,create:li}})