{"version":3,"sources":["webpack:///./app/scripts/components/PureCanvas.tsx","webpack:///./app/scripts/components/CanvasLayer.tsx","webpack:///./app/scripts/components/MapText.tsx","webpack:///./app/scripts/components/Places.tsx","webpack:///./app/scripts/components/CartogramCountyLabels.tsx","webpack:///./app/scripts/components/SvgLayer.tsx","webpack:///./app/scripts/components/Tooltip.tsx","webpack:///./app/scripts/components/TooltipTable.tsx","webpack:///./app/scripts/utils/get-point.ts","webpack:///./app/scripts/components/LayeredMap.tsx","webpack:///./app/scripts/utils/clamp.js","webpack:///./app/scripts/utils/get-distance.js","webpack:///./node_modules/topojson-client/src/identity.js","webpack:///./node_modules/topojson-client/src/transform.js","webpack:///./node_modules/topojson-client/src/feature.js","webpack:///./node_modules/topojson-client/src/reverse.js","webpack:///./node_modules/@turf/helpers/dist/es/index.js","webpack:///./app/scripts/colors.ts","webpack:///./app/scripts/components/OtherCandidate.js","webpack:///./app/scripts/components/Contest.tsx","webpack:///./app/scripts/components/HeadshotCandidateRow.tsx","webpack:///./app/scripts/vendor/flatqueue.js","webpack:///./app/scripts/vendor/flatbush.js","webpack:///./app/scripts/utils/prepare-topojson.ts","webpack:///./node_modules/d3-geo/src/identity.js","webpack:///./app/scripts/utils/format-percent.ts","webpack:///./config/modern-polyfills.js","webpack:///./app/scripts/utils/load-asset-url.js","webpack:///./node_modules/d3-geo/src/math.js","webpack:///./app/scripts/kickstart.js","webpack:///./app/scripts/components/Portal.js","webpack:///./app/scripts/utils/platform.ts","webpack:///./app/scripts/components/NewContestShowcase.tsx","webpack:///./app/scripts/components/BalancePower.js","webpack:///./app/scripts/components/MiniBalancePower.js","webpack:///../../src/util.js","webpack:///../../src/index.js","webpack:///./app/scripts/utils/debounce.js","webpack:///./app/scripts/utils/noop.js","webpack:///./app/scripts/components/Typeahead.js","webpack:///./app/scripts/components/YourRaces.js","webpack:///./app/scripts/utils/legislative-districts.js","webpack:///./app/scripts/components/TinyMap.tsx","webpack:///./node_modules/d3-jetpack/src/translate-selection.js","webpack:///./node_modules/d3-jetpack/src/parseAttributes.js","webpack:///./node_modules/d3-jetpack/src/insert.js","webpack:///./node_modules/d3-jetpack/src/at.js","webpack:///./node_modules/d3-jetpack/src/st.js","webpack:///./node_modules/d3-jetpack/src/wordwrap.js","webpack:///./node_modules/d3-jetpack/index.js","webpack:///./node_modules/d3-jetpack/src/append.js","webpack:///./node_modules/d3-jetpack/src/parent.js","webpack:///./node_modules/d3-jetpack/src/selectAppend.js","webpack:///./node_modules/d3-jetpack/src/tspans.js","webpack:///./node_modules/d3-jetpack/src/appendMany.js","webpack:///./app/scripts/utils/format-numbers.js","webpack:///./app/scripts/components/MiniBarChart.js","webpack:///./app/scripts/components/AnalysisTableRow.tsx","webpack:///./app/scripts/components/AnalysisTable.tsx","webpack:///./app/scripts/components/Ad.js","webpack:///./app/scripts/photoMap.js","webpack:///./app/scripts/ResultsApp.tsx","webpack:///./app/scripts/packs/main.js","webpack:///./node_modules/d3-geo/src/path/bounds.js","webpack:///./node_modules/@turf/meta/dist/es/index.js","webpack:///./node_modules/@turf/bbox/dist/es/index.js","webpack:///./app/scripts/endpoints.ts","webpack:///./app/scripts/utils/load-json-script.js","webpack:///./app/scripts/utils/sum-values.js","webpack:///./node_modules/d3-geo/src/clip/rejoin.js","webpack:///./node_modules/d3-geo/src/pointEqual.js","webpack:///./node_modules/d3-geo/src/clip/rectangle.js","webpack:///./node_modules/d3-geo/src/clip/buffer.js","webpack:///./node_modules/d3-geo/node_modules/d3-array/src/merge.js","webpack:///./node_modules/d3-geo/src/clip/line.js","webpack:///./node_modules/d3-geo/src/transform.js","webpack:///./node_modules/d3-geo/src/projection/fit.js","webpack:///./node_modules/d3-geo/src/projection/identity.js","webpack:///./app/scripts/components/CandidateRow.tsx","webpack:///./app/scripts/utils/select-all.js","webpack:///./node_modules/@turf/bbox-polygon/dist/es/index.js","webpack:///./node_modules/d3-geo/src/noop.js","webpack:///./app/scripts/constants.ts","webpack:///./app/scripts/utils/select.js","webpack:///./app/scripts/packs/sticky-nav-bar.js","webpack:///./app/scripts/election-utils.ts","webpack:///./node_modules/@turf/boolean-point-in-polygon/dist/es/index.js","webpack:///./node_modules/@turf/invariant/dist/es/index.js","webpack:///./node_modules/d3-geo/src/stream.js","webpack:///./app/scripts/utils/get-json.js","webpack:///./node_modules/d3-geo/node_modules/d3-array/src/fsum.js","webpack:///./node_modules/d3-geo/src/path/area.js","webpack:///./node_modules/d3-geo/src/path/centroid.js","webpack:///./node_modules/d3-geo/src/path/context.js","webpack:///./node_modules/d3-geo/src/path/measure.js","webpack:///./node_modules/d3-geo/src/path/string.js","webpack:///./node_modules/d3-geo/src/path/index.js","webpack:///./app/scripts/utils/shallow-equal.ts","webpack:///./app/scripts/components/PureComponent.tsx","webpack:///./node_modules/@babel/runtime/helpers/esm/extends.js","webpack:///./app/scripts/utils/find.ts","webpack:///./app/scripts/components/PartyPill.tsx"],"names":["PureCanvas","Component","shouldComponentUpdate","render","style","this","props","ref","canvas","contextRef","getContext","defaultProps","CanvasLayer","PureComponent","constructor","super","setContextRef","bind","ctx","draw","geoPath","pixelRatio","scaleCanvas","width","height","window","devicePixelRatio","scale","updateCanvas","componentDidMount","d3GeoPath","projection","componentDidUpdate","position","top","left","zIndex","pieData","name","color","value","pieGen","pie","d","MapText","state","drawPieLegends","typeRace","pieSvgSize","Math","min","round","pieRadius","select","remove","pieG","attr","append","selectAll","data","entries","enter","arc","innerRadius","outerRadius","textG","text","sizeTextG","sizeText","border","elPaso","marverick","line","points","x","y","arrowGen","p","curve","curveBasis","prevProps","typeMap","candidates","includesNoResult","includesTie","class","backgroundColor","TIE","NEUTRAL","map","candidate","split","pop","trim","cx","party","slice","toLowerCase","Places","places","place","idx","key","transform","centroid","dx","properties","dy","text-anchor","anchor","CartogramCountyLabels","counties","county","coordinates","alignment-baseline","SvgLayer","handleMouseMove","handleMouseLeave","event","onMouseMove","onMouseLeave","setState","mapTranslateValue","strokeLinecap","strokeLinejoin","pointerEvents","viewBox","preserveAspectRatio","Tooltip","cls","isHidden","tooltipRef","klass","children","TooltipTable","sortedResults","array","order","candidatesMap","candidatesRender","source","totalVotes","candidateOrder","id","results","sort","a","b","A","B","indexOf","pct_votes","formatPercent","total_votes","DDHQestimatedvotes","contestMetricsClass","contest__metrics__canvass","isCanvass","pct_votes_turnout","firstThreeResults","county_pollinglocationsreporting","total_county_pollinglocations","CandidateRow","countyHeader","result","get","candColor","filter","cand","ballotName","candidateId","contestIsCalled","candidateColor","isIncumbent","is_incumbent","isWinner","is_winner","isMapRow","totalVotesInContest","votes","getPoint","node","rect","getBoundingClientRect","clientLeft","clientTop","cartogramPosition","colorOrder","countiesToShow","relocateTooltip","tooltip","n","max","innerWidth","innerHeight","LayeredMap","param","activeBtn","activeGeometry","candidatesOnMap","set","geos","rRange","rScale","activePieCounty","onDocumentTouch","getTooltipRef","canvasRenderer","xScale","scaleLinear","yScale","el","setUpCountyMap","countyMap","fips","setUpCandidateMap","candidateMap","clientX","clientY","target","point","coords","invert","collection","index","found","search","i","features","find","feature","booleanPointInPolygon","activeCounty","forEach","x1","y1","x2","y2","sqrt","getDistance","center","radius","push","undefined","e","base","contains","drawBaseMap","strokeColor","beginPath","fillStyle","colors","fill","lineCap","lineJoin","strokeStyle","lineWidth","stroke","closePath","drawRoadsLayer","roads","level","drawPlacesLayer","places_mappable","PI","drawUrbanAreasLayer","urban_areas","embedType","clearRect","translate","lean","leader","second","leadingId","add","toFixed","recal_x","recal_y","r","votesLeft","currentAngle","portionAngle","lineTo","componentWillReceiveProps","nextProps","getContainerDimensions","offsetWidth","rawWidth","floor","clientWidth","topology","prepareTopoJSON","bbox","heightRatio","rawHeight","mapWidth","mapHeight","fitSize","bboxPolygon","domain","range","all_Leader_sizes","extent","scaleSqrt","elPasoCoordinates","maverick","maverickCoordinates","document","addEventListener","precinctsReporting","boxSizing","stroke-width","cy","totalPrecincts","mapType","invisible","Boolean","has","length","showBubbleMap","className","onClick","handleClick","identity","x0","y0","kx","ky","input","j","output","Array","o","objects","type","geometries","geometry","object","transformPoint","arcs","k","t","reverse","ring","polygon","geom","options","feat","Error","isArray","isNumber","_i","coordinates_1","lineString","num","isNaN","isObject","Object","GOVERNOR","lean_color","rgbaColor","AG","REPUBLICAN","DEMOCRAT","OtherCandidate","isViewable","candidateCount","classes","xlinkHref","Contest","viewAllCandidates","onViewableToggle","prevState","contest","columnCount","contestTitle","isShowcaseRace","renderCandidate","partyName","annotations","notes","tableHeader","isHomepage","asOf","converter","PreactHTMLConverter","shouldDisplayResult","contest_result","CandidatesShown","visibleCandidatesCount","uncontested","candidacies","uncontestedNoHouse","office","sumValues","sort_candidates_by_party","pct_votes_turnout_w_uncontested","text_conditionals","pct_votes_explain","ManualoverrideSource","showcaseClass","seat__races","seat__highlight_races","rowClass","klaxon","alert_winners","alert_conditionals","checkClass","homepage__metrics","precinctsClass","IsAnnotations","IsNoted","intcomma","pollinglocationsreporting","total_pollinglocations","pollinglocations_reporting_percent","convert","aria-hidden","includeCountyRundown","HeadshotCandidateRow","getColor","contestResult","candidateColors","divStyle","obj","checkStyle","IsAsterisk","title","isCalled","Header","colSpan","FlatQueue","ids","values","clear","pos","parent","parentValue","halfLength","right","bestIndex","bestValue","rightValue","peek","peekValue","ARRAY_TYPES","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","Flatbush","ArrayBuffer","magic","versionAndType","nodeSize","numItems","ArrayType","numNodes","_levelBounds","ceil","IndexArrayType","arrayTypeIndex","nodesByteSize","BYTES_PER_ELEMENT","_boxes","_indices","_pos","minX","minY","maxX","maxY","Infinity","_queue","finish","hilbertValues","hilbert","boxes","indices","pivot","swap","end","nodeMinX","nodeMinY","nodeMaxX","nodeMaxY","nodeIndex","filterFn","queue","neighbors","maxResults","maxDistance","q","maxDistSquared","upperBound","axisDist","dist","arr","m","temp","c","C","D","i0","i1","keys","roadsObject","placesObject","urbanAreasObject","getBBox","bounds","require","loadAssetURL","elementId","element","getElementById","getAttribute","JSON","parse","textContent","asset_url","epsilon","pi","tau","degrees","radians","abs","cos","atan","atan2","sin","exp","hypot","log","pow","sign","tan","ttData","relatedContentContainer","related_category","then","default","RelatedContent","AdLoader","delay","init","anchorJumps","setUpAnchors","Portal","renderPortal","componentWillUnmount","defaultNode","body","removeChild","portal","createElement","appendChild","userAgent","navigator","isIE","test","ContestShowcase","geoIdentity","reflectY","container","contestContainer","querySelector","mapContainer","countiesContainer","sourceMap","firstShowcaseRace","_contestPortal","determineContestTitle","is_called","_mapPortal","precincts_reporting","BalancePower","bodyWidth","breakPoint","createGraphic","redrawGraphic","getContainerWidth","pastData","currentData","prevdata","start","republican","democrat","seats","currentElection","uncontested_republican","vacant","startText","uncontested_democrat","d3","margin","svg","svgCurrent","diagonalStripePattern","g","gCurrent","total","xCurrent","textWidth","textWidthUncontested","currentText","TextUncontested","textSelection","textSelection2","getComputedTextLength","halfway","chamber","chamberText","MiniBalancePower","prepareData","upForGrabs","partisanBreakdown","totalSeats","getScroll","w","ret","method","documentElement","getScrollLeft","getScrollTop","getOffset","elem","box","doc","ownerDocument","docElem","getClientPosition","defaultView","parentWindow","getComputedStyleX","_RE_NUM_NO_PX","RegExp","RE_POS","LEFT","each","fn","isBorderBoxFn","getComputedStyle","computedStyle_","val","computedStyle","getPropertyValue","rsLeft","pixelLeft","BOX_MODELS","callback","old","hasOwnProperty","call","getPBMWidth","which","prop","cssProp","parseFloat","isWindow","domUtils","getWH","extra","viewportWidth","viewportHeight","nodeType","docWidth","docHeight","borderBoxValue","offsetHeight","isBorderBox","cssBoxValue","Number","borderBoxValueOrIsBorderBox","padding","refWin","win","documentElementProp","compatMode","cssShow","visibility","display","getWHIgnoreDisplay","args","arguments","apply","css","v","_typeof","first","charAt","toUpperCase","includeMargin","getWindow","offset","current","setOffset","clone","overflow","scrollLeft","scrollTo","scrollTop","config","util","allowHorizontalScroll","onlyScrollIfNeeded","alignWithTop","alignWithLeft","offsetTop","offsetLeft","offsetBottom","offsetRight","containerOffset","ch","cw","containerScroll","diffTop","diffBottom","winScroll","ww","wh","isWin","elemOffset","eh","outerHeight","ew","outerWidth","clientHeight","debounce","func","wait","immediate","timeout","context","timestamp","later","last","Date","now","setTimeout","callNow","Typeahead","highlightedIndex","isOpen","handleOnBlur","handleOnClear","handleOnFocus","handleOnInput","debouncedHandleOnInput","debounceDuration","handleKeyDown","setInputRef","setMenuRef","setItemRef","listRefs","_","count","getFilteredItems","maybeScrollItemIntoView","inputRef","menuRef","itemNode","menuNode","scrollIntoView","items","shouldItemRender","sortItems","item","highlightItemOnMouseEnter","selectItemOnClick","getItemValue","onSelect","blur","renderList","onMouseDown","preventDefault","cloneElement","renderItem","onMouseEnter","renderAttribution","onClear","onBlur","inputProps","onFocus","onChange","keyEvents","renderInput","role","String","autocomplete","onInput","onKeyDown","aria-label","noop","ArrowDown","itemsCount","newIndex","ArrowUp","Enter","keyCode","setSelectionRange","Escape","googleIMG","sessionToken","google","maps","AutocompleteSessionToken","autocompleteService","AutocompleteService","east","west","south","north","componentRestrictions","country","types","YourRaces","contests","lookupError","lookupPending","lookedFoundStored","handleGeocode","debouncedHandleGeocode","Promise","resolve","reject","getPlacePredictions","predict","status","getPredictions","catch","placeId","placesService","getDetails","fields","lat","latitude","lng","longitude","location","toJSON","getJSON","includeGeography","LOOKUP_URL","lookup","PlacesService","gridClass","addressFeedback","matches","sboe","noteMatches","annoMatches","arrayNum","getElementsByClassName","innerHTML","office_division","us_house","district","tx_senate","tx_house","for","placeholder","description","place_id","isHighlighted","src","alt","_resultsPortal","office_slug","determineContestTitleYourRaces","annotation","note","contestOffice","candidatesNum","TinyMap","createMap","redrawMap","findLeading","category","pathGenerator","foundCounty","countiesData","xy","dim","parts","shift","tag","constantNull","camelCaseAttrs","replace","addStyle","sel","wrapPx","addPx","match","CHAR_W","E","F","f","G","H","h","I","J","K","L","l","M","N","O","P","Q","R","S","s","T","U","u","V","W","X","Y","Z","z","selection","prototype","translateSelection","transition","create","parseAttributes","creator","insert","before","selector","insertBefore","parents","parentNode","selectAppend","tspans","lines","lh","appendMany","console","warn","at","st","property","customNumFormat","intword","MiniBarChart","categoryNumbers","officeSlug","maxNum","showPrecinctsReporting","newcand","last_name","join","category_votes","localeCompare","entry","bandwidth","ticks","tickFormat","tickSize","maxCharactersPerLine","minCharactersPerLine","monospace","w1","maxChars","minChars","maxLineW","minLineW","words","w2","lw","sum","char_w","wordwrap","nodes","foundCandidate","customBarNumFormat","AnalysisTableRow","categoryClass","category_text","geocategories","category_explain","geocategories_explain","AnalysisTable","criteria","newObj","summedEntries","arrayByCategories","reduce","acc","currentValue","totals","arrayToGetMost","votes_still_to_count","estimated_votes","largest_number","createArray","findCounties","findCounties2","arrayCounties","parseInt","objectCategories","arrayToGetLargest","sumofVotesLeftToCount","categories_headline","categories","data-note","categories_notes","Ad","href","buildURL","path","process","App","timer","fetchData","info","lastUpdatedFormat","RESULTS_IN_USE","startTimer","LENGTH_OF_CHECK_INTERVAL","clearTimer","clearTimeout","texasHouseGroups","usHouseGroups","texasHouse","usHouse","chunk","pastPowerBalance","analysisData","_yourPortal","dd_winner_rep","dd_winner_dem","_usPortal","total_current","NewContestShowcase","showCategoriesMap","contestGroup","_supremePortal","_sboePortal","_senatePortal","_housePortal","loadJsonScript","boundsStream","lineStart","lineEnd","polygonStart","polygonEnd","coordEach","geojson","excludeWrapCoord","stopG","geometryMaybeCollection","isGeometryCollection","wrapShrink","coordIndex","isFeatureCollection","isFeature","stop","featureIndex","geomIndex","multiFeatureIndex","geometryIndex","geomType","coord","HOMEPAGE_URL","STORY_API_URL","Intersection","other","segments","compareIntersection","startInside","interpolate","stream","subject","clip","segment","p0","p1","link","isSubject","clipRectangle","visible","from","to","direction","a1","corner","comparePoint","ca","cb","x__","y__","v__","x_","y_","v_","clean","activeStream","bufferStream","rejoin","concat","clipStream","linePoint","NaN","winding","a0","b0","b1","polygonInside","cleanInside","arrays","flatten","clipRejoin","ax","ay","t0","t1","clipLine","transformer","methods","TransformStream","sphere","fit","fitBounds","clipExtent","geoStream","fitExtent","sa","cache","cacheStream","tx","ty","sx","sy","alpha","postclip","reset","angle","reflectX","size","fitWidth","fitHeight","Node","Window","querySelectorAll","lowLeft","topLeft","topRight","lowRight","appNav","appNavHeight","appNavJumps","allJumps","pageYOffset","journalize","apdate","formatted_time","aptime","apmonth","getDate","ms","PARTY_SORT_ORDER","vote_pct","cand_num","label_conditionals","winner_conditionals","determineDistrictTitle","division_type","capfirst","pt","getCoord","polys","inBBox","insidePoly","inRing","ignoreBoundary","inHole","isInside","xi","yi","xj","yj","streamGeometry","streamGeometryType","streamObjectType","Feature","FeatureCollection","Sphere","Point","MultiPoint","LineString","streamLine","MultiLineString","Polygon","streamPolygon","MultiPolygon","GeometryCollection","closed","coordinate","jsonResponse","res","ok","statusText","json","fetch","Adder","_partials","_n","hi","lo","valueOf","x00","y00","areaSum","areaRingSum","areaStream","areaRingStart","areaRingEnd","area","areaPointFirst","areaPoint","X0","Y0","Z0","X1","Y1","Z1","X2","Y2","Z2","centroidStream","centroidPoint","centroidLineStart","centroidLineEnd","centroidRingStart","centroidRingEnd","centroidPointFirstLine","centroidPointLine","centroidPointFirstRing","centroidPointRing","PathContext","_context","_radius","pointRadius","_line","_point","moveTo","lengthRing","lengthSum","lengthStream","lengthPointFirst","lengthPoint","PathString","_string","circle","_circle","projectionStream","contextStream","pathArea","measure","pathMeasure","pathBounds","pathCentroid","hOP","is","shallowEqual","objA","objB","keysA","keysB","_extends","assign","predicate","TypeError","PartyPill","excludeInitial","partyPrefix","partyInitial","memoize"],"mappings":"+OAUA,MAAMA,UAAmBC,YACvBC,wBACE,OAAO,EAGTC,SACE,OACE,sBACEC,MAAOC,KAAKC,MAAMF,MAClBG,IAAKC,GACHA,EAASH,KAAKC,MAAMG,WAAWD,EAAOE,WAAW,MAAOF,GAAU,QAO5ER,EAAWW,aAAe,CACxBP,MAAO,IAGMJ,QCRf,MAAMY,UAAoBC,IAMxBC,cACEC,QADY,0IAGZV,KAAKW,cAAgBX,KAAKW,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C1D,IAAK,IAAIQ,EAAI,EAAGA,EAAI6c,UAAUlX,OAAQ3F,IAAK,CACzC,IAAIvF,EAASoiB,UAAU7c,GAEvB,IAAK,IAAI7H,KAAOsC,EACVyN,OAAO4jB,UAAUjR,eAAeC,KAAKrgB,EAAQtC,KAC/CqH,EAAOrH,GAAOsC,EAAOtC,IAK3B,OAAOqH,IAEOsd,MAAM5qB,KAAM2qB,WAd9B,mC,kCCSe,SAAS3c,EACtBgR,EACA4wB,GAEA,GAAyB,mBAAdA,EACT,MAAM,IAAIC,UAAU,gCAGtB,IAAK,IAAI/hC,EAAI,EAAGA,EAAIkR,EAAIvL,OAAQ3F,IAC9B,GAAI8hC,EAAU5wB,EAAIlR,GAAIA,EAAGkR,GACvB,OAAOA,EAAIlR,GAnBjB,mC,kCCAA,sEAYA,SAASgiC,EAAT,GAA4D,IAAzC,eAAEC,EAAF,MAAkBrqC,EAAlB,MAAyB3F,GAAgB,EACpDiwC,EAActqC,EAAMC,MAAM,EAAG,GAAGC,cAChCqqC,EAAevqC,EAAM,GAAGwlB,cAExBxU,EAAUjR,IAAG,cAAD,gBAAyBuqC,IAE3C,OACE,oBAAMhrC,MAAO0R,EAAS3W,MAAOA,EAAOua,MAAO8uB,mBAAS1jC,KAChDqqC,GAAkBE,GAK1BH,EAAUxvC,aAAe,CACvByvC,gBAAgB,GAGHG,QAAQJ,EAAW,QAAC,MAAEpqC,EAAF,MAAS3F,GAAV,QAAuB,CACvD2F,MAAOA,EACP3F,MAAOA,O","file":"main.d50504394a.mjs","sourcesContent":["import { Component, h } from 'preact';\n\ninterface Props {\n  style?: any;\n  contextRef: (\n    context: CanvasRenderingContext2D,\n    canvas: HTMLCanvasElement\n  ) => void;\n}\n\nclass PureCanvas extends Component<Props> {\n  shouldComponentUpdate() {\n    return false;\n  }\n\n  render() {\n    return (\n      <canvas\n        style={this.props.style}\n        ref={canvas =>\n          canvas ? this.props.contextRef(canvas.getContext('2d'), canvas) : null\n        }\n      />\n    );\n  }\n}\n\nPureCanvas.defaultProps = {\n  style: {},\n};\n\nexport default PureCanvas;\n","import {\n  geoPath as d3GeoPath,\n  GeoPath,\n  GeoProjection,\n  GeoIdentityTransform,\n} from 'd3-geo';\nimport { h } from 'preact';\n\nimport PureComponent from './PureComponent';\nimport PureCanvas from './PureCanvas';\n\nexport interface CanvasLayerProps {\n  projection: GeoProjection | GeoIdentityTransform;\n  width: number;\n  height: number;\n  typeMap: string;\n  render: (\n    ctx: CanvasRenderingContext2D,\n    geoPath: GeoPath,\n    pixelRatio: number\n  ) => void;\n}\n\nclass CanvasLayer extends PureComponent<CanvasLayerProps> {\n  ctx!: CanvasRenderingContext2D;\n  canvas!: HTMLCanvasElement;\n  geoPath!: GeoPath;\n  pixelRatio!: number;\n\n  constructor() {\n    super();\n\n    this.setContextRef = this.setContextRef.bind(this);\n  }\n\n  setContextRef(ctx: CanvasRenderingContext2D, canvas: HTMLCanvasElement) {\n    this.ctx = ctx;\n    this.canvas = canvas;\n  }\n\n  draw() {\n    const ctx = this.ctx;\n    const geoPath = this.geoPath;\n    const pixelRatio = this.pixelRatio;\n    const { render } = this.props;\n\n    render(ctx, geoPath, pixelRatio);\n  }\n\n  scaleCanvas(\n    canvas: HTMLCanvasElement,\n    ctx: CanvasRenderingContext2D,\n    width: number,\n    height: number\n  ) {\n    const pixelRatio = window.devicePixelRatio || 1;\n    this.pixelRatio = pixelRatio;\n\n    canvas.width = width * pixelRatio;\n    canvas.height = height * pixelRatio;\n\n    canvas.style.width = `${width}px`;\n    canvas.style.height = `${height}px`;\n\n    ctx.scale(pixelRatio, pixelRatio);\n  }\n\n  updateCanvas() {\n    this.scaleCanvas(\n      this.canvas,\n      this.ctx,\n      this.props.width,\n      this.props.height\n    );\n    this.draw();\n  }\n\n  componentDidMount() {\n    // we cannot set up our geoPath until we have a context\n    this.geoPath = d3GeoPath(this.props.projection, this.ctx);\n\n    this.updateCanvas();\n  }\n\n  componentDidUpdate() {\n    this.updateCanvas();\n  }\n\n  render() {\n    return (\n      <PureCanvas\n        style={{ position: 'absolute', top: 0, left: 0, zIndex: 1 }}\n        contextRef={this.setContextRef}\n      />\n    );\n  }\n}\n\nexport default CanvasLayer;\n","import cx from 'classnames';\nimport { Component, h } from 'preact';\nimport { select, selectAll, pie, entries, arc, line, curveBasis } from 'd3'\n\nimport context from 'Data/text.json';\n\nimport { DEMOCRAT, NEUTRAL, REPUBLICAN, TIE } from '../colors';\n\nconst svgPadding = 4;\nconst pieData = [\n  {name: \"R\", color: \"#EF564A\", value: 50},\n  // {name: \"not voted\", color: \"#bdbdbd\", value: 33},\n  {name: \"D\", color: \"#1755c5\", value: 50},\n];\nconst pieGen = pie()\n  .value(d => d.value.value);\n\nclass MapText extends Component {\n  // ({ typeMap, candidates, includesNoResult, includesTie, rScale })\n  constructor() {\n    super();\n    this.state = {\n    }\n  }\n\n  drawPieLegends(props) {\n    // types\n    const typeRace = props.typeRace;\n\n    // pie legend\n    const pieSvgSize = Math.min(Math.round((50 / 620 * props.width) * 2), 40);\n    const pieRadius = pieSvgSize / 2;\n\n    select(`#${typeRace}`).select('.below-map').select('.pie-g').remove();\n    const pieSvg = select(`#${typeRace}`)\n      .select('.breakdown-legend-item')\n      .select('svg')\n      .attr('width', pieSvgSize)\n      .attr('height', pieSvgSize)\n    const pieG = pieSvg.append('g')\n      .attr('class', 'pie-g')\n    pieG.append('g')\n      .attr('class', 'paths')\n      .attr('transform', `translate(${pieSvgSize / 2}, ${pieSvgSize / 2})`)\n      .selectAll('path')\n      .data(pieGen(entries(pieData)))\n      .enter()\n      .append('path')\n      .attr('d', arc()\n        .innerRadius(0)\n        .outerRadius(pieRadius)\n      )\n      .attr('fill', d => d.data.value.color)\n    // R and D text\n    const textG = pieG.append('g')\n      .attr('class', 'pie-text')\n      .attr('text-anchor', 'middle')\n      .style('font-weight', 'bold')\n      .attr('fill', 'white')\n    textG.append('text')\n      .attr('transform', `translate(${pieSvgSize / 4}, ${pieSvgSize / 2 + 3})`)\n      .text('D')\n    textG.append('text')\n      .attr('transform', `translate(${pieSvgSize * 3 / 4}, ${pieSvgSize / 2 + 3})`)\n      .text('R')\n\n    // size legend\n    select(`#${typeRace}`).select('.below-map').select('.text-g').remove();\n    const sizeSvg = select(`#${typeRace}`)\n      .select('.breakdown-annotation')\n      .select('svg')\n      .attr('width', props.width)\n      .attr('height', props.height)\n    const sizeTextG = sizeSvg.append('g')\n      .attr('class', 'text-g')\n    const sizeText = sizeTextG.append('text')\n      .attr('transform', `translate(${props.border.elPaso[0] + 20}, ${props.border.marverick[1] + 20})`)\n      .attr('text-anchor', 'start')\n      .attr('fill', '#333333')\n    sizeText.append('tspan')\n      .attr('x', 0)\n      .attr('dy', 0)\n      .text('Circles are sized')\n    sizeText.append('tspan')\n      .attr('x', 0)\n      .attr('dy', 12)\n      .text('by voter turnout')\n    sizeText.append('tspan')\n      .attr('x', 0)\n      .attr('dy', 12)\n      .text('in each county')\n\n    // arrow\n    // arrow defs\n    const arrowPoints = [[0, 0], [0, 5], [5, 2.5]];\n    sizeTextG.append('defs')\n      .append('marker')\n      .attr('id', 'arrow')\n      .attr('viewBox', [0, 0, 20, 15])\n      .attr('refX', 0)\n      .attr('refY', 2.5)\n      .attr('markerWidth', 20)\n      .attr('markerHeight', 15)\n      .attr('orient', 'auto-start-reverse')\n      .append('path')\n      .attr('d', line()(arrowPoints))\n      .attr('stroke', '#333333')\n      .attr('fill', '#333333');\n\n    const points = [\n      {x: -5, y: 0},\n      {x: props.width > 500 ? -30 : -25, y: -(props.border.marverick[1] - props.border.elPaso[1] - 30) / 2},\n      {x: -20, y: -(props.border.marverick[1] - props.border.elPaso[1] - 30)},\n    ]\n    const arrowGen = line()\n      .x(p => p.x)\n      .y(p => p.y)\n      .curve(curveBasis)\n    const arrowG = sizeTextG.append('g')\n      .attr('class', 'arrow')\n      .attr('transform', `translate(${props.border.elPaso[0] + 20}, ${props.border.marverick[1]})`)\n      .append('path')\n      .attr('d', arrowGen(points))\n      .attr('fill', 'none')\n      .attr('stroke', '#333333')\n      .attr('stroke-width', 1)\n      .attr('marker-end', 'url(#arrow)')\n    \n  }\n\n  componentDidUpdate(prevProps) {\n    const {\n      typeMap\n    } = this.props;\n\n    if (prevProps != this.props) {\n      if(typeMap == 'breakdown') {\n        this.drawPieLegends(this.props)\n      }\n    }\n  }\n\n  render() {\n    const {\n      typeMap,\n      candidates,\n      includesNoResult,\n      includesTie,\n    } = this.props;\n\n\n    return (\n      <div>\n        {typeMap == 'categorical' && (\n          <div class=\"results-map__text\">\n            <div class=\"results-map__legend\">\n              <table>\n              {includesTie && (\n              <div class=\"results-map__legend-item\">\n                <span class=\"circle-pill\" style={{ backgroundColor: TIE }} />{' '}\n                <p class=\"results-map__legend-label\">Tied</p>\n              </div>\n              )}\n              {includesNoResult && (\n              <div class=\"results-map__legend-item\">\n                <span class=\"circle-pill\" style={{ backgroundColor: NEUTRAL }} />{' '}\n                <p class=\"results-map__legend-label\">No votes</p>\n              </div>\n              )}\n        \n              {/* <div class=\"results-map__legend-item\">\n                <span class=\"circle-pill\" style={{ backgroundColor: TIE }} />{' '}\n                <p class=\"results-map__legend-label\">Tied</p>\n              </div>\n              <div class=\"results-map__legend-item\">\n                <span class=\"circle-pill\" style={{ backgroundColor: NEUTRAL }} />{' '}\n                <p class=\"results-map__legend-label\">No votes</p>\n              </div> */}\n      \n              {candidates.map(candidate => {\n              return (\n                  <tr class='results-map__legend-item'>\n                  <td>{candidate.name.split(' ')\n                    .pop()\n                    .trim()}</td>\n                 <td>\n                  <span\n                    class={cx(\n                      'circle-pill',\n                      `pill--${candidate.party.slice(0, 3).toLowerCase()}-lean`\n                    )}\n                  />\n                  <span class='legend-item-text'>{'< 10%'}</span>\n                  </td>\n                  <td>  <span\n                    class={cx(\n                      'circle-pill',\n                      `pill--${candidate.party.slice(0, 3).toLowerCase()}`\n                    )}\n                  />\n\n<span class='legend-item-text'>{'> 10%'}</span>\n                  </td>\n                  </tr>\n          \n              );\n            })}\n              {/* <span\n                    class={cx(\n                      'circle-pill',\n                      `pill--${candidate.party.slice(0, 3).toLowerCase()}-lean`\n                    )}\n                  />{' '}\n                  <p class=\"results-map__legend-label\">\n                    {candidate.name.split(' ')\n                    .pop()\n                    .trim()} by less than 10%\n                  </p> */}\n            </table>\n            </div>\n          </div>\n        )}\n        {typeMap == 'breakdown' && (\n          <div>\n            <div class=\"results-map__text breakdown-text\">\n              <div class=\"results-map__legend breakdown-legend\">\n                <div class=\"breakdown-legend-item\">\n                  <div class=\"breakdown-legend-title\">Share of votes for:</div>\n                  <svg></svg>\n                  {/* <div class=\"breakdown-legend-annotation\">Estimated votes<br />left to count</div> */}\n                </div>\n              </div>\n            </div>\n            <div class=\"breakdown-annotation\">\n              <svg></svg>\n            </div>\n          </div>\n        )}\n      </div>\n    );\n  } \n}\n\nexport default MapText;\n","import { h } from 'preact';\nimport { GeoPath } from 'd3';\nimport PureComponent from './PureComponent';\nimport { Feature } from 'geojson';\n\nclass Places extends PureComponent<{ geoPath: GeoPath; places: Feature[] }> {\n  render() {\n    const { geoPath, places } = this.props;\n\n    return (\n      <g class=\"places\">\n        <g class=\"place-background-labels\">\n          {places.map((place, idx) => (\n            <text\n              key={`bg-${idx}`}\n              class=\"place-background-label\"\n              transform={`translate(${geoPath.centroid(place)})`}\n              dx={place.properties.dx}\n              dy={place.properties.dy}\n              text-anchor={place.properties.anchor}\n            >\n              {place.properties.name}\n            </text>\n          ))}\n        </g>\n        <g class=\"place-labels\">\n          {places.map((place, idx) => (\n            <text\n              key={`fg-${idx}`}\n              class=\"place-label\"\n              transform={`translate(${geoPath.centroid(place)})`}\n              dx={place.properties.dx}\n              dy={place.properties.dy}\n              text-anchor={place.properties.anchor}\n            >\n              {place.properties.name}\n            </text>\n          ))}\n        </g>\n      </g>\n    );\n  }\n}\n\nexport default Places;\n","import { h } from 'preact';\nimport { GeoProjection } from 'd3';\nimport PureComponent from './PureComponent';\nimport { Feature } from 'geojson';\n\nclass CartogramCountyLabels extends PureComponent<{ projection: GeoProjection; counties: [] }> {\n  render() {\n    const { projection, counties } = this.props;\n\n    return (\n      <g class=\"places\">\n        <g class=\"places-background-labels\">\n          {counties.map((county, idx) => (\n            <text\n              key={`bg-${idx}`}\n              class=\"place-background-label\"\n              transform={`translate(${projection(county.coordinates)})`}\n              dx='0'\n              dy='0'\n              text-anchor='middle'\n              alignment-baseline=\"middle\"\n            >\n              {county.name}\n            </text>\n          ))}\n        </g>\n        <g class=\"place-labels\">\n          {counties.map((county, idx) => (\n            <text\n              key={`fg-${idx}`}\n              class=\"place-label\"\n              transform={`translate(${projection(county.coordinates)})`}\n              dx='0'\n              dy='0'\n              text-anchor='middle'\n              alignment-baseline=\"middle\"\n            >\n              {county.name}\n            </text>\n          ))}\n        </g>\n      </g>\n    );\n  }\n}\n\nexport default CartogramCountyLabels;\n","import {\n  geoPath as d3GeoPath,\n  GeoPath,\n  GeoIdentityTransform,\n  GeoProjection,\n} from 'd3-geo';\nimport { Component, h, VNode } from 'preact';\n\nimport PureComponent from './PureComponent';\n\nexport interface SvgLayerProps {\n  projection: GeoProjection | GeoIdentityTransform;\n  width: number;\n  height: number;\n  render: (state: SvgLayerState) => VNode | null;\n  onMouseMove?: (event: MouseEvent) => void;\n  onMouseLeave?: (event: MouseEvent) => void;\n}\n\ninterface SvgLayerState {\n  geoPath: GeoPath;\n}\n\nclass SvgLayer extends PureComponent<SvgLayerProps, SvgLayerState> {\n  constructor() {\n    super();\n\n    this.handleMouseMove = this.handleMouseMove.bind(this);\n    this.handleMouseLeave = this.handleMouseLeave.bind(this);\n  }\n\n  handleMouseMove(event: MouseEvent) {\n    const { onMouseMove } = this.props;\n\n    if (onMouseMove) {\n      onMouseMove(event);\n    } else {\n      return;\n    }\n  }\n\n  handleMouseLeave(event: MouseEvent) {\n    const { onMouseLeave } = this.props;\n\n    if (onMouseLeave) {\n      onMouseLeave(event);\n    }\n  }\n\n  componentDidMount() {\n    const geoPath = d3GeoPath(this.props.projection);\n\n    this.setState({ geoPath });\n  }\n\n  render() {\n    const { width, height, mapTranslateValue } = this.props;\n\n    return (\n      <svg\n        width={width}\n        height={height}\n        style={{\n          position: 'relative',\n          top: 0,\n          left: 0,\n          zIndex: 2,\n          strokeLinecap: 'round',\n          strokeLinejoin: 'round',\n          pointerEvents: 'none',\n        }}\n        viewBox={`0 0 ${width} ${height}`}\n        preserveAspectRatio=\"xMidYMid\"\n        onMouseMove={this.handleMouseMove}\n        onMouseLeave={this.handleMouseLeave}\n      >\n        <g\n          transform={`translate(${mapTranslateValue}, 0)`}\n        >{this.props.render(this.state)}</g>\n      </svg>\n    );\n  }\n}\n\nexport default SvgLayer;\n","import cx from 'classnames';\nimport { h } from 'preact';\n\nimport Portal from './Portal';\n\ninterface Props {\n  class: string;\n  tooltipRef(any): void;\n  style?: { [key: string]: string };\n  isHidden?: boolean;\n}\n\nfunction Tooltip({ class: cls, style, isHidden, tooltipRef }: Props) {\n  const klass = cx(cls, { 'display-none': isHidden });\n\n  return (\n    // <Portal>\n      <div class={klass} style={style} ref={tooltipRef}>\n        {this.props.children}\n      </div>\n    // </Portal>\n  );\n}\n\nTooltip.defaultProps = {\n  class: 'tooltip',\n  isHidden: false,\n};\n\nexport default Tooltip;\n","// packages\nimport { entries } from 'd3-collection';\nimport cx from 'classnames';\nimport { h } from 'preact';\nimport { isCanvass, DDHQestimatedvotes } from '../endpoints';\n\n// components\nimport CandidateRow from './CandidateRow';\nimport PureComponent from './PureComponent';\n\n// internal\nimport formatPercent from '../utils/format-percent';\n\n// function to sort candidates in tooltip based on candidate ID from CandidatesRender which already in party order\nfunction mapOrder(array, order, key) {\n  array.sort(function(a, b) {\n    var A = a[key],\n      B = b[key];\n\n    if (order.indexOf(A) > order.indexOf(B)) {\n      return 1;\n    } else {\n      return -1;\n    }\n  });\n  return array;\n}\n\nclass TooltipTable extends PureComponent<any> {\n  render() {\n    const {\n      candidatesMap,\n      county,\n      candidatesRender,\n      source,\n      totalVotes,\n    } = this.props;\n\n    // const sortedResults =  entries(county.results).sort(\n    //   (a, b) => b.value - a.value\n    // );\n\n    // If there are no votes, order them through party order using CandidatesRender, else order them by the most amount of\n\n    const candidateOrder = candidatesRender.map(x => x.id);\n\n    let sortedResults;\n\n    if (totalVotes > 0) {\n      sortedResults = entries(county.results).sort((a, b) => b.value - a.value);\n    } else {\n      sortedResults = mapOrder(entries(county.results), candidateOrder, 'key');\n    }\n\n    const pct_votes = formatPercent(\n      county.total_votes,\n      county[DDHQestimatedvotes]\n    );\n\n    let contestMetricsClass = cx('contest__metrics', {\n      contest__metrics__canvass: isCanvass == true,\n    });\n\n    const pct_votes_turnout =\n      pct_votes < 100\n        ? `An estimated ${pct_votes}% of votes counted`\n        : `An estimated >99% of votes counted`;\n\n    const firstThreeResults = sortedResults.slice(0, 3);\n\n    return (\n      <div class=\"contest\">\n        <table class=\"contest__candidates contest__candidates--tooltip\">\n          <caption>\n            <p class=\"county__title\">{county.county} County</p>\n            <div class={contestMetricsClass}>\n              {isCanvass == false && (\n                <p class=\"contest__precincts\">\n                  {source != 'Decision Desk HQ'\n                    ? `${formatPercent(\n                        county.county_pollinglocationsreporting,\n                        county.total_county_pollinglocations\n                      )}% reporting`\n                    : pct_votes_turnout}\n                </p>\n              )}\n            </div>\n          </caption>\n          {CandidateRow.countyHeader}\n          <tbody>\n            {firstThreeResults.map(result => {\n              const candidate = candidatesMap.get(result.key);\n\n              const candColor = candidatesRender.filter(\n                cand => cand.id == candidate.id\n              );\n\n              return (\n                <CandidateRow\n                  key={candidate.id}\n                  ballotName={candidate.name}\n                  candidateId={candidate.id}\n                  contestIsCalled={false}\n                  candidateColor={candColor[0]['color']}\n                  isIncumbent={candidate.is_incumbent}\n                  isWinner={candidate.is_winner}\n                  isMapRow\n                  party={candidate.party}\n                  totalVotesInContest={county.total_votes}\n                  votes={result.value}\n                />\n              );\n            })}\n          </tbody>\n        </table>\n      </div>\n    );\n  }\n}\n\nexport default TooltipTable;","function getPoint(node: HTMLElement, x: number, y: number): [number, number] {\n  const rect = node.getBoundingClientRect();\n  return [x - rect.left - node.clientLeft, y - rect.top - node.clientTop];\n}\n\nexport default getPoint;\n","// packages\nimport cx from 'classnames';\nimport { entries, map, Map, set, Set } from 'd3-collection';\nimport { GeoPath, GeoIdentityTransform, GeoProjection } from 'd3-geo';\nimport { scaleSqrt, extent } from 'd3';\nimport { scaleLinear, ScaleLinear } from 'd3-scale';\nimport { Feature, Point } from 'geojson';\nimport { Component, h } from 'preact';\nimport bboxPolygon from '@turf/bbox-polygon';\nimport booleanPointInPolygon from '@turf/boolean-point-in-polygon';\nimport sumValues from '../utils/sum-values';\n\n// components\nimport CanvasLayer from './CanvasLayer';\n// import MapLegend from './MapLegend';\nimport MapText from './MapText';\nimport Places from './Places';\nimport CartogramCountyLabels from './CartogramCountyLabels';\n// import Portal from './Portal';\nimport SvgLayer from './SvgLayer';\nimport Tooltip from './Tooltip';\nimport TooltipTable from './TooltipTable';\nimport { showBubbleMap, DDHQestimatedvotes } from '../endpoints';\n\n// internal\nimport clamp from '../utils/clamp';\nimport * as colors from '../colors';\nimport find from '../utils/find';\nimport getPoint from '../utils/get-point';\nimport prepareTopoJSON from '../utils/prepare-topojson';\nimport getDistance from '../utils/get-distance';\nimport { Topology } from 'topojson-specification';\nimport data from '../../../data/data.json'\n\ninterface LayeredMapProps {\n  projection: GeoProjection | GeoIdentityTransform;\n  topology: Topology;\n  precinctsReporting: number;\n  totalVotes: number;\n  source: string;\n  candidatesRender: { [key: string]: any };\n}\n\ninterface LayeredMapState {\n  activeGeometry: Feature | null;\n  candidatesOnMap: Set;\n  geos: any;\n  width: number;\n  height: number;\n  x: number;\n  y: number;\n  activeBtn: boolean;\n  includesTie: boolean;\n  typeMap: string;\n}\n\nconst tooltipPush = 20;\nconst cartogramPosition = data['breakdown_cartogram_position'];\nconst colorOrder = [\n  '#EF564A', // R\n  '#3cc687', // G\n  '#bdbdbd', // votes left to count\n  '#be9304', // L\n  '#1755c5' // D\n];\nconst countiesToShow = [\n  {name: 'Harris'},\n  {name: 'Dallas'},\n  {name: 'Tarrant'}, \n  {name: 'Bexar'}, \n  {name: 'Travis'}, \n  {name: 'Collin'}, \n  {name: 'Denton'}, \n  {name: 'Fort Bend'}, \n  {name: 'Williamson'}, \n  {name: 'El Paso'}\n];\nconst mapTranslateValue = 8;\n\nconst relocateTooltip = (tooltip, x, y) => {\n  const { height, width } = tooltip.getBoundingClientRect();\n\n  const innerWidth = window.innerWidth;\n  const innerHeight = window.innerHeight;\n\n  const left = clamp(\n    x - width / 2,\n    tooltipPush,\n    innerWidth - width - tooltipPush\n  );\n  const top =\n    innerHeight > y + tooltipPush + height\n      ? y + tooltipPush\n      : y - height - tooltipPush;\n\n  tooltip.style.left = `${left}px`;\n  tooltip.style.top = `${top}px`;\n};\n\nclass LayeredMap extends Component<LayeredMapProps, LayeredMapState> {\n  xScale: ScaleLinear<number, number>;\n  yScale: ScaleLinear<number, number>;\n  tooltip!: HTMLElement;\n  candidateMap!: Map<any>;\n  countyMap!: Map<any>;\n  embedType: string;\n  candidatesRender: { [key: string]: any };\n\n  constructor() {\n    super();\n\n    this.state = {\n      activeGeometry: null,\n      candidatesOnMap: set(),\n      geos: {},\n      width: 0,\n      height: 0,\n      includesNoResult: false,\n      includesTie: false,\n      typeMap: 'categorical',\n      activeBtn: 'categorical',\n      x: 0,\n      y: 0,\n      rRange: [],\n      rScale: null,\n      countiesToShow: [],\n      activePieCounty: null,\n      border: null,\n    };\n\n    this.onMouseMove = this.onMouseMove.bind(this);\n    this.onMouseLeave = this.onMouseLeave.bind(this);\n    this.onDocumentTouch = this.onDocumentTouch.bind(this);\n    this.getTooltipRef = this.getTooltipRef.bind(this);\n    this.canvasRenderer = this.canvasRenderer.bind(this);\n\n    this.xScale = scaleLinear();\n    this.yScale = scaleLinear();\n  }\n\n  getTooltipRef(el: HTMLElement) {\n    this.tooltip = el;\n  }\n\n  setUpCountyMap(counties: any) {\n    this.countyMap = map(counties, d => d.fips);\n  }\n\n  setUpCandidateMap(candidates: any) {\n    this.candidateMap = map(candidates, d => d.id);\n  }\n\n  handleClick = param => event => {\n    this.setState({\n      typeMap: param,\n      activeBtn: param,\n    });\n  };\n\n  onMouseMove(event: MouseEvent) {\n    const { typeMap } = this.state;\n    const { clientX: x, clientY: y, target } = event;\n    const point = getPoint(target as HTMLElement, x, y);\n\n    if(typeMap == 'categorical') {\n      const coords = [this.xScale.invert(point[0]), this.yScale.invert(point[1])];\n\n      const { collection, index } = this.state.geos;\n  \n      const found = index\n        .search(...coords, ...coords)\n        .map((i: number) => collection.features[i]);\n  \n      const activeGeometry = find(\n        found,\n        (feature: Feature<GeoJSON.Polygon | GeoJSON.MultiPolygon>) =>\n          booleanPointInPolygon(coords, feature)\n      );\n  \n      let activeCounty = null;\n  \n      if (activeGeometry) {\n        const { fips } = activeGeometry.properties;\n        activeCounty = this.countyMap.get(fips);\n      }\n  \n      this.setState({ activeCounty, activeGeometry }, () =>\n        relocateTooltip(this.tooltip, x, y)\n      );\n    } else { // when breakdown cartogram is selected\n      // distance from pie center is within radius => cursor is on a pie\n      const activePieCounty = [];\n\n      cartogramPosition.forEach(p => {\n        // see if the distance from pie center is within radius\n        const distance = getDistance(p.center[0], p.center[1], point[0] - mapTranslateValue, point[1])\n        if (distance <= p.radius) {\n          activePieCounty.push(p);\n        }\n      })\n\n      let activeCounty = null;\n  \n      if (activePieCounty[0] != undefined) {\n        const fips = activePieCounty[0].fips;\n        activeCounty = this.countyMap.get(fips);\n      }\n\n      this.setState({ \n        activeCounty,\n        activePieCounty: activePieCounty[0]\n      }, () =>\n        relocateTooltip(this.tooltip, x, y)\n      );\n    }\n  } \n\n  onMouseLeave() {\n    this.setState({ activeCounty: null, activeGeometry: null, activePieCounty: null });\n  }\n\n  onDocumentTouch(e) {\n    if (!this.base.contains(e.target)) this.onMouseLeave();\n  }\n\n  drawBaseMap(ctx, geos, geoPath, strokeColor) {\n    geos.collection.features.forEach((feature: Feature) => {\n      const { fips } = feature.properties;\n\n      ctx.beginPath();\n      geoPath(feature);\n\n      ctx.fillStyle = colors.NEUTRAL;\n      ctx.fill();\n      ctx.lineCap = 'round';\n      ctx.lineJoin = 'round';\n      ctx.strokeStyle = strokeColor;\n      ctx.lineWidth = 0.8;\n      ctx.stroke();\n      ctx.closePath();\n    });\n  }\n\n  drawRoadsLayer(ctx, geos, geoPath) {\n    geos.roads.features.forEach((feature: Feature) => {\n      if (feature.properties.level !== 'Interstate') return;\n      ctx.beginPath();\n      geoPath(feature);\n\n      ctx.lineCap = 'round';\n      ctx.lineJoin = 'round';\n\n      if (feature.properties.level === 'Interstate') {\n        ctx.strokeStyle = 'rgba(0, 0, 0, .12)';\n        ctx.lineWidth = 1;\n      } else {\n        ctx.strokeStyle = 'rgba(0, 0, 0, .08)';\n        ctx.lineWidth = 0.8;\n      }\n\n      ctx.stroke();\n      ctx.closePath();\n    });\n  }\n\n  drawPlacesLayer(ctx, geos,geoPath) {\n    let places_mappable = geos.places;\n\n    geos.places = places_mappable;\n\n    geos.places.features.forEach((feature: Feature<Point>) => {\n      const [x, y] = geoPath.centroid(feature);\n\n      ctx.beginPath();\n      ctx.arc(x, y, 3, 0, Math.PI * 2, true);\n      ctx.strokeStyle = 'rgba(33, 33, 33, .75)';\n      ctx.lineWidth = 1.25;\n      ctx.stroke();\n      ctx.closePath();\n    });\n  }\n\n  drawUrbanAreasLayer(ctx, geos, geoPath) {\n    geos.urban_areas.features.forEach((feature: Feature) => {\n      ctx.beginPath();\n      geoPath(feature);\n\n      ctx.fillStyle = 'rgba(153, 160, 175, 0.2)';\n      ctx.fill();\n      ctx.closePath();\n    });\n  }\n\n  canvasRenderer(ctx: CanvasRenderingContext2D, geoPath: GeoPath) {\n    const { geos, width, height, typeMap, rScale } = this.state;\n    const { candidatesRender, embedType, projection } = this.props;\n\n    ctx.clearRect(0, 0, width, height);\n    ctx.translate(mapTranslateValue, 0)\n\n    if (!geos.collection) return;\n\n    const candidatesOnMap = set();\n    let includesNoResult = false;\n    let includesTie = false;\n\n    if (typeMap == 'categorical') {\n      geos.collection.features.forEach((feature: Feature) => {\n        const { fips } = feature.properties;\n        const county = this.countyMap.get(fips);\n\n        let fillStyle, lean;\n\n        if (county.total_votes <= 0) {\n          includesNoResult = true;\n          fillStyle = colors.NEUTRAL;\n        } else {\n          const sortedResults = entries(county.results).sort(\n            (a, b) => b.value - a.value\n          );\n\n          const leader = sortedResults[0];\n          const second = sortedResults[1];\n\n          if (leader.value === second.value) {\n            includesTie = true;\n            fillStyle = colors.TIE;\n          } else {\n            const leadingId = leader.key;\n            candidatesOnMap.add(leadingId);\n\n            const leader_pct = leader.value/county.total_votes\n          const second_pct = second.value/county.total_votes\n\n          const margin = (leader_pct-second_pct)\n\n          if (margin.toFixed(2) < 0.10) {\n            lean = true\n          } else {\n            lean = false\n          }\n\n            const { id } = this.candidateMap.get(leadingId);\n            const result = candidatesRender.filter(cand => cand.id == id);\n            fillStyle = lean == true ? result[0]['lean_color']: result[0]['color'];\n            // fillStyle = result[0]['color'];\n          }\n        }\n\n        ctx.beginPath();\n        geoPath(feature);\n\n        ctx.fillStyle = fillStyle;\n        ctx.fill();\n        ctx.closePath();\n      });\n\n      ctx.beginPath();\n      geoPath(geos.collection);\n\n      ctx.lineCap = 'round';\n      ctx.lineJoin = 'round';\n      ctx.strokeStyle = 'rgba(255, 255, 255, .6)'; //255, 255, 255\n      ctx.lineWidth = 0.8;\n\n      ctx.stroke();\n      ctx.closePath();\n\n      this.drawRoadsLayer(ctx, geos, geoPath);\n      this.drawPlacesLayer(ctx, geos, geoPath);\n      this.drawUrbanAreasLayer(ctx, geos, geoPath);\n    }\n\n    if (typeMap == 'breakdown') {\n      // base map\n      this.drawBaseMap(ctx, geos, geoPath, colors.NEUTRAL);\n\n      // pie\n      // calculate cartogram positions\n      cartogramPosition.map(p => {\n        // get projected coordinates\n        const coordinates = [p.recal_x, p.recal_y];\n        const county = this.countyMap.get(p.fips);\n        p.center = projection(coordinates);\n        p.radius = rScale(county[DDHQestimatedvotes]);\n      })\n\n      cartogramPosition.forEach(p => {\n        const county = this.countyMap.get(p.fips);\n        const sortedResults = entries(county.results);\n        sortedResults.map(r => {\n          const candidate = candidatesRender.find(cand => cand.id == r.key);\n          r.color = candidate.color;\n        })\n        const votesLeft = county[DDHQestimatedvotes] - county.total_votes;\n        sortedResults.push({key: 'votesLeftToCount', value: votesLeft, color: '#bdbdbd'}); \n        sortedResults.sort((a, b) => colorOrder.indexOf(a.color) - colorOrder.indexOf(b.color));\n\n        let currentAngle = -Math.PI / 2;\n\n        for (const candidate of sortedResults) { \n          //calculating the angle the slice (portion) will take in the pie chart\n          let portionAngle = candidate.value > 0\n            ? (candidate.value / county[DDHQestimatedvotes]) * 2 * Math.PI\n            : 0;\n\n          //drawing an arc and a line to the center to differentiate the slice from the rest\n          ctx.beginPath();\n          ctx.arc(p.center[0], p.center[1], p.radius, currentAngle, currentAngle + portionAngle);\n          currentAngle += portionAngle;\n          ctx.lineTo(p.center[0], p.center[1]);\n          //filling the slices with the corresponding candidates's color\n          ctx.fillStyle = candidate.color\n          ctx.fill();\n        }\n      })\n    }\n    this.setState({ candidatesOnMap, includesNoResult, includesTie });\n  }\n\n  componentWillReceiveProps(nextProps) {\n    const { candidates, counties } = nextProps;\n\n    this.setUpCandidateMap(candidates);\n    this.setUpCountyMap(counties);\n  }\n\n  getContainerDimensions() {\n    const base = this.base!;\n    const rawWidth = base.offsetWidth;\n\n    this.setState({ width });\n  }\n\n  componentDidMount() {\n    const { candidates, counties, candidatesRender, projection } = this.props;\n\n    this.setUpCandidateMap(candidates);\n    this.setUpCountyMap(counties);\n\n    const base = this.base!;\n    const rawWidth = Math.floor(base.clientWidth);\n\n    const { topology } = this.props;\n    const geos = prepareTopoJSON(topology);\n\n    const { bbox, heightRatio } = geos;\n    const rawHeight = Math.floor(rawWidth * heightRatio);\n\n    const width = rawWidth;\n    const height = rawHeight;\n\n    // adjust map width and height so that El Paso won't be cut off\n    const mapWidth = width - mapTranslateValue;\n    const mapHeight = height;\n\n    this.props.projection\n      .fitSize([mapWidth, mapHeight], bboxPolygon(bbox))\n\n    this.xScale\n      .domain([bbox[0], bbox[2]])\n      .range([mapTranslateValue, width]);\n    this.yScale\n      .domain([bbox[1], bbox[3]])\n      .range([height, 0]);\n\n    // calculate rScale\n    const all_Leader_sizes = [];\n\n    geos.collection.features.forEach((feature: Feature) => {\n      const { fips } = feature.properties;\n      const county = this.countyMap.get(fips);\n      all_Leader_sizes.push(county[DDHQestimatedvotes]);\n    })\n\n    const e = extent(all_Leader_sizes);\n    const rRange = [\n      2 / 620 * rawWidth,\n      50 / 620 * rawHeight\n    ];\n    const rScale = scaleSqrt()\n      .range(rRange)\n      .domain(e);\n\n    // large counties to show county labels on cartogram\n    countiesToShow.map(county => {\n      county.coordinates = [\n        cartogramPosition.find(d => d.county == county.name)?.recal_x,\n        cartogramPosition.find(d => d.county == county.name)?.recal_y\n      ]\n    });\n\n    // space for annotation\n    const border = {\n      elPaso: null,\n      marverick: null\n    };\n    // El Paso coordinates\n    const elPaso = cartogramPosition.find(d => d.county == 'El Paso');\n    const elPasoCoordinates = projection([elPaso.recal_x, elPaso.recal_y]);\n    border.elPaso = elPasoCoordinates;\n\n    // Maverick coordinates\n    const maverick = cartogramPosition.find(d => d.county == 'Maverick');\n    const maverickCoordinates = projection([maverick.recal_x, maverick.recal_y]);\n    border.marverick = maverickCoordinates;\n\n    document.addEventListener('touchstart', this.onDocumentTouch, false);\n    \n    this.setState({ geos, width, height, rRange, rScale, countiesToShow, border });\n\n  }\n\n  render() {\n    const {\n      candidates,\n      projection,\n      precinctsReporting,\n      totalVotes,\n      candidatesRender,\n      embedType,\n      source,\n    } = this.props;\n    const {\n      activeCounty,\n      activeBtn,\n      activeGeometry,\n      candidatesOnMap,\n      geos,\n      includesNoResult,\n      includesTie,\n      width,\n      height,\n      x,\n      y,\n      typeMap,\n      rScale,\n      countiesToShow,\n      activePieCounty,\n      border\n    } = this.state;\n\n    return (\n      <div id=\"all-map-stuff\">\n        <div\n          class=\"layers-map\"\n          style={{\n            boxSizing: 'border-box',\n            width: '100%',\n            height: '100%',\n            position: 'relative',\n          }}\n          onMouseMove={this.onMouseMove}\n          onMouseLeave={this.onMouseLeave}\n        >\n          {typeMap == 'categorical' ? (\n            <SvgLayer\n              width={width}\n              height={height}\n              projection={projection}\n              mapTranslateValue={mapTranslateValue}\n              render={({ geoPath }) => (\n                <g>\n                  {geos.places && (\n                    <Places geoPath={geoPath} places={geos.places.features} />\n                  )}\n                  {activeGeometry && (\n                    <path\n                      fill=\"none\"\n                      stroke=\"black\"\n                      stroke-width=\"2\"\n                      d={geoPath(activeGeometry) || undefined}\n                    />\n                  )}\n                </g>\n              )}\n            />\n          ) : ( // breakdown cartogram\n            <SvgLayer\n              width={width}\n              height={height}\n              projection={projection}\n              mapTranslateValue={mapTranslateValue}\n              render={({ geoPath }) => (\n                <g>\n                  {countiesToShow && (\n                    <CartogramCountyLabels projection={projection} counties={countiesToShow} />\n                  )}\n                  {activePieCounty && (\n                    <circle\n                      fill=\"none\"\n                      stroke=\"black\"\n                      stroke-width=\"2\"\n                      cx={activePieCounty.center[0]}\n                      cy={activePieCounty.center[1]}\n                      r={activePieCounty.radius}\n                    />\n                  )}\n                </g>\n              )}\n            />\n            )\n          }\n          <CanvasLayer\n            totalPrecincts={precinctsReporting}\n            totalVotes={totalVotes}\n            projection={projection}\n            width={width}\n            height={height}\n            render={this.canvasRenderer}\n            mapType={typeMap}\n          />\n          <Tooltip\n            class={cx('tooltip map__tooltip', {\n              invisible: !Boolean(activeCounty),\n            })}\n            tooltipRef={this.getTooltipRef}\n          >\n            {activeCounty && (\n              <TooltipTable\n                candidatesRender={candidatesRender}\n                candidatesMap={this.candidateMap}\n                totalVotes={totalVotes}\n                county={activeCounty}\n                source={source}\n              />\n            )}\n          </Tooltip>\n        </div>\n        <div class=\"below-map\">\n          <MapText \n            candidates={candidates.filter(({ id }: { id: string }) =>\n              candidatesOnMap.has(id)\n            )}\n            includesNoResult={includesNoResult}\n            includesTie={includesTie}\n            width={width}\n            height={height}\n            typeMap={typeMap}\n            typeRace={candidates.length === 4 ? 'governor' : 'attorney-general'}\n            border={border}\n          />\n\n          {showBubbleMap && (\n            <div class=\"map-btn-group\">\n              <button\n                className={\n                  activeBtn === 'categorical'\n                    ? 'map-button map-button--active'\n                    : 'map-button'\n                }\n                onClick={this.handleClick('categorical')}\n              >\n                By candidate\n              </button>\n              <button\n                className={\n                  activeBtn === 'breakdown'\n                    ? 'map-button map-button--active'\n                    : 'map-button'\n                }\n                onClick={this.handleClick('breakdown')}\n              >\n                Breakdown\n              </button>\n            </div>\n          )}\n        </div>\n      </div>\n    );\n  }\n}\n\nexport default LayeredMap;\n","export default function clamp(n, min, max) {\n  return Math.min(Math.max(n, min), max);\n}\n","export default function getDistance(x1, y1, x2, y2) {\n  let y = x2 - x1;\n  let x = y2 - y1;\n\n  return Math.sqrt(x * x + y * y);\n}\n","export default function(x) {\n  return x;\n}\n","import identity from \"./identity.js\";\n\nexport default function(transform) {\n  if (transform == null) return identity;\n  var x0,\n      y0,\n      kx = transform.scale[0],\n      ky = transform.scale[1],\n      dx = transform.translate[0],\n      dy = transform.translate[1];\n  return function(input, i) {\n    if (!i) x0 = y0 = 0;\n    var j = 2, n = input.length, output = new Array(n);\n    output[0] = (x0 += input[0]) * kx + dx;\n    output[1] = (y0 += input[1]) * ky + dy;\n    while (j < n) output[j] = input[j], ++j;\n    return output;\n  };\n}\n","import reverse from \"./reverse.js\";\nimport transform from \"./transform.js\";\n\nexport default function(topology, o) {\n  if (typeof o === \"string\") o = topology.objects[o];\n  return o.type === \"GeometryCollection\"\n      ? {type: \"FeatureCollection\", features: o.geometries.map(function(o) { return feature(topology, o); })}\n      : feature(topology, o);\n}\n\nfunction feature(topology, o) {\n  var id = o.id,\n      bbox = o.bbox,\n      properties = o.properties == null ? {} : o.properties,\n      geometry = object(topology, o);\n  return id == null && bbox == null ? {type: \"Feature\", properties: properties, geometry: geometry}\n      : bbox == null ? {type: \"Feature\", id: id, properties: properties, geometry: geometry}\n      : {type: \"Feature\", id: id, bbox: bbox, properties: properties, geometry: geometry};\n}\n\nexport function object(topology, o) {\n  var transformPoint = transform(topology.transform),\n      arcs = topology.arcs;\n\n  function arc(i, points) {\n    if (points.length) points.pop();\n    for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) {\n      points.push(transformPoint(a[k], k));\n    }\n    if (i < 0) reverse(points, n);\n  }\n\n  function point(p) {\n    return transformPoint(p);\n  }\n\n  function line(arcs) {\n    var points = [];\n    for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n    if (points.length < 2) points.push(points[0]); // This should never happen per the specification.\n    return points;\n  }\n\n  function ring(arcs) {\n    var points = line(arcs);\n    while (points.length < 4) points.push(points[0]); // This may happen if an arc has only two points.\n    return points;\n  }\n\n  function polygon(arcs) {\n    return arcs.map(ring);\n  }\n\n  function geometry(o) {\n    var type = o.type, coordinates;\n    switch (type) {\n      case \"GeometryCollection\": return {type: type, geometries: o.geometries.map(geometry)};\n      case \"Point\": coordinates = point(o.coordinates); break;\n      case \"MultiPoint\": coordinates = o.coordinates.map(point); break;\n      case \"LineString\": coordinates = line(o.arcs); break;\n      case \"MultiLineString\": coordinates = o.arcs.map(line); break;\n      case \"Polygon\": coordinates = polygon(o.arcs); break;\n      case \"MultiPolygon\": coordinates = o.arcs.map(polygon); break;\n      default: return null;\n    }\n    return {type: type, coordinates: coordinates};\n  }\n\n  return geometry(o);\n}\n","export default function(array, n) {\n  var t, j = array.length, i = j - n;\n  while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n}\n","/**\n * @module helpers\n */\n/**\n * Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.\n *\n * @memberof helpers\n * @type {number}\n */\nexport var earthRadius = 6371008.8;\n/**\n * Unit of measurement factors using a spherical (non-ellipsoid) earth radius.\n *\n * @memberof helpers\n * @type {Object}\n */\nexport var factors = {\n    centimeters: earthRadius * 100,\n    centimetres: earthRadius * 100,\n    degrees: earthRadius / 111325,\n    feet: earthRadius * 3.28084,\n    inches: earthRadius * 39.37,\n    kilometers: earthRadius / 1000,\n    kilometres: earthRadius / 1000,\n    meters: earthRadius,\n    metres: earthRadius,\n    miles: earthRadius / 1609.344,\n    millimeters: earthRadius * 1000,\n    millimetres: earthRadius * 1000,\n    nauticalmiles: earthRadius / 1852,\n    radians: 1,\n    yards: earthRadius * 1.0936,\n};\n/**\n * Units of measurement factors based on 1 meter.\n *\n * @memberof helpers\n * @type {Object}\n */\nexport var unitsFactors = {\n    centimeters: 100,\n    centimetres: 100,\n    degrees: 1 / 111325,\n    feet: 3.28084,\n    inches: 39.37,\n    kilometers: 1 / 1000,\n    kilometres: 1 / 1000,\n    meters: 1,\n    metres: 1,\n    miles: 1 / 1609.344,\n    millimeters: 1000,\n    millimetres: 1000,\n    nauticalmiles: 1 / 1852,\n    radians: 1 / earthRadius,\n    yards: 1.0936133,\n};\n/**\n * Area of measurement factors based on 1 square meter.\n *\n * @memberof helpers\n * @type {Object}\n */\nexport var areaFactors = {\n    acres: 0.000247105,\n    centimeters: 10000,\n    centimetres: 10000,\n    feet: 10.763910417,\n    hectares: 0.0001,\n    inches: 1550.003100006,\n    kilometers: 0.000001,\n    kilometres: 0.000001,\n    meters: 1,\n    metres: 1,\n    miles: 3.86e-7,\n    millimeters: 1000000,\n    millimetres: 1000000,\n    yards: 1.195990046,\n};\n/**\n * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.\n *\n * @name feature\n * @param {Geometry} geometry input geometry\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature} a GeoJSON Feature\n * @example\n * var geometry = {\n *   \"type\": \"Point\",\n *   \"coordinates\": [110, 50]\n * };\n *\n * var feature = turf.feature(geometry);\n *\n * //=feature\n */\nexport function feature(geom, properties, options) {\n    if (options === void 0) { options = {}; }\n    var feat = { type: \"Feature\" };\n    if (options.id === 0 || options.id) {\n        feat.id = options.id;\n    }\n    if (options.bbox) {\n        feat.bbox = options.bbox;\n    }\n    feat.properties = properties || {};\n    feat.geometry = geom;\n    return feat;\n}\n/**\n * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.\n * For GeometryCollection type use `helpers.geometryCollection`\n *\n * @name geometry\n * @param {string} type Geometry Type\n * @param {Array<any>} coordinates Coordinates\n * @param {Object} [options={}] Optional Parameters\n * @returns {Geometry} a GeoJSON Geometry\n * @example\n * var type = \"Point\";\n * var coordinates = [110, 50];\n * var geometry = turf.geometry(type, coordinates);\n * // => geometry\n */\nexport function geometry(type, coordinates, _options) {\n    if (_options === void 0) { _options = {}; }\n    switch (type) {\n        case \"Point\":\n            return point(coordinates).geometry;\n        case \"LineString\":\n            return lineString(coordinates).geometry;\n        case \"Polygon\":\n            return polygon(coordinates).geometry;\n        case \"MultiPoint\":\n            return multiPoint(coordinates).geometry;\n        case \"MultiLineString\":\n            return multiLineString(coordinates).geometry;\n        case \"MultiPolygon\":\n            return multiPolygon(coordinates).geometry;\n        default:\n            throw new Error(type + \" is invalid\");\n    }\n}\n/**\n * Creates a {@link Point} {@link Feature} from a Position.\n *\n * @name point\n * @param {Array<number>} coordinates longitude, latitude position (each in decimal degrees)\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<Point>} a Point feature\n * @example\n * var point = turf.point([-75.343, 39.984]);\n *\n * //=point\n */\nexport function point(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    if (!coordinates) {\n        throw new Error(\"coordinates is required\");\n    }\n    if (!Array.isArray(coordinates)) {\n        throw new Error(\"coordinates must be an Array\");\n    }\n    if (coordinates.length < 2) {\n        throw new Error(\"coordinates must be at least 2 numbers long\");\n    }\n    if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n        throw new Error(\"coordinates must contain numbers\");\n    }\n    var geom = {\n        type: \"Point\",\n        coordinates: coordinates,\n    };\n    return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.\n *\n * @name points\n * @param {Array<Array<number>>} coordinates an array of Points\n * @param {Object} [properties={}] Translate these properties to each Feature\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {string|number} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Point>} Point Feature\n * @example\n * var points = turf.points([\n *   [-75, 39],\n *   [-80, 45],\n *   [-78, 50]\n * ]);\n *\n * //=points\n */\nexport function points(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    return featureCollection(coordinates.map(function (coords) {\n        return point(coords, properties);\n    }), options);\n}\n/**\n * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.\n *\n * @name polygon\n * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<Polygon>} Polygon Feature\n * @example\n * var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });\n *\n * //=polygon\n */\nexport function polygon(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {\n        var ring = coordinates_1[_i];\n        if (ring.length < 4) {\n            throw new Error(\"Each LinearRing of a Polygon must have 4 or more Positions.\");\n        }\n        for (var j = 0; j < ring[ring.length - 1].length; j++) {\n            // Check if first point of Polygon contains two numbers\n            if (ring[ring.length - 1][j] !== ring[0][j]) {\n                throw new Error(\"First and last Position are not equivalent.\");\n            }\n        }\n    }\n    var geom = {\n        type: \"Polygon\",\n        coordinates: coordinates,\n    };\n    return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.\n *\n * @name polygons\n * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygon coordinates\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Polygon>} Polygon FeatureCollection\n * @example\n * var polygons = turf.polygons([\n *   [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],\n *   [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]],\n * ]);\n *\n * //=polygons\n */\nexport function polygons(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    return featureCollection(coordinates.map(function (coords) {\n        return polygon(coords, properties);\n    }), options);\n}\n/**\n * Creates a {@link LineString} {@link Feature} from an Array of Positions.\n *\n * @name lineString\n * @param {Array<Array<number>>} coordinates an array of Positions\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<LineString>} LineString Feature\n * @example\n * var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});\n * var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});\n *\n * //=linestring1\n * //=linestring2\n */\nexport function lineString(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    if (coordinates.length < 2) {\n        throw new Error(\"coordinates must be an array of two or more positions\");\n    }\n    var geom = {\n        type: \"LineString\",\n        coordinates: coordinates,\n    };\n    return feature(geom, properties, options);\n}\n/**\n * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.\n *\n * @name lineStrings\n * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {string|number} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<LineString>} LineString FeatureCollection\n * @example\n * var linestrings = turf.lineStrings([\n *   [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],\n *   [[-14, 43], [-13, 40], [-15, 45], [-10, 49]]\n * ]);\n *\n * //=linestrings\n */\nexport function lineStrings(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    return featureCollection(coordinates.map(function (coords) {\n        return lineString(coords, properties);\n    }), options);\n}\n/**\n * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.\n *\n * @name featureCollection\n * @param {Feature[]} features input features\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {FeatureCollection} FeatureCollection of Features\n * @example\n * var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});\n * var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});\n * var locationC = turf.point([-75.534, 39.123], {name: 'Location C'});\n *\n * var collection = turf.featureCollection([\n *   locationA,\n *   locationB,\n *   locationC\n * ]);\n *\n * //=collection\n */\nexport function featureCollection(features, options) {\n    if (options === void 0) { options = {}; }\n    var fc = { type: \"FeatureCollection\" };\n    if (options.id) {\n        fc.id = options.id;\n    }\n    if (options.bbox) {\n        fc.bbox = options.bbox;\n    }\n    fc.features = features;\n    return fc;\n}\n/**\n * Creates a {@link Feature<MultiLineString>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiLineString\n * @param {Array<Array<Array<number>>>} coordinates an array of LineStrings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiLineString>} a MultiLineString feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiLine = turf.multiLineString([[[0,0],[10,10]]]);\n *\n * //=multiLine\n */\nexport function multiLineString(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    var geom = {\n        type: \"MultiLineString\",\n        coordinates: coordinates,\n    };\n    return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<MultiPoint>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiPoint\n * @param {Array<Array<number>>} coordinates an array of Positions\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPoint>} a MultiPoint feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPt = turf.multiPoint([[0,0],[10,10]]);\n *\n * //=multiPt\n */\nexport function multiPoint(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    var geom = {\n        type: \"MultiPoint\",\n        coordinates: coordinates,\n    };\n    return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<MultiPolygon>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiPolygon\n * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygons\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPolygon>} a multipolygon feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);\n *\n * //=multiPoly\n *\n */\nexport function multiPolygon(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    var geom = {\n        type: \"MultiPolygon\",\n        coordinates: coordinates,\n    };\n    return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<GeometryCollection>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name geometryCollection\n * @param {Array<Geometry>} geometries an array of GeoJSON Geometries\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryCollection>} a GeoJSON GeometryCollection Feature\n * @example\n * var pt = turf.geometry(\"Point\", [100, 0]);\n * var line = turf.geometry(\"LineString\", [[101, 0], [102, 1]]);\n * var collection = turf.geometryCollection([pt, line]);\n *\n * // => collection\n */\nexport function geometryCollection(geometries, properties, options) {\n    if (options === void 0) { options = {}; }\n    var geom = {\n        type: \"GeometryCollection\",\n        geometries: geometries,\n    };\n    return feature(geom, properties, options);\n}\n/**\n * Round number to precision\n *\n * @param {number} num Number\n * @param {number} [precision=0] Precision\n * @returns {number} rounded number\n * @example\n * turf.round(120.4321)\n * //=120\n *\n * turf.round(120.4321, 2)\n * //=120.43\n */\nexport function round(num, precision) {\n    if (precision === void 0) { precision = 0; }\n    if (precision && !(precision >= 0)) {\n        throw new Error(\"precision must be a positive number\");\n    }\n    var multiplier = Math.pow(10, precision || 0);\n    return Math.round(num * multiplier) / multiplier;\n}\n/**\n * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @name radiansToLength\n * @param {number} radians in radians across the sphere\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} distance\n */\nexport function radiansToLength(radians, units) {\n    if (units === void 0) { units = \"kilometers\"; }\n    var factor = factors[units];\n    if (!factor) {\n        throw new Error(units + \" units is invalid\");\n    }\n    return radians * factor;\n}\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @name lengthToRadians\n * @param {number} distance in real units\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} radians\n */\nexport function lengthToRadians(distance, units) {\n    if (units === void 0) { units = \"kilometers\"; }\n    var factor = factors[units];\n    if (!factor) {\n        throw new Error(units + \" units is invalid\");\n    }\n    return distance / factor;\n}\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet\n *\n * @name lengthToDegrees\n * @param {number} distance in real units\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} degrees\n */\nexport function lengthToDegrees(distance, units) {\n    return radiansToDegrees(lengthToRadians(distance, units));\n}\n/**\n * Converts any bearing angle from the north line direction (positive clockwise)\n * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line\n *\n * @name bearingToAzimuth\n * @param {number} bearing angle, between -180 and +180 degrees\n * @returns {number} angle between 0 and 360 degrees\n */\nexport function bearingToAzimuth(bearing) {\n    var angle = bearing % 360;\n    if (angle < 0) {\n        angle += 360;\n    }\n    return angle;\n}\n/**\n * Converts an angle in radians to degrees\n *\n * @name radiansToDegrees\n * @param {number} radians angle in radians\n * @returns {number} degrees between 0 and 360 degrees\n */\nexport function radiansToDegrees(radians) {\n    var degrees = radians % (2 * Math.PI);\n    return (degrees * 180) / Math.PI;\n}\n/**\n * Converts an angle in degrees to radians\n *\n * @name degreesToRadians\n * @param {number} degrees angle between 0 and 360 degrees\n * @returns {number} angle in radians\n */\nexport function degreesToRadians(degrees) {\n    var radians = degrees % 360;\n    return (radians * Math.PI) / 180;\n}\n/**\n * Converts a length to the requested unit.\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @param {number} length to be converted\n * @param {Units} [originalUnit=\"kilometers\"] of the length\n * @param {Units} [finalUnit=\"kilometers\"] returned unit\n * @returns {number} the converted length\n */\nexport function convertLength(length, originalUnit, finalUnit) {\n    if (originalUnit === void 0) { originalUnit = \"kilometers\"; }\n    if (finalUnit === void 0) { finalUnit = \"kilometers\"; }\n    if (!(length >= 0)) {\n        throw new Error(\"length must be a positive number\");\n    }\n    return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n}\n/**\n * Converts a area to the requested unit.\n * Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches, hectares\n * @param {number} area to be converted\n * @param {Units} [originalUnit=\"meters\"] of the distance\n * @param {Units} [finalUnit=\"kilometers\"] returned unit\n * @returns {number} the converted area\n */\nexport function convertArea(area, originalUnit, finalUnit) {\n    if (originalUnit === void 0) { originalUnit = \"meters\"; }\n    if (finalUnit === void 0) { finalUnit = \"kilometers\"; }\n    if (!(area >= 0)) {\n        throw new Error(\"area must be a positive number\");\n    }\n    var startFactor = areaFactors[originalUnit];\n    if (!startFactor) {\n        throw new Error(\"invalid original units\");\n    }\n    var finalFactor = areaFactors[finalUnit];\n    if (!finalFactor) {\n        throw new Error(\"invalid final units\");\n    }\n    return (area / startFactor) * finalFactor;\n}\n/**\n * isNumber\n *\n * @param {*} num Number to validate\n * @returns {boolean} true/false\n * @example\n * turf.isNumber(123)\n * //=true\n * turf.isNumber('foo')\n * //=false\n */\nexport function isNumber(num) {\n    return !isNaN(num) && num !== null && !Array.isArray(num);\n}\n/**\n * isObject\n *\n * @param {*} input variable to validate\n * @returns {boolean} true/false\n * @example\n * turf.isObject({elevation: 10})\n * //=true\n * turf.isObject('foo')\n * //=false\n */\nexport function isObject(input) {\n    return !!input && input.constructor === Object;\n}\n/**\n * Validate BBox\n *\n * @private\n * @param {Array<number>} bbox BBox to validate\n * @returns {void}\n * @throws Error if BBox is not valid\n * @example\n * validateBBox([-180, -40, 110, 50])\n * //=OK\n * validateBBox([-180, -40])\n * //=Error\n * validateBBox('Foo')\n * //=Error\n * validateBBox(5)\n * //=Error\n * validateBBox(null)\n * //=Error\n * validateBBox(undefined)\n * //=Error\n */\nexport function validateBBox(bbox) {\n    if (!bbox) {\n        throw new Error(\"bbox is required\");\n    }\n    if (!Array.isArray(bbox)) {\n        throw new Error(\"bbox must be an Array\");\n    }\n    if (bbox.length !== 4 && bbox.length !== 6) {\n        throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n    }\n    bbox.forEach(function (num) {\n        if (!isNumber(num)) {\n            throw new Error(\"bbox must only contain numbers\");\n        }\n    });\n}\n/**\n * Validate Id\n *\n * @private\n * @param {string|number} id Id to validate\n * @returns {void}\n * @throws Error if Id is not valid\n * @example\n * validateId([-180, -40, 110, 50])\n * //=Error\n * validateId([-180, -40])\n * //=Error\n * validateId('Foo')\n * //=OK\n * validateId(5)\n * //=OK\n * validateId(null)\n * //=Error\n * validateId(undefined)\n * //=Error\n */\nexport function validateId(id) {\n    if (!id) {\n        throw new Error(\"id is required\");\n    }\n    if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n        throw new Error(\"id must be a number or a string\");\n    }\n}\n","// This is where we set up the custom colors for the maps\n\nlet opacity = '0.4';\n\nconst GOVERNOR = [\n  {\n    name: 'Greg Abbott',\n    color: '#EF564A',\n    lean_color: '#F6A79D',\n    rgbaColor: 'rgba(239,86,74,' + opacity + ')',\n  },\n  {\n    name: \"Beto O'Rourke\",\n    color: '#1755c5',\n    lean_color: '#6DACD3',\n    rgbaColor: 'rgba(23,85,194,' + opacity + ')',\n  },\n  {\n    name: 'Mark Tippetts',\n    color: '#be9304',\n    lean_color: '#edc74a',\n    rgbaColor: 'rgba(190, 147, 4,' + opacity + ')',\n  },\n  {\n    name: 'Delilah Barrios',\n    color: '#3cc687',\n    lean_color: '#92e8c1',\n    rgbaColor: 'rgba(60, 198, 135,' + opacity + ')',\n  },\n];\n\nconst AG = [\n  {\n    name: 'Ken Paxton',\n    color: '#EF564A',\n    lean_color: '#F6A79D',\n    rgbaColor: 'rgba(239,86,74,' + opacity + ')',\n  },\n  {\n    name: 'Rochelle Garza',\n    color: '#1755c5',\n    lean_color: '#6DACD3',\n    rgbaColor: 'rgba(23,85,194,' + opacity + ')',\n  },\n  {\n    name: 'Mark Ash',\n    color: '#be9304',\n    lean_color: '#edc74a',\n    rgbaColor: 'rgba(190, 147, 4,' + opacity + ')',\n  },\n];\n\nconst OTHER = '#888888';\n\nconst REPUBLICAN = '#EF564A'\nconst DEMOCRAT = '#1755c5'\nconst DEMOCRAT_LEAN = '#6DACD3'\nconst REPUBLICAN_LEAN = '#F6A79D';\n\nconst NEUTRAL = '#F2F2F2';\nconst TIE = '#8264B0';\n\nexport { GOVERNOR, AG, NEUTRAL, TIE, OTHER, REPUBLICAN, DEMOCRAT, DEMOCRAT_LEAN, REPUBLICAN_LEAN };\n","import cx from 'classnames';\nimport { h } from 'preact';\n\nfunction OtherCandidate({ isViewable, candidateCount, embedType, onClick }) {\n  const classes = cx('candidate race__candidate-row', {\n    'race__candidate-row--hidden': !isViewable,\n  });\n\n  return (\n    <tr class={classes}>\n      <td\n        class=\"candidate__cell candidate__party t-align-center\"\n        onClick={onClick}\n      >\n        <svg class=\"icon icon-angle-down\">\n          <use xlinkHref=\"#icon-angle-down\" />\n        </svg>\n      </td>\n      <th class=\"candidate__cell candidate__name\">\n        <button class={embedType} onClick={onClick}>\n          Show All ({candidateCount}){' '}\n        </button>\n      </th>\n      <th class=\"candidate__cell candidate__votes\"></th>\n      <th class=\"candidate__cell candidate__pct\"></th>\n    </tr>\n  );\n}\n\nexport default OtherCandidate;\n","import cx from 'classnames';\nimport { intcomma } from 'journalize';\nimport { Component, h } from 'preact';\n\nimport OtherCandidate from './OtherCandidate';\nimport { PreactHTMLConverter } from 'preact-html-converter';\n\n// internal\nimport {\n  alert_conditionals,\n  alert_winners,\n  text_conditionals,\n  sort_candidates_by_party,\n} from '../election-utils';\nimport sumValues from '../utils/sum-values';\nimport formatPercent from '../utils/format-percent';\n\nimport { isCanvass, visibleCandidatesCount, DDHQestimatedvotes } from '../endpoints';\n\ntype Props = {\n  contest: { [key: string]: any };\n  columnCount: number;\n  contestTitle: string;\n  includeCountyRundown?: boolean;\n  isShowcaseRace?: boolean;\n  renderParty: any;\n  renderCandidate: any;\n  candidatesRender: any;\n  embedType: string;\n  broadcastHeaderImage: string;\n  activeContestId: string;\n  partyName: string;\n  tableHeader: JSX.Element;\n  annotations: { [key: string]: any };\n  notes: { [key: string]: any };\n  isHomepage?: boolean;\n  asOf: string;\n  source: string;\n};\n\nclass Contest extends Component<Props> {\n  constructor() {\n    super();\n\n    this.state = {\n      viewAllCandidates: false,\n    };\n    this.onViewableToggle = this.onViewableToggle.bind(this);\n  }\n\n  onViewableToggle() {\n    this.setState(prevState => ({\n      viewAllCandidates: !prevState.viewAllCandidates, // set viewAllCandidates to what is wasn't before\n    }));\n  }\n  render() {\n    const {\n      contest,\n      columnCount,\n      contestTitle,\n      isShowcaseRace,\n      renderCandidate,\n      partyName,\n      annotations,\n      notes,\n      tableHeader,\n      isHomepage,\n      asOf,\n      source,\n      embedType,\n      candidatesRender,\n    } = this.props;\n\n    const { viewAllCandidates } = this.state;\n\n    const converter = PreactHTMLConverter();\n\n    const shouldDisplayResult = contest.contest_result !== 'not called';\n\n    let CandidatesShown = isHomepage ? 2 : visibleCandidatesCount\n\n    // Get uncontested races that are not state races because we won't be receiving votes for those races\n\n    // Uncontested are going to be called regardless of being marked as winners\n\n    const uncontested = contest.candidacies.length == 1;\n\n    const uncontestedNoHouse = contest.candidacies.length == 1 && contest.office !== 'U.S. House';\n\n    // const uncontested = contest.candidacies.length == 1 && contest.office !== 'U.S. House';\n\n    const totalVotes = sumValues(contest.candidacies, 'votes');\n\n    let candidates;\n\n    candidates =\n      totalVotes == 0\n        ? sort_candidates_by_party(contest.candidacies)\n        : contest.candidacies;\n\n    const pct_votes = formatPercent(totalVotes, contest[DDHQestimatedvotes]);\n    const pct_votes_turnout =\n      embedType == 'homepage'\n        ? pct_votes < 100\n          ? `An estimated ${pct_votes}% of votes have been counted.`\n          : `An estimated >99% of votes have been counted.`\n        : pct_votes < 100\n        ? `An estimated ${pct_votes}% of votes have been counted, according to Decision Desk HQ turnout models.`\n        : `An estimated >99% of votes have been counted, according to Decision Desk HQ turnout models.`;\n\n    const pct_votes_turnout_w_uncontested =\n       (uncontestedNoHouse == true)\n          ? text_conditionals(pct_votes, contest.candidacies.length) :\n          pct_votes_turnout\n\n    const pct_votes_explain = !shouldDisplayResult && !uncontested\n      ? text_conditionals(pct_votes, contest.candidacies.length)\n      : ``;\n\n\n    let embedTypeUsable = 'none';\n\n    if (typeof embedType !== 'undefined') {\n      embedTypeUsable = embedType;\n    }\n\n    const showcaseClass = cx({\n      seat__races: !isShowcaseRace,\n      seat__highlight_races: isShowcaseRace,\n    });\n\n    const rowClass = cx('seat__race', {\n      'seat__race--Democrat': partyName == 'Democrat',\n      'seat__race--Republican': partyName == 'Republican',\n    });\n\n    const klaxon_sos = 'Race declared by Decision Desk HQ'; // if we switch sources to TX SOS and someone else has declared the winner\n\n    const klaxon = shouldDisplayResult \n      ? source == 'Decision Desk HQ'\n        ? alert_winners(contest.contest_result, totalVotes)\n        : klaxon_sos\n      : alert_conditionals(pct_votes, contest.candidacies.length);\n\n    const checkmark = '\\u2713';\n\n    let checkClass = cx('check', {\n      'dem-winner':\n        contest.party == 'Democrat' && contest.contest_result != 'runoff',\n      'rep-winner':\n        contest.party == 'Republican' && contest.contest_result != 'runoff',\n      'runoff-winner': contest.contest_result == 'runoff',\n    });\n\n    const contestMetricsClass = cx('contest__metrics', {\n      homepage__metrics: isHomepage,\n      'non-homepage__metrics': !isHomepage,\n    });\n\n    let hasTurnoutmodel = source == 'Decision Desk HQ' ? true : false;\n\n    const precinctsClass = cx('contest__precincts');\n\n    let ManualoverrideSource;\n\n    // If there is a race, that's being manually updated, you can change the Source to whatever the new votes are coming from here if you uncomment the code below. This is only if the source isn't Texas Secretary of State. If it is, then you don't have to do anything.\n\n    // if (contest.office == 'U.S. House' && contest.office_division == 37 && contest.party == 'Republican') {\n    //   ManualoverrideSource = 'Travis County Elections'\n    // }\n    // else {\n    //   ManualoverrideSource = ''\n    // }\n\n    ManualoverrideSource = '';\n\n    const IsAnnotations =\n      annotations && annotations.length > 0 && annotations[0].value != ''\n        ? true\n        : false;\n\n    const IsNoted = notes && notes.length > 0 ? true : false;\n\n    return (\n      <div class=\"seat\">\n        {!isShowcaseRace && embedType == null && (\n          <span>\n            <h3 class=\"seat__title\">\n              <span>{contestTitle}</span>\n            </h3>\n          </span>\n        )}\n        <div class={showcaseClass}>\n          <div class={rowClass}>\n            <div class=\"race\">\n              {embedType == 'homepage' && (\n                <span>\n                  <div class=\"office__title\">{contestTitle}</div>\n                </span>\n              )}\n              {embedType == 'internal' && (\n                <span>\n                  <h2 class=\"office__title\">{contestTitle}</h2>\n                </span>\n              )}\n\n              <div class={contestMetricsClass}>\n                {isCanvass == false && (\n                  <h4 class=\"klaxon__text\">\n                    {shouldDisplayResult && source == 'Decision Desk HQ' ? (\n                      <span class={checkClass}>{checkmark}</span>\n                    ) : (\n                      ''\n                    )}\n                    {klaxon}\n                  </h4>\n                )}\n                {ManualoverrideSource == '' && isCanvass == false && (\n                  <p class={precinctsClass}>\n                    {source != 'Decision Desk HQ'\n                      ? `${intcomma(\n                          contest.pollinglocationsreporting\n                        )} of ${intcomma(\n                          contest.total_pollinglocations\n                        )} polling locations reporting (${contest.pollinglocations_reporting_percent.toFixed(\n                          1\n                        )}%).`\n                      : pct_votes_turnout_w_uncontested}{' '}\n                    {pct_votes_explain}\n                  </p>\n                )}\n                {\n                  (ManualoverrideSource = !'' &&\n                    source != 'Texas Secretary of State' &&\n                    source != 'Decision Desk HQ' &&\n                    isCanvass == false && (\n                      <p class={precinctsClass}>\n                        {`${intcomma(\n                          contest.pollinglocationsreporting\n                        )} of ${intcomma(\n                          contest.total_pollinglocations\n                        )} polling locations reporting (${contest.pollinglocations_reporting_percent.toFixed(\n                          1\n                        )}%).`}\n\n                        {/* <span class=\"source\">{` Source: ${ManualoverrideSource}`}</span> */}\n                      </p>\n                    ))\n                }\n              </div>\n\n              <table class=\"race__candidates\">\n                {tableHeader}\n                <tbody>\n                  {isShowcaseRace &&\n                    candidates.map((candidate: any, idx: any) =>\n                      renderCandidate(\n                        candidate,\n                        idx,\n                        candidatesRender,\n                        viewAllCandidates,\n                        { totalVotes }\n                      )\n                    )}\n\n                  {!isShowcaseRace &&\n                    candidates.map((candidate: any, idx: any) =>\n                      renderCandidate(candidate, idx, viewAllCandidates, {\n                        totalVotes,\n                      })\n                    )}\n                  {candidates.length > CandidatesShown && (\n                    <OtherCandidate\n                      isViewable={!viewAllCandidates}\n                      candidateCount={candidates.length}\n                      embedType={embedType}\n                      onClick={() => {\n                        this.onViewableToggle();\n                      }}\n                    />\n                  )}\n                </tbody>\n                {candidates.length > CandidatesShown &&\n                  viewAllCandidates && (\n                    <tr class=\"candidate race__candidate-row\">\n                      <td\n                        class=\"candidate__cell candidate__party t-align-center\"\n                        onClick={() => {\n                          this.onViewableToggle();\n                        }}\n                      >\n                        <svg class=\"icon icon-angle-up\">\n                          <use xlinkHref=\"#icon-angle-up\" />\n                        </svg>\n                      </td>\n                      <th class=\"candidate__cell candidate__name\">\n                        <button\n                          class={embedType}\n                          onClick={() => {\n                            this.onViewableToggle();\n                          }}\n                        >\n                          Show fewer ({CandidatesShown})\n                        </button>\n                      </th>\n                      <th class=\"candidate__cell candidate__votes\"></th>\n                      <th class=\"candidate__cell candidate__pct\"></th>\n                    </tr>\n                  )}\n              </table>\n\n              {/* {isHomepage && (\n            <div class=\"dropped_out__div\" style=\"margin-top: 0.625rem;\">\n              *Dropped out\n            </div>\n          )} */}\n              {IsNoted == true && (\n                <p class=\"note__text\">{converter.convert(notes[0].value)}</p>\n              )}\n              {IsAnnotations == true && (\n                <div class=\"anno-text notes-annotations\">\n                  <span class=\"is-sr-only\">Note:</span>\n                  <svg class=\"icon note-icon anno-div\" aria-hidden=\"true\">\n                    <use xlinkHref=\"#note-icon\" />\n                  </svg>\n\n                  <p class=\"annotations t-links-underlined\">\n                    <span class=\"font-weight-bold\">Noteworthy: </span>\n                    {converter.convert(annotations[0].value)}\n                  </p>\n                </div>\n              )}\n              <div class=\"below-races\">\n              <div class=\"source\">{` Source: ${source}`}</div>\n                {(embedType == 'homepage' || embedType == 'internal') && (\n                  <div class=\"countdown\">\n                    <span class=\"counter-homepage\">LAST UPDATED {asOf}</span>\n                  </div>\n                )}\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    );\n  }\n}\n\nContest.defaultProps = {\n  isShowcaseRace: false,\n  includeCountyRundown: false,\n};\n\nexport default Contest;\n","import cx from 'classnames';\nimport { intcomma } from 'journalize';\nimport { h, VNode } from 'preact';\n\nimport PureComponent from './PureComponent';\n\nimport formatPercent from '../utils/format-percent';\nimport { isCanvass } from '../endpoints';\nimport PartyPill from './PartyPill';\n\ninterface Props {\n  ballotName: string;\n  candidateId: string;\n  contestIsCalled: boolean;\n  contestResult: string;\n  isIncumbent: boolean;\n  isWinner: boolean;\n  candidateColors: { [key: string]: any };\n  party: string;\n  totalVotesInContest: number;\n  votes: number;\n}\n\nclass HeadshotCandidateRow extends PureComponent<Props> {\n  static columnCount: number;\n  static Header: VNode;\n\n  render() {\n    const {\n      ballotName,\n      candidateId,\n      contestIsCalled,\n      contestResult,\n      isIncumbent,\n      isWinner,\n      party,\n      isViewable,\n      totalVotesInContest,\n      candidateColors,\n      votes,\n    } = this.props;\n\n    let getColor;\n\n    if (candidateColors) {\n      getColor = candidateColors\n        .filter(obj => obj.name == ballotName)\n        .map(obj => obj.color);\n    } else {\n      getColor = ['#777777'];\n    }\n\n    const divStyle = {\n      'background-color': getColor[0],\n    };\n\n    const checkStyle = {\n      color: getColor[0],\n    };\n\n    const IsAsterisk = ballotName == 'Rick Perry' ? true : false;\n\n    let rowClass = cx(\n      'candidate',\n      'contest__candidate-row',\n      'contest__candidate-row--headshot',\n      {\n        'contest__candidate-row--winner dem--border':\n          contestIsCalled && isWinner && party == 'Democrat',\n        'contest__candidate-row--winner rep--border':\n          contestIsCalled && isWinner && party == 'Republican',\n      }\n    );\n\n    let checkClass = cx('check', {\n      'dem-winner': party == 'Democrat',\n      'rep-winner': party == 'Republican',\n      'runoff-winner': contestResult == 'runoff',\n    });\n\n    if (!isViewable) {\n      rowClass += ' race__candidate-row--hidden';\n    }\n\n    const checkmark = '\\u2713';\n\n    return (\n      <tr class={rowClass}>\n        <td class=\"candidate__cell candidate__party\">\n            <PartyPill party={party} style={divStyle} />\n        </td>\n        <th class=\"candidate__cell candidate__name\">\n          {contestIsCalled && isWinner && contestResult != 'runoff' && (\n            <span class={checkClass} style={checkStyle}>\n              {checkmark}\n            </span>\n          )}\n          {contestIsCalled && isWinner && contestResult == 'runoff' && (\n            <span class={checkClass}>{checkmark}</span>\n          )}\n          {contestIsCalled &&\n          isWinner &&\n          isCanvass == true &&\n          contestResult != 'runoff' ? (\n            <span class={checkClass}>{ballotName}</span>\n          ) : (\n            ballotName\n          )}\n          {IsAsterisk && <span class=\"asterisk\">*</span>}{' '}\n          {isIncumbent && (\n            <span class=\"pill pill--basic\" title=\"Currently holds this seat\">\n              Incumbent\n            </span>\n          )}\n        </th>\n        <td class=\"candidate__cell candidate__votes\">{intcomma(votes)}</td>\n        <td class=\"candidate__cell candidate__pct\">\n          {formatPercent(votes, totalVotesInContest)}\n          <span class=\"candidate__pct-symbol\">%</span>\n        </td>\n      </tr>\n    );\n  }\n}\n\nHeadshotCandidateRow.defaultProps = {\n  isIncumbent: false,\n  isCalled: false,\n  isWinner: false,\n  isViewable: true,\n};\n\nHeadshotCandidateRow.Header = (\n  <thead>\n    <tr>\n      <th class=\"contest__candidate-header\" colSpan={2}>\n        Candidates\n      </th>\n      <th class=\"contest__candidate-header contest__candidate-header--numeric\">\n        Votes\n      </th>\n      <th class=\"contest__candidate-header contest__candidate-header--numeric\">\n        Pct.\n        <span class=\"candidate__pct-symbol\">%</span>\n      </th>\n    </tr>\n  </thead>\n);\n\nHeadshotCandidateRow.columnCount = 6;\n\nexport default HeadshotCandidateRow;\n","export default class FlatQueue {\n  constructor() {\n    this.ids = [];\n    this.values = [];\n    this.length = 0;\n  }\n\n  clear() {\n    this.length = this.ids.length = this.values.length = 0;\n  }\n\n  push(id, value) {\n    this.ids.push(id);\n    this.values.push(value);\n\n    let pos = this.length++;\n    while (pos > 0) {\n      const parent = (pos - 1) >> 1;\n      const parentValue = this.values[parent];\n      if (value >= parentValue) break;\n      this.ids[pos] = this.ids[parent];\n      this.values[pos] = parentValue;\n      pos = parent;\n    }\n\n    this.ids[pos] = id;\n    this.values[pos] = value;\n  }\n\n  pop() {\n    if (this.length === 0) return undefined;\n\n    const top = this.ids[0];\n    this.length--;\n\n    if (this.length > 0) {\n      const id = (this.ids[0] = this.ids[this.length]);\n      const value = (this.values[0] = this.values[this.length]);\n      const halfLength = this.length >> 1;\n      let pos = 0;\n\n      while (pos < halfLength) {\n        let left = (pos << 1) + 1;\n        const right = left + 1;\n        let bestIndex = this.ids[left];\n        let bestValue = this.values[left];\n        const rightValue = this.values[right];\n\n        if (right < this.length && rightValue < bestValue) {\n          left = right;\n          bestIndex = this.ids[right];\n          bestValue = rightValue;\n        }\n        if (bestValue >= value) break;\n\n        this.ids[pos] = bestIndex;\n        this.values[pos] = bestValue;\n        pos = left;\n      }\n\n      this.ids[pos] = id;\n      this.values[pos] = value;\n    }\n\n    this.ids.pop();\n    this.values.pop();\n\n    return top;\n  }\n\n  peek() {\n    return this.ids[0];\n  }\n\n  peekValue() {\n    return this.values[0];\n  }\n}\n","import FlatQueue from './flatqueue';\n\nconst ARRAY_TYPES = [\n  Int8Array,\n  Uint8Array,\n  Uint8ClampedArray,\n  Int16Array,\n  Uint16Array,\n  Int32Array,\n  Uint32Array,\n  Float32Array,\n  Float64Array,\n];\n\nconst VERSION = 3; // serialized format version\n\nexport default class Flatbush {\n  static from(data) {\n    if (!(data instanceof ArrayBuffer)) {\n      throw new Error('Data must be an instance of ArrayBuffer.');\n    }\n    const [magic, versionAndType] = new Uint8Array(data, 0, 2);\n    if (magic !== 0xfb) {\n      throw new Error('Data does not appear to be in a Flatbush format.');\n    }\n    if (versionAndType >> 4 !== VERSION) {\n      throw new Error(\n        `Got v${versionAndType >> 4} data when expected v${VERSION}.`\n      );\n    }\n    const [nodeSize] = new Uint16Array(data, 2, 1);\n    const [numItems] = new Uint32Array(data, 4, 1);\n\n    return new Flatbush(\n      numItems,\n      nodeSize,\n      ARRAY_TYPES[versionAndType & 0x0f],\n      data\n    );\n  }\n\n  constructor(numItems, nodeSize = 16, ArrayType = Float64Array, data) {\n    if (numItems === undefined)\n      throw new Error('Missing required argument: numItems.');\n    if (isNaN(numItems) || numItems <= 0)\n      throw new Error(`Unpexpected numItems value: ${numItems}.`);\n\n    this.numItems = +numItems;\n    this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);\n\n    // calculate the total number of nodes in the R-tree to allocate space for\n    // and the index of each tree level (used in search later)\n    let n = numItems;\n    let numNodes = n;\n    this._levelBounds = [n * 4];\n    do {\n      n = Math.ceil(n / this.nodeSize);\n      numNodes += n;\n      this._levelBounds.push(numNodes * 4);\n    } while (n !== 1);\n\n    this.ArrayType = ArrayType || Float64Array;\n    this.IndexArrayType = numNodes < 16384 ? Uint16Array : Uint32Array;\n\n    const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);\n    const nodesByteSize = numNodes * 4 * this.ArrayType.BYTES_PER_ELEMENT;\n\n    if (arrayTypeIndex < 0) {\n      throw new Error(`Unexpected typed array class: ${ArrayType}.`);\n    }\n\n    if (data && data instanceof ArrayBuffer) {\n      this.data = data;\n      this._boxes = new this.ArrayType(this.data, 8, numNodes * 4);\n      this._indices = new this.IndexArrayType(\n        this.data,\n        8 + nodesByteSize,\n        numNodes\n      );\n\n      this._pos = numNodes * 4;\n      this.minX = this._boxes[this._pos - 4];\n      this.minY = this._boxes[this._pos - 3];\n      this.maxX = this._boxes[this._pos - 2];\n      this.maxY = this._boxes[this._pos - 1];\n    } else {\n      this.data = new ArrayBuffer(\n        8 + nodesByteSize + numNodes * this.IndexArrayType.BYTES_PER_ELEMENT\n      );\n      this._boxes = new this.ArrayType(this.data, 8, numNodes * 4);\n      this._indices = new this.IndexArrayType(\n        this.data,\n        8 + nodesByteSize,\n        numNodes\n      );\n      this._pos = 0;\n      this.minX = Infinity;\n      this.minY = Infinity;\n      this.maxX = -Infinity;\n      this.maxY = -Infinity;\n\n      new Uint8Array(this.data, 0, 2).set([\n        0xfb,\n        (VERSION << 4) + arrayTypeIndex,\n      ]);\n      new Uint16Array(this.data, 2, 1)[0] = nodeSize;\n      new Uint32Array(this.data, 4, 1)[0] = numItems;\n    }\n\n    // a priority queue for k-nearest-neighbors queries\n    this._queue = new FlatQueue();\n  }\n\n  add(minX, minY, maxX, maxY) {\n    const index = this._pos >> 2;\n    this._indices[index] = index;\n    this._boxes[this._pos++] = minX;\n    this._boxes[this._pos++] = minY;\n    this._boxes[this._pos++] = maxX;\n    this._boxes[this._pos++] = maxY;\n\n    if (minX < this.minX) this.minX = minX;\n    if (minY < this.minY) this.minY = minY;\n    if (maxX > this.maxX) this.maxX = maxX;\n    if (maxY > this.maxY) this.maxY = maxY;\n  }\n\n  finish() {\n    if (this._pos >> 2 !== this.numItems) {\n      throw new Error(\n        `Added ${this._pos >> 2} items when expected ${this.numItems}.`\n      );\n    }\n\n    const width = this.maxX - this.minX;\n    const height = this.maxY - this.minY;\n    const hilbertValues = new Uint32Array(this.numItems);\n    const hilbertMax = (1 << 16) - 1;\n\n    // map item centers into Hilbert coordinate space and calculate Hilbert values\n    for (let i = 0; i < this.numItems; i++) {\n      let pos = 4 * i;\n      const minX = this._boxes[pos++];\n      const minY = this._boxes[pos++];\n      const maxX = this._boxes[pos++];\n      const maxY = this._boxes[pos++];\n      const x = Math.floor(\n        (hilbertMax * ((minX + maxX) / 2 - this.minX)) / width\n      );\n      const y = Math.floor(\n        (hilbertMax * ((minY + maxY) / 2 - this.minY)) / height\n      );\n      hilbertValues[i] = hilbert(x, y);\n    }\n\n    // sort items by their Hilbert value (for packing later)\n    sort(hilbertValues, this._boxes, this._indices, 0, this.numItems - 1);\n\n    // generate nodes at each tree level, bottom-up\n    for (let i = 0, pos = 0; i < this._levelBounds.length - 1; i++) {\n      const end = this._levelBounds[i];\n\n      // generate a parent node for each block of consecutive <nodeSize> nodes\n      while (pos < end) {\n        let nodeMinX = Infinity;\n        let nodeMinY = Infinity;\n        let nodeMaxX = -Infinity;\n        let nodeMaxY = -Infinity;\n        const nodeIndex = pos;\n\n        // calculate bbox for the new node\n        for (let i = 0; i < this.nodeSize && pos < end; i++) {\n          const minX = this._boxes[pos++];\n          const minY = this._boxes[pos++];\n          const maxX = this._boxes[pos++];\n          const maxY = this._boxes[pos++];\n          if (minX < nodeMinX) nodeMinX = minX;\n          if (minY < nodeMinY) nodeMinY = minY;\n          if (maxX > nodeMaxX) nodeMaxX = maxX;\n          if (maxY > nodeMaxY) nodeMaxY = maxY;\n        }\n\n        // add the new node to the tree data\n        this._indices[this._pos >> 2] = nodeIndex;\n        this._boxes[this._pos++] = nodeMinX;\n        this._boxes[this._pos++] = nodeMinY;\n        this._boxes[this._pos++] = nodeMaxX;\n        this._boxes[this._pos++] = nodeMaxY;\n      }\n    }\n  }\n\n  search(minX, minY, maxX, maxY, filterFn) {\n    if (this._pos !== this._boxes.length) {\n      throw new Error('Data not yet indexed - call index.finish().');\n    }\n\n    let nodeIndex = this._boxes.length - 4;\n    let level = this._levelBounds.length - 1;\n    const queue = [];\n    const results = [];\n\n    while (nodeIndex !== undefined) {\n      // find the end index of the node\n      const end = Math.min(\n        nodeIndex + this.nodeSize * 4,\n        this._levelBounds[level]\n      );\n\n      // search through child nodes\n      for (let pos = nodeIndex; pos < end; pos += 4) {\n        const index = this._indices[pos >> 2];\n\n        // check if node bbox intersects with query bbox\n        if (maxX < this._boxes[pos]) continue; // maxX < nodeMinX\n        if (maxY < this._boxes[pos + 1]) continue; // maxY < nodeMinY\n        if (minX > this._boxes[pos + 2]) continue; // minX > nodeMaxX\n        if (minY > this._boxes[pos + 3]) continue; // minY > nodeMaxY\n\n        if (nodeIndex < this.numItems * 4) {\n          if (filterFn === undefined || filterFn(index)) {\n            results.push(index); // leaf item\n          }\n        } else {\n          queue.push(index); // node; add it to the search queue\n          queue.push(level - 1);\n        }\n      }\n\n      level = queue.pop();\n      nodeIndex = queue.pop();\n    }\n\n    return results;\n  }\n\n  neighbors(x, y, maxResults = Infinity, maxDistance = Infinity, filterFn) {\n    if (this._pos !== this._boxes.length) {\n      throw new Error('Data not yet indexed - call index.finish().');\n    }\n\n    let nodeIndex = this._boxes.length - 4;\n    const q = this._queue;\n    const results = [];\n    const maxDistSquared = maxDistance * maxDistance;\n\n    while (nodeIndex !== undefined) {\n      // find the end index of the node\n      const end = Math.min(\n        nodeIndex + this.nodeSize * 4,\n        upperBound(nodeIndex, this._levelBounds)\n      );\n\n      // add child nodes to the queue\n      for (let pos = nodeIndex; pos < end; pos += 4) {\n        const index = this._indices[pos >> 2];\n\n        const dx = axisDist(x, this._boxes[pos], this._boxes[pos + 2]);\n        const dy = axisDist(y, this._boxes[pos + 1], this._boxes[pos + 3]);\n        const dist = dx * dx + dy * dy;\n\n        if (nodeIndex < this.numItems * 4) {\n          // leaf node\n          if (filterFn === undefined || filterFn(index)) {\n            // put a negative index if it's an item rather than a node, to recognize later\n            q.push(-index - 1, dist);\n          }\n        } else {\n          q.push(index, dist);\n        }\n      }\n\n      // pop items from the queue\n      while (q.length && q.peek() < 0) {\n        const dist = q.peekValue();\n        if (dist > maxDistSquared) {\n          q.clear();\n          return results;\n        }\n        results.push(-q.pop() - 1);\n\n        if (results.length === maxResults) {\n          q.clear();\n          return results;\n        }\n      }\n\n      nodeIndex = q.pop();\n    }\n\n    q.clear();\n    return results;\n  }\n}\n\nfunction axisDist(k, min, max) {\n  return k < min ? min - k : k <= max ? 0 : k - max;\n}\n\n// binary search for the first value in the array bigger than the given\nfunction upperBound(value, arr) {\n  let i = 0;\n  let j = arr.length - 1;\n  while (i < j) {\n    const m = (i + j) >> 1;\n    if (arr[m] > value) {\n      j = m;\n    } else {\n      i = m + 1;\n    }\n  }\n  return arr[i];\n}\n\n// custom quicksort that sorts bbox data alongside the hilbert values\nfunction sort(values, boxes, indices, left, right) {\n  if (left >= right) return;\n\n  const pivot = values[(left + right) >> 1];\n  let i = left - 1;\n  let j = right + 1;\n\n  while (true) {\n    do i++;\n    while (values[i] < pivot);\n    do j--;\n    while (values[j] > pivot);\n    if (i >= j) break;\n    swap(values, boxes, indices, i, j);\n  }\n\n  sort(values, boxes, indices, left, j);\n  sort(values, boxes, indices, j + 1, right);\n}\n\n// swap two values and two corresponding boxes\nfunction swap(values, boxes, indices, i, j) {\n  const temp = values[i];\n  values[i] = values[j];\n  values[j] = temp;\n\n  const k = 4 * i;\n  const m = 4 * j;\n\n  const a = boxes[k];\n  const b = boxes[k + 1];\n  const c = boxes[k + 2];\n  const d = boxes[k + 3];\n  boxes[k] = boxes[m];\n  boxes[k + 1] = boxes[m + 1];\n  boxes[k + 2] = boxes[m + 2];\n  boxes[k + 3] = boxes[m + 3];\n  boxes[m] = a;\n  boxes[m + 1] = b;\n  boxes[m + 2] = c;\n  boxes[m + 3] = d;\n\n  const e = indices[i];\n  indices[i] = indices[j];\n  indices[j] = e;\n}\n\n// Fast Hilbert curve algorithm by http://threadlocalmutex.com/\n// Ported from C++ https://github.com/rawrunprotected/hilbert_curves (public domain)\nfunction hilbert(x, y) {\n  let a = x ^ y;\n  let b = 0xffff ^ a;\n  let c = 0xffff ^ (x | y);\n  let d = x & (y ^ 0xffff);\n\n  let A = a | (b >> 1);\n  let B = (a >> 1) ^ a;\n  let C = (c >> 1) ^ (b & (d >> 1)) ^ c;\n  let D = (a & (c >> 1)) ^ (d >> 1) ^ d;\n\n  a = A;\n  b = B;\n  c = C;\n  d = D;\n  A = (a & (a >> 2)) ^ (b & (b >> 2));\n  B = (a & (b >> 2)) ^ (b & ((a ^ b) >> 2));\n  C ^= (a & (c >> 2)) ^ (b & (d >> 2));\n  D ^= (b & (c >> 2)) ^ ((a ^ b) & (d >> 2));\n\n  a = A;\n  b = B;\n  c = C;\n  d = D;\n  A = (a & (a >> 4)) ^ (b & (b >> 4));\n  B = (a & (b >> 4)) ^ (b & ((a ^ b) >> 4));\n  C ^= (a & (c >> 4)) ^ (b & (d >> 4));\n  D ^= (b & (c >> 4)) ^ ((a ^ b) & (d >> 4));\n\n  a = A;\n  b = B;\n  c = C;\n  d = D;\n  C ^= (a & (c >> 8)) ^ (b & (d >> 8));\n  D ^= (b & (c >> 8)) ^ ((a ^ b) & (d >> 8));\n\n  a = C ^ (C >> 1);\n  b = D ^ (D >> 1);\n\n  let i0 = x ^ y;\n  let i1 = b | (0xffff ^ (i0 | a));\n\n  i0 = (i0 | (i0 << 8)) & 0x00ff00ff;\n  i0 = (i0 | (i0 << 4)) & 0x0f0f0f0f;\n  i0 = (i0 | (i0 << 2)) & 0x33333333;\n  i0 = (i0 | (i0 << 1)) & 0x55555555;\n\n  i1 = (i1 | (i1 << 8)) & 0x00ff00ff;\n  i1 = (i1 | (i1 << 4)) & 0x0f0f0f0f;\n  i1 = (i1 | (i1 << 2)) & 0x33333333;\n  i1 = (i1 | (i1 << 1)) & 0x55555555;\n\n  return ((i1 << 1) | i0) >>> 0;\n}\n","import { feature, mesh } from 'topojson-client';\nimport getBBox from '@turf/bbox';\n\nimport Flatbush from '../vendor/flatbush';\n\nconst innerCompare = (a: TopoJSON.GeometryObject, b: TopoJSON.GeometryObject) =>\n  a !== b;\nconst outerCompare = (a: TopoJSON.GeometryObject, b: TopoJSON.GeometryObject) =>\n  a === b;\n\nfunction prepareTopoJSON(topology: TopoJSON.Topology, key?: string) {\n  const object = topology.objects[\n    key || Object.keys(topology.objects)[0]\n  ] as TopoJSON.GeometryCollection;\n  const roadsObject = topology.objects['roads'] as TopoJSON.GeometryCollection;\n  const placesObject = topology.objects[\n    'places'\n  ] as TopoJSON.GeometryCollection;\n  const urbanAreasObject = topology.objects[\n    'urban_areas'\n  ] as TopoJSON.GeometryCollection;\n\n  const collection = feature(topology, object);\n  const roads = feature(topology, roadsObject);\n  const places = feature(topology, placesObject);\n  const urban_areas = feature(topology, urbanAreasObject);\n  // const innerlines = mesh(topology, object, innerCompare);\n  // const outerlines = mesh(topology, object, outerCompare);\n  const bbox = topology.bbox || getBBox(collection);\n\n  const index = new Flatbush(collection.features.length);\n  collection.features.forEach(feature => {\n    const bounds = getBBox(feature);\n    index.add(...bounds);\n  });\n  index.finish();\n\n  const heightRatio = (bbox[3] - bbox[1]) / (bbox[2] - bbox[0]);\n\n  return {\n    collection,\n    // features,\n    // innerlines,\n    // outerlines,\n    bbox,\n    heightRatio,\n    index,\n    roads,\n    places,\n    urban_areas,\n  };\n}\n\nexport default prepareTopoJSON;\n","export default x => x;\n","function formatPercent(n: number, d: number): string {\n  if (d == null || d <= 0) return '0.0';\n\n  return ((n / d) * 100).toFixed(1);\n}\n\nexport default formatPercent;\n","'use strict';\n\n// We depend on intersection-observer enough that it should just be assumed as necessary\nrequire('intersection-observer');\n","/**\n * Grabs the contents of a `jsonScript` created JSON inline string and returns\n * it as a JSON object. If the element does not exist, or if the script\n * element does not have the JSON MIME type, null is returned instead.\n *\n * @param  {String} elementId the ID of the JSON script element\n * @return {Object|null}\n */\nexport default function loadAssetURL(elementId) {\n  const element = document.getElementById(elementId);\n\n  if (element && element.getAttribute('type') === 'application/json') {\n    return JSON.parse(element.textContent).asset_url;\n  } else {\n    return null;\n  }\n}\n","export var epsilon = 1e-6;\nexport var epsilon2 = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var quarterPi = pi / 4;\nexport var tau = pi * 2;\n\nexport var degrees = 180 / pi;\nexport var radians = pi / 180;\n\nexport var abs = Math.abs;\nexport var atan = Math.atan;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var ceil = Math.ceil;\nexport var exp = Math.exp;\nexport var floor = Math.floor;\nexport var hypot = Math.hypot;\nexport var log = Math.log;\nexport var pow = Math.pow;\nexport var sin = Math.sin;\nexport var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };\nexport var sqrt = Math.sqrt;\nexport var tan = Math.tan;\n\nexport function acos(x) {\n  return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n  return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);\n}\n\nexport function haversin(x) {\n  return (x = sin(x / 2)) * x;\n}\n","import { h, render } from 'preact';\n\nimport { delay } from './election-utils';\n\nimport { setUpAnchors } from './packs/sticky-nav-bar';\n\nimport selectAll from './utils/select-all';\n\n// just in case this gets removed\nwindow.ttData = window.ttData || {};\n\n// related content\nconst relatedContentContainer = document.getElementById(\n  'related-content-container'\n);\n\nif (relatedContentContainer && window.ttData.related_category) {\n  import(\n    /* webpackChunkName: \"RelatedContent\" */ './components/RelatedContent'\n  ).then(({ default: RelatedContent }) =>\n    render(\n      <RelatedContent title={'Read more'} related_category={window.ttData.related_category} />,\n      relatedContentContainer\n    )\n  );\n}\n\n// ads\nimport(/* webpackChunkName: \"ads\" */ './utils/ad-loader').then(\n  ({ default: AdLoader }) => {\n    delay(function() {\n      const ads = new AdLoader();\n      ads.init();\n      const anchorJumps = selectAll('a.anchor', document);\n      setUpAnchors(anchorJumps);\n    }, 600); // end delay\n  }\n);\n","import { Component, h, render } from 'preact';\n\nclass Portal extends Component {\n  componentDidMount() {\n    this.renderPortal();\n  }\n\n  componentWillUnmount() {\n    if (this.defaultNode) {\n      document.body.removeChild(this.defaultNode);\n    } else {\n      // Unmount the children rendered in custom node\n      render(null, this.props.node, this.portal);\n    }\n\n    this.defaultNode = null;\n    this.portal = null;\n  }\n\n  componentDidUpdate() {\n    this.renderPortal();\n  }\n\n  renderPortal() {\n    if (!this.props.node && !this.defaultNode) {\n      this.defaultNode = document.createElement('div');\n      document.body.appendChild(this.defaultNode);\n    }\n\n    const children = this.props.children;\n\n    this.portal = render(\n      (children && children[0]) || null,\n      this.props.node || this.defaultNode,\n      this.portal\n    );\n  }\n\n  render() {\n    return null;\n  }\n}\n\nexport default Portal;\n","const userAgent = navigator.userAgent;\n\nexport function isThisIE(): boolean {\n  return /Trident|MSIE|IEMobile/i.test(userAgent);\n}\n","// packages\nimport { geoIdentity, GeoIdentityTransform } from 'd3-geo';\nimport { Component, h } from 'preact';\n\n// components\nimport Contest from './Contest';\n// import CountyTable from './CountyTable';\nimport HeadshotCandidateRow from './HeadshotCandidateRow';\nimport LayeredMap from './LayeredMap';\nimport Portal from './Portal';\n\n// utils\nimport { isThisIE } from '../utils/platform';\nimport { determineContestTitle } from '../election-utils';\nimport AnalysisTable from './AnalysisTable';\n\nimport { GOVERNOR, AG } from '../colors';\n\nimport { visibleCandidatesCount, showCategoriesMap } from '../endpoints';\n\nimport topology from 'Assets/geography/texas_urban.json';\n\nconst isIE = isThisIE();\n\ninterface ContestShowcaseProps {\n  container: Element;\n  contest: any | null;\n  notes: { [key: string]: any };\n  asOf: string;\n  annotations: { [key: string]: any };\n}\n\ninterface ContestShowcaseState {\n  contestContainer: Element;\n  mapContainer: Element;\n  countiesContainer: Element;\n}\n\nclass ContestShowcase extends Component<\n  ContestShowcaseProps,\n  ContestShowcaseState\n> {\n  projection: GeoIdentityTransform;\n\n  constructor() {\n    super();\n\n    this.projection = geoIdentity().reflectY(true);\n  }\n\n  componentDidMount() {\n    const { container } = this.props;\n\n    const contestContainer = container.querySelector('.contest-container');\n    const mapContainer = container.querySelector('.contest-map-container');\n    const countiesContainer = container.querySelector(\n      '.contest-counties-container'\n    );\n\n    this.setState({ contestContainer, mapContainer, countiesContainer });\n  }\n\n  render() {\n    const { contest, asOf, notes, annotations } = this.props;\n    const { contestContainer, mapContainer, countiesContainer } = this.state;\n\n    const firstShowcaseRace = contest && contest.office == 'Governor';\n\n    let candidatesRender, sourceMap;\n\n    if (contest) {\n      let candidates = contest.candidacies;\n\n      // Adding the colors and new ids for the candidates in the showcase spot\n\n      candidatesRender = firstShowcaseRace\n        ? GOVERNOR.map(object => {\n            const result = candidates\n              .filter(obj => obj.name == object.name)\n              .map(obj => obj.id);\n            return { ...object, id: result[0] };\n          })\n        : AG.map(object => {\n            const result = candidates\n              .filter(obj => obj.name == object.name)\n              .map(obj => obj.id);\n            return { ...object, id: result[0] };\n          });\n\n      sourceMap = contest.source;\n\n    }\n\n    if (!contest) return null;\n\n    return (\n      <span>\n        {contestContainer && (\n          <Portal\n            node={contestContainer}\n            ref={ref => (this._contestPortal = ref)}\n          >\n            <Contest\n              contest={contest}\n              key={contest.id}\n              contestTitle={determineContestTitle(contest)}\n              isShowcaseRace\n              candidatesRender={candidatesRender}\n              partyName={contest.party}\n              annotations={annotations}\n              notes={notes}\n              asOf={asOf}\n              source={contest.source}\n              tableHeader={HeadshotCandidateRow.Header}\n              columnCount={HeadshotCandidateRow.columnCount}\n              renderCandidate={(\n                candidate: any,\n                idx: number,\n                candidatesRender: any,\n                viewAllCandidates: any,\n                { totalVotes }: { totalVotes: number }\n              ) => (\n                <HeadshotCandidateRow\n                  key={candidate.id}\n                  ballotName={candidate.name}\n                  candidateId={candidate.id}\n                  contestIsCalled={contest.is_called}\n                  contestResult={contest.contest_result}\n                  isIncumbent={candidate.is_incumbent}\n                  isWinner={candidate.is_winner}\n                  isViewable={viewAllCandidates || idx < visibleCandidatesCount}\n                  party={candidate.party}\n                  candidateColors={candidatesRender}\n                  totalVotesInContest={totalVotes}\n                  votes={candidate.votes}\n                />\n              )}\n            />\n          </Portal>\n        )}\n        {!isIE && mapContainer && (\n          <Portal node={mapContainer} ref={ref => (this._mapPortal = ref)}>\n            <LayeredMap\n              topology={topology}\n              projection={this.projection}\n              candidates={contest.candidacies}\n              candidatesRender={candidatesRender}\n              source={sourceMap}\n              counties={contest.counties}\n              precinctsReporting={contest.precincts_reporting}\n              totalVotes={contest.total_votes}\n            />\n          </Portal>\n        )}\n      </span>\n    );\n  }\n}\n\nexport default ContestShowcase;\n","import * as d3 from 'd3';\nimport { Component, h } from 'preact';\n\nimport { DEMOCRAT, REPUBLICAN } from '../colors';\n\nclass BalancePower extends Component {\n  constructor() {\n    super();\n\n    this.state = {\n      width: null,\n      height: 80,\n      bodyWidth: null,\n      breakPoint: 544,\n    };\n\n    this.createGraphic = this.createGraphic.bind(this);\n    this.redrawGraphic = this.redrawGraphic.bind(this);\n    this.getContainerWidth = this.getContainerWidth.bind(this);\n  }\n\n  componentDidMount() {\n    window.addEventListener('resize', () => {\n      this.redrawGraphic();\n    });\n  }\n\n  createGraphic(className, pastData, currentData) {\n    let { width, bodyWidth } = this.getContainerWidth(className);\n\n    let { height, breakPoint } = this.state;\n    let prevdata = [\n      {\n        start: pastData.republican,\n        end: pastData.republican + pastData.democrat,\n        color: DEMOCRAT,\n        party: 'Democrats',\n        seats: pastData.democrat,\n      },\n      {\n        start: 0,\n        end: pastData.republican,\n        color: REPUBLICAN,\n        party: 'Republicans',\n        seats: pastData.republican,\n      },\n    ];\n\n    let currentElection = [\n      {\n        start:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant +\n          currentData.democrat,\n        startText:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant,\n        end:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant +\n          currentData.democrat +\n          currentData.uncontested_democrat,\n        color: '#113a85',\n        party: 'Uncontested-Democrats',\n        seats: currentData.uncontested_democrat,\n      },\n      {\n        start:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant,\n        startText:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant,\n        end:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant +\n          currentData.democrat,\n        color: DEMOCRAT,\n        party: 'Democrats',\n        seats: currentData.democrat + currentData.uncontested_democrat,\n      },\n      {\n        start: currentData.republican + currentData.uncontested_republican,\n        end:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant,\n        color: '#bdbdbd',\n        party: 'Up for Grabs',\n        seats: currentData.vacant,\n      },\n      {\n        start: currentData.uncontested_republican,\n        startText: 0,\n        end: currentData.republican + currentData.uncontested_republican,\n        color: REPUBLICAN,\n        party: 'Republicans',\n        seats: currentData.republican + currentData.uncontested_republican,\n      },\n      {\n        start: 0,\n        startText: 0,\n        end: currentData.uncontested_republican,\n        color: '#ab261b',\n        party: 'Uncontested-Republicans',\n        seats: currentData.uncontested_republican,\n      },\n    ];\n\n    d3.selectAll(`.${className}-graphic-previous svg`).remove();\n\n    d3.selectAll(`.${className}-graphic-current svg`).remove();\n\n    // chart setup\n    let margin = { top: 0, bottom: 0, right: 0, left: 0 };\n\n    (width = width - margin.left - margin.right),\n      (height = height - margin.top - margin.bottom);\n\n    const isMobile = bodyWidth < breakPoint;\n\n    let svg = d3\n      .select(`.${className}-graphic-previous`)\n      .append('svg')\n      .attr('width', width + margin.left + margin.right)\n      .attr('height', height + margin.top + margin.bottom);\n\n    let svgCurrent = d3\n      .select(`.${className}-graphic-current`)\n      .append('svg')\n      .attr('width', width + margin.left + margin.right)\n      .attr('height', height + margin.top + margin.bottom + 85);\n\n    let diagonalStripePattern = svgCurrent\n      .append('defs')\n      .append('pattern')\n      .attr('id', 'diagonal-stripe')\n      .attr('patternUnits', 'userSpaceOnUse')\n      .attr('patternTransform', 'rotate(45 0 0)')\n      .attr('width', 6)\n      .attr('height', 6);\n\n    diagonalStripePattern\n      .append('rect')\n      .attr('width', 6)\n      .attr('height', 6)\n      .style('fill', '#d9d9d9');\n\n    diagonalStripePattern\n      .append('line')\n      .attr('x1', 0)\n      .attr('y1', 0)\n      .attr('x2', 0)\n      .attr('y2', 6)\n      .style('stroke', 'black')\n      .style('stroke-width', 0.5);\n\n    let g = svg\n      .append('g')\n      .attr('class', `${className}-graphic-past-group`)\n      .attr('width', width)\n      .attr('transform', `translate(${margin.left},${margin.top})`);\n\n    let gCurrent = svgCurrent\n      .append('g')\n      .attr('class', `${className}-graphic-current-group`)\n      .attr('width', width)\n      .attr('transform', `translate(${margin.left},${margin.top})`);\n\n    let x = d3.scaleLinear().domain([0, pastData.total]).range([0, width]);\n\n    let xCurrent = d3\n      .scaleLinear()\n      .domain([0, currentData.total])\n      .range([0, width]);\n\n    let pastBar = g\n      .selectAll('g')\n      .data(prevdata)\n      .enter()\n      .append('g')\n      .attr('transform', 'translate(0,' + 30 + ')');\n\n    pastBar\n      .append('rect')\n      .attr('class', 'past-bar')\n      .attr('width', (d) => x(d.end - d.start))\n      .attr('x', (d) => x(d.start))\n      .attr('fill', (d) => d.color)\n      .attr('height', 20);\n\n    g.selectAll('.bar-title')\n      .data(prevdata)\n      .enter()\n      .append('text')\n      .attr('class', (d) => `bar-title text-${d.party}`)\n      .attr('text-anchor', 'start')\n      .attr('x', (d, i) => (i == 1 ? x(d.start) : width - 110))\n      .attr('y', 20)\n      .style('fill', (d) => `${d.color}`)\n      .attr('height', 10)\n      .text((d) => `${d.seats} ${d.party}`);\n\n    let currentBar = gCurrent\n      .selectAll('g')\n      .data(currentElection)\n      .enter()\n      .append('g')\n      .attr('transform', 'translate(0,' + 60 + ')');\n\n    currentBar\n      .append('rect')\n      .attr('class', (d) => {\n        if (d.party == 'Up for Grabs') return 'current-bar dashed-line';\n        else return 'current-bar';\n      })\n      .attr('width', (d) => xCurrent(d.end - d.start))\n      .attr('x', (d) => xCurrent(d.start))\n      .attr('fill', (d) => d.color)\n      .attr('height', 20);\n\n    let currentText = gCurrent\n      .selectAll('.bar-title')\n      .data(currentElection)\n      .enter()\n      .append('text')\n      .filter(\n        (d) =>\n          d.party !== 'Up for Grabs' &&\n          d.party !== 'Uncontested-Republicans' &&\n          d.party !== 'Uncontested-Democrats'\n      )\n      .attr('class', (d) => `bar-title current-text-${className}-${d.party}`)\n      .attr('text-anchor', 'start')\n      .attr('x', (d, i) => (i == 1 ? xCurrent(d.startText) : width - 110))\n      .attr('y', 30)\n      .style('fill', (d) => `${d.color}`)\n      .attr('height', 10)\n      .text((d) => `${d.seats} ${d.party}`);\n\n    // Text for uncontested seats\n\n    let TextUncontested = gCurrent\n      .selectAll('.bar-title-uncontested')\n      .data(\n        currentElection.sort(function (a, b) {\n          if (a.party < b.party) {\n            return -1;\n          }\n          if (a.party > b.party) {\n            return 1;\n          }\n          return 0;\n        })\n      )\n      .enter()\n      .append('text')\n      .filter(\n        (d) =>\n          d.party !== 'Up for Grabs' &&\n          d.party !== 'Republicans' &&\n          d.party !== 'Democrats'\n      )\n      .attr(\n        'class',\n        (d) => `bar-title-uncontested ${className}-uncontested-text-${d.party}`\n      )\n      .attr('text-anchor', 'start')\n      .attr('y', 50)\n      .style('fill', (d) => `${d.color}`)\n      .attr('height', 10)\n      .text((d, i) =>\n        i == 1\n          ? `${currentData.uncontested_republican} were uncontested`\n          : `${currentData.uncontested_democrat} were uncontested`\n      );\n\n    let textWidth, textWidthUncontested;\n\n    let textSelection = d3\n      .select(`.current-text-${className}-Democrats`)\n      .node();\n    let textSelection2 = d3\n      .select(`.${className}-uncontested-text-Uncontested-Democrats`)\n      .node();\n\n    if (textSelection) {\n      textWidth = textSelection.getComputedTextLength();\n      textWidthUncontested = textSelection2.getComputedTextLength();\n    }\n\n    currentText.attr('x', (d, i) =>\n      i == 1 ? xCurrent(d.startText) : width - textWidth\n    );\n    TextUncontested.attr('x', (d, i) =>\n      i == 1 ? xCurrent(d.startText) : width - textWidthUncontested\n    );\n\n    gCurrent\n      .selectAll('.bar-title-contested')\n      .data(currentElection)\n      .enter()\n      .append('text')\n      .filter((d) => d.party == 'Up for Grabs')\n      .attr('class', `bar-title-contested`)\n      .attr('text-anchor', 'start')\n      .attr('x', width / 3)\n      .attr('y', className == 'us-house' ? height + 40 : height + 65)\n      .style('fill', '#4a4a4a')\n      .attr('height', 10)\n      .text((d, i) =>\n        currentData.vacant > 0\n          ? `${currentData.vacant} seat${\n              currentData.vacant > 1 ? 's' : ''\n            } still up for grabs`\n          : ``\n      );\n\n    if (className != 'us-house') {\n      g.append('line')\n        .attr('x1', x(currentData.halfway))\n        .attr('x2', x(currentData.halfway))\n        .attr('y1', 10)\n        .attr('y2', height - 10)\n        .attr('class', 'annotation-line');\n\n      gCurrent\n        .append('line')\n        .attr('x1', xCurrent(currentData.halfway))\n        .attr('x2', xCurrent(currentData.halfway))\n        .attr('y1', 40)\n        .attr('y2', height + 20)\n        .attr('class', 'annotation-line');\n\n      gCurrent\n        .append('text')\n        .attr('class', `text-majority`)\n        .attr('text-anchor', 'start')\n        .attr('x', xCurrent(currentData.halfway) - 8)\n        .attr('y', height + 35)\n        .style('fill', '#000')\n        .text((d, i) => `${currentData.halfway}`);\n    }\n  }\n\n  getContainerWidth(className) {\n    let base;\n\n    const body = d3.select('body');\n\n    base = d3.select(`.${className}-balance-graphic`);\n\n    const width = base.node().offsetWidth;\n    const bodyWidth = body.node().offsetWidth;\n\n    return { width, bodyWidth };\n  }\n\n  redrawGraphic() {\n    const { className, pastData, currentData } = this.props;\n\n    d3.selectAll(`.${className}-graphic-previous svg`).remove();\n    d3.selectAll(`.${className}-graphic-current svg`).remove();\n\n    let { width, bodyWidth } = this.getContainerWidth(className);\n\n    this.setState({ width: width, bodyWidth: bodyWidth });\n    this.createGraphic(className, pastData, currentData);\n  }\n\n  componentWillUnmount() {\n    window.addEventListener('resize', () => {\n      this.redrawGraphic();\n    });\n  }\n\n  render() {\n    const { className, pastData, currentData, chamber } = this.props;\n\n    this.createGraphic(className, pastData, currentData);\n\n    const chamberText =\n      chamber == 'U.S. House'\n        ? 'Texas delegation in'\n        : 'the balance of power in';\n\n    return (\n      <div id='balance-graphics'>\n        <p class='t-copy copy--narrative'>\n          {`For the last two years, ${chamberText} the ${chamber} has looked like this: `}\n        </p>\n        <div class={`${className}-graphic-previous`}></div>\n        <p class='t-copy copy--narrative'>\n          {`Results are in. Here is what the breakdown will look like:`}\n        </p>\n        <div class={`${className}-graphic-current`}></div>\n      </div>\n    );\n  }\n}\n\nexport default BalancePower;\n","import * as d3 from 'd3';\nimport { Component, h } from 'preact';\n\nimport find from '../utils/find';\n\nimport { DEMOCRAT, REPUBLICAN } from '../colors';\n\nclass MiniBalancePower extends Component {\n  constructor() {\n    super();\n\n    this.state = {\n      width: null,\n      height: 30,\n      bodyWidth: null,\n      breakPoint: 544,\n    };\n\n    this.createGraphic = this.createGraphic.bind(this);\n    this.redrawGraphic = this.redrawGraphic.bind(this);\n    this.prepareData = this.prepareData.bind(this);\n    this.getContainerWidth = this.getContainerWidth.bind(this);\n  }\n\n  componentDidMount() {\n    window.addEventListener('resize', () => {\n      this.redrawGraphic();\n    });\n  }\n\n  prepareData(data, className, chamber, total, halfway) {\n    let republican = 0,\n      democrat = 0,\n      vacant = 0,\n      uncontested_republican = 0,\n      uncontested_democrat = 0;\n\n    data.forEach((contest) => {\n      if (\n        contest.contest_result == 'not called' &&\n        contest.candidacies.length > 1\n      ) {\n        vacant++;\n      } else if (\n        (contest.contest_result == 'not called' ||\n          contest.contest_result == 'winner') &&\n        contest.candidacies.length == 1 &&\n        contest.candidacies[0].party == 'Republican'\n      ) {\n        uncontested_republican++;\n      } else if (\n        (contest.contest_result == 'not called' ||\n          contest.contest_result == 'winner') &&\n        contest.candidacies.length == 1 &&\n        contest.candidacies[0].party == 'Democrat'\n      ) {\n        uncontested_democrat++;\n      } else if (\n        contest.contest_result == 'winner' &&\n        contest.candidacies.length > 1 &&\n        find(contest.candidacies, (candidate) => candidate.is_winner === true)\n          .party == 'Republican'\n      ) {\n        republican++;\n      } else if (\n        contest.contest_result == 'winner' &&\n        contest.candidacies.length > 1 &&\n        find(contest.candidacies, (candidate) => candidate.is_winner === true)\n          .party == 'Democrat'\n      ) {\n        democrat++;\n      }\n    });\n\n    return {\n      chamber: chamber,\n      className: className,\n      republican: republican,\n      democrat: democrat,\n      vacant: vacant,\n      halfway: halfway,\n      total: total,\n      uncontested_republican: uncontested_republican,\n      uncontested_democrat: uncontested_democrat,\n    };\n  }\n\n  createGraphic(className, currentData) {\n    let { width, bodyWidth } = this.getContainerWidth(className);\n\n    let { height, breakPoint } = this.state;\n\n    let currentElection = [\n      {\n        start:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant,\n        end:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant +\n          currentData.democrat +\n          currentData.uncontested_democrat,\n        color: DEMOCRAT,\n        party: 'Democrats',\n        seats: currentData.democrat + currentData.uncontested_democrat,\n      },\n      {\n        start: currentData.republican + currentData.uncontested_republican,\n        end:\n          currentData.republican +\n          currentData.uncontested_republican +\n          currentData.vacant,\n        color: '#bdbdbd',\n        party: 'Up for Grabs',\n        seats: currentData.vacant,\n      },\n      {\n        start: 0,\n        end: currentData.republican + currentData.uncontested_republican,\n        color: REPUBLICAN,\n        party: 'Republicans',\n        seats: currentData.republican + currentData.uncontested_republican,\n      },\n    ];\n\n    d3.selectAll(`.${className}-graphic-mini svg`).remove();\n\n    // chart setup\n    let margin = { top: 5, bottom: 0, right: 0, left: 0 };\n\n    (width = width - margin.left - margin.right),\n      (height = height - margin.top - margin.bottom);\n\n    const isMobile = bodyWidth < breakPoint;\n\n    let svg = d3\n      .select(`.${className}-graphic-mini`)\n      .append('svg')\n      .attr('width', width + margin.left + margin.right)\n      .attr('height', height + margin.top + margin.bottom);\n\n    let diagonalStripePattern = svg\n      .append('defs')\n      .append('pattern')\n      .attr('id', 'diagonal-stripe')\n      .attr('patternUnits', 'userSpaceOnUse')\n      .attr('patternTransform', 'rotate(45 0 0)')\n      .attr('width', 6)\n      .attr('height', 6);\n\n    diagonalStripePattern\n      .append('rect')\n      .attr('width', 6)\n      .attr('height', 6)\n      .style('fill', '#d9d9d9');\n\n    diagonalStripePattern\n      .append('line')\n      .attr('x1', 0)\n      .attr('y1', 0)\n      .attr('x2', 0)\n      .attr('y2', 6)\n      .style('stroke', 'black')\n      .style('stroke-width', 0.5);\n\n    let g = svg\n      .append('g')\n      .attr('class', `${className}-graphic-mini-group`)\n      .attr('width', width)\n      .attr('transform', `translate(${margin.left},${margin.top})`);\n\n    let xCurrent = d3\n      .scaleLinear()\n      .domain([0, currentData.total])\n      .range([0, width]);\n\n    let currentBar = g\n      .selectAll('g')\n      .data(currentElection)\n      .enter()\n      .append('g')\n      .attr('transform', 'translate(0,' + 5 + ')');\n\n    currentBar\n      .append('rect')\n      .attr('class', 'current-bar')\n      .attr('width', (d) => xCurrent(d.end - d.start))\n      .attr('x', (d) => xCurrent(d.start))\n      .attr('fill', (d) => d.color)\n      .attr('height', 10);\n\n    if (className != 'us-house') {\n      g.append('line')\n        .attr('x1', xCurrent(currentData.halfway))\n        .attr('x2', xCurrent(currentData.halfway))\n        .attr('y1', 0)\n        .attr('y2', height)\n        .attr('class', 'annotation-line');\n    }\n  }\n\n  getContainerWidth(className) {\n    let base;\n\n    const body = d3.select('body');\n\n    base = d3.select(`.mini-${className}`);\n\n    const width = base.node().offsetWidth;\n    const bodyWidth = body.node().offsetWidth;\n\n    return { width, bodyWidth };\n  }\n\n  redrawGraphic() {\n    const { className, currentData } = this.props;\n\n    d3.selectAll(`.${className}-graphic-mini svg`).remove();\n\n    let { width, bodyWidth } = this.getContainerWidth(className);\n\n    this.setState({ width: width, bodyWidth: bodyWidth });\n    this.createGraphic(className, currentData);\n  }\n\n  componentWillUnmount() {\n    window.addEventListener('resize', () => {\n      this.redrawGraphic();\n    });\n  }\n\n  render() {\n    const { className, currentData } = this.props;\n\n    const upForGrabs = (\n      <div>\n        {currentData.vacant > 0 && (\n          <div>\n            There {currentData.vacant > 1 ? 'are' : 'is'} {currentData.vacant}{' '}\n            seat\n            {currentData.vacant > 1 ? 's' : ''} up for grabs.\n          </div>\n        )}\n        <div>\n          {currentData.uncontested_republican +\n            currentData.uncontested_democrat}{' '}\n          seats uncontested.\n        </div>\n      </div>\n    );\n\n    const partisanBreakdown = (\n      <div class='mini-balance-of-power-text'>\n        <div class='republican-mini-balance'>\n          <span class='rep-winner'>\n            {currentData.republican + currentData.uncontested_republican} R\n          </span>\n        </div>\n        <div class='democrat-mini-balance'>\n          <span class='dem-winner'>\n            {currentData.democrat + currentData.uncontested_democrat} D\n          </span>\n        </div>\n      </div>\n    );\n\n    const totalSeats = `${\n      currentData.uncontested_republican > 0 && currentData.total\n    } seats`;\n\n    this.createGraphic(className, currentData);\n    return (\n      <div class='mini-balance-power-graphic'>\n        <div class={`mini-balance-power-up-for-grabs`}>\n          {currentData.uncontested_republican > 0 && totalSeats}\n        </div>\n        <div class={`${className}-graphic-mini`}></div>\n        {currentData.uncontested_republican > 0 && partisanBreakdown}\n        <div class={`mini-balance-power-partisan-breakdown`}>\n          {currentData.uncontested_republican > 0 && upForGrabs}\n        </div>\n      </div>\n    );\n  }\n}\n\nexport default MiniBalancePower;\n","const RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nfunction getClientPosition(elem) {\n  let box;\n  let x;\n  let y;\n  const doc = elem.ownerDocument;\n  const body = doc.body;\n  const docElem = doc && doc.documentElement;\n  // 根据 GBS 最新数据，A-Grade Browsers 都已支持 getBoundingClientRect 方法，不用再考虑传统的实现方式\n  box = elem.getBoundingClientRect();\n\n  // 注：jQuery 还考虑减去 docElem.clientLeft/clientTop\n  // 但测试发现，这样反而会导致当 html 和 body 有边距/边框样式时，获取的值不正确\n  // 此外，ie6 会忽略 html 的 margin 值，幸运地是没有谁会去设置 html 的 margin\n\n  x = box.left;\n  y = box.top;\n\n  // In IE, most of the time, 2 extra pixels are added to the top and left\n  // due to the implicit 2-pixel inset border.  In IE6/7 quirks mode and\n  // IE6 standards mode, this border can be overridden by setting the\n  // document element's border to zero -- thus, we cannot rely on the\n  // offset always being 2 pixels.\n\n  // In quirks mode, the offset can be determined by querying the body's\n  // clientLeft/clientTop, but in standards mode, it is found by querying\n  // the document element's clientLeft/clientTop.  Since we already called\n  // getClientBoundingRect we have already forced a reflow, so it is not\n  // too expensive just to query them all.\n\n  // ie 下应该减去窗口的边框吧，毕竟默认 absolute 都是相对窗口定位的\n  // 窗口边框标准是设 documentElement ,quirks 时设置 body\n  // 最好禁止在 body 和 html 上边框 ，但 ie < 9 html 默认有 2px ，减去\n  // 但是非 ie 不可能设置窗口边框，body html 也不是窗口 ,ie 可以通过 html,body 设置\n  // 标准 ie 下 docElem.clientTop 就是 border-top\n  // ie7 html 即窗口边框改变不了。永远为 2\n  // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框，即使设了 border-top 也为 0\n\n  x -= docElem.clientLeft || body.clientLeft || 0;\n  y -= docElem.clientTop || body.clientTop || 0;\n\n  return {\n    left: x,\n    top: y,\n  };\n}\n\nfunction getScroll(w, top) {\n  let ret = w[`page${top ? 'Y' : 'X'}Offset`];\n  const method = `scroll${top ? 'Top' : 'Left'}`;\n  if (typeof ret !== 'number') {\n    const d = w.document;\n    // ie6,7,8 standard mode\n    ret = d.documentElement[method];\n    if (typeof ret !== 'number') {\n      // quirks mode\n      ret = d.body[method];\n    }\n  }\n  return ret;\n}\n\nfunction getScrollLeft(w) {\n  return getScroll(w);\n}\n\nfunction getScrollTop(w) {\n  return getScroll(w, true);\n}\n\nfunction getOffset(el) {\n  const pos = getClientPosition(el);\n  const doc = el.ownerDocument;\n  const w = doc.defaultView || doc.parentWindow;\n  pos.left += getScrollLeft(w);\n  pos.top += getScrollTop(w);\n  return pos;\n}\nfunction _getComputedStyle(elem, name, computedStyle_) {\n  let val = '';\n  const d = elem.ownerDocument;\n  const computedStyle =\n    computedStyle_ || d.defaultView.getComputedStyle(elem, null);\n\n  // https://github.com/kissyteam/kissy/issues/61\n  if (computedStyle) {\n    val = computedStyle.getPropertyValue(name) || computedStyle[name];\n  }\n\n  return val;\n}\n\nconst _RE_NUM_NO_PX = new RegExp(`^(${RE_NUM})(?!px)[a-z%]+$`, 'i');\nconst RE_POS = /^(top|right|bottom|left)$/;\nconst CURRENT_STYLE = 'currentStyle';\nconst RUNTIME_STYLE = 'runtimeStyle';\nconst LEFT = 'left';\nconst PX = 'px';\n\nfunction _getComputedStyleIE(elem, name) {\n  // currentStyle maybe null\n  // http://msdn.microsoft.com/en-us/library/ms535231.aspx\n  let ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];\n\n  // 当 width/height 设置为百分比时，通过 pixelLeft 方式转换的 width/height 值\n  // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19\n  // 在 ie 下不对，需要直接用 offset 方式\n  // borderWidth 等值也有问题，但考虑到 borderWidth 设为百分比的概率很小，这里就不考虑了\n\n  // From the awesome hack by Dean Edwards\n  // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n  // If we're not dealing with a regular pixel number\n  // but a number that has a weird ending, we need to convert it to pixels\n  // exclude left right for relativity\n  if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {\n    // Remember the original values\n    const style = elem.style;\n    const left = style[LEFT];\n    const rsLeft = elem[RUNTIME_STYLE][LEFT];\n\n    // prevent flashing of content\n    elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];\n\n    // Put in the new values to get a computed value out\n    style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;\n    ret = style.pixelLeft + PX;\n\n    // Revert the changed values\n    style[LEFT] = left;\n\n    elem[RUNTIME_STYLE][LEFT] = rsLeft;\n  }\n  return ret === '' ? 'auto' : ret;\n}\n\nlet getComputedStyleX;\nif (typeof window !== 'undefined') {\n  getComputedStyleX = window.getComputedStyle\n    ? _getComputedStyle\n    : _getComputedStyleIE;\n}\n\nfunction each(arr, fn) {\n  for (let i = 0; i < arr.length; i++) {\n    fn(arr[i]);\n  }\n}\n\nfunction isBorderBoxFn(elem) {\n  return getComputedStyleX(elem, 'boxSizing') === 'border-box';\n}\n\nconst BOX_MODELS = ['margin', 'border', 'padding'];\nconst CONTENT_INDEX = -1;\nconst PADDING_INDEX = 2;\nconst BORDER_INDEX = 1;\nconst MARGIN_INDEX = 0;\n\nfunction swap(elem, options, callback) {\n  const old = {};\n  const style = elem.style;\n  let name;\n\n  // Remember the old values, and insert the new ones\n  for (name in options) {\n    if (options.hasOwnProperty(name)) {\n      old[name] = style[name];\n      style[name] = options[name];\n    }\n  }\n\n  callback.call(elem);\n\n  // Revert the old values\n  for (name in options) {\n    if (options.hasOwnProperty(name)) {\n      style[name] = old[name];\n    }\n  }\n}\n\nfunction getPBMWidth(elem, props, which) {\n  let value = 0;\n  let prop;\n  let j;\n  let i;\n  for (j = 0; j < props.length; j++) {\n    prop = props[j];\n    if (prop) {\n      for (i = 0; i < which.length; i++) {\n        let cssProp;\n        if (prop === 'border') {\n          cssProp = `${prop + which[i]}Width`;\n        } else {\n          cssProp = prop + which[i];\n        }\n        value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;\n      }\n    }\n  }\n  return value;\n}\n\n/**\n * A crude way of determining if an object is a window\n * @member util\n */\nfunction isWindow(obj) {\n  // must use == for ie8\n  /* eslint eqeqeq:0 */\n  return obj != null && obj == obj.window;\n}\n\nconst domUtils = {};\n\neach(['Width', 'Height'], name => {\n  domUtils[`doc${name}`] = refWin => {\n    const d = refWin.document;\n    return Math.max(\n      // firefox chrome documentElement.scrollHeight< body.scrollHeight\n      // ie standard mode : documentElement.scrollHeight> body.scrollHeight\n      d.documentElement[`scroll${name}`],\n      // quirks : documentElement.scrollHeight 最大等于可视窗口多一点？\n      d.body[`scroll${name}`],\n      domUtils[`viewport${name}`](d),\n    );\n  };\n\n  domUtils[`viewport${name}`] = win => {\n    // pc browser includes scrollbar in window.innerWidth\n    const prop = `client${name}`;\n    const doc = win.document;\n    const body = doc.body;\n    const documentElement = doc.documentElement;\n    const documentElementProp = documentElement[prop];\n    // 标准模式取 documentElement\n    // backcompat 取 body\n    return (\n      (doc.compatMode === 'CSS1Compat' && documentElementProp) ||\n      (body && body[prop]) ||\n      documentElementProp\n    );\n  };\n});\n\n/*\n 得到元素的大小信息\n @param elem\n @param name\n @param {String} [extra]  'padding' : (css width) + padding\n 'border' : (css width) + padding + border\n 'margin' : (css width) + padding + border + margin\n */\nfunction getWH(elem, name, extra) {\n  if (isWindow(elem)) {\n    return name === 'width'\n      ? domUtils.viewportWidth(elem)\n      : domUtils.viewportHeight(elem);\n  } else if (elem.nodeType === 9) {\n    return name === 'width'\n      ? domUtils.docWidth(elem)\n      : domUtils.docHeight(elem);\n  }\n  const which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n  let borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;\n  const computedStyle = getComputedStyleX(elem);\n  const isBorderBox = isBorderBoxFn(elem, computedStyle);\n  let cssBoxValue = 0;\n  if (borderBoxValue == null || borderBoxValue <= 0) {\n    borderBoxValue = undefined;\n    // Fall back to computed then un computed css if necessary\n    cssBoxValue = getComputedStyleX(elem, name);\n    if (cssBoxValue == null || Number(cssBoxValue) < 0) {\n      cssBoxValue = elem.style[name] || 0;\n    }\n    // Normalize '', auto, and prepare for extra\n    cssBoxValue = parseFloat(cssBoxValue) || 0;\n  }\n  if (extra === undefined) {\n    extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;\n  }\n  const borderBoxValueOrIsBorderBox =\n    borderBoxValue !== undefined || isBorderBox;\n  const val = borderBoxValue || cssBoxValue;\n  if (extra === CONTENT_INDEX) {\n    if (borderBoxValueOrIsBorderBox) {\n      return (\n        val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle)\n      );\n    }\n    return cssBoxValue;\n  }\n  if (borderBoxValueOrIsBorderBox) {\n    const padding =\n      extra === PADDING_INDEX\n        ? -getPBMWidth(elem, ['border'], which, computedStyle)\n        : getPBMWidth(elem, ['margin'], which, computedStyle);\n    return val + (extra === BORDER_INDEX ? 0 : padding);\n  }\n  return (\n    cssBoxValue +\n    getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle)\n  );\n}\n\nconst cssShow = {\n  position: 'absolute',\n  visibility: 'hidden',\n  display: 'block',\n};\n\n// fix #119 : https://github.com/kissyteam/kissy/issues/119\nfunction getWHIgnoreDisplay(elem) {\n  let val;\n  const args = arguments;\n  // in case elem is window\n  // elem.offsetWidth === undefined\n  if (elem.offsetWidth !== 0) {\n    val = getWH.apply(undefined, args);\n  } else {\n    swap(elem, cssShow, () => {\n      val = getWH.apply(undefined, args);\n    });\n  }\n  return val;\n}\n\nfunction css(el, name, v) {\n  let value = v;\n  if (typeof name === 'object') {\n    for (const i in name) {\n      if (name.hasOwnProperty(i)) {\n        css(el, i, name[i]);\n      }\n    }\n    return undefined;\n  }\n  if (typeof value !== 'undefined') {\n    if (typeof value === 'number') {\n      value += 'px';\n    }\n    el.style[name] = value;\n    return undefined;\n  }\n  return getComputedStyleX(el, name);\n}\n\neach(['width', 'height'], name => {\n  const first = name.charAt(0).toUpperCase() + name.slice(1);\n  domUtils[`outer${first}`] = (el, includeMargin) => {\n    return (\n      el &&\n      getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX)\n    );\n  };\n  const which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];\n\n  domUtils[name] = (elem, val) => {\n    if (val !== undefined) {\n      if (elem) {\n        const computedStyle = getComputedStyleX(elem);\n        const isBorderBox = isBorderBoxFn(elem);\n        if (isBorderBox) {\n          val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);\n        }\n        return css(elem, name, val);\n      }\n      return undefined;\n    }\n    return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);\n  };\n});\n\n// 设置 elem 相对 elem.ownerDocument 的坐标\nfunction setOffset(elem, offset) {\n  // set position first, in-case top/left are set even on static elem\n  if (css(elem, 'position') === 'static') {\n    elem.style.position = 'relative';\n  }\n\n  const old = getOffset(elem);\n  const ret = {};\n  let current;\n  let key;\n\n  for (key in offset) {\n    if (offset.hasOwnProperty(key)) {\n      current = parseFloat(css(elem, key)) || 0;\n      ret[key] = current + offset[key] - old[key];\n    }\n  }\n  css(elem, ret);\n}\n\nexport default {\n  getWindow(node) {\n    const doc = node.ownerDocument || node;\n    return doc.defaultView || doc.parentWindow;\n  },\n  offset(el, value) {\n    if (typeof value !== 'undefined') {\n      setOffset(el, value);\n    } else {\n      return getOffset(el);\n    }\n  },\n  isWindow,\n  each,\n  css,\n  clone(obj) {\n    const ret = {};\n    for (const i in obj) {\n      if (obj.hasOwnProperty(i)) {\n        ret[i] = obj[i];\n      }\n    }\n    const overflow = obj.overflow;\n    if (overflow) {\n      for (const i in obj) {\n        if (obj.hasOwnProperty(i)) {\n          ret.overflow[i] = obj.overflow[i];\n        }\n      }\n    }\n    return ret;\n  },\n  scrollLeft(w, v) {\n    if (isWindow(w)) {\n      if (v === undefined) {\n        return getScrollLeft(w);\n      }\n      window.scrollTo(v, getScrollTop(w));\n    } else {\n      if (v === undefined) {\n        return w.scrollLeft;\n      }\n      w.scrollLeft = v;\n    }\n  },\n  scrollTop(w, v) {\n    if (isWindow(w)) {\n      if (v === undefined) {\n        return getScrollTop(w);\n      }\n      window.scrollTo(getScrollLeft(w), v);\n    } else {\n      if (v === undefined) {\n        return w.scrollTop;\n      }\n      w.scrollTop = v;\n    }\n  },\n  viewportWidth: 0,\n  viewportHeight: 0,\n  ...domUtils,\n};\n","import util from './util';\n\nfunction scrollIntoView(elem, container, config) {\n  config = config || {};\n  // document 归一化到 window\n  if (container.nodeType === 9) {\n    container = util.getWindow(container);\n  }\n\n  let allowHorizontalScroll = config.allowHorizontalScroll;\n  const onlyScrollIfNeeded = config.onlyScrollIfNeeded;\n  let alignWithTop = config.alignWithTop;\n  let alignWithLeft = config.alignWithLeft;\n  const offsetTop = config.offsetTop || 0;\n  const offsetLeft = config.offsetLeft || 0;\n  const offsetBottom = config.offsetBottom || 0;\n  const offsetRight = config.offsetRight || 0;\n\n  allowHorizontalScroll =\n    allowHorizontalScroll === undefined ? true : allowHorizontalScroll;\n\n  const isWin = util.isWindow(container);\n  const elemOffset = util.offset(elem);\n  const eh = util.outerHeight(elem);\n  const ew = util.outerWidth(elem);\n  let containerOffset;\n  let ch;\n  let cw;\n  let containerScroll;\n  let diffTop;\n  let diffBottom;\n  let win;\n  let winScroll;\n  let ww;\n  let wh;\n\n  if (isWin) {\n    win = container;\n    wh = util.height(win);\n    ww = util.width(win);\n    winScroll = {\n      left: util.scrollLeft(win),\n      top: util.scrollTop(win),\n    };\n    // elem 相对 container 可视视窗的距离\n    diffTop = {\n      left: elemOffset.left - winScroll.left - offsetLeft,\n      top: elemOffset.top - winScroll.top - offsetTop,\n    };\n    diffBottom = {\n      left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,\n      top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom,\n    };\n    containerScroll = winScroll;\n  } else {\n    containerOffset = util.offset(container);\n    ch = container.clientHeight;\n    cw = container.clientWidth;\n    containerScroll = {\n      left: container.scrollLeft,\n      top: container.scrollTop,\n    };\n    // elem 相对 container 可视视窗的距离\n    // 注意边框, offset 是边框到根节点\n    diffTop = {\n      left:\n        elemOffset.left -\n        (containerOffset.left +\n          (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) -\n        offsetLeft,\n      top:\n        elemOffset.top -\n        (containerOffset.top +\n          (parseFloat(util.css(container, 'borderTopWidth')) || 0)) -\n        offsetTop,\n    };\n    diffBottom = {\n      left:\n        elemOffset.left +\n        ew -\n        (containerOffset.left +\n          cw +\n          (parseFloat(util.css(container, 'borderRightWidth')) || 0)) +\n        offsetRight,\n      top:\n        elemOffset.top +\n        eh -\n        (containerOffset.top +\n          ch +\n          (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) +\n        offsetBottom,\n    };\n  }\n\n  if (diffTop.top < 0 || diffBottom.top > 0) {\n    // 强制向上\n    if (alignWithTop === true) {\n      util.scrollTop(container, containerScroll.top + diffTop.top);\n    } else if (alignWithTop === false) {\n      util.scrollTop(container, containerScroll.top + diffBottom.top);\n    } else {\n      // 自动调整\n      if (diffTop.top < 0) {\n        util.scrollTop(container, containerScroll.top + diffTop.top);\n      } else {\n        util.scrollTop(container, containerScroll.top + diffBottom.top);\n      }\n    }\n  } else {\n    if (!onlyScrollIfNeeded) {\n      alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;\n      if (alignWithTop) {\n        util.scrollTop(container, containerScroll.top + diffTop.top);\n      } else {\n        util.scrollTop(container, containerScroll.top + diffBottom.top);\n      }\n    }\n  }\n\n  if (allowHorizontalScroll) {\n    if (diffTop.left < 0 || diffBottom.left > 0) {\n      // 强制向上\n      if (alignWithLeft === true) {\n        util.scrollLeft(container, containerScroll.left + diffTop.left);\n      } else if (alignWithLeft === false) {\n        util.scrollLeft(container, containerScroll.left + diffBottom.left);\n      } else {\n        // 自动调整\n        if (diffTop.left < 0) {\n          util.scrollLeft(container, containerScroll.left + diffTop.left);\n        } else {\n          util.scrollLeft(container, containerScroll.left + diffBottom.left);\n        }\n      }\n    } else {\n      if (!onlyScrollIfNeeded) {\n        alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;\n        if (alignWithLeft) {\n          util.scrollLeft(container, containerScroll.left + diffTop.left);\n        } else {\n          util.scrollLeft(container, containerScroll.left + diffBottom.left);\n        }\n      }\n    }\n  }\n}\n\nexport default scrollIntoView;\n","export default function debounce(func, wait, immediate) {\n  var timeout, args, context, timestamp, result;\n\n  var later = function() {\n    var last = Date.now() - timestamp;\n\n    if (last < wait && last >= 0) {\n      timeout = setTimeout(later, wait - last);\n    } else {\n      timeout = null;\n      if (!immediate) {\n        result = func.apply(context, args);\n        if (!timeout) context = args = null;\n      }\n    }\n  };\n\n  return function() {\n    context = this;\n    args = arguments;\n    timestamp = Date.now();\n    var callNow = immediate && !timeout;\n    if (!timeout) timeout = setTimeout(later, wait);\n    if (callNow) {\n      result = func.apply(context, args);\n      context = args = null;\n    }\n\n    return result;\n  };\n}\n","export default () => {};\n","// packages\nimport { cloneElement, Component, h } from 'preact';\nimport scrollIntoView from 'dom-scroll-into-view';\n\n// internal\nimport debounce from '../utils/debounce';\nimport noop from '../utils/noop';\n\nclass Typeahead extends Component {\n  constructor(props) {\n    super(props);\n\n    this.state = {\n      highlightedIndex: null,\n      isOpen: false,\n    };\n\n    this.handleOnBlur = this.handleOnBlur.bind(this);\n    this.handleOnClear = this.handleOnClear.bind(this);\n    this.handleOnFocus = this.handleOnFocus.bind(this);\n    this.handleOnInput = this.handleOnInput.bind(this);\n    this.debouncedHandleOnInput = debounce(\n      this.handleOnInput,\n      this.props.debounceDuration\n    );\n    this.handleKeyDown = this.handleKeyDown.bind(this);\n    this.setInputRef = this.setInputRef.bind(this);\n    this.setMenuRef = this.setMenuRef.bind(this);\n    this.setItemRef = this.setItemRef.bind(this);\n\n    this.listRefs = {};\n  }\n\n  static getDerivedStateFromProps(_, prevState) {\n    if (prevState.highlightedIndex == null) {\n      return { highlightedIndex: 0 };\n    }\n  }\n\n  componentDidUpdate() {\n    const { highlightedIndex } = this.state;\n    const count = this.getFilteredItems(this.props).length;\n\n    if (Boolean(highlightedIndex) && highlightedIndex >= count) {\n      this.setState({ highlightedIndex: 0 });\n    }\n\n    this.maybeScrollItemIntoView();\n  }\n\n  setInputRef(element) {\n    this.inputRef = element;\n  }\n\n  setMenuRef(element) {\n    this.menuRef = element;\n  }\n\n  setItemRef(element, idx) {\n    this.listRefs[`item-${idx}`] = element;\n  }\n\n  maybeScrollItemIntoView() {\n    const { highlightedIndex, isOpen } = this.state;\n\n    if (isOpen && highlightedIndex != null) {\n      const itemNode = this.listRefs[`item-${this.state.highlightedIndex}`];\n      const menuNode = this.menuRef;\n\n      if (itemNode && menuNode) {\n        scrollIntoView(itemNode, menuNode, {\n          onlyScrollIfNeeded: true,\n        });\n      }\n    }\n  }\n\n  getFilteredItems(props) {\n    let { items } = props;\n\n    const { shouldItemRender, sortItems } = props;\n\n    if (shouldItemRender) {\n      items = items.filter(item => shouldItemRender(item, props.value));\n    }\n\n    if (sortItems) {\n      items = items.sort((a, b) => sortItems(a, b, props.value));\n    }\n\n    return items;\n  }\n\n  highlightItemOnMouseEnter(highlightedIndex) {\n    this.setState({ highlightedIndex });\n  }\n\n  selectItemOnClick(item) {\n    const { getItemValue, onSelect } = this.props;\n\n    const value = getItemValue(item);\n\n    this.setState(\n      {\n        highlightedIndex: null,\n        isOpen: false,\n      },\n      () => {\n        this.inputRef.blur();\n        onSelect(value, item);\n      }\n    );\n  }\n\n  renderList() {\n    const { highlightedIndex } = this.state;\n    const props = this.props;\n\n    if (!props.value) return null;\n\n    const items = this.getFilteredItems(props);\n\n    return (\n      <ul\n        class=\"listbox\"\n        ref={this.setMenuRef}\n        onMouseDown={event => event.preventDefault()}\n      >\n        {items.map((item, idx) => {\n          return cloneElement(\n            props.renderItem(item, idx === highlightedIndex),\n            {\n              onClick: () => this.selectItemOnClick(item),\n              onMouseEnter: () => this.highlightItemOnMouseEnter(idx),\n              ref: el => this.setItemRef(el, idx),\n            }\n          );\n        })}\n        {items.length > 0 && props.renderAttribution()}\n      </ul>\n    );\n  }\n\n  handleOnClear(event) {\n    this.setState({ isOpen: false });\n\n    this.props.onClear(event);\n  }\n\n  handleOnBlur() {\n    this.setState({ isOpen: false });\n\n    const { onBlur } = this.props.inputProps;\n    if (onBlur) onBlur(event);\n  }\n\n  handleOnFocus(event) {\n    const { value } = this.props;\n\n    if (value.length > 0) this.setState({ isOpen: true });\n\n    const { onFocus } = this.props.inputProps;\n    if (onFocus) onFocus(event);\n  }\n\n  handleOnInput(event) {\n    const { value } = event.target;\n\n    this.props.onChange(value, event);\n\n    if (value.length <= 0) {\n      this.setState({ highlightedIndex: null });\n    }\n  }\n\n  handleKeyDown(event) {\n    const { isOpen } = this.state;\n\n    if (isOpen && Typeahead.keyEvents[event.key]) {\n      Typeahead.keyEvents[event.key].call(this, event);\n    } else if (!isOpen) {\n      this.setState({ isOpen: true });\n    }\n  }\n\n  render() {\n    const { inputProps, onClear, renderInput, value } = this.props;\n    const { isOpen } = this.state;\n\n    return (\n      <div class=\"typeahead\">\n        <div class=\"typeahead__input-wrapper\">\n          {renderInput({\n            ...inputProps,\n            role: 'combobox',\n            'aria-autocomplete': 'list',\n            'aria-expanded': String(isOpen),\n            autocomplete: 'off',\n            onBlur: this.handleOnBlur,\n            onFocus: this.handleOnFocus,\n            onInput: this.handleOnInput,\n            onKeyDown: this.handleKeyDown,\n            value,\n            ref: this.setInputRef,\n          })}\n          {onClear && value && (\n            <button\n              onClick={this.handleOnClear}\n              type=\"button\"\n              class=\"close\"\n              aria-label=\"Clear\"\n            >\n              <span aria-hidden=\"true\">&times;</span>\n            </button>\n          )}\n        </div>\n        {isOpen && this.renderList()}\n      </div>\n    );\n  }\n}\n\nTypeahead.defaultProps = {\n  debounceDuration: 150,\n  inputProps: {},\n  onChange: noop,\n  onClear: noop,\n  onSelect: noop,\n  renderInput: props => <input {...props} />,\n  value: '',\n};\n\nTypeahead.keyEvents = {\n  ArrowDown(event) {\n    event.preventDefault();\n\n    const items = this.getFilteredItems(this.props);\n    const itemsCount = items.length;\n    if (itemsCount < 1) return;\n\n    const { highlightedIndex } = this.state;\n\n    const newIndex =\n      highlightedIndex < itemsCount - 1\n        ? highlightedIndex + 1\n        : highlightedIndex;\n\n    this.setState({ highlightedIndex: newIndex });\n  },\n\n  ArrowUp(event) {\n    event.preventDefault();\n\n    const items = this.getFilteredItems(this.props);\n    const itemsCount = items.length;\n    if (itemsCount < 1) return;\n\n    const { highlightedIndex } = this.state;\n\n    const newIndex =\n      highlightedIndex > 0 ? highlightedIndex - 1 : highlightedIndex;\n\n    this.setState({ highlightedIndex: newIndex });\n  },\n\n  Enter(event) {\n    // not the right kind of Enter, abort\n    if (event.keyCode !== 13) return;\n\n    const { highlightedIndex, isOpen } = this.state;\n\n    if (!isOpen) {\n      // the menu is not open\n      return;\n    } else if (highlightedIndex == null) {\n      // input has control, but there's nothing selected\n      this.setState({ isOpen: false }, () => this.inputRef.select());\n    } else {\n      // the input has control and we have an item\n      event.preventDefault();\n\n      const item = this.getFilteredItems(this.props)[highlightedIndex];\n      const value = this.props.getItemValue(item);\n\n      this.setState(\n        {\n          highlightedIndex: null,\n          isOpen: false,\n        },\n        () => {\n          this.inputRef.setSelectionRange(value.length, value.length);\n          this.props.onSelect(value, item);\n        }\n      );\n    }\n  },\n\n  Escape() {\n    this.setState({\n      highlightedIndex: null,\n      isOpen: false,\n    });\n  },\n};\n\nexport default Typeahead;\n","// packages\nimport cx from 'classnames';\nimport { get, set } from '../vendor/idb-keyval';\nimport { h } from 'preact';\n\n// components\nimport CandidateRow from './CandidateRow';\nimport Contest from './Contest';\nimport Portal from './Portal';\nimport PureComponent from './PureComponent';\nimport Typeahead from './Typeahead';\n\n// internal\nimport debounce from '../utils/debounce';\nimport { determineContestTitleYourRaces } from '../election-utils';\nimport { visibleCandidatesCount } from '../endpoints';\nimport { lookup } from '../utils/legislative-districts';\nimport loadAssetURL from '../utils/load-asset-url';\n\nconst googleIMG = loadAssetURL('powered-by-google');\n\nconst sessionToken = new google.maps.places.AutocompleteSessionToken();\nconst autocompleteService = new google.maps.places.AutocompleteService();\n\nconst bounds = {\n  east: -93.514764,\n  west: -106.662177,\n  south: 25.843902,\n  north: 36.500199,\n};\n\nconst componentRestrictions = { country: 'us' };\nconst types = ['geocode'];\n\nconst getPredictions = (input) => {\n  return new Promise((resolve, reject) => {\n    autocompleteService.getPlacePredictions(\n      { bounds, componentRestrictions, input, sessionToken, types },\n      (predict, status) => {\n        if (status === 'OK') resolve(predict);\n\n        reject(new Error('No results found.'));\n      }\n    );\n  });\n};\n\n// always render what's provided, the geocoder decides\nconst shouldItemRender = () => true;\n\nclass YourRaces extends PureComponent {\n  constructor() {\n    super();\n\n    this.state = {\n      contests: [],\n      coordinates: null,\n      data: null,\n      lookupError: false,\n      lookupPending: false,\n      lookedFoundStored: false,\n      results: [],\n      value: '',\n    };\n\n    this.handleGeocode = this.handleGeocode.bind(this);\n    this.debouncedHandleGeocode = debounce(this.handleGeocode, 300);\n    this.onChange = this.onChange.bind(this);\n    this.onClear = this.onClear.bind(this);\n    this.onSelect = this.onSelect.bind(this);\n  }\n\n  onClear() {\n    this.setState({ value: '' });\n  }\n\n  onChange(value) {\n    this.setState({ value }, this.debouncedHandleGeocode);\n  }\n\n  handleGeocode() {\n    const { value: input } = this.state;\n\n    getPredictions(input)\n      .then((results) => this.setState({ results }))\n      .catch(() => this.setState({ results: [] }));\n  }\n\n  onSelect({ name, placeId }) {\n    this.setState({ lookupError: false, lookupPending: true, value: name });\n\n    this.placesService.getDetails(\n      {\n        fields: ['geometry.location'],\n        placeId,\n        sessionToken,\n      },\n      (result) => {\n        const { lat: latitude, lng: longitude } =\n          result.geometry.location.toJSON();\n\n        const coordinates = { latitude, longitude };\n\n        lookup(coordinates)\n          .then(({ data }) =>\n            this.setState(\n              {\n                coordinates,\n                data,\n                lookupPending: false,\n                lookedFoundStored: false,\n              },\n              // () => set('your-races-lookup', data)\n            )\n          )\n          .catch(() =>\n            this.setState({\n              data: null,\n              lookupError: true,\n              lookupPending: false,\n            })\n          );\n      }\n    );\n  }\n\n  componentDidMount() {\n    this.placesService = new google.maps.places.PlacesService(this.inputRef);\n\n    // get('your-races-lookup').then((data) => {\n    //   if (data != null) {\n    //     this.setState({ data, lookedFoundStored: true });\n    //   }\n    // });\n  }\n\n  render() {\n    const { contests, notes, annotations, asOf } = this.props;\n    const {\n      coordinates,\n      data,\n      lookupError,\n      lookupPending,\n      lookedFoundStored,\n      results,\n      value,\n    } = this.state;\n\n    let addressFeedback = null;\n\n    let matches = {\n      'us-house': null,\n      sboe: null,\n      'tx-senate': null,\n      'tx-house': null,\n    };\n\n    const noteMatches = {\n      'us-house': null,\n      sboe: null,\n      'tx-senate': null,\n      'tx-house': null,\n    };\n\n    const annoMatches = {\n      'us-house': null,\n      sboe: null,\n      'tx-senate': null,\n      'tx-house': null,\n    };\n\n    let gridClass;\n\n    if (data) {\n      // Hacky fix for bug that let old races hang around after you search for an address in another district\n      var arr = document.getElementsByClassName('representative-districts');\n      for (var i = 0; i < arr.length; i++) {\n        arr[i].innerHTML = ' ';\n      }\n\n      matches['us-house'] = contests.filter(\n        (contest) =>\n          contest.office === 'U.S. House' &&\n          contest.office_division === data.us_house.district\n      );\n\n      matches['sboe'] = contests.filter(\n        (contest) =>\n          contest.office === 'State Board of Education' &&\n          contest.office_division === data.sboe.district\n      );\n\n      matches['tx-senate'] = contests.filter(\n        (contest) =>\n          contest.office === 'Texas Senate' &&\n          contest.office_division === data.tx_senate.district\n      );\n\n      matches['tx-house'] = contests.filter(\n        (contest) =>\n          contest.office === 'Texas House' &&\n          contest.office_division === data.tx_house.district\n      );\n\n      noteMatches['us-house'] = notes.filter(\n        (contest) =>\n          contest.type === 'us-house-district-' + data.us_house.district\n      );\n\n      noteMatches['sboe'] = notes.filter(\n        (contest) =>\n          contest.type ===\n          'state-board-of-education-district-' + data.sboe.district\n      );\n\n      noteMatches['tx-senate'] = notes.filter(\n        (contest) =>\n          contest.type === 'texas-senate-district-' + data.tx_senate.district\n      );\n\n      noteMatches['tx-house'] = notes.filter(\n        (contest) =>\n          contest.type === 'texas-house-district-' + data.tx_house.district\n      );\n\n      annoMatches['us-house'] = annotations.filter(\n        (contest) =>\n          contest.type === 'us-house-district-' + data.us_house.district\n      );\n\n      annoMatches['sboe'] = annotations.filter(\n        (contest) =>\n          contest.type ===\n          'state-board-of-education-district-' + data.sboe.district\n      );\n\n      annoMatches['tx-senate'] = annotations.filter(\n        (contest) =>\n          contest.type === 'texas-senate-district-' + data.tx_senate.district\n      );\n\n      annoMatches['tx-house'] = annotations.filter(\n        (contest) =>\n          contest.type === 'texas-house-district-' + data.tx_house.district\n      );\n\n      let arrayNum;\n      arrayNum =\n        matches['us-house'].length +\n        matches['tx-house'].length +\n        matches['sboe'].length +\n        matches['tx-senate'].length;\n\n      gridClass = cx('representative-districts contest-list', {\n        'seat__contests-double': arrayNum > 1,\n        'seat__contests-single': arrayNum == 1,\n      });\n    }\n\n    if (lookupPending) {\n      addressFeedback = (\n        <p class='has-padding t-serif t-weight-bold t-align-center'>\n          Finding your details...{' '}\n          <svg class='icon icon-spinner animate-pulse'>\n            <use xlinkHref='#icon-spinner' />\n          </svg>\n        </p>\n      );\n    }\n\n    if (lookupError) {\n      addressFeedback = (\n        <p class='has-padding t-serif t-weight-bold t-align-center'>\n          Hmm... we were unable to find you in Texas. Please check your address\n          and try again!\n        </p>\n      );\n    }\n\n    if (coordinates && !lookupPending && !lookupError) {\n      addressFeedback = (\n        <p class='has-padding t-serif t-weight-bold t-align-center'>\n          We found your information! These races have been personalized for you.\n        </p>\n      );\n    }\n\n    if (lookedFoundStored && !lookupPending && !lookupError) {\n      addressFeedback = (\n        <p class='has-padding t-serif t-weight-bold t-align-center'>\n          Welcome back! We remembered the districts you found last time.\n        </p>\n      );\n      if (\n        (coordinates || lookedFoundStored) &&\n        matches['us-house'].length == 0 &&\n        matches['tx-house'].length == 0 &&\n        matches['sboe'].length == 0 &&\n        matches['tx-senate'].length == 0\n      ) {\n        addressFeedback = (\n          <p class='has-padding t-serif t-weight-bold t-align-center'>\n            Welcome back! We remembered the districts you found last time.{' '}\n            <br></br> <br></br>\n            We're fetching your midterm races.\n            <svg class='icon icon-spinner animate-pulse'>\n              <use xlinkHref='#icon-spinner' />\n            </svg>\n          </p>\n        );\n      }\n    }\n\n    const inputProps = {\n      id: 'address-input',\n      class: 'address-input__input',\n      placeholder: '1010 Colorado St, Austin, TX, 78701',\n    };\n\n    function findIsCalled(party, matches) {\n      const race = matches.filter((race) => race.party === party);\n      return race[0].is_called;\n    }\n\n    function findContestResult(party, matches) {\n      const race = matches.filter((race) => race.party === party);\n      return race[0].contest_result;\n    }\n\n    return (\n      <div class='address-input t-sans'>\n        <svg class='icon icon-drawn-left-arrow'>\n          <use xlinkHref='#icon-drawn-left-arrow'></use>\n        </svg>\n        <label class='address-input__label' for='address-input'>\n          Enter your address\n        </label>\n        <Typeahead\n          inputProps={inputProps}\n          items={results}\n          getItemValue={(item) => ({\n            name: item.description,\n            placeId: item.place_id,\n          })}\n          value={value}\n          onChange={this.onChange}\n          onClear={this.onClear}\n          onSelect={this.onSelect}\n          renderItem={(item, isHighlighted) => (\n            <li\n              class={cx('listbox__item', {\n                'listbox__item--highlighted': isHighlighted,\n              })}\n              key={item.id}\n            >\n              {item.description}\n            </li>\n          )}\n          renderAttribution={() => (\n            <li class='listbox__item listbox__item--attribution'>\n              <img src={googleIMG} alt='Powered by Google' />\n            </li>\n          )}\n          shouldItemRender={shouldItemRender}\n          renderInput={(props) => (\n            <input\n              {...props}\n              ref={(el) => {\n                props.ref(el);\n                this.inputRef = el;\n              }}\n            />\n          )}\n        />\n        {addressFeedback}\n        {data && contests.length > 0 && (\n          <Portal\n            node={document.getElementById('your-races-results')}\n            ref={(ref) => (this._resultsPortal = ref)}\n          >\n            <div class={gridClass}>\n              {matches['us-house'].length > 0 &&\n                matches['us-house'].map((contest) => (\n                  <Contest\n                    key={matches['us-house'][0].office_slug}\n                    contest={contest}\n                    contestTitle={determineContestTitleYourRaces(\n                      matches['us-house'][0]\n                    )}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    annotations={annoMatches['us-house'].filter(\n                      (annotation) => annotation.type === contest.office_slug\n                    )}\n                    notes={noteMatches['us-house'].filter(\n                      (note) => note.type === contest.office_slug\n                    )}\n                    partyName={contest.party}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        candidateId={candidate.id}\n                        contestOffice={matches['us-house'][0].office}\n                        contestIsCalled={matches['us-house'][0].is_called}\n                        contestResult={matches['us-house'][0].contest_result}\n                        candidatesNum={\n                          matches['us-house'][0].candidacies.length\n                        }\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n              {matches['tx-senate'].length > 0 &&\n                matches['tx-senate'].map((contest) => (\n                  <Contest\n                    key={matches['tx-senate'].id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitleYourRaces(\n                      matches['tx-senate'][0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annoMatches['tx-senate'].filter(\n                      (annotation) => annotation.type === contest.office_slug\n                    )}\n                    notes={noteMatches['tx-senate'].filter(\n                      (note) => note.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={matches['tx-senate'][0].office}\n                        contestIsCalled={matches['tx-senate'][0].is_called}\n                        contestResult={matches['tx-senate'][0].contest_result}\n                        candidatesNum={\n                          matches['tx-senate'][0].candidacies.length\n                        }\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n              {matches['tx-house'].length > 0 &&\n                matches['tx-house'].map((contest) => (\n                  <Contest\n                    key={matches['tx-house'].id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitleYourRaces(\n                      matches['tx-house'][0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annoMatches['tx-house'].filter(\n                      (annotation) => annotation.type === contest.office_slug\n                    )}\n                    notes={noteMatches['tx-house'].filter(\n                      (note) => note.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={matches['tx-house'][0].office}\n                        contestIsCalled={matches['tx-house'][0].is_called}\n                        contestResult={matches['tx-house'][0].contest_result}\n                        candidatesNum={\n                          matches['tx-house'][0].candidacies.length\n                        }\n                        isIncumbent={candidate.is_incumbent}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        isWinner={candidate.is_winner}\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n              {matches['sboe'].length > 0 &&\n                matches['sboe'].map((contest) => (\n                  <Contest\n                    key={matches['sboe'][0].office_slug}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitleYourRaces(\n                      matches['sboe'][0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annoMatches['sboe'].filter(\n                      (annotation) => annotation.type === contest.office_slug\n                    )}\n                    notes={noteMatches['sboe'].filter(\n                      (note) => note.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={matches['sboe'][0].office}\n                        contestIsCalled={matches['sboe'][0].is_called}\n                        contestResult={matches['sboe'][0].contest_result}\n                        candidatesNum={matches['sboe'][0].candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </Portal>\n        )}\n      </div>\n    );\n  }\n}\n\nexport default YourRaces;\n","import getJSON from './get-json';\n\nconst LOOKUP_URL = ({ latitude, longitude, includeGeography = false }) =>\n  `https://dv-dev.texastribune.org/legislative-lookup-2020/?latitude=${latitude}&longitude=${longitude}`;\n\nexport function lookup({ latitude, longitude }) {\n  return getJSON(LOOKUP_URL({ latitude, longitude }));\n}\n","import * as d3 from 'd3';\nimport { Component, h } from 'preact';\n\nimport { entries, map, Map } from 'd3-collection';\n\nimport topology from 'Assets/geography/texas_urban.json';\n\nimport countiesData from 'Data/data.json';\n\nimport prepareTopoJSON from '../utils/prepare-topojson';\n\nimport { TIE } from '../colors';\n\ninterface Props {\n  category: string;\n  contest: { [key: string]: any };\n  candidatesRender: any;\n}\n\nclass TinyMap extends Component<Props> {\n  candidateMap!: Map<any>;\n  countyMap!: Map<any>;\n\n  constructor() {\n    super();\n\n    this.createMap = this.createMap.bind(this);\n    this.redrawMap = this.redrawMap.bind(this);\n    this.findLeading = this.findLeading.bind(this);\n  }\n\n  setUpCandidateMap(candidates: any) {\n    this.candidateMap = map(candidates, (d) => d.id);\n  }\n\n  setUpCountyMap(counties: any) {\n    this.countyMap = map(counties, (d) => d.fips);\n  }\n\n  componentDidMount() {\n    const { category, contest } = this.props;\n\n    this.setUpCandidateMap(contest.candidacies);\n    this.setUpCountyMap(contest.counties);\n\n    this.createMap(contest, category);\n\n    window.addEventListener('resize', () => {\n      this.redrawMap();\n    });\n  }\n\n  componentDidUpdate() {\n    const { category, contest } = this.props;\n\n    this.setUpCandidateMap(contest.candidacies);\n    this.setUpCountyMap(contest.counties);\n\n    this.createMap(contest, category);\n  }\n\n  findLeading(fips) {\n    const { candidatesRender } = this.props;\n\n    const county = this.countyMap.get(fips);\n\n    let fillStyle;\n\n    if (county.total_votes <= 0) {\n      fillStyle = '#666';\n    } else {\n      const sortedResults = entries(county.results).sort(\n        (a, b) => b.value - a.value\n      );\n\n      const leader = sortedResults[0];\n      const second = sortedResults[1];\n\n      if (leader.value === second.value) {\n        fillStyle = TIE;\n      } else {\n        const leadingId = leader.key;\n\n        const { id } = this.candidateMap.get(leadingId);\n        const result = candidatesRender.filter((cand) => cand.id == id);\n        fillStyle = result[0]['color'];\n      }\n    }\n\n    return fillStyle;\n  }\n\n  createMap(contest, category) {\n    d3.selectAll(`.${category}-${contest.office_slug} svg`).remove();\n\n    const container = d3.select(`.${category}-${contest.office_slug}`);\n\n    const geos = prepareTopoJSON(topology);\n\n    let projection = d3\n      .geoIdentity()\n      .reflectY(true)\n      .fitSize([75, 75], geos.collection);\n\n    let pathGenerator = d3.geoPath().projection(projection);\n\n    let tinymap = container\n      .append('svg')\n      .attr('id', 'tinymap')\n      .attr('role', 'presentation')\n      .attr('width', 75)\n      .attr('height', 75);\n\n    let g_tinymap = tinymap\n      .append('g')\n      .attr('class', 'tinymap')\n      .attr('width', 75)\n      .attr('height', 75);\n\n    let tinycounties = g_tinymap\n      .selectAll('.tinycounties')\n      .data(geos.collection.features)\n      .enter()\n      .append('path')\n      .attr('d', pathGenerator)\n      .attr('stroke', (d) => {\n        let foundCounty = countiesData.counties.find(\n          (a) => a.county == d.properties.name\n        );\n        if (foundCounty && foundCounty.category == category)\n          return this.findLeading(d.properties.fips);\n        else return '#d0d0d0';\n      })\n      .attr('stroke-width', '1')\n      .attr('class', 'tinycounties')\n      .attr('fill', (d) => {\n        let foundCounty = countiesData.counties.find(\n          (a) => a.county == d.properties.name\n        );\n        if (foundCounty && foundCounty.category == category)\n          return this.findLeading(d.properties.fips);\n        else return '#d0d0d0';\n      });\n  }\n\n  redrawMap() {\n    const { category, contest } = this.props;\n\n    d3.selectAll(`.${category}-${contest.office_slug} svg`).remove();\n    this.createMap(contest, category);\n  }\n\n  render() {\n    const { category, contest } = this.props;\n\n    return (\n      <div\n        id='tinymapcontainer'\n        class={`${category}-${contest.office_slug}`}\n      ></div>\n    );\n  }\n}\n\nexport default TinyMap;\n","export default function(xy, dim) {\n  var node = this.node()\n  return !node ? this : node.getBBox ?\n    this.attr('transform', function(d,i) {\n      var p = typeof xy == 'function' ? xy.call(this, d,i) : xy;\n      if (dim === 0) p = [p, 0]; else if (dim === 1) p = [0, p];\n      return 'translate(' + p[0] +','+ p[1]+')';\n    }) :\n    this.style('transform', function(d,i) {\n      var p = typeof xy == 'function' ? xy.call(this, d,i) : xy;\n      if (dim === 0) p = [p, 0]; else if (dim === 1) p = [0, p];\n      return 'translate(' + p[0] +'px,'+ p[1]+'px)';\n    });\n}\n","export default function(name) {\n  if (typeof name === \"string\") {\n    var attr = {},\n      parts = name.split(/([\\.#])/g), p;\n      name = parts.shift();\n    while ((p = parts.shift())) {\n      if (p == '.') attr['class'] = attr['class'] ? attr['class'] + ' ' + parts.shift() : parts.shift();\n      else if (p == '#') attr.id = parts.shift();\n    }\n    return {tag: name, attr: attr};\n  }\n  return name;\n}\n","import {creator, selector} from \"d3-selection\";\nimport parseAttributes from \"./parseAttributes.js\";\n\nfunction constantNull() {\n  return null;\n}\n\nexport default function(name, before) {\n  var n = parseAttributes(name),\n      create = creator(n.tag),\n      select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n\n  var s = this.select(function() {\n    return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n  });\n\n\n  //attrs not provided by default in v4\n  for (var key in n.attr) { s.attr(key, n.attr[key]); }\n  return s;\n}","const camelCaseAttrs = /^(allowReorder|attributeName|attributeType|autoReverse|baseFrequency|baseProfile|calcMode|clipPathUnits|contentScriptType|contentStyleType|diffuseConstant|edgeMode|externalResourcesRequired|filterRes|filterUnits|glyphRef|gradientTransform|gradientUnits|kernelMatrix|kernelUnitLength|keyPoints|keySplines|keyTimes|lengthAdjust|limitingConeAngle|markerHeight|markerUnits|markerWidth|maskContentUnits|maskUnits|numOctaves|pathLength|patternContentUnits|patternTransform|patternUnits|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|referrerPolicy|refX|refY|repeatCount|repeatDur|requiredExtensions|requiredFeatures|specularConstant|specularExponent|spreadMethod|startOffset|stdDeviation|stitchTiles|surfaceScale|systemLanguage|tableValues|targetX|targetY|textLength|viewBox|viewTarget|xChannelSelector|yChannelSelector|zoomAndPan)$/;\n\nexport default function(name, value) {\n  if (typeof(name) == 'object'){\n    for (var key in name){\n      this.attr(camelCaseAttrs.test(key) ? key : key.replace(/([a-z\\d])([A-Z])/g, '$1-$2').toLowerCase(), name[key]);\n    }\n    return this;\n  } else{\n    return arguments.length == 1 ? this.attr(name) : this.attr(name, value);\n  }\n}\n","import ƒ from \"./f.js\";\n\nexport default function(name, value) {\n  if (typeof(name) == 'object'){\n    for (var key in name){\n      addStyle(this, key, name[key]);\n    }\n    return this;\n  } else {\n    return arguments.length == 1 ? this.style(name) : addStyle(this, name, value);\n  }\n\n\n  function addStyle(sel, style, value){\n    style = style.replace(/([a-z\\d])([A-Z])/g, '$1-$2').toLowerCase();\n\n    var pxStyles = 'top left bottom right padding-top padding-left padding-bottom padding-right border-top b-width border-left-width border-botto-width m border-right-width margin-top margin-left margin-bottom margin-right font-size width stroke-width line-height margin padding border border-radius max-width min-width max-height min-height';\n\n    if (~pxStyles.indexOf(style) ){\n      sel.style(style, typeof value == 'function' ? wrapPx(value) : addPx(value));\n    } else{\n      sel.style(style, value);\n    }\n\n    return sel;\n  }\n\n  function addPx(d){ return d.match ? d : d + 'px'; }\n  function wrapPx(fn){\n    return function(){\n      var val = fn.apply(this, arguments)\n      return addPx(val)\n    }\n\n  }\n}\n","import {sum} from 'd3-array';\n\n// while this might not be reprentative for all fonts, it is\n// still better than assuming every character has the same width\n// (set monospace=true if you want to bypass this)\nvar CHAR_W = {\n    A:7,a:7,B:8,b:7,C:8,c:6,D:9,d:7,E:7,e:7,F:7,f:4,G:9,g:7,H:9,h:7,I:3,i:3,J:5,j:3,K:8,k:6,L:7,l:3,M:11,\n    m:11,N:9,n:7,O:9,o:7,P:8,p:7,Q:9,q:7,R:8,r:4,S:8,s:6,T:7,t:4,U:9,u:7,V:7,v:6,W:11,w:9,X:7,x:6,Y:7,y:6,Z:7,z:5,\n    '.':2,',':2,':':2,';':2\n};\n\nexport default function(line, maxCharactersPerLine, minCharactersPerLine, monospace) {\n    var l, lines = [], w = [], words = [], w1, maxChars, minChars, maxLineW, minLineW;\n    w1 = line.split(' ');\n    w1.forEach(function(s, i) {\n        var w2 = s.split('-');\n        var lw = (i < w1.length - 1 ? ' ' : '');\n        if (w2.length > 1) {\n            w2.forEach(function(t, j) {\n                w.push(t + (j < w2.length - 1 ? '-' : lw));\n            });\n        } else {\n            w.push(s + lw);\n        }\n    });\n    maxChars = maxCharactersPerLine || 40;\n    minChars = minCharactersPerLine || Math.max(3, Math.min(maxChars * 0.5, 0.75 * w.map(word_len).sort(num_asc)[Math.round(w.length / 2)]));\n    maxLineW = maxChars * CHAR_W.a;\n    minLineW = minChars * CHAR_W.a;\n    l = 0;\n    w.forEach(function(d) {\n        var ww = sum(d.split('').map(char_w));\n        if (l + ww > maxLineW && l > minLineW) {\n            lines.push(words.join(''));\n            words.length = 0;\n            l = 0;\n        }\n        l += ww;\n        return words.push(d);\n    });\n    if (words.length) {\n        lines.push(words.join(''));\n    }\n    return lines.filter(function(d) {\n        return d !== '';\n    });\n    function char_w(c) { return !monospace && CHAR_W[c] || CHAR_W.a; }\n    function word_len(d) { return d.length; }\n    function num_asc(a, b) { return a - b; }\n}\n\n","import {selection} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport translateSelection from \"./src/translate-selection.js\";\nimport append from \"./src/append.js\";\nimport insert from \"./src/insert.js\";\nimport parent from \"./src/parent.js\";\nimport selectAppend from \"./src/selectAppend.js\";\nimport tspans from \"./src/tspans.js\";\nimport appendMany from \"./src/appendMany.js\";\nimport at from \"./src/at.js\";\nimport st from \"./src/st.js\";\n\nselection.prototype.translate = translateSelection;\ntransition.prototype.translate = translateSelection;\nselection.prototype.append = append;\nselection.prototype.insert = insert;\nselection.prototype.parent = parent;\nselection.prototype.selectAppend = selectAppend;\nselection.prototype.tspans = tspans;\nselection.prototype.appendMany = appendMany;\nselection.prototype.at = at;\nselection.prototype.st = st;\ntransition.prototype.at = at;\ntransition.prototype.st = st;\nselection.prototype.prop = selection.prototype.property;\n\nexport {default as wordwrap} from \"./src/wordwrap.js\";\nexport {default as parseAttributes} from \"./src/parseAttributes.js\";\nexport {default as f} from \"./src/f.js\";\nexport {default as ascendingKey} from \"./src/ascendingKey.js\";\nexport {default as descendingKey} from \"./src/descendingKey.js\";\nexport {default as conventions} from \"./src/conventions.js\";\nexport {default as drawAxis} from \"./src/drawAxis.js\";\nexport {default as attachTooltip} from \"./src/attachTooltip.js\";\nexport {default as loadData} from \"./src/loadData.js\";\nexport {default as nestBy} from \"./src/nestBy.js\";\nexport {default as round} from \"./src/round.js\";\nexport {default as clamp} from \"./src/clamp.js\";\nexport {default as polygonClip} from \"./src/polygonClip.js\";\nexport {default as timer} from \"./src/timer.js\";\nexport {default as interval} from \"./src/interval.js\";\nexport {default as timeout} from \"./src/timeout.js\";\n","import {creator} from \"d3-selection\";\nimport parseAttributes from \"./parseAttributes.js\";\n\nexport default function(name) {\n  var create, n;\n\n  if (typeof name === \"function\"){\n    create = name;\n  } else {\n    n = parseAttributes(name)\n    create = creator(n.tag);\n  }\n  var sel = this.select(function(){\n    return this.appendChild(create.apply(this, arguments));\n  });\n\n  if (n) for (var key in n.attr) { sel.attr(key, n.attr[key]); }\n  return sel;\n}\n\n","import {creator} from \"d3-selection\";\n\nexport default function() {\n  var parents = [];\n  return this.filter(function() {\n    if (parents.indexOf(this.parentNode) > -1) return false;\n    parents.push(this.parentNode);\n    return true;\n  }).select(function() {\n    return this.parentNode;\n  });\n}\n","import {selector} from \"d3-selection\";\nimport {creator} from \"d3-selection\";\nimport parseAttributes from \"./parseAttributes.js\";\n\nexport default function(name) {\n  var select = selector(name),\n     n = parseAttributes(name), s;\n\n  name = creator(n.tag);\n\n  s = this.select(function() {\n    return select.apply(this, arguments) ||\n        this.appendChild(name.apply(this, arguments));\n  });\n\n  //attrs not provided by default in v4\n  for (var key in n.attr) { s.attr(key, n.attr[key]); }\n  return s;\n}\n","export default function(lines, lh) {\n  return this.selectAll('tspan')\n      .data(function(d, i) {\n        return (typeof(lines) === 'function' ? lines.call(this, d, i) : lines)\n          .map(function(l) {\n            return { line: l, parent: d };\n          });\n      })\n      .enter()\n    .append('tspan')\n      .text(function(d) { return d.line; })\n      .attr('x', 0)\n      .attr('dy', function(d, i) { return i ? (typeof(lh) === 'function' ? lh.call(this, d.parent, d.line, i) : lh) || 15 : 0; });\n}\n","export default function(name, data){\n  if (typeof(data) == 'string'){\n    console.warn(\"DEPRECATED: jetpack's appendMany order of arguments has changed. It's appendMany('div', data) from now on\")\n    var temp = data\n    data = name\n    name = temp\n  }\n\n  return this.selectAll(null).data(data).enter().append(name);\n}\n","import { intword, intcomma } from 'journalize';\nimport * as d3 from 'd3';\n\nexport function customNumFormat(d, i) {\n  if (i == 0) {\n    return ``;\n  } else if (i == 1) {\n    return `${d3.format('~s')(d)}`;\n  } else if (i == 2) {\n    return `${intcomma(intword(d)).replace(' million', 'M')}`;\n  } else if (i == 3) {\n    return `${intcomma(intword(d)).replace(' million', 'M')}`;\n  }\n}\n\nexport function customNumFormatMini(d, i) {\n  if (i == 0) {\n    return ``;\n  } else if (i == 1) {\n    return `${d3.format('~s')(d)}`;\n  } else if (i == 2) {\n    return `${intcomma(intword(d)).replace(' million', 'M')}`;\n  }\n}\n\nexport function customBarNumFormat(d) {\n  return `${intcomma(intword(d)).replace(' million', 'M')}`;\n}\n","import * as d3 from 'd3';\nimport { Component, h } from 'preact';\nimport { wordwrap } from 'd3-jetpack';\n\nimport { showPrecinctsReporting } from '../endpoints';\n\nimport { customNumFormat, customBarNumFormat } from '../utils/format-numbers';\n\nclass MiniBarChart extends Component {\n  constructor() {\n    super();\n\n    this.state = {\n      width: null,\n      height: 90,\n      bodyWidth: null,\n      breakPoint: 768,\n    };\n\n    this.createGraphic = this.createGraphic.bind(this);\n    this.redrawGraphic = this.redrawGraphic.bind(this);\n    this.getContainerWidth = this.getContainerWidth.bind(this);\n  }\n\n  componentDidMount() {\n    const {\n      className,\n      categoryNumbers,\n      candidatesRender,\n      candidates,\n      officeSlug,\n      maxNum,\n    } = this.props;\n    let { width, bodyWidth } = this.getContainerWidth(officeSlug);\n\n    this.setState({ width: width, bodyWidth: bodyWidth }, () => {\n      this.createGraphic(\n        className,\n        categoryNumbers,\n        candidatesRender,\n        candidates,\n        officeSlug,\n        maxNum\n      );\n    });\n\n    window.addEventListener('resize', () => {\n      this.redrawGraphic();\n    });\n  }\n\n  componentDidUpdate() {\n    const {\n      className,\n      categoryNumbers,\n      candidatesRender,\n      candidates,\n      officeSlug,\n      maxNum,\n    } = this.props;\n\n    this.createGraphic(\n      className,\n      categoryNumbers,\n      candidatesRender,\n      candidates,\n      officeSlug,\n      maxNum\n    );\n  }\n\n  createGraphic(\n    className,\n    categoryNumbers,\n    candidatesRender,\n    candidates,\n    officeSlug,\n    maxNum\n  ) {\n    let { width, bodyWidth } = this.getContainerWidth(officeSlug);\n\n    let { height, breakPoint } = this.state;\n\n    d3.selectAll(`.bar-chart-${className}-${officeSlug} svg`).remove();\n\n    const container = d3.select(`.bar-chart-${className}-${officeSlug}`);\n\n    // chart setup\n    let margin = { top: 0, bottom: 20, right: 30, left: 70 };\n\n    (width = width - margin.left - margin.right),\n      (height =\n        categoryNumbers[1][0]['votes_still_to_count'] > 0 && showPrecinctsReporting ==  true\n          ? 90 - margin.top - margin.bottom\n          : 68 - margin.top - margin.bottom);\n\n    const isMobile = bodyWidth < breakPoint;\n\n    let svg = container\n      .append('svg')\n      .attr('width', width + margin.left + margin.right)\n      .attr('height', height + margin.top + margin.bottom);\n\n    let diagonalStripePattern = svg\n      .append('defs')\n      .append('pattern')\n      .attr('id', 'diagonal-stripe')\n      .attr('patternUnits', 'userSpaceOnUse')\n      .attr('patternTransform', 'rotate(45 0 0)')\n      .attr('width', 6)\n      .attr('height', 6);\n\n    diagonalStripePattern\n      .append('rect')\n      .attr('width', 6)\n      .attr('height', 6)\n      .style('fill', '#d9d9d9');\n\n    diagonalStripePattern\n      .append('line')\n      .attr('x1', 0)\n      .attr('y1', 0)\n      .attr('x2', 0)\n      .attr('y2', 6)\n      .style('stroke', 'black')\n      .style('stroke-width', 0.5);\n\n    let g = svg\n      .append('g')\n      .attr('class', `bar-chart-${className}-${officeSlug}-group`)\n      .attr('width', width)\n      .attr('transform', `translate(${margin.left},${margin.top})`);\n\n    let newcand = candidates.map((obj) => ({\n      ...obj,\n      last_name: obj.name.split(' ').slice(-1).join(' '),\n      category_votes: categoryNumbers[1][0][obj.id],\n    }));\n\n    if (categoryNumbers[1][0]['votes_still_to_count'] > 0 && showPrecinctsReporting == true) {\n      newcand.push({\n        category_votes: categoryNumbers[1][0]['votes_still_to_count'],\n        last_name: 'Votes left to count',\n        party: 'A-Votes',\n      });\n    }\n\n    newcand = newcand.sort(function (a, b) {\n      return a.party.localeCompare(b.party);\n    });\n\n    var x = d3.scaleLinear().range([0, width]).domain([0, maxNum]);\n\n    var y = d3\n      .scaleBand()\n      .domain(\n        newcand.map(function (entry) {\n          return entry.last_name;\n        })\n      )\n      .range([height, 0])\n      .padding(0.4);\n\n    // light gray bar underneath\n    let graybars = g\n      .selectAll('.bar-gray')\n      .data(newcand)\n      .enter()\n      .append('rect')\n      .attr('class', 'bar-light-gray')\n      .attr('fill', '#F5F5F5')\n      .attr('width', x(maxNum))\n      .attr('y', (d) => y(d.last_name))\n      .attr('height', y.bandwidth());\n\n    // add the x Axis\n    g.append('g')\n      .attr('transform', 'translate(0,' + height + ')')\n      .call(\n        d3.axisBottom(x).ticks(3).tickFormat(customNumFormat).tickSize(-height)\n      )\n      .attr('class', 'axis axis--x')\n      .selectAll('text')\n      .attr('dy', '0.99em');\n\n    // add the y Axis\n    g.append('g')\n      .attr('class', 'axis axis--y')\n      .style('text-anchor', 'end')\n      .call(d3.axisLeft(y))\n      .selectAll('text')\n      .attr('y', 5)\n      .attr('x', -5)\n      .attr('text-anchor', 'end')\n      .text('')\n      .tspans((d) => wordwrap(d, 10))\n      .attr('x', -12);\n\n    d3.selectAll('tspan')\n      .nodes()\n      .forEach((d) => {\n        if (d.textContent == 'Votes left ') {\n          d.textContent = d.textContent.replace(/[ \\t]+$/g, '');\n        }\n      });\n\n    // append the rectangles for the bar chart\n    let bars = g\n      .selectAll('.bar')\n      .data(newcand)\n      .enter()\n      .append('rect')\n      .attr('class', 'bar-category')\n      .attr('fill', (d) => {\n        let foundCandidate = candidatesRender.find((a) => a.id == d.id);\n        if (foundCandidate) return foundCandidate.color;\n        else return '#bdbdbd';\n      })\n      .attr('width', (d) => x(d.category_votes))\n      .attr('y', (d) => y(d.last_name))\n      .attr('height', y.bandwidth());\n\n    g.selectAll('.bar')\n      .data(newcand)\n      .enter()\n      .append('text')\n      .attr('x', (d) => x(d.category_votes) + 3)\n      .attr('text-anchor', 'start')\n      .attr('y', (d) => y(d.last_name) + y.bandwidth() / 2)\n      .attr('dy', '.35em')\n      .text((d) => customBarNumFormat(d.category_votes));\n  }\n\n  getContainerWidth(office_slug) {\n    let base;\n\n    const body = d3.select('body');\n\n    base = d3.select('.contest-showcase__contest.' + office_slug);\n\n    const width = base.node().offsetWidth - 80;\n    const bodyWidth = body.node().offsetWidth;\n\n    return { width, bodyWidth };\n  }\n\n  redrawGraphic() {\n    const {\n      className,\n      categoryNumbers,\n      candidatesRender,\n      candidates,\n      officeSlug,\n      maxNum,\n    } = this.props;\n\n    d3.selectAll(`.bar-chart-${className}-${officeSlug} svg`).remove();\n\n    let { width, bodyWidth } = this.getContainerWidth(officeSlug);\n\n    this.setState({ width: width, bodyWidth: bodyWidth });\n    this.createGraphic(\n      className,\n      categoryNumbers,\n      candidatesRender,\n      candidates,\n      officeSlug,\n      maxNum\n    );\n  }\n\n  componentWillUnmount() {\n    window.addEventListener('resize', () => {\n      this.redrawGraphic();\n    });\n  }\n\n  render() {\n    const { className, officeSlug } = this.props;\n\n    return (\n      <div\n        class={`category-bar-chart bar-chart-${className}-${officeSlug}`}\n      ></div>\n    );\n  }\n}\n\nexport default MiniBarChart;\n","import cx from 'classnames';\nimport { Component, h } from 'preact';\n\nimport TinyMap from './TinyMap';\n\nimport text from 'Data/text.json';\nimport MiniBarChart from './MiniBarChart';\n\ninterface Props {\n  category: string;\n  maxNum: number;\n  categoryNumbers: { [key: string]: any };\n  contest: { [key: string]: any };\n  candidates: { [key: string]: any };\n  candidatesRender: any;\n}\n\nclass AnalysisTableRow extends Component {\n  constructor() {\n    super();\n  }\n\n  render() {\n    const {\n      category,\n      categoryNumbers,\n      candidatesRender,\n      contest,\n      maxNum,\n      candidates,\n    } = this.props;\n\n    let categoryClass = cx(\n      'category-bar-chart-' + category + '-' + contest.office_slug\n    );\n\n    const category_text = text.geocategories.find((a) => a.type == category)[\n      'value'\n    ];\n\n    const category_explain = text.geocategories_explain.find(\n      (a) => a.type == category\n    )['value'];\n\n    return (\n      <div class='category-grid t-sans'>\n        <h4 class='map__title'>{category_text}</h4>\n        <p class='map__explain'>{category_explain}</p>\n        <div class='category-inline-grid'>\n          <TinyMap\n            contest={contest}\n            category={category}\n            candidatesRender={candidatesRender}\n          />\n          <div class={categoryClass}>\n            <MiniBarChart\n              className={category}\n              maxNum={maxNum}\n              officeSlug={contest.office_slug}\n              categoryNumbers={categoryNumbers}\n              candidatesRender={candidatesRender}\n              candidates={candidates}\n            />\n          </div>\n        </div>\n      </div>\n    );\n  }\n}\n\nexport default AnalysisTableRow;\n","import { Component, h } from 'preact';\n\nimport AnalysisTableRow from './AnalysisTableRow';\n\nimport { GOVERNOR, AG } from '../colors';\n\nimport { DDHQestimatedvotes, showPrecinctsReporting } from '../endpoints';\n\nimport countiesData from 'Data/data.json';\nimport context from 'Data/text.json';\n\ntype Props = {\n  contest: { [key: string]: any },\n};\n\nclass AnalysisTable extends Component<Props> {\n  constructor() {\n    super();\n  }\n\n  render() {\n    const { contest, candidates, counties } = this.props;\n\n    const firstShowcaseRace = contest && contest.office == 'Governor';\n\n    let candidatesRender, sourceMap;\n\n    if (contest) {\n      let candidates = contest.candidacies;\n\n      // Adding the colors and new ids for the candidates in the showcase spot\n\n      candidatesRender = firstShowcaseRace\n        ? GOVERNOR.map((object) => {\n            const result = candidates\n              .filter((obj) => obj.name == object.name)\n              .map((obj) => obj.id);\n            return { ...object, id: result[0] };\n          })\n        : AG.map((object) => {\n            const result = candidates\n              .filter((obj) => obj.name == object.name)\n              .map((obj) => obj.id);\n            return { ...object, id: result[0] };\n          });\n\n      sourceMap = contest.source;\n    }\n\n    // This function divides each county into categories (urban, suburban, red/rural and border) and adds the total votes for the counties in these categories for each candidate. We also add up the estimated votes left to count, the total votes that all candidates received, as well as the largest number in this array.\n\n    function groupBy(arr, criteria) {\n      const newObj = arr.reduce(function (acc, currentValue) {\n        if (!acc[currentValue[criteria]]) {\n          acc[currentValue[criteria]] = [];\n        }\n        const findCounties = counties\n          .filter((county) => county.county == currentValue['county'])\n          .map((obj) => obj.results)[0];\n        const findCounties2 = counties\n          .filter((county) => county.county == currentValue['county'])\n          .map((obj) => obj[DDHQestimatedvotes])[0];\n        let arrayCounties = {\n          ...currentValue,\n          ...findCounties,\n          estimated_votes: findCounties2,\n        };\n        acc[currentValue[criteria]].push(arrayCounties);\n        return acc;\n      }, {});\n\n      const summedEntries = [];\n\n      Object.entries(newObj).forEach(function (val, idx) {\n        const result = val[1].reduce((r, e, i, a) => {\n          const candidateIds = Object.keys(e);\n          candidateIds.forEach((k) => (r[k] = (r[k] || 0) + parseInt(e[k])));\n\n          if (!a[i + 1])\n            Object.keys(e)\n              .filter((k) => typeof e[k] == 'string')\n              .forEach((k) => (r[k] /= val[1].length));\n          r['category'] = e.category;\n          delete r['county'];\n          delete r['county_CAPS'];\n\n          return r;\n        });\n        summedEntries.push(result);\n      });\n      return summedEntries;\n    }\n\n    // This function adds a key (border, red, suburban, urban) to each array\n\n    function createArray(arr, criteria) {\n      const newObj = arr.reduce(function (acc, currentValue) {\n        if (!acc[currentValue[criteria]]) {\n          acc[currentValue[criteria]] = [];\n        }\n        acc[currentValue[criteria]].push(currentValue);\n        return acc;\n      }, []);\n\n      Object.entries(newObj).forEach(function (item, idx) {\n        function sum(obj) {\n          var sum = 0;\n          var arrayToGetMost = [];\n          for (var el in obj) {\n            if (el !== 'category' && el !== 'estimated_votes') {\n              sum += parseFloat(obj[el]);\n              arrayToGetMost.push(obj[el]);\n            }\n          }\n          return [sum, arrayToGetMost];\n        }\n        var totals = sum(item[1][0]);\n        item[1][0].total_votes = totals[0];\n        item[1][0].votes_still_to_count =\n          item[1][0].estimated_votes - totals[0];\n        totals[1].push(item[1][0].estimated_votes - totals[0]);\n        item[1][0].largest_number = Math.max(...totals[1]);\n        delete item[1][0].category;\n      });\n      return newObj;\n    }\n\n    const countiesByCategory = groupBy(countiesData.counties, 'category');\n\n    const arrayByCategories = createArray(countiesByCategory, 'category');\n\n    // Turn the arrayByCategories into entries for easy looping\n\n    const objectCategories = Object.entries(arrayByCategories);\n\n    // Find the largest number in all of the arrays for all categories. Also, add the sum of votes left to count. This is so when the count hits zero for all categories, we don't show the note at the bottom of the graphic talking about Decision Desk's turnout estimates mode.\n\n    let arrayToGetLargest = [];\n\n    var sumofVotesLeftToCount = 0;\n\n    objectCategories.forEach((item) => {\n      arrayToGetLargest.push(item[1][0].largest_number);\n      sumofVotesLeftToCount += item[1][0].votes_still_to_count;\n    });\n\n    return (\n      <span>\n        <h3 class='category__title t-sans'>{context.categories_headline}</h3>\n        <div class='category-grids t-sans'>\n          {objectCategories.map((categories) => (\n            <AnalysisTableRow\n              contest={contest}\n              category={categories[0]}\n              maxNum={Math.max(...arrayToGetLargest)}\n              categoryNumbers={categories}\n              candidates={candidates}\n              candidatesRender={candidatesRender}\n            />\n          ))}\n        </div>\n        {sumofVotesLeftToCount > 0 || showPrecinctsReporting == false && (\n          <ul class='graphic-footer'>\n            <li data-note>Note: {context.categories_notes}</li>\n          </ul>\n        )}\n      </span>\n    );\n  }\n}\n\nexport default AnalysisTable;\n","import cx from 'classnames';\nimport { h } from 'preact';\n\nfunction Ad() {\n  const classes = cx('c-ad-flex_bg--gray preact__ad');\n\n  return (\n    <div class=\"plugin plugin--centered\">\n      <div class={classes}>\n        <div class=\"c-ad-flex__inner\">\n          <p class=\"c-ad-flex__thanks\">\n            The Texas Tribune thanks its sponsors.\n            <a href=\"https://mediakit.texastribune.org/\">\n              <strong>Become one</strong>\n            </a>\n            .\n          </p>\n          <div class=\"c-ad-flex__unit\">\n            <div class=\"dv-gpt-ad\"></div>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n\nexport default Ad;\n","import { map } from 'd3-collection';\n\nconst lookup = map();\n\nconst buildURL = path => `${process.env.PUBLIC_PATH}${path}`;\n\n// gov race\nlookup.set(\"Beto O'Rourke\", buildURL('assets/images/beto.png'));\n\nlookup.set('Greg Abbott', buildURL('assets/images/abbott.png'));\n\n// ag race (just in case)\n\nlookup.set('Ken Paxton', buildURL('assets/images/paxton.png'));\n\nlookup.set('Rochelle Garza', buildURL('assets/images/garza.png'));\n\nexport { lookup };\n","// packages\nimport { Component, h } from 'preact';\nimport cx from 'classnames';\n\n// components\nimport CandidateRow from './components/CandidateRow';\nimport Contest from './components/Contest';\nimport NewContestShowcase from './components/NewContestShowcase';\nimport BalancePower from './components/BalancePower';\nimport MiniBalancePower from './components/MiniBalancePower';\nimport YourRaces from './components/YourRaces';\nimport Portal from './components/Portal';\nimport AnalysisTable from './components/AnalysisTable';\n\nimport find from './utils/find';\nimport {\n  determineContestTitle,\n  lastUpdatedFormat,\n  chunk,\n  sort_candidates_by_party,\n} from './election-utils';\nimport {\n  RESULTS_IN_USE,\n  visibleCandidatesCount,\n  DDHQestimatedvotes,\n  showCategoriesMap,\n  showPrecinctsReporting\n} from './endpoints';\nimport getJSON from './utils/get-json';\nimport { LENGTH_OF_CHECK_INTERVAL } from './constants';\n\nimport Ad from './components/Ad';\nimport { lookup } from './photoMap';\nimport sumValues from './utils/sum-values';\nimport formatPercent from './utils/format-percent';\n\nimport analysisData from 'Data/data.json';\n\ntype State = {\n  data: { [key: string]: any },\n  now: Date | null,\n};\n\nclass App extends Component<{}, State> {\n  //   timer!: number;\n\n  constructor() {\n    super();\n\n    this.state = {\n      data: [],\n      now: null,\n      timer: 0,\n    };\n\n    this.fetchData = this.fetchData.bind(this);\n    this.prepareData = this.prepareData.bind(this);\n  }\n\n  fetchData() {\n    const now = new Date();\n    console.info('Requesting:', now);\n\n    const asOf = lastUpdatedFormat(now);\n\n    // Uncomment if you want to bring back last updated in sticky bar\n\n    // document.querySelector('.counter').innerHTML = asOf;\n\n    // document.querySelector('.counter-mobile .counter').innerHTML = asOf;\n\n    getJSON(RESULTS_IN_USE).then((data) =>\n      this.setState({ data, asOf }, this.startTimer)\n    );\n  }\n\n  prepareData(data, className, chamber, total, halfway) {\n    let republican = 0,\n      democrat = 0,\n      vacant = 0,\n      uncontested_republican = 0,\n      uncontested_democrat = 0;\n\n    data.forEach((contest) => {\n      // console.log(contest)\n      if (\n        contest.contest_result == 'not called' &&\n        contest.candidacies.length > 1\n      ) {\n        vacant++;\n      } else if (\n        (contest.contest_result == 'not called' ||\n          contest.contest_result == 'uncontested') &&\n        contest.candidacies.length == 1 &&\n        contest.candidacies[0].party == 'Republican'\n      ) {\n        uncontested_republican++;\n      } else if (\n        (contest.contest_result == 'not called' ||\n          contest.contest_result == 'uncontested') &&\n        contest.candidacies.length == 1 &&\n        contest.candidacies[0].party == 'Democrat'\n      ) {\n        uncontested_democrat++;\n      } else if (\n        contest.contest_result == 'winner' &&\n        contest.candidacies.length > 1 &&\n        find(contest.candidacies, (candidate) => candidate.is_winner === true) && \n        find(contest.candidacies, (candidate) => candidate.is_winner === true)\n          .party == 'Republican'\n      ) {\n        republican++;\n      } else if (\n        contest.contest_result == 'winner' &&\n        contest.candidacies.length > 1 &&\n        find(contest.candidacies, (candidate) => candidate.is_winner === true) && \n        find(contest.candidacies, (candidate) => candidate.is_winner === true)\n          .party == 'Democrat'\n      ) {\n        democrat++;\n      }\n    });\n\n    return {\n      chamber: chamber,\n      className: className,\n      republican: republican,\n      democrat: democrat,\n      vacant: vacant,\n      halfway: halfway,\n      total: total,\n      uncontested_republican: uncontested_republican,\n      uncontested_democrat: uncontested_democrat,\n    };\n  }\n\n  startTimer() {\n    this.timer = window.setTimeout(this.fetchData, LENGTH_OF_CHECK_INTERVAL);\n  }\n\n  clearTimer() {\n    window.clearTimeout(this.timer);\n  }\n\n  componentDidMount() {\n    this.fetchData();\n  }\n\n  componentWillUnmount() {\n    this.clearTimer();\n  }\n\n  componentDidUpdate() {}\n\n  render() {\n    const { notes, annotations } = this.props;\n    const { data, asOf } = this.state;\n\n    // In order to sprinkle ads between races in sections where there a lot of races like the Texas House, we need to divide them into groups of nth races to make it into different divs\n\n    const texasHouse = data.filter(\n      (contest) => contest.office === 'Texas House'\n    );\n\n    const usHouse = data.filter((contest) => contest.office === 'U.S. House');\n\n    let texasHouseGroups, usHouseGroups;\n\n    if (texasHouse.length) {\n      texasHouseGroups = chunk(texasHouse, 28);\n      usHouseGroups = chunk(usHouse, 24);\n    }\n\n    const pastPowerBalance = analysisData['past_balance_of_power'];\n\n    const checkmark = '\\u2713';\n\n    // {cx('check', {\n    //   'rep-winner': candidate.party == 'Republican',\n    //   'dem-winner': candidate.party == 'Democrat',\n    // })}\n\n    return (\n      <div class=\"results\">\n        <Portal\n          node={document.getElementById('lookup-select')}\n          ref={(ref) => (this._yourPortal = ref)}\n        >\n          <YourRaces\n            contests={data}\n            notes={notes}\n            annotations={annotations}\n            asOf={asOf}\n          />\n        </Portal>\n\n        <Portal\n          node={document.querySelector('.headshot-results')}\n          ref={(ref) => (this._yourPortal = ref)}\n        >\n          {data &&\n            data\n              .filter((chamber) => chamber.office == 'Governor')\n              .map((chamber, i) => (\n                <div class=\"headshot-result\">\n                  <div class=\"headshot-title\"><a href={`#${chamber.office_slug}`} class='anchor'>{chamber.office}</a></div>\n                  <div class=\"top-candidates\">\n                    {sort_candidates_by_party(chamber.candidacies)\n                      .filter(\n                        (candidate) =>\n                          candidate.name === 'Greg Abbott' ||\n                          candidate.name === \"Beto O'Rourke\"\n                      )\n                      .map((candidate) => (\n                        <div class=\"top-candidate\">\n                          <img\n                            class={'headshot'}\n                            alt={`Headshot of ` + candidate.name}\n                            src={lookup.get(candidate.name)}\n                          />\n                          <div\n                            class={cx('top-candidate-name', {\n                              dd_winner_rep: candidate.party == 'Republican',\n                              dd_winner_dem: candidate.party == 'Democrat',\n                            })}\n                          >\n                            {candidate.is_winner == true && (\n                              <span class=\"check\">{checkmark}</span>\n                            )}\n                            {candidate.name.split(' ')[1]}{' '}\n                          </div>\n                          <div class=\"top-candidate-votes\">\n                            {formatPercent(\n                              candidate.votes,\n                              sumValues(chamber.candidacies, 'votes')\n                            )}\n                            %\n                          </div>\n                        </div>\n                      ))}\n                  </div>\n                 {showPrecinctsReporting == true && ( <p class=\"contest__precincts\">\n                    {formatPercent(\n                      sumValues(chamber.candidacies, 'votes'),\n                      chamber[DDHQestimatedvotes]\n                    ) < 100\n                      ? `${formatPercent(\n                          sumValues(chamber.candidacies, 'votes'),\n                          chamber[DDHQestimatedvotes]\n                        )}% votes counted`\n                      : `>99% votes counted`}\n                  </p>)}\n                </div>\n              ))}\n        </Portal>\n\n        {data &&\n          pastPowerBalance\n            .filter((chamber) => chamber.chamber !== 'U.S. House')\n            .map((chamber) => (\n              <Portal\n                node={document.querySelector(`.mini-${chamber.className}`)}\n                ref={(ref) => (this._usPortal = ref)}\n              >\n                <div class=\"mini-balance-of-power\">\n                  <div class=\"headshot-title\">\n                    {data.length > 0 && (<a href={`#${chamber.className}`} class='anchor'>{chamber.chamber}</a>)}\n                  </div>\n                  <MiniBalancePower\n                    className={chamber.className}\n                    currentData={this.prepareData(\n                      data.filter(\n                        (contest) => contest.office === chamber.chamber\n                      ),\n                      chamber.className,\n                      chamber.chamber,\n                      chamber.total_current,\n                      chamber.halfway\n                    )}\n                  />\n                </div>\n              </Portal>\n            ))}\n\n        <NewContestShowcase\n          contest={find(data, (contest) => contest.office === 'Governor')}\n          container={document.querySelector('#governor')}\n          annotations={annotations.filter((item) => item.type === 'governor')}\n          asOf={asOf}\n        />\n        <NewContestShowcase\n          contest={find(\n            data,\n            (contest) => contest.office === 'Attorney General'\n          )}\n          container={document.querySelector('#attorney-general')}\n          annotations={annotations.filter(\n            (item) => item.type === 'attorney-general'\n          )}\n          asOf={asOf}\n        />\n\n       \n\n        {data &&\n          pastPowerBalance.map((chamber) => (\n            <Portal\n              node={document.querySelector(\n                `.${chamber.className}-balance-graphic`\n              )}\n              ref={(ref) => (this._usPortal = ref)}\n            >\n              <div class=\"balance-of-power-container\">\n                <BalancePower\n                  pastData={chamber}\n                  chamber={chamber.chamber}\n                  className={chamber.className}\n                  currentData={this.prepareData(\n                    data.filter(\n                      (contest) => contest.office === chamber.chamber\n                    ),\n                    chamber.className,\n                    chamber.chamber,\n                    chamber.total_current,\n                    chamber.halfway\n                  )}\n                />\n              </div>\n            </Portal>\n          ))}\n\n{data &&\n          showCategoriesMap &&\n          data\n            .filter(\n              (contest) =>\n                contest.office == 'Governor' ||\n                contest.office == 'Attorney General'\n            )\n            .map((contest) => (\n              <Portal\n                node={document.querySelector(\n                  `.contest-counties-container.${contest.office_slug}`\n                )}\n                ref={(ref) => (this._usPortal = ref)}\n              >\n                <AnalysisTable\n                  contest={contest}\n                  candidates={contest.candidacies.filter(\n                    (candidate) =>\n                      candidate.name === \"Beto O'Rourke\" ||\n                      candidate.name === 'Greg Abbott' ||\n                      candidate.name === 'Ken Paxton' ||\n                      candidate.name === 'Rochelle Garza'\n                  )}\n                  counties={contest.counties}\n                />\n              </Portal>\n            ))}\n\n        <Portal\n          node={document.querySelector('#us-house .contests')}\n          ref={(ref) => (this._usPortal = ref)}\n        >\n          <div class=\"office__contests\">\n            {usHouse.length > 0 &&\n              usHouseGroups.map((contestGroup) => (\n                <div class=\"contest-group\">\n                  <div class=\"seat__contests-double\">\n                    {contestGroup.map((contest) => (\n                      <Contest\n                        key={contest.id}\n                        contest={contest}\n                        tableHeader={CandidateRow.Header}\n                        columnCount={CandidateRow.columnCount}\n                        contestTitle={determineContestTitle(\n                          data.filter(\n                            (item) => item.office_slug === contest.office_slug\n                          )[0]\n                        )}\n                        partyName={contest.party}\n                        annotations={annotations.filter(\n                          (item) => item.type === contest.office_slug\n                        )}\n                        notes={notes.filter(\n                          (item) => item.type === contest.office_slug\n                        )}\n                        source={contest.source}\n                        asOf={asOf}\n                        renderCandidate={(\n                          candidate,\n                          idx,\n                          viewAllCandidates,\n                          { totalVotes }\n                        ) => (\n                          <CandidateRow\n                            ballotName={candidate.name}\n                            contestOffice={contest.office}\n                            contestIsCalled={contest.is_called}\n                            contestResult={contest.contest_result}\n                            isIncumbent={candidate.is_incumbent}\n                            isWinner={candidate.is_winner}\n                            isViewable={\n                              viewAllCandidates || idx < visibleCandidatesCount\n                            }\n                            party={candidate.party}\n                            totalVotesInContest={totalVotes}\n                            votes={candidate.votes}\n                          />\n                        )}\n                      />\n                    ))}\n                  </div>\n                  <Ad />\n                </div>\n              ))}\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector('#lieutenant-governor .contests')}\n          ref={(ref) => (this._supremePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-single\">\n              {data\n                .filter((contest) => contest.office === 'Lieutenant Governor')\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector('#land-commissioner .contests')}\n          ref={(ref) => (this._supremePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-single\">\n              {data\n                .filter((contest) => contest.office === 'Land Commissioner')\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector('#comptroller .contests')}\n          ref={(ref) => (this._supremePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-single\">\n              {data\n                .filter((contest) => contest.office === 'Comptroller')\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector('#agriculture-commissioner .contests')}\n          ref={(ref) => (this._supremePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-single\">\n              {data\n                .filter(\n                  (contest) => contest.office === 'Agriculture Commissioner'\n                )\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector(\n            '#railroad-commission-of-texas .contests'\n          )}\n          ref={(ref) => (this._supremePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-single\">\n              {data\n                .filter(\n                  (contest) => contest.office === 'Texas Railroad Commission'\n                )\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector('#state-board-of-education .contests')}\n          ref={(ref) => (this._sboePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-double\">\n              {data\n                .filter(\n                  (contest) => contest.office === 'State Board of Education'\n                )\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector('#texas-supreme-court .contests')}\n          ref={(ref) => (this._sboePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-double\">\n              {data\n                .filter((contest) => contest.office === 'Texas Supreme Court')\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector(\n            '#texas-court-of-criminal-appeals .contests'\n          )}\n          ref={(ref) => (this._sboePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-double\">\n              {data\n                .filter(\n                  (contest) =>\n                    contest.office === 'Texas Court of Criminal Appeals'\n                )\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n        <Portal\n          node={document.querySelector('#texas-senate .contests')}\n          ref={(ref) => (this._senatePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            <div class=\"seat__contests-double\">\n              {data\n                .filter((contest) => contest.office === 'Texas Senate')\n                .map((contest) => (\n                  <Contest\n                    key={contest.id}\n                    contest={contest}\n                    tableHeader={CandidateRow.Header}\n                    columnCount={CandidateRow.columnCount}\n                    contestTitle={determineContestTitle(\n                      data.filter(\n                        (item) => item.office_slug === contest.office_slug\n                      )[0]\n                    )}\n                    partyName={contest.party}\n                    annotations={annotations.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    notes={notes.filter(\n                      (item) => item.type === contest.office_slug\n                    )}\n                    source={contest.source}\n                    asOf={asOf}\n                    renderCandidate={(\n                      candidate,\n                      idx,\n                      viewAllCandidates,\n                      { totalVotes }\n                    ) => (\n                      <CandidateRow\n                        ballotName={candidate.name}\n                        contestOffice={contest.office}\n                        contestIsCalled={contest.is_called}\n                        contestResult={contest.contest_result}\n                        candidatesNum={contest.candidacies.length}\n                        isIncumbent={candidate.is_incumbent}\n                        isWinner={candidate.is_winner}\n                        isViewable={\n                          viewAllCandidates || idx < visibleCandidatesCount\n                        }\n                        party={candidate.party}\n                        totalVotesInContest={totalVotes}\n                        votes={candidate.votes}\n                      />\n                    )}\n                  />\n                ))}\n            </div>\n          </div>\n        </Portal>\n\n        <Portal\n          node={document.querySelector('#texas-house .contests')}\n          ref={(ref) => (this._housePortal = ref)}\n        >\n          <div class=\"office__contests\">\n            {texasHouse.length > 0 &&\n              texasHouseGroups.map((contestGroup) => (\n                <div class=\"contest-group\">\n                  <div class=\"seat__contests-double\">\n                    {contestGroup.map((contest) => (\n                      <Contest\n                        key={contest.id}\n                        contest={contest}\n                        tableHeader={CandidateRow.Header}\n                        columnCount={CandidateRow.columnCount}\n                        contestTitle={determineContestTitle(\n                          data.filter(\n                            (item) => item.office_slug === contest.office_slug\n                          )[0]\n                        )}\n                        partyName={contest.party}\n                        annotations={annotations.filter(\n                          (item) => item.type === contest.office_slug\n                        )}\n                        notes={notes.filter(\n                          (item) => item.type === contest.office_slug\n                        )}\n                        source={contest.source}\n                        asOf={asOf}\n                        renderCandidate={(\n                          candidate,\n                          idx,\n                          viewAllCandidates,\n                          { totalVotes }\n                        ) => (\n                          <CandidateRow\n                            ballotName={candidate.name}\n                            contestOffice={contest.office}\n                            contestIsCalled={contest.is_called}\n                            contestResult={contest.contest_result}\n                            candidatesNum={contest.candidacies.length}\n                            isIncumbent={candidate.is_incumbent}\n                            isWinner={candidate.is_winner}\n                            isViewable={\n                              viewAllCandidates || idx < visibleCandidatesCount\n                            }\n                            party={candidate.party}\n                            totalVotesInContest={totalVotes}\n                            votes={candidate.votes}\n                          />\n                        )}\n                      />\n                    ))}\n                  </div>\n                  <Ad />\n                </div>\n              ))}\n          </div>\n        </Portal>\n      </div>\n    );\n  }\n}\n\nexport default App;\n","// import JS files\nimport '../kickstart';\nimport './sticky-nav-bar';\n\nimport { h, render } from 'preact';\n\n// Components\nimport App from '../ResultsApp';\nimport loadJsonScript from '../utils/load-json-script';\n\nconst notes = loadJsonScript('notes_data');\n\nconst annotations = loadJsonScript('annotations_data');\n\nrender(\n  <App notes={notes} annotations={annotations} />,\n  document.getElementById('app')\n);\n","import noop from \"../noop.js\";\n\nvar x0 = Infinity,\n    y0 = x0,\n    x1 = -x0,\n    y1 = x1;\n\nvar boundsStream = {\n  point: boundsPoint,\n  lineStart: noop,\n  lineEnd: noop,\n  polygonStart: noop,\n  polygonEnd: noop,\n  result: function() {\n    var bounds = [[x0, y0], [x1, y1]];\n    x1 = y1 = -(y0 = x0 = Infinity);\n    return bounds;\n  }\n};\n\nfunction boundsPoint(x, y) {\n  if (x < x0) x0 = x;\n  if (x > x1) x1 = x;\n  if (y < y0) y0 = y;\n  if (y > y1) y1 = y;\n}\n\nexport default boundsStream;\n","import { feature, lineString, isObject, point } from '@turf/helpers';\n\n/**\n * Callback for coordEach\n *\n * @callback coordEachCallback\n * @param {Array<number>} currentCoord The current coordinate being processed.\n * @param {number} coordIndex The current index of the coordinate being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n */\n\n/**\n * Iterate over coordinates in any GeoJSON object, similar to Array.forEach()\n *\n * @name coordEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentCoord, coordIndex, featureIndex, multiFeatureIndex)\n * @param {boolean} [excludeWrapCoord=false] whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n *   turf.point([26, 37], {\"foo\": \"bar\"}),\n *   turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.coordEach(features, function (currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n *   //=currentCoord\n *   //=coordIndex\n *   //=featureIndex\n *   //=multiFeatureIndex\n *   //=geometryIndex\n * });\n */\nfunction coordEach(geojson, callback, excludeWrapCoord) {\n  // Handles null Geometry -- Skips this GeoJSON\n  if (geojson === null) return;\n  var j,\n    k,\n    l,\n    geometry,\n    stopG,\n    coords,\n    geometryMaybeCollection,\n    wrapShrink = 0,\n    coordIndex = 0,\n    isGeometryCollection,\n    type = geojson.type,\n    isFeatureCollection = type === \"FeatureCollection\",\n    isFeature = type === \"Feature\",\n    stop = isFeatureCollection ? geojson.features.length : 1;\n\n  // This logic may look a little weird. The reason why it is that way\n  // is because it's trying to be fast. GeoJSON supports multiple kinds\n  // of objects at its root: FeatureCollection, Features, Geometries.\n  // This function has the responsibility of handling all of them, and that\n  // means that some of the `for` loops you see below actually just don't apply\n  // to certain inputs. For instance, if you give this just a\n  // Point geometry, then both loops are short-circuited and all we do\n  // is gradually rename the input until it's called 'geometry'.\n  //\n  // This also aims to allocate as few resources as possible: just a\n  // few numbers and booleans, rather than any temporary arrays as would\n  // be required with the normalization approach.\n  for (var featureIndex = 0; featureIndex < stop; featureIndex++) {\n    geometryMaybeCollection = isFeatureCollection\n      ? geojson.features[featureIndex].geometry\n      : isFeature\n      ? geojson.geometry\n      : geojson;\n    isGeometryCollection = geometryMaybeCollection\n      ? geometryMaybeCollection.type === \"GeometryCollection\"\n      : false;\n    stopG = isGeometryCollection\n      ? geometryMaybeCollection.geometries.length\n      : 1;\n\n    for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {\n      var multiFeatureIndex = 0;\n      var geometryIndex = 0;\n      geometry = isGeometryCollection\n        ? geometryMaybeCollection.geometries[geomIndex]\n        : geometryMaybeCollection;\n\n      // Handles null Geometry -- Skips this geometry\n      if (geometry === null) continue;\n      coords = geometry.coordinates;\n      var geomType = geometry.type;\n\n      wrapShrink =\n        excludeWrapCoord &&\n        (geomType === \"Polygon\" || geomType === \"MultiPolygon\")\n          ? 1\n          : 0;\n\n      switch (geomType) {\n        case null:\n          break;\n        case \"Point\":\n          if (\n            callback(\n              coords,\n              coordIndex,\n              featureIndex,\n              multiFeatureIndex,\n              geometryIndex\n            ) === false\n          )\n            return false;\n          coordIndex++;\n          multiFeatureIndex++;\n          break;\n        case \"LineString\":\n        case \"MultiPoint\":\n          for (j = 0; j < coords.length; j++) {\n            if (\n              callback(\n                coords[j],\n                coordIndex,\n                featureIndex,\n                multiFeatureIndex,\n                geometryIndex\n              ) === false\n            )\n              return false;\n            coordIndex++;\n            if (geomType === \"MultiPoint\") multiFeatureIndex++;\n          }\n          if (geomType === \"LineString\") multiFeatureIndex++;\n          break;\n        case \"Polygon\":\n        case \"MultiLineString\":\n          for (j = 0; j < coords.length; j++) {\n            for (k = 0; k < coords[j].length - wrapShrink; k++) {\n              if (\n                callback(\n                  coords[j][k],\n                  coordIndex,\n                  featureIndex,\n                  multiFeatureIndex,\n                  geometryIndex\n                ) === false\n              )\n                return false;\n              coordIndex++;\n            }\n            if (geomType === \"MultiLineString\") multiFeatureIndex++;\n            if (geomType === \"Polygon\") geometryIndex++;\n          }\n          if (geomType === \"Polygon\") multiFeatureIndex++;\n          break;\n        case \"MultiPolygon\":\n          for (j = 0; j < coords.length; j++) {\n            geometryIndex = 0;\n            for (k = 0; k < coords[j].length; k++) {\n              for (l = 0; l < coords[j][k].length - wrapShrink; l++) {\n                if (\n                  callback(\n                    coords[j][k][l],\n                    coordIndex,\n                    featureIndex,\n                    multiFeatureIndex,\n                    geometryIndex\n                  ) === false\n                )\n                  return false;\n                coordIndex++;\n              }\n              geometryIndex++;\n            }\n            multiFeatureIndex++;\n          }\n          break;\n        case \"GeometryCollection\":\n          for (j = 0; j < geometry.geometries.length; j++)\n            if (\n              coordEach(geometry.geometries[j], callback, excludeWrapCoord) ===\n              false\n            )\n              return false;\n          break;\n        default:\n          throw new Error(\"Unknown Geometry Type\");\n      }\n    }\n  }\n}\n\n/**\n * Callback for coordReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n *  - The previousValue argument is initialValue.\n *  - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n *  - The previousValue argument is the value of the first element present in the array.\n *  - The currentValue argument is the value of the second element present in the array.\n *\n * @callback coordReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Array<number>} currentCoord The current coordinate being processed.\n * @param {number} coordIndex The current index of the coordinate being processed.\n * Starts at index 0, if an initialValue is provided, and at index 1 otherwise.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n */\n\n/**\n * Reduce coordinates in any GeoJSON object, similar to Array.reduce()\n *\n * @name coordReduce\n * @param {FeatureCollection|Geometry|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentCoord, coordIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @param {boolean} [excludeWrapCoord=false] whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n *   turf.point([26, 37], {\"foo\": \"bar\"}),\n *   turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.coordReduce(features, function (previousValue, currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n *   //=previousValue\n *   //=currentCoord\n *   //=coordIndex\n *   //=featureIndex\n *   //=multiFeatureIndex\n *   //=geometryIndex\n *   return currentCoord;\n * });\n */\nfunction coordReduce(geojson, callback, initialValue, excludeWrapCoord) {\n  var previousValue = initialValue;\n  coordEach(\n    geojson,\n    function (\n      currentCoord,\n      coordIndex,\n      featureIndex,\n      multiFeatureIndex,\n      geometryIndex\n    ) {\n      if (coordIndex === 0 && initialValue === undefined)\n        previousValue = currentCoord;\n      else\n        previousValue = callback(\n          previousValue,\n          currentCoord,\n          coordIndex,\n          featureIndex,\n          multiFeatureIndex,\n          geometryIndex\n        );\n    },\n    excludeWrapCoord\n  );\n  return previousValue;\n}\n\n/**\n * Callback for propEach\n *\n * @callback propEachCallback\n * @param {Object} currentProperties The current Properties being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Iterate over properties in any GeoJSON object, similar to Array.forEach()\n *\n * @name propEach\n * @param {FeatureCollection|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentProperties, featureIndex)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n *     turf.point([26, 37], {foo: 'bar'}),\n *     turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.propEach(features, function (currentProperties, featureIndex) {\n *   //=currentProperties\n *   //=featureIndex\n * });\n */\nfunction propEach(geojson, callback) {\n  var i;\n  switch (geojson.type) {\n    case \"FeatureCollection\":\n      for (i = 0; i < geojson.features.length; i++) {\n        if (callback(geojson.features[i].properties, i) === false) break;\n      }\n      break;\n    case \"Feature\":\n      callback(geojson.properties, 0);\n      break;\n  }\n}\n\n/**\n * Callback for propReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n *  - The previousValue argument is initialValue.\n *  - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n *  - The previousValue argument is the value of the first element present in the array.\n *  - The currentValue argument is the value of the second element present in the array.\n *\n * @callback propReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {*} currentProperties The current Properties being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Reduce properties in any GeoJSON object into a single value,\n * similar to how Array.reduce works. However, in this case we lazily run\n * the reduction, so an array of all properties is unnecessary.\n *\n * @name propReduce\n * @param {FeatureCollection|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentProperties, featureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n *     turf.point([26, 37], {foo: 'bar'}),\n *     turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.propReduce(features, function (previousValue, currentProperties, featureIndex) {\n *   //=previousValue\n *   //=currentProperties\n *   //=featureIndex\n *   return currentProperties\n * });\n */\nfunction propReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  propEach(geojson, function (currentProperties, featureIndex) {\n    if (featureIndex === 0 && initialValue === undefined)\n      previousValue = currentProperties;\n    else\n      previousValue = callback(previousValue, currentProperties, featureIndex);\n  });\n  return previousValue;\n}\n\n/**\n * Callback for featureEach\n *\n * @callback featureEachCallback\n * @param {Feature<any>} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Iterate over features in any GeoJSON object, similar to\n * Array.forEach.\n *\n * @name featureEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentFeature, featureIndex)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n *   turf.point([26, 37], {foo: 'bar'}),\n *   turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.featureEach(features, function (currentFeature, featureIndex) {\n *   //=currentFeature\n *   //=featureIndex\n * });\n */\nfunction featureEach(geojson, callback) {\n  if (geojson.type === \"Feature\") {\n    callback(geojson, 0);\n  } else if (geojson.type === \"FeatureCollection\") {\n    for (var i = 0; i < geojson.features.length; i++) {\n      if (callback(geojson.features[i], i) === false) break;\n    }\n  }\n}\n\n/**\n * Callback for featureReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n *  - The previousValue argument is initialValue.\n *  - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n *  - The previousValue argument is the value of the first element present in the array.\n *  - The currentValue argument is the value of the second element present in the array.\n *\n * @callback featureReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Reduce features in any GeoJSON object, similar to Array.reduce().\n *\n * @name featureReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentFeature, featureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n *   turf.point([26, 37], {\"foo\": \"bar\"}),\n *   turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.featureReduce(features, function (previousValue, currentFeature, featureIndex) {\n *   //=previousValue\n *   //=currentFeature\n *   //=featureIndex\n *   return currentFeature\n * });\n */\nfunction featureReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  featureEach(geojson, function (currentFeature, featureIndex) {\n    if (featureIndex === 0 && initialValue === undefined)\n      previousValue = currentFeature;\n    else previousValue = callback(previousValue, currentFeature, featureIndex);\n  });\n  return previousValue;\n}\n\n/**\n * Get all coordinates from any GeoJSON object.\n *\n * @name coordAll\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @returns {Array<Array<number>>} coordinate position array\n * @example\n * var features = turf.featureCollection([\n *   turf.point([26, 37], {foo: 'bar'}),\n *   turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * var coords = turf.coordAll(features);\n * //= [[26, 37], [36, 53]]\n */\nfunction coordAll(geojson) {\n  var coords = [];\n  coordEach(geojson, function (coord) {\n    coords.push(coord);\n  });\n  return coords;\n}\n\n/**\n * Callback for geomEach\n *\n * @callback geomEachCallback\n * @param {Geometry} currentGeometry The current Geometry being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {Object} featureProperties The current Feature Properties being processed.\n * @param {Array<number>} featureBBox The current Feature BBox being processed.\n * @param {number|string} featureId The current Feature Id being processed.\n */\n\n/**\n * Iterate over each geometry in any GeoJSON object, similar to Array.forEach()\n *\n * @name geomEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentGeometry, featureIndex, featureProperties, featureBBox, featureId)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n *     turf.point([26, 37], {foo: 'bar'}),\n *     turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.geomEach(features, function (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n *   //=currentGeometry\n *   //=featureIndex\n *   //=featureProperties\n *   //=featureBBox\n *   //=featureId\n * });\n */\nfunction geomEach(geojson, callback) {\n  var i,\n    j,\n    g,\n    geometry,\n    stopG,\n    geometryMaybeCollection,\n    isGeometryCollection,\n    featureProperties,\n    featureBBox,\n    featureId,\n    featureIndex = 0,\n    isFeatureCollection = geojson.type === \"FeatureCollection\",\n    isFeature = geojson.type === \"Feature\",\n    stop = isFeatureCollection ? geojson.features.length : 1;\n\n  // This logic may look a little weird. The reason why it is that way\n  // is because it's trying to be fast. GeoJSON supports multiple kinds\n  // of objects at its root: FeatureCollection, Features, Geometries.\n  // This function has the responsibility of handling all of them, and that\n  // means that some of the `for` loops you see below actually just don't apply\n  // to certain inputs. For instance, if you give this just a\n  // Point geometry, then both loops are short-circuited and all we do\n  // is gradually rename the input until it's called 'geometry'.\n  //\n  // This also aims to allocate as few resources as possible: just a\n  // few numbers and booleans, rather than any temporary arrays as would\n  // be required with the normalization approach.\n  for (i = 0; i < stop; i++) {\n    geometryMaybeCollection = isFeatureCollection\n      ? geojson.features[i].geometry\n      : isFeature\n      ? geojson.geometry\n      : geojson;\n    featureProperties = isFeatureCollection\n      ? geojson.features[i].properties\n      : isFeature\n      ? geojson.properties\n      : {};\n    featureBBox = isFeatureCollection\n      ? geojson.features[i].bbox\n      : isFeature\n      ? geojson.bbox\n      : undefined;\n    featureId = isFeatureCollection\n      ? geojson.features[i].id\n      : isFeature\n      ? geojson.id\n      : undefined;\n    isGeometryCollection = geometryMaybeCollection\n      ? geometryMaybeCollection.type === \"GeometryCollection\"\n      : false;\n    stopG = isGeometryCollection\n      ? geometryMaybeCollection.geometries.length\n      : 1;\n\n    for (g = 0; g < stopG; g++) {\n      geometry = isGeometryCollection\n        ? geometryMaybeCollection.geometries[g]\n        : geometryMaybeCollection;\n\n      // Handle null Geometry\n      if (geometry === null) {\n        if (\n          callback(\n            null,\n            featureIndex,\n            featureProperties,\n            featureBBox,\n            featureId\n          ) === false\n        )\n          return false;\n        continue;\n      }\n      switch (geometry.type) {\n        case \"Point\":\n        case \"LineString\":\n        case \"MultiPoint\":\n        case \"Polygon\":\n        case \"MultiLineString\":\n        case \"MultiPolygon\": {\n          if (\n            callback(\n              geometry,\n              featureIndex,\n              featureProperties,\n              featureBBox,\n              featureId\n            ) === false\n          )\n            return false;\n          break;\n        }\n        case \"GeometryCollection\": {\n          for (j = 0; j < geometry.geometries.length; j++) {\n            if (\n              callback(\n                geometry.geometries[j],\n                featureIndex,\n                featureProperties,\n                featureBBox,\n                featureId\n              ) === false\n            )\n              return false;\n          }\n          break;\n        }\n        default:\n          throw new Error(\"Unknown Geometry Type\");\n      }\n    }\n    // Only increase `featureIndex` per each feature\n    featureIndex++;\n  }\n}\n\n/**\n * Callback for geomReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n *  - The previousValue argument is initialValue.\n *  - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n *  - The previousValue argument is the value of the first element present in the array.\n *  - The currentValue argument is the value of the second element present in the array.\n *\n * @callback geomReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Geometry} currentGeometry The current Geometry being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {Object} featureProperties The current Feature Properties being processed.\n * @param {Array<number>} featureBBox The current Feature BBox being processed.\n * @param {number|string} featureId The current Feature Id being processed.\n */\n\n/**\n * Reduce geometry in any GeoJSON object, similar to Array.reduce().\n *\n * @name geomReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n *     turf.point([26, 37], {foo: 'bar'}),\n *     turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.geomReduce(features, function (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n *   //=previousValue\n *   //=currentGeometry\n *   //=featureIndex\n *   //=featureProperties\n *   //=featureBBox\n *   //=featureId\n *   return currentGeometry\n * });\n */\nfunction geomReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  geomEach(\n    geojson,\n    function (\n      currentGeometry,\n      featureIndex,\n      featureProperties,\n      featureBBox,\n      featureId\n    ) {\n      if (featureIndex === 0 && initialValue === undefined)\n        previousValue = currentGeometry;\n      else\n        previousValue = callback(\n          previousValue,\n          currentGeometry,\n          featureIndex,\n          featureProperties,\n          featureBBox,\n          featureId\n        );\n    }\n  );\n  return previousValue;\n}\n\n/**\n * Callback for flattenEach\n *\n * @callback flattenEachCallback\n * @param {Feature} currentFeature The current flattened feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n */\n\n/**\n * Iterate over flattened features in any GeoJSON object, similar to\n * Array.forEach.\n *\n * @name flattenEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentFeature, featureIndex, multiFeatureIndex)\n * @example\n * var features = turf.featureCollection([\n *     turf.point([26, 37], {foo: 'bar'}),\n *     turf.multiPoint([[40, 30], [36, 53]], {hello: 'world'})\n * ]);\n *\n * turf.flattenEach(features, function (currentFeature, featureIndex, multiFeatureIndex) {\n *   //=currentFeature\n *   //=featureIndex\n *   //=multiFeatureIndex\n * });\n */\nfunction flattenEach(geojson, callback) {\n  geomEach(geojson, function (geometry, featureIndex, properties, bbox, id) {\n    // Callback for single geometry\n    var type = geometry === null ? null : geometry.type;\n    switch (type) {\n      case null:\n      case \"Point\":\n      case \"LineString\":\n      case \"Polygon\":\n        if (\n          callback(\n            feature(geometry, properties, { bbox: bbox, id: id }),\n            featureIndex,\n            0\n          ) === false\n        )\n          return false;\n        return;\n    }\n\n    var geomType;\n\n    // Callback for multi-geometry\n    switch (type) {\n      case \"MultiPoint\":\n        geomType = \"Point\";\n        break;\n      case \"MultiLineString\":\n        geomType = \"LineString\";\n        break;\n      case \"MultiPolygon\":\n        geomType = \"Polygon\";\n        break;\n    }\n\n    for (\n      var multiFeatureIndex = 0;\n      multiFeatureIndex < geometry.coordinates.length;\n      multiFeatureIndex++\n    ) {\n      var coordinate = geometry.coordinates[multiFeatureIndex];\n      var geom = {\n        type: geomType,\n        coordinates: coordinate,\n      };\n      if (\n        callback(feature(geom, properties), featureIndex, multiFeatureIndex) ===\n        false\n      )\n        return false;\n    }\n  });\n}\n\n/**\n * Callback for flattenReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n *  - The previousValue argument is initialValue.\n *  - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n *  - The previousValue argument is the value of the first element present in the array.\n *  - The currentValue argument is the value of the second element present in the array.\n *\n * @callback flattenReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n */\n\n/**\n * Reduce flattened features in any GeoJSON object, similar to Array.reduce().\n *\n * @name flattenReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentFeature, featureIndex, multiFeatureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n *     turf.point([26, 37], {foo: 'bar'}),\n *     turf.multiPoint([[40, 30], [36, 53]], {hello: 'world'})\n * ]);\n *\n * turf.flattenReduce(features, function (previousValue, currentFeature, featureIndex, multiFeatureIndex) {\n *   //=previousValue\n *   //=currentFeature\n *   //=featureIndex\n *   //=multiFeatureIndex\n *   return currentFeature\n * });\n */\nfunction flattenReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  flattenEach(\n    geojson,\n    function (currentFeature, featureIndex, multiFeatureIndex) {\n      if (\n        featureIndex === 0 &&\n        multiFeatureIndex === 0 &&\n        initialValue === undefined\n      )\n        previousValue = currentFeature;\n      else\n        previousValue = callback(\n          previousValue,\n          currentFeature,\n          featureIndex,\n          multiFeatureIndex\n        );\n    }\n  );\n  return previousValue;\n}\n\n/**\n * Callback for segmentEach\n *\n * @callback segmentEachCallback\n * @param {Feature<LineString>} currentSegment The current Segment being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n * @param {number} segmentIndex The current index of the Segment being processed.\n * @returns {void}\n */\n\n/**\n * Iterate over 2-vertex line segment in any GeoJSON object, similar to Array.forEach()\n * (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON\n * @param {Function} callback a method that takes (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex)\n * @returns {void}\n * @example\n * var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]);\n *\n * // Iterate over GeoJSON by 2-vertex segments\n * turf.segmentEach(polygon, function (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n *   //=currentSegment\n *   //=featureIndex\n *   //=multiFeatureIndex\n *   //=geometryIndex\n *   //=segmentIndex\n * });\n *\n * // Calculate the total number of segments\n * var total = 0;\n * turf.segmentEach(polygon, function () {\n *     total++;\n * });\n */\nfunction segmentEach(geojson, callback) {\n  flattenEach(geojson, function (feature, featureIndex, multiFeatureIndex) {\n    var segmentIndex = 0;\n\n    // Exclude null Geometries\n    if (!feature.geometry) return;\n    // (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n    var type = feature.geometry.type;\n    if (type === \"Point\" || type === \"MultiPoint\") return;\n\n    // Generate 2-vertex line segments\n    var previousCoords;\n    var previousFeatureIndex = 0;\n    var previousMultiIndex = 0;\n    var prevGeomIndex = 0;\n    if (\n      coordEach(\n        feature,\n        function (\n          currentCoord,\n          coordIndex,\n          featureIndexCoord,\n          multiPartIndexCoord,\n          geometryIndex\n        ) {\n          // Simulating a meta.coordReduce() since `reduce` operations cannot be stopped by returning `false`\n          if (\n            previousCoords === undefined ||\n            featureIndex > previousFeatureIndex ||\n            multiPartIndexCoord > previousMultiIndex ||\n            geometryIndex > prevGeomIndex\n          ) {\n            previousCoords = currentCoord;\n            previousFeatureIndex = featureIndex;\n            previousMultiIndex = multiPartIndexCoord;\n            prevGeomIndex = geometryIndex;\n            segmentIndex = 0;\n            return;\n          }\n          var currentSegment = lineString(\n            [previousCoords, currentCoord],\n            feature.properties\n          );\n          if (\n            callback(\n              currentSegment,\n              featureIndex,\n              multiFeatureIndex,\n              geometryIndex,\n              segmentIndex\n            ) === false\n          )\n            return false;\n          segmentIndex++;\n          previousCoords = currentCoord;\n        }\n      ) === false\n    )\n      return false;\n  });\n}\n\n/**\n * Callback for segmentReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n *  - The previousValue argument is initialValue.\n *  - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n *  - The previousValue argument is the value of the first element present in the array.\n *  - The currentValue argument is the value of the second element present in the array.\n *\n * @callback segmentReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature<LineString>} currentSegment The current Segment being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n * @param {number} segmentIndex The current index of the Segment being processed.\n */\n\n/**\n * Reduce 2-vertex line segment in any GeoJSON object, similar to Array.reduce()\n * (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON\n * @param {Function} callback a method that takes (previousValue, currentSegment, currentIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {void}\n * @example\n * var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]);\n *\n * // Iterate over GeoJSON by 2-vertex segments\n * turf.segmentReduce(polygon, function (previousSegment, currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n *   //= previousSegment\n *   //= currentSegment\n *   //= featureIndex\n *   //= multiFeatureIndex\n *   //= geometryIndex\n *   //= segmentIndex\n *   return currentSegment\n * });\n *\n * // Calculate the total number of segments\n * var initialValue = 0\n * var total = turf.segmentReduce(polygon, function (previousValue) {\n *     previousValue++;\n *     return previousValue;\n * }, initialValue);\n */\nfunction segmentReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  var started = false;\n  segmentEach(\n    geojson,\n    function (\n      currentSegment,\n      featureIndex,\n      multiFeatureIndex,\n      geometryIndex,\n      segmentIndex\n    ) {\n      if (started === false && initialValue === undefined)\n        previousValue = currentSegment;\n      else\n        previousValue = callback(\n          previousValue,\n          currentSegment,\n          featureIndex,\n          multiFeatureIndex,\n          geometryIndex,\n          segmentIndex\n        );\n      started = true;\n    }\n  );\n  return previousValue;\n}\n\n/**\n * Callback for lineEach\n *\n * @callback lineEachCallback\n * @param {Feature<LineString>} currentLine The current LineString|LinearRing being processed\n * @param {number} featureIndex The current index of the Feature being processed\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed\n * @param {number} geometryIndex The current index of the Geometry being processed\n */\n\n/**\n * Iterate over line or ring coordinates in LineString, Polygon, MultiLineString, MultiPolygon Features or Geometries,\n * similar to Array.forEach.\n *\n * @name lineEach\n * @param {Geometry|Feature<LineString|Polygon|MultiLineString|MultiPolygon>} geojson object\n * @param {Function} callback a method that takes (currentLine, featureIndex, multiFeatureIndex, geometryIndex)\n * @example\n * var multiLine = turf.multiLineString([\n *   [[26, 37], [35, 45]],\n *   [[36, 53], [38, 50], [41, 55]]\n * ]);\n *\n * turf.lineEach(multiLine, function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n *   //=currentLine\n *   //=featureIndex\n *   //=multiFeatureIndex\n *   //=geometryIndex\n * });\n */\nfunction lineEach(geojson, callback) {\n  // validation\n  if (!geojson) throw new Error(\"geojson is required\");\n\n  flattenEach(geojson, function (feature, featureIndex, multiFeatureIndex) {\n    if (feature.geometry === null) return;\n    var type = feature.geometry.type;\n    var coords = feature.geometry.coordinates;\n    switch (type) {\n      case \"LineString\":\n        if (callback(feature, featureIndex, multiFeatureIndex, 0, 0) === false)\n          return false;\n        break;\n      case \"Polygon\":\n        for (\n          var geometryIndex = 0;\n          geometryIndex < coords.length;\n          geometryIndex++\n        ) {\n          if (\n            callback(\n              lineString(coords[geometryIndex], feature.properties),\n              featureIndex,\n              multiFeatureIndex,\n              geometryIndex\n            ) === false\n          )\n            return false;\n        }\n        break;\n    }\n  });\n}\n\n/**\n * Callback for lineReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n *  - The previousValue argument is initialValue.\n *  - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n *  - The previousValue argument is the value of the first element present in the array.\n *  - The currentValue argument is the value of the second element present in the array.\n *\n * @callback lineReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature<LineString>} currentLine The current LineString|LinearRing being processed.\n * @param {number} featureIndex The current index of the Feature being processed\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed\n * @param {number} geometryIndex The current index of the Geometry being processed\n */\n\n/**\n * Reduce features in any GeoJSON object, similar to Array.reduce().\n *\n * @name lineReduce\n * @param {Geometry|Feature<LineString|Polygon|MultiLineString|MultiPolygon>} geojson object\n * @param {Function} callback a method that takes (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var multiPoly = turf.multiPolygon([\n *   turf.polygon([[[12,48],[2,41],[24,38],[12,48]], [[9,44],[13,41],[13,45],[9,44]]]),\n *   turf.polygon([[[5, 5], [0, 0], [2, 2], [4, 4], [5, 5]]])\n * ]);\n *\n * turf.lineReduce(multiPoly, function (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n *   //=previousValue\n *   //=currentLine\n *   //=featureIndex\n *   //=multiFeatureIndex\n *   //=geometryIndex\n *   return currentLine\n * });\n */\nfunction lineReduce(geojson, callback, initialValue) {\n  var previousValue = initialValue;\n  lineEach(\n    geojson,\n    function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n      if (featureIndex === 0 && initialValue === undefined)\n        previousValue = currentLine;\n      else\n        previousValue = callback(\n          previousValue,\n          currentLine,\n          featureIndex,\n          multiFeatureIndex,\n          geometryIndex\n        );\n    }\n  );\n  return previousValue;\n}\n\n/**\n * Finds a particular 2-vertex LineString Segment from a GeoJSON using `@turf/meta` indexes.\n *\n * Negative indexes are permitted.\n * Point & MultiPoint will always return null.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson Any GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.featureIndex=0] Feature Index\n * @param {number} [options.multiFeatureIndex=0] Multi-Feature Index\n * @param {number} [options.geometryIndex=0] Geometry Index\n * @param {number} [options.segmentIndex=0] Segment Index\n * @param {Object} [options.properties={}] Translate Properties to output LineString\n * @param {BBox} [options.bbox={}] Translate BBox to output LineString\n * @param {number|string} [options.id={}] Translate Id to output LineString\n * @returns {Feature<LineString>} 2-vertex GeoJSON Feature LineString\n * @example\n * var multiLine = turf.multiLineString([\n *     [[10, 10], [50, 30], [30, 40]],\n *     [[-10, -10], [-50, -30], [-30, -40]]\n * ]);\n *\n * // First Segment (defaults are 0)\n * turf.findSegment(multiLine);\n * // => Feature<LineString<[[10, 10], [50, 30]]>>\n *\n * // First Segment of 2nd Multi Feature\n * turf.findSegment(multiLine, {multiFeatureIndex: 1});\n * // => Feature<LineString<[[-10, -10], [-50, -30]]>>\n *\n * // Last Segment of Last Multi Feature\n * turf.findSegment(multiLine, {multiFeatureIndex: -1, segmentIndex: -1});\n * // => Feature<LineString<[[-50, -30], [-30, -40]]>>\n */\nfunction findSegment(geojson, options) {\n  // Optional Parameters\n  options = options || {};\n  if (!isObject(options)) throw new Error(\"options is invalid\");\n  var featureIndex = options.featureIndex || 0;\n  var multiFeatureIndex = options.multiFeatureIndex || 0;\n  var geometryIndex = options.geometryIndex || 0;\n  var segmentIndex = options.segmentIndex || 0;\n\n  // Find FeatureIndex\n  var properties = options.properties;\n  var geometry;\n\n  switch (geojson.type) {\n    case \"FeatureCollection\":\n      if (featureIndex < 0)\n        featureIndex = geojson.features.length + featureIndex;\n      properties = properties || geojson.features[featureIndex].properties;\n      geometry = geojson.features[featureIndex].geometry;\n      break;\n    case \"Feature\":\n      properties = properties || geojson.properties;\n      geometry = geojson.geometry;\n      break;\n    case \"Point\":\n    case \"MultiPoint\":\n      return null;\n    case \"LineString\":\n    case \"Polygon\":\n    case \"MultiLineString\":\n    case \"MultiPolygon\":\n      geometry = geojson;\n      break;\n    default:\n      throw new Error(\"geojson is invalid\");\n  }\n\n  // Find SegmentIndex\n  if (geometry === null) return null;\n  var coords = geometry.coordinates;\n  switch (geometry.type) {\n    case \"Point\":\n    case \"MultiPoint\":\n      return null;\n    case \"LineString\":\n      if (segmentIndex < 0) segmentIndex = coords.length + segmentIndex - 1;\n      return lineString(\n        [coords[segmentIndex], coords[segmentIndex + 1]],\n        properties,\n        options\n      );\n    case \"Polygon\":\n      if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n      if (segmentIndex < 0)\n        segmentIndex = coords[geometryIndex].length + segmentIndex - 1;\n      return lineString(\n        [\n          coords[geometryIndex][segmentIndex],\n          coords[geometryIndex][segmentIndex + 1],\n        ],\n        properties,\n        options\n      );\n    case \"MultiLineString\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      if (segmentIndex < 0)\n        segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;\n      return lineString(\n        [\n          coords[multiFeatureIndex][segmentIndex],\n          coords[multiFeatureIndex][segmentIndex + 1],\n        ],\n        properties,\n        options\n      );\n    case \"MultiPolygon\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      if (geometryIndex < 0)\n        geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n      if (segmentIndex < 0)\n        segmentIndex =\n          coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;\n      return lineString(\n        [\n          coords[multiFeatureIndex][geometryIndex][segmentIndex],\n          coords[multiFeatureIndex][geometryIndex][segmentIndex + 1],\n        ],\n        properties,\n        options\n      );\n  }\n  throw new Error(\"geojson is invalid\");\n}\n\n/**\n * Finds a particular Point from a GeoJSON using `@turf/meta` indexes.\n *\n * Negative indexes are permitted.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson Any GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.featureIndex=0] Feature Index\n * @param {number} [options.multiFeatureIndex=0] Multi-Feature Index\n * @param {number} [options.geometryIndex=0] Geometry Index\n * @param {number} [options.coordIndex=0] Coord Index\n * @param {Object} [options.properties={}] Translate Properties to output Point\n * @param {BBox} [options.bbox={}] Translate BBox to output Point\n * @param {number|string} [options.id={}] Translate Id to output Point\n * @returns {Feature<Point>} 2-vertex GeoJSON Feature Point\n * @example\n * var multiLine = turf.multiLineString([\n *     [[10, 10], [50, 30], [30, 40]],\n *     [[-10, -10], [-50, -30], [-30, -40]]\n * ]);\n *\n * // First Segment (defaults are 0)\n * turf.findPoint(multiLine);\n * // => Feature<Point<[10, 10]>>\n *\n * // First Segment of the 2nd Multi-Feature\n * turf.findPoint(multiLine, {multiFeatureIndex: 1});\n * // => Feature<Point<[-10, -10]>>\n *\n * // Last Segment of last Multi-Feature\n * turf.findPoint(multiLine, {multiFeatureIndex: -1, coordIndex: -1});\n * // => Feature<Point<[-30, -40]>>\n */\nfunction findPoint(geojson, options) {\n  // Optional Parameters\n  options = options || {};\n  if (!isObject(options)) throw new Error(\"options is invalid\");\n  var featureIndex = options.featureIndex || 0;\n  var multiFeatureIndex = options.multiFeatureIndex || 0;\n  var geometryIndex = options.geometryIndex || 0;\n  var coordIndex = options.coordIndex || 0;\n\n  // Find FeatureIndex\n  var properties = options.properties;\n  var geometry;\n\n  switch (geojson.type) {\n    case \"FeatureCollection\":\n      if (featureIndex < 0)\n        featureIndex = geojson.features.length + featureIndex;\n      properties = properties || geojson.features[featureIndex].properties;\n      geometry = geojson.features[featureIndex].geometry;\n      break;\n    case \"Feature\":\n      properties = properties || geojson.properties;\n      geometry = geojson.geometry;\n      break;\n    case \"Point\":\n    case \"MultiPoint\":\n      return null;\n    case \"LineString\":\n    case \"Polygon\":\n    case \"MultiLineString\":\n    case \"MultiPolygon\":\n      geometry = geojson;\n      break;\n    default:\n      throw new Error(\"geojson is invalid\");\n  }\n\n  // Find Coord Index\n  if (geometry === null) return null;\n  var coords = geometry.coordinates;\n  switch (geometry.type) {\n    case \"Point\":\n      return point(coords, properties, options);\n    case \"MultiPoint\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      return point(coords[multiFeatureIndex], properties, options);\n    case \"LineString\":\n      if (coordIndex < 0) coordIndex = coords.length + coordIndex;\n      return point(coords[coordIndex], properties, options);\n    case \"Polygon\":\n      if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n      if (coordIndex < 0)\n        coordIndex = coords[geometryIndex].length + coordIndex;\n      return point(coords[geometryIndex][coordIndex], properties, options);\n    case \"MultiLineString\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      if (coordIndex < 0)\n        coordIndex = coords[multiFeatureIndex].length + coordIndex;\n      return point(coords[multiFeatureIndex][coordIndex], properties, options);\n    case \"MultiPolygon\":\n      if (multiFeatureIndex < 0)\n        multiFeatureIndex = coords.length + multiFeatureIndex;\n      if (geometryIndex < 0)\n        geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n      if (coordIndex < 0)\n        coordIndex =\n          coords[multiFeatureIndex][geometryIndex].length - coordIndex;\n      return point(\n        coords[multiFeatureIndex][geometryIndex][coordIndex],\n        properties,\n        options\n      );\n  }\n  throw new Error(\"geojson is invalid\");\n}\n\nexport { coordAll, coordEach, coordReduce, featureEach, featureReduce, findPoint, findSegment, flattenEach, flattenReduce, geomEach, geomReduce, lineEach, lineReduce, propEach, propReduce, segmentEach, segmentReduce };\n","import { coordEach } from \"@turf/meta\";\n/**\n * Takes a set of features, calculates the bbox of all input features, and returns a bounding box.\n *\n * @name bbox\n * @param {GeoJSON} geojson any GeoJSON object\n * @returns {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @example\n * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]);\n * var bbox = turf.bbox(line);\n * var bboxPolygon = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [line, bboxPolygon]\n */\nfunction bbox(geojson) {\n    var result = [Infinity, Infinity, -Infinity, -Infinity];\n    coordEach(geojson, function (coord) {\n        if (result[0] > coord[0]) {\n            result[0] = coord[0];\n        }\n        if (result[1] > coord[1]) {\n            result[1] = coord[1];\n        }\n        if (result[2] < coord[0]) {\n            result[2] = coord[0];\n        }\n        if (result[3] < coord[1]) {\n            result[3] = coord[1];\n        }\n    });\n    return result;\n}\nbbox[\"default\"] = bbox;\nexport default bbox;\n","// Live results being updated by Republic\nconst FLAT_RESULTS_URL =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/results_FLAT.json';\n\n// This has emptied out results i.e. is static\nconst STATIC_FLAT_RESULTS_URL =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/results_static_FLAT.json';\n\n// This has the final certified results and is static\nconst FINAL_RESULTS_URL =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/results_FLAT_FINAL_RESULTS.json';\n\nconst COUNTY_FAKE_DATA =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/county_fake_data.json';\n\nconst DDHQ_FAKE_DATA =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/results_FLAT_FINAL_Oct_13.json';\n\nconst DDHQ_FAKE_DATA_2 =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/results_FLAT_FINAL_Oct_25.json';\n\nconst DDHQ_MID_TEST =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/results_FLAT_Oct_25_mid_test.json';\n\nconst SOS_FAKE_DATA =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/results_FLAT_SOS_TEST.json';\n\nconst MINI_CHART_TEST =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/republic_json/results_MiniChart_test.json';\n\n// Used for homepage takeover\nconst HOMEPAGE_URL =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2022_general/homepage_takeover/2022-general.json';\n\n// Calls TT stories using the API\nconst STORY_API_URL = (id: number): string =>\n  `https://www.texastribune.org/api/v2/articles/${id}/?format=json&fields=sitewide_image,summary,authors,url,pub_date,updated_date,homepage_headline`;\n\n// This is for the other candidates for the hide/show toggle\nconst visibleCandidatesCount = 6;\n\n// The Decision Desk estimated votes count that we will be using, it can be either estimated_votes_high, estimated_votes_mid or estimated_votes_low. Ask DDHQ for guidance on which to use before the election.\nconst DDHQestimatedvotes = 'estimated_votes_mid';\n\n// Show bubble piegram map toggle option. Set to false if we want to hide it.\nconst showBubbleMap = true;\n\n// Show categories map toggle option. Set to false if we want to hide it.\nconst showCategoriesMap = true;\n\n// Show precincts or estimated votes still being counted text\nconst showPrecinctsReporting = false;\n\n// Adds the checkmark if this is the final official results from local canvass\nconst isCanvass = true;\n\n// Show last updated timestamp, set to true to last updated text\nconst showLastUpdated = false;\n\n// What we are using across the ap\n// will be used on the results page, in the homepage takeover\n// and in the embeds\nconst RESULTS_IN_USE = FINAL_RESULTS_URL;\n\nexport {\n  RESULTS_IN_USE,\n  HOMEPAGE_URL,\n  STORY_API_URL,\n  visibleCandidatesCount,\n  showPrecinctsReporting,\n  isCanvass,\n  showLastUpdated,\n  showBubbleMap,\n  showCategoriesMap,\n  DDHQestimatedvotes\n};","/**\n * Grabs the contents of a `jsonScript` created JSON inline string and returns\n * it as a JSON object. If the element does not exist, or if the script\n * element does not have the JSON MIME type, null is returned instead.\n *\n * @param  {String} elementId the ID of the JSON script element\n * @return {Object|null}\n */\nexport default function loadJsonScript(elementId) {\n  const element = document.getElementById(elementId);\n\n  if (element && element.getAttribute('type') === 'application/json') {\n    return JSON.parse(element.textContent);\n  } else {\n    return null;\n  }\n}\n","export default function sumValues(arr, key) {\n  return arr.reduce((acc, obj) => acc + obj[key], 0);\n}\n","import pointEqual from \"../pointEqual.js\";\nimport {epsilon} from \"../math.js\";\n\nfunction Intersection(point, points, other, entry) {\n  this.x = point;\n  this.z = points;\n  this.o = other; // another intersection\n  this.e = entry; // is an entry?\n  this.v = false; // visited\n  this.n = this.p = null; // next & previous\n}\n\n// A generalized polygon clipping algorithm: given a polygon that has been cut\n// into its visible line segments, and rejoins the segments by interpolating\n// along the clip edge.\nexport default function(segments, compareIntersection, startInside, interpolate, stream) {\n  var subject = [],\n      clip = [],\n      i,\n      n;\n\n  segments.forEach(function(segment) {\n    if ((n = segment.length - 1) <= 0) return;\n    var n, p0 = segment[0], p1 = segment[n], x;\n\n    if (pointEqual(p0, p1)) {\n      if (!p0[2] && !p1[2]) {\n        stream.lineStart();\n        for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n        stream.lineEnd();\n        return;\n      }\n      // handle degenerate cases by moving the point\n      p1[0] += 2 * epsilon;\n    }\n\n    subject.push(x = new Intersection(p0, segment, null, true));\n    clip.push(x.o = new Intersection(p0, null, x, false));\n    subject.push(x = new Intersection(p1, segment, null, false));\n    clip.push(x.o = new Intersection(p1, null, x, true));\n  });\n\n  if (!subject.length) return;\n\n  clip.sort(compareIntersection);\n  link(subject);\n  link(clip);\n\n  for (i = 0, n = clip.length; i < n; ++i) {\n    clip[i].e = startInside = !startInside;\n  }\n\n  var start = subject[0],\n      points,\n      point;\n\n  while (1) {\n    // Find first unvisited intersection.\n    var current = start,\n        isSubject = true;\n    while (current.v) if ((current = current.n) === start) return;\n    points = current.z;\n    stream.lineStart();\n    do {\n      current.v = current.o.v = true;\n      if (current.e) {\n        if (isSubject) {\n          for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n        } else {\n          interpolate(current.x, current.n.x, 1, stream);\n        }\n        current = current.n;\n      } else {\n        if (isSubject) {\n          points = current.p.z;\n          for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n        } else {\n          interpolate(current.x, current.p.x, -1, stream);\n        }\n        current = current.p;\n      }\n      current = current.o;\n      points = current.z;\n      isSubject = !isSubject;\n    } while (!current.v);\n    stream.lineEnd();\n  }\n}\n\nfunction link(array) {\n  if (!(n = array.length)) return;\n  var n,\n      i = 0,\n      a = array[0],\n      b;\n  while (++i < n) {\n    a.n = b = array[i];\n    b.p = a;\n    a = b;\n  }\n  a.n = b = array[0];\n  b.p = a;\n}\n","import {abs, epsilon} from \"./math.js\";\n\nexport default function(a, b) {\n  return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon;\n}\n","import {abs, epsilon} from \"../math.js\";\nimport clipBuffer from \"./buffer.js\";\nimport clipLine from \"./line.js\";\nimport clipRejoin from \"./rejoin.js\";\nimport {merge} from \"d3-array\";\n\nvar clipMax = 1e9, clipMin = -clipMax;\n\n// TODO Use d3-polygon’s polygonContains here for the ring check?\n// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?\n\nexport default function clipRectangle(x0, y0, x1, y1) {\n\n  function visible(x, y) {\n    return x0 <= x && x <= x1 && y0 <= y && y <= y1;\n  }\n\n  function interpolate(from, to, direction, stream) {\n    var a = 0, a1 = 0;\n    if (from == null\n        || (a = corner(from, direction)) !== (a1 = corner(to, direction))\n        || comparePoint(from, to) < 0 ^ direction > 0) {\n      do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);\n      while ((a = (a + direction + 4) % 4) !== a1);\n    } else {\n      stream.point(to[0], to[1]);\n    }\n  }\n\n  function corner(p, direction) {\n    return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3\n        : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1\n        : abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0\n        : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon\n  }\n\n  function compareIntersection(a, b) {\n    return comparePoint(a.x, b.x);\n  }\n\n  function comparePoint(a, b) {\n    var ca = corner(a, 1),\n        cb = corner(b, 1);\n    return ca !== cb ? ca - cb\n        : ca === 0 ? b[1] - a[1]\n        : ca === 1 ? a[0] - b[0]\n        : ca === 2 ? a[1] - b[1]\n        : b[0] - a[0];\n  }\n\n  return function(stream) {\n    var activeStream = stream,\n        bufferStream = clipBuffer(),\n        segments,\n        polygon,\n        ring,\n        x__, y__, v__, // first point\n        x_, y_, v_, // previous point\n        first,\n        clean;\n\n    var clipStream = {\n      point: point,\n      lineStart: lineStart,\n      lineEnd: lineEnd,\n      polygonStart: polygonStart,\n      polygonEnd: polygonEnd\n    };\n\n    function point(x, y) {\n      if (visible(x, y)) activeStream.point(x, y);\n    }\n\n    function polygonInside() {\n      var winding = 0;\n\n      for (var i = 0, n = polygon.length; i < n; ++i) {\n        for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {\n          a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];\n          if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }\n          else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }\n        }\n      }\n\n      return winding;\n    }\n\n    // Buffer geometry within a polygon and then clip it en masse.\n    function polygonStart() {\n      activeStream = bufferStream, segments = [], polygon = [], clean = true;\n    }\n\n    function polygonEnd() {\n      var startInside = polygonInside(),\n          cleanInside = clean && startInside,\n          visible = (segments = merge(segments)).length;\n      if (cleanInside || visible) {\n        stream.polygonStart();\n        if (cleanInside) {\n          stream.lineStart();\n          interpolate(null, null, 1, stream);\n          stream.lineEnd();\n        }\n        if (visible) {\n          clipRejoin(segments, compareIntersection, startInside, interpolate, stream);\n        }\n        stream.polygonEnd();\n      }\n      activeStream = stream, segments = polygon = ring = null;\n    }\n\n    function lineStart() {\n      clipStream.point = linePoint;\n      if (polygon) polygon.push(ring = []);\n      first = true;\n      v_ = false;\n      x_ = y_ = NaN;\n    }\n\n    // TODO rather than special-case polygons, simply handle them separately.\n    // Ideally, coincident intersection points should be jittered to avoid\n    // clipping issues.\n    function lineEnd() {\n      if (segments) {\n        linePoint(x__, y__);\n        if (v__ && v_) bufferStream.rejoin();\n        segments.push(bufferStream.result());\n      }\n      clipStream.point = point;\n      if (v_) activeStream.lineEnd();\n    }\n\n    function linePoint(x, y) {\n      var v = visible(x, y);\n      if (polygon) ring.push([x, y]);\n      if (first) {\n        x__ = x, y__ = y, v__ = v;\n        first = false;\n        if (v) {\n          activeStream.lineStart();\n          activeStream.point(x, y);\n        }\n      } else {\n        if (v && v_) activeStream.point(x, y);\n        else {\n          var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],\n              b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];\n          if (clipLine(a, b, x0, y0, x1, y1)) {\n            if (!v_) {\n              activeStream.lineStart();\n              activeStream.point(a[0], a[1]);\n            }\n            activeStream.point(b[0], b[1]);\n            if (!v) activeStream.lineEnd();\n            clean = false;\n          } else if (v) {\n            activeStream.lineStart();\n            activeStream.point(x, y);\n            clean = false;\n          }\n        }\n      }\n      x_ = x, y_ = y, v_ = v;\n    }\n\n    return clipStream;\n  };\n}\n","import noop from \"../noop.js\";\n\nexport default function() {\n  var lines = [],\n      line;\n  return {\n    point: function(x, y, m) {\n      line.push([x, y, m]);\n    },\n    lineStart: function() {\n      lines.push(line = []);\n    },\n    lineEnd: noop,\n    rejoin: function() {\n      if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));\n    },\n    result: function() {\n      var result = lines;\n      lines = [];\n      line = null;\n      return result;\n    }\n  };\n}\n","function* flatten(arrays) {\n  for (const array of arrays) {\n    yield* array;\n  }\n}\n\nexport default function merge(arrays) {\n  return Array.from(flatten(arrays));\n}\n","export default function(a, b, x0, y0, x1, y1) {\n  var ax = a[0],\n      ay = a[1],\n      bx = b[0],\n      by = b[1],\n      t0 = 0,\n      t1 = 1,\n      dx = bx - ax,\n      dy = by - ay,\n      r;\n\n  r = x0 - ax;\n  if (!dx && r > 0) return;\n  r /= dx;\n  if (dx < 0) {\n    if (r < t0) return;\n    if (r < t1) t1 = r;\n  } else if (dx > 0) {\n    if (r > t1) return;\n    if (r > t0) t0 = r;\n  }\n\n  r = x1 - ax;\n  if (!dx && r < 0) return;\n  r /= dx;\n  if (dx < 0) {\n    if (r > t1) return;\n    if (r > t0) t0 = r;\n  } else if (dx > 0) {\n    if (r < t0) return;\n    if (r < t1) t1 = r;\n  }\n\n  r = y0 - ay;\n  if (!dy && r > 0) return;\n  r /= dy;\n  if (dy < 0) {\n    if (r < t0) return;\n    if (r < t1) t1 = r;\n  } else if (dy > 0) {\n    if (r > t1) return;\n    if (r > t0) t0 = r;\n  }\n\n  r = y1 - ay;\n  if (!dy && r < 0) return;\n  r /= dy;\n  if (dy < 0) {\n    if (r > t1) return;\n    if (r > t0) t0 = r;\n  } else if (dy > 0) {\n    if (r < t0) return;\n    if (r < t1) t1 = r;\n  }\n\n  if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;\n  if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;\n  return true;\n}\n","export default function(methods) {\n  return {\n    stream: transformer(methods)\n  };\n}\n\nexport function transformer(methods) {\n  return function(stream) {\n    var s = new TransformStream;\n    for (var key in methods) s[key] = methods[key];\n    s.stream = stream;\n    return s;\n  };\n}\n\nfunction TransformStream() {}\n\nTransformStream.prototype = {\n  constructor: TransformStream,\n  point: function(x, y) { this.stream.point(x, y); },\n  sphere: function() { this.stream.sphere(); },\n  lineStart: function() { this.stream.lineStart(); },\n  lineEnd: function() { this.stream.lineEnd(); },\n  polygonStart: function() { this.stream.polygonStart(); },\n  polygonEnd: function() { this.stream.polygonEnd(); }\n};\n","import {default as geoStream} from \"../stream.js\";\nimport boundsStream from \"../path/bounds.js\";\n\nfunction fit(projection, fitBounds, object) {\n  var clip = projection.clipExtent && projection.clipExtent();\n  projection.scale(150).translate([0, 0]);\n  if (clip != null) projection.clipExtent(null);\n  geoStream(object, projection.stream(boundsStream));\n  fitBounds(boundsStream.result());\n  if (clip != null) projection.clipExtent(clip);\n  return projection;\n}\n\nexport function fitExtent(projection, extent, object) {\n  return fit(projection, function(b) {\n    var w = extent[1][0] - extent[0][0],\n        h = extent[1][1] - extent[0][1],\n        k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),\n        x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,\n        y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;\n    projection.scale(150 * k).translate([x, y]);\n  }, object);\n}\n\nexport function fitSize(projection, size, object) {\n  return fitExtent(projection, [[0, 0], size], object);\n}\n\nexport function fitWidth(projection, width, object) {\n  return fit(projection, function(b) {\n    var w = +width,\n        k = w / (b[1][0] - b[0][0]),\n        x = (w - k * (b[1][0] + b[0][0])) / 2,\n        y = -k * b[0][1];\n    projection.scale(150 * k).translate([x, y]);\n  }, object);\n}\n\nexport function fitHeight(projection, height, object) {\n  return fit(projection, function(b) {\n    var h = +height,\n        k = h / (b[1][1] - b[0][1]),\n        x = -k * b[0][0],\n        y = (h - k * (b[1][1] + b[0][1])) / 2;\n    projection.scale(150 * k).translate([x, y]);\n  }, object);\n}\n","import clipRectangle from \"../clip/rectangle.js\";\nimport identity from \"../identity.js\";\nimport {transformer} from \"../transform.js\";\nimport {fitExtent, fitSize, fitWidth, fitHeight} from \"./fit.js\";\nimport {cos, degrees, radians, sin} from \"../math.js\";\n\nexport default function() {\n  var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, // scale, translate and reflect\n      alpha = 0, ca, sa, // angle\n      x0 = null, y0, x1, y1, // clip extent\n      kx = 1, ky = 1,\n      transform = transformer({\n        point: function(x, y) {\n          var p = projection([x, y])\n          this.stream.point(p[0], p[1]);\n        }\n      }),\n      postclip = identity,\n      cache,\n      cacheStream;\n\n  function reset() {\n    kx = k * sx;\n    ky = k * sy;\n    cache = cacheStream = null;\n    return projection;\n  }\n\n  function projection (p) {\n    var x = p[0] * kx, y = p[1] * ky;\n    if (alpha) {\n      var t = y * ca - x * sa;\n      x = x * ca + y * sa;\n      y = t;\n    }    \n    return [x + tx, y + ty];\n  }\n  projection.invert = function(p) {\n    var x = p[0] - tx, y = p[1] - ty;\n    if (alpha) {\n      var t = y * ca + x * sa;\n      x = x * ca - y * sa;\n      y = t;\n    }\n    return [x / kx, y / ky];\n  };\n  projection.stream = function(stream) {\n    return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream));\n  };\n  projection.postclip = function(_) {\n    return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;\n  };\n  projection.clipExtent = function(_) {\n    return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];\n  };\n  projection.scale = function(_) {\n    return arguments.length ? (k = +_, reset()) : k;\n  };\n  projection.translate = function(_) {\n    return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];\n  }\n  projection.angle = function(_) {\n    return arguments.length ? (alpha = _ % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;\n  };\n  projection.reflectX = function(_) {\n    return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;\n  };\n  projection.reflectY = function(_) {\n    return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0;\n  };\n  projection.fitExtent = function(extent, object) {\n    return fitExtent(projection, extent, object);\n  };\n  projection.fitSize = function(size, object) {\n    return fitSize(projection, size, object);\n  };\n  projection.fitWidth = function(width, object) {\n    return fitWidth(projection, width, object);\n  };\n  projection.fitHeight = function(height, object) {\n    return fitHeight(projection, height, object);\n  };\n\n  return projection;\n}\n","import cx from 'classnames';\nimport { intcomma } from 'journalize';\nimport { Component, h, VNode } from 'preact';\n\nimport PartyPill from './PartyPill';\n\nimport context from 'Data/text.json';\n\nimport { isCanvass } from '../endpoints';\n\nimport formatPercent from '../utils/format-percent';\n\ninterface Props {\n  ballotName: string;\n  candidateId: string;\n  contestIsCalled: boolean;\n  contestResult: string;\n  contestOffice: string;\n  isIncumbent: boolean;\n  isWinner: boolean;\n  isMapRow: boolean;\n  party: string;\n  candidatesNum: number;\n  totalVotesInContest: number;\n  votes: number;\n}\n\nclass CandidateRow extends Component<Props> {\n  static Header: VNode;\n  static countyHeader: VNode;\n  static columnCount: number;\n\n  render() {\n    const {\n      ballotName,\n      contestIsCalled,\n      contestResult,\n      isIncumbent,\n      isWinner,\n      isViewable,\n      candidateColor,\n      candidatesNum,\n      isMapRow,\n      party,\n      totalVotesInContest,\n      votes,\n    } = this.props;\n\n    let divStyle;\n\n    let checkStyle;\n\n    if (candidateColor) {\n      divStyle = {\n        'background-color': candidateColor,\n      };\n      checkStyle = {\n        color: candidateColor,\n      };\n    }\n\n\n    // Get uncontested races that are not state races because we won't be receiving votes for those races\n\n    // const uncontested = candidatesNum == 1 && contestOffice !== 'U.S. House';\n\n    const uncontested = candidatesNum == 1;\n\n    let rowClass = cx('candidate', 'contest__candidate-row', {\n      'contest__candidate-row--winner dem--border':\n        contestIsCalled && isWinner && party == 'Democrat',\n      'contest__candidate-row--winner rep--border':\n        contestIsCalled && isWinner && party == 'Republican',\n    });\n\n    let checkClass = cx('check', {\n      'dem-winner': party == 'Democrat' && contestResult != 'runoff',\n      'rep-winner': party == 'Republican' && contestResult != 'runoff',\n      'runoff-winner': contestResult == 'runoff',\n    });\n\n    if (!isViewable) {\n      rowClass += ' race__candidate-row--hidden';\n    }\n\n    const checkmark = '\\u2713';\n\n\n\n    const IsAsterisk =\n    context['asterisks'].filter(candidate => candidate.value == ballotName).length > 0\n        ? true\n        : false;\n\n    return (\n      <tr class={rowClass}>\n        <td class=\"candidate__cell candidate__party\">\n          {!candidateColor && <PartyPill party={party} />}\n          {candidateColor && <PartyPill party={party} style={divStyle} />}\n        </td>\n        <th class=\"candidate__cell candidate__name\">\n          {isWinner &&\n          isMapRow == null && (\n              <span class={checkClass}>{checkmark}</span>\n            )}\n          {isWinner &&\n          isMapRow == null &&\n          isCanvass == true &&\n          contestResult != 'runoff' ? (\n            <span class={checkClass}>{ballotName}</span>\n          ) : (\n            ballotName\n          )}\n          {IsAsterisk && <span class=\"asterisk_out\">*</span>}{' '}\n          {isIncumbent && (\n            <span class=\"pill pill--basic\" title=\"Currently holds this seat\">\n              Incumbent\n            </span>\n          )}\n        </th>\n        <td class=\"candidate__cell candidate__votes\"> {uncontested == false ? intcomma(votes) : '—'}</td>\n        <td class=\"candidate__cell candidate__pct\">\n          {uncontested == false ? formatPercent(votes, totalVotesInContest): '—'}\n          <span class=\"candidate__pct-symbol\">%</span>\n        </td>\n      </tr>\n    );\n  }\n}\n\nCandidateRow.defaultProps = {\n  contestIsCalled: false,\n  isViewable: true,\n};\n\nCandidateRow.Header = (\n  <thead>\n    <tr>\n      <th class=\"contest__candidate-header\" colSpan={2}>\n        Candidates\n      </th>\n      <th class=\"contest__candidate-header contest__candidate-header--numeric\">\n        Votes\n      </th>\n      <th class=\"contest__candidate-header contest__candidate-header--numeric\">\n        Pct.\n        <span class=\"candidate__pct-symbol\">%</span>\n      </th>\n    </tr>\n  </thead>\n);\n\nCandidateRow.countyHeader = (\n  <thead>\n    <tr>\n      <th class=\"contest__candidate-header\" colSpan={2}>\n        Candidates\n      </th>\n      <th class=\"contest__candidate-header contest__candidate-header--numeric\">\n        Votes\n      </th>\n      <th class=\"contest__candidate-header contest__candidate-header--numeric\">\n        Pct.\n        <span class=\"candidate__pct-symbol\">%</span>\n      </th>\n    </tr>\n  </thead>\n);\n\nCandidateRow.columnCount = 4;\n\nexport default CandidateRow;\n","/* global Node, Window */\n\n/**\n * Select all matching elements on the page. Uses `document.querySelectorAll`.\n *\n * @param {String} el The CSS selector to search for.\n * @param {Element} [context] The container to search within. Defaults to\n * `document`.\n * @returns {Element[]}\n */\nfunction selectAll(el, context) {\n  // if `el` is a Node or Window, return it in an Array\n  if (el instanceof Node || el instanceof Window) return [el];\n\n  return Array.prototype.slice.call(\n    typeof el === 'string'\n      ? (context || document).querySelectorAll(el)\n      : el || []\n  );\n}\n\nexport default selectAll;\n","import { polygon } from \"@turf/helpers\";\n/**\n * Takes a bbox and returns an equivalent {@link Polygon|polygon}.\n *\n * @name bboxPolygon\n * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order\n * @param {Object} [options={}] Optional parameters\n * @param {Properties} [options.properties={}] Translate properties to Polygon\n * @param {string|number} [options.id={}] Translate Id to Polygon\n * @returns {Feature<Polygon>} a Polygon representation of the bounding box\n * @example\n * var bbox = [0, 0, 10, 10];\n *\n * var poly = turf.bboxPolygon(bbox);\n *\n * //addToMap\n * var addToMap = [poly]\n */\nexport default function bboxPolygon(bbox, options) {\n    if (options === void 0) { options = {}; }\n    // Convert BBox positions to Numbers\n    // No performance loss for including Number()\n    // https://github.com/Turfjs/turf/issues/1119\n    var west = Number(bbox[0]);\n    var south = Number(bbox[1]);\n    var east = Number(bbox[2]);\n    var north = Number(bbox[3]);\n    if (bbox.length === 6) {\n        throw new Error(\"@turf/bbox-polygon does not support BBox with 6 positions\");\n    }\n    var lowLeft = [west, south];\n    var topLeft = [west, north];\n    var topRight = [east, north];\n    var lowRight = [east, south];\n    return polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox: bbox, id: options.id });\n}\n","export default function noop() {}\n","const LENGTH_OF_CHECK_INTERVAL = 1000 * 60 * 2; // 2 minutes\nconst TIMERS_SHOULD_RUN = false;\n\nexport { LENGTH_OF_CHECK_INTERVAL, TIMERS_SHOULD_RUN };\n","/**\n * Select an element on the page. Uses `document.querySelector`, meaning it\n * will only return the first element that matches.\n *\n * @param {String} el The CSS selector to search for.\n * @param {Element} [context] The container to search within. Defaults to\n * `document`.\n * @returns {Element|null}\n */\nfunction select(el, context) {\n  return typeof el === 'string'\n    ? (context || document).querySelector(el)\n    : el || null;\n}\n\nexport default select;\n","//The sticky top nav bar\n\nimport select from '../utils/select';\nimport selectAll from '../utils/select-all';\n\nconst appNav = document.getElementById('app-nav');\nconst { height } = appNav.getBoundingClientRect();\nconst appNavHeight = Math.round(height) + 10;\n\nexport { appNavHeight };\n\nconst appNavJumps = selectAll('.navbar__item a', appNav);\n\n// These are for anchor links so that they also take into account the height of the sticky bar\nconst anchorJumps = selectAll('a.anchor', document);\n\nexport function setUpAnchors(allJumps) {\n  allJumps.forEach((el) => {\n    el.addEventListener('click', (e) => {\n      e.preventDefault();\n      const target = select(e.target.getAttribute('href'));\n\n      // var current = appNav.getElementsByClassName('active-nav');\n\n      // current[0].className = current[0].className.replace(' active-nav', '');\n\n      // var path =\n      //   e.path || (e.composedPath && e.composedPath()) || composedPath(e.target);\n      // path[1].className += ' active-nav';\n\n      window.scrollTo(\n        0,\n        window.pageYOffset + target.getBoundingClientRect().top - appNavHeight\n      );\n    });\n  });\n}\n\nsetUpAnchors(appNavJumps.concat(anchorJumps));\n","var journalize = require('journalize');\n\nimport { capfirst } from 'journalize';\n\nimport context from 'Data/text.json';\n\nexport function lastUpdatedFormat(now) {\n  // format dates to ap style\n  const formatted_date = journalize.apdate(now),\n    formatted_time = journalize.aptime(now),\n    formatted_month = journalize.apmonth(now),\n    just_day = now.getDate();\n\n  return formatted_time;\n}\n\nexport function format(num) {\n  return num < 10 ? '0' + num : num;\n}\n\nexport const chunk = (arr, size) =>\n  arr.reduce((acc, _, i) => {\n    if (i % size === 0) acc.push(arr.slice(i, i + size));\n    return acc;\n  }, []);\n\nexport const delay = (function() {\n  var timer = 0;\n  return function(callback, ms) {\n    clearTimeout(timer);\n    timer = setTimeout(callback, ms);\n  };\n})();\n\nconst PARTY_SORT_ORDER = [\n  'Republican',\n  'Democrat',\n  'Libertarian',\n  'Green',\n  'Independent',\n  'Write-in',\n];\n\n// If we need light blue #99d2da; background-color:rgba(153, 210, 218, .1)\n// If we need dark blue #325ba8; background-color:rgba(90, 137, 204, .1)\n\nconst TT_directory_slugs = [\n  { office: 'Texas House', 'directory-slug': 'tx-house' },\n  { office: 'Texas Senate', 'directory-slug': 'tx-senate' },\n  { office: 'U.S. House', 'directory-slug': 'us-house' },\n  { office: 'State Board of Education', 'directory-slug': 'sboe' },\n];\n\nexport function get_directory_slug(office) {\n  return TT_directory_slugs.filter(slug => slug.office == office);\n}\n\nexport function sort_candidates_by_party(candidates) {\n  return candidates.sort(\n    (a, b) =>\n      PARTY_SORT_ORDER.indexOf(a.party) - PARTY_SORT_ORDER.indexOf(b.party)\n  );\n}\n\nexport function alert_conditionals(vote_pct, cand_num) {\n  if (vote_pct == 0 && cand_num > 1) {\n    return context.label_conditionals['zero-results'];\n  } else if (vote_pct > 0 && vote_pct < 50 && cand_num > 1) {\n    return context.label_conditionals['more-than-0-less-than-50'];\n  } else if (vote_pct >= 50 && vote_pct < 99 && cand_num > 1) {\n    return context.label_conditionals['more-than-50-no-winner'];\n  } else if (vote_pct >= 99 && cand_num > 1) {\n    return context.label_conditionals['all-results-in-no-winner'];\n  } else if (cand_num == 1) {\n    return context.label_conditionals['uncontested'];\n  }\n}\n\nexport function alert_winners(result, totals) {\n  if (result == 'winner' && totals > 0) {\n    return context.winner_conditionals['winner'];\n  } \n  else if (result == 'winner' && totals == 0) {\n    return context.winner_conditionals['winner_zero']\n  }\n    else if (result == 'uncontested') {\n    return context.winner_conditionals['uncontested'];\n  } else if (result == 'runoff') {\n    return '';\n  }\n}\n\nexport function text_conditionals(vote_pct, cand_num) {\n  if (vote_pct == 0 && cand_num > 1) {\n    return context.text_conditionals['zero-results'];\n  } else if (vote_pct > 0 && vote_pct < 50 && cand_num > 1) {\n    return context.text_conditionals['more-than-0-less-than-50'];\n  } else if (vote_pct >= 50 && vote_pct < 99 && cand_num > 1) {\n    return context.text_conditionals['more-than-50-no-winner'];\n  } else if (vote_pct >= 99 && cand_num > 1) {\n    return context.text_conditionals['all-results-in-no-winner'];\n  } else if (cand_num == 1) {\n    return context.text_conditionals['uncontested'];\n  }\n}\n\nexport function determineDistrictTitle(contest) {\n  return `${contest.office} ${\n    contest.office === 'President' ||\n    contest.division_type === 'class' ||\n    contest.division_type === 'statewide'\n      ? ''\n      : contest.division_type === 'place' && contest.office_division === 1\n      ? 'Chief Justice'\n      : capfirst(contest.division_type) + ' ' + contest.office_division\n  }`.trim();\n}\n\nexport function determineContestTitle(contest) {\n  if (contest.division_type === 'statewide' || contest.division_type === 'seat')\n    return '';\n\n  return determineDistrictTitle(contest);\n}\n\nexport function determineContestTitleYourRaces(contest) {\n  return determineDistrictTitle(contest);\n}\n","import { getCoord, getGeom } from \"@turf/invariant\";\n// http://en.wikipedia.org/wiki/Even%E2%80%93odd_rule\n// modified from: https://github.com/substack/point-in-polygon/blob/master/index.js\n// which was modified from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html\n/**\n * Takes a {@link Point} and a {@link Polygon} or {@link MultiPolygon} and determines if the point\n * resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.\n *\n * @name booleanPointInPolygon\n * @param {Coord} point input point\n * @param {Feature<Polygon|MultiPolygon>} polygon input polygon or multipolygon\n * @param {Object} [options={}] Optional parameters\n * @param {boolean} [options.ignoreBoundary=false] True if polygon boundary should be ignored when determining if\n * the point is inside the polygon otherwise false.\n * @returns {boolean} `true` if the Point is inside the Polygon; `false` if the Point is not inside the Polygon\n * @example\n * var pt = turf.point([-77, 44]);\n * var poly = turf.polygon([[\n *   [-81, 41],\n *   [-81, 47],\n *   [-72, 47],\n *   [-72, 41],\n *   [-81, 41]\n * ]]);\n *\n * turf.booleanPointInPolygon(pt, poly);\n * //= true\n */\nexport default function booleanPointInPolygon(point, polygon, options) {\n    if (options === void 0) { options = {}; }\n    // validation\n    if (!point) {\n        throw new Error(\"point is required\");\n    }\n    if (!polygon) {\n        throw new Error(\"polygon is required\");\n    }\n    var pt = getCoord(point);\n    var geom = getGeom(polygon);\n    var type = geom.type;\n    var bbox = polygon.bbox;\n    var polys = geom.coordinates;\n    // Quick elimination if point is not inside bbox\n    if (bbox && inBBox(pt, bbox) === false) {\n        return false;\n    }\n    // normalize to multipolygon\n    if (type === \"Polygon\") {\n        polys = [polys];\n    }\n    var insidePoly = false;\n    for (var i = 0; i < polys.length && !insidePoly; i++) {\n        // check if it is in the outer ring first\n        if (inRing(pt, polys[i][0], options.ignoreBoundary)) {\n            var inHole = false;\n            var k = 1;\n            // check for the point in any of the holes\n            while (k < polys[i].length && !inHole) {\n                if (inRing(pt, polys[i][k], !options.ignoreBoundary)) {\n                    inHole = true;\n                }\n                k++;\n            }\n            if (!inHole) {\n                insidePoly = true;\n            }\n        }\n    }\n    return insidePoly;\n}\n/**\n * inRing\n *\n * @private\n * @param {Array<number>} pt [x,y]\n * @param {Array<Array<number>>} ring [[x,y], [x,y],..]\n * @param {boolean} ignoreBoundary ignoreBoundary\n * @returns {boolean} inRing\n */\nfunction inRing(pt, ring, ignoreBoundary) {\n    var isInside = false;\n    if (ring[0][0] === ring[ring.length - 1][0] &&\n        ring[0][1] === ring[ring.length - 1][1]) {\n        ring = ring.slice(0, ring.length - 1);\n    }\n    for (var i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n        var xi = ring[i][0];\n        var yi = ring[i][1];\n        var xj = ring[j][0];\n        var yj = ring[j][1];\n        var onBoundary = pt[1] * (xi - xj) + yi * (xj - pt[0]) + yj * (pt[0] - xi) === 0 &&\n            (xi - pt[0]) * (xj - pt[0]) <= 0 &&\n            (yi - pt[1]) * (yj - pt[1]) <= 0;\n        if (onBoundary) {\n            return !ignoreBoundary;\n        }\n        var intersect = yi > pt[1] !== yj > pt[1] &&\n            pt[0] < ((xj - xi) * (pt[1] - yi)) / (yj - yi) + xi;\n        if (intersect) {\n            isInside = !isInside;\n        }\n    }\n    return isInside;\n}\n/**\n * inBBox\n *\n * @private\n * @param {Position} pt point [x,y]\n * @param {BBox} bbox BBox [west, south, east, north]\n * @returns {boolean} true/false if point is inside BBox\n */\nfunction inBBox(pt, bbox) {\n    return (bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1]);\n}\n","import { isNumber, } from \"@turf/helpers\";\n/**\n * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.\n *\n * @name getCoord\n * @param {Array<number>|Geometry<Point>|Feature<Point>} coord GeoJSON Point or an Array of numbers\n * @returns {Array<number>} coordinates\n * @example\n * var pt = turf.point([10, 10]);\n *\n * var coord = turf.getCoord(pt);\n * //= [10, 10]\n */\nexport function getCoord(coord) {\n    if (!coord) {\n        throw new Error(\"coord is required\");\n    }\n    if (!Array.isArray(coord)) {\n        if (coord.type === \"Feature\" &&\n            coord.geometry !== null &&\n            coord.geometry.type === \"Point\") {\n            return coord.geometry.coordinates;\n        }\n        if (coord.type === \"Point\") {\n            return coord.coordinates;\n        }\n    }\n    if (Array.isArray(coord) &&\n        coord.length >= 2 &&\n        !Array.isArray(coord[0]) &&\n        !Array.isArray(coord[1])) {\n        return coord;\n    }\n    throw new Error(\"coord must be GeoJSON Point or an Array of numbers\");\n}\n/**\n * Unwrap coordinates from a Feature, Geometry Object or an Array\n *\n * @name getCoords\n * @param {Array<any>|Geometry|Feature} coords Feature, Geometry Object or an Array\n * @returns {Array<any>} coordinates\n * @example\n * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);\n *\n * var coords = turf.getCoords(poly);\n * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]\n */\nexport function getCoords(coords) {\n    if (Array.isArray(coords)) {\n        return coords;\n    }\n    // Feature\n    if (coords.type === \"Feature\") {\n        if (coords.geometry !== null) {\n            return coords.geometry.coordinates;\n        }\n    }\n    else {\n        // Geometry\n        if (coords.coordinates) {\n            return coords.coordinates;\n        }\n    }\n    throw new Error(\"coords must be GeoJSON Feature, Geometry Object or an Array\");\n}\n/**\n * Checks if coordinates contains a number\n *\n * @name containsNumber\n * @param {Array<any>} coordinates GeoJSON Coordinates\n * @returns {boolean} true if Array contains a number\n */\nexport function containsNumber(coordinates) {\n    if (coordinates.length > 1 &&\n        isNumber(coordinates[0]) &&\n        isNumber(coordinates[1])) {\n        return true;\n    }\n    if (Array.isArray(coordinates[0]) && coordinates[0].length) {\n        return containsNumber(coordinates[0]);\n    }\n    throw new Error(\"coordinates must only contain numbers\");\n}\n/**\n * Enforce expectations about types of GeoJSON objects for Turf.\n *\n * @name geojsonType\n * @param {GeoJSON} value any GeoJSON object\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} if value is not the expected type.\n */\nexport function geojsonType(value, type, name) {\n    if (!type || !name) {\n        throw new Error(\"type and name required\");\n    }\n    if (!value || value.type !== type) {\n        throw new Error(\"Invalid input to \" +\n            name +\n            \": must be a \" +\n            type +\n            \", given \" +\n            value.type);\n    }\n}\n/**\n * Enforce expectations about types of {@link Feature} inputs for Turf.\n * Internally this uses {@link geojsonType} to judge geometry types.\n *\n * @name featureOf\n * @param {Feature} feature a feature with an expected geometry type\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} error if value is not the expected type.\n */\nexport function featureOf(feature, type, name) {\n    if (!feature) {\n        throw new Error(\"No feature passed\");\n    }\n    if (!name) {\n        throw new Error(\".featureOf() requires a name\");\n    }\n    if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n        throw new Error(\"Invalid input to \" + name + \", Feature with geometry required\");\n    }\n    if (!feature.geometry || feature.geometry.type !== type) {\n        throw new Error(\"Invalid input to \" +\n            name +\n            \": must be a \" +\n            type +\n            \", given \" +\n            feature.geometry.type);\n    }\n}\n/**\n * Enforce expectations about types of {@link FeatureCollection} inputs for Turf.\n * Internally this uses {@link geojsonType} to judge geometry types.\n *\n * @name collectionOf\n * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} if value is not the expected type.\n */\nexport function collectionOf(featureCollection, type, name) {\n    if (!featureCollection) {\n        throw new Error(\"No featureCollection passed\");\n    }\n    if (!name) {\n        throw new Error(\".collectionOf() requires a name\");\n    }\n    if (!featureCollection || featureCollection.type !== \"FeatureCollection\") {\n        throw new Error(\"Invalid input to \" + name + \", FeatureCollection required\");\n    }\n    for (var _i = 0, _a = featureCollection.features; _i < _a.length; _i++) {\n        var feature = _a[_i];\n        if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n            throw new Error(\"Invalid input to \" + name + \", Feature with geometry required\");\n        }\n        if (!feature.geometry || feature.geometry.type !== type) {\n            throw new Error(\"Invalid input to \" +\n                name +\n                \": must be a \" +\n                type +\n                \", given \" +\n                feature.geometry.type);\n        }\n    }\n}\n/**\n * Get Geometry from Feature or Geometry Object\n *\n * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object\n * @returns {Geometry|null} GeoJSON Geometry Object\n * @throws {Error} if geojson is not a Feature or Geometry Object\n * @example\n * var point = {\n *   \"type\": \"Feature\",\n *   \"properties\": {},\n *   \"geometry\": {\n *     \"type\": \"Point\",\n *     \"coordinates\": [110, 40]\n *   }\n * }\n * var geom = turf.getGeom(point)\n * //={\"type\": \"Point\", \"coordinates\": [110, 40]}\n */\nexport function getGeom(geojson) {\n    if (geojson.type === \"Feature\") {\n        return geojson.geometry;\n    }\n    return geojson;\n}\n/**\n * Get GeoJSON object's type, Geometry type is prioritize.\n *\n * @param {GeoJSON} geojson GeoJSON object\n * @param {string} [name=\"geojson\"] name of the variable to display in error message (unused)\n * @returns {string} GeoJSON type\n * @example\n * var point = {\n *   \"type\": \"Feature\",\n *   \"properties\": {},\n *   \"geometry\": {\n *     \"type\": \"Point\",\n *     \"coordinates\": [110, 40]\n *   }\n * }\n * var geom = turf.getType(point)\n * //=\"Point\"\n */\nexport function getType(geojson, _name) {\n    if (geojson.type === \"FeatureCollection\") {\n        return \"FeatureCollection\";\n    }\n    if (geojson.type === \"GeometryCollection\") {\n        return \"GeometryCollection\";\n    }\n    if (geojson.type === \"Feature\" && geojson.geometry !== null) {\n        return geojson.geometry.type;\n    }\n    return geojson.type;\n}\n","function streamGeometry(geometry, stream) {\n  if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {\n    streamGeometryType[geometry.type](geometry, stream);\n  }\n}\n\nvar streamObjectType = {\n  Feature: function(object, stream) {\n    streamGeometry(object.geometry, stream);\n  },\n  FeatureCollection: function(object, stream) {\n    var features = object.features, i = -1, n = features.length;\n    while (++i < n) streamGeometry(features[i].geometry, stream);\n  }\n};\n\nvar streamGeometryType = {\n  Sphere: function(object, stream) {\n    stream.sphere();\n  },\n  Point: function(object, stream) {\n    object = object.coordinates;\n    stream.point(object[0], object[1], object[2]);\n  },\n  MultiPoint: function(object, stream) {\n    var coordinates = object.coordinates, i = -1, n = coordinates.length;\n    while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);\n  },\n  LineString: function(object, stream) {\n    streamLine(object.coordinates, stream, 0);\n  },\n  MultiLineString: function(object, stream) {\n    var coordinates = object.coordinates, i = -1, n = coordinates.length;\n    while (++i < n) streamLine(coordinates[i], stream, 0);\n  },\n  Polygon: function(object, stream) {\n    streamPolygon(object.coordinates, stream);\n  },\n  MultiPolygon: function(object, stream) {\n    var coordinates = object.coordinates, i = -1, n = coordinates.length;\n    while (++i < n) streamPolygon(coordinates[i], stream);\n  },\n  GeometryCollection: function(object, stream) {\n    var geometries = object.geometries, i = -1, n = geometries.length;\n    while (++i < n) streamGeometry(geometries[i], stream);\n  }\n};\n\nfunction streamLine(coordinates, stream, closed) {\n  var i = -1, n = coordinates.length - closed, coordinate;\n  stream.lineStart();\n  while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);\n  stream.lineEnd();\n}\n\nfunction streamPolygon(coordinates, stream) {\n  var i = -1, n = coordinates.length;\n  stream.polygonStart();\n  while (++i < n) streamLine(coordinates[i], stream, 1);\n  stream.polygonEnd();\n}\n\nexport default function(object, stream) {\n  if (object && streamObjectType.hasOwnProperty(object.type)) {\n    streamObjectType[object.type](object, stream);\n  } else {\n    streamGeometry(object, stream);\n  }\n}\n","/**\n * A wrapper for the initial response from a fetch call that funnels to\n * res.json().\n *\n * @private\n * @param {Response} res\n * @returns {Promise}\n */\nfunction jsonResponse(res) {\n  if (!res.ok) throw new Error(`${res.status}: ${res.statusText}`);\n\n  return res.json();\n}\n\n/**\n * A light wrapper around fetch that assumes you're seeking a JSON response.\n *\n * @param {String|Request} input\n * @param {Object} init\n * @returns {Promise}\n */\nexport default function getJSON(input, init) {\n  return fetch(input, init).then(jsonResponse);\n}\n","// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423\nexport class Adder {\n  constructor() {\n    this._partials = new Float64Array(32);\n    this._n = 0;\n  }\n  add(x) {\n    const p = this._partials;\n    let i = 0;\n    for (let j = 0; j < this._n && j < 32; j++) {\n      const y = p[j],\n        hi = x + y,\n        lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);\n      if (lo) p[i++] = lo;\n      x = hi;\n    }\n    p[i] = x;\n    this._n = i + 1;\n    return this;\n  }\n  valueOf() {\n    const p = this._partials;\n    let n = this._n, x, y, lo, hi = 0;\n    if (n > 0) {\n      hi = p[--n];\n      while (n > 0) {\n        x = hi;\n        y = p[--n];\n        hi = x + y;\n        lo = y - (hi - x);\n        if (lo) break;\n      }\n      if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {\n        y = lo * 2;\n        x = hi + y;\n        if (y == x - hi) hi = x;\n      }\n    }\n    return hi;\n  }\n}\n\nexport function fsum(values, valueof) {\n  const adder = new Adder();\n  if (valueof === undefined) {\n    for (let value of values) {\n      if (value = +value) {\n        adder.add(value);\n      }\n    }\n  } else {\n    let index = -1;\n    for (let value of values) {\n      if (value = +valueof(value, ++index, values)) {\n        adder.add(value);\n      }\n    }\n  }\n  return +adder;\n}\n\nexport function fcumsum(values, valueof) {\n  const adder = new Adder();\n  let index = -1;\n  return Float64Array.from(values, valueof === undefined\n      ? v => adder.add(+v || 0)\n      : v => adder.add(+valueof(v, ++index, values) || 0)\n  );\n}\n","import {Adder} from \"d3-array\";\nimport {abs} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar areaSum = new Adder(),\n    areaRingSum = new Adder(),\n    x00,\n    y00,\n    x0,\n    y0;\n\nvar areaStream = {\n  point: noop,\n  lineStart: noop,\n  lineEnd: noop,\n  polygonStart: function() {\n    areaStream.lineStart = areaRingStart;\n    areaStream.lineEnd = areaRingEnd;\n  },\n  polygonEnd: function() {\n    areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;\n    areaSum.add(abs(areaRingSum));\n    areaRingSum = new Adder();\n  },\n  result: function() {\n    var area = areaSum / 2;\n    areaSum = new Adder();\n    return area;\n  }\n};\n\nfunction areaRingStart() {\n  areaStream.point = areaPointFirst;\n}\n\nfunction areaPointFirst(x, y) {\n  areaStream.point = areaPoint;\n  x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction areaPoint(x, y) {\n  areaRingSum.add(y0 * x - x0 * y);\n  x0 = x, y0 = y;\n}\n\nfunction areaRingEnd() {\n  areaPoint(x00, y00);\n}\n\nexport default areaStream;\n","import {sqrt} from \"../math.js\";\n\n// TODO Enforce positive area for exterior, negative area for interior?\n\nvar X0 = 0,\n    Y0 = 0,\n    Z0 = 0,\n    X1 = 0,\n    Y1 = 0,\n    Z1 = 0,\n    X2 = 0,\n    Y2 = 0,\n    Z2 = 0,\n    x00,\n    y00,\n    x0,\n    y0;\n\nvar centroidStream = {\n  point: centroidPoint,\n  lineStart: centroidLineStart,\n  lineEnd: centroidLineEnd,\n  polygonStart: function() {\n    centroidStream.lineStart = centroidRingStart;\n    centroidStream.lineEnd = centroidRingEnd;\n  },\n  polygonEnd: function() {\n    centroidStream.point = centroidPoint;\n    centroidStream.lineStart = centroidLineStart;\n    centroidStream.lineEnd = centroidLineEnd;\n  },\n  result: function() {\n    var centroid = Z2 ? [X2 / Z2, Y2 / Z2]\n        : Z1 ? [X1 / Z1, Y1 / Z1]\n        : Z0 ? [X0 / Z0, Y0 / Z0]\n        : [NaN, NaN];\n    X0 = Y0 = Z0 =\n    X1 = Y1 = Z1 =\n    X2 = Y2 = Z2 = 0;\n    return centroid;\n  }\n};\n\nfunction centroidPoint(x, y) {\n  X0 += x;\n  Y0 += y;\n  ++Z0;\n}\n\nfunction centroidLineStart() {\n  centroidStream.point = centroidPointFirstLine;\n}\n\nfunction centroidPointFirstLine(x, y) {\n  centroidStream.point = centroidPointLine;\n  centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidPointLine(x, y) {\n  var dx = x - x0, dy = y - y0, z = sqrt(dx * dx + dy * dy);\n  X1 += z * (x0 + x) / 2;\n  Y1 += z * (y0 + y) / 2;\n  Z1 += z;\n  centroidPoint(x0 = x, y0 = y);\n}\n\nfunction centroidLineEnd() {\n  centroidStream.point = centroidPoint;\n}\n\nfunction centroidRingStart() {\n  centroidStream.point = centroidPointFirstRing;\n}\n\nfunction centroidRingEnd() {\n  centroidPointRing(x00, y00);\n}\n\nfunction centroidPointFirstRing(x, y) {\n  centroidStream.point = centroidPointRing;\n  centroidPoint(x00 = x0 = x, y00 = y0 = y);\n}\n\nfunction centroidPointRing(x, y) {\n  var dx = x - x0,\n      dy = y - y0,\n      z = sqrt(dx * dx + dy * dy);\n\n  X1 += z * (x0 + x) / 2;\n  Y1 += z * (y0 + y) / 2;\n  Z1 += z;\n\n  z = y0 * x - x0 * y;\n  X2 += z * (x0 + x);\n  Y2 += z * (y0 + y);\n  Z2 += z * 3;\n  centroidPoint(x0 = x, y0 = y);\n}\n\nexport default centroidStream;\n","import {tau} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nexport default function PathContext(context) {\n  this._context = context;\n}\n\nPathContext.prototype = {\n  _radius: 4.5,\n  pointRadius: function(_) {\n    return this._radius = _, this;\n  },\n  polygonStart: function() {\n    this._line = 0;\n  },\n  polygonEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line === 0) this._context.closePath();\n    this._point = NaN;\n  },\n  point: function(x, y) {\n    switch (this._point) {\n      case 0: {\n        this._context.moveTo(x, y);\n        this._point = 1;\n        break;\n      }\n      case 1: {\n        this._context.lineTo(x, y);\n        break;\n      }\n      default: {\n        this._context.moveTo(x + this._radius, y);\n        this._context.arc(x, y, this._radius, 0, tau);\n        break;\n      }\n    }\n  },\n  result: noop\n};\n","import {Adder} from \"d3-array\";\nimport {sqrt} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar lengthSum = new Adder(),\n    lengthRing,\n    x00,\n    y00,\n    x0,\n    y0;\n\nvar lengthStream = {\n  point: noop,\n  lineStart: function() {\n    lengthStream.point = lengthPointFirst;\n  },\n  lineEnd: function() {\n    if (lengthRing) lengthPoint(x00, y00);\n    lengthStream.point = noop;\n  },\n  polygonStart: function() {\n    lengthRing = true;\n  },\n  polygonEnd: function() {\n    lengthRing = null;\n  },\n  result: function() {\n    var length = +lengthSum;\n    lengthSum = new Adder();\n    return length;\n  }\n};\n\nfunction lengthPointFirst(x, y) {\n  lengthStream.point = lengthPoint;\n  x00 = x0 = x, y00 = y0 = y;\n}\n\nfunction lengthPoint(x, y) {\n  x0 -= x, y0 -= y;\n  lengthSum.add(sqrt(x0 * x0 + y0 * y0));\n  x0 = x, y0 = y;\n}\n\nexport default lengthStream;\n","export default function PathString() {\n  this._string = [];\n}\n\nPathString.prototype = {\n  _radius: 4.5,\n  _circle: circle(4.5),\n  pointRadius: function(_) {\n    if ((_ = +_) !== this._radius) this._radius = _, this._circle = null;\n    return this;\n  },\n  polygonStart: function() {\n    this._line = 0;\n  },\n  polygonEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line === 0) this._string.push(\"Z\");\n    this._point = NaN;\n  },\n  point: function(x, y) {\n    switch (this._point) {\n      case 0: {\n        this._string.push(\"M\", x, \",\", y);\n        this._point = 1;\n        break;\n      }\n      case 1: {\n        this._string.push(\"L\", x, \",\", y);\n        break;\n      }\n      default: {\n        if (this._circle == null) this._circle = circle(this._radius);\n        this._string.push(\"M\", x, \",\", y, this._circle);\n        break;\n      }\n    }\n  },\n  result: function() {\n    if (this._string.length) {\n      var result = this._string.join(\"\");\n      this._string = [];\n      return result;\n    } else {\n      return null;\n    }\n  }\n};\n\nfunction circle(radius) {\n  return \"m0,\" + radius\n      + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + -2 * radius\n      + \"a\" + radius + \",\" + radius + \" 0 1,1 0,\" + 2 * radius\n      + \"z\";\n}\n","import identity from \"../identity.js\";\nimport stream from \"../stream.js\";\nimport pathArea from \"./area.js\";\nimport pathBounds from \"./bounds.js\";\nimport pathCentroid from \"./centroid.js\";\nimport PathContext from \"./context.js\";\nimport pathMeasure from \"./measure.js\";\nimport PathString from \"./string.js\";\n\nexport default function(projection, context) {\n  var pointRadius = 4.5,\n      projectionStream,\n      contextStream;\n\n  function path(object) {\n    if (object) {\n      if (typeof pointRadius === \"function\") contextStream.pointRadius(+pointRadius.apply(this, arguments));\n      stream(object, projectionStream(contextStream));\n    }\n    return contextStream.result();\n  }\n\n  path.area = function(object) {\n    stream(object, projectionStream(pathArea));\n    return pathArea.result();\n  };\n\n  path.measure = function(object) {\n    stream(object, projectionStream(pathMeasure));\n    return pathMeasure.result();\n  };\n\n  path.bounds = function(object) {\n    stream(object, projectionStream(pathBounds));\n    return pathBounds.result();\n  };\n\n  path.centroid = function(object) {\n    stream(object, projectionStream(pathCentroid));\n    return pathCentroid.result();\n  };\n\n  path.projection = function(_) {\n    return arguments.length ? (projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream, path) : projection;\n  };\n\n  path.context = function(_) {\n    if (!arguments.length) return context;\n    contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _);\n    if (typeof pointRadius !== \"function\") contextStream.pointRadius(pointRadius);\n    return path;\n  };\n\n  path.pointRadius = function(_) {\n    if (!arguments.length) return pointRadius;\n    pointRadius = typeof _ === \"function\" ? _ : (contextStream.pointRadius(+_), +_);\n    return path;\n  };\n\n  return path.projection(projection).context(context);\n}\n","const hOP = Object.prototype.hasOwnProperty;\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x: any, y: any): boolean {\n  // SameValue algorithm\n  if (x === y) {\n    // Steps 1-5, 7-10\n    // Steps 6.b-6.e: +0 != -0\n    // Added the nonzero y check to make Flow happy, but it is redundant\n    return x !== 0 || y !== 0 || 1 / x === 1 / y;\n  }\n  // Step 6.a: NaN == NaN\n  return x !== x && y !== y;\n}\n\n/**\n * Performs equality by iterating through keys on an object and returning false\n * when any key has values which are not strictly equal between the arguments.\n * Returns true when the values of all keys are strictly equal.\n */\nfunction shallowEqual(objA: object, objB: object): boolean {\n  if (is(objA, objB)) {\n    return true;\n  }\n\n  if (\n    typeof objA !== 'object' ||\n    objA === null ||\n    typeof objB !== 'object' ||\n    objB === null\n  ) {\n    return false;\n  }\n\n  const keysA = Object.keys(objA);\n  const keysB = Object.keys(objB);\n\n  if (keysA.length !== keysB.length) {\n    return false;\n  }\n\n  // Test for A's keys different from B.\n  for (let i = 0; i < keysA.length; i++) {\n    if (!hOP.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n      return false;\n    }\n  }\n\n  return true;\n}\n\nexport default shallowEqual;\n","// packages\nimport { Component } from 'preact';\n\n// internal\nimport shallowEqual from '../utils/shallow-equal';\n\nabstract class PureComponent<P = {}, S = {}> extends Component<P, S> {\n  shouldComponentUpdate(props, state) {\n    const check =\n      shallowEqual(props, this.props) && shallowEqual(state, this.state);\n    // if (props.projection)\n    //   console.log(\n    //     'projection check:',\n    //     props.projection === this.props.projection,\n    //     !check\n    //   );\n    return !check;\n  }\n}\n\nexport default PureComponent;\n","export default function _extends() {\n  _extends = Object.assign ? Object.assign.bind() : function (target) {\n    for (var i = 1; i < arguments.length; i++) {\n      var source = arguments[i];\n\n      for (var key in source) {\n        if (Object.prototype.hasOwnProperty.call(source, key)) {\n          target[key] = source[key];\n        }\n      }\n    }\n\n    return target;\n  };\n  return _extends.apply(this, arguments);\n}","/**\n * A for-loop version of Array.prototype.find so IE and friends can play.\n *\n * @private\n * @param  {Array} arr\n * @param  {Function} predicate\n * @return {*|undefined}\n * @throws {TypeError} Argument predicate must be a function\n */\nexport default function find(\n  arr: Array<any>,\n  predicate: Function\n): any | undefined {\n  if (typeof predicate !== 'function') {\n    throw new TypeError('predicate must be a function');\n  }\n\n  for (let i = 0; i < arr.length; i++) {\n    if (predicate(arr[i], i, arr)) {\n      return arr[i];\n    }\n  }\n\n  return undefined;\n}\n","// packages\nimport cx from 'classnames';\nimport { capfirst } from 'journalize';\nimport memoize from 'lodash.memoize';\nimport { h } from 'preact';\n\ntype Props = {\n  excludeInitial?: boolean;\n  party: string;\n  style: string;\n};\n\nfunction PartyPill({ excludeInitial, party, style }: Props) {\n  const partyPrefix = party.slice(0, 3).toLowerCase();\n  const partyInitial = party[0].toUpperCase();\n\n  const classes = cx('circle-pill', `pill--${partyPrefix}`);\n\n  return (\n    <span class={classes} style={style} title={capfirst(party)}>\n      {!excludeInitial && partyInitial}\n    </span>\n  );\n}\n\nPartyPill.defaultProps = {\n  excludeInitial: false,\n};\n\nexport default memoize(PartyPill, ({ party, style }) => ({\n  party: party,\n  style: style,\n}));\n"],"sourceRoot":""}