function BillOverviewViewModel(n,t,i,r,u){var f=this;f.currentUserId=ko.observable(i);f.showProxyComment=ko.observable(!1);f.showBillInfo=ko.observable(!1);f.selectedSessionId=ko.observable(n).subscribeTo(window.constants.sessionPubSubName);f.selectedProxyUser=ko.observable("").subscribeTo("SelectedProxyUser");f.billNumber=ko.observable(t);f.billInfo=ko.observable([]);f.showStanding=ko.observable(!1);f.isLoading=ko.observable(!1);f.isLoadingKeyword=ko.observable(!1);f.isLoadingSA=ko.observable(!1);f.isLoadingSpon=ko.observable(!1);f.isLoadingVideo=ko.observable(!1);f.isLoadingDocs=ko.observable(!1);f.isLoadingOverview=ko.observable(!1);f.detailFloorHeader=ko.observable("COW");f.detailFloorHeader2=ko.observable();f.showQualifyVotes=ko.observable(!1);f.sponsors=ko.observableArray([]);f.sponsorHouseVer=ko.observable(!1);f.sponsorSenateVer=ko.observable(!1);f.sponsorTypes=ko.observableArray(["P","H","S"]);f.showRef=ko.observable(!0);f.showPriorRef=ko.observable(!1);f.showNextRef=ko.observable(!1);f.CurTab=ko.observable(u);f.selectedVoteOption=ko.observable("");f.maxRef=ko.observable(1);f.referralText=ko.observable("");f.curRef=ko.observable(1);f.curCommitteeShortName=ko.observable("");f.commMotionExists=ko.observable(!1);f.COWDate=ko.observable("");f.ADCOWDate=ko.observable("");f.MOTIONADCOWDate=ko.observable("");f.SitCOWDate=ko.observable("");f.ThirdDate=ko.observable("");f.ReconThirdDate=ko.observable("");f.ConfCommDate=ko.observable("");f.ConcurrenceDate=ko.observable("");f.FinalDate=ko.observable("");f.ReconFinalDate=ko.observable("");f.MiscMotionDate=ko.observable("");f.VetoDate=ko.observable("");f.sessionSubPath=ko.observable("");f.COWCurRef=ko.observable(1);f.ADCOWCurRef=ko.observable(1);f.MOTIONADCOWCurRef=ko.observable(1);f.SitCOWCurRef=ko.observable(1);f.ThirdCurRef=ko.observable(1);f.ReconThirdCurRef=ko.observable(1);f.ConfCommCurRef=ko.observable(1);f.ConcurrenceCurRef=ko.observable(1);f.FinalCurRef=ko.observable(1);f.ReconFinalCurRef=ko.observable(1);f.MiscMotionCurRef=ko.observable(1);f.VetoCurRef=ko.observable(1);f.sectionsAffected=ko.observableArray([]);f.signalRGroup=ko.observable("");f.signalRProxyGroup=ko.observable("");f.sbcEditGroupId=ko.observable("");f.sbcIsBeingEditted=ko.observable(!1);f.sbcEditProxyComment=ko.observable(!0);f.sbcEditMyComment=ko.observable(!0);f.reportFloorCommDetailFilter=ko.observableArray([]);f.bodyConfMemmbersLabel=ko.observable("");f.bodyTab=ko.observable("H");f.oppBody=ko.observable("");f.curBillId=ko.observable(0);f.setBodyTab=function(n){(n=n.trim().toUpperCase(),f.bodyTab()!=n)&&(f.bodyTab(n),n=="S"?(f.oppBody("H"),f.bodyConfMemmbersLabel("Senate Members")):(f.oppBody("S"),f.bodyConfMemmbersLabel("House Members")),f.setConcurRefuse())};f.searchForBill=function(n){if(f.billNumber().length<6)return!1;if(f.keywords([]),f.sectionsAffected([]),f.sponsors([]),f.billCommentScreenDisplay(""),f.billNumber()=="")return f.billInfo([]),!1;f.isLoading(!0);f.billNumber(f.billNumber().toUpperCase());var t={billNumber:f.billNumber(),sessionId:f.selectedSessionId(),legislativeBody:f.bodyTab()};$.getJSON(window.constants.api.bill,t).done(function(t){if(f.billInfo(t),f.billInfo()==null)return n&&(f.isLoading(!1),alert(f.billNumber()+" is an invalid Bill Number.")),f.billNumber(""),f.showBillInfo(!1),null;f.showBillInfo(!0);f.CurTab()==-1&&f.CurTab(0);switch(f.CurTab()){case 2:f.loadVideos();break;case 3:f.loadBillSKS();break;case 4:f.loadBillPositions();break;case 5:f.loadDocuments()}f.isLoading(!1);f.loadBillOverview();f.loadTransmitDates();f.billNumber().substring(0,1)=="S"?($("#bodytab a:last").tab("show"),f.setBodyTab("S")):($("#bodytab a:first").tab("show"),f.setBodyTab("H"));$("#myTab>li.active").removeClass("active");$("#myTab li:eq("+f.CurTab()+")").addClass("active");$("#myTabContent>div.active").removeClass("active");$("#tab1-"+parseInt(f.CurTab()+1)).removeClass("fade").addClass("active");f.isLoading(!1)}).fail(function(){alert("Error loading bill information, the server may be unavailable.")})};f.billOverviewInfo=ko.observableArray([]);f.loadBillOverview=function(){if(f.isLoading()||f.billNumber()=="")return!1;f.billInfo()==null&&f.searchForBill(!0);f.isLoadingOverview(!0);var n={billNumber:f.billNumber(),sessionId:f.selectedSessionId()};$.getJSON(window.constants.api.billOverview,n).done(function(n){return f.billOverviewInfo(n),f.isLoadingOverview(!1),f.billOverviewInfo()==null?(alert("Invalid Bill Number for Overview"),null):void 0});f.curBillId(f.billInfo().BillId)};f.billOverviewInfo.subscribe(function(){if(f.billOverviewInfo()==null)return!1;f.searchForSponsors(f.billInfo().BillId)});f.billComments=ko.observable("");f.billProxyComments=ko.observable("");f.proxyCommentsLabel=ko.observable("");f.selectedProxyUser.subscribe(function(){f.loadProxyUserInfo()});f.loadProxyUserInfo=function(){var n,t;if((f.proxyCommentsLabel(""),f.billProxyComments(""),f.showProxyComment(!1),f.currentUserId==0)||f.selectedProxyUser()==undefined||f.selectedProxyUser()==null||f.selectedProxyUser()==""||f.billInfo()==undefined||f.billInfo()==null||f.billInfo()=="")return!1;n=f.selectedProxyUser().UserId()==i;n?f.signalRProxyGroup(""):(f.showProxyComment(!0),f.proxyCommentsLabel("Comments for "+f.selectedProxyUser().FullName()+":"),t={billStatusId:f.billInfo().BillId,userId:f.selectedProxyUser().UserId},$.getJSON(window.constants.api.billComment,t).done(function(n){n.length==0?f.billProxyComments({BillStatusId:f.billInfo().BillId,UserId:f.selectedProxyUser().UserId,Comment:""}):f.billProxyComments(n[0]);f.billProxyCommentScreenDisplay(f.billProxyComments().Comment)}).fail(function(){alert("Failed to load comments, the server may be unavailable.")}))};f.commentsModalButtonClosedFlag=ko.observable(!1);f.sbcEdittingUserId=ko.observable(0);f.sbcEdittingUserName=ko.observable("");f.sbcEdittingUserId.subscribe(function(){if(f.sbcEdittingUserId==0)f.sbcEdittingUserName("");else{var n={userId:f.sbcEdittingUserId()};$.getJSON(window.constants.api.user,n).done(function(n){n!=undefined&&n.length!=0?f.sbcEdittingUserName(n[0].FullName):f.sbcEdittingUserName(f.sbcEdittingUserId)}).fail(function(){f.sbcEdittingUserName("")})}});f.commentValue=ko.observable("");f.currentlyEdittingComment=ko.observable(0);f.sbcGroupBeingEdited=ko.observable(0);f.commentToEdit=ko.observable("");f.loadCommentsToEdit=function(n){if(f.currentUserId()==0)return!1;f.commentsModalButtonClosedFlag(!1);f.currentlyEdittingComment(n);n==1&&f.commentValue(f.billComments().Comment);n==2&&f.commentValue(f.billProxyComments().Comment)};f.URLButton=function(){var n,i,t;if(f.billInfo==null||f.billNumber()=="")return!1;n=document.createElement("a");i=document.createTextNode(f.billNumber());n.appendChild(i);n.id="copyhelper";n.href="https://apps.azleg.gov/BillStatus/BillOverview/"+f.billInfo().BillId;document.body.appendChild(n);t=document.createRange();t.selectNode(document.getElementById("copyhelper"));window.getSelection().removeAllRanges(t);window.getSelection().addRange(t);document.execCommand("copy");document.body.removeChild(n);alert("URL Loaded into clipboard.")};f.billInfo.subscribe(function(){if(f.billInfo==null||f.billNumber()=="")return!1;f.isLoading(!0);f.sessionSubPath("");$.getJSON(window.constants.api.session,{sessionId:f.selectedSessionId()}).done(function(n){f.sessionSubPath(n[0].Legislature+"leg/"+n[0].Code+"/")});f.loadBillStandingCommittees();f.floorCommitteeSetup();f.getTransmitBody();f.setConcurRefuse();f.loadComments();f.isLoading(!1)});f.billCommentScreenDisplay=ko.observable("");f.billProxyCommentScreenDisplay=ko.observable("");f.loadComments=function(){if(f.billInfo()==null||i===0)return!1;f.billCommentScreenDisplay("");$.getJSON(window.constants.api.billComment,{billStatusId:f.billInfo().BillId}).done(function(n){n.length==0?f.billComments({BillStatusId:f.billInfo().BillId,UserId:i,Comment:""}):f.billComments(n[0]);f.billCommentScreenDisplay(f.billComments().Comment)}).fail(function(){alert("Failed to load comments, the server may be unavailable.")})};f.hideCommentsNoSave=function(){if(f.currentUserId()===0)return!1;f.sbcIsBeingEditted(!1);f.sbcGroupBeingEdited(0);f.commentsModalButtonClosedFlag(!0);$("#commentModal").modal("hide")};f.saveComments=function(){if(f.currentUserId()==0||f.billInfo()==undefined||f.billInfo()==null)return!1;f.currentlyEdittingComment()==1&&(f.billComments().Comment=f.commentValue(),f.billCommentScreenDisplay(f.billComments().Comment),f.saveBillComments());f.currentlyEdittingComment()==2&&(f.billProxyComments().Comment=f.commentValue(),f.billProxyCommentScreenDisplay(f.billProxyComments().Comment),f.saveProxyBillComments());f.sbcIsBeingEditted(!1);f.sbcGroupBeingEdited(0);f.commentsModalButtonClosedFlag(!0);$("#commentModal").modal("hide")};f.saveBillComments=function(){$.ajax({url:window.constants.api.billComment,type:"PUT",data:f.billComments(),success:function(n){$("#commentModal").modal("hide");f.billComments(n)},fail:function(n){alert(JSON.parse(n.responseText).Message)}})};f.saveProxyBillComments=function(){$.ajax({url:window.constants.api.billComment,type:"PUT",data:f.billProxyComments(),success:function(n){$("#commentModal").modal("hide");f.billProxyComments(n)},fail:function(n){alert(JSON.parse(n.responseText).Message)}})};f.textConcurRefuse=ko.observable("");f.setConcurRefuse=function(){if(f.textConcurRefuse(""),f.billInfo()!=null)if(f.bodyTab()=="S")switch(f.billInfo().SenateCaucusConcurRefuse){case"C":f.textConcurRefuse("Concurrence Recommended");break;case"R":f.textConcurRefuse("Conference Committee Recommended");break;case null:case"":f.textConcurRefuse("");break;default:f.textConcurRefuse("Referred To Committee")}else switch(f.billInfo().HouseCaucusConcurRefuse){case"C":f.textConcurRefuse("Concurrence Recommended");break;case"R":f.textConcurRefuse("Conference Committee Recommended");break;case"":case null:f.textConcurRefuse("");break;default:f.textConcurRefuse("Referred To Committee")}};f.firstSponsor=ko.observable("");f.searchForSponsors=function(n){if(!n)return!1;f.isLoadingSpon(!0);var t={id:n};$.getJSON(window.constants.api.billSponsor,t).done(function(n){f.sponsors(n);f.firstSponsor(f.sponsors()[0].Legislator.FullName);f.isLoadingSpon(!1)})};f.setCurTab=function(n){f.CurTab(n)};f.userInfo=ko.observable([]);f.billPositions=ko.observable([]);f.bpFor=ko.observable(0);f.bpAgainst=ko.observable(0);f.bpNeutral=ko.observable(0);f.loadBillPositions=function(){if(f.billInfo()==null||f.billInfo().BillId==undefined)return!1;f.isLoading(!0);var n={id:f.selectedSessionId(),billStatusId:f.billInfo().BillId,verifyUser:!1};$.getJSON(window.constants.api.billPosition,n).done(function(n){f.billPositions(n);f.isLoading(!1);var t=ko.utils.arrayFilter(f.billPositions(),function(n){return n.Opinion==="For"});f.bpFor(t.length);t=ko.utils.arrayFilter(f.billPositions(),function(n){return n.Opinion==="Against"});f.bpAgainst(t.length);t=ko.utils.arrayFilter(f.billPositions(),function(n){return n.Opinion==="Neutral"});f.bpNeutral(t.length)})};f.selectedSessionId.subscribe(function(){f.searchForBill(!1)});f.detailStandingHeader=ko.observable();f.billStandingCommittees=ko.observableArray();f.filterStandingCommitteesByBody=ko.observable();f.houseStandingCommitteeCount=ko.observable();f.senateStandingCommitteeCount=ko.observable();f.displayStandingCommitteesByBody=function(n){f.filterStandingCommitteesByBody(n.toUpperCase());n.toUpperCase()=="H"&&f.detailStandingHeader("House Standing Committee Details - "+f.billNumber());n.toUpperCase()=="S"&&f.detailStandingHeader("Senate Standing Committee Details - "+f.billNumber())};f.loadBillStandingCommittees=function(){if((f.billStandingCommittees(""),f.detailStandingHeader(""),f.billInfo()==undefined)||f.billInfo()==null||f.billInfo().BillId==null)return null;var n={billStatusId:f.billInfo().BillId,includeVotes:!0,officialOnly:!0};$.getJSON(window.constants.api.standingCommittees,n).done(function(n){var t,i;f.billStandingCommittees(n);t=ko.utils.arrayFilter(f.billStandingCommittees(),function(n){return n.Committee.LegislativeBody=="H"});f.houseStandingCommitteeCount(t.length);i=ko.utils.arrayFilter(f.billStandingCommittees(),function(n){return n.Committee.LegislativeBody=="S"});f.senateStandingCommitteeCount(i.length)})};f.filteredBillStandingCommittees=ko.computed(function(){var n=f.filterStandingCommitteesByBody();return n==undefined?f.billStandingCommittees():n==""?f.billStandingCommittees():(n=n.toUpperCase(),n=="H"||n=="S"?ko.utils.arrayFilter(f.billStandingCommittees(),function(t){return t.Committee.LegislativeBody==n}):f.billStandingCommittees())});f.showConcurVD=ko.observable(!1);f.floorCommitteeSetup=ko.computed(function(){var t,n;if((f.commMotionExists(!1),f.COWDate(""),f.ADCOWDate(""),f.MOTIONADCOWDate(""),f.SitCOWDate(""),f.ThirdDate(""),f.ReconThirdDate(""),f.ConfCommDate(""),f.ConcurrenceDate(""),f.FinalDate(""),f.ReconFinalDate(""),f.MiscMotionDate(""),f.VetoDate(""),f.showConcurVD(!1),f.billInfo()==null)||f.billInfo().FloorHeaders==null)return null;for(t=f.billInfo().FloorHeaders,n=0;n<t.length;n++)if(t[n].LegislativeBody==f.bodyTab())switch(t[n].CommitteeShortName){case"COW":f.COWDate()==""&&(f.COWDate(t[n].ActionDate),f.COWCurRef(t[n].ReferralNumber));break;case"ADCOW":f.ADCOWDate()==""&&(f.ADCOWDate(t[n].ActionDate),f.ADCOWCurRef(t[n].ReferralNumber));break;case"MOTIONADCOW":f.MOTIONADCOWDate()==""&&(f.MOTIONADCOWDate(t[n].ActionDate),f.MOTIONADCOWCurRef(t[n].ReferralNumber));break;case"SCOW":f.SitCOWDate()==""&&(f.SitCOWDate(t[n].ActionDate),f.SitCOWCurRef(t[n].ReferralNumber));break;case"MOTION":f.commMotionExists(!0);break;case"THIRD":f.ThirdDate()==""&&(f.ThirdDate(t[n].ActionDate),f.ThirdCurRef(t[n].ReferralNumber));break;case"RECON_3RD":f.ReconThirdDate()==""&&(f.ReconThirdDate(t[n].ActionDate),f.ReconThirdCurRef(t[n].ReferralNumber));break;case"CONF":f.ConfCommDate()==""&&(f.ConfCommDate(t[n].ActionDate),f.ConfCommCurRef(t[n].ReferralNumber));break;case"CONCUR":f.ConcurrenceDate()==""&&(f.ConcurrenceDate(t[n].ActionDate),f.ConcurrenceCurRef(t[n].ReferralNumber),t[n].TotalVotes!=0&&f.showConcurVD(!0));break;case"FINAL":f.FinalDate()==""&&(f.FinalDate(t[n].ActionDate),f.FinalCurRef(t[n].ReferralNumber));break;case"RECON_FNL":f.ReconFinalDate()==""&&(f.ReconFinalDate(t[n].ActionDate),f.ReconFinalCurRef(t[n].ReferralNumber));break;case"MISC":f.MiscMotionDate()==""&&(f.MiscMotionDate(t[n].ActionDate),f.MiscMotionCurRef(t[n].ReferralNumber));break;case"VETO":f.VetoDate()==""&&(f.VetoDate(t[n].ActionDate),f.VetoCurRef(t[n].ReferralNumber))}return},this);f.buttonLabel=ko.observable("");f.floorCommType=ko.observable(1);f.showMotionButton=ko.observable(!0);f.transmitToSenate1=ko.observable("");f.transmitToSenate2=ko.observable("");f.transmitToHouse1=ko.observable("");f.transmitToHouse2=ko.observable("");f.loadTransmitDates=function(){f.transmitToSenate1(f.getTransmitDate(1,"S"));f.transmitToHouse1(f.getTransmitDate(1,"H"));f.transmitToSenate2(f.getTransmitDate(2,"S"));f.transmitToHouse2(f.getTransmitDate(2,"H"))};f.getTransmitDate=function(n,t){if(f.billInfo()==null||f.billInfo().BodyTransmittedTo==null)return"";var i=ko.utils.arrayFirst(f.billInfo().BodyTransmittedTo,function(i){return i.LegislativeBody.trim()==t&&i.TransmitToInd==n});return i==null?"":moment(i.TransmitDate).format("MM/DD/YYYY")};f.transmittedToDate=ko.observable("");f.transmitToBody=ko.observable("");f.getTransmitBody=function(){if((f.transmittedToDate(""),f.transmitToBody(""),f.billInfo()==null)||f.billInfo().BodyTransmittedTo==null)return null;var n=ko.utils.arrayFirst(f.billInfo().BodyTransmittedTo,function(n){return n.LegislativeBody.trim()!="S"&&n.LegislativeBody.trim()!="H"});return n==null?null:(f.transmittedToDate(n.TransmitDate),n.LegislativeBody.trim()=="G"?f.transmitToBody("Governor"):f.transmitToBody("Secretary of State"),n)};f.getCurReferral=function(n){switch(n){case"COW":f.curRef(f.COWCurRef());break;case"ADCOW":f.curRef(f.ADCOWCurRef());break;case"MOTIONADCOW":f.curRef(f.MOTIONADCOWCurRef());break;case"SCOW":f.curRef(f.SitCOWCurRef());break;case"THIRD":f.curRef(f.ThirdCurRef());break;case"RECON_3RD":f.curRef(f.ReconThirdCurRef());break;case"CONF":f.curRef(f.ConfCommCurRef());break;case"CONCUR":f.curRef(f.ConcurrenceCurRef());break;case"FINAL":f.curRef(f.FinalCurRef());break;case"RECON_FNL":f.curRef(f.ReconFinalCurRef());break;case"MISC":f.curRef(f.MiscMotionCurRef());break;case"VETO":f.curRef(f.VetoCurRef())}};f.setCurReferral=function(n){switch(n){case"COW":f.COWCurRef(f.curRef());break;case"ADCOW":f.ADCOWCurRef(f.curRef());break;case"SCOW":f.SitCOWCurRef(f.curRef());break;case"MOTIONADCOW":f.MOTIONADCOWCurRef(f.curRef());break;case"THIRD":f.ThirdCurRef(f.curRef());break;case"RECON_3RD":f.ReconThirdCurRef(f.curRef());break;case"CONF":f.ConfCommCurRef(f.curRef());break;case"CONCUR":f.ConcurrenceCurRef(f.curRef());break;case"FINAL":f.FinalCurRef(f.curRef());break;case"RECON_FNL":f.ReconFinalCurRef(f.curRef());break;case"MISC":f.MiscMotionCurRef(f.curRef());break;case"VETO":f.VetoCurRef(f.curRef())}};f.standingURLReport=ko.computed(function(){return f.billInfo()==null?"":"/api/Report?id="+f.billInfo().BillId+"&reportType=standing"});f.referrals=ko.observableArray([]);f.floorCommDetails=ko.observableArray([]);f.loadFloorCommDetails=function(n,t,i){var r,u,e;if(f.billInfo()==undefined||f.billInfo()==null||f.billInfo().BodyTransmittedTo==null||(f.bodyTab(t),n=n.trim(),n==""&&(n=f.curCommitteeShortName()),f.curCommitteeShortName(n),f.getCurReferral(n),i!=0&&f.curRef(parseInt(i)),f.setCurReferral(n),r=ko.utils.arrayFirst(f.billInfo().FloorHeaders,function(i){return i.CommitteeShortName==n&&i.LegislativeBody==t&&i.ReferralNumber==f.curRef()}),r==null)||(u=ko.utils.arrayFirst(f.billInfo().FloorHeaders,function(i){return i.CommitteeShortName==n&&i.LegislativeBody==t}),u==null))return null;f.maxRef(u.ReferralNumber);e={billStatusId:f.billInfo().BillId,billStatusActionId:r.BillStatusActionId,includeVotes:!0};f.reportFloorCommDetailFilter(e);$.getJSON(window.constants.api.floorCommittees,e).done(function(n){f.floorCommDetails(n)})};f.col1=ko.observable(0);f.col2=ko.observable(0);f.selectedVotesToDisplay=ko.observableArray([]);f.getSelectedVotesToDisplay=function(){if(f.billInfo()!=null&&f.billInfo().BodyTransmittedTo!=null&&f.floorCommDetails()!=null&&f.floorCommDetails().length>0){f.floorCommDetails()[0].Votes.length>0?f.showQualifyVotes(!0):f.showQualifyVotes(!1);var n=ko.utils.arrayFilter(f.floorCommDetails()[0].Votes,function(n){return f.selectedVoteOption()==""||f.selectedVoteOption()==undefined||(f.selectedVoteOption()=="Y"||f.selectedVoteOption()=="N"||f.selectedVoteOption()=="NV"||f.selectedVoteOption()=="EXC")&&n.Vote==f.selectedVoteOption()||(f.selectedVoteOption()=="D"||f.selectedVoteOption()=="R")&&n.Legislator.Party==f.selectedVoteOption()});if(n==null)return null;f.selectedVotesToDisplay(n);f.col1(0);f.col2(0);n.length<40?(n.length%2==1?f.col1(1):f.col1(0),f.col2(0)):n.length%3==2?(f.col1(1),f.col2(1)):n.length%3==1&&(f.col1(1),f.col2(0))}};f.selectedVoteOption.subscribe(function(){f.getSelectedVotesToDisplay()});f.floorCommDetails.subscribe(function(){f.setFloorDetails();f.setReferralInfo()});f.setReferralInfo=function(){f.maxRef()==1?f.showRef(!1):f.showRef(!0);f.referralText("Referral "+f.curRef()+" of "+f.maxRef());f.curRef()>1?f.showPriorRef(!0):f.showPriorRef(!1);f.maxRef()==1||f.curRef()==f.maxRef()?f.showNextRef(!1):f.showNextRef(!0)};f.rowCt=ko.observable();f.curOtherCommittee=ko.observable("");f.voteComments=ko.observable("");f.voteAddOns=ko.observable("");f.voteAddOns2=ko.observable("");f.voteAddOns3=ko.observable("");f.displayAction=ko.observable();f.commentHeader=ko.observable();f.setFloorDetails=function(){f.detailFloorHeader((f.bodyTab()=="H"?"House ":"Senate ")+f.floorCommDetails()[0].CommitteeName+(f.curRef()>1?" #"+f.curRef():"")+" - "+f.billNumber()+" "+f.billInfo().ShortTitle+(f.billInfo().NOWTitle>""?" (NOW: "+f.billInfo().NOWTitle+")":""));f.curRef()>1&&f.detailFloorHeader();f.showMotionButton(!1);f.voteAddOns("");f.voteComments("");f.displayAction(f.floorCommDetails()[0].Action);f.commentHeader("Amendments:");switch(f.floorCommDetails()[0].CommitteeShortName){case"COW":f.buttonLabel("Motion to Amend");f.commMotionExists()&&f.showMotionButton(!0);f.floorCommType(2);f.curOtherCommittee("MOTION");f.voteComments(f.floorCommDetails()[0].Comments);f.rowCt(5);break;case"ADCOW":f.buttonLabel("Motion to Amend");f.commMotionExists()&&f.showMotionButton(!0);f.floorCommType(2);f.curOtherCommittee("MOTIONADCOW");f.voteComments(f.floorCommDetails()[0].Comments);f.rowCt(5);break;case"MOTIONADCOW":f.buttonLabel("Add. Committee of the Whole");f.showMotionButton(!0);f.curOtherCommittee("ADCOW");f.voteComments(f.floorCommDetails()[0].Comments);f.rowCt(2);f.displayAction(f.getSimplePassFail());f.commentHeader("Motions:");break;case"MOTION":f.buttonLabel("Committee of the Whole");f.showMotionButton(!0);f.curOtherCommittee("COW");f.voteComments(f.floorCommDetails()[0].Comments);f.rowCt(2);f.displayAction(f.getSimplePassFail());f.commentHeader("Motions:");break;case"SCOW":f.buttonLabel("Motion to Amend");f.commMotionExists()&&f.showMotionButton(!0);f.floorCommType(2);f.curOtherCommittee("SITMOTION");f.voteComments(f.floorCommDetails()[0].Comments);f.rowCt(2);break;case"SITMOTION":f.displayAction(f.getSimplePassFail());f.commentHeader("Motions:");break;case"THIRD":f.voteAddOns(f.getAddOns());f.floorCommType(1);f.displayAction(f.getPassFail(f.floorCommDetails()[0].Ayes,f.floorCommDetails()[0].Nays,f.floorCommDetails()[0].Emergency,f.floorCommDetails()[0].RequestForEnactment,f.floorCommDetails()[0].TwoThirdVote,f.floorCommDetails()[0].RFEIR,f.floorCommDetails()[0].RFEIRSections,f.floorCommDetails()[0].UnanimouslyAdopted));break;case"CONCUR":f.voteAddOns(f.getAddOns());f.floorCommType(1);f.displayAction(f.getSimplePassFail());f.commentHeader("Motions:");break;case"FINAL":f.voteAddOns(f.getAddOns());f.displayAction(f.getPassFail(f.floorCommDetails()[0].Ayes,f.floorCommDetails()[0].Nays,f.floorCommDetails()[0].Emergency,f.floorCommDetails()[0].RequestForEnactment,f.floorCommDetails()[0].TwoThirdVote,f.floorCommDetails()[0].RFEIR,f.floorCommDetails()[0].RFEIRSections,f.floorCommDetails()[0].UnanimouslyAdopted));break;case"RECON_3RD":f.commentHeader("Motions:");f.voteComments(f.floorCommDetails()[0].Comments);f.displayAction(f.getSimplePassFail());break;case"RECON_FNL":f.commentHeader("Motions:");f.voteComments(f.floorCommDetails()[0].Comments);f.displayAction(f.getSimplePassFail());break;case"MISC":f.commentHeader("Motions:");f.voteComments(f.floorCommDetails()[0].Comments);f.displayAction(f.getSimplePassFail())}f.selectedVoteOption("")};f.getSimplePassFail=function(){if(f.floorCommDetails()[0].Action!==""&&f.floorCommDetails()[0].Action!=="None")return f.floorCommDetails()[0].Action;if((f.floorCommDetails()[0].Ayes||0)!=0&&(f.floorCommDetails()[0].Nays||0)!=0)return(f.floorCommDetails()[0].Ayes||0)>(f.floorCommDetails()[0].Nays||0)?"Passed":"Failed";var n=f.floorCommDetails()[0].Comments.toLowerCase();return n.includes("pass")||n.includes("carried")?"Passed":n.includes("failed")?"Failed":""};f.getPassFail=function(n,t,i,r,u,e,o,s){if(f.billInfo()==null)return"";var h="Failed";return i=="E"||r==1||u||0?f.bodyTab()=="H"?(n||0)>=40&&(h="Passed"):(n||0)>=20&&(h="Passed"):(e||0)!=0&&o==""?f.bodyTab()=="H"?(n||0)>45&&(h="Passed"):(n||0)>23&&(h="Passed"):s?h="Passed":(n||0)>(t||0)&&(f.bodyTab()=="H"?(n||0)>30&&(h="Passed"):(n||0)>15&&(h="Passed")),h};f.getAddOns=function(){var n="";return f.voteAddOns2(""),f.voteAddOns3(""),f.floorCommDetails()[0].Amended&&(n="Amended"),f.floorCommDetails()[0].Emergency=="W/O"?n==""?n="Without Emergency ":f.voteAddOns2("Without Emergency "):f.floorCommDetails()[0].Emergency=="E"&&(n==""?n="Emergency ":f.voteAddOns2("Emergency ")),f.floorCommDetails()[0].RequestForEnactment&&(n==""?n="RFE":f.voteAddOns2()==""&&f.voteAddOns2("RFE")),f.floorCommDetails()[0].RFEIR&&(f.bodyTab()=="H"&&f.floorCommDetails()[0].Ayes>40||f.bodyTab()=="S"&&f.floorCommDetails()[0].Ayes>20?n==""?(n="RFEIR Passed: ",f.floorCommDetails()[0].RFEIRSections&&(n+=" Sec."+f.floorCommDetails()[0].RFEIRSections)):f.voteAddOns2()==""?f.floorCommDetails()[0].RFEIRSections===""?f.voteAddOns2("RFEIR Passed: "):f.voteAddOns2("RFEIR Passed: Sec."+f.floorCommDetails()[0].RFEIRSections):f.floorCommDetails()[0].RFEIRSections>""?f.voteAddOns3("RFEIR Passed: Sec."+f.floorCommDetails()[0].RFEIRSections):f.voteAddOns3("RFEIR Passed: "):n==""?n=f.floorCommDetails()[0].RFEIRSections>""?"RFEIR Failed: Sec."+f.floorCommDetails()[0].RFEIRSections:"RFEIR Failed: ":f.voteAddOns2()==""?f.floorCommDetails()[0].RFEIRSections>""?f.voteAddOns2("RFEIR Failed: Sec."+f.floorCommDetails()[0].RFEIRSections):f.voteAddOns2("RFEIR Failed: "):f.floorCommDetails()[0].RFEIRSections>""?f.voteAddOns3("RFEIR Failed: Sec."+f.floorCommDetails()[0].RFEIRSections):f.voteAddOns3("RFEIR Failed: ")),f.floorCommDetails()[0].UnanimouslyAdopted&&(n=n+" Unanimously Adopted "),f.floorCommDetails()[0].TwoThirdVote&&(n=f.bodyTab()=="H"&&f.floorCommDetails()[0].Ayes>40||f.bodyTab()=="S"&&f.floorCommDetails()[0].Ayes>20?n+"Two/Third Vote passed":n+"Two/Third Vote Failed"),n.trim()};f.confMembers=ko.observableArray([]);f.ConfCommNotes=ko.observable("");f.ccMinorityReport=ko.observable(!1);f.ConfCommDetails=ko.observable();f.replacedMembers=ko.observableArray([]);f.loadConfCommDetails=function(){var n,t;if((f.detailFloorHeader(""),f.ConfCommNotes(""),f.ccMinorityReport(!1),f.confMembers([]),f.replacedMembers([]),f.ConfCommDetails([]),f.ConfCommDate()=="")||(f.bodyTab()=="S"?f.bodyConfMemmbersLabel("Senate Members"):f.bodyConfMemmbersLabel("House Members"),n=ko.utils.arrayFilter(f.billInfo().FloorHeaders,function(n){return n.LegislativeBody==f.bodyTab()&&n.CommitteeShortName=="CONF"}),n==null))return!1;f.detailFloorHeader((f.bodyTab()=="H"?"House ":"Senate ")+"Conference Committee - "+f.billNumber());t={billStatusId:f.billInfo().BillId,billStatusActionId:n[0].BillStatusActionId,includeVotes:!1,includeConfComm:!0,body:f.bodyTab()};$.getJSON(window.constants.api.floorCommittees,t).done(function(n){f.ConfCommDetails(n);var t="";f.ConfCommDetails()[0].Comments&&f.ConfCommDetails()[0].Comments!=null&&(t=f.ConfCommDetails()[0].Comments);f.ConfCommDetails()[0].MiscNotes!=""&&f.ConfCommDetails()[0].MiscNotes!=null&&(t=t?t+"\r"+f.ConfCommDetails()[0].MiscNotes:f.ConfCommDetails()[0].MiscNotes);f.ConfCommNotes(t)});$.getJSON(window.constants.api.confCommMembers,t).done(function(n){active=ko.utils.arrayFilter(n,function(n){return n.Active});f.confMembers(active);replaced=ko.utils.arrayFilter(n,function(n){return!n.Active});f.replacedMembers(replaced)})};f.loadOverviewCC=function(n){f.bodyTab(n);f.loadConfCommDetails()};f.ConfCommDetails.subscribe(function(){f.ConfCommDetails==null&&f.ccMinorityReport(!1);f.ConfCommDetails.MinorityReport?f.ccMinorityReport(!0):f.ccMinorityReport(!1)});f.qualifyOptions=[{Option:"All Votes",OptionVal:""},{Option:"Ayes Only",OptionVal:"Y"},{Option:"Nays Only",OptionVal:"N"},{Option:"Excused Members Only",OptionVal:"EXC"},{Option:"Not Voting Members Only",OptionVal:"NV"},{Option:"Democrat Votes",OptionVal:"D"},{Option:"Republican Votes",OptionVal:"R"}];f.selectedDoc=ko.observable("");f.setDocToDisplayName=function(n){f.selectedDoc(window.constants.azLegWebUrl+n.substring(0,n.length-3)+"pdf")};f.documents=ko.observableArray([]);f.docTypes=ko.observableArray([]);f.calendars=ko.observableArray([]);f.agendas=ko.observableArray([]);f.loadDocuments=function(){f.docTypes([]);f.billInfo()!=null&&(f.isLoadingDocs(!0),$.getJSON(window.constants.api.strDocType,{billStatusId:f.billInfo().BillId}).done(function(n){f.docTypes(n);$.getJSON(window.constants.api.calendarByBill,{billId:f.billInfo().BillId}).done(function(n){f.calendars(n)}).fail(function(){alert("Error retrieving calendar information.")});$.getJSON(window.constants.api.agenda,{billId:f.billInfo().BillId}).done(function(n){f.agendas(n);f.isLoadingDocs(!1)}).fail(function(){alert("Error retrieving agenda information.")})}).fail(function(){alert("Error loading bill documents, the server may be unavailable.")}))};f.justSATypes=function(){var n=ko.utils.arrayMap(f.sectionsAffected(),function(n){return n.EngrossedType});return n.sort()};f.distinctSA=ko.computed(function(){return ko.utils.arrayGetDistinctValues(f.justSATypes())});f.filterByType=function(n){return ko.utils.arrayFilter(f.sectionsAffected(),function(t){return t.EngrossedType==n})};f.sponsorByType2=function(){return ko.utils.arrayFilter(f.sponsors,function(n){return n.BillVersion().toUpperCase()==start})};f.sponsorByType=ko.computed(function(){var i=[],n,t;return ko.utils.arrayForEach(f.sponsors(),function(r){r.BillVersion!==n&&(n=r.BillVersion,t={letter:n,contacts:[]},i.push(t));t.contacts.push(r)}),i});f.keywords=ko.observableArray([]);f.getKeywords=function(){if(f.billInfo()==null||f.billInfo().BillId==null)return!1;f.isLoadingKeyword(!0);var n={billStatusId:f.billInfo().BillId};$.getJSON(window.constants.api.keyword,n).done(function(n){f.keywords(n);f.isLoadingKeyword(!1)})};f.loadBillSKS=function(){f.getKeywords();f.billInfo()!=null&&f.searchForSponsors(f.billInfo().BillId);f.getSectionsAffected()};f.sectionsAffected2=ko.observableArray([]);f.getSectionsAffected=function(){if(f.billInfo()==null||f.billInfo().BillId==undefined||f.isLoadingSA())return!1;f.sectionsAffected([]);f.sectionsAffected2([]);grouping=-1;f.isLoadingSA(!0);var n={billStatusId:f.billInfo().BillId};$.getJSON(window.constants.api.sectionsAffected,n).done(function(n){$.each(n,function(n,t){f.sectionsAffected().filter(function(n){return n.EngrossedType==t.EngrossedType}).length==0?(f.sectionsAffected.push({EngrossedType:t.EngrossedType,sections:ko.observableArray([t])}),grouping++):(saAdd=ko.utils.arrayFilter(f.sectionsAffected(),function(n){return n.EngrossedType==n.EngrossedType}),saAdd!=undefined&&saAdd[0].sections!=undefined&&saAdd[grouping].sections.push(t))});f.sectionsAffected2(f.distinctSA());f.isLoadingSA(!1)})};f.videoList=ko.observableArray([]);f.loadVideos=function(){var n;if(f.isLoading()||f.billInfo()==null)return!1;f.videoList([]);n={billStatusId:f.billInfo().BillId};$.getJSON(window.constants.api.invintusvideo,n).done(function(n){f.videoList(n);f.isLoadingVideo(!1)});f.curBillId(f.billInfo().BillId);return};f.printNoms=function(){printElement($("#printArea"))};f.printRTSCurrentBillPositions=function(){printElement($("#printRTSArea"))};f.selectedBillIds=ko.computed(function(){var n=[];return f.billInfo()==null?!1:(n.push(f.billInfo().BillId),n)});f.downloadStandingCommitteeReport=function(){if(f.billInfo()==null)return!1;var n=$("<form><\/form>").attr({method:"post",action:window.constants.ReportPath+"GetStandingCommitteeDetailReport"});$("<input>").attr({type:"hidden",name:"billStatusId",value:f.billInfo().BillId}).appendTo(n);$("<input>").attr({type:"hidden",name:"legislativeBody",value:f.filterStandingCommitteesByBody()}).appendTo(n);$("body").append(n);n[0].submit();n.remove()};f.downloadFloorCommitteeReport=function(){var n=$("<form><\/form>").attr({method:"post",action:window.constants.ReportPath+"GetFloorCommitteeDetailReport"});$("<input>").attr({type:"hidden",name:"billStatusId",value:f.reportFloorCommDetailFilter().billStatusId}).appendTo(n);$("<input>").attr({type:"hidden",name:"billStatusActionId",value:f.reportFloorCommDetailFilter().billStatusActionId}).appendTo(n);$("<input>").attr({type:"hidden",name:"actionStr",value:f.displayAction()}).appendTo(n);$("body").append(n);n[0].submit();n.remove()};f.downloadRTSCurrentBillPositionsReport=function(){if(f.billInfo()==null)return!1;var n=$("<form><\/form>").attr({method:"post",action:window.constants.ReportPath+"GetRTSCurrentBillPositionsReport"});$("<input>").attr({type:"hidden",name:"billStatusId",value:f.billInfo().BillId}).appendTo(n);$("<input>").attr({type:"hidden",name:"billNumber",value:f.billNumber()}).appendTo(n);$("body").append(n);n[0].submit();n.remove()};f.downloadRTSCommentReport=function(){if(f.billInfo()==null)return!1;var n=$("<form><\/form>").attr({method:"post",action:window.constants.ReportPath+"GetRTSCommentReport"});$("<input>").attr({type:"hidden",name:"id",value:f.billInfo().BillId}).appendTo(n);$("<input>").attr({type:"hidden",name:"billNumber",value:f.billNumber()}).appendTo(n);$("<input>").attr({type:"hidden",name:"cFlag",value:$("input:radio[name=radioc]:checked").val()}).appendTo(n);$("<input>").attr({type:"hidden",name:"sFlag",value:$("input:radio[name=radios]:checked").val()}).appendTo(n);$("body").append(n);n[0].submit();n.remove()};f.createRTSCSVfromData=function(n){if(f.billInfo()==null)return!1;var t=$("<form><\/form>").attr({method:"post",action:window.constants.ReportPath+"CreateCSVfromData"});$("<input>").attr({type:"hidden",name:"billStatusId",value:f.billInfo().BillId}).appendTo(t);$("<input>").attr({type:"hidden",name:"csvType",value:n}).appendTo(t);$("body").append(t);t[0].submit();t.remove()};f.printBillHistory=function(){if(f.billInfo()==null)return!1;var n=$("<form><\/form>").attr({method:"post",action:window.constants.ReportPath+"BillHistoryReportByBillId"});$("<input>").attr({type:"hidden",name:"billId",value:f.billInfo().BillId}).appendTo(n);$("body").append(n);n[0].submit();n.remove()}}NomineeSearchViewModel=function(n){var t=this;t.selectedSessionId=ko.observable(n).subscribeTo(window.constants.sessionPubSubName);t.name=ko.observable("");t.nominees=ko.observableArray();t.isLoading=ko.observable(!1);t.isLoadingAgencies=ko.observable(!1);t.showGrid=ko.observable(!1);t.selectedAgency=ko.observable("");t.selectedNominee=ko.observable("");t.agencies=ko.observableArray();t.positions=ko.observableArray();t.isLoadingAgencyData=ko.observable(!1);t.currentSessionOnly=ko.observable(!0);t.selectedCommittee=ko.observable("");t.committees=ko.observableArray([]);t.priorTerm=ko.observable("");t.priorCommittee=ko.observable("");t.priorCurrentSessionValue=ko.observable(!0);t.loadNominees=function(){var n=t.selectedCommittee()!=""&&t.selectedCommittee()!=undefined,i;n&&t.currentSessionOnly(!0);i={term:t.name(),currentSessionOnly:t.currentSessionOnly(),committeeId:t.selectedCommittee()?t.selectedCommittee().CommitteeId:null,sessionId:t.currentSessionOnly()?t.selectedSessionId():null};$.trim(t.name())!=""||n?(t.isLoading(!0),t.priorTerm(t.name()),t.priorCommittee(t.selectedCommittee()),t.priorCurrentSessionValue(t.currentSessionOnly()),$.getJSON(window.constants.api.nomineePosition,i).done(function(n){t.nominees(n);t.isLoading(!1);t.showGrid(!0)}).fail(function(){alert("Error retrieving nominees.")})):alert("Please provide a search value or select a committee.")};t.resultsHeader=ko.computed(function(){var n="",i;return t.priorTerm!=undefined&&t.priorTerm()!=""&&(n='"'+t.priorTerm()+'"'),t.priorCommittee()!=""&&t.priorCommittee()!=undefined&&(i=(t.priorCommittee().LegislativeBody()=="S"?"Senate ":"House ")+t.priorCommittee().CommitteeName()+" Committee",n=n.length>0?n+" in "+i:i),n});t.loadNomineeDetails=function(n){t.selectedNominee(ko.mapping.fromJS(n))};t.currentSessionOnly.subscribe(function(){t.loadAgencies(!0)});t.selectedSessionId.subscribe(function(){t.loadAgencies(!0);t.loadCommittees(!0)});t.selectedCommittee.subscribe(function(){t.selectedCommittee()!=undefined&&t.selectedCommittee()!=""&&t.currentSessionOnly(!0)});t.loadAgencies=function(n){t.positions([]);(t.agencies()==undefined||t.agencies()==""||n)&&(t.isLoadingAgencies(!0),$.getJSON(window.constants.api.agency,{sessionId:t.currentSessionOnly()?t.selectedSessionId():null}).done(function(n){ko.mapping.fromJS(n,{},t.agencies);t.isLoadingAgencies(!1)}).fail(function(){alert("Error loading agencies, the server may be unavailable.")}))};t.loadCommittees=function(){t.nominees([]);$.getJSON(window.constants.api.committee,{standingOnly:!0,sessionId:t.selectedSessionId,legislativeBody:"S"}).done(function(n){ko.mapping.fromJS(n,{},t.committees)}).fail(function(){alert("Error loading committees, the server may be unavailable.")})};t.selectedAgency.subscribe(function(){t.selectedAgency()!=""&&t.selectedAgency()!=undefined&&(t.isLoadingAgencyData(!0),t.positions([]),$.getJSON(window.constants.api.agency,{id:t.selectedAgency().AgencyId,sessionId:t.currentSessionOnly()?t.selectedSessionId():null}).done(function(n){ko.mapping.fromJS(n.Positions,{},t.positions);t.isLoadingAgencyData(!1)}))});t.printNoms=function(){printElement($("#printArea"))};t.printAgency=function(){printElement($("#agencyDetail"))}}