function sendAnalyticsData(n,t,i,r){var f,e,u;if(typeof __analyticsSuppress!="undefined"&&__analyticsSuppress==!0){__analyticsSuppress=!1;return}if(window._gat&&window._gat._getTracker){setTimeout(sendAnalyticsData(n,t,i,r),1e3);return}f=null;typeof __pageGenerationTime!="undefined"&&(f=__pageGenerationTime);e=null;typeof __loginType!="undefined"&&(e=__loginType);typeof i=="object"&&(r=i,i=window.location.pathname+window.location.search);i[0]!="/"&&(i="/"+i);u={hitType:"pageview",title:document.title.replace(" -","")};i!=null&&(u.page=i);r.clientIp&&(u.dimension1=r.clientIp);e!=null&&(u.dimension2=e);r.election&&(u.dimension3=r.election);r.parish&&(u.dimension4=r.parish);f!=null&&(u.metric1=f);ga("create",n,{cookieDomain:t});ga("send",u)}(function(n,t,i,r,u,f,e){n.GoogleAnalyticsObject=u;n[u]=n[u]||function(){(n[u].q=n[u].q||[]).push(arguments)};n[u].l=1*new Date;f=t.createElement(i);e=t.getElementsByTagName(i)[0];f.async=1;f.src=r;e.parentNode.insertBefore(f,e)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");!function(){function u(n,t){function s(t){var r=n.arcs[t<0?~t:t],u=r[0],i;return n.transform?(i=[0,0],r.forEach(function(n){i[0]+=n[0];i[1]+=n[1]})):i=r[r.length-1],t<0?[i,u]:[u,i]}function o(n,t){var r,i;for(r in n)i=n[r],delete t[i.start],delete i.start,delete i.end,i.forEach(function(n){f[n<0?~n:n]=1}),u.push(i)}var f={},i={},r={},u=[],e=-1;return t.forEach(function(i,r){var u=n.arcs[i<0?~i:i],f;u.length<3&&!u[1][0]&&!u[1][1]&&(f=t[++e],t[e]=i,t[r]=f)}),t.forEach(function(n){var c=s(n),f=c[0],e=c[1],t,u,o,h;(t=r[f])?(delete r[t.end],t.push(n),t.end=e,(u=i[e])?(delete i[u.start],o=u===t?t:t.concat(u),i[o.start=t.start]=r[o.end=u.end]=o):i[t.start]=r[t.end]=t):(t=i[e])?(delete i[t.start],t.unshift(n),t.start=f,(u=r[f])?(delete r[u.end],h=u===t?t:u.concat(t),i[h.start=u.start]=r[h.end=t.end]=h):i[t.start]=r[t.end]=t):(t=[n],i[t.start=f]=r[t.end=e]=t)}),o(r,i),o(i,r),t.forEach(function(n){f[n<0?~n:n]||u.push([n])}),u}function f(n,t,i){var r=[],f,h,s,e,a;if(arguments.length>1){f=[];function v(n){var t=n<0?~n:n;(f[t]||(f[t]=[])).push({i:n,g:h})}function c(n){n.forEach(v)}function o(n){n.forEach(c)}function l(n){n.type==="GeometryCollection"?n.geometries.forEach(l):n.type in s&&(h=n,s[n.type](n.arcs))}s={LineString:c,MultiLineString:o,Polygon:o,MultiPolygon:function(n){n.forEach(o)}};l(t);f.forEach(arguments.length<3?function(n){r.push(n[0].i)}:function(n){i(n[0].g,n[n.length-1].g)&&r.push(n[0].i)})}else for(e=0,a=n.arcs.length;e<a;++e)r.push(e);return{type:"MultiLineString",arcs:u(n,r)}}function e(i,r){function s(n){n.forEach(function(t){t.forEach(function(t){(f[t=t<0?~t:t]||(f[t]=[])).push(n)})});e.push(n)}function h(n){return p(t(i,{type:"Polygon",arcs:[n]}).coordinates[0])>0}var f={},e=[],o=[];return r.forEach(function(n){n.type==="Polygon"?s(n.arcs):n.type==="MultiPolygon"&&n.arcs.forEach(s)}),e.forEach(function(n){if(!n._){var t=[],i=[n];for(n._=1,o.push(t);n=i.pop();)t.push(n),n.forEach(function(n){n.forEach(function(n){f[n<0?~n:n].forEach(function(n){n._||(n._=1,i.push(n))})})})}}),e.forEach(function(n){delete n._}),{type:"MultiPolygon",arcs:o.map(function(t){var r=[],o,e,s;if(t.forEach(function(n){n.forEach(function(n){n.forEach(function(n){f[n<0?~n:n].length<2&&r.push(n)})})}),r=u(i,r),(n=r.length)>1)for(o=h(t[0][0]),e=0;e<n;++e)if(o===h(r[e])){s=r[0];r[0]=r[e];r[e]=s;break}return r})}}function l(n,t){return t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(t){return o(n,t)})}:o(n,t)}function o(n,i){var r={type:"Feature",id:i.id,properties:i.properties||{},geometry:t(n,i)};return i.id==null&&delete r.id,r}function t(n,t){function c(n,t){t.length&&t.pop();for(var u=s[n<0?~n:n],i=0,f=u.length,e;i<f;++i)t.push(e=u[i].slice()),r(e,i);n<0&&a(t,f)}function u(n){return n=n.slice(),r(n,0),n}function i(n){for(var t=[],i=0,r=n.length;i<r;++i)c(n[i],t);return t.length<2&&t.push(t[0].slice()),t}function l(n){for(var t=i(n);t.length<4;)t.push(t[0].slice());return t}function f(n){return n.map(l)}function e(n){var t=n.type;return t==="GeometryCollection"?{type:t,geometries:n.geometries.map(e)}:t in o?{type:t,coordinates:o[t](n)}:null}var r=h(n.transform),s=n.arcs,o={Point:function(n){return u(n.coordinates)},MultiPoint:function(n){return n.coordinates.map(u)},LineString:function(n){return i(n.arcs)},MultiLineString:function(n){return n.arcs.map(i)},Polygon:function(n){return f(n.arcs)},MultiPolygon:function(n){return n.arcs.map(f)}};return e(t)}function a(n,t){for(var u,i=n.length,r=i-t;r<--i;)u=n[r],n[r++]=n[i],n[i]=u}function s(n,t){for(var i=0,u=n.length,r;i<u;)r=i+u>>>1,n[r]<t?i=r+1:u=r;return i}function v(n){function a(n,t){n.forEach(function(n){n<0&&(n=~n);var i=f[n];i?i.push(t):f[n]=[t]})}function c(n,t){n.forEach(function(n){a(n,t)})}function v(n,t){n.type==="GeometryCollection"?n.geometries.forEach(function(n){v(n,t)}):n.type in y&&y[n.type](n.arcs,t)}var f={},h=n.map(function(){return[]}),y={LineString:a,MultiLineString:c,Polygon:c,MultiPolygon:function(n,t){n.forEach(function(n){c(n,t)})}},t,o,r,u,i;n.forEach(v);for(t in f)for(var l=f[t],p=l.length,e=0;e<p;++e)for(o=e+1;o<p;++o)r=l[e],u=l[o],(i=h[r])[t=s(i,u)]!==u&&i.splice(t,0,u),(i=h[u])[t=s(i,r)]!==r&&i.splice(t,0,r);return h}function y(n,t){function r(n){i.remove(n);n[1][2]=t(n);i.push(n)}var u=h(n.transform),f=k(n.transform),i=b();return t||(t=w),n.arcs.forEach(function(n){for(var s,h,c=[],a=0,e,o=0,l=n.length,v;o<l;++o)v=n[o],u(n[o]=[v[0],v[1],Infinity],o);for(o=1,l=n.length-1;o<l;++o)e=n.slice(o-1,o+2),e[1][2]=t(e),c.push(e),i.push(e);for(o=0,l=c.length;o<l;++o)e=c[o],e.previous=c[o-1],e.next=c[o+1];while(e=i.pop())s=e.previous,h=e.next,e[1][2]<a?e[1][2]=a:a=e[1][2],s&&(s.next=h,s[2]=e[2],r(s)),h&&(h.previous=s,h[0]=e[0],r(h));n.forEach(f)}),n}function p(n){for(var r=-1,u=n.length,i,t=n[u-1],f=0;++r<u;)i=t,t=n[r],f+=i[0]*t[1]-i[1]*t[0];return f*.5}function w(n){var t=n[0],i=n[1],r=n[2];return Math.abs((t[0]-r[0])*(i[1]-t[1])-(t[0]-i[0])*(r[1]-t[1]))}function i(n,t){return n[1][2]-t[1][2]}function b(){function u(t,r){while(r>0){var f=(r+1>>1)-1,u=n[f];if(i(t,u)>=0)break;n[u._=r]=u;n[t._=r=f]=t}}function f(r,u){for(;;){var o=u+1<<1,s=o-1,e=u,f=n[e];if(s<t&&i(n[s],f)<0&&(f=n[e=s]),o<t&&i(n[o],f)<0&&(f=n[e=o]),e===u)break;n[f._=u]=f;n[r._=u=e]=r}}var r={},n=[],t=0;return r.push=function(i){return u(n[i._=t]=i,t++),t},r.pop=function(){if(!(t<=0)){var r=n[0],i;return--t>0&&(i=n[t],f(n[i._=0]=i,0)),r}},r.remove=function(r){var e=r._,o;if(n[e]===r)return e!==--t&&(o=n[t],(i(o,r)<0?u:f)(n[o._=e]=o,e)),e},r}function h(n){if(!n)return c;var t,i,r=n.scale[0],u=n.scale[1],f=n.translate[0],e=n.translate[1];return function(n,o){o||(t=i=0);n[0]=(t+=n[0])*r+f;n[1]=(i+=n[1])*u+e}}function k(n){if(!n)return c;var t,i,r=n.scale[0],u=n.scale[1],f=n.translate[0],e=n.translate[1];return function(n,o){o||(t=i=0);var s=(n[0]-f)/r|0,h=(n[1]-e)/u|0;n[0]=s-t;n[1]=h-i;t=s;i=h}}function c(){}var r={version:"1.6.18",mesh:function(n){return t(n,f.apply(this,arguments))},meshArcs:f,merge:function(n){return t(n,e.apply(this,arguments))},mergeArcs:e,feature:l,neighbors:v,presimplify:y};typeof define=="function"&&define.amd?define(r):typeof module=="object"&&module.exports?module.exports=r:this.topojson=r}();angular.module("ui.bootstrap",["ui.bootstrap.modal"]);angular.module("ui.bootstrap.modal",[]).factory("$$stackedMap",function(){return{createNew:function(){var n=[];return{add:function(t,i){n.push({key:t,value:i})},get:function(t){for(var i=0;i<n.length;i++)if(t==n[i].key)return n[i]},keys:function(){for(var i=[],t=0;t<n.length;t++)i.push(n[t].key);return i},top:function(){return n[n.length-1]},remove:function(t){for(var r=-1,i=0;i<n.length;i++)if(t==n[i].key){r=i;break}return n.splice(r,1)[0]},removeTop:function(){return n.splice(n.length-1,1)[0]},length:function(){return n.length}}}}}).directive("modalBackdrop",["$timeout",function(n){function t(t){t.animate=!1;n(function(){t.animate=!0})}return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",compile:function(n,i){return n.addClass(i.backdropClass),t}}}]).directive("modalWindow",["$modalStack","$q",function(n,t){return{restrict:"EA",scope:{index:"@",animate:"="},replace:!0,transclude:!0,templateUrl:function(n,t){return t.templateUrl||"template/modal/window.html"},link:function(i,r,u){r.addClass(u.windowClass||"");i.size=u.size;i.close=function(t){var i=n.getTop();i&&i.value.backdrop&&i.value.backdrop!="static"&&t.target===t.currentTarget&&(t.preventDefault(),t.stopPropagation(),n.dismiss(i.key,"backdrop click"))};i.$isRendered=!0;var f=t.defer();u.$observe("modalRender",function(n){n=="true"&&f.resolve()});f.promise.then(function(){var t,u;i.animate=!0;t=r[0].querySelectorAll("[autofocus]");t.length?t[0].focus():r[0].focus();u=n.getTop();u&&n.modalRendered(u.key)})}}}]).directive("modalAnimationClass",[function(){return{compile:function(n,t){t.modalAnimation&&n.addClass(t.modalAnimationClass)}}}]).directive("modalTransclude",function(){return{link:function(n,t,i,r,u){u(n.$parent,function(n){t.empty();t.append(n)})}}}).factory("$modalStack",["$animate","$timeout","$document","$compile","$rootScope","$$stackedMap",function(n,t,i,r,u,f){function c(){for(var t=-1,i=e.keys(),n=0;n<i.length;n++)e.get(i[n]).value.backdrop&&(t=n);return t}function a(n){var r=i.find("body").eq(0),t=e.get(n).value;e.remove(n);v(t.modalDomEl,t.modalScope,function(){r.toggleClass(l,e.length()>0);p()})}function p(){if(h&&c()==-1){var n=o;v(h,o,function(){n=null});h=undefined;o=undefined}}function v(i,r,f){function e(){e.done||(e.done=!0,i.remove(),r.$destroy(),f&&f())}if(r.animate=!1,i.attr("modal-animation")&&n.enabled())i.one("$animate:close",function(){u.$evalAsync(e)});else t(e)}function y(n,t,i){return!n.value.modalScope.$broadcast("modal.closing",t,i).defaultPrevented}var l="modal-open",h,o,e=f.createNew(),s={};return u.$watch(c,function(n){o&&(o.index=n)}),i.bind("keydown",function(n){var t;n.which===27&&(t=e.top(),t&&t.value.keyboard&&(n.preventDefault(),u.$apply(function(){s.dismiss(t.key,"escape key press")})))}),s.open=function(n,t){var p=i[0].activeElement,f,v,s,a,y;e.add(n,{deferred:t.deferred,renderDeferred:t.renderDeferred,modalScope:t.scope,backdrop:t.backdrop,keyboard:t.keyboard});f=i.find("body").eq(0);v=c();v>=0&&!h&&(o=u.$new(!0),o.index=v,s=angular.element('<div modal-backdrop="modal-backdrop"><\/div>'),s.attr("backdrop-class",t.backdropClass),t.animation&&s.attr("modal-animation","true"),h=r(s)(o),f.append(h));a=angular.element('<div modal-window="modal-window"><\/div>');a.attr({"template-url":t.windowTemplateUrl,"window-class":t.windowClass,size:t.size,index:e.length()-1,animate:"animate"}).html(t.content);t.animation&&a.attr("modal-animation","true");y=r(a)(t.scope);e.top().value.modalDomEl=y;e.top().value.modalOpener=p;f.append(y);f.addClass(l)},s.close=function(n,t){var i=e.get(n);return i&&y(i,t,!0)?(i.value.deferred.resolve(t),a(n),i.value.modalOpener.focus(),!0):!i},s.dismiss=function(n,t){var i=e.get(n);return i&&y(i,t,!1)?(i.value.deferred.reject(t),a(n),i.value.modalOpener.focus(),!0):!i},s.dismissAll=function(n){for(var t=this.getTop();t&&this.dismiss(t.key,n);)t=this.getTop()},s.getTop=function(){return e.top()},s.modalRendered=function(n){var t=e.get(n);t&&t.value.renderDeferred.resolve()},s}]).provider("$modal",function(){var n={options:{animation:!0,backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$templateRequest","$controller","$modalStack",function(t,i,r,u,f,e){function s(n){return n.template?r.when(n.template):u(angular.isFunction(n.templateUrl)?n.templateUrl():n.templateUrl)}function h(n){var i=[];return angular.forEach(n,function(n){(angular.isFunction(n)||angular.isArray(n))&&i.push(r.when(t.invoke(n)))}),i}var o={};return o.open=function(t){var o=r.defer(),c=r.defer(),a=r.defer(),u={result:o.promise,opened:c.promise,rendered:a.promise,close:function(n){return e.close(u,n)},dismiss:function(n){return e.dismiss(u,n)}},l;if(t=angular.extend({},n.options,t),t.resolve=t.resolve||{},!t.template&&!t.templateUrl)throw new Error("One of template or templateUrl options is required.");return l=r.all([s(t)].concat(h(t.resolve))),l.then(function(n){var r=(t.scope||i).$new(),h,s,c;r.$close=u.close;r.$dismiss=u.dismiss;s={};c=1;t.controller&&(s.$scope=r,s.$modalInstance=u,angular.forEach(t.resolve,function(t,i){s[i]=n[c++]}),h=f(t.controller,s),t.controllerAs&&(r[t.controllerAs]=h));e.open(u,{scope:r,deferred:o,renderDeferred:a,content:n[0],animation:t.animation,backdrop:t.backdrop,keyboard:t.keyboard,backdropClass:t.backdropClass,windowClass:t.windowClass,windowTemplateUrl:t.windowTemplateUrl,size:t.size})},function(n){o.reject(n)}),l.then(function(){c.resolve(!0)},function(n){c.reject(n)}),u},o}]};return n});angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.modal"]);angular.module("ui.bootstrap.tpls",["template/modal/backdrop.html","template/modal/window.html"]);angular.module("ui.bootstrap.modal",[]).factory("$$stackedMap",function(){return{createNew:function(){var n=[];return{add:function(t,i){n.push({key:t,value:i})},get:function(t){for(var i=0;i<n.length;i++)if(t==n[i].key)return n[i]},keys:function(){for(var i=[],t=0;t<n.length;t++)i.push(n[t].key);return i},top:function(){return n[n.length-1]},remove:function(t){for(var r=-1,i=0;i<n.length;i++)if(t==n[i].key){r=i;break}return n.splice(r,1)[0]},removeTop:function(){return n.splice(n.length-1,1)[0]},length:function(){return n.length}}}}}).directive("modalBackdrop",["$timeout",function(n){function t(t){t.animate=!1;n(function(){t.animate=!0})}return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",compile:function(n,i){return n.addClass(i.backdropClass),t}}}]).directive("modalWindow",["$modalStack","$q",function(n,t){return{restrict:"EA",scope:{index:"@",animate:"="},replace:!0,transclude:!0,templateUrl:function(n,t){return t.templateUrl||"template/modal/window.html"},link:function(i,r,u){r.addClass(u.windowClass||"");i.size=u.size;i.close=function(t){var i=n.getTop();i&&i.value.backdrop&&i.value.backdrop!="static"&&t.target===t.currentTarget&&(t.preventDefault(),t.stopPropagation(),n.dismiss(i.key,"backdrop click"))};i.$isRendered=!0;var f=t.defer();u.$observe("modalRender",function(n){n=="true"&&f.resolve()});f.promise.then(function(){var t,u;i.animate=!0;t=r[0].querySelectorAll("[autofocus]");t.length?t[0].focus():r[0].focus();u=n.getTop();u&&n.modalRendered(u.key)})}}}]).directive("modalAnimationClass",[function(){return{compile:function(n,t){t.modalAnimation&&n.addClass(t.modalAnimationClass)}}}]).directive("modalTransclude",function(){return{link:function(n,t,i,r,u){u(n.$parent,function(n){t.empty();t.append(n)})}}}).factory("$modalStack",["$animate","$timeout","$document","$compile","$rootScope","$$stackedMap",function(n,t,i,r,u,f){function c(){for(var t=-1,i=e.keys(),n=0;n<i.length;n++)e.get(i[n]).value.backdrop&&(t=n);return t}function a(n){var r=i.find("body").eq(0),t=e.get(n).value;e.remove(n);v(t.modalDomEl,t.modalScope,function(){r.toggleClass(l,e.length()>0);p()})}function p(){if(h&&c()==-1){var n=o;v(h,o,function(){n=null});h=undefined;o=undefined}}function v(i,r,f){function e(){e.done||(e.done=!0,i.remove(),r.$destroy(),f&&f())}if(r.animate=!1,i.attr("modal-animation")&&n.enabled())i.one("$animate:close",function(){u.$evalAsync(e)});else t(e)}function y(n,t,i){return!n.value.modalScope.$broadcast("modal.closing",t,i).defaultPrevented}var l="modal-open",h,o,e=f.createNew(),s={};return u.$watch(c,function(n){o&&(o.index=n)}),i.bind("keydown",function(n){var t;n.which===27&&(t=e.top(),t&&t.value.keyboard&&(n.preventDefault(),u.$apply(function(){s.dismiss(t.key,"escape key press")})))}),s.open=function(n,t){var p=i[0].activeElement,f,v,s,a,y;e.add(n,{deferred:t.deferred,renderDeferred:t.renderDeferred,modalScope:t.scope,backdrop:t.backdrop,keyboard:t.keyboard});f=i.find("body").eq(0);v=c();v>=0&&!h&&(o=u.$new(!0),o.index=v,s=angular.element('<div modal-backdrop="modal-backdrop"><\/div>'),s.attr("backdrop-class",t.backdropClass),t.animation&&s.attr("modal-animation","true"),h=r(s)(o),f.append(h));a=angular.element('<div modal-window="modal-window"><\/div>');a.attr({"template-url":t.windowTemplateUrl,"window-class":t.windowClass,size:t.size,index:e.length()-1,animate:"animate"}).html(t.content);t.animation&&a.attr("modal-animation","true");y=r(a)(t.scope);e.top().value.modalDomEl=y;e.top().value.modalOpener=p;f.append(y);f.addClass(l)},s.close=function(n,t){var i=e.get(n);return i&&y(i,t,!0)?(i.value.deferred.resolve(t),a(n),i.value.modalOpener.focus(),!0):!i},s.dismiss=function(n,t){var i=e.get(n);return i&&y(i,t,!1)?(i.value.deferred.reject(t),a(n),i.value.modalOpener.focus(),!0):!i},s.dismissAll=function(n){for(var t=this.getTop();t&&this.dismiss(t.key,n);)t=this.getTop()},s.getTop=function(){return e.top()},s.modalRendered=function(n){var t=e.get(n);t&&t.value.renderDeferred.resolve()},s}]).provider("$modal",function(){var n={options:{animation:!0,backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$templateRequest","$controller","$modalStack",function(t,i,r,u,f,e){function s(n){return n.template?r.when(n.template):u(angular.isFunction(n.templateUrl)?n.templateUrl():n.templateUrl)}function h(n){var i=[];return angular.forEach(n,function(n){(angular.isFunction(n)||angular.isArray(n))&&i.push(r.when(t.invoke(n)))}),i}var o={};return o.open=function(t){var o=r.defer(),c=r.defer(),a=r.defer(),u={result:o.promise,opened:c.promise,rendered:a.promise,close:function(n){return e.close(u,n)},dismiss:function(n){return e.dismiss(u,n)}},l;if(t=angular.extend({},n.options,t),t.resolve=t.resolve||{},!t.template&&!t.templateUrl)throw new Error("One of template or templateUrl options is required.");return l=r.all([s(t)].concat(h(t.resolve))),l.then(function(n){var r=(t.scope||i).$new(),h,s,c;r.$close=u.close;r.$dismiss=u.dismiss;s={};c=1;t.controller&&(s.$scope=r,s.$modalInstance=u,angular.forEach(t.resolve,function(t,i){s[i]=n[c++]}),h=f(t.controller,s),t.controllerAs&&(r[t.controllerAs]=h));e.open(u,{scope:r,deferred:o,renderDeferred:a,content:n[0],animation:t.animation,backdrop:t.backdrop,keyboard:t.keyboard,backdropClass:t.backdropClass,windowClass:t.windowClass,windowTemplateUrl:t.windowTemplateUrl,size:t.size})},function(n){o.reject(n)}),l.then(function(){c.resolve(!0)},function(n){c.reject(n)}),u},o}]};return n});angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(n){n.put("template/modal/backdrop.html",'<div class="modal-backdrop"\n     modal-animation-class="fade"\n     ng-class="{in: animate}"\n     ng-style="{\'z-index\': 1040 + (index && 1 || 0) + index*10}"\n><\/div>\n')}]);angular.module("template/modal/window.html",[]).run(["$templateCache",function(n){n.put("template/modal/window.html",'<div modal-render="{{$isRendered}}" tabindex="-1" role="dialog" class="modal"\n    modal-animation-class="fade"\n\tng-class="{in: animate}" ng-style="{\'z-index\': 1050 + index*10, display: \'block\'}" ng-click="close($event)">\n    <div class="modal-dialog" ng-class="size ? \'modal-\' + size : \'\'"><div class="modal-content" modal-transclude><\/div><\/div>\n<\/div>\n')}]),function(){"use strict";angular.module("electionResultsControllers",["electionResultsServices","ui.bootstrap"]);angular.module("electionResultsServices",[]);angular.module("electionResultsDirectives",["electionResultsServices","ui.bootstrap"]);angular.module("electionResultsApp",["filters","electionResultsServices","electionResultsControllers","electionResultsDirectives","ui.bootstrap"]).config(["$httpProvider",function(n){n.interceptors.push("serverError");n.interceptors.push("electionHttpResponseInterceptor")}])}(),function(){"use strict";angular.module("electionResultsServices").factory("electionHttpResponseInterceptor",["$q","$location","processor","util",function(n,t,i,r){return{response:function(n){var t=n.config.url,u=t.match(/([a-z_]*?)\./i),o=u!==null&&u.length>0,f,e;if(!o)return n;f=u[1];switch(f){case"Configuration":n.data=i.processConfig(n.data);break;case"ElectionDates":n.data=i.processElectionList(n.data);break;case"CurrentVersion":n.data=r.isDefined(n.data.Current)&&r.isDefined(n.data.Current.VersionDateTime)?r.toDate(n.data.Current.VersionDateTime):null;break;case"RacesCandidates_Multiparish":n.data=i.processMultiparish(n.data);break;case"Votes_Multiparish":n.data=n.data.Races;break;case"ParishesInElection":n.data=i.processParishesInElection(n.data);break;case"StatsCategories":n.data=i.processStatsCategories(n.data);break;case"ElectionRaces":n.data=i.processElectionRaces(n.data);break;case"StatsStatewide":e=n.data.Stats;e.Option="Louisiana";n.data=[n.data.Stats];break;case"StatsParish":case"StatsCongressional":case"StatsSenate":case"StatsHouse":n.data=r.ensureArray(n.data.Stats.Parish)}return t.indexOf("RacesCandidates/ByParish_")!==-1?n.data=i.processMultiparish(n.data):t.indexOf("VotesParish/Votes_")!==-1?n.data=n.data.Races:t.indexOf("VotesEarly/Votes_")!==-1?n.data=n.data.EarlyVoting:t.indexOf("StatsRaceParish/Stats_")!==-1?n.data=r.ensureArray(n.data.Stats.Precinct):t.indexOf("VotesRaceByParish/Votes_")!==-1?n.data=n.data.Parishes:t.indexOf("VotesRaceByPrecinct/Votes_")!==-1&&(n.data=n.data.Precincts),n}}}])}(),function(){"use strict";function n(n){function t(t){var i,r,u;if(!t)return n.reject("handleServerError: received no response info.");i="Server error";r=!1;t.status&&(i+=" "+t.status,t.status===-1&&(r=!0));t.statusText&&(i+=" "+t.statusText);t.config&&(i+=" accessing "+t.config.url);u=new Error(i);u.networkError=r;throw u;}return{responseError:t}}angular.module("electionResultsServices").factory("serverError",n);n.$inject=["$q"]}(),function(){"use strict";angular.module("filters",[]).filter("percent",function(){return function(n,t){var r,u,f,i;for((!n||n===Infinity||isNaN(n))&&(n=0),(!t||n===t||isNaN(t))&&(t=0),r=n*100,u=1,f=0;f<t;f++)u=u*10;return r=r*u,i=Math.round(r),i==0&&n!=0&&(i=Math.ceil(r)),i/u==100&&n!=1&&(i=Math.floor(r)),i=i/u,t>0&&(i=i.toFixed(t)),i+"%"}}).filter("commas",["$sce",function(n){return function(t){for(var f=(t||"0")+"",r=f.split("."),i=r[0],e=r.length>1?"."+r[1]:"",u=/(\d+)(\d{3})/;u.test(i);)i=i.replace(u,'$1<span class="hidden-trans">,<\/span>$2');return n.trustAsHtml(i+e)}}]).filter("asHtml",["$sce",function(n){return function(t){return n.trustAsHtml(t)}}])}(),function(){"use strict";angular.module("electionResultsApp").constant("constants",{category:{PRESIDENTIAL:"Presidential",CONGRESSIONAL:"Congressional",STATEWIDE:"Statewide",LEGISLATIVE:"Legislative",MULTIPARISH:"Multiparish"},mapTypes:{STATE:"stateFeatures",PARISH:"parishFeatures",FEDERALHOUSE:"federalHouseFeatures",STATEHOUSE:"stateHouseFeatures",STATESENATE:"stateSenateFeatures"},mapStyleTypes:{ACTIVEELECTION:"activeElection",STATISTICS:"statistics"},outcomeStyles:{Elected:{color:"#070",icon:"glyphicon glyphicon-ok-sign"},Defeated:{color:"#F00",icon:"glyphicon glyphicon-remove-sign"},Runoff:{color:"#00B",icon:"glyphicon glyphicon-circle-arrow-right"},Approved:{color:"#070",icon:"glyphicon glyphicon-ok-sign"}},outcomeIcons:{Elected:"glyphicon glyphicon-ok-sign",Defeated:"glyphicon glyphicon-remove-sign",Runoff:"glyphicon glyphicon-circle-arrow-right",Approved:"glyphicon glyphicon-ok-sign"},parishList:[{id:"01",name:"Acadia"},{id:"02",name:"Allen"},{id:"03",name:"Ascension"},{id:"04",name:"Assumption"},{id:"05",name:"Avoyelles"},{id:"06",name:"Beauregard"},{id:"07",name:"Bienville"},{id:"08",name:"Bossier"},{id:"09",name:"Caddo"},{id:"10",name:"Calcasieu"},{id:"11",name:"Caldwell"},{id:"12",name:"Cameron"},{id:"13",name:"Catahoula"},{id:"14",name:"Claiborne"},{id:"15",name:"Concordia"},{id:"16",name:"De Soto"},{id:"17",name:"East Baton Rouge"},{id:"18",name:"East Carroll"},{id:"19",name:"East Feliciana"},{id:"20",name:"Evangeline"},{id:"21",name:"Franklin"},{id:"22",name:"Grant"},{id:"23",name:"Iberia"},{id:"24",name:"Iberville"},{id:"25",name:"Jackson"},{id:"26",name:"Jefferson"},{id:"27",name:"Jefferson Davis"},{id:"28",name:"Lafayette"},{id:"29",name:"Lafourche"},{id:"30",name:"Lasalle"},{id:"31",name:"Lincoln"},{id:"32",name:"Livingston"},{id:"33",name:"Madison"},{id:"34",name:"Morehouse"},{id:"35",name:"Natchitoches"},{id:"36",name:"Orleans"},{id:"37",name:"Ouachita"},{id:"38",name:"Plaquemines"},{id:"39",name:"Pointe Coupee"},{id:"40",name:"Rapides"},{id:"41",name:"Red River"},{id:"42",name:"Richland"},{id:"43",name:"Sabine"},{id:"44",name:"St. Bernard"},{id:"45",name:"St. Charles"},{id:"46",name:"St. Helena"},{id:"47",name:"St. James"},{id:"48",name:"St. John The Baptist"},{id:"49",name:"St. Landry"},{id:"50",name:"St. Martin"},{id:"51",name:"St. Mary"},{id:"52",name:"St. Tammany"},{id:"53",name:"Tangipahoa"},{id:"54",name:"Tensas"},{id:"55",name:"Terrebonne"},{id:"56",name:"Union"},{id:"57",name:"Vermilion"},{id:"58",name:"Vernon"},{id:"59",name:"Washington"},{id:"60",name:"Webster"},{id:"61",name:"West Baton Rouge"},{id:"62",name:"West Carroll"},{id:"63",name:"West Feliciana"},{id:"64",name:"Winn"}]})}(),function(){"use strict";angular.module("electionResultsApp").factory("geoFeatures",["$http","constants","util",function(n,t,i){function o(o,s){var c=null,h=null,l;i.isDefined(s)&&(h=new Date(s));switch(o){case t.mapTypes.STATE:c="laState";break;case t.mapTypes.PARISH:c="laParish";break;case t.mapTypes.FEDERALHOUSE:c=!i.isDefined(h)||h>=e?"laFederalHouse2010Census":"laFederalHouse2000Census";break;case t.mapTypes.STATEHOUSE:c=!i.isDefined(h)||h>=r?"laStateHouse2010Census":"laStateHouse2000Census";break;case t.mapTypes.STATESENATE:c=!i.isDefined(h)||h>=r?"laStateSenate2010Census":"laStateSenate2000Census"}return l=u+c+f,n({method:"GET",cache:!0,url:l}).then(function(n){return n.data}).catch(function(){})}var u="/Areas/ElectionResults/Scripts/GeoData/",f=".js",e=new Date("11/6/2012"),r=new Date("10/22/2011");return{getGeoFeatures:o}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("util",["constants","$filter",function(n,t){var i={election:"None",tab:"None",dialog:"None",parish:"None",statFilter:"None",precinct:"None",statTabCategory:"None",statTabCategoryOption:"None"};return{isNullOrWhiteSpace:function(n){return n===null||typeof n=="undefined"||n.match(/^ *$/)!==null},isDefined:function(n){return typeof n!="undefined"&&n!=null},isTrue:function(n){return n==="1"||n===1||n===!0||n==="True"||n==="true"},ensureArray:function(n){return typeof n=="undefined"||n==null?null:angular.isArray(n)?n:[n]},prefixWithDateFolder:function(n,i){return t("date")(n,"yyyyMMdd")+"/"+i},showWait:function(){$(".wait-container").show()},hideWait:function(){$(".wait-container").hide()},getParishName:function(t){return $.grep(n.parishList,function(n){return n.id===t})[0].name},getParishValue:function(t){return $.grep(n.parishList,function(n){return n.name.toLowerCase()===t.toLowerCase()})[0].id},sortPrecincts:function(n,t){var i=n&&typeof n=="string"?n.split("/"):null,r=t&&typeof t=="string"?t.split("/"):null;return!i||!r||i.length!=2||r.length!=2?n>t?1:n<t?-1:0:i[0]>r[0]||i[0]==r[0]&&i[1]>r[1]?1:r[0]>i[0]||r[0]==i[0]&&r[1]>i[1]?-1:0},hexToDecimal:function(n){var t,i,r,u,f;return n=n.replace("#",""),u=/([0-9A-F][0-9A-F])([0-9A-F][0-9A-F])([0-9A-F]?[0-9A-F]?)/i,f=/([0-9A-F])([0-9A-F]?)([0-9A-F]?)/i,u.exec(n)?(t=parseInt((RegExp.$1+"00").substr(0,2),16),i=parseInt((RegExp.$2+"00").substr(0,2),16),r=parseInt((RegExp.$3+"00").substr(0,2),16)):f.exec(n)&&(t=parseInt("0"+RegExp.$1+RegExp.$1,16),i=parseInt("0"+RegExp.$2+RegExp.$2,16),r=parseInt("0"+RegExp.$3+RegExp.$3,16)),{r:Math.min(Math.max(0,t),255),g:Math.min(Math.max(0,i),255),b:Math.min(Math.max(0,r),255)}},toDate:function(n){if(!this.isDefined(n))return null;if(n==="1900-01-01T00:00:00")return new Date(n);var t=n.indexOf(".");return t!==-1&&(n=n.substring(0,t)),n+="-0"+-configuration.louisianaUtcOffset+":00",new Date(n)},isToday:function(n){var t=this.getLouisianaTime();return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()},getLouisianaTime:function(){var n=(new Date).getTimezoneOffset()/-60,t=configuration.louisianaUtcOffset-n;return new Date(Date.now()+36e5*t)},getDataVersion:function(n){if(n!=null&&n.hasOwnProperty("VersionDateTime")){var t=n.VersionDateTime;return t==null&&(t="1900-01-01T00:00:00"),this.toDate(t)}return null},toMinutes:function(n){return Math.floor(n/60)+":"+("0"+n%60).slice(-2)},getNameWidthClass:function(n){return n<=3?"choice-width-ref":n>52?"choice-width-long":n>33?"choice-width-pres":"choice-width-normal"},synchronizeCollection:function(n,t,i){for(var r=0,u,f;r<t.length;r++)if(n.length>r&&n[r][i]===t[r][i])for(u in t[r])n[r].hasOwnProperty(u)&&(n[r][u]=t[r][u]);else f=$.grep(n,function(n){return n[i]===t[r][i]}),f.length===0?n.splice(r,0,t[r]):(n.splice(r,1),r--);while(n.length>r)n.pop()},log:function(){},isNormalNumber:function(n){return n&&n!==Infinity&&!isNaN(n)},assignObjectProperties:function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},locationInfo:i,locationClearDialog:function(){i.dialog="None";i.parish="None";i.precinct="None";i.statFilter="None"},locationClearStatistics:function(){i.statTabCategory="None";i.statTabCategoryOption="None"}}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("dataManager",["$rootScope","$http","$q","processor","util","constants",function(n,t,i,r,u,f){return n.selected={election:null,tab:null,dialog:null},n.parishesInElectionList=[],n.raceParishResultsList=[],n.racePrecinctResultsList=[],n.configuration={siteMessage:null},n.currentVersion=null,{pendingRequests:[],dataLoaded:{},awaitQueue:function(){function t(){if(n.length>0){var t=n[0];t.running||(t.running=!0,t.deferred.resolveWith(r,[t.complete]))}}var n=this.pendingRequests,r=this,i={deferred:jQuery.Deferred(),complete:function(){n.shift();t()},running:!1};return n.push(i),t(),i.deferred.promise()},loadSettings:function(){var t=this;this.awaitQueue().then(function(r){var u=[this.getData("configuration","Configuration.htm"),this.getData("electionMode","ElectionMode.htm"),this.getData("electionList","ElectionDates.htm")];n.inElectionMode&&u.push(this.getData("currentVersion","CurrentVersion.htm"));i.all(u).then(function(){t.setElectionMode();n.$broadcast("SETTINGS_LOADED");u.length===4&&n.$broadcast("VERSION_LOADED");r()})})},clearElectionData:function(){n.electionInfo=null;n.electionRawResults=null;n.parishRaces=null;n.parishResults=null;n.parishRaceList=null;n.electionRaces=null;n.statsCategories=null;n.statistics=null;n.earlyVoting=null;n.earlyVotesList=null;n.raceParishResults=null;n.raceParishResultsList=[];n.racePrecinctsResults=null;n.racePrecinctsResultsList=[];n.raceStats=null;n.raceParishStats=null;n.parishesInElection=null;n.parishesInElectionList=[];n.currentVersion=null},loadElection:function(){var r=this,t=n.selected.election;t&&this.awaitQueue().then(function(f){i.all([this.getData("electionInfo",u.prefixWithDateFolder(t.date,"RacesCandidates_Multiparish.htm"))]).then(function(){r.initializeElection();n.$broadcast("ELECTION_LOADED");f()})})},loadElectionResults:function(){var t=n.selected.election;t&&this.awaitQueue().then(function(f){i.all([this.getData("electionInfo",u.prefixWithDateFolder(t.date,"RacesCandidates_Multiparish.htm")),this.getData("electionRawResults",u.prefixWithDateFolder(t.date,"Votes_Multiparish.htm"))]).then(function(i){r.mergeRacesAndResults(i[0].races,i[1].Race,null,t);n.$broadcast("RESULTS_LOADED");f()})})},loadParishResults:function(t){var f=n.selected.election,e,o;f&&(e=null,o=null,u.isDefined(t)&&(e=u.prefixWithDateFolder(f.date,"RacesCandidates/ByParish_"+t+".htm"),o=u.prefixWithDateFolder(f.date,"VotesParish/Votes_"+t+".htm")),this.awaitQueue().then(function(t){var u=i.all([this.getData("parishRaces",e),this.getData("parishResults",o)]);u.then(function(i){if(n.electionInfo!=null){var u=r.mergeRacesAndResults(i[0].races,i[1].Race,n.electionInfo.races,f);n.parishRaceList=u;n.$broadcast("PARISH_RESULTS_LOADED")}t()})}))},loadElectionRaces:function(){var t=n.selected.election;t&&this.awaitQueue().then(function(r){i.all([this.getData("electionRaces",u.prefixWithDateFolder(t.date,"ElectionRaces.htm"))]).then(function(){n.$broadcast("RACES_LOADED");r()})})},getCsvFilePath:function(t,i){var f=n.selected.election,r;return f?(r="csv/",r+=i?"ByParish":"ByPrecinct",r+="_"+t+".csv",u.prefixWithDateFolder(f.date,r)):"noelection"},loadStatCategories:function(){var t=n.selected.election;t&&this.awaitQueue().then(function(r){i.all([this.getData("statsCategories",u.prefixWithDateFolder(t.date,"StatsCategories.htm"))]).then(function(){n.$broadcast("STAT_CATEGORIES_LOADED");r()})})},loadStatistics:function(t){var f=n.selected.election,r;if(f){r=null;switch(t){case"Louisiana":r="Statewide";break;case"Parish":r="Parish";break;case"Congressional District":r="Congressional";break;case"Senate District":r="Senate";break;case"House District":r="House";break;default:throw new Error("Unrecognized category: "+t);}r="Stats"+r+".htm";this.awaitQueue().then(function(t){i.all([this.getData("statistics",u.prefixWithDateFolder(f.date,r))]).then(function(){n.$broadcast("STATISTICS_LOADED");t()})})}},loadEarlyVotingResults:function(t){var f=n.selected.election,e;f&&(e=null,u.isDefined(t)&&(e=u.prefixWithDateFolder(f.date,"VotesEarly/Votes_"+t.id+".htm")),this.awaitQueue().then(function(u){i.all([this.getData("earlyVoting",e)]).then(function(i){n.earlyVotesList=r.mergeOneRaceAndResults(t,i[0].Parish,f);n.$broadcast("EARLY_VOTES_LOADED");u()})}))},loadRaceParishResults:function(t){var f=n.selected.election;f&&this.awaitQueue().then(function(e){var o="VotesRaceByParish/Votes_"+t.id+".htm";i.all([this.getData("raceParishResults",u.prefixWithDateFolder(f.date,o))]).then(function(i){var o=r.mergeOneRaceAndResults(t,i[0].Parish,f);u.synchronizeCollection(n.raceParishResultsList,o,"parishValue");n.$broadcast("RACE_PARISH_RESULTS_LOADED");e()})})},loadRacePrecinctResults:function(t,f){var e=n.selected.election;e&&this.awaitQueue().then(function(o){var s="VotesRaceByPrecinct/Votes_"+t.id+"_"+f+".htm";i.all([this.getData("racePrecinctResults",u.prefixWithDateFolder(e.date,s))]).then(function(i){var f=r.mergeOneRaceAndResults(t,i[0].Precinct,e);u.synchronizeCollection(n.racePrecinctResultsList,f,"precinct");n.$broadcast("RACE_PRECINCT_RESULTS_LOADED");o()})})},loadRaceStats:function(t){var r=n.selected.election;r&&this.awaitQueue().then(function(f){var e="StatsRace/Stats_"+t+".htm";i.all([this.getData("raceStats",u.prefixWithDateFolder(r.date,e))]).then(function(){n.$broadcast("RACE_STATS_LOADED");f()})})},loadRaceParishStats:function(t,r){var f=n.selected.election;f&&this.awaitQueue().then(function(e){var o="StatsRaceParish/Stats_"+t+"_"+r+".htm";i.all([this.getData("raceParishStats",u.prefixWithDateFolder(f.date,o))]).then(function(){n.$broadcast("RACE_PARISH_STATS_LOADED");e()})})},loadParishesInElection:function(){var t=n.selected.election;t&&this.awaitQueue().then(function(i){this.getData("parishesInElection",u.prefixWithDateFolder(t.date,"ParishesInElection.htm")).then(function(){u.synchronizeCollection(n.parishesInElectionList,n.parishesInElection.parishes,"value");n.$broadcast("PARISHES_IN_ELECTION_LOADED");i()})})},filterOnCategory:function(t,i){if(i===undefined||i===null){if(n.electionInfo==null)return[];i=n.electionInfo.races}return r.filterOnCategory(t,i)},isDataExpired:function(t){if(!this.dataLoaded.hasOwnProperty(t))return!1;var i=this.dataLoaded[t].version;return i!=null&&i<n.currentVersion},setElectionMode:function(){n.inElectionMode=u.isDefined(n.electionMode)&&n.electionMode.ElectionMode!=null&&n.selected.election&&n.electionMode.ElectionMode.PKElectionID==n.selected.election.id},getData:function(i,r){var o=jQuery.Deferred(),e=this,f=e.dataLoaded[i],s,h;if(r==null){if(f==null)return console.log("getData: tried to reload but loaded["+i+"] is null"),o.resolveWith(e,null),o.promise();r=f.file}return s=!0,i==="configuration"||i==="electionMode"||i==="currentVersion"?s=!1:f!=null&&new Date-f.time>36e5?s=!1:!n.inElectionMode||f==null||f.version==null||f.version>=n.currentVersion||(s=!1),s&&f!=null&&f.file===r&&n[i]!=null?(u.log("getData: resolving '"+i+"' with existing data"),o.resolveWith(e,[n[i]])):(h=configuration.dataUrl+"?blob="+r,t.get(h).then(function(t){n[i]=t.data;e.dataLoaded[i]={file:r,version:u.getDataVersion(t.data),time:new Date};u.log("getData: resolving '"+i+"' with new data, version: "+e.dataLoaded[i].version);o.resolveWith(e,[t.data])}).catch(function(t){u.log("getData: resolving '"+i+"' with null; ERROR");n.bigError=!0;o.rejectWith(e,[t])})),o.promise()},initializeRaceGroups:function(){$.each(n.electionInfo.races,function(t,i){n.electionInfo.hasPresidential|=r.isInRaceGroup(i,f.category.PRESIDENTIAL);n.electionInfo.hasCongressional|=r.isInRaceGroup(i,f.category.CONGRESSIONAL);n.electionInfo.hasLegislative|=r.isInRaceGroup(i,f.category.LEGISLATIVE);n.electionInfo.hasStateWide|=r.isInRaceGroup(i,f.category.STATEWIDE);n.electionInfo.hasMultiparish|=r.isInRaceGroup(i,f.category.MULTIPARISH)})},initializeElection:function(){var t=n.electionInfo,i;t.tabs.length>0||(this.initializeRaceGroups(),t.hasPresidential&&t.tabs.push({title:"Presidential"}),t.hasCongressional&&t.tabs.push({title:"Congressional"}),t.hasStateWide&&t.tabs.push({title:"Statewide"}),t.hasLegislative&&t.tabs.push({title:"Legislative"}),t.hasMultiparish&&t.tabs.push({title:"Multiparish"}),t.tabs.push({title:"Parish"}),i=n.selected.election,i&&(i.hasJurisdictionStats||i.hasPostElectionStats)&&n.configuration.enableJurisdictionStats&&t.tabs.push({title:"Statistics"}))}}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("processor",["$filter","util","constants","percentFilter",function(n,t,i,r){return{processConfig:function(n){var i=function(t){return $.grep(n.Configuration.Config,function(n){return n.Name===t})[0].Value};return{csvElectionDayHour:i("CSVElectionDayHour"),enableJurisdictionStats:t.isTrue(i("EnableJurisdictionStats")),enableRaceStats:t.isTrue(i("EnableRaceStats")),refreshTimerInterval:i("RefreshTimerInterval"),isLive:t.isTrue(i("IsLive")),siteMessage:t.isNullOrWhiteSpace(i("SiteMessage"))?"":i("SiteMessage")}},processElectionList:function(i){var f=i.Dates.DefaultElectionDate,u=[],r=function(n){var t=n.match(/(\d+)/g);return new Date(t[2],t[0]-1,t[1])},e=function(n){var t=r(n),i="";return i+=["Sun","Mon","Tues","Wed","Thur","Fri","Sat"][t.getDay()],i+=" "+["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],i+=" "+t.getDate(),i+(" "+t.getFullYear())};return $.each(i.Dates.Date,function(i,o){var s={id:o.PKElectionID,date:r(o.ElectionDate),dateFormatted:e(o.ElectionDate),shortDateString:o.ElectionDate,iso8601Date:n("date")(r(o.ElectionDate),"yyyy-MM-dd"),isOfficial:t.isTrue(o.ResultsOfficial),isDefault:o.ElectionDate==f,displayTurnoutStats:t.isTrue(o.DisplayTurnoutStats),congressionalMapName:o.CONG_MapName,representativeMapName:o.REP_MapName,senateMapName:o.SEN_MapName,hasPostElectionStats:t.isTrue(o.PostElectionStatsAvailable),hasJurisdictionStats:t.isTrue(o.PWPStatsExist),hasRaceStats:t.isTrue(o.RaceStatsExist),turnoutMessage:o.TurnoutMessage};u.push(s)}),u},processElectionRaces:function(n){var i=[];return $.each(t.ensureArray(n.Races.Race),function(n,t){i.push({id:t.RaceID,name:t.OfficeTitleAndDesc})}),i},processMultiparish:function(n){var u=function(n){var t=[];return $.each(n,function(n,i){t.push({id:i.ID,name:i.Desc,color:"#"+i.Color.substring(2)})}),t},i=t.ensureArray(n.Races.Race),r={hasPresidential:!1,hasCongressional:!1,hasLegislative:!1,hasStateWide:!1,hasMultiparish:!1,races:[],tabs:[]};return i!=null&&$.each(i,function(n,i){var f={id:i.ID,fullText:i.FullText,title:i.GeneralTitle,isClosedParty:t.isTrue(i.IsClosedParty),isMultiparish:t.isTrue(i.IsMultiParish),isPresidentialNominee:t.isTrue(i.IsPresidentialNominee),numberToBeElected:i.NumberToBeElected,level:i.OfficeLevel,specificTitle:i.SpecificTitle,summaryText:i.SummaryText,choices:u(i.Choice)};r.races.push(f)}),r},mergeRacesAndResults:function(n,u,f,e){if(u=t.ensureArray(u),f=t.ensureArray(f),u==null)return[];var o=[],s=this;return $.each(u,function(t,u){var v=0,c=null,l=0,h=null,y,a,p;if(typeof n!="undefined"&&n!=null&&(h=$.grep(n,function(n){return n.id==u.ID})[0]),h==null&&typeof f!="undefined"&&f!=null&&(h=$.grep(f,function(n){return n.id==u.ID})[0]),h==null){y="Race id "+u.ID+" in results but not found in races - election "+e.shortDateString;try{$.post(configuration.errorUrl,{message:y,additionalInfo:"Try doing a full regeneration of the files from the graphical result file writer tool.",stackTrace:""})}catch(w){}return}for(h.precinctsReporting=u.PrecinctsReporting,h.precinctsExpected=u.PrecinctsExpected,h.reportingPercent=r(h.precinctsReporting/h.precinctsExpected,0),h.absenteeReporting=u.NumAbsenteeReporting,h.absenteeExpected=u.NumAbsenteeExpected,l=0;l<h.choices.length;l++){if(c=h.choices[l],a=$.grep(u.Choice,function(n){return n.ID==c.id})[0],a==null)throw new Error("Missing result for choice ID "+c.ID+", race "+h.id+", election "+e.shortDateString);e.isOfficial&&!h.isClosedParty?(c.outcome=a.Outcome,c.outcomeColor=i.outcomeStyles[c.outcome],c.outcomeIcon=i.outcomeIcons[c.outcome]):c.outcome=null;c.votes=a.VoteTotal;v+=1*c.votes}if(h.totalVotes=v,h.showSubtitle=!1,h.subtitle="",s.normalizeChoices(h.choices),h.showTurnout=u.VoterCountQualified!=-1&&(e.isOfficial||u.PrecinctsReporting==u.PrecinctsExpected),h.turnout=s.getTurnoutText(e,h.showTurnout,u,v,h.numberToBeElected),$.grep(o,function(n){return n.id===h.id}).length>0){p="Race "+h.id+" already found in merged race array - "+e.shortDateString;try{$.post(configuration.errorUrl,{message:p,stackTrace:""})}catch(w){}}else o.push(h)}),o},getReportingText:function(n){if(!n.hasOwnProperty("PrecinctsReporting"))return null;var t=n.NumAbsenteeReporting!==n.NumAbsenteeExpected?' class="attention" ':"",i=n.PrecinctsReporting!==n.PrecinctsExpected?' class="attention" ':"",r="<span"+t+">Early & Absentee Reporting - "+n.NumAbsenteeReporting+" of "+n.NumAbsenteeExpected+" parishes<\/span>",u="<span"+i+">Election Day Reporting - "+n.PrecinctsReporting+" of "+n.PrecinctsExpected+" precincts<\/span>";return r+"<br />"+u},getTurnoutText:function(n,i,r,u,f){if(!r.hasOwnProperty("VoterCountQualified"))return"";var o=function(n,t){var i=""+Math.round(n/t*1e3)/10;return i!=100&&i.indexOf(".")==-1&&(i+=".0"),i+"%"},e="";return n.displayTurnoutStats?i&&(e=n.isOfficial&&n.hasPostElectionStats?"Turnout: "+o(r.VoterCountVoted,r.VoterCountQualified):"Unofficial Turnout: "+o(u/f,r.VoterCountQualified)):t.isNullOrWhiteSpace(n.turnoutMessage)||(e=n.turnoutMessage),e},mergeOneRaceAndResults:function(n,i,r){i=t.ensureArray(i);var u=this,f=[];return $.each(i,function(i,e){for(var c=0,o=null,s=0,l=[],a,v,h,s=0;s<n.choices.length;s++){if(o=n.choices[s],a=$.grep(e.Choice,function(n){return n.ID==o.id})[0],a==null)throw new Error("Missing result for choice ID "+o.ID+", race "+n.id+", election "+r.shortDateString);v=a.VoteTotal;c+=1*v;l.push({id:o.id,name:o.name,color:o.color,votes:v,outcome:null})}u.normalizeChoices(l);h={hasReported:e.hasOwnProperty("HasReported")?t.isTrue(e.HasReported):!0,totalVotes:c,choices:l,turnout:u.getTurnoutText(r,n.showTurnout,e,c,n.numberToBeElected),reportingText:u.getReportingText(e)};e.hasOwnProperty("ParishValue")&&(h.parishValue=e.ParishValue);e.hasOwnProperty("Precinct")&&(h.precinct=e.Precinct);f.push(h)}),f},processParishesInElection:function(n){var r=t.ensureArray(n.ParishesInElection.Parish),i=[];return $.each(r,function(n,r){var u=t.getParishName(r.ParishValue);i.push({hasAbsentee:r.CompleteWithAbsentee,value:r.ParishValue,name:u,precincts:r.Precincts,precinctsReported:r.PrecinctsReported,display:u+" - "+r.PrecinctsReported+" of "+r.Precincts+" precincts reporting"})}),{VersionDateTime:n.ParishesInElection.VersionDateTime,parishes:i}},filterOnCategory:function(n,t){var i=[],r=this;return $.each(t,function(t,u){r.isInRaceGroup(u,n)&&i.push(u)}),i},processStatsCategories:function(n){var u=t.ensureArray(n.Dropdown.Category),r=[];return $.each(u,function(n,u){if(u.CategoryName==="Parish"){var f=[];$.each(t.ensureArray(u.Option),function(n,t){var r=$.grep(i.parishList,function(n){return n.name.toLowerCase()===t.toLowerCase()})[0];f.push(r.name)});r.push({name:u.CategoryName,options:f})}else r.push({name:u.CategoryName,options:t.ensureArray(u.Option)})}),r},normalizeChoices:function(n){for(var i,f=0,o=0,e,u,r=0;r<n.length;r++)f+=1*n[r].votes,o=Math.max(o,n[r].votes);for(r=0;r<n.length;r++)i=n[r],i.graphStyle={"background-color":i.color},f===0?(i.percent=0,i.graphStyle.width=null):(i.percent=Math.round(i.votes/f*100),i.graphPercent=Math.round(i.votes/o*100),i.graphStyle.width=i.graphPercent+"%"),i.showPercent=f>0,e=t.hexToDecimal(i.color),u=e.r+","+e.g+","+e.b,i.backgroundGraphStyle={width:i.graphPercent+"%",background:"linear-gradient(to top, rgba("+u+",0.8) 0, rgba("+u+",.25) 15%, rgba("+u+",.25) 85%, rgba("+u+",0.8) 100%)"}},isInRaceGroup:function(n,t){var r=n.hasOwnProperty("isPresidentialNominee")?n.isPresidentialNominee:n.level==50||n.level==60||n.level==57;switch(t){case i.category.MULTIPARISH:if(n.isMultiparish==1)return!0;break;case i.category.STATEWIDE:if(n.level>=100&&n.level<=142||n.level==998||n.level==10||r)return!0;break;case i.category.LEGISLATIVE:if(n.level>=200&&n.level<=209)return!0;break;case i.category.CONGRESSIONAL:if(n.level>=140&&n.level<=149)return!0;break;case i.category.PRESIDENTIAL:if(n.level==10)return!0}return!1}}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("googleAnalytics",[function(){return{submit:function(n,t){typeof submitGoogleAnalytics!="undefined"&&submitGoogleAnalytics(n,t)}}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("d3Service",[function(){var n=window.d3;return window.d3=undefined,n}])}(),function(){"use strict";angular.module("electionResultsServices").factory("topojsonService",[function(){var n=window.topojson;return window.topojson=undefined,n}])}(),function(){"use strict";angular.module("electionResultsServices").factory("modalService",["$modal","util",function(n,t){function e(f){r=$("body").scrollTop();$("body").css({overflow:"hidden",position:"fixed",top:-r});t.locationInfo.dialog="Controller: "+f.controller+" Race: "+f.resolve.race().id;i=n.open(f);i.result.catch(function(){}).finally(function(){u()})}function u(){i&&(i.dismiss(),i=null,f(),t.locationClearDialog(),$("body").css({overflow:"",position:"",top:""}).scrollTop(r))}var i,r,f;return{modal:function(n,t,r){n?(e(t),f=r):i&&u()},close:u}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("drawing",["d3Service","topojsonService",function(n,t){function i(i,r,u){var s=t.feature(i,i.objects.collection),e=n.geoBounds(s),l=[(e[0][0]+e[1][0])/2,(e[1][1]+e[0][1])/2],f=5e3,h=n.geoMercator().center(l).scale(f).translate([r/2,u/2]),y=n.geoPath().projection(h),o=y.bounds(s),a=f*r/(o[1][0]-o[0][0]),v=f*u/(o[1][1]-o[0][1]),c;return f=a<v?a:v,f=f-20,h=n.geoMercator().center(l).scale(f).translate([r/2,u/2]),c=[],angular.forEach(s.features,function(t){c.push(n.geoPath().projection(h)(t))}),c}return{createMapPathData:i}}])}(),function(){"use strict";angular.module("electionResultsApp").factory("$exceptionHandler",["$injector","util",function(n,t){var i=function(i,r){var f=null,e=null,s=null,h=null,o;if(typeof i=="undefined"||i==null?f="No message or exception provided":i.hasOwnProperty("message")?(f=i.message,e=i.stack,i.description&&i.description!==f&&(f+=" ("+i.description+")")):f=i,typeof r!="undefined"&&r!=null&&(f+=' (caused by "'+r+'")'),!u()){if(o=n.get("$rootScope"),i&&i.networkError){o.bigError=2;return}t.locationInfo!==undefined&&t.locationInfo!==null&&(s=JSON.stringify(t.locationInfo));o.bigError=!0;h=window.location.href;try{$.post(configuration.errorUrl,{message:f,stackTrace:e,pageUrl:h,additionalInfo:s})}catch(c){}typeof console!="undefined"&&(e!=null?console.error(f,e):console.error(f))}},r=0,u=function(){return++r>3};return i}])}(),function(){"use strict";function n(){function n(n){var r=configuration.humanReadableExcelUrl,i=n.getDate().toString(),t;i.length===1&&(i="0"+i);t=(n.getMonth()+1).toString();t.length===1&&(t="0"+t);var u=n.getFullYear().toString(),f=u+t+i,e=t+"-"+i+"-"+u;return r=r.replace("{0}",f),r.replace("{1}",e)}return{buildDownloadUrl:n}}angular.module("electionResultsServices").factory("humanReadableElectionResultsService",[n])}(),function(){"use strict";angular.module("electionResultsServices").factory("pieChartDataService",["d3Service",function(){function n(n,t){var r=["#1964AD","#C01945","#3AA942","#C0C0C0","#808080","#000000","#800000","#FFFF00","#808000","#008000","#00FFFF","#008080","#000080","#FF00FF","#800080"],i=[];switch(t.toLowerCase()){case"party":i.push({label:"Democratic",value:n.Dem,color:r[0]});i.push({label:"Republican",value:n.Rep,color:r[1]});i.push({label:"Other",value:n.PartyOther,color:r[2]});break;case"gender":i.push({label:"Male",value:n.Male,color:r[0]});i.push({label:"Female",value:n.Female,color:r[1]});i.push({label:"Unknown",value:n.SexUnknown,color:r[2]});break;case"race":i.push({label:"White",value:n.White,color:r[0]});i.push({label:"Black",value:n.Black,color:r[1]});i.push({label:"Other",value:n.RaceOther,color:r[2]})}return i}return{preparePieChartData:n}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("pieChartService",["d3Service","$timeout",function(n,t){function s(n,t){return(n-t*2)/2}function h(n,t,i){return(n-i-t*2)/2}function c(n,t,i){var r={};return r.x=n/2,r.y=(t-i)/2,r}function f(n,t,i,r){var f;if(n.endAngle-n.startAngle==0)return"M 0 0";var e=(t-1)*Math.cos(n.startAngle),o=i*Math.sin(n.startAngle),u=(t-1)*Math.cos(n.endAngle),s=i*Math.sin(n.endAngle);return u=u-1,f=[],f.push("M",e,o,"A",t,i,"0",n.endAngle-n.startAngle>Math.PI?1:0,"1",u,s,"L",r*u,r*s),f.push("A",r*t,r*i,"0",n.endAngle-n.startAngle>Math.PI?1:0,"0",r*e,r*o,"z"),f.join(" ")}function e(n,t,i,r){var u=n.startAngle>Math.PI?Math.PI:n.startAngle,u=u<0?0:u,o=n.endAngle>Math.PI?Math.PI:n.endAngle,f=t*Math.cos(u),e=i*Math.sin(u),s=t*Math.cos(o),h=i*Math.sin(o),c=[];return c.push("M",f,e,"L",f,r+e,"A",t,i,"0 0 1",s,r+h,"L",s,h,"A",t,i,"0 0 0",f,e,"z"),c.join(" ")}function o(n,t,i,r,u){if(u==0)return"M 0 0";var f=n.startAngle<Math.PI?Math.PI:n.startAngle,e=n.endAngle<Math.PI?Math.PI:n.endAngle,o=u*t*Math.cos(f),s=u*i*Math.sin(f),h=u*t*Math.cos(e),c=u*i*Math.sin(e),l=[];return l.push("M",o,s,"A",u*t,u*i,"0 0 1",h,c,"L",h,r+c,"A",u*t,u*i,"0 0 0",o,r+s,"z"),l.join(" ")}function r(n){return Math.round(1e3*(n.endAngle-n.startAngle)/(Math.PI*2))/10+"%"}function i(n){return n.data.value!=0?n.data.label:""}function u(n){return parseInt(n.data.value,10).toLocaleString("en-US",{useGrouping:!0})}function l(s,h,c,l,a,v,y,p){var w,k,b;typeof h!="undefined"&&h!=null&&(w=n.pie().sort(null).startAngle(0-Math.PI/2).endAngle(Math.PI*2-Math.PI/2).value(function(n){return n.value})(h),k=n.select("#"+s),k.selectAll(".slices").remove(),b=k.append("g").attr("transform","translate("+c+","+l+")").attr("class","slices").attr("id",s+"-slices"),b.selectAll(".innerSlice").data(w).enter().append("path").attr("class","innerSlice").style("fill",function(t){return n.hsl(t.data.color).darker(.7)}).attr("d",function(n){return o(n,a+.5,v+.5,y,p)}).attr("id",function(n,t){return s+"-inner-slice-"+t}).append("title").text(function(n){return i(n)+" - "+u(n)+" ("+r(n)+")"}).each(function(n){this._current=n}),b.selectAll(".outerSlice").data(w).enter().append("path").attr("class","outerSlice").style("fill",function(t){return n.hsl(t.data.color).darker(.7)}).style("stroke-width",2).attr("d",function(n){return e(n,a-.5,v-.5,y)}).attr("id",function(n,t){return s+"-outer-slice-"+t}).append("title").text(function(n){return i(n)+" - "+u(n)+" ("+r(n)+")"}).each(function(n){this._current=n}),b.selectAll(".topSlice").data(w).enter().append("path").attr("class","topSlice").style("fill",function(n){return n.data.color}).style("stroke",function(n){return n.data.color}).style("stroke-width",2).attr("d",function(n){return f(n,a,v,p)}).attr("id",function(n,t){return s+"-top-slice-"+t}).append("title").text(function(n){return i(n)+" - "+u(n)+" ("+r(n)+")"}).each(function(n){this._current=n}),b.selectAll(".label").data(w).enter().append("text").attr("class","label").attr("x",function(n){return.5*a*Math.cos(.5*(n.startAngle+n.endAngle))}).attr("y",function(n){return.5*v*Math.sin(.5*(n.startAngle+n.endAngle))}).attr("style","fill: black; font-size: 9px; font-weight: bold; font-family: Verdana,Arial,sans-serif; text-anchor: middle;").attr("id",function(n,t){return s+"-slice-label-"+t}).text(i).each(function(n){this._current=n}),t(function(){var h=document.getElementById(s),n,f,r,c,t,u,l,i,e,o;if(typeof h!="undefined"&&h!=null&&(n=h.getElementsByTagName("text"),f=[],typeof n!="undefined"&&n!=null))for(r=0;r<n.length;r++)for(c=n[r],t=c.getBoundingClientRect(),u=0;u<n.length;u++)l=n[u],c!=l&&(i=l.getBoundingClientRect(),i.left>t.right||i.right<t.left||i.top>t.bottom||i.bottom<t.top||(t.top<i.bottom?(e=t.bottom-t.top,o=i.bottom-i.top,f.indexOf(r)<0&&(n[r].setAttribute("transform","translate(0,"+(e/2+2)*-1+")"),n[u].setAttribute("transform","translate(0,"+(o/2+2)+")"),f.push(r),f.push(u))):(e=i.bottom-i.top,o=t.bottom-t.top,f.indexOf(u)<0&&(n[u].setAttribute("transform","translate(0,"+(e/2+2)*-1+")"),n[r].setAttribute("transform","translate(0,"+(o/2+2)+")"),f.push(u),f.push(r)))))}))}function a(t,r,u,s,h,c){function a(t){var i=n.interpolate(this._current,t);return this._current=i(0),function(n){return o(i(n),u+.5,s+.5,h,c)}}function v(t){var i=n.interpolate(this._current,t);return this._current=i(0),function(n){return f(i(n),u,s,c)}}function y(t){var i=n.interpolate(this._current,t);return this._current=i(0),function(n){return e(i(n),u-.5,s-.5,h)}}function p(t){var i=n.interpolate(this._current,t);return this._current=i(0),function(n){return.5*u*Math.cos(.5*(i(n).startAngle+i(n).endAngle))}}function w(t){var i=n.interpolate(this._current,t);return this._current=i(0),function(n){return.5*u*Math.sin(.5*(i(n).startAngle+i(n).endAngle))}}var l=n.pie().sort(null).startAngle(0-Math.PI/2).endAngle(Math.PI*2-Math.PI/2).value(function(n){return n.value})(r);n.select("#"+t).selectAll(".innerSlice").data(l).transition().duration(750).attrTween("d",a);n.select("#"+t).selectAll(".outerSlice").data(l).transition().duration(750).attrTween("d",y);n.select("#"+t).selectAll(".topSlice").data(l).transition().duration(750).attrTween("d",v);n.select("#"+t).selectAll(".label").data(l).transition().duration(750).attrTween("x",p).attrTween("y",w).text(i)}return{calculateChartXRadius:s,calculateChartYRadius:h,calculatePieChartCenter:c,draw:l,transition:a}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("barChartDataService",[function(){function n(n){return Math.ceil(n/10)*10}function t(t,i){var u=["#1964AD","#C01945","#3AA942","#C0C0C0","#808080","#000000","#800000","#FFFF00","#808000","#008000","#00FFFF","#008080","#000080","#FF00FF","#800080"],r={},o,s;r.values=[];switch(i.toLowerCase()){case"party":var h=parseInt(t.Dem_Voted,10),c=parseInt(t.Rep_Voted,10),f=parseInt(t.PartyOther_Voted,10),l=parseInt(t.Dem,10),a=parseInt(t.Rep,10),e=parseInt(t.PartyOther,10);r.values.push({label:"Democratic",value:h/l*100,color:u[0],originalData:{voted:h,qualified:l}});r.values.push({label:"Republican",value:c/a*100,color:u[1],originalData:{voted:c,qualified:a}});r.values.push({label:"Other",value:f/e*100,color:u[2],originalData:{voted:f,qualified:e}});break;case"gender":var v=parseInt(t.Male_Voted,10),y=parseInt(t.Female_Voted,10),p=parseInt(t.SexUnknown_Voted,10),w=parseInt(t.Male,10),b=parseInt(t.Female,10),k=parseInt(t.SexUnknown,10);r.values.push({label:"Male",value:v/w*100,color:u[0],originalData:{voted:v,qualified:w}});r.values.push({label:"Female",value:y/b*100,color:u[1],originalData:{voted:y,qualified:b}});r.values.push({label:"Unknown",value:p/k*100,color:u[2],originalData:{voted:p,qualified:k}});break;case"race":var d=parseInt(t.White_Voted,10),g=parseInt(t.Black_Voted,10),f=parseInt(t.RaceOther_Voted,10),nt=parseInt(t.White,10),tt=parseInt(t.Black,10),e=parseInt(t.RaceOther,10);r.values.push({label:"White",value:d/nt*100,color:u[0],originalData:{voted:d,qualified:nt}});r.values.push({label:"Black",value:g/tt*100,color:u[1],originalData:{voted:g,qualified:tt}});r.values.push({label:"Other",value:f/e*100,color:u[2],originalData:{voted:f,qualified:e}})}for(r.maximumValue=0,o=0;o<r.values.length;o++)s=parseInt(r.values[o].value,10),s>=r.maximumValue&&(r.maximumValue=s);return r.magnitude=n(r.maximumValue),r.magnitude==0&&(r.magnitude=1),r}return{prepareBarChartData:t}}])}(),function(){"use strict";angular.module("electionResultsServices").factory("barChartService",["d3Service","$filter",function(n,t){function i(t,i,r,u){var c={},a={},f={},v={},y={},p={},s={},l,h,w,o,b,e;for(s.x=u+2*u/3,s.y=i-(u*2+u/3),c.x=s.x,c.y=u,a.x=r-u,a.y=s.y,f.x=u,f.y=i-u*2,v.x=r-u,v.y=u,y.x=f.x,y.y=u+u/3,p.x=r-(u+2*u/3),p.y=f.y,l=n.select("#"+t).append("g").attr("class","axes").attr("id",t+"-axes"),h=[],h.push("M",c.x,c.y,"L",s.x,s.y,"L",f.x,f.y,"L",y.x,y.y,"z"),l.append("path").attr("d",h.join(" ")).attr("stroke","black").attr("stroke-weight","1").attr("fill","navajowhite").attr("class","axis"),h=[],h.push("M",f.x,f.y,"L",s.x,s.y,"L",a.x,a.y,"L",p.x,p.y,"z"),l.append("path").attr("d",h.join(" ")).attr("stroke","black").attr("stroke-weight","1").attr("fill","navajowhite").attr("class","axis"),h=[],h.push("M",c.x,c.y,"L",s.x,s.y,"L",a.x,a.y,"L",v.x,v.y,"z"),l.append("path").attr("d",h.join(" ")).attr("stroke","black").attr("stroke-weight","1").attr("fill","navajowhite").attr("class","axis"),w=(i-(u*3+u/3))/4,e=1;e<=3;e++)o=e*w,b="M "+y.x+" "+(y.y+o)+" L "+c.x+" "+(c.y+o)+" L "+v.x+" "+(v.y+o),l.append("path").attr("d",b).attr("stroke","black").attr("stroke-weight","0.5").attr("stroke-dasharray","1,1").attr("class","value-line").attr("fill","none");var nt=f.x-u*.3,k=w,tt=f.y+7,it=u*.2,rt=f.x-it,d=u*.1,g=k*.75;for(e=4;e>=0;e--){var ut=5*e,o=k*e,ft=tt-o;l.append("text").attr("x",nt).attr("y",ft).text(ut).attr("id",t+"-axis-label-"+e).attr("text-anchor","end").attr("style","fill: black; font-size: 8px; font-family: Verdana,Arial,sans-serif; text-anchor: end;");e!=0&&l.append("path").attr("d","M "+(f.x-1)+" "+(f.y-o)+" L "+(f.x-1)+" "+(f.y-o+g)+" L "+(f.x-d-1)+" "+(f.y-o+g)+" L "+(f.x-d-1)+" "+(f.y-o)+"z").attr("fill","silver");l.append("line").attr("x1",rt).attr("x2",f.x).attr("y1",f.y-o).attr("y2",f.y-o).attr("style","stroke: black;stroke-width: 1")}}function r(i,r,u,f,e){var w,g,c,l,v,s,y,a,h,nt,tt,b,o;if(typeof i!="undefined"&&i!=null&&i.values.length>0){var k=i.maximumValue!=0?i.maximumValue:1,ut=k/i.magnitude,p=(u-(e*2+2*e/3))/(i.values.length+1),d=n.select("#"+r);for(d.selectAll("#"+r+"-bars").remove(),w=d.append("g").attr("class","bars").attr("id",r+"-bars"),o=0;o<i.values.length;o++)g=(o+1)*p+(e+2*e/3),c={},c.x=g+7.5,c.y=f-2*e-e/3,l={},l.x=c.x,l.y=c.y-i.values[o].value/k*ut*(f-(e*3+e/3)),v={},v.x=c.x-15,v.y=l.y,s={},s.x=v.x-2*e/3+e/6,s.y=v.y+e/3-e/12,y={},y.x=s.x,y.y=f-e*2-e/12,a={},a.x=y.x+15,a.y=y.y,h={},h.x=a.x,h.y=s.y,w.append("path").attr("class","bar").attr("id","bar"+o+"_1").attr("d","M "+c.x+" "+c.y+" L "+l.x+" "+l.y+" L "+h.x+" "+h.y+" L "+a.x+" "+a.y+" z").attr("stroke","black").attr("stroke-weight","1").attr("fill",function(){return n.hsl(i.values[o].color).darker(.7)}).append("title").text(function(){return i.values[o].label+" - "+i.values[o].value.toLocaleString("en-US",{maximumFractionDigits:1})+"%"}),w.append("path").attr("class","bar").attr("id","bar"+o+"_2").attr("d","M "+l.x+" "+l.y+" L "+v.x+" "+v.y+" L "+s.x+" "+s.y+" L "+h.x+" "+h.y+" z").attr("stroke","black").attr("stroke-weight","1").attr("fill",function(){return n.hsl(i.values[o].color).darker(.3)}).append("title").text(function(){return i.values[o].label+" - "+i.values[o].value.toLocaleString("en-US",{maximumFractionDigits:1})+"%"}),w.append("path").attr("class","bar").attr("id","bar"+o+"_3").attr("d","M "+a.x+" "+a.y+" L "+h.x+" "+h.y+" L "+s.x+" "+s.y+" L "+y.x+" "+y.y+" z").attr("stroke","black").attr("stroke-weight","1").attr("fill",i.values[o].color).append("title").text(function(){return i.values[o].label+" - "+i.values[o].value.toLocaleString("en-US",{maximumFractionDigits:1})+"%"});for(nt=i.magnitude/4,o=1;o<5;o++)tt=r+"-axis-label-"+o,b=o*nt,n.select("#"+tt).text(t("number")(b));var ft=p/2,et=p+(e+2*e/3),ot=f-2*e+e/3;for(o=0;o<i.values.length;o++){var tt=r+"-bar-label-"+o,b=i.values[o].label,it=et+o*p-ft,rt=ot;n.select("#"+r+"-bars").append("text").text(b).attr("style","fill: black; font-size: 10px; font-weight: bold; font-family: Verdana,Arial,sans-serif; text-anchor: end;").attr("x",it).attr("y",rt).attr("transform","rotate(-45, "+it+", "+rt+")")}}}return{drawAxes:i,drawBars:r}}])}(),function(){"use strict";angular.module("electionResultsControllers").controller("graphicalCtrl",["$scope","$q","$location","$compile","$modal","$sce","dataManager","$interval","util","googleAnalytics",function(n,t,i,r,u,f,e,o,s,h){function l(){n.showCSV=!(s.isToday(n.selected.election.date)&&s.getLouisianaTime().getHours()<n.configuration.csvElectionDayHour)}function v(){n.configuration.isLive||(document.location="/Maintenance?areaName=ElectionResults");n.selected.election==null&&(n.selected.election=$.grep(n.electionList,function(n){return n.isDefault})[0]);l();n.interval===null&&(n.secondsUntilRecheck=n.configuration.refreshTimerInterval,n.interval=o(function(){n.secondsUntilRecheck-=1;n.recheckString=s.toMinutes(n.secondsUntilRecheck);n.secondsUntilRecheck<=0&&(n.secondsUntilRecheck=n.configuration.refreshTimerInterval,e.loadSettings())},1e3))}function a(){c=!1;n.tab=n.selected.tab.toLowerCase();s.locationInfo.tab=n.selected.tab;s.locationClearStatistics();h.submit("/graphical/"+n.tab,{election:n.selected.election.shortDateString})}s.showWait();var c=!0;n.resultsMessage=null;n.siteMessage=null;n.showCSV=!1;n.secondsUntilRecheck=0;n.recheckString="-:--";n.interval=null;n.$on("SETTINGS_LOADED",function(){v()});n.$on("ELECTION_LOADED",function(){if(n.electionInfo!=null){n.tabs=n.electionInfo.tabs;var t=$.grep(n.electionInfo.tabs,function(t){return t.title===n.selected.tab});t.length===0&&(n.selected.tab=n.electionInfo.tabs[0].title);c&&a()}});n.$watch("configuration.siteMessage",function(){var t=n.configuration.siteMessage;n.siteMessage=s.isNullOrWhiteSpace(t)?null:f.trustAsHtml(t)});n.$watch("selected.election",function(){var t=n.selected.election;t!=null&&(c=!0,n.tab=undefined,s.showWait(),e.clearElectionData(),e.loadElection(),e.setElectionMode(),n.resultsMessage=t.isOfficial?"Official Results":new Date<t.date?"Unofficial Results - Site may contain test data prior to day of election":"Unofficial Results",l(),s.locationInfo.election=t.shortDateString)});n.$watch("bigError",function(){var r,t,i;n.bigError&&(r=$("#ErrorTemplate").html(),t="We're sorry. An error has occurred. Please reload the page.",n.bigError===2&&(t="Network connection not available. Please reload the page."),i=n.$new(),i.message=t,h.submit("/graphical/clienterror"),u.open({backdrop:"static",keyboard:!1,animation:!1,windowClass:"smaller-phone",template:r,scope:i}))});n.navigate=function(t){t!=n.selected.tab?(s.showWait(),n.selected.tab=t,a()):n.$broadcast("RESET_TAB")};n.showCSVFlag=!1;n.chooseCSV=function(){n.showCSVFlag=!0};n.showTimerNoticeFlag=!1;n.openTimerNotice=function(){n.showTimerNoticeFlag=!0};n.refresh=function(){n.secondsUntilRecheck=1};e.loadSettings()}])}(),function(){"use strict";angular.module("electionResultsDirectives").constant("PADDING_PERCENT",.16).directive("grBarChart",["$window","$timeout","d3Service","barChartService","PADDING_PERCENT",function(n,t,i,r,u){function e(n,f,e){t(function(){var c=n.vm.barChartData,t=parseInt(e.width,10),s=parseInt(e.height,10),h=i.select(f[0]).append("svg").attr("width",t).attr("height",s).attr("id",e.svgId),o;h.append("g").attr("id",e.chartId);o=t*u;h.append("text").attr("x",t/2).attr("y",o*2/3).attr("text-anchor","middle").style("font-size","13px").style("font-weight","bolder").style("font-family","Verdana,Arial,sans-serif").text("Turnout");r.drawAxes(e.chartId,s,t,o);r.drawBars(c,e.chartId,s,t,o)})}function f(n){var t=this;t.$onInit=function(){function i(){t.padding=t.width*u}n.$watch(function(){return t.barChartData},function(n,i){n!==i&&typeof n!="undefined"&&n!=null&&r.drawBars(n,t.chartId,t.height,t.width,t.padding)});i()}}f.$inject=["$scope","$element"];return{restrict:"EA",scope:{barChartData:"=",chartId:"@",svgId:"@",width:"=",height:"="},link:e,controller:f,controllerAs:"vm",bindToController:!0}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grChoices",function(){return{restrict:"AE",scope:{choices:"="},template:$("#ChoicesTemplate").html()}})}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grCsv",["$modal",function(n){var i=function(){},t=function(t){t.$watch("active",function(n){n?t.open():t.modalInstance!=undefined&&t.modalInstance.close()});t.open=function(){t.modalInstance=n.open({template:$("#CSVTemplate").html(),controller:"csvCtrl",windowClass:"smaller-phone",backdrop:"static",resolve:{}});t.modalInstance.result.then(function(){t.active=!1},function(){t.active=!1})}};return t.$inject=["$scope"],{restrict:"AE",scope:{active:"=",race:"=",parishValue:"="},link:i,controller:t}}]);angular.module("electionResultsDirectives").controller("csvCtrl",["$scope","$modalInstance","dataManager","googleAnalytics","humanReadableElectionResultsService",function(n,t,i,r,u){n.close=function(){t.dismiss()};n.selectedRace=null;n.raceListLoaded=!1;n.selectedType="Parish";i.loadElectionRaces(n.selected.election);n.$on("RACES_LOADED",function(){n.selectedRace=n.electionRaces[0];n.raceListLoaded=!0});r.submit("/graphical/chooseCSV",{election:n.selected.election.shortDateString});n.downloadRace=function(){if(n.selectedRace!=null){var t=configuration.dataUrl+"?blob="+i.getCsvFilePath(n.selectedRace.id,n.selectedType==="Parish");window.open(t,"_blank","noopener,noreferrer");r.submit("/graphical/downloadCSV",{election:n.selected.election.shortDateString})}};n.downloadElection=function(){var t=u.buildDownloadUrl(n.selected.election.date);window.open(t,"_blank","noopener,noreferrer");r.submit("/graphical/downloadElection",{election:n.selected.election.shortDateString})}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grEarlyVoting",["modalService",function(n){var i=function(){},t=function(t){var i={template:$("#EarlyVotingTemplate").html(),controller:"earlyVotingCtrl",windowClass:"smaller-phone",backdrop:"static",resolve:{race:function(){return t.race},parishValue:function(){return t.parishValue}}};t.$watch("active",function(r){n.modal(r,i,function(){t.active=!1})})};return t.$inject=["$scope"],{restrict:"AE",scope:{active:"=",race:"=",parishValue:"="},link:i,controller:t}}]);angular.module("electionResultsDirectives").controller("earlyVotingCtrl",["$scope","modalService","dataManager","googleAnalytics","util","race","parishValue",function(n,t,i,r,u,f,e){n.close=function(){t.close()};n.race=f;n.resultSet=null;n.parishList=null;n.selectedParish=null;i.loadEarlyVotingResults(f);n.$on("EARLY_VOTES_LOADED",function(){n.parishList=[];$.each(n.earlyVotesList,function(t,i){var r=u.getParishName(i.parishValue);i.parishName=r;n.parishList.push({name:r,value:i.parishValue})});n.parishList.length>1&&n.parishList.unshift({name:"All",value:"All"});u.isDefined(e)?n.selectedParish=$.grep(n.parishList,function(n){return n.value===e})[0]:n.parishList.length===1&&(n.selectedParish=n.parishList[0]);n.showParishSelect=n.parishList.length>1;n.resultsLoaded=!0});n.$on("VERSION_LOADED",function(){i.loadEarlyVotingResults(f)});n.$on("$destroy",n.$watch("selectedParish",function(){n.selectedParish!==null&&(n.resultSet=n.selectedParish.value==="All"?n.earlyVotesList:$.grep(n.earlyVotesList,function(t){return t.parishValue===n.selectedParish.value}),u.locationInfo.parish=n.selectedParish.name,r.submit("/graphical/earlyVoting",{election:n.selected.election.shortDateString,parish:n.selectedParish.name}))}))}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grParishResults",["modalService",function(n){var i=function(){},t=function(t){var i={template:$("#ParishResultsTemplate").html(),controller:"parishResultsCtrl",windowClass:"smaller-phone",backdrop:"static",resolve:{race:function(){return t.race},parishValue:function(){return t.parishValue}}};t.$watch("active",function(r){n.modal(r,i,function(){t.active=!1})})};return t.$inject=["$scope"],{restrict:"AE",scope:{active:"=",race:"=",parishValue:"="},link:i,controller:t}}]);angular.module("electionResultsDirectives").controller("parishResultsCtrl",["$scope","modalService","dataManager","googleAnalytics","util","race","parishValue",function(n,t,i,r,u,f,e){var o="Results by Parish",s="Results by Precinct";n.close=function(){t.close()};n.race=f;n.resultSet=[];n.parishList=null;n.precinctList=null;n.selectedParish=null;n.selectedPrecinct=null;n.precinctsLoaded=!1;n.$on("RACE_PARISH_RESULTS_LOADED",function(){n.selectedParish==null&&n.buildParishList();n.resultsLoaded=!0});n.$on("RACE_PRECINCT_RESULTS_LOADED",function(){n.selectedPrecinct==null&&n.buildPrecinctList()});n.$on("VERSION_LOADED",function(){n.showParishSelect&&n.selectedParish!=null&&i.loadRaceParishResults(f);n.precinctsLoaded&&n.selectedParish!=null&&i.loadRacePrecinctResults(f,n.selectedParish.value)});n.showPrecincts=function(){n.precinctsLoaded=!1;n.showPrecinctSelect=!0;i.loadRacePrecinctResults(f,n.selectedParish.value)};n.precinctMode=u.isDefined(e);n.showPrecinctSelect=n.precinctMode;n.showParishSelect=!n.precinctMode;n.precinctMode?(n.selectedParish={value:e,name:u.getParishName(e)},u.locationInfo.parish=n.selectedParish.name,u.locationInfo.precinct="None",n.modalTitle=s,n.showPrecincts()):(i.loadRaceParishResults(f),n.modalTitle=o);n.$on("$destroy",n.$watch("selectedParish",function(){n.precinctMode||n.selectedParish!==null&&n.raceParishResultsList!=null&&(n.loadParish(),r.submit("/graphical/parishResults",{election:n.selected.election.shortDateString,parish:n.selectedParish.name}))}));n.loadParish=function(){n.precinctList=null;n.selectedPrecinct=null;n.precinctsLoaded=!1;n.showPrecinctSelect=!1;n.modalTitle=o;n.selectedParish.value==="All"?(n.resultSet=n.raceParishResultsList,$.each(n.resultSet,function(n,t){var i=u.getParishName(t.parishValue);t.parishName=i})):n.resultSet=$.grep(n.raceParishResultsList,function(t){return t.parishValue===n.selectedParish.value});u.locationInfo.parish=n.selectedParish.name;u.locationInfo.precinct="None"};n.$on("$destroy",n.$watch("selectedPrecinct",function(){n.selectedPrecinct!==null&&(n.resultSet=n.selectedPrecinct.value==="All"?n.racePrecinctResultsList:$.grep(n.racePrecinctResultsList,function(t){return t.precinct===n.selectedPrecinct.value}),n.modalTitle=s,u.locationInfo.precinct=n.selectedPrecinct.name)}));n.buildParishList=function(){n.parishList=[];$.each(n.raceParishResultsList,function(t,i){n.parishList.push({name:u.getParishName(i.parishValue),value:i.parishValue})});n.parishList.length>1?n.parishList.unshift({name:"All",value:"All"}):n.selectedParish=n.parishList[0]};n.buildPrecinctList=function(){n.precinctList=[];$.each(n.racePrecinctResultsList,function(t,i){n.precinctList.push({name:i.precinct,value:i.precinct});i.precinctLabel=i.precinct==="Early Voting"||i.precinct==="Provisional Votes"?i.precinct:"Precinct "+i.precinct});n.precinctList.length>1?n.precinctList.unshift({name:"All",value:"All"}):n.selectedPrecinct=n.precinctList[0];n.precinctsLoaded=!0;n.resultsLoaded=!0}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grPieChart",["$window","$timeout","d3Service","pieChartService",function(n,t,i,r){function f(n,u,f){t(function(){var l=n.vm.pieChartData,t=parseInt(f.width,10),o=parseInt(f.height,10),s=parseInt(f.padding,10),e=parseInt(f.chartHeight,10),h=i.select(u[0]).append("svg").attr("width",t).attr("height",o).attr("id",f.svgId);h.append("g").attr("id",f.chartId);h.append("text").attr("x",t/2).attr("y",t/10).attr("text-anchor","middle").style("font-size","13px").style("font-weight","bolder").style("font-family","Verdana,Arial,sans-serif").style("color","#001C39").text("Qualified Voters");var a=r.calculateChartXRadius(t,s,e),v=r.calculateChartYRadius(o,s,e),c=r.calculatePieChartCenter(t,o,e);r.draw(f.chartId,l,c.x,c.y,a,v,e,0)})}function u(n){var t=this;t.$onInit=function(){function i(){}n.$watch(function(){return t.pieChartData},function(n,i){if(n!==i&&typeof n!="undefined"&&n!=null){var f=r.calculateChartXRadius(t.width,t.padding,t.chartHeight),e=r.calculateChartYRadius(t.height,t.padding,t.chartHeight),u=r.calculatePieChartCenter(t.width,t.height,t.chartHeight);r.draw(t.chartId,n,u.x,u.y,f,e,t.chartHeight,0)}});i()}}u.$inject=["$scope","$element"];return{restrict:"EA",scope:{pieChartData:"=",chartId:"@",svgId:"@",width:"=",height:"=",chartHeight:"=",padding:"="},link:f,controller:u,controllerAs:"vm",bindToController:!0}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grRace",["$modal","$sce","util",function(n,t,i){var r=function(n){if(i.isDefined(n.election)){var t;n.$watch("race",function(r){if(r!=undefined){t=n.race;var u=0;$.each(t.choices,function(n,t){u=Math.max(u,t.name.length)});n.nameWidthClass=i.getNameWidthClass(u);n.showStatsButton=n.configuration.enableRaceStats&&n.election.hasRaceStats;n.showMultiparishText=n.mode==="parish"&&t.isMultiparish;n.multiToBeElectedText=t.numberToBeElected>1?"("+t.numberToBeElected+" to be elected)":"";n.showParishButton=n.mode!=="parish";n.showPrecinctButton=n.mode==="parish";i.isNullOrWhiteSpace(t.fullText)||(n.titleClass="ref-title")}});n.showVoterStatsFlag=!1;n.showEarlyVotingFlag=!1;n.showParishResultsFlag=!1;n.showFullTextFlag=!1;n.showFullText=function(){i.isNullOrWhiteSpace(t.fullText)||(n.showFullTextFlag=!0)};n.showVoterStats=function(){n.showVoterStatsFlag=!0};n.showEarlyVoting=function(){n.showEarlyVotingFlag=!0};n.showParishResults=function(){n.showParishResultsFlag=!0};n.showPrecinctResults=function(){n.showParishResultsFlag=!0}}};return r.$inject=["$scope"],{controller:r,restrict:"E",scope:{race:"=",election:"=",configuration:"=",parishValue:"=",mode:"@"},template:$("#RaceTemplate").html()}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grRaceSimple",["$sce","util",function(n,t){var i=function(n){function i(){var r=n.race,i=0;$.each(r.choices,function(n,t){i=Math.max(i,t.name.length)});n.nameWidthClass=t.getNameWidthClass(i)}i(n)};return i.$inject=["$scope"],{controller:i,restrict:"EA",scope:{race:"=race",mode:"@"},template:$("#RaceSimpleTemplate").html()}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grRefText",["modalService",function(n){var i=function(){},t=function(t){var i={template:$("#RefTextTemplate").html(),controller:"refTextCtrl",windowClass:"smaller-phone",backdrop:"static",resolve:{race:function(){return t.race}}};t.$watch("active",function(r){n.modal(r,i,function(){t.active=!1})})};return t.$inject=["$scope"],{restrict:"AE",scope:{active:"=",race:"=",parishValue:"="},link:i,controller:t}}]);angular.module("electionResultsDirectives").controller("refTextCtrl",["$scope","modalService","dataManager","googleAnalytics","util","race",function(n,t,i,r,u,f){n.close=function(){t.close()};n.summaryText=f.summaryText;n.fullText=f.fullText}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grStateMap",["util","constants","drawing","$filter","geoFeatures","d3Service",function(n,t,i,r,u,f){function e(){}function o(e,o){function p(){var t=f.select(o[0]).select("svg").attr("viewBox"),n=t.split(" ");return{width:n[2],height:n[3]}}function w(){h=null;s.rawGeoFeatures=null;s.svgPathData=null;c=null;n.showWait();u.getGeoFeatures(s.mapType,s.electionDate).then(function(t){n.isDefined(t)&&(s.rawGeoFeatures=t,h=[],angular.forEach(s.rawGeoFeatures.objects.collection.geometries,function(n){h.push(k(n))}),s.svgPathData=i.createMapPathData(s.rawGeoFeatures,a.width,a.height),n.isDefined(s.participatingRegions)&&v());n.hideWait()})}function v(){var t=n.isDefined(h)&&h.length>0;t&&(s.regionClasses=[],s.regionTitles=[],angular.forEach(h,function(n){var i=l(n,!1),t;s.regionClasses.push(i);t=g(n);s.regionTitles.push(t)}),n.isDefined(s.selectedRegion)&&y())}function y(){var i=n.isDefined(h)&&h.length>0,t;i&&(n.isDefined(c)&&(s.regionClasses[c]=l(h[c])),n.isDefined(s.selectedRegion)&&(t=h.indexOf(s.selectedRegion),s.regionClasses[t]=l(h[t],!1),c=t))}function b(i){if(n.isDefined(s.participatingRegions)){var u=h[i],f=r("filter")(s.participatingRegions,s.mapStyle===t.mapStyleTypes.ACTIVEELECTION?{value:u}:u,!0).length===1;f&&(s.selectedRegion=u)}}function k(n){return s.mapType===t.mapTypes.STATE?"0":n.id}function l(n,i){var u="",f,e,o,h;return s.participatingRegions===undefined?u:(f=!1,s.mapStyle===t.mapStyleTypes.ACTIVEELECTION?f=r("filter")(s.participatingRegions,{value:n},!0).length>0:s.mapStyle===t.mapStyleTypes.STATISTICS&&(f=s.participatingRegions.indexOf(n)!==-1),f&&(u+=" region-in-election",s.mapStyle===t.mapStyleTypes.ACTIVEELECTION&&(e=r("filter")(s.participatingRegions,{value:n},!0)[0],o=e.precinctsReported===e.precincts&&e.hasAbsentee==="1",o&&(u+=" region-reported")),h=s.selectedRegion===n,h&&(u+=" region-highlight")),i&&(u+=" region-hover"),u)}function d(n,t){if(s.regionClasses){var i=h[t],r=n.type==="mouseover";s.regionClasses[t]=l(i,r)}}function g(i){var u="",e,f,o;return s.mapStyle!==t.mapStyleTypes.ACTIVEELECTION&&s.mapStyle!==t.mapStyleTypes.STATISTICS?u:s.participatingRegions===undefined||s.mapStyle!==t.mapStyleTypes.ACTIVEELECTION&&s.mapStyle!==t.mapStyleTypes.STATISTICS?u:s.mapStyle===t.mapStyleTypes.STATISTICS?(e=s.participatingRegions.indexOf(i),e!==-1&&(u=s.areaTitles[e]),u):(f=r("filter")(s.participatingRegions,{value:i},!0)[0],o=n.isDefined(f),o&&(u=f.name+": "+f.precinctsReported+" of "+f.precincts+" precincts reporting"),u)}var s=e.vm,h=null,c=null,a;s.rawGeoFeatures=null;s.regionClasses=null;s.regionTitles=null;s.svgPathData=null;a=p();s.handleRegionClicked=b;s.handleHoverEvent=d;e.$watchGroup(["vm.mapType","vm.electionDate"],function(){n.isDefined(s.mapType)&&w()});e.$watch("vm.participatingRegions",function(){n.isDefined(s.participatingRegions)&&v()});e.$watch("vm.selectedRegion",function(){y()})}return{restrict:"E",template:$("#StateMapTemplate").html(),scope:{mapStyle:"=",mapType:"=",electionDate:"=",participatingRegions:"=",selectedRegion:"=",areaTitles:"="},link:o,controller:e,controllerAs:"vm",bindToController:!0}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grStatsTable",["$sce","util","percentFilter",function(n,t,i){var r=function(t){t.statsFiltered=[];t.$watch("election",function(n){if(n!=undefined){var i=t.election;t.showTurnout=i.hasPostElectionStats&&i.isOfficial;t.$emit("SHOW_TURNOUT_FLAG_CHANGED",t.showTurnout)}});t.filterStats=function(){var e,r,o,f,u;if(t.stats!=null){for(e=function(n,t){n==0&&t==0&&(t="1");var r=i(n/t,1),u=i(n/t,0);return'<span class="hidden-xs">'+r+'<\/span><span class="visible-xs">'+u+"<\/span>"},t.statsFiltered.length=0,r=t.stats,t.statsFilter==="Party"?(t.statsFiltered.push({option:"Democratic",qualified:r.Dem,voted:r.Dem_Voted}),t.statsFiltered.push({option:"Republican",qualified:r.Rep,voted:r.Rep_Voted}),t.statsFiltered.push({option:"Other",qualified:r.PartyOther,voted:r.PartyOther_Voted})):t.statsFilter==="Race"?(t.statsFiltered.push({option:"White",qualified:r.White,voted:r.White_Voted}),t.statsFiltered.push({option:"Black",qualified:r.Black,voted:r.Black_Voted}),t.statsFiltered.push({option:"Other",qualified:r.RaceOther,voted:r.RaceOther_Voted})):(t.statsFiltered.push({option:"Male",qualified:r.Male,voted:r.Male_Voted}),t.statsFiltered.push({option:"Female",qualified:r.Female,voted:r.Female_Voted}),t.statsFiltered.push({option:"Unknown",qualified:r.SexUnknown,voted:r.SexUnknown_Voted})),t.statsFiltered.push({option:"Total",qualified:r.All,voted:r.All_Voted}),o=t.statsFiltered[3].qualified,f=0;f<4;f++)u=t.statsFiltered[f],u.turnout=n.trustAsHtml(e(u.voted,u.qualified)),u.percent=n.trustAsHtml(e(u.qualified,o));t.$emit("RACE_FILTER_CHANGED",t.statsFilter)}};t.$watch("stats",t.filterStats);t.$watch("statsFilter",t.filterStats)};return r.$inject=["$scope"],{restrict:"E",controller:r,scope:{stats:"=",election:"=",statsFilter:"="},template:$("#StatsTableTemplate").html()}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grTabMultiparish",["dataManager","util",function(n,t){var i=function(i){i.active=!1;i.$watch("active",function(n){n&&r()});i.$watch("category",function(n){n!=undefined&&r()});var r=function(){i.active&&n.loadElectionResults()};i.$on("RESULTS_LOADED",function(){i.raceList=n.filterOnCategory(i.category);t.hideWait()});i.$on("VERSION_LOADED",function(){r()})};return i.$inject=["$scope"],{restrict:"E",scope:{category:"=",active:"=",configuration:"=",raceList:"=",election:"="},controller:i,template:$("#TabMultiParish").html()}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grTabParish",["dataManager","util","googleAnalytics","constants",function(n,t,i,r){var u=function(u){u.active=!1;u.$watch("active",function(n){n&&f()});u.$watch("election",function(n){n&&f()});var f=function(){u.election!=null&&u.active&&(u.resultsMode=!1,u.selectedParish=null,n.loadParishesInElection())};u.$on("PARISHES_IN_ELECTION_LOADED",function(){u.participatingRegions=angular.copy(u.parishesInElectionList);t.hideWait()});u.$on("PARISH_RESULTS_LOADED",function(){t.hideWait()});u.$on("RESET_TAB",function(){f()});u.$on("VERSION_LOADED",function(){u.resultsMode?n.loadParishResults(u.selectedParish):f()});u.viewClicked=function(){u.selectedParish!=null&&(t.showWait(),u.resultsMode=!0,u.parishName=t.getParishName(u.selectedParish),u.parishValue=u.selectedParish,n.loadParishResults(u.selectedParish),i.submit("/graphical/parish",{election:u.election.shortDateString,parish:u.parishName}))};u.changeParish=function(){u.resultsMode=!1;u.parishName=null;u.parishValue=null};u.parishMapType=r.mapTypes.PARISH;u.parishMapStyle=r.mapStyleTypes.ACTIVEELECTION};return u.$inject=["$scope"],{restrict:"E",scope:{active:"=",election:"=",parishesInElectionList:"=",parishRaceList:"=",configuration:"="},controller:u,template:$("#TabParishTemplate").html()}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grTabStatistics",["dataManager","util","constants","$filter","pieChartDataService","barChartDataService",function(n,t,i,r,u,f){var e=function(e){function c(){var r,i;if(e.active&&o){if(o=!1,!t.isDefined(e.election))return;if(e.resultsMode=!1,n.loadStatCategories(),r=e.election,e.showStats=r.hasRaceStats&&r.hasJurisdictionStats,e.files=[],r.hasPostElectionStats){var u=new Date(r.date),h=""+u.getFullYear(),f=""+(u.getMonth()+1),s=""+u.getDate();f.length===1&&(f="0"+f);s.length===1&&(s="0"+s);i=h+"_"+f+s+"_";u>new Date("8/1/2006")?(e.files.push({url:"statewide/"+i+"sta.pdf",label:"State Wide Stats",image:"pdf.gif"}),e.files.push({url:"statewide/"+i+"sta.xls",label:"State Wide Stats",image:"xls.gif"}),e.files.push({url:"parish/"+i+"par.pdf",label:"Parish Stats",image:"pdf.gif"}),e.files.push({url:"parish/"+i+"par.xls",label:"Parish Stats",image:"xls.gif"})):(e.files.push({url:"statewide/"+i+"sta.txt",label:"State Wide Stats",image:"txt.gif"}),e.files.push({url:"statewide/"+i+"sta.zip",label:"State Wide Stats",image:"zip.gif"}),e.files.push({url:"parish/"+i+"par.txt",label:"Parish Stats",image:"txt.gif"}),e.files.push({url:"parish/"+i+"par.zip",label:"Parish Stats",image:"zip.gif"}));$.each(e.files,function(n,t){t.url=configuration.statsLocation+t.url})}}else t.hideWait()}function s(n){switch(n){case"Louisiana":return i.mapTypes.STATE;case"Parish":return i.mapTypes.PARISH;case"Congressional District":return i.mapTypes.FEDERALHOUSE;case"Senate District":return i.mapTypes.STATESENATE;case"House District":return i.mapTypes.STATEHOUSE;default:return i.mapTypes.STATE}}function l(n,i){var r=[];return angular.forEach(n,function(n){var u=h(n,i);t.isDefined(u)&&r.push(u)}),r}function h(n,t){var u,f;return t===i.mapTypes.STATE?u="0":t===i.mapTypes.PARISH?u=r("filter")(i.parishList,{name:n},!0)[0].id:(f=n.split(" ")[0],u=f.substr(0,f.length-2)),u}function a(n,t){var u;return t===i.mapTypes.STATE?u="Louisiana":t===i.mapTypes.PARISH?u=r("filter")(i.parishList,{id:n},!0)[0].name:(u=n.toString(),u[0]==="0"&&(u=u.substr(1,u.length-1)),u=v(u),t===i.mapTypes.FEDERALHOUSE?u=u+" Congressional":t===i.mapTypes.STATEHOUSE?u=u+" Representative":t===i.mapTypes.STATESENATE&&(u=u+" Senatorial"),u=u+" District"),u}function v(n){var t=n[n.length-1];return t==="1"&&n!=="11"?n+"st":t==="2"&&n!=="12"?n+"nd":t==="3"&&n!=="13"?n+"rd":n+"th"}e.statsFiltered=[];e.jurisdictionStats=null;e.active=!1;e.$watch("active",function(n){n&&c()});var o=!0;e.$watch("election",function(n){n!=undefined&&(o=!0)});e.$watch("statsCategories",function(n){n!=undefined&&(e.statsCategorySelected=e.statsCategories[0],e.statsCategoryOptions=e.statsCategories[0].options,e.statsCategoryOptionSelected=e.statsCategories[0].options[0],t.locationInfo.statTabCategory=e.statsCategorySelected.name,t.locationInfo.statTabCategoryOption=e.statsCategoryOptionSelected,t.hideWait())});e.$on("STATISTICS_LOADED",function(){e.resultsMode=!0;t.hideWait()});e.$watch("statistics",function(n){n!=undefined&&e.bindStatistics(!0)});e.$on("RESET_TAB",function(){e.resultsMode=!1});e.$watch("statsCategoryOptionSelected",function(){if(t.isDefined(e.statsCategoryOptionSelected)){var n=s(e.statsCategorySelected.name);e.selectedRegion=h(e.statsCategoryOptionSelected,n);t.locationInfo.statTabCategoryOption=e.statsCategoryOptionSelected;e.resultsMode===!0&&e.bindStatistics(!1)}});e.$watch("selectedRegion",function(){if(t.isDefined(e.selectedRegion)){var n=s(e.statsCategorySelected.name);e.statsCategoryOptionSelected=a(e.selectedRegion,n)}});e.$watch("statsCategorySelected",function(){e.statsCategorySelected!=null&&(e.statsCategoryOptions=$.grep(e.statsCategories,function(n){return n.name===e.statsCategorySelected.name})[0].options,e.statsCategoryOptionSelected=e.statsCategoryOptions[0],e.mapType=s(e.statsCategorySelected.name),e.electionShortDateString=e.election.shortDateString,t.locationInfo.statTabCategory=e.statsCategorySelected.name,t.locationInfo.statTabCategoryOption=e.statsCategoryOptionSelected,e.participatingRegions=e.mapType===i.mapTypes.STATE?["0"]:l(e.statsCategoryOptions,e.mapType))});e.$on("RACE_FILTER_CHANGED",function(n,t){e.chartFilter=t});e.$on("SHOW_TURNOUT_FLAG_CHANGED",function(n,t){e.hideTurnoutChart=!t});e.$watch(function(){return e.chartFilter},function(n,t){n!==t&&typeof n!="undefined"&&n!=null&&(e.jurisdictionPieChartData=u.preparePieChartData(e.jurisdictionStats,n),e.jurisdictionBarChartData=f.prepareBarChartData(e.jurisdictionStats,n))});e.mapType=i.mapTypes.STATE;e.mapStyle=i.mapStyleTypes.STATISTICS;e.bindStatistics=function(n){e.statsCategoryDisplay=e.statsCategoryOptionSelected+(e.statsCategorySelected.name==="Parish"?" Parish":"");n&&(e.statsFilter="Party");var i=e.statsCategorySelected.name==="Parish"?t.getParishValue(e.statsCategoryOptionSelected):e.statsCategoryOptionSelected;e.jurisdictionStats=$.grep(e.statistics,function(n){return n.Option===i})[0];typeof e.jurisdictionStats!="undefined"&&e.jurisdictionStats!=null&&(e.jurisdictionPieChartData=u.preparePieChartData(e.jurisdictionStats,e.statsFilter),e.jurisdictionBarChartData=f.prepareBarChartData(e.jurisdictionStats,e.statsFilter));t.hideWait()};e.viewClicked=function(){t.showWait();n.loadStatistics(e.statsCategorySelected.name,e.statsCategoryOptionSelected)};e.changeJurisdiction=function(){e.resultsMode=!1;e.$root.statistics=null;e.statsFilter="Party"}};return e.$inject=["$scope"],{restrict:"E",controller:e,scope:{active:"=",election:"=",statsCategories:"=",statistics:"="},template:$("#TabStatisticsTemplate").html()}}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grTimerNotice",["$modal",function(n){function i(){}function t(t){function r(){i.modalInstance}function u(){i.modalInstance=n.open({template:$("#TimerNoticeTemplate").html(),controller:"timerNoticeInstanceCtrl",windowClass:"smaller-phone",backdrop:"static",resolve:{}});i.modalInstance.result.then(function(){i.active=!1},function(){i.active=!1})}var i=this;r();t.$watch("vm.active",function(n){n?u():i.modalInstance!=undefined&&i.modalInstance.close()})}t.$inject=["$scope"];return{restrict:"EA",scope:{active:"="},link:i,controller:t,controllerAs:"vm",bindToController:!0}}]);angular.module("electionResultsDirectives").controller("timerNoticeInstanceCtrl",["$scope","$modalInstance",function(n,t){function r(){i.message="This site automatically refreshes election data on a set time interval indicated by the Election Timer. There is no need to refresh this site manually. Updated election results will only be available when the Election Timer expires."}function u(){t.close("closed")}var i=n;i.close=u;r()}])}(),function(){"use strict";angular.module("electionResultsDirectives").directive("grVoterStats",["modalService",function(n){var i=function(){},t=function(t){var i={template:$("#VoterStatsTemplate").html(),controller:"voterStatsCtrl",windowClass:"smaller-phone",backdrop:"static",resolve:{race:function(){return t.race},parishValue:function(){return t.parishValue}}};t.$watch("active",function(r){n.modal(r,i,function(){t.active=!1})})};return t.$inject=["$scope"],{restrict:"AE",scope:{active:"=",race:"=",parishValue:"="},link:i,controller:t}}]);angular.module("electionResultsDirectives").controller("voterStatsCtrl",["$scope","dataManager","googleAnalytics","util","race","parishValue","pieChartDataService","barChartDataService","modalService",function(n,t,i,r,u,f,e,o,s){n.close=function(){s.close()};n.race=u;n.raceStatsLoaded=!1;n.highLevelStats=null;n.jurisdictionStats=null;n.parishList=null;n.precinctList=null;n.selectedParish=null;n.selectedPrecinct=null;n.showHighLevel=!0;n.statsFilter="Party";n.chartFilter=n.statsFilter;n.hideTurnoutChart=!0;t.loadRaceStats(u.id);n.$on("RACE_STATS_LOADED",function(){n.highLevelStats=n.raceStats.Stats.HighLevel;n.chartData=e.preparePieChartData(n.highLevelStats,n.statsFilter);n.barChartData=o.prepareBarChartData(n.highLevelStats,n.statsFilter);n.parishStats=r.ensureArray(n.raceStats.Stats.ParishLevel.Parish);n.parishList=[];$.each(n.parishStats,function(t,i){n.parishList.push({name:r.getParishName(i.ParishValue),value:i.ParishValue})});u.isMultiparish||(n.showHighLevel=!1,n.selectedParish=n.parishList[0],n.parishSelected());i.submit("/graphical/raceStats",{election:n.selected.election.shortDateString});n.raceStatsLoaded=!0;r.locationInfo.statFilter=n.statsFilter});n.$on("RACE_PARISH_STATS_LOADED",function(){n.precinctList=[];$.each(n.raceParishStats,function(t,i){n.precinctList.push(i.Precinct)});n.precinctList.length===1?(n.selectedPrecinct=n.precinctList[0],r.locationInfo.precinct=n.selectedPrecinct):n.precinctList.sort(r.sortPrecincts)});n.$on("RACE_FILTER_CHANGED",function(t,i){n.chartFilter=i});n.$on("SHOW_TURNOUT_FLAG_CHANGED",function(t,i){n.hideTurnoutChart=!i});n.$watch(function(){return n.chartFilter},function(t,i){t!==i&&typeof t!="undefined"&&t!=null&&(r.locationInfo.statFilter=n.statsFilter,n.chartData=e.preparePieChartData(n.highLevelStats,n.statsFilter,"highlevel"),n.barChartData=o.prepareBarChartData(n.highLevelStats,n.statsFilter),typeof n.jurisdictionStats!="undefined"&&n.jurisdictionStats!=null&&(n.jurisdictionPieChartData=e.preparePieChartData(n.jurisdictionStats,n.statsFilter,"jurisdiction"),n.jurisdictionBarChartData=o.prepareBarChartData(n.jurisdictionStats,n.statsFilter)))});n.parishSelected=function(){n.jurisdictionStats=$.grep(n.parishStats,function(t){return t.ParishValue===n.selectedParish.value})[0];n.precinctList=null;n.selectedPrecinct=null;t.loadRaceParishStats(u.id,n.selectedParish.value);r.locationInfo.parish=n.selectedParish.name;r.locationInfo.precinct="None";n.jurisdictionPieChartData=e.preparePieChartData(n.jurisdictionStats,n.statsFilter,"jurisdiction");n.jurisdictionBarChartData=o.prepareBarChartData(n.jurisdictionStats,n.statsFilter);i.submit("/graphical/raceStats",{election:n.selected.election.shortDateString,parish:n.selectedParish.name})};n.precinctSelected=function(){if(n.raceParishStats){if(n.jurisdictionStats=$.grep(n.raceParishStats,function(t){return t.Precinct===n.selectedPrecinct})[0],!n.jurisdictionStats)throw new Error("Failed to find stats in raceParish collection for precinct "+n.selectedPrecinct+(n.race?", race "+n.race.id:"")+".");n.jurisdictionPieChartData=e.preparePieChartData(n.jurisdictionStats,n.statsFilter,"jurisdiction");n.jurisdictionBarChartData=o.prepareBarChartData(n.jurisdictionStats,n.statsFilter);r.locationInfo.precinct=n.selectedPrecinct}}}])}()