{"version":3,"sources":["webpack:///./app/scripts/components/PureCanvas.tsx","webpack:///./app/scripts/components/CanvasLayer.tsx","webpack:///./app/scripts/colors.ts","webpack:///./app/scripts/components/MapLegend.tsx","webpack:///./app/scripts/components/Places.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/vendor/flatqueue.js","webpack:///./app/scripts/vendor/flatbush.js","webpack:///./app/scripts/utils/prepare-topojson.ts","webpack:///./app/scripts/components/LayeredMap.tsx","webpack:///./app/scripts/utils/clamp.js","webpack:///./app/scripts/utils/sum-values-no-key.js","webpack:///./node_modules/@turf/helpers/index.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:///./app/scripts/components/OtherCandidate.js","webpack:///./app/scripts/components/Contest.tsx","webpack:///./node_modules/@turf/invariant/index.js","webpack:///./app/scripts/components/HeadshotCandidateRow.tsx","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:///./app/scripts/components/Portal.js","webpack:///./node_modules/@turf/bbox/index.js","webpack:///./node_modules/d3-geo/src/math.js","webpack:///./node_modules/@turf/boolean-point-in-polygon/index.js","webpack:///./app/scripts/kickstart.js","webpack:///./app/scripts/utils/platform.ts","webpack:///./app/scripts/components/NewContestShowcase.tsx","webpack:///./app/scripts/vendor/idb-keyval.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/Ad.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/bbox-polygon/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/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:///./node_modules/@turf/meta/index.js","webpack:///./app/scripts/components/CandidateRow.tsx","webpack:///./app/scripts/utils/select-all.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/d3-geo/src/stream.js","webpack:///./app/scripts/packs/races-to-watch.js","webpack:///./app/scripts/utils/get-json.js","webpack:///./node_modules/d3-array/src/ascending.js","webpack:///./node_modules/d3-array/src/bisector.js","webpack:///./node_modules/d3-array/src/bisect.js","webpack:///./node_modules/d3-array/src/cross.js","webpack:///./node_modules/d3-array/src/number.js","webpack:///./node_modules/d3-array/src/extent.js","webpack:///./node_modules/d3-array/src/array.js","webpack:///./node_modules/d3-array/src/range.js","webpack:///./node_modules/d3-array/src/ticks.js","webpack:///./node_modules/d3-array/src/threshold/sturges.js","webpack:///./node_modules/d3-array/src/quantile.js","webpack:///./node_modules/d3-array/src/max.js","webpack:///./node_modules/d3-array/src/merge.js","webpack:///./node_modules/d3-geo/src/adder.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","DEMOCRAT","DEMOCRAT_LEAN","REPUBLICAN","REPUBLICAN_LEAN","LIBERTARIAN","GREEN","INDEPENDENT","OTHER","NEUTRAL","TIE","MapLegend","candidates","includesNoResult","includesTie","class","map","candidate","cx","party","slice","toLowerCase","name","split","pop","trim","backgroundColor","Places","places","place","idx","key","transform","centroid","dx","properties","dy","text-anchor","anchor","SvgLayer","handleMouseMove","handleMouseLeave","event","onMouseMove","onMouseLeave","setState","strokeLinecap","strokeLinejoin","pointerEvents","viewBox","preserveAspectRatio","state","Tooltip","cls","isHidden","tooltipRef","klass","Portal","children","TooltipTable","candidatesMap","county","sortedResults","entries","results","sort","a","b","value","firstFourResults","sumValues","pct_votes","formatPercent","total_votes","estimated_votes_high","pct_votes_turnout","source","county_pollinglocationsreporting","total_county_pollinglocations","CandidateRow","countyHeader","result","get","last_names","id","ballotName","candidateId","contestIsCalled","isIncumbent","is_incumbent","totalVotesInContest","votes","getPoint","node","x","y","rect","getBoundingClientRect","clientLeft","clientTop","FlatQueue","ids","values","length","clear","push","pos","parent","parentValue","halfLength","right","bestIndex","bestValue","rightValue","peek","peekValue","ARRAY_TYPES","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","Flatbush","data","ArrayBuffer","Error","magic","versionAndType","nodeSize","numItems","ArrayType","undefined","isNaN","Math","min","max","n","numNodes","_levelBounds","ceil","IndexArrayType","arrayTypeIndex","indexOf","nodesByteSize","BYTES_PER_ELEMENT","_boxes","_indices","_pos","minX","minY","maxX","maxY","Infinity","set","_queue","add","index","finish","hilbertValues","i","floor","hilbert","boxes","indices","pivot","j","swap","end","nodeMinX","nodeMinY","nodeMaxX","nodeMaxY","nodeIndex","search","filterFn","level","queue","neighbors","maxResults","maxDistance","q","maxDistSquared","upperBound","axisDist","dist","k","arr","m","temp","c","d","e","A","B","C","D","i0","i1","prepareTopoJSON","topology","object","objects","Object","keys","roadsObject","placesObject","urbanAreasObject","collection","feature","roads","urban_areas","bbox","getBBox","features","forEach","bounds","heightRatio","relocateTooltip","tooltip","innerWidth","innerHeight","LayeredMap","activeGeometry","candidatesOnMap","geos","onDocumentTouch","getTooltipRef","canvasRenderer","xScale","scaleLinear","yScale","el","setUpCountyMap","counties","countyMap","fips","setUpCandidateMap","candidateMap","clientX","clientY","target","point","coords","invert","found","find","booleanPointInPolygon","activeCounty","base","contains","candidatesRender","embedType","clearRect","fillStyle","lean","totalVotes","reduce","colors","leader","second","leadingId","toFixed","toUpperCase","beginPath","fill","closePath","lineCap","lineJoin","strokeStyle","lineWidth","stroke","places_mappable","embedTypeUsable","includes","filter","arc","PI","componentWillReceiveProps","nextProps","getContainerDimensions","offsetWidth","componentWillUnmount","document","removeEventListener","rawWidth","clientWidth","domain","range","fitSize","bboxPolygon","addEventListener","precinctsReporting","boxSizing","stroke-width","totalPrecincts","has","invisible","Boolean","geom","options","feat","type","geometry","coordinates","polygon","_i","coordinates_1","ring","lineString","featureCollection","fc","multiLineString","multiPoint","multiPolygon","radiansToLength","radians","units","factor","exports","factors","lengthToRadians","distance","radiansToDegrees","isNumber","num","Array","isArray","test","defineProperty","earthRadius","centimeters","centimetres","degrees","feet","inches","kilometers","kilometres","meters","metres","miles","millimeters","millimetres","nauticalmiles","yards","unitsFactors","areaFactors","acres","points","polygons","lineStrings","geometryCollection","geometries","round","precision","multiplier","pow","lengthToDegrees","bearingToAzimuth","bearing","angle","degreesToRadians","convertLength","originalUnit","finalUnit","convertArea","area","startFactor","finalFactor","isObject","input","validateBBox","validateId","radians2degrees","degrees2radians","distanceToDegrees","distanceToRadians","radiansToDistance","bearingToAngle","convertDistance","identity","x0","y0","kx","ky","translate","output","o","transformPoint","arcs","array","t","reverse","p","line","OtherCandidate","isViewable","candidateCount","onClick","classes","xlinkHref","converter","process","PreactHTMLConverter","Contest","viewAllCandidates","onViewableToggle","prevState","winner_found","directory_slug","contest","flags","annotations","columnCount","contestTitle","isShowcaseRace","asOf","includeCountyRundown","renderCandidate","visibleCandidatesCount","isHomepage","tableHeader","broadcastHeaderImage","activeContestId","shouldDisplayResult","contest_result","IsFlagged","hasTurnoutmodel","rep_target","dem_target","office","IsAnnotations","get_directory_slug","candidacies","sort_candidates_by_party","item","is_winner","isPartner","rowClass","seat__races","seat__races__partner","seat__highlight_races","disclaimerClass","contestMetricsClass","homepage__metrics","precinctsClass","tribcast","turnout_model_district","countdownClass","href","rel","src","alt","title","aria-hidden","convert","prose","intcomma","pollinglocationsreporting","total_pollinglocations","pollinglocations_reporting_percent","hasManualoverride","showCountdown","helpers_1","require","getCoord","coord","getCoords","containsNumber","geojsonType","featureOf","collectionOf","_a","getGeom","geojson","getType","HeadshotCandidateRow","isWinner","IsDroppedOut","checkClass","isCanvass","isCalled","Header","colSpan","HomepageHeader","loadAssetURL","elementId","element","getElementById","getAttribute","JSON","parse","textContent","asset_url","renderPortal","defaultNode","body","removeChild","portal","createElement","appendChild","meta_1","default","coordEach","epsilon","pi","tau","abs","cos","atan","atan2","sin","exp","log","sqrt","sign","tan","invariant_1","inRing","pt","ignoreBoundary","isInside","xi","yi","xj","yj","polys","inBBox","insidePoly","inHole","ttData","relatedContentContainer","gutenTag","then","RelatedContent","ribbonContainer","Ribbon","AdLoader","delay","init","userAgent","navigator","isIE","ContestShowcase","geoIdentity","reflectY","container","contestContainer","querySelector","mapContainer","countiesContainer","_contestPortal","determineContestTitle","visibleCandidateCount","is_called","_mapPortal","precincts_reporting","store","Store","dbName","storeName","_dbp","Promise","resolve","reject","openreq","indexedDB","open","onerror","error","onsuccess","onupgradeneeded","createObjectStore","_withIDBStore","callback","db","transaction","oncomplete","onabort","objectStore","getDefaultStore","getScroll","w","ret","method","getScrollLeft","getScrollTop","getOffset","elem","doc","docElem","box","getClientPosition","_RE_NUM_NO_PX","RegExp","RE_POS","LEFT","each","fn","isBorderBoxFn","getComputedStyleX","computedStyle_","val","computedStyle","rsLeft","BOX_MODELS","old","getPBMWidth","which","prop","cssProp","parseFloat","isWindow","obj","domUtils","getWH","extra","borderBoxValue","isBorderBox","cssBoxValue","Number","borderBoxValueOrIsBorderBox","padding","refWin","win","documentElementProp","cssShow","visibility","display","getWHIgnoreDisplay","args","css","v","first","includeMargin","getWindow","offset","current","setOffset","clone","scrollLeft","scrollTop","viewportWidth","viewportHeight","config","util","allowHorizontalScroll","onlyScrollIfNeeded","alignWithTop","alignWithLeft","offsetTop","offsetLeft","offsetBottom","offsetRight","isWin","elemOffset","eh","ew","wh","ww","winScroll","diffTop","diffBottom","containerScroll","containerOffset","ch","cw","debounce","func","wait","immediate","timeout","context","timestamp","later","last","Date","now","setTimeout","apply","arguments","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","highlightItemOnMouseEnter","selectItemOnClick","getItemValue","onSelect","blur","renderList","onMouseDown","preventDefault","cloneElement","renderItem","onMouseEnter","renderAttribution","onClear","onBlur","inputProps","onFocus","onChange","keyEvents","call","renderInput","role","String","autocomplete","onInput","onKeyDown","aria-label","noop","ArrowDown","itemsCount","newIndex","ArrowUp","Enter","keyCode","select","setSelectionRange","Escape","googleIMG","sessionToken","google","maps","AutocompleteSessionToken","autocompleteService","AutocompleteService","east","west","south","north","componentRestrictions","country","types","YourRaces","contests","lookupError","lookupPending","lookedFoundStored","handleGeocode","debouncedHandleGeocode","getPlacePredictions","predict","status","getPredictions","catch","placeId","placesService","getDetails","fields","lat","latitude","lng","longitude","location","toJSON","getJSON","LOOKUP_URL","lookup","put","PlacesService","req","addressFeedback","matches","sboe","flagMatches","annoMatches","office_division","us_house","district","tx_senate","tx_house","for","placeholder","description","place_id","isHighlighted","_resultsPortal","office_slug","determineContestTitleYourRaces","Ad","App","timer","fetchData","console","info","lastUpdatedFormat","RESULTS_IN_USE","startTimer","LENGTH_OF_CHECK_INTERVAL","clearTimer","clearTimeout","texasHouseGroups","usHouseGroups","texasHouse","usHouse","chunk","_yourPortal","NewContestShowcase","_usPortal","contestGroup","_supremePortal","_sboePortal","_crimPortal","_senatePortal","_housePortal","loadJsonScript","x1","y1","boundsStream","lineStart","lineEnd","polygonStart","polygonEnd","lowLeft","topLeft","topRight","lowRight","HOMEPAGE_URL","STORY_API_URL","acc","Intersection","other","entry","z","segments","compareIntersection","startInside","interpolate","stream","subject","clip","segment","p0","p1","link","start","isSubject","clipRectangle","visible","from","to","direction","a1","corner","comparePoint","ca","cb","x__","y__","v__","x_","y_","v_","clean","lines","activeStream","bufferStream","rejoin","concat","shift","clipStream","linePoint","NaN","winding","a0","b0","b1","polygonInside","cleanInside","merge","clipRejoin","r","ax","ay","t0","t1","clipLine","transformer","methods","s","TransformStream","prototype","sphere","fit","fitBounds","clipExtent","geoStream","fitExtent","extent","h","sa","cache","cacheStream","tx","ty","sx","sy","alpha","postclip","reset","reflectX","size","fitWidth","fitHeight","helpers","excludeWrapCoord","l","stopG","geometryMaybeCollection","isGeometryCollection","wrapShrink","coordIndex","isFeatureCollection","isFeature","stop","featureIndex","geomIndex","multiFeatureIndex","geometryIndex","geomType","propEach","featureEach","geomEach","g","featureProperties","featureBBox","featureId","flattenEach","segmentEach","segmentIndex","previousCoords","previousFeatureIndex","previousMultiIndex","prevGeomIndex","currentCoord","featureIndexCoord","multiPartIndexCoord","currentSegment","lineEach","coordReduce","initialValue","previousValue","propReduce","currentProperties","featureReduce","currentFeature","coordAll","geomReduce","currentGeometry","flattenReduce","segmentReduce","started","lineReduce","currentLine","findSegment","findPoint","selectAll","Node","Window","querySelectorAll","appNav","appNavHeight","appNavJumps","anchorJumps","scrollTo","pageYOffset","journalize","PARTY_SORT_ORDER","TT_directory_slugs","slug","ms","lastUpdated","apdate","formatted_time","aptime","replace","apmonth","getDate","countdown_div","innerHTML","determineDistrictTitle","division_type","capfirst","streamGeometry","streamGeometryType","hasOwnProperty","streamObjectType","Feature","FeatureCollection","Sphere","Point","MultiPoint","LineString","streamLine","MultiLineString","Polygon","streamPolygon","MultiPolygon","GeometryCollection","closed","coordinate","filterSelection","w3RemoveClass","getElementsByClassName","w3AddClass","arr1","arr2","className","splice","join","btnContainer","btns","path","composedPath","jsonResponse","res","ok","statusText","json","fetch","compare","f","ascending","lo","hi","mid","ascendingBisect","bisector","bisectRight","valueof","step","e10","e5","e2","ticks","tickIncrement","isFinite","power","LN10","tickStep","step0","step1","LN2","number","value0","arrays","merged","Adder","valueOf","adder","bv","av","x00","y00","areaSum","areaRingSum","areaStream","areaRingStart","areaRingEnd","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","lineTo","lengthRing","lengthSum","lengthStream","lengthPointFirst","lengthPoint","PathString","_string","circle","radius","_circle","projectionStream","contextStream","pathArea","measure","pathMeasure","pathBounds","pathCentroid","hOP","is","shallowEqual","objA","objB","keysA","keysB","_extends","assign","predicate","TypeError","PartyPill","excludeInitial","partyPrefix","partyIn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9B,EAAT,GAA4D,IAAzC,eAAEC,EAAF,MAAkBtmC,EAAlB,MAAyBnD,GAAgB,EACpD0pC,EAAcvmC,EAAMC,MAAM,EAAG,GAAGC,cAChCsmC,EAAexmC,EAAM,GAAGuP,cAExBwI,EAAUhY,IAAG,cAAD,gBAAyBwmC,IAE3C,OACE,oBAAM3mC,MAAOmY,EAASlb,MAAOA,EAAOwe,MAAO0iB,mBAAS/9B,KAChDsmC,GAAkBE,GAK1BH,EAAUjpC,aAAe,CACvBkpC,gBAAgB,GAGHG,QAAQJ,EAAY,IAAD,IAAC,MAAErmC,EAAF,MAASnD,GAAV,QAAuB,CACvDmD,MAAOA,EACPnD,MAAOA,O","file":"main.078abd6fb8.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  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","const DEMOCRAT = '#2569C4';\nconst DEMOCRAT_LEAN = '#6DACD3'\nconst REPUBLICAN = '#EF564A';\nconst REPUBLICAN_LEAN = '#F6A79D';\nconst LIBERTARIAN = '#1a2b4b';\nconst GREEN = '#3cc687';\nconst INDEPENDENT = '#8790A0';\n\n\nconst OTHER = '#888888';\n\nconst NEUTRAL = '#F2F2F2';\nconst TIE = '#999999';\n\nexport {\n  DEMOCRAT,\n  DEMOCRAT_LEAN,\n  REPUBLICAN_LEAN,\n  REPUBLICAN,\n  LIBERTARIAN,\n  GREEN,\n  INDEPENDENT,\n  NEUTRAL,\n  TIE,\n  OTHER,\n};\n","import cx from 'classnames';\nimport { h } from 'preact';\n\nimport { DEMOCRAT, LIBERTARIAN, NEUTRAL, REPUBLICAN, TIE } from '../colors';\n\nfunction MapLegend({ candidates, includesNoResult, includesTie }) {\n\n\n  return (\n    <div class=\"results-map__legend t-sans\">\n      <p class=\"results-map__legend-title\">Currently in the lead</p>\n      <div class=\"results-map__legend-items\">\n        {candidates.map(candidate => {\n          return (\n            <div class=\"results-map__legend-item\">\n              <span\n                class={cx(\n                  'circle-pill',\n                  `pill--${candidate.party.slice(0, 3).toLowerCase()}`\n                )}\n              />{' '}\n              <p class=\"results-map__legend-label\">\n                {candidate.name.split(' ')\n                .pop()\n                .trim()}\n              </p>\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            </div>\n          );\n        })}\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      </div>\n    </div>\n  );\n}\n\nexport default MapLegend;","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 {\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 } = 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>{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 { intcomma } from 'journalize';\nimport { h } from 'preact';\n\n// components\nimport CandidateRow from './CandidateRow';\nimport PureComponent from './PureComponent';\n\n// internal\nimport formatPercent from '../utils/format-percent';\nimport { sort_candidates_by_party } from '../election-utils';\nimport { source } from '../endpoints';\nimport sumValues from '../utils/sum-values';\n\nclass TooltipTable extends PureComponent<any> {\n  render() {\n    const { candidatesMap, county } = this.props;\n\n    const sortedResults = entries(county.results).sort(\n      (a, b) => b.value - a.value\n    );\n\n    const totalVotes = sumValues(sortedResults, 'value');\n\n\n\n    let sorted_by_party;\n\n    const firstFourResults = sortedResults.slice(0, 4);\n\n    const pct_votes = formatPercent(\n      county.total_votes,\n      county.estimated_votes_high\n    )\n\n    const pct_votes_turnout = pct_votes < 100 ? `An estimated ${pct_votes}% votes counted` : `An estimated >99% votes counted`\n\n\n    return (\n      <div class=\"contest\">\n        <table class=\"contest__candidates contest__candidates--tooltip\">\n          <caption>\n            <p class=\"contest__title\">{county.county} County</p>\n            <div class=\"contest__metrics\">\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            </div>\n          </caption>\n          {CandidateRow.countyHeader}\n          <tbody>\n            {firstFourResults.map(result => {\n              const candidate = candidatesMap.get(result.key);\n              // Just show last names to the county tooltip\n              const last_names = candidate.name\n\n                .split(' ')\n                .pop()\n                .trim();\n\n              return (\n                <CandidateRow\n                  key={candidate.id}\n                  ballotName={last_names}\n                  candidateId={candidate.id}\n                  contestIsCalled={false}\n                  isIncumbent={candidate.is_incumbent}\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;\n","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","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","// packages\nimport cx from 'classnames';\nimport { entries, map, Map, set, Set } from 'd3-collection';\nimport { GeoPath, GeoIdentityTransform, GeoProjection } from 'd3-geo';\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';\n\n// components\nimport CanvasLayer from './CanvasLayer';\nimport MapLegend from './MapLegend';\nimport Places from './Places';\nimport Portal from './Portal';\nimport SvgLayer from './SvgLayer';\nimport Tooltip from './Tooltip';\nimport TooltipTable from './TooltipTable';\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 { Topology } from 'topojson-specification';\nimport sumValuesNoKey from '../utils/sum-values-no-key';\n\ninterface LayeredMapProps {\n  projection: GeoProjection | GeoIdentityTransform;\n  topology: Topology;\n  precinctsReporting: number;\n  totalVotes: number;\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  includesNoResult: boolean;\n  includesTie: boolean;\n}\n\nconst tooltipPush = 20;\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      x: 0,\n      y: 0,\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  onMouseMove(event: MouseEvent) {\n    const { clientX: x, clientY: y, target } = event;\n    const point = getPoint(target as HTMLElement, x, y);\n\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  }\n\n  onMouseLeave() {\n    this.setState({ activeCounty: null, activeGeometry: null });\n  }\n\n  onDocumentTouch(e) {\n    if (!this.base.contains(e.target)) this.onMouseLeave();\n  }\n\n  canvasRenderer(ctx: CanvasRenderingContext2D, geoPath: GeoPath) {\n    const { geos, width, height } = this.state;\n\n    const { candidatesRender, embedType } = this.props;\n\n    ctx.clearRect(0, 0, width, height);\n\n    if (!geos.collection) return;\n\n    const candidatesOnMap = set();\n    let includesNoResult = false;\n    let includesTie = false;\n\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      const totalVotes = sumValuesNoKey(county.results);\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/totalVotes\n          const second_pct = second.value/totalVotes\n\n          const margin = (leader_pct-second_pct)\n\n          if (margin.toFixed(2) < 0.10) {\n            lean = '_LEAN'\n          } else {\n            lean = ''\n          }\n\n          const { party } = this.candidateMap.get(leadingId);\n          fillStyle = colors[party.toUpperCase() + lean];\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)';\n    ctx.lineWidth = 0.8;\n\n    ctx.stroke();\n    ctx.closePath();\n\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    let places_mappable = geos.places;\n\n    let embedTypeUsable = 'none';\n\n    if (typeof embedType !== 'undefined') {\n      embedTypeUsable = embedType;\n    }\n\n    if (embedTypeUsable.includes('tribcast')) {\n      places_mappable.features = geos.places.features.filter(\n        i =>\n          i['properties']['name'] == 'Fort Worth' ||\n          i['properties']['name'] == 'Dallas' ||\n          i['properties']['name'] == 'San Antonio' ||\n          i['properties']['name'] == 'Austin' ||\n          i['properties']['name'] == 'Houston'\n      );\n    }\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    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    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  componentWillUnmount() {\n    document.removeEventListener('touchstart', this.onDocumentTouch, false);\n  }\n\n  componentDidMount() {\n    const { candidates, counties } = 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    this.xScale.domain([bbox[0], bbox[2]]).range([0, width]);\n    this.yScale.domain([bbox[1], bbox[3]]).range([height, 0]);\n\n    this.props.projection.fitSize([width, height], bboxPolygon(bbox));\n\n    document.addEventListener('touchstart', this.onDocumentTouch, false);\n\n    this.setState({ geos, width, height });\n  }\n\n  render() {\n    const {\n      candidates,\n      projection,\n      precinctsReporting,\n      totalVotes,\n      candidatesRender,\n      embedType,\n    } = this.props;\n    const {\n      activeCounty,\n      activeGeometry,\n      candidatesOnMap,\n      geos,\n      includesNoResult,\n      includesTie,\n      width,\n      height,\n      x,\n      y,\n    } = this.state;\n    \n\n    return (\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        <SvgLayer\n          width={width}\n          height={height}\n          projection={projection}\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        <CanvasLayer\n          totalPrecincts={precinctsReporting}\n          totalVotes={totalVotes}\n          projection={projection}\n          width={width}\n          height={height}\n          render={this.canvasRenderer}\n        />\n        <MapLegend\n          candidates={candidates.filter(({ id }: { id: string }) =>\n            candidatesOnMap.has(id)\n          )}\n          includesNoResult={includesNoResult}\n          includesTie={includesTie}\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              county={activeCounty}\n            />\n          )}\n        </Tooltip>\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 sumValuesNoKey(arr) {\n  return Object.values(arr).reduce((a, b) => a + b);\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\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 */\nexports.earthRadius = 6371008.8;\n/**\n * Unit of measurement factors using a spherical (non-ellipsoid) earth radius.\n *\n * @memberof helpers\n * @type {Object}\n */\nexports.factors = {\n    centimeters: exports.earthRadius * 100,\n    centimetres: exports.earthRadius * 100,\n    degrees: exports.earthRadius / 111325,\n    feet: exports.earthRadius * 3.28084,\n    inches: exports.earthRadius * 39.370,\n    kilometers: exports.earthRadius / 1000,\n    kilometres: exports.earthRadius / 1000,\n    meters: exports.earthRadius,\n    metres: exports.earthRadius,\n    miles: exports.earthRadius / 1609.344,\n    millimeters: exports.earthRadius * 1000,\n    millimetres: exports.earthRadius * 1000,\n    nauticalmiles: exports.earthRadius / 1852,\n    radians: 1,\n    yards: exports.earthRadius / 1.0936,\n};\n/**\n * Units of measurement factors based on 1 meter.\n *\n * @memberof helpers\n * @type {Object}\n */\nexports.unitsFactors = {\n    centimeters: 100,\n    centimetres: 100,\n    degrees: 1 / 111325,\n    feet: 3.28084,\n    inches: 39.370,\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 / exports.earthRadius,\n    yards: 1 / 1.0936,\n};\n/**\n * Area of measurement factors based on 1 square meter.\n *\n * @memberof helpers\n * @type {Object}\n */\nexports.areaFactors = {\n    acres: 0.000247105,\n    centimeters: 10000,\n    centimetres: 10000,\n    feet: 10.763910417,\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 */\nfunction 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}\nexports.feature = feature;\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 */\nfunction geometry(type, coordinates, options) {\n    if (options === void 0) { options = {}; }\n    switch (type) {\n        case \"Point\": return point(coordinates).geometry;\n        case \"LineString\": return lineString(coordinates).geometry;\n        case \"Polygon\": return polygon(coordinates).geometry;\n        case \"MultiPoint\": return multiPoint(coordinates).geometry;\n        case \"MultiLineString\": return multiLineString(coordinates).geometry;\n        case \"MultiPolygon\": return multiPolygon(coordinates).geometry;\n        default: throw new Error(type + \" is invalid\");\n    }\n}\nexports.geometry = geometry;\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 */\nfunction point(coordinates, properties, options) {\n    if (options === void 0) { options = {}; }\n    var geom = {\n        type: \"Point\",\n        coordinates: coordinates,\n    };\n    return feature(geom, properties, options);\n}\nexports.point = point;\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 */\nfunction 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}\nexports.points = points;\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 */\nfunction 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}\nexports.polygon = polygon;\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 */\nfunction 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}\nexports.polygons = polygons;\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 */\nfunction 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}\nexports.lineString = lineString;\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 */\nfunction 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}\nexports.lineStrings = lineStrings;\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 */\nfunction 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}\nexports.featureCollection = featureCollection;\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 */\nfunction 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}\nexports.multiLineString = multiLineString;\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 */\nfunction 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}\nexports.multiPoint = multiPoint;\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 */\nfunction 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}\nexports.multiPolygon = multiPolygon;\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 */\nfunction 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}\nexports.geometryCollection = geometryCollection;\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 */\nfunction 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}\nexports.round = round;\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, or kilometers inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} distance\n */\nfunction radiansToLength(radians, units) {\n    if (units === void 0) { units = \"kilometers\"; }\n    var factor = exports.factors[units];\n    if (!factor) {\n        throw new Error(units + \" units is invalid\");\n    }\n    return radians * factor;\n}\nexports.radiansToLength = radiansToLength;\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, or kilometers inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} radians\n */\nfunction lengthToRadians(distance, units) {\n    if (units === void 0) { units = \"kilometers\"; }\n    var factor = exports.factors[units];\n    if (!factor) {\n        throw new Error(units + \" units is invalid\");\n    }\n    return distance / factor;\n}\nexports.lengthToRadians = lengthToRadians;\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, or kilometers inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} degrees\n */\nfunction lengthToDegrees(distance, units) {\n    return radiansToDegrees(lengthToRadians(distance, units));\n}\nexports.lengthToDegrees = lengthToDegrees;\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 */\nfunction bearingToAzimuth(bearing) {\n    var angle = bearing % 360;\n    if (angle < 0) {\n        angle += 360;\n    }\n    return angle;\n}\nexports.bearingToAzimuth = bearingToAzimuth;\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 */\nfunction radiansToDegrees(radians) {\n    var degrees = radians % (2 * Math.PI);\n    return degrees * 180 / Math.PI;\n}\nexports.radiansToDegrees = radiansToDegrees;\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 */\nfunction degreesToRadians(degrees) {\n    var radians = degrees % 360;\n    return radians * Math.PI / 180;\n}\nexports.degreesToRadians = degreesToRadians;\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 */\nfunction 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}\nexports.convertLength = convertLength;\n/**\n * Converts a area to the requested unit.\n * Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches\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 distance\n */\nfunction 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 = exports.areaFactors[originalUnit];\n    if (!startFactor) {\n        throw new Error(\"invalid original units\");\n    }\n    var finalFactor = exports.areaFactors[finalUnit];\n    if (!finalFactor) {\n        throw new Error(\"invalid final units\");\n    }\n    return (area / startFactor) * finalFactor;\n}\nexports.convertArea = convertArea;\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 */\nfunction isNumber(num) {\n    return !isNaN(num) && num !== null && !Array.isArray(num) && !/^\\s*$/.test(num);\n}\nexports.isNumber = isNumber;\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 */\nfunction isObject(input) {\n    return (!!input) && (input.constructor === Object);\n}\nexports.isObject = isObject;\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 */\nfunction 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}\nexports.validateBBox = validateBBox;\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 */\nfunction 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}\nexports.validateId = validateId;\n// Deprecated methods\nfunction radians2degrees() {\n    throw new Error(\"method has been renamed to `radiansToDegrees`\");\n}\nexports.radians2degrees = radians2degrees;\nfunction degrees2radians() {\n    throw new Error(\"method has been renamed to `degreesToRadians`\");\n}\nexports.degrees2radians = degrees2radians;\nfunction distanceToDegrees() {\n    throw new Error(\"method has been renamed to `lengthToDegrees`\");\n}\nexports.distanceToDegrees = distanceToDegrees;\nfunction distanceToRadians() {\n    throw new Error(\"method has been renamed to `lengthToRadians`\");\n}\nexports.distanceToRadians = distanceToRadians;\nfunction radiansToDistance() {\n    throw new Error(\"method has been renamed to `radiansToLength`\");\n}\nexports.radiansToDistance = radiansToDistance;\nfunction bearingToAngle() {\n    throw new Error(\"method has been renamed to `bearingToAzimuth`\");\n}\nexports.bearingToAngle = bearingToAngle;\nfunction convertDistance() {\n    throw new Error(\"method has been renamed to `convertLength`\");\n}\nexports.convertDistance = convertDistance;\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","import cx from 'classnames';\nimport { h } from 'preact';\nimport { apnumber } from 'journalize';\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 { capfirst, intcomma } from 'journalize';\nimport cx from 'classnames';\nimport { Component, h } from 'preact';\nimport { PreactHTMLConverter } from 'preact-html-converter';\nconst BROADCAST_HEADER_IMG = `${process.env.PUBLIC_PATH}assets/images/TT-2020Elections_logo-embed.png`;\nimport OtherCandidate from './OtherCandidate';\n\n// internal\nimport {\n  sort_candidates_by_party,\n  get_directory_slug,\n} from '../election-utils';\nimport { showCountdown, source } from '../endpoints';\nimport formatPercent from '../utils/format-percent';\nimport sumValues from '../utils/sum-values';\n\n// text\nimport text from '../../../data/text.json';\n\nconst converter = PreactHTMLConverter();\n\ntype Props = {\n  contest: { [key: string]: any },\n  flags: { [key: string]: any },\n  annotations: { [key: string]: any },\n  columnCount: number,\n  contestTitle: string,\n  asOf: string,\n  includeCountyRundown?: boolean,\n  isShowcaseRace?: boolean,\n  isHomepage?: boolean,\n  tableHeader: JSX.Element,\n  renderCandidate: any,\n  visibleCandidatesCount?: number,\n  embedType: string,\n  broadcastHeaderImage: string,\n  activeContestId: 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      flags,\n      annotations,\n      columnCount,\n      contestTitle,\n      isShowcaseRace,\n      asOf,\n      includeCountyRundown,\n      renderCandidate,\n      visibleCandidatesCount,\n      isHomepage,\n      tableHeader,\n      embedType,\n      broadcastHeaderImage,\n      activeContestId,\n    } = this.props;\n\n    const { viewAllCandidates } = this.state;\n\n    let totalVotes;\n    let candidates;\n    let winner_found;\n    let pct_votes;\n    let pct_votes_turnout;\n\n\n    const shouldDisplayResult = contest.contest_result !== 'not called';\n\n    const IsFlagged = flags && flags.length > 0 ? true : false;\n\n    const IsRepTarget = IsFlagged && flags[0].value.rep_target ? true : false;\n\n    const IsDemTarget = IsFlagged && flags[0].value.dem_target ? true : false;\n\n    const hasTurnoutmodel =\n      contest.office == 'U.S. House' ||\n      contest.office == 'President' ||\n      contest.office == 'U.S. Senate' ||\n      contest.office == 'Texas Railroad Commission' ||\n      contest.office == 'Texas Supreme Court' ||\n      contest.office == 'Texas Court of Criminal Appeals'\n        ? true\n        : false;\n\n    // const hasManualoverride =\n    // (contest.office == 'U.S. House' && contest.office_division == 4) || (contest.office == 'U.S. House' && contest.office_division == 23) ? true : false;\n    \n    const hasManualoverride = false;\n\n\n    const IsAnnotations =\n      annotations && annotations.length > 0 && annotations[0].value != ''\n        ? true\n        : false;\n\n    // The Republic API slugs don't match the directory url slugs so we need to get them\n\n    let directory_slug;\n\n    if (contest) {\n      directory_slug = get_directory_slug(contest.office);\n      totalVotes = sumValues(contest.candidacies, 'votes');\n      candidates =\n        totalVotes == 0\n          ? sort_candidates_by_party(contest.candidacies)\n          : contest.candidacies;\n      winner_found = candidates\n        .filter(item => item.is_winner === true)\n        .map(item => item.name);\n      pct_votes = formatPercent(\n        totalVotes,\n        contest.estimated_votes_high\n        )\n    \n      pct_votes_turnout = pct_votes < 100 ? `An estimated ${pct_votes}% of votes have already been counted, according to Decision Desk HQ turnout models.` : `An estimated >99% of votes have already been counted, according to Decision Desk HQ turnout models.`\n    }\n    // Uncomment this and put it back to line 334 to put back the polling locations numbers\n    \n\n    const checkmark = '\\u2713';\n\n    let embedTypeUsable = 'none';\n\n    if (typeof embedType !== 'undefined') {\n      embedTypeUsable = embedType;\n    }\n\n    // set the class on the disclaimer, changes between partner embed and the default index page\n    const isPartner =\n      embedTypeUsable && embedTypeUsable == 'partner' ? true : false;\n\n    const rowClass = cx({\n      seat__races: !isShowcaseRace,\n      seat__races__partner: isPartner,\n      seat__highlight_races: isShowcaseRace,\n    });\n\n    const disclaimerClass = cx(\n      'disclaimer-race',\n      {\n        'disclaimer-partner': isPartner,\n        'disclaimer-homepage': isHomepage,\n      } // disclaimer-partner needs to be after disclaimer-race\n    );\n\n    const contestMetricsClass = cx(\n      'contest__metrics',\n      {\n        homepage__metrics: isHomepage,\n        'non-homepage__metrics': !isHomepage,\n      } // disclaimer-partner needs to be after disclaimer-race\n    );\n\n    const precinctsClass = cx('contest__precincts', {\n      tribcast: embedType == 'tribcast',\n      turnout_model_district: hasTurnoutmodel,\n    });\n\n    const countdownClass = cx('countdown', {\n      tribcast: embedType == 'tribcast',\n    });\n\n    return (\n      <div class=\"seat t-sans\">\n        {embedTypeUsable.includes('broadcast') && (\n          <header class=\"embed-logo-container\">\n            <a\n              href=\"https://www.texastribune.org/\"\n              target=\"_blank\"\n              rel=\"noopener noreferrer\"\n            >\n              <img\n                class=\"embed-logo\"\n                src={broadcastHeaderImage}\n                alt=\"Texas 2020 November Election Results presented by The Texas Tribune\"\n              />\n            </a>\n          </header>\n        )}\n        {/* {IsFlagged == true && (\n          <div class=\"seat__flag\">\n            <p class=\"office__flag\">\n              <span class=\"gold-star\">★</span>Race to watch\n            </p>\n          </div>\n        )} */}\n\n        <div class={rowClass}>\n          <div class=\"seat__race\">\n            <div class=\"race\">\n              <h3 class=\"seat__title\">\n                {!isHomepage && <span>{contestTitle}</span>}\n\n                {directory_slug[0] != null && (\n                  <a\n                    href={`https://www.texastribune.org/directory/districts/${directory_slug[0]['directory-slug']}/${contest['office_division']}`}\n                  >\n                    <span\n                      class=\"icon-div\"\n                      title=\"Click to learn more about this district\"\n                    >\n                      <svg class=\"icon icon-info\">\n                        <use xlinkHref=\"#icon-info\"></use>\n                      </svg>\n                    </span>\n                  </a>\n                )}\n              </h3>\n\n              {(IsAnnotations == true ||\n                IsFlagged == true ||\n                (shouldDisplayResult && source == 'Decision Desk HQ')) && (\n                <div class={disclaimerClass}>\n                  {source == 'Decision Desk HQ' && shouldDisplayResult && (\n                    <div class=\"anno-text ddhq_winner\">\n                      <span class=\"dd_winner\">{checkmark}</span>\n                      <p class=\"annotations winner-call\">\n                        Decision Desk HQ has declared {winner_found} the winner{contest.office == 'President' && (<span> in Texas</span>)}.\n                      </p>\n                    </div>\n                  )}\n\n                  {IsAnnotations == true && (\n                    <div class=\"anno-text notes\">\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\">\n                        <span class=\"font-weight-bold\">Noteworthy: </span>\n                        {converter.convert(annotations[0].value)}\n                      </p>\n                    </div>\n                  )}\n\n                  {IsFlagged == true && flags[0].value.prose != '' && (\n                    <div class=\"anno-text race_to_watch_note get__flag\">\n                      <span class=\"gold-star\">★</span>\n                      <p class=\"annotations\">\n                        <span class=\"font-weight-bold\">Race to watch: </span>\n                        {converter.convert(flags[0].value.prose)}\n                      </p>\n                    </div>\n                  )}\n                </div>\n              )}\n              <table class=\"race__candidates\">\n                {tableHeader}\n                <tbody>\n                  {isShowcaseRace &&\n                    candidates.map((candidate: any, idx: any) =>\n                      renderCandidate(candidate, idx, 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\n                  {isHomepage && candidates.length > visibleCandidatesCount && (\n                    <OtherCandidate\n                      isViewable={!viewAllCandidates}\n                      candidateCount={candidates.length}\n                      embedType={embedType}\n                      onClick={() => {\n                        this.onViewableToggle();\n                      }}\n                    />\n                  )}\n                </tbody>\n\n                {isHomepage &&\n                  candidates.length > visibleCandidatesCount &&\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 ({visibleCandidatesCount})\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              <div>\n                <div class={contestMetricsClass}>\n                {hasManualoverride == false && (\n                  <p class={precinctsClass}>\n                    {hasTurnoutmodel == false || 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}\n\n                    <span class=\"source\">{` Source: ${source}`}</span>\n                  </p>)}\n                  {hasManualoverride == true && (\n                  <p class={precinctsClass}>\n                    <span class=\"source\">{` Source: Texas Secretary of State`}</span>\n                  </p>)}\n                </div>\n              </div>\n              {showCountdown == true && hasManualoverride == false && (\n                <div class={countdownClass}>\n                  <span class=\"counter\">Last updated {asOf}</span>\n                </div>\n              )}\n              {isHomepage && (\n                <div class=\"homepage-link__full_results\">\n                  <a href=\"https://apps.texastribune.org/features/2020/general-election-results/\">\n                    View Full Results\n                  </a>\n                </div>\n              )}\n            </div>\n          </div>\n        </div>\n      </div>\n    );\n  }\n}\n\nContest.defaultProps = {\n  isShowcaseRace: false,\n  includeCountyRundown: false,\n  visibleCandidatesCount: 2,\n};\n\nexport default Contest;\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar helpers_1 = require(\"@turf/helpers\");\r\n/**\r\n * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.\r\n *\r\n * @name getCoord\r\n * @param {Array<number>|Geometry<Point>|Feature<Point>} coord GeoJSON Point or an Array of numbers\r\n * @returns {Array<number>} coordinates\r\n * @example\r\n * var pt = turf.point([10, 10]);\r\n *\r\n * var coord = turf.getCoord(pt);\r\n * //= [10, 10]\r\n */\r\nfunction getCoord(coord) {\r\n    if (!coord) {\r\n        throw new Error(\"coord is required\");\r\n    }\r\n    if (!Array.isArray(coord)) {\r\n        if (coord.type === \"Feature\" && coord.geometry !== null && coord.geometry.type === \"Point\") {\r\n            return coord.geometry.coordinates;\r\n        }\r\n        if (coord.type === \"Point\") {\r\n            return coord.coordinates;\r\n        }\r\n    }\r\n    if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {\r\n        return coord;\r\n    }\r\n    throw new Error(\"coord must be GeoJSON Point or an Array of numbers\");\r\n}\r\nexports.getCoord = getCoord;\r\n/**\r\n * Unwrap coordinates from a Feature, Geometry Object or an Array\r\n *\r\n * @name getCoords\r\n * @param {Array<any>|Geometry|Feature} coords Feature, Geometry Object or an Array\r\n * @returns {Array<any>} coordinates\r\n * @example\r\n * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);\r\n *\r\n * var coords = turf.getCoords(poly);\r\n * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]\r\n */\r\nfunction getCoords(coords) {\r\n    if (Array.isArray(coords)) {\r\n        return coords;\r\n    }\r\n    // Feature\r\n    if (coords.type === \"Feature\") {\r\n        if (coords.geometry !== null) {\r\n            return coords.geometry.coordinates;\r\n        }\r\n    }\r\n    else {\r\n        // Geometry\r\n        if (coords.coordinates) {\r\n            return coords.coordinates;\r\n        }\r\n    }\r\n    throw new Error(\"coords must be GeoJSON Feature, Geometry Object or an Array\");\r\n}\r\nexports.getCoords = getCoords;\r\n/**\r\n * Checks if coordinates contains a number\r\n *\r\n * @name containsNumber\r\n * @param {Array<any>} coordinates GeoJSON Coordinates\r\n * @returns {boolean} true if Array contains a number\r\n */\r\nfunction containsNumber(coordinates) {\r\n    if (coordinates.length > 1 && helpers_1.isNumber(coordinates[0]) && helpers_1.isNumber(coordinates[1])) {\r\n        return true;\r\n    }\r\n    if (Array.isArray(coordinates[0]) && coordinates[0].length) {\r\n        return containsNumber(coordinates[0]);\r\n    }\r\n    throw new Error(\"coordinates must only contain numbers\");\r\n}\r\nexports.containsNumber = containsNumber;\r\n/**\r\n * Enforce expectations about types of GeoJSON objects for Turf.\r\n *\r\n * @name geojsonType\r\n * @param {GeoJSON} value any GeoJSON object\r\n * @param {string} type expected GeoJSON type\r\n * @param {string} name name of calling function\r\n * @throws {Error} if value is not the expected type.\r\n */\r\nfunction geojsonType(value, type, name) {\r\n    if (!type || !name) {\r\n        throw new Error(\"type and name required\");\r\n    }\r\n    if (!value || value.type !== type) {\r\n        throw new Error(\"Invalid input to \" + name + \": must be a \" + type + \", given \" + value.type);\r\n    }\r\n}\r\nexports.geojsonType = geojsonType;\r\n/**\r\n * Enforce expectations about types of {@link Feature} inputs for Turf.\r\n * Internally this uses {@link geojsonType} to judge geometry types.\r\n *\r\n * @name featureOf\r\n * @param {Feature} feature a feature with an expected geometry type\r\n * @param {string} type expected GeoJSON type\r\n * @param {string} name name of calling function\r\n * @throws {Error} error if value is not the expected type.\r\n */\r\nfunction featureOf(feature, type, name) {\r\n    if (!feature) {\r\n        throw new Error(\"No feature passed\");\r\n    }\r\n    if (!name) {\r\n        throw new Error(\".featureOf() requires a name\");\r\n    }\r\n    if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\r\n        throw new Error(\"Invalid input to \" + name + \", Feature with geometry required\");\r\n    }\r\n    if (!feature.geometry || feature.geometry.type !== type) {\r\n        throw new Error(\"Invalid input to \" + name + \": must be a \" + type + \", given \" + feature.geometry.type);\r\n    }\r\n}\r\nexports.featureOf = featureOf;\r\n/**\r\n * Enforce expectations about types of {@link FeatureCollection} inputs for Turf.\r\n * Internally this uses {@link geojsonType} to judge geometry types.\r\n *\r\n * @name collectionOf\r\n * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged\r\n * @param {string} type expected GeoJSON type\r\n * @param {string} name name of calling function\r\n * @throws {Error} if value is not the expected type.\r\n */\r\nfunction collectionOf(featureCollection, type, name) {\r\n    if (!featureCollection) {\r\n        throw new Error(\"No featureCollection passed\");\r\n    }\r\n    if (!name) {\r\n        throw new Error(\".collectionOf() requires a name\");\r\n    }\r\n    if (!featureCollection || featureCollection.type !== \"FeatureCollection\") {\r\n        throw new Error(\"Invalid input to \" + name + \", FeatureCollection required\");\r\n    }\r\n    for (var _i = 0, _a = featureCollection.features; _i < _a.length; _i++) {\r\n        var feature = _a[_i];\r\n        if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\r\n            throw new Error(\"Invalid input to \" + name + \", Feature with geometry required\");\r\n        }\r\n        if (!feature.geometry || feature.geometry.type !== type) {\r\n            throw new Error(\"Invalid input to \" + name + \": must be a \" + type + \", given \" + feature.geometry.type);\r\n        }\r\n    }\r\n}\r\nexports.collectionOf = collectionOf;\r\n/**\r\n * Get Geometry from Feature or Geometry Object\r\n *\r\n * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object\r\n * @returns {Geometry|null} GeoJSON Geometry Object\r\n * @throws {Error} if geojson is not a Feature or Geometry Object\r\n * @example\r\n * var point = {\r\n *   \"type\": \"Feature\",\r\n *   \"properties\": {},\r\n *   \"geometry\": {\r\n *     \"type\": \"Point\",\r\n *     \"coordinates\": [110, 40]\r\n *   }\r\n * }\r\n * var geom = turf.getGeom(point)\r\n * //={\"type\": \"Point\", \"coordinates\": [110, 40]}\r\n */\r\nfunction getGeom(geojson) {\r\n    if (geojson.type === \"Feature\") {\r\n        return geojson.geometry;\r\n    }\r\n    return geojson;\r\n}\r\nexports.getGeom = getGeom;\r\n/**\r\n * Get GeoJSON object's type, Geometry type is prioritize.\r\n *\r\n * @param {GeoJSON} geojson GeoJSON object\r\n * @param {string} [name=\"geojson\"] name of the variable to display in error message\r\n * @returns {string} GeoJSON type\r\n * @example\r\n * var point = {\r\n *   \"type\": \"Feature\",\r\n *   \"properties\": {},\r\n *   \"geometry\": {\r\n *     \"type\": \"Point\",\r\n *     \"coordinates\": [110, 40]\r\n *   }\r\n * }\r\n * var geom = turf.getType(point)\r\n * //=\"Point\"\r\n */\r\nfunction getType(geojson, name) {\r\n    if (geojson.type === \"FeatureCollection\") {\r\n        return \"FeatureCollection\";\r\n    }\r\n    if (geojson.type === \"GeometryCollection\") {\r\n        return \"GeometryCollection\";\r\n    }\r\n    if (geojson.type === \"Feature\" && geojson.geometry !== null) {\r\n        return geojson.geometry.type;\r\n    }\r\n    return geojson.type;\r\n}\r\nexports.getType = getType;\r\n","import cx from 'classnames';\nimport { capfirst, intcomma } from 'journalize';\nimport { Component, h, VNode } from 'preact';\n\nimport PureComponent from './PureComponent';\n\nimport formatPercent from '../utils/format-percent';\nimport { isCanvass } from '../endpoints';\nimport PartyPill from './PartyPill';\nimport { lookup } from '../photoMap';\n\ninterface Props {\n  ballotName: string;\n  candidateId: string;\n  contestIsCalled: boolean;\n  isIncumbent: boolean;\n  isWinner: boolean;\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  static HomepageHeader: VNode;\n\n  render() {\n    const {\n      ballotName,\n      candidateId,\n      contestIsCalled,\n      isIncumbent,\n      isWinner,\n      party,\n      isViewable,\n      totalVotesInContest,\n      votes,\n    } = this.props;\n\n    const IsDroppedOut =\n      ballotName == 'Julián Castro' ||\n      ballotName == 'Cory Booker' ||\n      ballotName == 'Marianne Williamson' ||\n      ballotName == 'John K. Delaney' ||\n      ballotName == 'Deval Patrick' ||\n      ballotName == 'Andrew Yang' ||\n      ballotName == 'Michael Bennet' ||\n      ballotName == 'Pete Buttigieg' ||\n      ballotName == 'Tom Steyer' ||\n      ballotName == 'Amy Klobuchar'\n        ? true\n        : 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      'lib-winner': party == 'Libertarian',\n      'ind-winner': party == 'Independent',\n      'gre-winner': party == 'Green',\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} />\n        </td>\n        <th class=\"candidate__cell candidate__name\">\n          {isCanvass == true && contestIsCalled && isWinner && (\n            <span class={checkClass}>{checkmark}</span>\n          )}\n          {isCanvass == true && contestIsCalled && isWinner ? (\n            <span class={checkClass}>{ballotName}</span>\n          ) : (\n            ballotName\n          )}\n          {IsDroppedOut && <span class=\"dropped_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\">{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.HomepageHeader = (\n  <thead>\n    <tr>\n      <th class=\"contest__candidate-header\" colSpan={2}>\n        President\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 function(x) {\n  return x;\n}\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","import { Component, 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","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar meta_1 = require(\"@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    meta_1.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}\nexports.default = bbox;\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 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","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar invariant_1 = require(\"@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 */\nfunction 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 = invariant_1.getCoord(point);\n    var geom = invariant_1.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}\nexports.default = booleanPointInPolygon;\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] && 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) && ((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] &&\n        bbox[1] <= pt[1] &&\n        bbox[2] >= pt[0] &&\n        bbox[3] >= pt[1];\n}\n","import { h, render } from 'preact';\n\nimport { delay } from './election-utils';\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.gutenTag) {\n  import(\n    /* webpackChunkName: \"RelatedContent\" */ './components/RelatedContent'\n  ).then(({ default: RelatedContent }) =>\n    render(\n      <RelatedContent title={'Read more'} gutenTag={window.ttData.gutenTag} />,\n      relatedContentContainer\n    )\n  );\n}\n\n// trending ribbon\nconst ribbonContainer = document.getElementById('ribbon-container');\n\nif (ribbonContainer) {\n  import(\n    /* webpackChunkName: \"Ribbon\" */ './components/Ribbon'\n  ).then(({ default: Ribbon }) => render(<Ribbon />, ribbonContainer));\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    }, 600); // end delay\n  }\n);\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';\nimport CountyTable from './CountyTable';\nimport HeadshotCandidateRow from './HeadshotCandidateRow';\nimport LayeredMap from './LayeredMap';\nimport Portal from './Portal';\nimport { PreactHTMLConverter } from 'preact-html-converter';\n\n// utils\nimport { isThisIE } from '../utils/platform';\nimport { determineContestTitle } from '../election-utils';\nimport { visibleCandidatesCount } from '../endpoints';\n\nimport topology from 'Assets/geography/texas_urban.json';\n\nconst converter = PreactHTMLConverter();\n\nconst isIE = isThisIE();\n\ninterface ContestShowcaseProps {\n  container: Element;\n  contest: any | null;\n  asOf: string;\n  visibleCandidatesCount?: number;\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\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, annotations, asOf } = this.props;\n    const { contestContainer, mapContainer, countiesContainer } = this.state;\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              contestTitle={determineContestTitle(contest)}\n              isShowcaseRace\n              annotations={annotations}\n              tableHeader={HeadshotCandidateRow.Header}\n              columnCount={HeadshotCandidateRow.columnCount}\n              visibleCandidateCount={visibleCandidatesCount}\n              asOf={asOf}\n              renderCandidate={(\n                candidate: any,\n                idx: number,\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                  isIncumbent={candidate.is_incumbent}\n                  isWinner={candidate.is_winner}\n                  isViewable={viewAllCandidates || idx < visibleCandidatesCount}\n                  party={candidate.party}\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              counties={contest.counties}\n              precinctsReporting={contest.precincts_reporting}\n              totalVotes={contest.total_votes}\n            />\n          </Portal>\n        )}\n        {/* {!isIE &&\n          countiesContainer && (\n            <Portal\n              node={countiesContainer}\n              ref={ref => (this._countiesPortal = ref)}\n            >\n              <CountyTable\n                candidates={contest.candidates}\n                counties={contest.counties}\n              />\n            </Portal>\n          )} */}\n      </span>\n    );\n  }\n}\n\nexport default ContestShowcase;\n","class Store {\n  constructor(dbName = 'keyval-store', storeName = 'keyval') {\n    this.storeName = storeName;\n    this._dbp = new Promise((resolve, reject) => {\n      const openreq = indexedDB.open(dbName, 1);\n      openreq.onerror = () => reject(openreq.error);\n      openreq.onsuccess = () => resolve(openreq.result);\n      // First time setup: create an empty object store\n      openreq.onupgradeneeded = () => {\n        openreq.result.createObjectStore(storeName);\n      };\n    });\n  }\n  _withIDBStore(type, callback) {\n    return this._dbp.then(\n      db =>\n        new Promise((resolve, reject) => {\n          const transaction = db.transaction(this.storeName, type);\n          transaction.oncomplete = () => resolve();\n          transaction.onabort = transaction.onerror = () =>\n            reject(transaction.error);\n          callback(transaction.objectStore(this.storeName));\n        })\n    );\n  }\n}\nlet store;\nfunction getDefaultStore() {\n  if (!store) store = new Store();\n  return store;\n}\nfunction get(key, store = getDefaultStore()) {\n  let req;\n  return store\n    ._withIDBStore('readonly', store => {\n      req = store.get(key);\n    })\n    .then(() => req.result);\n}\nfunction set(key, value, store = getDefaultStore()) {\n  return store._withIDBStore('readwrite', store => {\n    store.put(value, key);\n  });\n}\nfunction del(key, store = getDefaultStore()) {\n  return store._withIDBStore('readwrite', store => {\n    store.delete(key);\n  });\n}\nfunction clear(store = getDefaultStore()) {\n  return store._withIDBStore('readwrite', store => {\n    store.clear();\n  });\n}\nfunction keys(store = getDefaultStore()) {\n  const keys = [];\n  return store\n    ._withIDBStore('readonly', store => {\n      // This would be store.getAllKeys(), but it isn't supported by Edge or Safari.\n      // And openKeyCursor isn't supported by Safari.\n      (store.openKeyCursor || store.openCursor).call(\n        store\n      ).onsuccess = function() {\n        if (!this.result) return;\n        keys.push(this.result.key);\n        this.result.continue();\n      };\n    })\n    .then(() => keys);\n}\n\nexport { Store, get, set, del, clear, keys };\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 { 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(value) {\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 {\n          lat: latitude,\n          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, flags, 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    const matches = {\n      'us-house': null,\n      sboe: null,\n      'tx-senate': null,\n      'tx-house': null,\n    };\n\n    const flagMatches = {\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    if (data) {\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      flagMatches['us-house'] = flags.filter(\n        contest =>\n          contest.type === 'us-house-district-' + data.us_house.district\n      );\n\n      flagMatches['sboe'] = flags.filter(\n        contest =>\n          contest.type ===\n          'state-board-of-education-district-' + data.sboe.district\n      );\n\n      flagMatches['tx-senate'] = flags.filter(\n        contest =>\n          contest.type === 'texas-senate-district-' + data.tx_senate.district\n      );\n\n      flagMatches['tx-house'] = flags.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\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    }\n\n    const inputProps = {\n      id: 'address-input',\n      class: 'address-input__input',\n      placeholder: '1010 Colorado St, Austin, TX, 78701',\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        <Portal node={document.getElementById('your-address-feedback')}>\n          {addressFeedback}\n        </Portal>\n        {data && contests.length > 0 && (\n          <Portal\n            node={document.getElementById('your-races-results')}\n            ref={ref => (this._resultsPortal = ref)}\n          >\n            <div class=\"representative-districts contest-list seat__contests-double\">\n              <Contest\n                key={matches['us-house'][0].office_slug}\n                contest={matches['us-house'][0]}\n                flags={flagMatches['us-house']}\n                annotations={annoMatches['us-house']}\n                contestTitle={determineContestTitleYourRaces(\n                  matches['us-house'][0]\n                )}\n                asOf={asOf}\n                tableHeader={CandidateRow.Header}\n                columnCount={CandidateRow.columnCount}\n                renderCandidate={(\n                  candidate,\n                  idx,\n                  viewAllCandidates,\n                  { totalVotes }\n                ) => (\n                  <CandidateRow\n                    key={candidate.id}\n                    ballotName={candidate.name}\n                    candidateId={candidate.id}\n                    contestIsCalled={matches['us-house'].is_called}\n                    isIncumbent={candidate.is_incumbent}\n                    isWinner={candidate.is_winner}\n                    isViewable={viewAllCandidates || idx < 3}\n                    party={candidate.party}\n                    totalVotesInContest={totalVotes}\n                    votes={candidate.votes}\n                  />\n                )}\n              />\n              {matches['sboe'].length > 0 && (\n                <Contest\n                  key={matches['sboe'][0].office_slug}\n                  contest={matches['sboe'][0]}\n                  flags={flagMatches['sboe']}\n                  annotations={annoMatches['sboe']}\n                  contestTitle={determineContestTitleYourRaces(\n                    matches['sboe'][0]\n                  )}\n                  asOf={asOf}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(\n                    candidate,\n                    idx,\n                    viewAllCandidates,\n                    { totalVotes }\n                  ) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={matches['sboe'].is_called}\n                      isIncumbent={candidate.is_incumbent}\n                      isWinner={candidate.is_winner}\n                      isViewable={viewAllCandidates || idx < 3}\n                      party={candidate.party}\n                      totalVotesInContest={totalVotes}\n                      votes={candidate.votes}\n                    />\n                  )}\n                />\n              )}\n              {matches['tx-senate'].length > 0 && (\n                <Contest\n                  key={matches['tx-senate'][0].office_slug}\n                  contest={matches['tx-senate'][0]}\n                  flags={flagMatches['tx-senate']}\n                  annotations={annoMatches['tx-senate']}\n                  columnCount={CandidateRow.columnCount}\n                  contestTitle={determineContestTitleYourRaces(\n                    matches['tx-senate'][0]\n                  )}\n                  asOf={asOf}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(candidate, { totalVotes }) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={matches['tx-senate'].is_called}\n                      isIncumbent={candidate.is_incumbent}\n                      isWinner={candidate.is_winner}\n                      party={candidate.party}\n                      totalVotesInContest={totalVotes}\n                      votes={candidate.votes}\n                    />\n                  )}\n                />\n              )}\n              <Contest\n                key={matches['tx-house'][0].office_slug}\n                contest={matches['tx-house'][0]}\n                flags={flagMatches['tx-house']}\n                annotations={annoMatches['tx-house']}\n                columnCount={CandidateRow.columnCount}\n                contestTitle={determineContestTitleYourRaces(\n                  matches['tx-house'][0]\n                )}\n                asOf={asOf}\n                tableHeader={CandidateRow.Header}\n                columnCount={CandidateRow.columnCount}\n                renderCandidate={(\n                  candidate,\n                  idx,\n                  viewAllCandidates,\n                  { totalVotes }\n                ) => (\n                  <CandidateRow\n                    key={candidate.id}\n                    ballotName={candidate.name}\n                    candidateId={candidate.id}\n                    contestIsCalled={matches['tx-house'].is_called}\n                    isIncumbent={candidate.is_incumbent}\n                    isViewable={viewAllCandidates || idx < 3}\n                    isWinner={candidate.is_winner}\n                    party={candidate.party}\n                    totalVotesInContest={totalVotes}\n                    votes={candidate.votes}\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 = false }) =>\n  `https://dv-dev.texastribune.org/legislative-lookup/?latitude=${latitude}&longitude=${longitude}`;\n\nexport function lookup({ latitude, longitude }) {\n  return getJSON(LOOKUP_URL({ latitude, longitude }));\n}\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","// packages\nimport cx from 'classnames';\nimport { Component, h } from 'preact';\n\n// components\nimport CandidateRow from './components/CandidateRow';\nimport Contest from './components/Contest';\nimport NewContestShowcase from './components/NewContestShowcase';\nimport YourRaces from './components/YourRaces';\nimport Portal from './components/Portal';\nimport Ad from './components/Ad';\n\nimport find from './utils/find';\nimport {\n  determineContestTitle,\n  chunk,\n  lastUpdatedFormat,\n} from './election-utils';\nimport { RESULTS_IN_USE, visibleCandidatesCount } from './endpoints';\nimport getJSON from './utils/get-json';\nimport { LENGTH_OF_CHECK_INTERVAL } from './constants';\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  }\n\n  fetchData() {\n    const now = new Date();\n    console.info('Requesting:', now);\n\n    const asOf = lastUpdatedFormat(now)\n\n    getJSON(RESULTS_IN_USE).then(data =>\n      this.setState({ data, asOf }, this.startTimer)\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                         // This is for countdown timer, can put back if need be\n                         // const length = Math.ceil(LENGTH_OF_CHECK_INTERVAL / 60000);\n                         // countdown(length); //where n is the number of minutes required.\n                       }\n\n  render() {\n    const { flags, annotations } = this.props;\n    const { data, asOf } = this.state;\n\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\n    .filter(contest => contest.office === 'Texas House')\n\n    const usHouse = data\n    .filter(contest => contest.office === 'U.S. House')\n\n    let texasHouseGroups, usHouseGroups;\n\n    if (texasHouse.length) {\n      texasHouseGroups = chunk(texasHouse, 26)\n      usHouseGroups = chunk(usHouse, 24)\n    }\n\n    return (\n      <div class=\"results\">\n        <Portal\n          node={document.getElementById('your-races')}\n          ref={ref => (this._yourPortal = ref)}\n        >\n          <YourRaces annotations={annotations} asOf={asOf} contests={data} flags={flags} />\n        </Portal>\n\n        <NewContestShowcase\n          contest={find(data, contest => contest.office === 'President')}\n          container={document.querySelector('#president .president')}\n          annotations={annotations.filter(\n            item => item.type === 'president'\n          )}\n          asOf={asOf}\n        />\n        <NewContestShowcase\n          contest={find(data, contest => contest.office === 'U.S. Senate')}\n          container={document.querySelector('#us-senate .senate')}\n          annotations={annotations.filter(\n            item => item.type === 'us-senate-class-2'\n          )}\n          asOf={asOf}\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 && (usHouseGroups.map(contestGroup => (\n            <div class=\"contest-group\">\n            <div class=\"seat__contests-double\">\n            {contestGroup.map(contest => (<Contest\n                  key={contest.id}\n                  contest={contest}\n                  flags={flags.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  annotations={annotations.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  visibleCandidateCount={visibleCandidatesCount}\n                  columnCount={CandidateRow.columnCount}\n                  contestTitle={determineContestTitle(\n                    data.filter(\n                      item => item.office_slug === contest.office_slug\n                    )[0]\n                  )}\n                  asOf={asOf}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(\n                    candidate,\n                    idx,\n                    viewAllCandidates,\n                    { totalVotes }\n                  ) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={candidate.is_called}\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                \n          </div>\n          <Ad />\n        </div>\n        )))}\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 seat__contests-double\">\n            {data\n              .filter(contest => contest.office === 'Texas Railroad Commission')\n              .map(contest => (\n                <Contest\n                  key={contest.id}\n                  contest={contest}\n                  flags={flags.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  annotations={annotations.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  asOf={asOf}\n                  visibleCandidateCount={visibleCandidatesCount}\n                  columnCount={CandidateRow.columnCount}\n                  contestTitle={determineContestTitle(\n                    data.filter(\n                      item => item.office_slug === contest.office_slug\n                    )[0]\n                  )}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(\n                    candidate,\n                    idx,\n                    viewAllCandidates,\n                    { totalVotes }\n                  ) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={candidate.is_called}\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        <Portal\n          node={document.querySelector('#state-board-of-education .contests')}\n          ref={ref => (this._sboePortal = ref)}\n        >\n          <div class=\"office__contests seat__contests-double\">\n            {data\n              .filter(contest => contest.office === 'State Board of Education')\n              .map(contest => (\n                <Contest\n                  key={contest.id}\n                  contest={contest}\n                  flags={flags.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  annotations={annotations.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  visibleCandidateCount={visibleCandidatesCount}\n                  columnCount={CandidateRow.columnCount}\n                  contestTitle={determineContestTitle(\n                    data.filter(\n                      item => item.office_slug === contest.office_slug\n                    )[0]\n                  )}\n                  asOf={asOf}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(\n                    candidate,\n                    idx,\n                    viewAllCandidates,\n                    { totalVotes }\n                  ) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={candidate.is_called}\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        <Portal\n          node={document.querySelector('#texas-supreme-court .contests')}\n          ref={ref => (this._supremePortal = ref)}\n        >\n          <div class=\"office__contests 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                  flags={flags.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  annotations={annotations.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  asOf={asOf}\n                  visibleCandidateCount={visibleCandidatesCount}\n                  columnCount={CandidateRow.columnCount}\n                  contestTitle={determineContestTitle(\n                    data.filter(\n                      item => item.office_slug === contest.office_slug\n                    )[0]\n                  )}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(\n                    candidate,\n                    idx,\n                    viewAllCandidates,\n                    { totalVotes }\n                  ) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={candidate.is_called}\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        <Portal\n          node={document.querySelector(\n            '#texas-court-of-criminal-appeals .contests'\n          )}\n          ref={ref => (this._crimPortal = ref)}\n        >\n          <div class=\"office__contests seat__contests-double\">\n            {data\n              .filter(\n                contest => contest.office === 'Texas Court of Criminal Appeals'\n              )\n              .map(contest => (\n                <Contest\n                  key={contest.id}\n                  contest={contest}\n                  flags={flags.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  annotations={annotations.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  visibleCandidateCount={visibleCandidatesCount}\n                  asOf={asOf}\n                  columnCount={CandidateRow.columnCount}\n                  contestTitle={determineContestTitle(\n                    data.filter(\n                      item => item.office_slug === contest.office_slug\n                    )[0]\n                  )}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(\n                    candidate,\n                    idx,\n                    viewAllCandidates,\n                    { totalVotes }\n                  ) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={candidate.is_called}\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        <Portal\n          node={document.querySelector('#texas-senate .contests')}\n          ref={ref => (this._senatePortal = ref)}\n        >\n          <div class=\"office__contests 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                  flags={flags.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  annotations={annotations.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  asOf={asOf}\n                  visibleCandidateCount={visibleCandidatesCount}\n                  columnCount={CandidateRow.columnCount}\n                  contestTitle={determineContestTitle(\n                    data.filter(\n                      item => item.office_slug === contest.office_slug\n                    )[0]\n                  )}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(\n                    candidate,\n                    idx,\n                    viewAllCandidates,\n                    { totalVotes }\n                  ) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={candidate.is_called}\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        <Portal\n          node={document.querySelector('#texas-house .contests')}\n          ref={ref => (this._housePortal = ref)}\n        >\n          <div class=\"office__contests\">\n          {texasHouse.length > 0 && (texasHouseGroups.map(contestGroup => (\n            <div class=\"contest-group\">\n            <div class=\"seat__contests-double\">\n            {contestGroup.map(contest => (<Contest\n                  key={contest.id}\n                  contest={contest}\n                  flags={flags.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  annotations={annotations.filter(\n                    item => item.type === contest.office_slug\n                  )}\n                  asOf={asOf}\n                  visibleCandidateCount={visibleCandidatesCount}\n                  columnCount={CandidateRow.columnCount}\n                  contestTitle={determineContestTitle(\n                    data.filter(\n                      item => item.office_slug === contest.office_slug\n                    )[0]\n                  )}\n                  tableHeader={CandidateRow.Header}\n                  columnCount={CandidateRow.columnCount}\n                  renderCandidate={(\n                    candidate,\n                    idx,\n                    viewAllCandidates,\n                    { totalVotes }\n                  ) => (\n                    <CandidateRow\n                      key={candidate.id}\n                      ballotName={candidate.name}\n                      candidateId={candidate.id}\n                      contestIsCalled={candidate.is_called}\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                \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';\nimport './races-to-watch';\nimport { h, render } from 'preact';\n\n// Components\nimport App from '../ResultsApp';\nimport loadJsonScript from '../utils/load-json-script';\n\nconst flags = loadJsonScript('flag_data');\n\nconst annotations = loadJsonScript('annotations_data');\n\nrender(\n  <App annotations={annotations} flags={flags} />,\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","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar helpers_1 = require(\"@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 */\nfunction 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 helpers_1.polygon([[\n            lowLeft,\n            lowRight,\n            topRight,\n            topLeft,\n            lowLeft,\n        ]], options.properties, { bbox: bbox, id: options.id });\n}\nexports.default = bboxPolygon;\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/2020_general/republic_json/results_FLAT_static.json';\n\n// Results from either Decision Desk or Secretary of State (depending on what the cron job is collecting)\nconst FLAT_RESULTS_URL =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2020_general/republic_json/results_FLAT.json';\n\n// Includes fake results data for testing\nconst FAKE_RESULTS_URL =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2020_general/republic_json/results_FLAT_dummy_data.json';\nconst FAKE_RESULTS_URL_TWO =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2020_general/republic_json/results_FLAT_TEST_OCT_8.json';\n\n// fake results based on 2018 returns for Senate and Governor\nconst FAKE_RESULTS_2018 =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2020_general/republic_json/results_FLAT_dummy_data_2018.json';\n\n// Used for homepage takeover\nconst HOMEPAGE_URL =\n  'https://s3.amazonaws.com/sos-test-2.texastribune.org/2020_general/homepage_takeover/2020-general.json';\n\n// This is for the other candidates for the hide/show toggle. I turned it off by making it a really high number, you can turn it back on by making it 3\nconst visibleCandidatesCount = 53;\n\n// Show countdown counter, set to true to last updated text\nconst showCountdown = true;\n\n// Switches front-end to show either 'Decision Desk HQ' as source or 'Texas Secretary of State'\nconst source = 'Decision Desk HQ';\n\n// Adds the checkmark if this is the final official results from local canvass\nconst isCanvass = false;\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// 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 = FLAT_RESULTS_URL;\n\nexport {\n  RESULTS_IN_USE,\n  HOMEPAGE_URL,\n  STORY_API_URL,\n  visibleCandidatesCount,\n  showCountdown,\n  isCanvass,\n  source,\n};\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","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","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar helpers = require('@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, k, l, geometry, stopG, 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 ? geojson.features[featureIndex].geometry :\n            (isFeature ? geojson.geometry : geojson));\n        isGeometryCollection = (geometryMaybeCollection) ? geometryMaybeCollection.type === 'GeometryCollection' : false;\n        stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 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] : 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 = (excludeWrapCoord && (geomType === 'Polygon' || geomType === 'MultiPolygon')) ? 1 : 0;\n\n            switch (geomType) {\n            case null:\n                break;\n            case 'Point':\n                if (callback(coords, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) === false) return false;\n                coordIndex++;\n                multiFeatureIndex++;\n                break;\n            case 'LineString':\n            case 'MultiPoint':\n                for (j = 0; j < coords.length; j++) {\n                    if (callback(coords[j], coordIndex, featureIndex, multiFeatureIndex, geometryIndex) === false) 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 (callback(coords[j][k], coordIndex, featureIndex, multiFeatureIndex, geometryIndex) === false) 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 (callback(coords[j][k][l], coordIndex, featureIndex, multiFeatureIndex, geometryIndex) === false) 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 (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false) 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(geojson, function (currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n        if (coordIndex === 0 && initialValue === undefined) previousValue = currentCoord;\n        else previousValue = callback(previousValue, currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex);\n    }, excludeWrapCoord);\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/**\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) previousValue = currentProperties;\n        else 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) 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, j, g, geometry, 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\n        geometryMaybeCollection = (isFeatureCollection ? geojson.features[i].geometry :\n            (isFeature ? geojson.geometry : geojson));\n        featureProperties = (isFeatureCollection ? geojson.features[i].properties :\n            (isFeature ? geojson.properties : {}));\n        featureBBox = (isFeatureCollection ? geojson.features[i].bbox :\n            (isFeature ? geojson.bbox : undefined));\n        featureId = (isFeatureCollection ? geojson.features[i].id :\n            (isFeature ? geojson.id : undefined));\n        isGeometryCollection = (geometryMaybeCollection) ? geometryMaybeCollection.type === 'GeometryCollection' : false;\n        stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;\n\n        for (g = 0; g < stopG; g++) {\n            geometry = isGeometryCollection ?\n                geometryMaybeCollection.geometries[g] : geometryMaybeCollection;\n\n            // Handle null Geometry\n            if (geometry === null) {\n                if (callback(null, featureIndex, featureProperties, featureBBox, featureId) === false) 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 (callback(geometry, featureIndex, featureProperties, featureBBox, featureId) === false) return false;\n                break;\n            }\n            case 'GeometryCollection': {\n                for (j = 0; j < geometry.geometries.length; j++) {\n                    if (callback(geometry.geometries[j], featureIndex, featureProperties, featureBBox, featureId) === false) 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(geojson, function (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n        if (featureIndex === 0 && initialValue === undefined) previousValue = currentGeometry;\n        else previousValue = callback(previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId);\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 (callback(helpers.feature(geometry, properties, {bbox: bbox, id: id}), featureIndex, 0) === false) 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 (var multiFeatureIndex = 0; multiFeatureIndex < geometry.coordinates.length; multiFeatureIndex++) {\n            var coordinate = geometry.coordinates[multiFeatureIndex];\n            var geom = {\n                type: geomType,\n                coordinates: coordinate\n            };\n            if (callback(helpers.feature(geom, properties), featureIndex, multiFeatureIndex) === false) 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(geojson, function (currentFeature, featureIndex, multiFeatureIndex) {\n        if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === undefined) previousValue = currentFeature;\n        else previousValue = callback(previousValue, currentFeature, featureIndex, multiFeatureIndex);\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 (coordEach(feature, function (currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {\n            // Simulating a meta.coordReduce() since `reduce` operations cannot be stopped by returning `false`\n            if (previousCoords === undefined || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {\n                previousCoords = currentCoord;\n                previousFeatureIndex = featureIndex;\n                previousMultiIndex = multiPartIndexCoord;\n                prevGeomIndex = geometryIndex;\n                segmentIndex = 0;\n                return;\n            }\n            var currentSegment = helpers.lineString([previousCoords, currentCoord], feature.properties);\n            if (callback(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) === false) return false;\n            segmentIndex++;\n            previousCoords = currentCoord;\n        }) === false) 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 *   //= segmentInex\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(geojson, function (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n        if (started === false && initialValue === undefined) previousValue = currentSegment;\n        else previousValue = callback(previousValue, currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex);\n        started = true;\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) return false;\n            break;\n        case 'Polygon':\n            for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {\n                if (callback(helpers.lineString(coords[geometryIndex], feature.properties), featureIndex, multiFeatureIndex, geometryIndex) === false) 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(geojson, function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n        if (featureIndex === 0 && initialValue === undefined) previousValue = currentLine;\n        else previousValue = callback(previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex);\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 (!helpers.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) 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 helpers.lineString([coords[segmentIndex], coords[segmentIndex + 1]], properties, options);\n    case 'Polygon':\n        if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n        if (segmentIndex < 0) segmentIndex = coords[geometryIndex].length + segmentIndex - 1;\n        return helpers.lineString([coords[geometryIndex][segmentIndex], coords[geometryIndex][segmentIndex + 1]], properties, options);\n    case 'MultiLineString':\n        if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex;\n        if (segmentIndex < 0) segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;\n        return helpers.lineString([coords[multiFeatureIndex][segmentIndex], coords[multiFeatureIndex][segmentIndex + 1]], properties, options);\n    case 'MultiPolygon':\n        if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex;\n        if (geometryIndex < 0) geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n        if (segmentIndex < 0) segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;\n        return helpers.lineString([coords[multiFeatureIndex][geometryIndex][segmentIndex], coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]], properties, options);\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 (!helpers.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) 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 helpers.point(coords, properties, options);\n    case 'MultiPoint':\n        if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex;\n        return helpers.point(coords[multiFeatureIndex], properties, options);\n    case 'LineString':\n        if (coordIndex < 0) coordIndex = coords.length + coordIndex;\n        return helpers.point(coords[coordIndex], properties, options);\n    case 'Polygon':\n        if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n        if (coordIndex < 0) coordIndex = coords[geometryIndex].length + coordIndex;\n        return helpers.point(coords[geometryIndex][coordIndex], properties, options);\n    case 'MultiLineString':\n        if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex;\n        if (coordIndex < 0) coordIndex = coords[multiFeatureIndex].length + coordIndex;\n        return helpers.point(coords[multiFeatureIndex][coordIndex], properties, options);\n    case 'MultiPolygon':\n        if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex;\n        if (geometryIndex < 0) geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n        if (coordIndex < 0) coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;\n        return helpers.point(coords[multiFeatureIndex][geometryIndex][coordIndex], properties, options);\n    }\n    throw new Error('geojson is invalid');\n}\n\nexports.coordEach = coordEach;\nexports.coordReduce = coordReduce;\nexports.propEach = propEach;\nexports.propReduce = propReduce;\nexports.featureEach = featureEach;\nexports.featureReduce = featureReduce;\nexports.coordAll = coordAll;\nexports.geomEach = geomEach;\nexports.geomReduce = geomReduce;\nexports.flattenEach = flattenEach;\nexports.flattenReduce = flattenReduce;\nexports.segmentEach = segmentEach;\nexports.segmentReduce = segmentReduce;\nexports.lineEach = lineEach;\nexports.lineReduce = lineReduce;\nexports.findSegment = findSegment;\nexports.findPoint = findPoint;\n","import cx from 'classnames';\nimport { capfirst, intcomma } from 'journalize';\nimport { Component, h, VNode } from 'preact';\n\nimport PartyPill from './PartyPill';\nimport PureComponent from './PureComponent';\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  isIncumbent: boolean;\n  isWinner: boolean;\n  party: string;\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      isIncumbent,\n      isWinner,\n      isViewable,\n      party,\n      totalVotesInContest,\n      votes,\n    } = this.props;\n  \n\n    let rowClass = cx('candidate', 'contest__candidate-row');\n\n    let checkClass = cx('check', {\n      'dem-winner': party == 'Democrat',\n      'rep-winner': party == 'Republican',\n      'lib-winner': party == 'Libertarian',\n      'ind-winner': party == 'Independent',\n      'gre-winner': party == 'Green',\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} />\n        </td>\n        <th class=\"candidate__cell candidate__name\">\n          {isWinner && isCanvass == true && (\n            <span class={checkClass}>{checkmark}</span>\n          )}\n          {isWinner && isCanvass == true ? (\n            <span class={checkClass}>{ballotName}</span>\n          ) : (\n            ballotName\n          )}{' '}\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\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","export default function noop() {}\n","const LENGTH_OF_CHECK_INTERVAL = 1000 * 60 * 2; // 2 minutes\nconst TIMERS_SHOULD_RUN = false;\n\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\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\nappNavJumps.concat(anchorJumps).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","var journalize = require('journalize');\n\nimport { capfirst, apdate, aptime, apmonth } from 'journalize';\n\nimport { LENGTH_OF_CHECK_INTERVAL } from './constants';\n\nconst PARTY_SORT_ORDER = [\n  'Republican',\n  'Democrat',\n  'Libertarian',\n  'Green',\n  'Independent',\n  'Write-in',\n];\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\nfunction get_directory_slug(office) {\n  return TT_directory_slugs.filter(slug => slug.office == office);\n}\n\nfunction 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\nfunction countdown(minutes) {\n  var seconds = 60;\n\n  var now = new Date().getTime();\n  // target timestamp; we will compute the remaining time\n  // relative to this date.\n  var target = new Date(now + LENGTH_OF_CHECK_INTERVAL);\n  // update frequency; note, this is flexible, and when the tab is\n  // inactive, there are no guarantees that the countdown will update\n  // at this frequency.\n  var update = 500;\n\n  var int = setInterval(function() {\n    var countdown_div = document.querySelectorAll('.countdown');\n    // current timestamp\n    var now = new Date();\n    // remaining time, in seconds\n    var remaining = (target - now) / 1000;\n\n    // if done, alert\n    if (remaining < 1 && remaining > 0) {\n      Array.prototype.forEach.call(countdown_div, function(el) {\n        el.innerHTML = 'Updating';\n      });\n      return;\n    }\n\n    if (remaining < 0) {\n      clearInterval(int);\n      return;\n    }\n\n    // format\n    var minutes = ~~(remaining / 60);\n    var seconds = ~~(remaining % 60);\n\n    // display\n    Array.prototype.forEach.call(countdown_div, function(el) {\n      el.innerHTML =\n        \"Update in <span class='counter'>\" +\n        format(minutes) +\n        ':' +\n        format(seconds) +\n        '</span>';\n    });\n  }, update);\n}\n\nconst delay = (function() {\n  var timer = 0;\n  return function(callback, ms) {\n    clearTimeout(timer);\n    timer = setTimeout(callback, ms);\n  };\n})(); \n\nfunction lastUpdated(now) {\n  // format dates to ap style\n  const formatted_date = journalize.apdate(now),\n    formatted_time = journalize.aptime(now).replace(/\\./g, ''),\n    formatted_month = journalize.apmonth(now),\n    just_day = now.getDate();\n\n  // A delay function so we can give a little time for the div .countdown to exist\n  const delay = (function() {\n    var timer = 0;\n    return function(callback, ms) {\n      clearTimeout(timer);\n      timer = setTimeout(callback, ms);\n    };\n  })(); \n\n  delay(function() {\n    var countdown_div = document.querySelectorAll('.countdown');\n    Array.prototype.forEach.call(countdown_div, function(el) {\n      el.innerHTML =\n        \"Last updated <span class='counter'>\" +\n        // formatted_month + ' ' + just_day + ', ' +\n        formatted_time +\n        '</span>';\n    });\n  }, 600); // end delay\n}\n\nfunction lastUpdatedFormat(now) {\n  // format dates to ap style\n  const formatted_date = journalize.apdate(now),\n    formatted_time = journalize.aptime(now).replace(/\\./g, ''),\n    formatted_month = journalize.apmonth(now),\n    just_day = now.getDate();\n\n  return formatted_time;\n}\n\nfunction format(num) {\n  return num < 10 ? '0' + num : num;\n}\n\nconst 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\nfunction determineDistrictTitle(contest) {\n  return `${contest.office} ${\n    contest.office === 'President' || contest.division_type === 'class'\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\nfunction determineContestTitle(contest, isPartner) {\n  if (\n    (contest.division_type === null ||\n      contest.division_type == 'class' ||\n      contest.division_type === 'seat') &&\n    isPartner !== 'isPartner'\n  )\n    return '';\n  else if (\n    (contest.division_type === null ||\n      contest.division_type == 'class' ||\n      contest.division_type === 'seat') &&\n    isPartner == 'isPartner'\n  )\n    return `${contest.office}`;\n  else return determineDistrictTitle(contest);\n}\n\nfunction determineContestTitleYourRaces(contest) {\n  return determineDistrictTitle(contest);\n}\n\nexport {\n  get_directory_slug,\n  sort_candidates_by_party,\n  countdown,\n  delay,\n  lastUpdated,\n  lastUpdatedFormat,\n  chunk,\n  determineDistrictTitle,\n  determineContestTitle,\n  determineContestTitleYourRaces,\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","// Races To Watch buttons\nfilterSelection('all');\nfunction filterSelection(c, id) {\n  var x, i;\n\n  // Need to differentiate between sections with ads in between like the Texas House and U.S. House and ones with not\n\n  if (id == 'texas-house' || id == 'us-house') {\n    x = document.querySelectorAll(\n      '#' +\n        String(id) +\n        ' div.contests div.office__contests div.contest-group div.seat__contests-double >  .seat'\n    );\n  } else {\n    x = document.querySelectorAll(\n      '#' +\n        String(id) +\n        ' div.contests div.office__contests.seat__contests-double >  .seat'\n    );\n  }\n\n  // Add the \"show\" class (display:block) to the filtered elements, and remove the \"show\" class from the elements that are not selected\n  for (i = 0; i < x.length; i++) {\n    if (c == 'all') {\n      w3RemoveClass(x[i], 'remove');\n    } else {\n      w3RemoveClass(x[i], 'remove');\n      if (x[i].getElementsByClassName('get__flag').length == 0)\n        w3AddClass(x[i], 'remove');\n    }\n  }\n}\n\n// Show filtered elements\nfunction w3AddClass(element, name) {\n  var i, arr1, arr2;\n  arr1 = element.className.split(' ');\n  arr2 = name.split(' ');\n  for (i = 0; i < arr2.length; i++) {\n    if (arr1.indexOf(arr2[i]) == -1) {\n      element.className += ' ' + arr2[i];\n    }\n  }\n}\n\n// Hide elements that are not selected\nfunction w3RemoveClass(element, name) {\n  var i, arr1, arr2;\n  arr1 = element.className.split(' ');\n  arr2 = name.split(' ');\n  for (i = 0; i < arr2.length; i++) {\n    while (arr1.indexOf(arr2[i]) > -1) {\n      arr1.splice(arr1.indexOf(arr2[i]), 1);\n    }\n  }\n  element.className = arr1.join(' ');\n}\n\n// Add active class to the current control button (highlight it)\nvar btnContainer = document.querySelectorAll('#btnGroup');\n\nfor (var i = 0; i < btnContainer.length; i++) {\n  var btns = btnContainer[i].getElementsByClassName('race_to_watch_button');\n\n  for (var t = 0; t < btns.length; t++) {\n    btns[t].addEventListener('click', function(event) {\n      var path =\n        event.path ||\n        (event.composedPath && event.composedPath()) ||\n        composedPath(event.target);\n\n      var currentParent = document.querySelector(\n        '#btnGroup.' + path[1].className\n      );\n      var current = currentParent.getElementsByClassName('active');\n      current[0].className = current[0].className.replace(' active', '');\n      this.className += ' active';\n\n      filterSelection(this.value, path[2].id);\n    });\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","export default function(a, b) {\n  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending\";\n\nexport default function(compare) {\n  if (compare.length === 1) compare = ascendingComparator(compare);\n  return {\n    left: function(a, x, lo, hi) {\n      if (lo == null) lo = 0;\n      if (hi == null) hi = a.length;\n      while (lo < hi) {\n        var mid = lo + hi >>> 1;\n        if (compare(a[mid], x) < 0) lo = mid + 1;\n        else hi = mid;\n      }\n      return lo;\n    },\n    right: function(a, x, lo, hi) {\n      if (lo == null) lo = 0;\n      if (hi == null) hi = a.length;\n      while (lo < hi) {\n        var mid = lo + hi >>> 1;\n        if (compare(a[mid], x) > 0) hi = mid;\n        else lo = mid + 1;\n      }\n      return lo;\n    }\n  };\n}\n\nfunction ascendingComparator(f) {\n  return function(d, x) {\n    return ascending(f(d), x);\n  };\n}\n","import ascending from \"./ascending\";\nimport bisector from \"./bisector\";\n\nvar ascendingBisect = bisector(ascending);\nexport var bisectRight = ascendingBisect.right;\nexport var bisectLeft = ascendingBisect.left;\nexport default bisectRight;\n","import {pair} from \"./pairs\";\n\nexport default function(values0, values1, reduce) {\n  var n0 = values0.length,\n      n1 = values1.length,\n      values = new Array(n0 * n1),\n      i0,\n      i1,\n      i,\n      value0;\n\n  if (reduce == null) reduce = pair;\n\n  for (i0 = i = 0; i0 < n0; ++i0) {\n    for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) {\n      values[i] = reduce(value0, values1[i1]);\n    }\n  }\n\n  return values;\n}\n","export default function(x) {\n  return x === null ? NaN : +x;\n}\n","export default function(values, valueof) {\n  var n = values.length,\n      i = -1,\n      value,\n      min,\n      max;\n\n  if (valueof == null) {\n    while (++i < n) { // Find the first comparable value.\n      if ((value = values[i]) != null && value >= value) {\n        min = max = value;\n        while (++i < n) { // Compare the remaining values.\n          if ((value = values[i]) != null) {\n            if (min > value) min = value;\n            if (max < value) max = value;\n          }\n        }\n      }\n    }\n  }\n\n  else {\n    while (++i < n) { // Find the first comparable value.\n      if ((value = valueof(values[i], i, values)) != null && value >= value) {\n        min = max = value;\n        while (++i < n) { // Compare the remaining values.\n          if ((value = valueof(values[i], i, values)) != null) {\n            if (min > value) min = value;\n            if (max < value) max = value;\n          }\n        }\n      }\n    }\n  }\n\n  return [min, max];\n}\n","var array = Array.prototype;\n\nexport var slice = array.slice;\nexport var map = array.map;\n","export default function(start, stop, step) {\n  start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;\n\n  var i = -1,\n      n = Math.max(0, Math.ceil((stop - start) / step)) | 0,\n      range = new Array(n);\n\n  while (++i < n) {\n    range[i] = start + i * step;\n  }\n\n  return range;\n}\n","var e10 = Math.sqrt(50),\n    e5 = Math.sqrt(10),\n    e2 = Math.sqrt(2);\n\nexport default function(start, stop, count) {\n  var reverse,\n      i = -1,\n      n,\n      ticks,\n      step;\n\n  stop = +stop, start = +start, count = +count;\n  if (start === stop && count > 0) return [start];\n  if (reverse = stop < start) n = start, start = stop, stop = n;\n  if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];\n\n  if (step > 0) {\n    start = Math.ceil(start / step);\n    stop = Math.floor(stop / step);\n    ticks = new Array(n = Math.ceil(stop - start + 1));\n    while (++i < n) ticks[i] = (start + i) * step;\n  } else {\n    start = Math.floor(start * step);\n    stop = Math.ceil(stop * step);\n    ticks = new Array(n = Math.ceil(start - stop + 1));\n    while (++i < n) ticks[i] = (start - i) / step;\n  }\n\n  if (reverse) ticks.reverse();\n\n  return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n  var step = (stop - start) / Math.max(0, count),\n      power = Math.floor(Math.log(step) / Math.LN10),\n      error = step / Math.pow(10, power);\n  return power >= 0\n      ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)\n      : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);\n}\n\nexport function tickStep(start, stop, count) {\n  var step0 = Math.abs(stop - start) / Math.max(0, count),\n      step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),\n      error = step0 / step1;\n  if (error >= e10) step1 *= 10;\n  else if (error >= e5) step1 *= 5;\n  else if (error >= e2) step1 *= 2;\n  return stop < start ? -step1 : step1;\n}\n","export default function(values) {\n  return Math.ceil(Math.log(values.length) / Math.LN2) + 1;\n}\n","import number from \"./number\";\n\nexport default function(values, p, valueof) {\n  if (valueof == null) valueof = number;\n  if (!(n = values.length)) return;\n  if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);\n  if (p >= 1) return +valueof(values[n - 1], n - 1, values);\n  var n,\n      i = (n - 1) * p,\n      i0 = Math.floor(i),\n      value0 = +valueof(values[i0], i0, values),\n      value1 = +valueof(values[i0 + 1], i0 + 1, values);\n  return value0 + (value1 - value0) * (i - i0);\n}\n","export default function(values, valueof) {\n  var n = values.length,\n      i = -1,\n      value,\n      max;\n\n  if (valueof == null) {\n    while (++i < n) { // Find the first comparable value.\n      if ((value = values[i]) != null && value >= value) {\n        max = value;\n        while (++i < n) { // Compare the remaining values.\n          if ((value = values[i]) != null && value > max) {\n            max = value;\n          }\n        }\n      }\n    }\n  }\n\n  else {\n    while (++i < n) { // Find the first comparable value.\n      if ((value = valueof(values[i], i, values)) != null && value >= value) {\n        max = value;\n        while (++i < n) { // Compare the remaining values.\n          if ((value = valueof(values[i], i, values)) != null && value > max) {\n            max = value;\n          }\n        }\n      }\n    }\n  }\n\n  return max;\n}\n","export default function(arrays) {\n  var n = arrays.length,\n      m,\n      i = -1,\n      j = 0,\n      merged,\n      array;\n\n  while (++i < n) j += arrays[i].length;\n  merged = new Array(j);\n\n  while (--n >= 0) {\n    array = arrays[n];\n    m = array.length;\n    while (--m >= 0) {\n      merged[--j] = array[m];\n    }\n  }\n\n  return merged;\n}\n","// Adds floating point numbers with twice the normal precision.\n// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and\n// Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3)\n// 305–363 (1997).\n// Code adapted from GeographicLib by Charles F. F. Karney,\n// http://geographiclib.sourceforge.net/\n\nexport default function() {\n  return new Adder;\n}\n\nfunction Adder() {\n  this.reset();\n}\n\nAdder.prototype = {\n  constructor: Adder,\n  reset: function() {\n    this.s = // rounded value\n    this.t = 0; // exact error\n  },\n  add: function(y) {\n    add(temp, y, this.t);\n    add(this, temp.s, this.s);\n    if (this.s) this.t += temp.t;\n    else this.s = temp.t;\n  },\n  valueOf: function() {\n    return this.s;\n  }\n};\n\nvar temp = new Adder;\n\nfunction add(adder, a, b) {\n  var x = adder.s = a + b,\n      bv = x - a,\n      av = x - bv;\n  adder.t = (a - av) + (b - bv);\n}\n","import adder from \"../adder.js\";\nimport {abs} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar areaSum = adder(),\n    areaRingSum = 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.reset();\n  },\n  result: function() {\n    var area = areaSum / 2;\n    areaSum.reset();\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 \"../adder.js\";\nimport {sqrt} from \"../math.js\";\nimport noop from \"../noop.js\";\n\nvar lengthSum = 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.reset();\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 || 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\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":""}