"use strict";var BT50=window.BT50||{};BT50&&BT50.Widget||(BT50.Widget=function(r){if((r=Object.assign({elementID:"#BT50Widget",currentSession:!0,height:"400px",width:"100%",rows:100,borderColor:"",fontFamily:"",fontSize:"",linkColor:"",tBackground:"",tForeground:""},r)).hostname="https://www.billtrack50.com",o(r),!document.getElementById("bt50Css")){var t=document.getElementsByTagName("head")[0],e=document.createElement("link");e.id="bt50Css",e.rel="stylesheet",e.type="text/css",e.href="".concat(r.hostname,"/css/bt50.widget.bill.css"),t.appendChild(e)}function n(){var t=document.querySelector(r.elementID);t.classList.add("bt50Widget"),t.style.width=r.width,r.borderColor.length&&(t.style.borderColor=r.borderColor),r.fontFamily.length&&(t.style.fontFamily=r.fontFamily),r.fontSize.length&&(t.style.fontSize=r.fontSize),r.width.length&&(t.style.width=r.width);var n=document.createElement("div");n.classList.add("bt50Title","text-truncate"),r.tForeground.length&&(n.style.backgroundColor=r.tBackground),r.tForeground.length&&(n.style.color=r.tForeground),n.innerHTML="Bills Sponsored By:";var o=document.createElement("div");o.classList.add("bt50BodyWrap"),o.style.height=r.height,o.innerHTML='
Loading...
',t.appendChild(n),t.appendChild(o),function(){var t=new URL("".concat(r.hostname,"/BT50Api/2.1/widget/legislator"));return t.searchParams.append("legislatorID",r.legislatorID),t.searchParams.append("currentSession",r.currentSession),t.searchParams.append("rowCount",r.rows),fetch(t,{method:"get"}).then(function(t){if(!t.ok)throw Error(t.statusText);return t.text()})}().then(function(t){var e=document.createElement("div");e.innerHTML=t,r.linkColor.length&&e.querySelectorAll("a.billTitle").forEach(function(t){t.style.color=r.linkColor});n.innerHTML=e.querySelector(".bt50Title").innerHTML,o.innerHTML=e.querySelector(".bt50BodyWrap").innerHTML}).catch(function(t){o.innerHTML='
An error occurred retrieving bills.
'})}function o(t){t.rowCount&&(t.rows=t.rowCount,delete t.rowCount),"string"==typeof t.rows&&(t.rows=parseInt(t.rows)),t.height=t.height.toString(),t.height.includes("px")||(t.height="".concat(t.height,"px")),t.width=t.width.toString(),t.width.includes("px")||t.width.includes("%")||(t.width="".concat(t.width,"px")),t.fontSize=t.fontSize.toString(),t.fontSize.length&&!t.fontSize.includes("px")&&(t.fontSize="".concat(t.fontSize,"px"))}this.refresh=function(){document.querySelector(r.elementID).innerHTML="",n()},this.setOption=function(t,e){r[t]=e,o(r)},"complete"===document.readyState||"loaded"===document.readyState||"interactive"===document.readyState?n():document.addEventListener("DOMContentLoaded",function(){n()})});