(function(n){"use strict";var t=nspace("kd.viz.component.selectors"),i=nspace("kd.components");t.ChangeIndicatorView=i.TooltipDialogView.extend({initializeViews:function(){n("#indicator-target",n(this.el)).chosen({disable_search:!0})},handleSubmit:function(n){var t=this.getFormValue(n,"#indicator-target");window.location.href=t,n.preventDefault()},defaultQtip:{position:{my:"top center",at:"bottom center",target:!1},show:{event:"click",solo:!0,modal:!0},style:{classes:"tooltip medium",width:"400px"},events:{visible:function(){n("form",n(this)).trigger("render")},render:function(){n("button:submit").live("click",function(){var t=n(this).parents(".qtip").qtip("hide");t.find("~ #qtip-overlay").toggle()})},hide:function(t){var i=n(t.originalEvent.currentTarget),r=t.originalEvent.type,u=n(this);if(r=="mouseleave"&&i.is(".helper")){t.preventDefault();return}}}}})})(jQuery),function(){"use strict";var t=nspace("kd.viz.component.selectors.adapters"),n=t.UiAdapter=function(n){n||(n={}),this.initialize.apply(this,arguments)};_.extend(n.prototype,{initialize:function(){},selectEl:"",getProperty:function(){throw"getProperty has not been set.";},setProperty:function(){throw"setProperty has not been set.";}}),n.extend=extend}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.adapters");t.MultipleSelectAdapter=t.UiAdapter.extend({initialize:function(n){if(!n.forms)throw"Adapter form element is required.";if(!n.select)throw"Adapter select selector is required.";if(!n.prop)throw"Adapter requires a model property.";if(!n.subProp)throw"Adapter requires model sub-property.";this.forms=n.forms,this.select=n.select,this.prop=n.prop,this.subProp=n.subProp},get:function(t){var i={},r={};return r[this.prop]=i,t.find(this.select).each(function(){var t=n(this),r=t.data("id"),u=t.find("option:selected").map(function(){return n(this).data("id")}).toArray();i[r]=u}),r},set:function(t){var r=t.get(this.prop),i;typeof r!="undefined"&&(i=n(this.select,n(this.forms)),i.each(function(){var t=n(this),i=t.data("id").toString();t.val(r[i]||[])}),i.updateSelect())}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.adapters");t.RadioAdapter=t.UiAdapter.extend({initialize:function(n){if(!n.forms)throw"Adapter form element is required.";if(!n.select)throw"Adapter select selector is required.";if(!n.prop)throw"Adapter requires a model property.";this.forms=n.forms,this.select=n.select,this.prop=n.prop},get:function(t){var r=t.find(this.select).filter(":checked").map(function(){return n(this).data("id")}).toArray(),i={};return i[this.prop]=r||[],i},set:function(t){var i=t.get(this.prop),r;typeof i!="undefined"&&(r=n(this.select,n(this.forms)),r.each(function(){var t=n(this),r=t.data("id");i.indexOf(r)>=0&&t.prop("checked",!0)}))}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.adapters");t.SelectAdapter=t.UiAdapter.extend({initialize:function(n){if(!n.forms)throw"Adapter form element is required.";if(!n.select)throw"Adapter select selector is required.";if(!n.prop)throw"Adapter requires a model property.";this.forms=n.forms,this.select=n.select,this.prop=n.prop},get:function(t){var i={};return i[this.prop]=t.find(this.select).find("option:selected").map(function(){return n(this).data("id")}).toArray(),i},set:function(t){var r=t.get(this.prop),i;typeof r!="undefined"&&(i=n(this.select,n(this.forms)),i.val(r),i.updateSelect())}})}(jQuery),function(n){"use strict";var i=nspace("kd.viz.component.selectors.strategies"),t=i.DefaultsStrategy=function(n){n||(n={}),this.initialize.apply(this,arguments)};_.extend(t.prototype,{initialize:function(t){if(!t)throw"options are required.";if(!t.selectEl)throw"selectEl is required";if(!t.propertyName)throw"propertyName is required";if(!t.model)throw"model is required";var i=n(t.selectEl);if(i.length==0)throw"selectEl must include at least one element.";if(!i.is("select"))throw"selectEl must be a select element.";this.selectEl=i,this.propertyName=t.propertyName,this.model=t.model},selectEl:"",getProperty:function(){return this.model.get(this.propertyName)},setProperty:function(n){this.model.set(this.propertyName,n)}}),t.extend=extend}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.AllDefaultsStrategy=t.DefaultsStrategy.extend({setDefault:function(){var r=this.getProperty(),u=n(this.selectEl),t,i;r||hasProperty(r)||(t={},i=u.uniqueBy(function(t){return n(t).data("id")}),i.filter(function(){return n(this).is("[multiple]")}).each(function(){t[n(this).data("id")]=n("option",n(this)).map(function(){return n(this).data("id")}).toArray()}),i.filter(function(){return n(this).is(":not([multiple])")}).each(function(){t[n(this).data("id")]=n("option",n(this)).first().map(function(){return n(this).data("id")}).toArray()}),this.setProperty(t))}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.DataTypeDefaultStrategy=t.DefaultsStrategy.extend({initialize:function(t){if(!t)throw"options are required.";if(!t.selectEl)throw"selectEl is required";if(!t.propertyName)throw"propertyName is required";if(!t.model)throw"model is required";var i=n(t.selectEl);if(i.length==0)throw"selectEl must include at least one element.";if(!i.is("input:radio"))throw"selectEl must be a select element.";this.selectEl=i,this.propertyName=t.propertyName,this.model=t.model},setDefault:function(){var t=this.getProperty(),i;t&&t.length!=0||(i=parseInt(n("#default-data-type").val()),this.setProperty([i]))}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.FirstSingleSelectDefaultStrategy=t.DefaultsStrategy.extend({setDefault:function(){var t=this.getProperty();if(!t||t.length==0){var i=n(this.selectEl),r=n("option",i.first()).first(),u=r.data("id");this.setProperty([u])}}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.PrimaryDistributionDefaultStrategy=t.DefaultsStrategy.extend({setDefault:function(){var u=this.getProperty(),f=n(this.selectEl),t,i,r;u||(t=[],i=n("select:has([data-entity=dist])").uniqueBy(function(t){return n(t).data("id")}),i&&i.length>0?t=[i.find("option").data("id")]:(r=f.uniqueBy(function(t){return n(t).data("id")}),t=[r.data("id")]),this.setProperty(t))}})}(jQuery),function(n){"use strict";var r=nspace("kd.viz.component.selectors"),u=nspace("kd.components"),t=nspace("kd.viz"),i=nspace("kd.viz.component.selectors.strategies"),f=nspace("kd.events").EventNames.route.hydrate.name;r.DefaultSelectorsView=u.TooltipDialogView.extend({defaultQtip:{position:{my:"top center",at:"bottom center"},show:{event:"click",solo:!0,modal:!0},style:{classes:"tooltip medium",width:"700px"},events:{visible:function(){n("form",n(this)).trigger("render")},render:function(){n(".qtip-content").append('<button type="button" id="cboxqtipClose">close<\/button>'),n("button:submit, button.hide").live("click",function(){var t=n(this).parents(".qtip").qtip("hide");n("#qtip-overlay").hide()}),n("#cboxqtipClose").click(function(){var t=n(this).parents(".qtip").qtip("hide");t.hide(),n("#qtip-overlay").hide()});var i=new t.component.summaries.util.TimeFrame,r=n("select[multiple]:has([data-entity=tf])").show().multiselect({header:!1,selectedText:function(t,r,u){var f,e;return f=n(u).map(function(){return n(this).closest("label").find("span").text()}).toArray(),e=n(this).get(0).checkboxContainer.find("li label").map(function(){return n(this).text()}).toArray(),i.getTimeFrameSummary(f,e)}}),u=n("select[multiple][data-entity="+t.UrlParams.locationType+"]").add(r);n("select[multiple]").not(u).show().multiselect({header:!1}),n("select[multiple]").hide()},hide:function(t){var r=n(t.originalEvent.currentTarget),i=t.originalEvent.type,u=n(this);if(i!=="click"||!r.is("button:submit")){if(i=="click"&&r.is(".blurs")){t.preventDefault();return}if(i==="mouseleave"&&r.is(".edit-selections")){t.preventDefault();return}if(i=="mouseout"&&n(t.currentTarget).is(".qtip")){t.preventDefault();return}if(i=="blur"){t.preventDefault();return}n(".ui-state-active",u).length>0&&n("select[multiple]",u).multiselect("close"),n("form",u).trigger("reset")}}}},defaultDefaultStrategies:{tf:{selector:"select:has(option[data-entity="+t.UrlParams.timeFrame+"])",Strategy:i.FirstSingleSelectDefaultStrategy,propertyName:t.UrlParams.timeFrame},fmt:{selector:"input:radio[data-entity="+t.UrlParams.dataFormat+"]",Strategy:i.DataTypeDefaultStrategy,propertyName:t.UrlParams.dataFormat},dist:{selector:"select[data-entity="+t.UrlParams.distribution+"]",Strategy:i.AllDefaultsStrategy,propertyName:t.UrlParams.distribution},pdist:{selector:"select[data-entity="+t.UrlParams.distribution+"]",Strategy:i.PrimaryDistributionDefaultStrategy,propertyName:t.UrlParams.primaryDist}},initializeViews:function(t){var r,u=this,e,i,o,s;this.totalOptions={},n('option[data-entity=ch][data-istotal="true"]').each(function(){var t=n(this).closest("select").attr("data-id");u.totalOptions[t]=n(this).clone()}),n("select",n(this.el)).not("[multiple]").chosen({disable_search:!0}),n("select[multiple]").show().multiselect(),n(".chzn-drop",n(this.el)).css({width:"100%"});this.$el.on("change","input[data-entity=fmt]",function(n){u.onDataFormatChange(n)});_.bindAll(this,"updateViews","updateDistricts","getInitialRenderPromise","showMessage"),r=n.extend(!0,{},this.defaultDefaultStrategies,t.defaultStrategies||{});for(e in r)i=r[e],o=n(i.selector).length>0,o&&(s=i.Strategy,this.defaultStrategies.push(new s({selectEl:i.selector,propertyName:i.propertyName,model:this.model})));this.adapters=t.adapters||[],this.setDefaults();n(this.el).on("change",".legislative-selector",this.updateDistricts);n(this.el).on("reset render",this.updateViews);this.model.bind(f,this.hydrateView,this),this.renderPromise.resolve()},renderPromise:n.Deferred(),getInitialRenderPromise:function(){this.renderPromise.promise()},setDefaults:function(){for(var n=0;n<this.defaultStrategies.length;n++)this.defaultStrategies[n].setDefault()},defaultStrategies:[],hydrateView:function(){var i=this.model.get("legt"),r,u;i&&i.length>0&&(r=n("select[data-entity="+t.UrlParams.locationType+"]",n(this.el)),r.val(""),r.multiselect({noneSelectedText:"Then, select district(s)"}).closest("div").hide(),u=n("select[data-entity="+t.UrlParams.locationType+"][data-id="+i+"]",n(this.el)),u.closest("div").show(),u.updateSelect()),this.updateViews()},updateViews:function(){n("select[multiple]").each(function(){n(this).width()>259&&n(this).width(259)}),this.updateComponents();var t=n("[data-entity=fmt]:selected");t.length==0&&(t=n("[data-entity=fmt][data-id="+this.model.get("fmt")+"]")),this.updateTotalCharacteristics(t,!0)},updateComponents:function(){for(var t,n=0;n<this.adapters.length;n++)t=this.adapters[n],t&&t.set(this.model)},updateDistricts:function(i){var r=n("select[data-entity="+t.UrlParams.locationType+"]",n(this.el)),u,f;r.val(""),r.multiselect({noneSelectedText:"Then, select district(s)"}).closest("div").hide(),r.updateSelect(),u=n("option:selected",n(i.currentTarget)).data("id"),f=n("select[data-entity="+t.UrlParams.locationType+"][data-id="+u+"]",n(this.el)),u&&(f.closest("div").show(),f.updateSelect())},handleSubmit:function(n){n.preventDefault();var t=this.getModel(n,this.model);this.model.set(t),this.updateViews()},getModel:function(t,i){var f,o,r,u,s,e;return f=this,o=n(t.currentTarget).closest("form"),r={},_.each(f.adapters,function(n){(u=n.get(o),s=_.keys(u)[0],e=_.values(u)[0],e!=null)&&(f.propertiesAreEqual(e,i.get(s))||(r=_.extend(r,u)))}),r},propertiesAreEqual:function(n,t){return n instanceof Array||t instanceof Array?n instanceof Array&&t instanceof Array?this.arraysAreEqual(n,t):!1:n instanceof Object&&t instanceof Object?this.objectsAreEqual(n,t):!1},arraysAreEqual:function(n,t){var i;return i=_.intersection(n,t).length,i===n.length&&i===t.length},objectsAreEqual:function(n,t){var r,f,u,i;if(r=_.keys(n),f=_.keys(t),!this.arraysAreEqual(r,f))return!1;for(u=0;u<r.length;u++){if(i=r[u],n[i]instanceof Array&&t[i]instanceof Array){if(this.arraysAreEqual(n[i],t[i]))continue;return!1}return!1}return!0},adapters:[],showMessage:function(t){clearTimeout(this._timeout),n(".selectors .message-area").html(t).fadeIn(400),this._timeout=setTimeout(function(){n(".selectors .message-area").fadeOut(1e3)},6e3)},ensureOneOptionSelected:function(t){n(t.currentTarget).find("select[data-entity='dist']").each(function(){var t=n(this);t.find("option:selected").length===0&&(t.val([t[0].options[0].value]),t.updateSelect())})},onDataFormatChange:function(t){this.updateTotalCharacteristics(n(t.currentTarget))},updateTotalCharacteristics:function(t,i){var r=this,u=t.closest("label").text();u.indexOf("Percent")>-1?(n('option[data-entity=ch][data-istotal="true"]').each(function(){var t=parseInt(n(this).closest("select").attr("data-id")),u=parseInt(n(this).val());n(this).remove(),i&&kd.viz.vizUtil.removeCharacteristicFromModel(r.model,t,u)}),n("select[data-entity=dist]").multiselect().updateSelect()):n("select[data-entity=dist]").each(function(){var t=r.totalOptions[n(this).attr("data-id")],i;t&&n('option[data-entity=ch][data-istotal="true"][data-id="'+t.attr("data-id")+'"]',n(this)).length==0&&(n(this).append(t.clone()),i=n(this).val()||[],i.push(t.val()),n(this).val(i),n(this).multiselect().updateSelect())})}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors");t.MapSelectorsView=t.DefaultSelectorsView.extend({updateTotalCharacteristics:function(t,i){var r=this,u=t.closest("label").text();u.indexOf("Percent")>-1?(n('option[data-entity=ch][data-istotal="true"]').each(function(){var t=parseInt(n(this).closest("select").attr("data-id")),u=parseInt(n(this).val());n(this).remove(),i&&kd.viz.vizUtil.removeCharacteristicFromModel(r.model,t,u)}),n("select[data-entity=dist]").chosen().updateSelect()):n("select[data-entity=dist]").each(function(){var t=r.totalOptions[n(this).attr("data-id")];t&&n('option[data-entity=ch][data-istotal="true"][data-id="'+t.attr("data-id")+'"]',n(this)).length==0&&(n(this).append(t.clone()),n(this).chosen().updateSelect())})}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.adapters");t.PrimaryDistributionAdapter=t.UiAdapter.extend({initialize:function(n){if(!n.forms)throw"Adapter form element is required.";if(!n.select)throw"Adapter select selector is required.";if(!n.prop)throw"Adapter requires a model property.";this.forms=n.forms,this.select=n.select,this.prop=n.prop,this.distSelect=n.distSelect},get:function(t){var i,r,u;if(r=0,i={},t.find(this.distSelect).each(function(){var t,i;t=n(this),i=t.find("option:checked").length,i>r&&(r=i,u=t.data("id"))}),u)return i[this.prop]=[+u],i},set:function(t){var r=t.get(this.prop),i;typeof r!="undefined"&&(i=n(this.select,n(this.forms)),i.val(r),i.updateSelect())}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.adapters");t.SortSelectorAdapter=t.UiAdapter.extend({initialize:function(n){if(!n.forms)throw"Adapter form element is required.";if(!n.select)throw"Adapter select selector is required.";if(!n.prop)throw"Adapter requires a model property.";if(!n.distSelect)throw"Adapter requires a distribution selector.";if(!n.controlSelect)throw"Adapter requires a control selector.";this.forms=n.forms,this.select=n.select,this.prop=n.prop,this.distSelect=n.distSelect,this.controlSelect=n.controlSelect},get:function(t){var i={},r=t.find(this.select).find("option:selected").map(function(){return n(this).data("id")}).toArray();return i[this.prop]=r,i},set:function(t){var r,u,f=t.get(this.prop),i;typeof f!="undefined"&&(r=n(this.distSelect,n(this.forms)).map(function(){return n(this).find("option:checked").length}).toArray(),u=_.reduce(r,function(n,t){return Math.max(t,n)},0),u>1?n(this.controlSelect).hide():n(this.controlSelect).show(),i=n(this.select,n(this.forms)),i.val(f),i.updateSelect())}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.adapters");t.TimeRangeAdapter=t.UiAdapter.extend({initialize:function(n){if(!n.forms)throw"Adapter form element is required.";if(!n.select)throw"Adapter select selector is required.";if(!n.prop)throw"Adapter requires a model property.";this.forms=n.forms,this.select=n.select,this.prop=n.prop},get:function(n){var r={},u,f=n.find(this.select),e=f.filter("#start").first(),t=e.find("option:selected").data("id")||e.find("option").last().data("id"),o=f.filter("#end").first(),i=o.find("option:selected").data("id")||o.find("option").first().data("id");return u=t&&i?[t,i]:t?[t]:i?[i]:[],r[this.prop]=u,r},set:function(t){var i=t.get(this.prop);if(i){var r=n(this.select),u=r.filter("#start"),f=r.filter("#end");switch(i.length){case 0:break;case 1:u.val(i),f.val(i);break;default:u.val(i[0]),f.val(i[1])}r.updateSelect()}}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors"),i=nspace("kd.viz").UrlParams;t.BarSelectorsView=t.DefaultSelectorsView.extend({dialogEvents:{"multiselectclick select[data-entity=dist]":"characteristicClick","change select[data-entity=dist]":"distributionChange"},characteristicClick:function(n,t){this.isLastChecked=t.checked},distributionChange:function(t){var u,f,e,r,o,s;u=n(t.currentTarget),f=u.data("id"),e=u.find("option:selected").length,r=n(t.delegateTarget),o=r.find("select[data-entity='dist']"),s=this,e>1?(o.each(function(){var t,r,u,e;t=n(this),r=t.val(),u=t.data("id"),u!==f&&r&&r.length&&r.length>1&&(e=s.model.get(i.distribution)[u],e.length===1?t.val(e):t.val([t[0].options[0].value])),t.updateSelect()}),r.find(".sort-selector").hide()):r.find(".sort-selector").show()},handleSubmit:function(n){n.preventDefault(),this.ensureOneOptionSelected(n);var t=this.getModel(n,this.model);this.model.set(t),this.updateViews()}})}(jQuery),function(){"use strict";var n,t,i;n=window.nspace("kd.viz.component.selectors.embed.extensions"),t=window.nspace("kd.viz"),i=window.nspace("kd.events").EventNames,n.EmbedInitializationView={initializeEmbedViews:function(n){var e,u,f,o,r,s,h;this.el instanceof Object&&(this.el=n.el,this.$el=$(n.el)),e=new t.component.summaries.util.TimeFrame,$("select",$(this.el)).not("[multiple]").chosen({disable_search:!0}),$("select[multiple]:has([data-entity=tf])").show().multiselect({header:!1,selectedText:function(n,t,i){var r,u;return r=$(i).map(function(){return $(this).closest("label").find("span").text()}).toArray(),u=$(this).get(0).checkboxContainer.find("li label").map(function(){return $(this).text()}).toArray(),e.getTimeFrameSummary(r,u)}}),$("select[multiple]:not(:has([data-entity=tf]))").show().multiselect(),$(".chzn-drop",$(this.el)).css({width:"100%"}),_.bindAll(this),u=this,this.totalOptions={},$('option[data-entity=ch][data-istotal="true"]').each(function(){var n=$(this).closest("select").attr("data-id");u.totalOptions[n]=$(this).clone()});this.$el.on("change","input[data-entity=fmt]",function(n){u.onDataFormatChange(n)});f=$.extend(!0,{},this.defaultDefaultStrategies,n.defaultStrategies||{});for(o in f)r=f[o],s=$(r.selector).length>0,s&&(h=r.Strategy,this.defaultStrategies.push(new h({selectEl:r.selector,propertyName:r.propertyName,model:this.model})));this.adapters=n.adapters||[],this.setDefaults();this.$el.on("change",".legislative-selector",this.updateDistricts);this.$el.on("reset render",this.updateViews);this.$formdt=$("dl.tree dt:first"),this.$formdt.click(this.hideForm),this.model.bind(i.route.hydrate.name,this.hydrateView,this),this.renderPromise.resolve()},handleSubmitAndHideForm:function(n){this.handleSubmit(n),this.hideForm()},hideForm:function(){this.$formdt.toggleClass("show")}}}(),function(){"use strict";var t,n;t=window.nspace("kd.viz.component.selectors.embed.extensions"),n=window.nspace("kd.viz").UrlParams,t.EmbedSubmitHandlerView={handleSubmit:function(t){var i,r;t.preventDefault(),i=this.getModel(t,this.model),this.ensureOneOptionSelected(t),this.locationsHaveChanged()&&(i[n.location]=this.model.get(n.stagedLocations)),r=this.primaryDistribution||this.model.get("pdist"),i[n.primaryDist]=[r],this.model.set(i),this.updateViews()},locationsHaveChanged:function(){var t=this;return t.model.get(n.stagedLocations)?t.model.get(n.location).length!==t.model.get(n.stagedLocations).length?!0:_.any(t.model.get(n.location),function(i,r){return i!==t.model.get(n.stagedLocations)[r]})?!0:!1:!1}}}(),function(){"use strict";var n=window.nspace("kd.viz.component.selectors.embed"),t=window.nspace("kd.viz.component.selectors");n.BarSelectorsView=t.BarSelectorsView.extend({events:{submit:"handleSubmitAndHideForm","keydown .chzn-search input":"handleKeydown","multiselectclick select[data-entity=dist]":"characteristicClick","change select[data-entity=dist]":"distributionChange","change input[data-entity=fmt]":"onDataFormatChange"},initializeViews:function(n){_.bindAll(this,"initializeEmbedViews"),this.initializeEmbedViews(n)}}),_.extend(n.BarSelectorsView.prototype,n.extensions.EmbedSubmitHandlerView),_.extend(n.BarSelectorsView.prototype,n.extensions.EmbedInitializationView)}(),function(n){"use strict";var r,t,u,i;r=nspace("kd.viz.component.selectors"),t=nspace("kd.events").EventNames.route.hydrate.name,u=nspace("kd.viz").UrlParams,i=["modelProp","messageEl","toggleEl"],r.LocationSelectorView=Backbone.View.extend({initialize:function(r){for(var o=n(this.el),u,e,f=0;f<i.length;f++)if(u=i[f],e=r[u],!e)throw u+" is required by LocationSelectorView";else this[u]=r[u];_.bindAll(this),this.renderPromise.resolve(),this.$slider=o.parent(),this.$slider.mCustomScrollbar({theme:"dark-thick",scrollButtons:{enable:!0},advanced:{updateOnBrowserResize:!0,updateOnContentResize:!0,autoScrollOnFocus:!1}}),this[this.modelProp]=r[this.modelProp],!r.maximumChecked||(this.maximumChecked=r.maximumChecked),this.defaultLocationTypes=r.defaultLocationTypes||"state,region,county",this.setDefaults(),n(".modal-trigger").colorbox({inline:!0,opacity:.5});n(this.el).closest(".chart-container").on("click",this.toggleEl,this.toggleLocationSidebar);this.model.bind(t,this.hydrateView,this),this.renderPromise.resolve(),this.model.bind("change",this.updateSlider),this.model.bind(t,this.updateSlider)},renderPromise:n.Deferred(),getInitialRenderPromise:function(){this.renderPromise.promise()},maximumChecked:-1,setDefaults:function(){var n=this.getDefaults();this.model.set(this.modelProp,n),this.model.set(u.originalLocations,_.clone(n))},validatedLocationId:function(){var n;return(n=this.$("input[data-entity=loc][data-id="+this[this.modelProp]+"]:first"),n.length)?this[this.modelProp]:+this.$("input[data-entity=loc]:first").data("id")},getDefaults:function(){var t,i,r;return this[this.modelProp]?(i=this.validatedLocationId(),[i]):(r=_.map(this.defaultLocationTypes.split(","),function(n){return"[data-loc-type="+n+"]"}).join(),t=n("input[data-entity=loc]",n(this.el)).filter(r).map(function(){return n(this).data("id")}).toArray(),(t.length==0||t.length==1&&t[0]==2)&&(t=n("input[data-entity=loc]",n(this.el)).map(function(){return n(this).data("id")}).toArray()),this.maximumChecked>0&&t.length>this.maximumChecked&&(t=_.first(t,this.maximumChecked)),t)},hydrateView:function(){var r=this.model.get(this.modelProp),t=this,i;i=n("input:checkbox",n(this.el)).filter("[data-entity=loc]").prop("checked",!1).filter(function(){return r.indexOf(n(this).data("id"))>-1}).prop("checked",!0),i.each(function(){var r=n(this),i;i=r.parentsUntil(t.el,"dd:first"),i.siblings("dt").addClass("show"),i.parentsUntil(t.el,"dd:first").prev("dt").addClass("show")}),this.isValid()?(n(this.messageEl).empty(),n(this.messageEl).hide()):(n(this.messageEl).html(this.message),n(this.messageEl).show())},updateSlider:function(){var n=this;setTimeout(function(){n.$slider.mCustomScrollbar("update")},1e3)},events:{"click .clear-all":"clearAllCheckboxes","click .select-all-counties":"checkAllCounties","click .select-all-cities":"checkAllCities","click .select-all-districts":"checkAllDistricts","click .select-all-assembly":"checkAllAssemblies","click .select-all-senate":"checkAllSenates","click .select-all-congress":"checkAllCongresses","change input:checkbox":"onCheckboxChange"},clearAllCheckboxes:function(t){t.preventDefault();var i=n("input:checkbox",n(this.el)).prop("checked",!1).map(function(){return n(this).data("id")}).toArray();this.remove(i)},checkAllCounties:function(t){var i,r,u;if(t.preventDefault(),i=n('input:checkbox[data-loc-type="county"]',n(this.el)).filter(function(){return n(this).prop("checked")==!1}),r=n("input:checkbox:checked",n(this.el)).length+i.length,this.maximumChecked>0&&r>this.maximumChecked){alert("A maximum of "+this.maximumChecked+" locations are selectable.");return}u=i.prop("checked",!0).map(function(){return n(this).data("id")}).toArray(),this.add(u)},checkAllCities:function(t){var r;t.preventDefault();var u=n(t.currentTarget),i=u.parent("dd").next("dd").find('input:checkbox[data-loc-type="city"]').filter(function(){return n(this).prop("checked")==!1}),f=n("input:checkbox:checked",n(this.el)).length+i.length;if(this.maximumChecked>0&&f>this.maximumChecked){alert("A maximum of "+this.maximumChecked+" locations are selectable.");return}r=i.prop("checked",!0).map(function(){return n(this).data("id")}).toArray(),this.add(r)},checkAllDistricts:function(t){var r;t.preventDefault();var u=n(t.currentTarget),i=u.parent("dd").next("dd").find('input:checkbox[data-loc-type="school district"]').filter(function(){return n(this).prop("checked")==!1}),f=n("input:checkbox:checked",n(this.el)).length+i.length;if(this.maximumChecked>0&&f>this.maximumChecked){alert("A maximum of "+this.maximumChecked+" locations are selectable.");return}r=i.prop("checked",!0).map(function(){return n(this).data("id")}).toArray(),this.add(r)},checkAllAssemblies:function(t){var r;t.preventDefault();var u=n(t.currentTarget),i=u.parent("dd").next("dd").find('input:checkbox[data-loc-type="assembly district"]').filter(function(){return n(this).prop("checked")==!1}),f=n("input:checkbox:checked",n(this.el)).length+i.length;if(this.maximumChecked>0&&f>this.maximumChecked){alert("A maximum of "+this.maximumChecked+" locations are selectable.");return}r=i.prop("checked",!0).map(function(){return n(this).data("id")}).toArray(),this.add(r)},checkAllSenates:function(t){var r;t.preventDefault();var u=n(t.currentTarget),i=u.parent("dd").next("dd").find('input:checkbox[data-loc-type="state senate district"]').filter(function(){return n(this).prop("checked")==!1}),f=n("input:checkbox:checked",n(this.el)).length+i.length;if(this.maximumChecked>0&&f>this.maximumChecked){alert("A maximum of "+this.maximumChecked+" locations are selectable.");return}r=i.prop("checked",!0).map(function(){return n(this).data("id")}).toArray(),this.add(r)},checkAllCongresses:function(t){var r;t.preventDefault();var u=n(t.currentTarget),i=u.parent("dd").next("dd").find('input:checkbox[data-loc-type="u.s. congressional district"]').filter(function(){return n(this).prop("checked")==!1}),f=n("input:checkbox:checked",n(this.el)).length+i.length;if(this.maximumChecked>0&&f>this.maximumChecked){alert("A maximum of "+this.maximumChecked+" locations are selectable.");return}r=i.prop("checked",!0).map(function(){return n(this).data("id")}).toArray(),this.add(r)},onCheckboxChange:function(t){var i=n(t.currentTarget),r,u;if(this.maximumChecked>0&&n("input:checkbox:checked",n(this.el)).length>this.maximumChecked){i.prop("checked",!1),alert("A maximum of "+this.maximumChecked+" locations are selectable.");return}r=i.data("id"),u=i.prop("checked"),u?this.add(r):this.remove(r)},add:function(t){var r,i,f;if(typeof t!="undefined"&&t!=null){r=typeof t=="string"?_.map(t.split(","),function(n){return parseInt(n)}):typeof t=="number"?[t]:t;var e=this.modelProp,u=this.model.get(e).slice(0),o=!1;for(i=0;i<r.length;i++)f=r[i],u.indexOf(f)<0&&(u.push(f),o=!0);o&&this.model.set(e,u),this.isValid()?(n(this.messageEl).empty(),n(this.messageEl).hide()):(n(this.messageEl).html(this.message),n(this.messageEl).show())}},remove:function(t){var u,r,f;if(typeof t!="undefined"&&t!=null){u=typeof t=="string"?_.map(t.split(","),function(n){return parseInt(n)}):typeof t=="number"?[t]:t;var e=this.modelProp,i=this.model.get(e).slice(0),o=!1;for(r=0;r<u.length;r++)f=u[r],i.indexOf(f)>=0&&(i.splice(i.indexOf(f),1),o=!0);o&&this.model.set(e,i),this.isValid()?(n(this.messageEl).empty(),n(this.messageEl).hide()):(n(this.messageEl).html(this.message),n(this.messageEl).show())}},toggleLocationSidebar:function(t){var i,r,u,f,e;t.preventDefault(),i=n(t.currentTarget),r=n(this.el).closest(".chart-container"),r.hasClass("show-sidebar")?(i.find(".helper").text("(show)"),r.removeClass("show-sidebar")):(i.find(".helper").text("(hide)"),r.addClass("show-sidebar")),u=n(".dataTables_wrapper").width(),f=n(".DTFC_LeftWrapper").width(),n(".dataTables_scroll").width(u-f),e=nspace("kd.events").EventNames,i.trigger(e.sidebar.toggled.name)},message:"",isValid:function(){return n("input:checkbox:checked",n(this.el)).length==0?(this.message='<div class="greySmallFont">Please select at least one location to see data.<\/div>',!1):(this.message="",!0)}})}(jQuery),function(){"use strict";var t=window.nspace("kd.viz.component.selectors.embed"),i=window.nspace("kd.viz.component.selectors"),n=window.nspace("kd.viz").UrlParams;t.LocationSelectorView=i.LocationSelectorView.extend({add:function(n){this.change(n,function(n,t){var i=!1;return _.each(n,function(n){t.indexOf(n)<0&&(t.push(n),i=!0)}),i})},remove:function(n){this.change(n,function(n,t){var i=!1;return _.each(n,function(n){t.indexOf(n)>=0&&(t.splice(t.indexOf(n),1),i=!0)}),i})},change:function(t,i){var u,r,f;(this.model.get(n.stagedLocations)||this.model.set(n.stagedLocations,this.model.get(this.modelProp)),typeof t!="undefined"&&t!=null)&&(u=typeof t=="string"?_.map(t.split(","),function(n){return parseInt(n)}):typeof t=="number"?[t]:t,r=this.model.get(n.stagedLocations).slice(0),f=i(u,r),f&&this.model.set(n.stagedLocations,r,{silent:!0}),this.isValid()?($(this.messageEl).empty(),$(this.messageEl).hide()):($(this.messageEl).html(this.message),$(this.messageEl).show()))}})}(),function(){"use strict";var t,n;t=window.nspace("kd.viz.component.selectors.extensions"),n=window.nspace("kd.viz").UrlParams,t.LocationSelectorExtensions={changeLocationType:function(t,i){t[n.locationType]=[i],t[n.location]=[]}}}(),function(n,t,i){"use strict";var e=window.nspace("kd.viz.component.selectors"),r=window.nspace("kd.viz").UrlParams,u=window.nspace("kd.events").EventNames,o=window.nspace("kd.viz.component.selectors.extensions").LocationSelectorExtensions,f=["locTypeProp","locProp","toggleEl"];e.MapLocationSelectorView=t.View.extend({initialize:function(t){for(var r,o,e=0;e<f.length;e++)if(r=f[e],o=t[r],!o)throw r+" is required by MapLocationSelectorView";else this[r]=t[r];i.bindAll(this,"setDefaults","toggleLocationSidebar","expandLocationBranches","focusSelectedLocation","updateSlider","chosenifyLocationSelector"),this.setDefaults(),this.scrollbarInertia==null&&(this.scrollbarInertia=950),this.$slider=this.$el.parent(),this.$slider.mCustomScrollbar({theme:"dark-thick",scrollButtons:{enable:!0},scrollInertia:this.scrollbarInertia,advanced:{updateOnContentResize:!0,autoScrollOnFocus:!1}}),this.chosenifyLocationSelector();n(this.el).closest(".chart-container").on("click",this.toggleEl,this.toggleLocationSidebar);this.model.bind(u.route.hydrate.name,this.hydrateView,this);this.model.on("change",this.updateSlider);this.model.on(u.route.hydrate.name,this.updateSlider);this.renderPromise.resolve()},locationTypeSelector:'select:not(".hide")',chosenifyLocationSelector:function(){var t=this;n(t.locationTypeSelector,n(t.el)).chosen({disable_search_threshold:10}).change(function(){t.wrapLongLocationName(n(this).next("div").find("span"))})},expandLocationBranches:function(){var n,t;n=this.$("> select:first option:checked[data-entity=loct]"),t="a[data-id="+this.model.get(r.location)[0]+"][data-loc-type="+n.attr("data-id")+"]",this.$(t).parentsUntil(this.el,"dd:first").prev("dt").addClass("show")},focusSelectedLocation:function(){var n,t;(n=this,n.$el.find(".highlight-location").removeClass("highlight-location"),n.model.get(r.location)[0])&&(t=n.$el.find('.tree:visible a[data-entity="loc"][data-id="'+n.model.get(r.location)[0]+'"]').addClass("highlight-location"),t.length!==0)&&setTimeout(function(){n.$slider.mCustomScrollbar("scrollTo",t.offset().top-n.$el.offset().top-n.$slider.height()/2)},n.scrollbarInertia)},updateSlider:function(){this.$slider.mCustomScrollbar("update")},wrapLongLocationName:function(n){if(n.length!=0){var t;n.removeAttr("style"),t=n.innerWidth(),n[0].scrollWidth>t&&n.css("overflow","inherit").css("white-space","normal").css("height","42px").css("line-height","21px").css("padding-top","7px").css("padding-bottom","7px")}},renderPromise:n.Deferred(),getInitialRenderPromise:function(){this.renderPromise.promise()},setDefaults:function(){var t=n("select",n(this.el)),i=t.find("option:first()").data("id");t.val(i),this.model.set(this.locTypeProp,[i]),this.model.set(this.locProp,[]),this.changeLocType()},hydrateView:function(){n("select",n(this.el)).val(this.model.get(r.locationType)[0]).trigger("liszt:updated"),this.wrapLongLocationName(n("select + div span",n(this.el))),this.showTree();this.model.on("change:"+r.location,this.expandLocationBranches);this.model.on("change:"+r.location,this.focusSelectedLocation);this.expandLocationBranches(),this.focusSelectedLocation()},events:{"change select":"changeLocType","click a[data-entity=loc]":"changeLocation","click .clear":"clearLocations"},showTree:function(){var t=n("select option:selected",n(this.el)).data("id");return n(".tree",n(this.el)).hide(),n(".tree[data-loc-type="+t+"]",n(this.el)).show(),t},changeLocType:function(){var t=this.showTree(),n={};o.changeLocationType(n,t),this.model.set(n)},changeLocation:function(t){var i=n(t.currentTarget);if(i.is(".highlight-location")){this.model.set(this.locProp,[]);return}this.model.set(this.locProp,[i.data("id")])},clearLocations:function(n){this.model.set(this.locProp,[]),n.preventDefault()},toggleLocationSidebar:function(t){t.preventDefault();var r,i,f;r=n(t.currentTarget),i=n(this.el).closest(".chart-container"),f=i.find(".chart.map").width(),i.hasClass("show-sidebar")?(r.find(".helper").text("(show)"),i.removeClass("show-sidebar")):(r.find(".helper").text("(hide)"),i.addClass("show-sidebar")),r.trigger(u.sidebar.toggled.name,[f])}})}(jQuery,Backbone,_),function(){"use strict";var n=window.nspace("kd.viz.component.selectors.embed"),t=window.nspace("kd.viz.component.selectors");n.MapLocationSelectorView=t.MapLocationSelectorView.extend({changeLocType:function(){},focusSelectedLocation:function(){},locationTypeSelector:"select"})}(),function(){"use strict";var n=window.nspace("kd.viz.component.selectors.embed"),t=window.nspace("kd.viz.component.selectors"),i=window.nspace("kd.viz").UrlParams,r=window.nspace("kd.viz.component.selectors.extensions").LocationSelectorExtensions;n.MapSelectorsView=t.DefaultSelectorsView.extend({events:{submit:"handleSubmitAndHideForm","keydown .chzn-search input":"handleKeydown"},initializeViews:function(n){_.bindAll(this,"initializeEmbedViews"),this.initializeEmbedViews(n)},handleSubmit:function(n){n.preventDefault();var t=this.getModel(n,this.model),u=+$(".location-selector select.block option:selected:first").attr("data-id");this.model.get(i.locationType)[0]!==u&&r.changeLocationType(t,u),this.model.set(t),this.updateViews()},updateTotalCharacteristics:function(n,t){var i=this,r=n.closest("label").text();r.indexOf("Percent")>-1?($('option[data-entity=ch][data-istotal="true"]').each(function(){var n=parseInt($(this).closest("select").attr("data-id")),r=parseInt($(this).val());$(this).remove(),t&&kd.viz.vizUtil.removeCharacteristicFromModel(i.model,n,r)}),$("select[data-entity=dist]").chosen().updateSelect()):$("select[data-entity=dist]").each(function(){var n=i.totalOptions[$(this).attr("data-id")];n&&$('option[data-entity=ch][data-istotal="true"][data-id="'+n.attr("data-id")+'"]',$(this)).length==0&&($(this).append(n.clone()),$(this).chosen().updateSelect())})}}),_.extend(n.MapSelectorsView.prototype,n.extensions.EmbedInitializationView)}(),function(n){"use strict";var t=nspace("kd.viz.component.selectors"),u=nspace("kd.events").EventNames.route.hydrate.name,f=nspace("kd.viz").UrlParams,i=0,r=0;t.PieSelectorsView=t.DefaultSelectorsView.extend({dialogEvents:{"multiselectclick select[data-entity=dist]":"characteristicClick","change select[data-entity=dist]":"distributionChange","change select:has([data-entity=dist])":"primaryDistributionChange","change input[data-entity=fmt]":"onDataFormatChange"},initializeSelectors:function(){var t=n("[data-entity=fmt][data-id="+this.model.get("fmt")+"]");this.updateTotalCharacteristics(t)},characteristicClick:function(n,t){this.isLastChecked=t.checked},distributionChange:function(t){var i=n("select:has([data-entity=dist])"),u=n(t.currentTarget).data("id"),f=i.find("option:selected").data("id")||i.find("option").first().data("id"),e=n(t.currentTarget).find("option:selected").map(function(){return n(this).data("id")}).toArray();i.length>0&&this.isLastChecked&&u!=f&&e.length>1&&(r<3&&(this.showMessage("By selecting more than one characteristic, you have changed the primary distribution. All other distributions will be reduced to a single characteristic."),r++),i.val(u),i.updateSelect())},primaryDistributionChange:function(){i<3&&(clearTimeout(this._timeout),this.showMessage("You have changed which distribution will be represented by wedges in the pie. Upon submit, the other distributions will be reduced to a single characteristic."),i++)},initializeViews:function(t){var h,r,e,i,o,s;n("select",n(this.el)).not("[multiple]").chosen({disable_search:!0}),n("select[multiple]").show().multiselect(),n(".chzn-drop",n(this.el)).css({width:"100%"}),_.bindAll(this,"updateViews","updateDistricts","getInitialRenderPromise","showMessage"),h=this,r=n.extend(!0,{},this.defaultDefaultStrategies,t.defaultStrategies||{});for(e in r)i=r[e],o=n(i.selector).length>0,o&&(s=i.Strategy,this.defaultStrategies.push(new s({selectEl:i.selector,propertyName:i.propertyName,model:this.model})));this.adapters=_.filter(t.adapters||[],function(n){return n.prop!==f.primaryDist}),this.setDefaults();n(this.el).on("change",".legislative-selector",this.updateDistricts);n(this.el).on("reset render",this.updateViews);this.model.bind(u,this.hydrateView,this),this.renderPromise.resolve()},handleSubmit:function(n){n.preventDefault(),this.ensureOneOptionSelected(n);var t=this.getModel(n,this.model);this.model.set(t),this.updateViews()},onDataFormatChange:function(t){this.updateTotalCharacteristics(n(t.currentTarget))},updateTotalCharacteristics:function(t){var u=t.closest("label").text(),i=t.closest("form.selectors").find("option[data-entity=ch]").filter(function(){return n(this).text().indexOf("Total")>-1}),r=i.closest("select");u.indexOf("Percent")>-1?(i.prop("selected",!1),i.prop("disabled",!0),r.multiselect().updateSelect()):(i.prop("disabled",!1),r.multiselect().updateSelect())}})}(jQuery),function(){"use strict";var n=window.nspace("kd.viz.component.selectors.embed"),t=window.nspace("kd.viz.component.selectors"),i=window.nspace("kd.viz").UrlParams;n.PieSelectorsView=t.PieSelectorsView.extend({events:{submit:"handleSubmitAndHideForm","keydown .chzn-search input":"handleKeydown"},initializeViews:function(n){_.bindAll(this,"initializeEmbedViews"),this.initializeEmbedViews(n),this.adapters=_.filter(n.adapters||[],function(n){return n.prop!==i.primaryDist})}}),_.extend(n.PieSelectorsView.prototype,n.extensions.EmbedSubmitHandlerView),_.extend(n.PieSelectorsView.prototype,n.extensions.EmbedInitializationView)}(),function(n){"use strict";var t=nspace("kd.viz.component.selectors");t.TableSelectorsView=t.DefaultSelectorsView.extend({dialogEvents:{"change select:has([data-entity=tf])":"onTimeFrameChange"},onTimeFrameChange:function(t){var i=n(t.currentTarget),r,u,f;if(i.find("option:selected").length>=10)return r=i.find("option[data-entity=tf]:not(:selected)").map(function(){return n(this).data("id")}).toArray(),u=n("select:has([data-entity=tf])").find("option[data-entity=tf]").filter(function(){return r.indexOf(n(this).data("id"))>-1?!0:!1}).prop("disabled",!0),u.length>0&&i.updateSelect(),this.showMessage("A maximum number of 10 years may be selected at one time."),i.multiselect("close"),!1;f=n("select:has([data-entity=tf])").find("option[data-entity=tf]:disabled").prop("disabled",!1),f.length>0&&i.updateSelect()},handleSubmit:function(n){n.preventDefault(),this.ensureOneOptionSelected(n);var t=this.getModel(n,this.model);this.model.set(t),this.updateViews()}})}(jQuery),function(){"use strict";var n=window.nspace("kd.viz.component.selectors.embed"),t=window.nspace("kd.viz.component.selectors");n.TableSelectorsView=t.TableSelectorsView.extend({events:{submit:"handleSubmitAndHideForm","keydown .chzn-search input":"handleKeydown"},initializeViews:function(n){_.bindAll(this,"initializeEmbedViews"),this.initializeEmbedViews(n)}}),_.extend(n.TableSelectorsView.prototype,n.extensions.EmbedSubmitHandlerView),_.extend(n.TableSelectorsView.prototype,n.extensions.EmbedInitializationView)}(),function(n){"use strict";var t=nspace("kd.viz.component.selectors"),i=nspace("kd.viz").UrlParams;t.TrendSelectorsView=t.DefaultSelectorsView.extend({dialogEvents:{"multiselectclick select[data-entity=dist]":"clickCharacteristic","change select[data-entity=dist]":"changeDistribution"},clickCharacteristic:function(t,i){var r=n(t.currentTarget),u=r.find("option:selected").length;return(this.isLastChecked=i.checked,u>10&&i.checked)?(alert("Only 10 characteristics may be selected at one time. Please deselect option(s) before choosing another."),r.find("option[data-id="+i.value+"]").prop("checked",!1),r.updateSelect(),t.preventDefault(),!1):!0},changeDistribution:function(t){var r,u,f,e,o,s;r=n(t.currentTarget),u=r.data("id"),f=r.find("option:selected").length,e=n(t.delegateTarget),o=e.find("select[data-entity='dist']"),s=this,f>1&&o.each(function(){var t,r,f,e;t=n(this),r=t.val(),f=t.data("id"),f!==u&&r&&r.length&&r.length>1&&(e=s.model.get(i.distribution)[f],e.length===1?t.val(e):t.val([t[0].options[0].value])),t.updateSelect()})},handleSubmit:function(n){n.preventDefault(),this.ensureOneOptionSelected(n);var t=this.getModel(n,this.model);t.tf&&(t[i.timeFrame]=this.validatedTimeFrames(t)),this.model.set(t),this.updateViews()},validatedTimeFrames:function(t){var i,r,u;return(i=n("#start")[0].options,_.each(i,function(n,i){+n.value==+t.tf[0]?r=i:+n.value==+t.tf[1]&&(u=i)}),r>u)?t.tf:[t.tf[1],t.tf[0]]},updateTotalCharacteristics:function(t,i){var r=this,u=t.closest("label").text();u.indexOf("Percent")>-1?(n('option[data-entity=ch][data-istotal="true"]').each(function(){var t=parseInt(n(this).closest("select").attr("data-id")),u=parseInt(n(this).val());n(this).remove(),i&&kd.viz.vizUtil.removeCharacteristicFromModel(r.model,t,u)}),n("select[data-entity=dist]").multiselect().updateSelect()):n("select[data-entity=dist]").each(function(){var t=r.totalOptions[n(this).attr("data-id")];t&&n('option[data-entity=ch][data-istotal="true"][data-id="'+t.attr("data-id")+'"]',n(this)).length==0&&(n(this).append(t.clone()),n(this).multiselect().updateSelect())})}})}(jQuery),function(){"use strict";var t,i,n;t=window.nspace("kd.viz.component.selectors.embed"),i=window.nspace("kd.viz.component.selectors"),n=window.nspace("kd.viz").UrlParams,t.TrendSelectorsView=i.TrendSelectorsView.extend({events:{submit:"handleSubmitAndHideForm","keydown .chzn-search input":"handleKeydown","multiselectclick select[data-entity=dist]":"clickCharacteristic","change select[data-entity=dist]":"changeDistribution"},initializeViews:function(n){_.bindAll(this,"initializeEmbedViews"),this.initializeEmbedViews(n)},handleSubmit:function(t){t.preventDefault(),this.ensureOneOptionSelected(t);var i=this.getModel(t,this.model);this.locationsHaveChanged()&&(i[n.location]=this.model.get(n.stagedLocations)),i.tf&&(i[n.timeFrame]=this.validatedTimeFrames(i)),this.model.set(i),this.updateViews()},locationsHaveChanged:function(){var t=this;return t.model.get(n.stagedLocations)?t.model.get(n.location).length!==t.model.get(n.stagedLocations).length?!0:_.any(t.model.get(n.location),function(i,r){return i!==t.model.get(n.stagedLocations)[r]})?!0:!1:!1}}),_.extend(t.TrendSelectorsView.prototype,t.extensions.EmbedInitializationView)}(),function(){"use strict";var n=window.nspace("kd.viz.component.selectors.portable");n.ChangeRelatedMapView=Backbone.View.extend({initialize:function(){var n=this;n.$el.chosen({disable_search:!0}).change(function(){window.location.href=n.$(":selected").attr("data-url")})}})}(),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.AllFirstsDefaultsStrategy=t.DefaultsStrategy.extend({setDefault:function(){var i=this.getProperty(),t;i||hasProperty(i)||(t={},n(this.selectEl).uniqueBy(function(t){return n(t).data("id")}).each(function(){t[n(this).data("id")]=n("option",n(this)).first().map(function(){return n(this).data("id")}).toArray()}),this.setProperty(t))}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.AllThenFirstsDefaultsStrategy=t.DefaultsStrategy.extend({setDefault:function(){var i=this.getProperty(),u=n(this.selectEl);if(!i&&!hasProperty(i)){var t={},r=u.uniqueBy(function(t){return n(t).data("id")}),f=r.first().filter(function(){return n(this).is("[multiple]")}).each(function(){t[n(this).data("id")]=n("option",n(this)).map(function(){return n(this).data("id")}).toArray()});r.not(f).each(function(){t[n(this).data("id")]=n("option",n(this)).first().map(function(){return n(this).data("id")}).toArray()}),this.setProperty(t)}}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.BarCharacteristicsDefaultsStrategy=t.DefaultsStrategy.extend({setDefault:function(){var i=this.getProperty(),u=n(this.selectEl);if(!i&&!hasProperty(i)){var t={},r=u.uniqueBy(function(t){return n(t).data("id")}),f=n("[data-entity=fmt][data-id="+this.model.get("fmt")+"]").closest("label").text()=="Percent",e=r.first().filter(function(){return n(this).is("[multiple]")}).each(function(){t[n(this).data("id")]=n("option",n(this)).filter(function(){return!f||n(this).text().indexOf("Total")==-1}).map(function(){return n(this).data("id")}).toArray()});r.not(e).each(function(){t[n(this).data("id")]=n("option",n(this)).first().map(function(){return n(this).data("id")}).toArray()}),this.setProperty(t)}}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.DefaultsGenericStrategy=t.DefaultsStrategy.extend({initialize:function(t){if(!t)throw"options are required.";if(!t.selectEl)throw"selectEl is required";if(!t.propertyName)throw"propertyName is required";if(!t.model)throw"model is required";var i=n(t.selectEl);this.selectEl=i,this.propertyName=t.propertyName,this.model=t.model}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies");t.FirstSingleRadioDefaultStrategy=t.DefaultsStrategy.extend({initialize:function(t){if(!t)throw"options are required.";if(!t.selectEl)throw"selectEl is required";if(!t.propertyName)throw"propertyName is required";if(!t.model)throw"model is required";var i=n(t.selectEl);if(i.length==0)throw"selectEl must include at least one element.";if(!i.is("input:radio"))throw"selectEl must be a select element.";this.selectEl=i,this.propertyName=t.propertyName,this.model=t.model},setDefault:function(){var i=this.getProperty(),t;i&&i.length!=0||(t=n(this.selectEl).first(),t.length>0&&this.setProperty([t.data("id")]))}})}(jQuery),function(n){"use strict";var i=window.nspace("kd.viz.component.selectors.strategies"),t=window.nspace("kd.viz").UrlParams;i.PrimaryDistributionHiddenDefaultStrategy=i.DefaultsGenericStrategy.extend({setDefault:function(){var i=this.getProperty(),r=n(this.selectEl),t;i||(t=[r.attr("data-pdist")],this.setProperty(t)),this.setAllPrimaryDistributionCharacteristics()},setAllPrimaryDistributionCharacteristics:function(){var r,i,u,f;r=this.model.get(t.primaryDist),i=this.model.get(t.distribution),u="select[data-entity="+t.distribution+"][data-id="+r[0]+"] option[data-entity="+t.characteristic+"]",f=n(u).map(function(){return+n(this).attr("data-id")}).get(),i&&(i[r[0]]=f),this.model.set(t.distribution,i)}})}(jQuery),function(n){"use strict";var t=nspace("kd.viz.component.selectors.strategies"),i=nspace("kd.viz");t.TimeRangeDefaultStrategy=t.DefaultsStrategy.extend({setDefault:function(){var t=n(this.selectEl).filter("#start").first(),r=n("option[data-entity="+i.UrlParams.timeFrame+"]",t).last(),u=r.val(),f=n(this.selectEl).filter("#end").first(),e=n("option[data-entity="+i.UrlParams.timeFrame+"]",f).first(),o=e.val();this.setProperty([u,o])}})}(jQuery)