var Epic,__extends;$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.AuthenticatedWidgetHelpers=$$WP.Scheduling.AuthenticatedWidgetHelpers||{};$$WP.Scheduling.OnMyWay=$$WP.Scheduling.OnMyWay||{};$$WP.Scheduling.OnMyWay.AuthenticatedWidgetHelpers=$$WP.Scheduling.OnMyWay.AuthenticatedWidgetHelpers||{};$$WP.Scheduling.OnMyWay.AuthenticatedWidgetHelpers.SetUpWidget=function(n){$$WPUtil.ShowAjaxSpinner($afe.select(".ajaxspinner"));initLegacyWidgetAuth(n,function(){$.ajax({url:makeLink("Widget/GetWidgetAuthCode"),type:"POST",cache:!1,data:{apiKey:n},dataType:"json",headers:{Authorization:$$WP.WidgetAccessToken},success:$$WP.Scheduling.OnMyWay.AuthenticatedWidgetHelpers.RedirectToAuthWidget})})};$$WP.Scheduling.OnMyWay.AuthenticatedWidgetHelpers.RedirectToAuthWidget=function(n){var t=n.AuthCode,i,r;$$WPUtil.IsNullOrEmpty(t)?$$WP.Scheduling.OnMyWay.AuthenticatedWidgetHelpers.RedirectToStandardWidget():(i=location.search+"&authcode="+t,r=makeLink("OnMyWay/AuthenticatedWidget")+i,location.assign(r))};$$WP.Scheduling.OnMyWay.AuthenticatedWidgetHelpers.RedirectToStandardWidget=function(){var n=new URLSearchParams(location.search);n.delete("apiKey");location.assign(makeLink("OnMyWay/Widget?"+n.toString()))};$$WP.Scheduling.AuthenticatedWidgetHelpers.RefreshAuthCode=function(){$.ajax({url:makeLink("Widget/RefreshAuthCode"),type:"POST",cache:!1,success:$$WP.Scheduling.AuthenticatedWidgetHelpers.__onAuthCodeRefreshed})};$$WP.Scheduling.AuthenticatedWidgetHelpers.__onAuthCodeRefreshed=function(n){var i=n.AuthCode,t;$$WPUtil.IsNullOrEmpty(i)||(t=new URLSearchParams(location.search),t.set("authcode",i),location.search="?"+t.toString())};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.Utilities=$$WP.Scheduling.Utilities||{};$$WPSchedulingUtil=$$WP.Scheduling.Utilities;$$WPSchedulingUtil.PreloginTimeoutSeconds=600;$$WPSchedulingUtil.PreloginTimer=null;$$WPSchedulingUtil.FocusElement=function(n){$$WP.WidgetMode&&!document.hasFocus()||n.focus()};$$WPSchedulingUtil.AnnounceMessage=function(n){var i=$afe.select("#announcementcontainer"),t;i.empty();t=$$WP.SimpleTemplates.Span({id:"announcementtext","class":"offscreen","aria-live":"assertive","aria-atomic":"true",role:"alert"});t.text(n);i.safeAppend(t)};$$WPSchedulingUtil.ScrollToTopOfPageIfEmbeddedInIframe=function(){(isDataTile()||$$WP.WidgetMode)&&$$WPSchedulingUtil.ScrollToTopOfPage()};$$WPSchedulingUtil.ScrollToTopOfPage=function(){var n=$afe.jq($afe.select("div.actionNodeWorkflow.active div.nodeTitle")).height(),t=$afe.select("#wrap"),i=!!document.querySelector("#main h1");$$WP.WidgetMode&&!document.hasFocus()||(isDataTile()?scrollTopOfTheIframe(0,!0):$$WP.WidgetMode?$$WPUtil.ScrollTopOfTheIframeCrossDomain():$$WP.Utilities.UI.IsMobile&&n>0?$$WPUtil.SmoothScrollToElementWithOffset($$WPUtil.ScrollableBody(),t,n,300):$$WP.Utilities.UI.IsSmallScreen()&&$$WP.Utilities.UI.IsLoggedIn&&i?($$WP.Utilities.UI.CollapseHeader(),$$WPUtil.SmoothScrollToElementWithOffset($$WPUtil.ScrollableBody(),$afe.select("#main"),-13,300)):$$WPUtil.SmoothScrollToElement($$WPUtil.ScrollableBody(),t,300))};$$WPSchedulingUtil.RemoveDuplicateElementsFromArray=function(n){for(var t=0,i=null,r=[],t=0;t<n.length;t++)i=n[t],-1===r.indexOf(i)&&r.push(i);return r};$$WPSchedulingUtil.IsValueInAllArrays=function(n,t){for(var i=0,i=0;i<t.length;i++)if(-1===t[i].indexOf(n))return!1;return!0};$$WPSchedulingUtil.GetIntersectionOfArrays=function(n){for(var t=0,u=[],r=null,i=n.shift(),t=0;t<i.length;t++)r=i[t],$$WPSchedulingUtil.IsValueInAllArrays(r,n)&&u.push(r);return u};$$WPSchedulingUtil.GetUnionOfArrays=function(n){for(var i=0,t=0,r=[],u=[],i=0;i<n.length;i++)for(r=n[i],t=0;t<r.length;t++)-1===u.indexOf(r[t])&&u.push(r[t]);return u};$$WPSchedulingUtil.DoAllArraysContainTheSameValues=function(n){var t=$$WPSchedulingUtil.GetUnionOfArrays(n),i=$$WPSchedulingUtil.GetIntersectionOfArrays(n);return t.length>0&&t.length===i.length};$$WPSchedulingUtil.ConstructAppointmentStringHtml=function(n,t,i,r,u){var h,f=$$WP.Strings.getNamespace("Scheduling"),o="",c="",l="",a="",v="",s="",e=null,y=r&&!!n&&!$$WP.Utilities.IsNullOrEmpty(n.Name);return u=!!u,f.addMnemonics({"@MYCHART@DEPARTMENT@":{Value:t.Name,EncodingType:$$WP.Strings.EncodingTypes.HTML},"@MYCHART@REASONFORVISIT@":{Value:i,EncodingType:$$WP.Strings.EncodingTypes.HTML}}),y?u?(e=document.createElement("use"),v=makeStaticImageLink("library.svg#hyperlink"),e.setAttribute("xlink:href",v),WP.DOM.Browser.isIE?($$WP.Svg.Helpers.loadSingleSvgIcon(e),s=new Handlebars.SafeString(e.innerHTML)):s=new Handlebars.SafeString(e.outerHTML),f.addMnemonic("@MYCHART@PROVIDER@",n.Name,$$WP.Strings.EncodingTypes.HTML),l=f.getString("ProviderDetailsTooltip"),a=f.getString("ProviderDetailsLabel"),c='<a class="providerBioLink" href="'+makeLink(n.WebPageUrl)+'" aria-label="'+a+'" target="_blank" title="'+l+'">'+HTMLEncode(n.Name)+'<svg class="jumpArrow" aria-hidden="true">'+s+"<\/svg><\/a>",f.addMnemonic("@MYCHART@LINKEDPROVIDER@",c,$$WP.Strings.EncodingTypes.None),o="ConfirmRfvWithLinkedProvider"):(f.addMnemonic("@MYCHART@PROVIDER@",n.Name,$$WP.Strings.EncodingTypes.HTML),o="ConfirmProviderRfv"):(f.addMnemonic("@MYCHART@PROVIDER@","",$$WP.Strings.EncodingTypes.HTML),o="ConfirmRfv"),h=f.getString(o),f.removeMnemonic("@MYCHART@PROVIDER@"),f.removeMnemonic("@MYCHART@LINKEDPROVIDER@"),f.removeMnemonic("@MYCHART@DEPARTMENT@"),f.removeMnemonic("@MYCHART@REASONFORVISIT@"),h};$$WPSchedulingUtil.GetVTMWarningMessages=function(n){var r=[],i=$$WP.Strings.getNamespace("Scheduling"),t;if(n)for(t=0;t<n.length;t++)i.addMnemonics({"@MYCHART@MINIMUMAGE1@":{Value:n[t].MinAge1,EncodingType:$$WP.Strings.EncodingTypes.None},"@MYCHART@MAXIMUMAGE1@":{Value:n[t].MaxAge1,EncodingType:$$WP.Strings.EncodingTypes.None},"@MYCHART@MINIMUMAGE2@":{Value:n[t].MinAge2,EncodingType:$$WP.Strings.EncodingTypes.None},"@MYCHART@MAXIMUMAGE2@":{Value:n[t].MaxAge2,EncodingType:$$WP.Strings.EncodingTypes.None}}),r.push(i.getString(n[t].WarningCode)),i.clearMnemonics();return r};$$WPSchedulingUtil.GetVTMWarningBannerModel=function(n){var t=null,r=0,i=$$WPSchedulingUtil.GetVTMWarningMessages(n),u=$$WP.Strings.getNamespace("Scheduling");if(i.length>0)if((t={}).BannerType="informationalType",t.DisableDetailTextHtmlEncoding=!0,1===i.length)t.DetailText="<span>"+HTMLEncode(i[0])+"<\/span>";else{for(t.DetailText="<span>"+HTMLEncode(u.getString("GenericAgeVTMWarning"))+'<\/span><ul class="VTMWarningList">',r=0;r<i.length;r++)t.DetailText+="<li>"+HTMLEncode(i[r])+"<\/li>";t.DetailText+="<\/ul>"}return t};$$WPSchedulingUtil.BuildProvidersFiltered=function(n,t,i,r,u,f){for(var o,s={},e=0;e<u.length;e++)s[u[e].ID]=!0;return o=$$WPSchedulingUtil.BuildProviderDepartmentPairsFiltered(n,i,r),$$WPSchedulingUtil.AddProvidersFromProviderDepartmentPairs(o,t,s,f)};$$WPSchedulingUtil.BuildProviderDepartmentPairsFiltered=function(n,t,i){var r=[];return i&&(r=n&&t?i.RequestProviderDepartmentPairs:i.AllProviderDepartmentPairs),r};$$WPSchedulingUtil.AddProvidersFromProviderDepartmentPairs=function(n,t,i,r){for(var u=0,e=null,f=null,o=[],s=n.length,u=0;u<s;u++)e=n[u],t&&!i[e.DepartmentId]||(f=e.Provider,!r&&f.OtherOption||-1!==o.indexOf(f)||o.push(f));return o};$$WPSchedulingUtil.GetMinutesAndHoursFromMinutes=function(n){var i,r,t=$$WP.Strings.getNamespace("Scheduling"),u=Math.floor(n/60),f=n%60;return!n||n<=0?"":(t.addMnemonics({"@MYCHART@HOURS@":{Value:u,EncodingType:$$WP.Strings.EncodingTypes.HTML},"@MYCHART@MINUTES@":{Value:f,EncodingType:$$WP.Strings.EncodingTypes.HTML}}),r=$$WPSchedulingUtil.GetDurationStringResourceName(u,f),i=t.getString(r),t.removeMnemonic("@MYCHART@HOURS@"),t.removeMnemonic("@MYCHART@MINUTES@"),i)};Handlebars.registerHelper("durationInHoursAndMinutes",$$WPSchedulingUtil.GetMinutesAndHoursFromMinutes);$$WPSchedulingUtil.GetRoughProgressThroughWorkflow=function(n,t){return 5*Math.round(20*n/t)};$$WPSchedulingUtil.GetDurationStringResourceName=function(n,t){return n>1?t>0?"DurationHoursAndMinutes":"DurationHours":1===n?t>0?"DurationHourAndMinutes":"DurationOneHour":"DurationMinutes"};$$WPSchedulingUtil.CanUsePermissionsApi=function(){return"object"==typeof navigator.permissions};$$WPSchedulingUtil.CheckIfGeolocationPermissionsAreDenied=function(n){$$WPSchedulingUtil.CanUsePermissionsApi()&&navigator.permissions.query({name:"geolocation"}).then(function(t){"denied"===t.state&&n()})};$$WPSchedulingUtil.HandleStickyBanner=function(){setTimeout(function(){$afe.jq(window).trigger("handleStickyBanner")},0)};$$WPSchedulingUtil.GetDateFieldValidationSettings=function(n,t,i){return new $$WP.FormValidation.ValidationSettings({required:i,isDate:!0,minDate:n,maxDate:t})};$$WPSchedulingUtil.FormatDteAsDate=function(n){var t=null,i="";return $$WPUtil.IsNullOrEmpty(n)||(t=new $$WP.I18N.Date(formatDate(WP.Utils.dte2date(n)),"string"),i=$$WP.I18N.formatPatientGivenDate(t.DateObject)),i};$$WPSchedulingUtil.ShouldTreatAsAnonymous=function(n){return n.IsAnonymous||n.IsFromPrelogin};$$WPSchedulingUtil.SetPreloginTimeout=function(){function t(){var n={positioningFunction:$$WP.WidgetMode?$$WPContain.Positions.InsideNearTop:$$WPContain.Positions.InsideCentered},t={SecondsLeft:30,isPreLogin:!0},i=function(){for(var n=this.window.location.href,r=["slotuid","slotUid"],t="",i=0;i<r.length;i++)t=r[i],$$WPUtil.IsNullOrEmpty($$WPUtil.GetQueryStringParameterValue(n,t))||(n=$$WPSchedulingUtil.RemoveQueryStringParameter(n,t));return n}();$$WPUtil.IsNullOrEmpty(i)||(t.preLoginRedirectURL=i);$$WPUtil.quickPopup(new $$WPComp.TimeoutWarningComponent(t),n);n.positioningFunction===$$WPContain.Positions.InsideNearTop&&$$WPSchedulingUtil.ScrollToTopOfPage()}function n(){$$WPSchedulingUtil.ClearPreloginTimeout();$$WPSchedulingUtil.PreloginTimer=setTimeout(t,1e3*$$WPSchedulingUtil.PreloginTimeoutSeconds)}$$WP.Utilities.UI.IsLoggedIn||$$WP.WidgetMode&&!document.hasFocus()||(n(),document.addEventListener("click",n,!0),document.addEventListener("keydown",n,!0),document.addEventListener("scroll",n,!0))};$$WPSchedulingUtil.ClearPreloginTimeout=function(){clearTimeout($$WPSchedulingUtil.PreloginTimer)};$$WPSchedulingUtil.RemoveQueryStringParameter=function(n,t){var i=n.split("?"),u=i[0],r=new URLSearchParams(i[1]);return r.delete(t),u+"?"+r.toString()};$$WPSchedulingUtil.GetEndpointUrl=function(n,t){return $$WP.WidgetMode?"Scheduling/Embedded/"+n:$$WPSchedulingUtil.IsWorkflowTreatedAsAnonymous(t)?"Scheduling/Anonymous/"+n:"Scheduling/"+n};$$WPSchedulingUtil.RedirectToLogin=function(n,t,i,r){$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("SchedulingRedirectToLogin",t)),data:$$WPUtil.postify(n),cache:!1,success:i,error:r})};$$WPSchedulingUtil.IsWorkflowTreatedAsAnonymous=function(n){return n.IsAnonymous};$$WPSchedulingUtil.SetUpInstructions=function(n){var r,u,t=$afe.select("#apptinstructions .visitinstructionscontent"),i=$afe.select("#deptinstructions .visitinstructionscontent");i=i.not(":has(.instructionContent)");t=t.not(":has(.instructionContent)");n||(n=$$WPSchedulingUtil.SetUpInstructionsViewModel(t,i));t.length>0&&new $$WP.Visits.PatientInstructionController(t,n.PatientInstructions);n.CanShowDepartmentDirections&&i.length>0&&($$WP.Strings.setDefaultNamespace("Visits"),r=n.DepartmentDirections.join("<\/br>"),u=$$WP.Strings.get("ViewFullDirectionsButtonText"),new $$WP.Visits.PatientInstructionController(i,r,null,u))};$$WPSchedulingUtil.SetUpInstructionsViewModel=function(n,t){var i={};return n.length>0&&(i.PatientInstructions=n[0].innerHTML),t.length>0&&(i.DepartmentDirections=[t[0].innerHTML],i.DepartmentDirections&&(i.CanShowDepartmentDirections=!0)),i};$$WPSchedulingUtil.ReturnToStep=function(n,t,i,r,u){var f;null!==(f=$$WPSchedulingUtil.GetStepModelOfTypeNoAncestor(t,n,u))?(r&&$$WPSchedulingUtil.SetPropertyOnStepAndAncestors(f,t,"ForceShowOnce",!0),$$WPSchedulingUtil.SetPropertyOnStepAndAncestors(f,t,"ActiveStatus",$$WP.Scheduling.SchedulingStep.ActiveEnum.Active)):$.isFunction(i)&&i()};$$WPSchedulingUtil.ReturnToSlotStepAndReloadSlots=function(n){n.AppointmentBuilder.deselectAllSlots();$$WPSchedulingUtil.ReturnToStep($$WP.Scheduling.SchedulingStep.StepTypeEnum.Slot,n,null,!1);n.AppointmentBuilder.setProperty("CountOfFailedAttemptsToReviewSlot",n.AppointmentBuilder.CountOfFailedAttemptsToReviewSlot+1)};$$WPSchedulingUtil.CanEditStep=function(n,t,i,r){var u,f,e;return f=$$WPSchedulingUtil.CanEditIfHidden(t),u=$$WPSchedulingUtil.GetStepModelOfType(n,i),e=$$WPSchedulingUtil.CanEditStepType(n,i),!!u&&e&&(!u.IsHidden||f)&&!r};$$WPSchedulingUtil.CanEditIfHidden=function(n){return $$WP.Scheduling.Workflow.isWorkflowTypeOpenSchedulingWidget(n)};$$WPSchedulingUtil.CanEditStepType=function(n,t){switch(t){case $$WP.Scheduling.SchedulingStep.StepTypeEnum.Location:return $$WPSchedulingUtil.CanEditLocation(n);case $$WP.Scheduling.SchedulingStep.StepTypeEnum.Provider:return $$WPSchedulingUtil.CanEditProvider(n);default:return!0}};$$WPSchedulingUtil.CanEditLocation=function(n){for(var i=null,r=null,t=0,u=n.SchedulingSteps.Models,f=n.AppointmentBuilder.getAppointment(n.AppointmentBuilder.getActiveApptIndex()),e=f.VisitType,o=n.AppointmentBuilder.AvailableLocations,t=0;t<u.length;t++)(r=u[t]).Type===$$WP.Scheduling.SchedulingStep.StepTypeEnum.Location&&(i=r);return(!o||1!==n.AppointmentBuilder.AvailableLocations[n.AppointmentBuilder.getActiveApptIndex()].length)&&(!(!i||i.IsHidden)||!!n.AppointmentBuilder.hasMultipleInPersonLocations()||!!(e&&e.ShowLocationStepForTelehealthVisit&&f.hasAValidLocation()))};$$WPSchedulingUtil.CanEditProvider=function(n){return n.AppointmentBuilder.hasAppointmentThatAllowsProviderSelection()};$$WPSchedulingUtil.GetStepModelOfType=function(n,t){for(var r=null,i=0;i<n.SchedulingSteps.Models.length;i++)if(n.SchedulingSteps.Models[i].Type===t)return r=n.SchedulingSteps.Models[i],$$WPSchedulingUtil.GetStepAncestor(r,n);return null};$$WPSchedulingUtil.GetStepModelOfTypeNoAncestor=function(n,t,i){var r=0;for(null==i&&(i=0),r=0;r<n.SchedulingSteps.Models.length;r++)if(n.SchedulingSteps.Models[r].Type===t){if(0===i)return n.SchedulingSteps.Models[r];i--}return null};$$WPSchedulingUtil.SetPropertyOnStepAndAncestors=function(n,t,i,r){for(n.setProperty(i,r);n&&""!==n.StackId;)(n=t.SchedulingSteps.getFromIndex("ID",n.StackId)).setProperty(i,r)};$$WPSchedulingUtil.GetStepAncestor=function(n,t){for(;n&&""!==n.StackId;)n=t.SchedulingSteps.getFromIndex("ID",n.StackId);return n};$$WPSchedulingUtil.GetLocationsSummaryArray=function(n){var t=0,f=0,r=null,i=[],u=[],e=!0;if($$WPSchedulingUtil.AllowsLocationsSeparate(n)){for(t=0;t<n.AppointmentBuilder.numAppointments();t++)r=n.AppointmentBuilder.getAppointment(t),e=e&&r.IsLocationAnyOptionSelected;for(t=0;t<n.AppointmentBuilder.numAppointments();t++)u=$$WPSchedulingUtil.GetLocationsSummaryArrayForAppt(n,t,i,e),i=i.concat(u)}else f=n.AppointmentBuilder.getActiveApptIndex(),r=n.AppointmentBuilder.getAppointment(f),u=$$WPSchedulingUtil.GetLocationsSummaryArrayForAppt(n,f,i,r.IsLocationAnyOptionSelected),i=i.concat(u);return $$WPSchedulingUtil.TrimViewModelArray(i,1)};$$WPSchedulingUtil.GetLocationsSummaryArrayForAppt=function(n,t,i,r){var e=null,u=[],f=null,o=$$WP.Scheduling.Location.SortMethodEnum.Alphabetically;return e=n.AppointmentBuilder.getAppointment(t),r?(f=n.Locations.getFromIndex("Id","-1"),-1===i.indexOf(f)&&u.push(f)):(u=e.Locations.toArray().slice(),$$WP.Scheduling.Location.sortLocations(u,o)),u};$$WPSchedulingUtil.AllowsLocationsSeparate=function(n){var t=n.AppointmentBuilder.getFirstAppointment().PanelId,i=!$$WPUtil.IsNullOrEmpty(t),r=!$$WPUtil.IsNullOrEmpty(n.AppointmentBuilder.getFirstAppointment().BundleId);return i?n.VisitTypes.getFromIndex("ID",t).HasSeparateLocationSelectionInPanels:!!r&&n.HasSeparateLocationSelectionInTicketBundles};$$WPSchedulingUtil.GetProvidersSummaryArray=function(n){var i=0,u=0,t=[],r=[];if(n.AppointmentBuilder.IsSlotStepMultiApptPreGrouped)for(i=0;i<n.AppointmentBuilder.numAppointments();i++)r=$$WPSchedulingUtil.GetProvidersSummaryArrayForAppt(n,i,t),t=t.concat(r);else u=n.AppointmentBuilder.getActiveApptIndex(),r=$$WPSchedulingUtil.GetProvidersSummaryArrayForAppt(n,u,t),t=t.concat(r);return $$WPSchedulingUtil.TrimViewModelArray(t,1)};$$WPSchedulingUtil.GetProvidersSummaryArrayForAppt=function(n,t,i){var r=null,u=[],f=null;return r=n.AppointmentBuilder.getAppointment(t),$$WP.Scheduling.Workflow.allowProviderSelectForAppointment(n.AppointmentBuilder,r)&&(r.IsProviderAnyOptionSelected?(f=n.Providers.getFromIndex("ID","-2"),-1===i.indexOf(f)&&u.push(f)):(u=r.Providers.toArray().slice()).sort($$WP.Scheduling.Provider.sortProviders)),u};$$WPSchedulingUtil.TrimViewModelArray=function(n,t){var r=0,i=[];return $$WPUtil.IsNullOrEmpty(t)&&(t=3),(i=$$WPSchedulingUtil.RemoveDuplicateElementsFromArray(n)).length>t+1&&(r=i.length,i.splice(t),i.push({Name:r-t+" "+$$WP.Strings.get("MoreLabel","Scheduling")})),i};$$WPSchedulingUtil.GetCondensedFilterString=function(n){var t="";return 1===n.length?t=n[0].Name:2===n.length&&($$WP.Strings.addMnemonic("@MYCHART@LOCATION1@",n[0].Name),$$WP.Strings.addMnemonic("@MYCHART@LOCATION2@",n[1].Name),t=$$WP.Strings.getNamespace("Scheduling").getStringForTemplate("SelectedLocations"),$$WP.Strings.removeMnemonic("@MYCHART@LOCATION1@"),$$WP.Strings.removeMnemonic("@MYCHART@LOCATION2@")),t};$$WPSchedulingUtil.ShowWorkflowLoadingIndicator=function(){$afe.select("#scheduling-workflow").addClass("faded");$$WPUtil.ShowAjaxSpinner($afe.select(".schedulingSpinner .ajaxspinner"))};$$WPSchedulingUtil.HideWorkflowLoadingIndicator=function(){$afe.select("#scheduling-workflow").removeClass("faded");$$WPUtil.HideAjaxSpinner($afe.select(".schedulingSpinner .ajaxspinner"))};$$WPSchedulingUtil.RegisterConfirmationPartials=function(){Handlebars.registerPartial("Scheduling.SlotArrivalAndTime",$$WP.Templates.Scheduling.SlotArrivalAndTime);Handlebars.registerPartial("Scheduling.ConfirmationInfoRow",$$WP.Templates.Scheduling.ConfirmationInfoRow);Handlebars.registerPartial("Scheduling.SolutionDetailed",$$WP.Templates.Scheduling.SolutionDetailed);Handlebars.registerPartial("Scheduling.SolutionAlerts",$$WP.Templates.Scheduling.SolutionAlerts);Handlebars.registerPartial("Scheduling.Payment",$$WP.Templates.Scheduling.Payment)};$$WPSchedulingUtil.GetPreviousVisibleStep=function(n,t,i){var u,r=0;if(0===n)return null;for(r=n-1;r>=0;r--)if(u=t[r],i.SchedulingSteps.getFromIndex("ID",u.Id).CompleteStatus!==$$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)return r;return null};$$WPSchedulingUtil.CreateBrowserId=function(){for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="",i=0;i<20;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t+Math.round(Date.now()/1e3).toString()};$$WPSchedulingUtil.OnMyChartLinkClicked=function(n,t,i,r){var u,f=(new Date).toISOString(),e=makeLink(i);u=$$WPUtil.IsNullOrEmpty(r)?function(){$$WPUtil.TryRedirect(e)}:function(){WP.FdiUtils.ExecuteFDILink(r)};$$WP.Scheduling.SchedulingController.logSchedulingViewEvent($$WP.Analytics.ViewEvent.SubmodulesEnum.MyChartLinkStep,f,null,t,n,u)};$$WPSchedulingUtil.GetVisitDisplayName=function(n,t,i){var r=0,u="",f=null,e="";if(n&&1===n.AppointmentRequestIds.length&&$$WPUtil.IsNullOrEmpty(n.PanelId)&&t)for(f=t.AppointmentRequests,e=n.AppointmentRequestIds[0],r=0;r<f.length;r++)f[r].ID===e&&(u=f[r].DisplayName);return $$WPUtil.IsNullOrEmpty(u)&&n&&n.VisitType&&(u=$$WPUtil.IsNullOrEmpty(i)||$$WPUtil.IsNullOrEmpty(n.VisitType.TelehealthModeDisplayNames)||$$WPUtil.IsNullOrEmpty(n.VisitType.TelehealthModeDisplayNames[i])?n.VisitType.DisplayName:n.VisitType.TelehealthModeDisplayNames[i]),u};$$WPSchedulingUtil.GetDisplayDepartmentAddress=function(n){var t;for($$WPUtil.IsNullOrEmpty(n.Address)||(t=" • "),i=0;i<n.Address.length;i++)t+=" "+n.Address[i];return t};$$WPSchedulingUtil.GetDisplayPhonenumber=function(n){var t;return $$WPUtil.IsNullOrEmpty(n.OverridePhoneNumber)?$$WPUtil.IsNullOrEmpty(n.PhoneNumber)||(t=" • "+n.PhoneNumber):t=" • "+n.OverridePhoneNumber,t};$$WPSchedulingUtil.GetVisitDisplayNameFromComponent=function(n,t,i){var r=0,u="",f=null,e="";if(n&&1===n.AppointmentRequestIds.length&&!i&&t)for(f=t.AppointmentRequests,e=n.AppointmentRequestIds[0],r=0;r<f.length;r++)f[r].ID===e&&(u=f[r].DisplayName);return $$WPUtil.IsNullOrEmpty(u)&&n&&n.DefaultVisitType&&(u=n.DefaultVisitType.DisplayName),u};$$WPSchedulingUtil.IsStandaloneWidget=function(n){return n.isTypeOpenSchedulingWidget()&&!$$WP.WidgetMode};$$WPSchedulingUtil.HideBackButton=function(){var n=document.querySelector(".md_scheduling_index .previousstep");n&&n.classList.add("hidden")};$$WPSchedulingUtil.NullifyIfFalsy=function(n){return n||null};$$WPSchedulingUtil.GetTimePreferenceRangeProps=function(n){return{DayOfWeekIndex:n.data("day-index"),StartTime:$$WPSchedulingUtil.ParseTime(n.data("begin-time")),EndTime:$$WPSchedulingUtil.ParseTime(n.data("end-time")),RangeString:n.data("message-range-value"),RangeElement:n.data("range-element")}};$$WPSchedulingUtil.ParseTime=function(n){var i,t;if(2===(t=n.toUpperCase().split(" ")).length){if("PM"===t[1])i=12;else{if("AM"!==t[1])return;i=0}i+=parseInt(t[0])%12}else{if(1!==t.length)return;i=parseInt(t[0])}if(2===(t=t[0].split(":")).length)return 3600*(i+=parseInt(t[1])/60)};$$WPSchedulingUtil.Reload=function(n){n?$$WP.Scheduling.AuthenticatedWidgetHelpers.RefreshAuthCode():location.reload()};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.ReactHelpers=$$WP.Scheduling.ReactHelpers||{};$$WP.Scheduling.ReactHelpers.convertStoreToLowercase=function(n){var t={};return Object.keys(n).reduce(function(i,r){return"object"==typeof n[r]&&(i[$$WP.Scheduling.ReactHelpers.lowercaseProperty(r,t)]=$$WP.Scheduling.ReactHelpers.getLowercaseCollectionCopy(n[r],t)),i})};$$WP.Scheduling.ReactHelpers.getLowercaseCollectionCopy=function(n,t){var i="";return Object.keys(n).reduce(function(r,u){return i=$$WP.Scheduling.ReactHelpers.lowercaseProperty(u,t),n[u],r[i]=$$WP.Scheduling.ReactHelpers.lowercaseObject(n[u],t),r})};$$WP.Scheduling.ReactHelpers.lowercaseObject=function(n,t){var r=Object.keys(n),i="";return"string"==typeof n?n:n instanceof Date?n.toISOString():r.reduce(function(r,u){return i=$$WP.Scheduling.ReactHelpers.lowercaseProperty(u,t),r[i]=Array.isArray(n[u])?$$WP.Scheduling.ReactHelpers.lowercaseArray(n[u],t):n[u]instanceof $$WP.Common.ModelCollection?$$WP.Scheduling.ReactHelpers.lowercaseArray(n[u].Models,t):n[u]&&"object"==typeof n[u]?$$WP.Scheduling.ReactHelpers.lowercaseObject(n[u],t):n[u],r},{})};$$WP.Scheduling.ReactHelpers.lowercaseProperty=function(n,t){if(!t[n])switch(n){case"ID":t[n]="id";break;case"DateTimeUtc":t[n]="displayDateTimeUtc";break;default:t[n]=n.slice(0,1).toLowerCase()+n.slice(1)}return t[n]};$$WP.Scheduling.ReactHelpers.lowercaseArray=function(n,t){for(var r=[],i=0,i=0;i<n.length;i++)r.push($$WP.Scheduling.ReactHelpers.lowercaseObject(n[i],t));return r};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.SlotReservationHelpers=$$WP.Scheduling.SlotReservationHelpers||{};$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners=$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners||{};$$WP.Scheduling.SlotReservationHelpers.MakeReservation=function(n,t,i,r){if(!n.IsSlotSelectionBlocked&&null===n.getFirstApptWithUnselectedSlot()){n.setProperty("IsSlotSelectionBlocked",!0);var u={appointmentBuilder:n.toSparseRawRequestObject(),workflow:t.toRawRequestObject(),clientTimeZoneOffset:(new Date).getTimezoneOffset()};$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("ReserveAppointment",t)),data:$$WPUtil.postify(u),success:i,error:r})}};$$WP.Scheduling.SlotReservationHelpers.DeleteReservationFromSlot=function(n,t){$$WPUtil.SendBeacon(makeLink($$WPSchedulingUtil.GetEndpointUrl("DeleteReservationFromSlot",t)),JSON.stringify(n.toRawObject()));$$WP.Scheduling.SlotReservationHelpers.DestroyReservationCleanUpListenerFromSlot(n)};$$WP.Scheduling.SlotReservationHelpers.CleanUpOpenSchedulingSession=function(n){$$WPUtil.SendBeacon(makeLink("Scheduling/Anonymous/CleanUpOpenSchedulingSession"),n);$$WP.Scheduling.SlotReservationHelpers.DestroyReservationCleanUpListenerFromToken(n)};$$WP.Scheduling.SlotReservationHelpers.CreateReservationCleanUpListenerFromSlot=function(n,t){var i=$.proxy(function(){$$WP.Scheduling.SlotReservationHelpers.DeleteReservationFromSlot(n,t)},this);WP.Events.addListener(window,"pagehide",i);$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners[n.ReservationKey]=i};$$WP.Scheduling.SlotReservationHelpers.CreateReservationCleanUpListenerFromToken=function(n){var t=$.proxy(function(){$$WP.Scheduling.SlotReservationHelpers.CleanUpOpenSchedulingSession(n)},this);WP.Events.addListener(window,"pagehide",t);$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners[n]=t};$$WP.Scheduling.SlotReservationHelpers.DestroyReservationCleanUpListenerFromSlot=function(n){var t=$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners[n.ReservationKey];WP.Events.removeListener(window,"pagehide",t);$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners[n.ReservationKey]=null};$$WP.Scheduling.SlotReservationHelpers.DestroyReservationCleanUpListenerFromToken=function(n){var t=$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners[n];WP.Events.removeListener(window,"pagehide",t);$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners[n]=null};$$WP.Scheduling.SlotReservationHelpers.DestroyAllReservationCleanUpListeners=function(){var t=null,n=null;for(t in $$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners)n=$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners[t],$$WPUtil.IsNullOrEmpty(n)||WP.Events.removeListener(window,"pagehide",n);$$WP.Scheduling.SlotReservationHelpers.__reservationCleanUpListeners={}};!function(){var u=$$WP.Scheduling.ReactHelpers,n=function(){this.WP$Controllers$Controller();this.proxify("__registerReactHandlers","__tryToSetActiveAppointment")},i=null,t=function(){return i||(i=new n),i},r=function(){var n=$afe.select("#OriginalAppointmentInfo");return 0===n.length&&(n=$$WP.SimpleTemplates.Div({id:"OriginalAppointmentInfo"})),n};n.prototype={originalApptCount:0,__$parent:null,__isFirstRender:!0,__setActiveAppointment:null,__appointmentDatToActivate:"",__initializeData:function(n,t){var i={originalAppointments:u.lowercaseArray(n,{}),workflowType:t,register:this.__registerReactHandlers};EpicPx.addReactPortal("@epic-px/scheduling","OriginalAppointmentInfoHost",i,"OriginalAppointmentInfoHost");this.originalApptCount=n.length},__registerReactHandlers:function(n){this.__setActiveAppointment=$.proxy(function(){n(this.__appointmentDatToActivate);this.__appointmentDatToActivate=""},this);$$WPUtil.IsNullOrEmpty(this.__appointmentDatToActivate)||this.__setActiveAppointment()},__tryToSetActiveAppointment:function(n){this.__appointmentDatToActivate=n;this.__setActiveAppointment&&this.__setActiveAppointment()},__render:function(n){var t=r();this.__$parent=n;this.__$parent.safeAppend(t);this.__isFirstRender&&(EpicPx.addReactPortal("@epic-px/scheduling","OriginalAppointmentInfo",{},"OriginalAppointmentInfo"),this.__isFirstRender=!1)},__stashPortal:function(){var n=r();$afe.select("#OriginalAppointmentInfoHost").safeAppend(n)},__destroy:function(){this.__initializeData([]);EpicPx.removeReactPortal("OriginalAppointmentInfo");EpicPx.removeReactPortal("OriginalAppointmentInfoHost")}};n.Initialize=function(n,i){t().__initializeData(n,i)};n.Update=function(n,i,r){var u=t(),f="",e=1===n.AppointmentBuilder.numAppointments()&&u.originalApptCount>1;(r||e)&&(f=function(n){var t=n.AppointmentBuilder.getAppointment(n.AppointmentBuilder.getActiveApptIndex());return t?t.RescheduleDat:""}(n));u.__tryToSetActiveAppointment(f);u.__render(i)};n.Render=function(n){t().__render(n)};n.StashPortal=function(){t().__stashPortal()};n.Destroy=function(){t().__destroy()};n.extend($$WP.Controllers.Controller,"WP$Scheduling$OriginalAppointmentInfoController");$$WP.Scheduling.OriginalAppointmentInfoController=n}();!function(){var n=function(){this.__collectionEventListeners=[];this.__collectionPropertyEventListeners=[];this.__modelPropertyEventListeners=[]};n.prototype={__collectionEventListeners:[],__collectionPropertyEventListeners:[],__modelPropertyEventListeners:[],addCollectionEventListener:function(n,t,i,r){var u=n.addCollectionEventListener(t,i,r),f={Collection:n,EventName:t,ListenerId:u};this.__collectionEventListeners.push(f)},addCollectionPropertyListener:function(n,t,i,r){var u=n.addPropertyListener(t,i,r),f={Collection:n,PropertyName:t,ListenerId:u};this.__collectionPropertyEventListeners.push(f)},addModelPropertyListener:function(n,t,i,r){var u=n.addPropertyListener(t,i,r),f={Model:n,PropertyName:t,ListenerId:u};this.__modelPropertyEventListeners.push(f)},removelListenersFromModel:function(n){for(var i=null,t=0,t=this.__modelPropertyEventListeners.length-1;t>=0;t--)(i=this.__modelPropertyEventListeners[t]).Model===n&&(i.Model.removePropertyListener(i.ListenerId),this.__modelPropertyEventListeners.splice(t,1))},removeAllListeners:function(){for(var t=null,n=0,n=0;n<this.__collectionEventListeners.length;n++)(t=this.__collectionEventListeners[n]).Collection.removeCollectionEventListener(t.EventName,t.ListenerId);for(this.__collectionEventListeners=[],n=0;n<this.__collectionPropertyEventListeners.length;n++)(t=this.__collectionPropertyEventListeners[n]).Collection.removePropertyListener(t.PropertyName,t.ListenerId);for(this.__collectionPropertyEventListeners=[],n=0;n<this.__modelPropertyEventListeners.length;n++)(t=this.__modelPropertyEventListeners[n]).Model.removePropertyListener(t.ListenerId);this.__modelPropertyEventListeners=[]}};$$WP.Scheduling.EventManager=n}();$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.Utilities=$$WP.Scheduling.Utilities||{};$$WPSchedulingUtil=$$WP.Scheduling.Utilities;$$WPSchedulingUtil.GetCaptchaLightbox=function(n){return resetLightbox(),showLightBox('<div class="captchaLightbox"><\/div>',n),$afe.select("#lightbox").addClass("captchaPopup"),$afe.select(".captchaLightbox")};$$WPSchedulingUtil.InitializeCaptchaLightbox=function(){adjustLightbox();$$WPSchedulingUtil.__setLightboxAriaProps();$$WPSchedulingUtil.__addLightboxKeydownListener();$$WPSchedulingUtil.__addLightboxCloseButton();$$WPSchedulingUtil.__addLightboxHeader();$afe.select("#ReservationStepTitle").focus();$$WPSchedulingUtil.ScrollToTopOfPageIfEmbeddedInIframe();isDataTile()&&(WP.DOM.Browser.isIPhone||WP.DOM.Browser.isIPad||WP.DOM.Browser.isIPod)&&window.setTimeout(function(){adjustLightbox()},300)};$$WPSchedulingUtil.IsCaptchaLightboxOpen=function(){return 0!==$afe.select(".captchaLightbox").length};$$WPSchedulingUtil.__setLightboxAriaProps=function(){var t=$afe.select("#lightbox"),n=$afe.select("#captchaLightboxLabel"),i=$afe.select(".captchaLightbox > .clearlabel");t.safeAttr("role","dialog");t.safeAttr("aria-modal","true");0!==i.length&&i.safeAttr("aria-hidden","true");0===n.length&&(n=$afe.select("#lightbox .visuallabel"));0!==n.length&&(n.safeAttr("id","captchaLightboxLabel"),t.safeAttr("aria-labelledby","ReservationStepTitle"))};$$WPSchedulingUtil.__addLightboxKeydownListener=function(){$afe.select("#lightbox").on("keydown",function(n){var t=n.which;27===t?$$WPSchedulingUtil.CloseCaptchaLightbox():9===t&&$$WPSchedulingUtil.__trapCaptchaFocus(n)})};$$WPSchedulingUtil.CloseCaptchaLightbox=function(){resetLightbox()};$$WPSchedulingUtil.__trapCaptchaFocus=function(n){var i=$afe.select("#lightbox"),r=WP.DOM.Search.getNextFocusable(i.get(0)),u=WP.DOM.Search.getLastFocusable(i.get(0)),t=null;n.shiftKey&&n.target===r?t=u:n.shiftKey||n.target!==u||(t=r);t&&(t.focus(),n.preventDefault())};$$WPSchedulingUtil.__addLightboxCloseButton=function(){var t=$$WP.Strings.getNamespace("Scheduling"),i=$afe.select("#lightbox"),n=null,r=$$WPSchedulingUtil.__getCaptchaLightboxContainer();0!==i.length&&0===$afe.select("#lightbox .closeLightbox").length&&((n=$afe.jq(document.createElement("button"))).addClass("closeLightbox"),n.safeAttr("tabindex","0"),n.safeAttr("aria-label",t.getString("ClosePopupLabel")),n.safeAttr("role","button"),n.on("click",$$WPSchedulingUtil.CloseCaptchaLightbox),r.safeAfter(n))};$$WPSchedulingUtil.__getCaptchaLightboxContainer=function(){return $afe.select(".captchaLightbox .captchaContainer")};$$WPSchedulingUtil.__addLightboxHeader=function(){if(0!==$afe.select("#lightbox").length){var t=$$WPSchedulingUtil.__getCaptchaLightboxContainer(),n=$afe.jq(document.createElement("h2"));$$WP.Strings.setDisplayText(n,"ReservationStepTitle","Scheduling");n.safeAttr("id","ReservationStepTitle");n.safeAttr("tabindex","0");n.addClass("header center");n.safeInsertBefore(t)}};!function(){var n=function(t,i,f,e,o,s,h,c,l){$$WP.Utilities.IsNullOrEmpty(timePreferenceConfig)?$$WP.Debug.logError("There is no timePreferenceConfig loaded on the page yet. put @Html.Raw(MyChartWebSettings.TimePreferenceConfig.GetScriptTag()) on page.",!1):(this._Id=u++,this.$root=t,this._isSingleSelect=l,this.OnFilePreferences=r(o),this._generateStrings(o,s),$$WP.Utilities.IsNullOrEmpty(e)&&(e=n.LabelValueEnum.AllAvailable),this.proxify("_onToggleButtonClick"),this.$root.on("click",".togglebutton.clearradio.preferencetype",this._onToggleButtonClick),this.proxify("_onToggleButtonDblClick"),this.$root.on("dblclick","label.togglebutton[for*='schedpref']",this._onToggleButtonDblClick),this._viewModel=this._generateViewModel(timePreferenceConfig,i),this.$root.safeAppend($afe.renderTemplate($$WP.Templates.UI.TimePreferenceWidget,this._viewModel)),this._markSelected(e,h,c),this._bindChangeFunction(f))},i={$root:null,OnFilePreferences:null,PreferredDaysString:null,PreferredTimesString:null,_viewModel:null,_Id:null,_isSingleSelect:null,_generateViewModel:function(n,t){var i,e,h,f,u,l,v,r,s,o,p,a,c,y="";if(!Array.isArray(n.Days))return null;for(h=0,l=[],u={},v=[],f=[],i=0;i<n.Days.length;i++)if(n.Days[i].Ranges.length>0){for(l.push({Display:n.Days[i].Display,DayOfWeek:n.Days[i].DayOfWeek,RangeOption:[]}),f.push({}),f[h].DayDisplay=n.Days[i].Display,f[h].DayIndex=n.Days[i].DayOfWeek,e=0;e<n.Days[i].Ranges.length;e++)f[h][n.Days[i].Ranges[e].Element]=!0,u.hasOwnProperty(n.Days[i].Ranges[e].Element)||(u[n.Days[i].Ranges[e].Element]=n.Days[i].Ranges[e]);h++}if(o={},null!==t)for(o={},i=0;i<t.length;i++)o[t[i].RangeElement]=o[t[i].RangeElement]||[!1,!1,!1,!1,!1,!1,!1],o[t[i].RangeElement][t[i].DayIndex]=!0;for(r in u){for(s={Display:u[r].Display,Abbrev:u[r].Abbrev,DaysOption:[]},a=$$WP.Strings.getNamespace("UI.TimePreferenceWidget"),i=0;i<f.length;i++)p=!(null===t||!Array.isArray(o[r]))&&o[r][f[i].DayIndex],f[i][r]?(a.addMnemonics({"@MYCHART@DAY@":{Value:f[i].DayDisplay,EncodingType:$$WP.Strings.EncodingTypes.None},"@MYCHART@TIMERANGE@":{Value:u[r].Display,EncodingType:$$WP.Strings.EncodingTypes.None}}),""===(y=u[r].MessageOverride)&&(y=u[r].Display),c={Showing:!0,DayIndex:f[i].DayIndex,Value:f[i].DayDisplay+" "+u[r].Display,BeginTime:u[r].BeginTime,EndTime:u[r].EndTime,RangeElement:r,Selected:p,OptionTitle:a.getString("OptionTitle"),MessageRangeString:y},s.DaysOption.push(c),c.Abbrev=s.Abbrev,c.Display=s.Display,l[i].RangeOption.push(c),a.clearMnemonics()):s.DaysOption.push({Showing:!1});v.push(s)}return{TitleLine:l,RangeLines:v,Id:this._Id,hasOnFilePreferences:null!==this.OnFilePreferences,DaysString:this.PreferredDaysString,TimesString:this.PreferredTimesString,IsSingleSelect:this._isSingleSelect}},_generateStrings:function(n,t){var u,i,o,e,f,r;if(u=$$WP.Strings.getNamespace("UI.TimePreferenceWidget"),0===n.Days.length)this.PreferredDaysString=u.getString("NoPreferredDay");else for(this.PreferredDaysString=t[n.Days[0]-1],i=1;i<n.Days.length;i++)this.PreferredDaysString+=", "+t[n.Days[i]-1];if(0===n.Times.length)e=[u.getString("NoPreferredTime")];else{for(f=[],i=0;i<n.Times.length;i++)r={startVal:n.Times[i][0],endVal:n.Times[i][1],startText:n.TimeStrings[i][0],endText:n.TimeStrings[i][1]},f.push(r);for(f.sort(function(n,t){return n.startVal-t.startVal}),e=[],i=0;i<f.length;i++)o=0===(r=f[i]).startVal?u.getString("NoPreferredTime"):r.startText,o+=86400===r.endVal?" - "+u.getString("NoPreferredTime"):" - "+r.endText,e.push(o)}this.PreferredTimesString=e.join(", ")},_bindChangeFunction:function(n){var t;t=this.$root;"function"==typeof n&&this.$root.find("input.clearradio, input.radio").change(function(){n(t.find(".timepreferencewidget input[type='checkbox']:checked"),t.find(".timepreferencewidget input.clearradio.preferencetype:checked"),!1,t.find(".daytimetable input.clearradio").index(this))})},_onToggleButtonClick:function(n){var t,i;$afe.jq(n.target).is("input.togglebutton")&&(t=n.target,i=$afe.jq(t).val(),this._markSelected(i,!0),$afe.jq(t).trigger("change"))},_onToggleButtonDblClick:function(){return!1},_markSelected:function(n,i,r){var u,f,e;u=this.$root.find("input.clearradio.preferencetype[value="+n+"]");$$WP.Utilities.UI.ToggleButtonClick(u[0],null,1);(e=u.get(0).value)===t.AllAvailable&&(this.$root.find(".preference").addClass("hidden"),this.$root.find(".timeTable #"+this._Id+"_daytimetable").addClass("hidden"));e===t.OnFile&&(this.$root.find(".preference").removeClass("hidden"),this.$root.find(".timeTable #"+this._Id+"_daytimetable").addClass("hidden"));e===t.Other&&(this.$root.find(".preference").addClass("hidden"),this.$root.find(".timeTable #"+this._Id+"_daytimetable").removeClass("hidden"));u.prop("checked",!0);$.isNumeric(r)&&r>=0&&(f=$afe.jq(this.$root.find(".daytimetable input.clearradio").get(r)));!$$WP.Utilities.IsNullOrEmpty(f)&&f.is("[type=checkbox]")&&i?f.focus():i&&u.focus()}},t={AllAvailable:"1",OnFile:"2",Other:"3"},r=function(n){var r,i,t;if(0===n.Days.length&&0===n.Times.length)return null;if(r=Array([],[],[],[],[],[],[]),i=[],0===n.Times.length)i.push([0,86400]);else for(t=0;t<n.Times.length;t++)i.push([n.Times[t][0],n.Times[t][1]]);if(0===n.Days.length)for(t=0;t<7;t++)r[t]=i;else for(t=0;t<n.Days.length;t++)r[n.Days[t]-1]=i;return r},u=0;n.prototype=i;n.LabelValueEnum=t;n.extend($$WP.Controllers.Controller,"WP$Utilities$UI$TimePreferenceWidgetController");$$WP.Utilities.UI.TimePreferenceWidgetController=n}();!function(){var n=function(){this.WP$Controllers$Controller();this.proxify("__onCaptchaSuccessCallback","__onSecureSessionCreated","__onDemographicVerificationFormSubmit","__onDemographicVerificationCaptchaSuccess","__onError")};n.prototype={__workflow:null,__accessCode:"",__accessCodeFirstName:"",__isDemographicAuthRequired:!1,__captcha:null,__onSessionEstablishedCallback:null,__onErrorCallback:null,__onCaptchaContentRenderedCallback:null,__onContainerUsageCompleteCallback:null,Initialize:function(n,t,i,r){this.__workflow=n;this.__accessCode=t;this.__isDemographicAuthRequired=i;this.__accessCodeFirstName=r},IsContainerRequired:function(){return!this.__hasActiveSession()&&(!!$$WP.Captcha&&$$WP.Captcha.IsVisible()&&!!$$WP.Settings&&!$$WP.Settings.IsCaptchaDisabled||this.__isDemographicAuthRequired)},EstablishSession:function(n,t,i,r,u){this.__onSessionEstablishedCallback=n;this.__onErrorCallback=t;this.__onCaptchaContentRenderedCallback=r;this.__onContainerUsageCompleteCallback=u;this.__hasActiveSession()?this.__tryRunCallback(this.__onSessionEstablishedCallback):this.IsContainerRequired()?this.__drawContentInContainer(i):this.__drawAndSubmitInvisibleCaptcha()},ResetSession:function(){this.__captcha&&this.__captcha.Reset();this.__workflow&&(this.__workflow.SecureSessionToken="")},__drawAndSubmitInvisibleCaptcha:function(){var n=$afe.select(".invisibleCaptchaContainer");this.__captcha=new $$WP.Captcha(n);this.__captcha.Render();this.__showAjaxSpinner();setTimeout(this.__hideAjaxSpinner,3e3);this.__captcha.GetResponse(this.__onCaptchaSuccessCallback,this.__onError)},__drawContentInContainer:function(n){var t={IsDemographicAuthRequired:this.__isDemographicAuthRequired,ValidationSettings:new $$WP.FormValidation.ValidationSettings({required:!0,isDate:!0,maxDate:new Date,minDate:new Date(1900,0,0)}),FirstName:this.__accessCodeFirstName};n.safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.SecureSessionContent,t));$$WP.FormValidation.initializeDOMSubtree(n);this.__drawCaptchaInContainer(n.find(".captchaContainer"));t.IsDemographicAuthRequired&&(n.find(".demographicAuthForm").submit(function(n){n.preventDefault()}),n.find("#captchaConfirm").on("click",this.__onDemographicVerificationFormSubmit))},__drawCaptchaInContainer:function(n){this.__captcha=new $$WP.Captcha(n,this.__onCaptchaSuccessCallback);this.__captcha.Render();this.__tryRunCallback(this.__onCaptchaContentRenderedCallback)},__hasActiveSession:function(){var n=!$$WP.Utilities.IsNullOrEmpty(this.__workflow.SecureSessionToken);return!$$WPSchedulingUtil.IsWorkflowTreatedAsAnonymous(this.__workflow)||n},__onDemographicVerificationFormSubmit:function(){this.__isDemographicVerificationFormValid()&&this.__captcha.GetResponse(this.__onDemographicVerificationCaptchaSuccess,this.__onError)},__isDemographicVerificationFormValid:function(){return $afe.select("#DOBVerify").trigger("change"),$$WP.FormValidation.checkIfFormIsValid($afe.select(".demographicAuthForm"),!1)},__onDemographicVerificationCaptchaSuccess:function(n){var t=$afe.select("#DOBVerify").val();this.__createSecureSession(n,this.__accessCode,t)},__onCaptchaSuccessCallback:function(n){this.__hideAjaxSpinner();this.__isDemographicAuthRequired||this.__createSecureSession(n)},__createSecureSession:function(n,t,i){this.__showAjaxSpinner();$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("CreateSecureSession",this.__workflow)),captchaResponse:n,data:{accessCode:t,userEnteredDateOfBirth:i},cache:!1,success:this.__onSecureSessionCreated,error:this.__onError});$$WP.Captcha.IsVisible()||this.__captcha.Reset()},__onError:function(){this.__hideAjaxSpinner();this.__tryRunCallback(this.__onContainerUsageCompleteCallback);this.__tryRunCallback(this.__onErrorCallback)},__onSecureSessionCreated:function(n){this.__hideAjaxSpinner();$$WPUtil.IsNullOrEmpty(n.SessionToken)?n.IsDateOfBirthVerificationFailure?($$WP.FormValidation.addValidationError($afe.select("#DOBVerify"),"IncorrectDateOfBirth"),this.ResetSession()):this.__onError():(this.__workflow.SecureSessionToken=n.SessionToken,this.__tryRunCallback(this.__onContainerUsageCompleteCallback),this.__tryRunCallback(this.__onSessionEstablishedCallback))},__tryRunCallback:function(n){"function"==typeof n&&n()},__showAjaxSpinner:function(){$$WPUtil.ShowAjaxSpinner($afe.select(".captchaLoadingHeart .ajaxspinner"))},__hideAjaxSpinner:function(){$$WPUtil.HideAjaxSpinner($afe.select(".captchaLoadingHeart .ajaxspinner"))}};$$WP.Scheduling.SecureSessionController=n;n.extend($$WP.Controllers.Controller,"WP$Scheduling$SecureSessionController")}();!function(){var f="Gender",r="Languages",i="PatientAge",t="IsInNetwork",e=$$WP.Scheduling.Workflow,u=function(n,t,i,r,u){this.WP$Controllers$Controller();this.proxify("__onExpandFilters","__onCollapseFilters","__onFilterSelectionChanged");this.__filterTemplate=$$WP.Templates.Scheduling.Filters;this.__appointmentBuilder=t;this.__appointments=this.__appointmentBuilder.Appointments;this.__setSelectedProviders();this.__activeAppointmentIndex=this.__appointmentBuilder.getActiveApptIndex();this.__defaultLanguages=n;this.__isShowingOneAppointment=!this.__appointmentBuilder.IsSlotStepMultiApptPreGrouped;this.__workflow=i;this.__filterSettings=r;this.__preselectedFilters=u||[];this.__initialPreselectedFilterGroups=[];this.__processPreselectedFilters();this.__checkNetworkFilterByDefault=this.__filterSettings.IsInsuranceSelectionValid&&this.__workflow.Type===e.WorkflowTypesEnum.ProviderFinder;this.__filterProvDeptPairsOnFirstRender=this.__checkNetworkFilterByDefault||this.__preselectedFilters.length>0};u.prototype={__$root:null,__filterTemplate:null,__selectedFilters:[],__availableProviders:[],__availableProviderDepartmentPairs:[],__selectedProviders:[],__expandedFilters:[],__defaultLanguages:null,__appointments:null,__switchedAvailableProviders:!1,__totalFilterSelections:[],__filtersMatrix:[],__activeAppointmentIndex:null,__isShowingOneAppointment:null,__workflow:null,__providerDepartmentFilterListeners:[],__checkNetworkFilterByDefault:!1,__filterSettings:null,__filterProvDeptPairsOnFirstRender:!1,__preselectedFilters:[],__initialPreselectedFilterGroups:[],__setSelectedProviders:function(){var n,t;for(this.__selectedProviders=[],n=0;n<this.__appointmentBuilder.numAppointments();n++)t=this.__appointmentBuilder.getAppointment(n).Providers,this.__selectedProviders[n]=t},__generateViewModel:function(n){var u,f,e,s,h,c,o;if(this.__activeAppointmentIndex=this.__appointmentBuilder.getActiveApptIndex(),this.__isShowingOneAppointment=!this.__appointmentBuilder.IsSlotStepMultiApptPreGrouped,this.__filtersMatrix=this.__getFilters(this.__filterSettings.FiltersToLoad),null!==n&&n.length>0)for(u=0;u<n.length;u++)for(s=n[u].GroupIndex,h=n[u].OptionIndex,f=0;f<this.__filtersMatrix.length;f++)if(this.__filtersMatrix[f].name==s){for(e=0;e<this.__filtersMatrix[f].options.length;e++)if(this.__filtersMatrix[f].options[e].name===h){this.__filtersMatrix[f].options[e].selected=!0;break}break}for(c=this.__getViewFiltersMatrix(this.__filtersMatrix),o=[],u=0;u<this.__defaultLanguages.length;u++)o[u]={languageName:this.__defaultLanguages[u].Title};return{filtersMatrix:c,isProviderFilteringAvailable:this.isProviderFilteringAvailable(),languageGroupName:r,patientAgeName:i,defaultLanguages:o,hasDefaultLanguage:null!==this.__defaultLanguages||0!==this.__defaultLanguages.length,insuranceName:t}},__getViewFiltersMatrix:function(n){for(var i,r=[],u,t=0;t<n.length;t++)if(n[t].options.length<=3)n[t].show=!1,r.push(n[t]);else{for(n[t].show=!0,u=!1,-1!==this.__expandedFilters.indexOf(n[t].name)&&(u=!0),i=0;i<n[t].options.length;i++)n[t].options[i].hideOption=this.__isFilterOptionHidden(u,i,3);u?(n[t].collapsed=!1,r.push(n[t])):r.push({name:n[t].name,options:n[t].options,title:n[t].title,collapsed:!0,show:!0})}return r},isAnyProviderDepartmentFilterSelected:function(){return this.getListOfSelectedProviderDepartmentFilters().length>0},getListOfSelectedProviderDepartmentFilters:function(){for(var t,r,u=[],i=this.getSelectedFilters(),n=0;n<i.length;n++)t=i[n].GroupIndex,r=i[n].OptionIndex,this.__isFilterProviderDepartment(t)&&u.push({GroupIndex:t,OptionIndex:r});return u},updateAvailableProviders:function(n,t){var i=[];this.__areAvailableProvidersEmpty(t)?this.__availableProviders[t]=n:(i=[this.__availableProviders[t],n],$$WPSchedulingUtil.DoAllArraysContainTheSameValues(i)||(this.__availableProviders[t]=n,this.clearAllFilters()));this.__activeAppointmentIndex=this.__appointmentBuilder.getActiveApptIndex()},updateAvailableProviderDepartmentPairs:function(n,t){var i=[];this.__areAvailableProviderDepartmentPairsEmpty(t)?this.__availableProviderDepartmentPairs[t]=n:(i=[this.__availableProviderDepartmentPairs[t],n],$$WPSchedulingUtil.DoAllArraysContainTheSameValues(i)||(this.__availableProviderDepartmentPairs[t]=n,this.clearAllFilters()));this.__activeAppointmentIndex=this.__appointmentBuilder.getActiveApptIndex()},__areAvailableProvidersEmpty:function(n){return this.__hasDataAtAppointmentIndex(this.__availableProviders,n)},__areAvailableProviderDepartmentPairsEmpty:function(n){return this.__hasDataAtAppointmentIndex(this.__availableProviderDepartmentPairs,n)},__hasDataAtAppointmentIndex:function(n,t){return 0===n.length||null===n[t]||void 0===n[t]||""===n[t]},__isFilterOptionHidden:function(n,t,i){return!(t<i)&&t>=i&&!n},__hasOnlyProviderDepartmentsThatSeeAllAges:function(){for(var t,i=!0,r=null,u=!0,f=!0,n=0;n<this.__availableProviderDepartmentPairs.length;n++){for(t=0;t<this.__availableProviderDepartmentPairs[n].length;t++)if(u=-1!==(r=this.__availableProviderDepartmentPairs[n][t]).PatientAge.indexOf($$WP.Scheduling.FilterController.PatientAgeFilterSeesChildrenValue()),f=-1!==r.PatientAge.indexOf($$WP.Scheduling.FilterController.PatientAgeFilterSeesAdolescentsValue()),!u||!f){i=!1;break}if(!i)break}return i},__isFiltersOptionsStatic:function(n){switch(n){case i:case t:return!0;default:return!1}},isFiltersOptionsMutuallyExclusive:function(){return!1},__isFilterProviderDepartment:function(n){switch(n){case i:case t:return!0;default:return!1}},__getDefaultOptionForStatic:function(){return filter,""},__getStaticOptions:function(n,r){switch(n){case i:r.push({group:"PatientAge",hideOption:!1,name:$$WP.Scheduling.FilterController.PatientAgeFilterSeesChildrenValue(),selected:this.__isFilterPreselected("PatientAge",$$WP.Scheduling.FilterController.PatientAgeFilterSeesChildrenValue()),isMutuallyExclusive:this.isFiltersOptionsMutuallyExclusive(n)},{group:"PatientAge",hideOption:!1,name:$$WP.Scheduling.FilterController.PatientAgeFilterSeesAdolescentsValue(),selected:this.__isFilterPreselected("PatientAge",$$WP.Scheduling.FilterController.PatientAgeFilterSeesAdolescentsValue()),isMutuallyExclusive:this.isFiltersOptionsMutuallyExclusive(n)});break;case t:r.push({group:"IsInNetwork",hideOption:!1,name:$$WP.Strings.get("InsuranceFilterOptionText","Scheduling"),selected:this.__checkNetworkFilterByDefault,isMutuallyExclusive:!1});break;default:return}},__isFilterPreselected:function(n,t){for(var r,i=0;i<this.__preselectedFilters.length;i++)if(0===(r=this.__preselectedFilters[i]).FilterGroup.localeCompare(n)&&0===r.FilterValue.localeCompare(t))return!0;return!1},__wasFilterGroupPreselected:function(n){return 1===this.__initialPreselectedFilterGroups[n]},__getFilters:function(n){var s,f,i,h,v=[],y=!1,e=[],c=[],l,a;if(this.__isShowingOneAppointment)e=this.__availableProviders[this.__activeAppointmentIndex],c=this.__availableProviderDepartmentPairs[this.__activeAppointmentIndex];else{for(f=0;f<this.__availableProviders.length;f++)for(l=this.__availableProviders[f],i=0;i<l.length;i++)-1===e.indexOf(l[i])&&e.push(l[i]);for(f=0;f<this.__availableProviderDepartmentPairs.length;f++)for(a=this.__availableProviderDepartmentPairs[f],i=0;i<a.length;i++)-1===c.indexOf(a[i])&&c.push(a[i])}if(h=e.length,this.__determineAllProvDeptPairValues(c,this.__appointmentBuilder.getAppointment(this.__activeAppointmentIndex)),h>1){for(s=0;s<n.length;s++){var o=[],u=n[s],p=this.__getNumProvidersWithOptions(u,e);this.__showFilterGroup(p,h,u)&&(this.__addFilterOptions(h,e,u,[],o),(o.length>1||this.__wasFilterGroupPreselected(u)||(0===u.localeCompare(r)||0===u.localeCompare(t))&&o.length>=1)&&(this.__switchedAvailableProviders&&(y=this.__reselectFiltersAfterProviderSwitch(o)),v.push({name:u,options:o,title:$$WP.Strings.get("FilterGroupTitle_"+u,"Scheduling"),collapsed:!0,isMutuallyExclusive:this.isFiltersOptionsMutuallyExclusive(u)})))}y&&this.filterProvidersBySelection()}return this.__switchedAvailableProviders=!1,v},__determineAllProvDeptPairValues:function(n,t){var i;if(void 0!==n)for(i=0;i<n.length;i++)n[i].determinePatientAge(t.VisitType.ID),n[i].setNetworkStatusOnProvider()},__addFilterOptions:function(n,t,i,r,u){var o,s,f,e;if(this.__isFiltersOptionsStatic(i))this.__getStaticOptions(i,u);else{for(o=0;o<n;o++)if(f=t[o][i],Array.isArray(f))for(s=0;s<f.length;s++)e=f[s],this.__shouldAddOption(e,r,i)&&(u.push({name:e,group:i,selected:this.__isFilterPreselected(i,e),hideOption:!1,isMutuallyExclusive:this.isFiltersOptionsMutuallyExclusive(i)}),r.push(e));else this.__shouldAddOption(f,r,i)&&(u.push({name:f,group:i,selected:this.__isFilterPreselected(i,f),hideOption:!1,isMutuallyExclusive:this.isFiltersOptionsMutuallyExclusive(i)}),r.push(f));u.sort(this.__sortFilterOptions)}},__reselectFiltersAfterProviderSwitch:function(n){for(var t,r,u,f,e,i=0;i<this.__totalFilterSelections.length;i++)for(r=this.__totalFilterSelections[i].OptionIndex,u=this.__totalFilterSelections[i].GroupIndex,t=0;t<n.length;t++)f=n[t].name,e=n[t].group,r===f&&u===e&&(n[t].selected=!0,selectedAdditionalFilters=!0,null!==this.__selectedFilters?this.__selectedFilters.push({GroupIndex:u,OptionIndex:r}):this.__selectedFilters=[{GroupIndex:u,OptionIndex:r}]);return!1},__shouldAddOption:function(n,t,i){return""!==n&&-1===t.indexOf(n)&&!this.__isDefaultLanguage(i,n)&&(this.__isShowingOneAppointment||this.__isFilterOptionInAllAppointments(i,n))},__isFilterOptionInAllAppointments:function(n,t){var r,u,f,o,e,s=this.__appointmentBuilder.numAppointments(),h=!0,i;if(s<2)return!0;for(r=0;r<s;r++){for(o=this.__availableProviders[r],e=!1,u=0;u<o.length;u++)if(i=o[u][n],Array.isArray(i)){for(f=0;f<i.length;f++)if(0===t.localeCompare(i[f])){e=!0;break}}else 0===t.localeCompare(i)&&(e=!0);e||(h=!1)}return h},__isDefaultLanguage:function(n,t){for(var i=0;i<this.__defaultLanguages.length;i++)if(0===n.localeCompare(r)&&0===t.localeCompare(this.__defaultLanguages[i].Title))return!0;return!1},__canShowFilterWhenLessThanThreshold:function(n){switch(n){case f:case r:case i:case t:return!0;default:return this.__wasFilterGroupPreselected(n)}},__showFilterGroup:function(n,r,u){if(r<2||n/r<.8&&!this.__canShowFilterWhenLessThanThreshold(u))return!1;switch(u){case i:return this.__workflow.isTypeOpenScheduling()&&$$WPSchedulingUtil.ShouldTreatAsAnonymous(this.__workflow)&&(this.__wasFilterGroupPreselected(u)||!this.__hasOnlyProviderDepartmentsThatSeeAllAges());case t:return this.__filterSettings.IsInsuranceSelectionValid;default:return!0}},__bindChangeFunctions:function(){this.__$root.on("change",".filter-option",this.__onFilterSelectionChanged);this.__$root.on("click",".expand-filter-group",this.__onExpandFilters);this.__$root.on("click",".collapse-filter-group",this.__onCollapseFilters)},clearAllFilters:function(n){this.__selectedFilters=null;n&&(this.__checkNetworkFilterByDefault=!1,this.__preselectedFilters=[]);this.__clearSelectedFiltersOnDOM()},filterProviderDepartments:function(n){var i,r=0,e=[],u=this.getListOfSelectedProviderDepartmentFilters(),f;if(0===u.length)return n;for(i=0;i<n.length;i++){for(f=!0,providerDepartment=n[i],r=0;r<u.length;r++)filterName=u[r].GroupIndex,filterName===t?providerDepartment.IsInNetwork||(f=!1):(selectedOption=u[r].OptionIndex,filterName in providerDepartment&&-1!==providerDepartment[filterName].indexOf(selectedOption)||(f=!1));f&&e.push(n[i])}return e},isProviderFilteringAvailable:function(){return null!==this.__availableProviders&&0!==this.__availableProviders.length&&null!==this.__availableProviderDepartmentPairs&&0!==this.__availableProviderDepartmentPairs.length&&this.__checkIfEnoughFiltersToShow()},__getProvidersToRemove:function(){var n,i,t,r=[];if(this.__hasSelectedFilters())if(this.__isShowingOneAppointment)for(t=this.__selectedProviders[this.__activeAppointmentIndex].toArray(),n=0;n<t.length;n++)this.__isProviderFiltered(t[n],this.__activeAppointmentIndex)&&r.push(t[n]);else for(n=0;n<this.__selectedProviders.length;n++)for(t=this.__selectedProviders[n].toArray(),i=0;i<t.length;i++)this.__isProviderFiltered(t[i],n)&&r.push(t[i]);return r},__checkIfProviderInArray:function(n,t){for(var r=n.ID,i=0;i<t.length;i++)if(t[i].ID===r)return!0;return!1},__getProvidersToAdd:function(){var n,t,i=[];if(this.__isShowingOneAppointment)0!==(t=this.__getProvidersToAddForAppt(this.__activeAppointmentIndex)).length&&(i[this.__activeAppointmentIndex]=t);else for(n=0;n<this.__selectedProviders.length;n++)0!==(t=this.__getProvidersToAddForAppt(n)).length&&(i[n]=t);return i},__getProvidersToAddForAppt:function(n){for(var r=[],u=this.__selectedProviders[n].toArray(),i=this.__availableProviders[n],t=0;t<i.length;t++)this.__checkIfProviderInArray(i[t],u)||this.__isProviderFiltered(i[t],n)||r.push(i[t]);return r},__isProviderFiltered:function(n,i){var r,e,f,o,u;if(!this.__hasSelectedFilters()||!this.__checkIfProviderInArray(n,this.__availableProviders[i]))return!1;r=this.__generateLogicTable(n);for(u in r){if(e=!0,f=r[u],0!==u.localeCompare(t))for(option in f)f[option].shouldFilterOption||(e=!1);else e=!n.IsInNetwork;f.shouldFilterGroup=e}o=!1;for(u in r)(f=r[u]).shouldFilterGroup&&(o=!0);return o},__generateLogicTable:function(n){for(var f,i={},e=this.getSelectedFilters(),t,r,o,u=0;u<e.length;u++)if(t=e[u].GroupIndex,r=e[u].OptionIndex,i[t]=i[t]||{},i[t][r]=i[t][r]||{},Array.isArray(n[t])){for(o=n[t],i[t][r].shouldFilterOption=!0,f=0;f<o.length;f++)if(o[f]===r){i[t][r].shouldFilterOption=!1;break}}else i[t][r].shouldFilterOption=!0,n[t]===r&&(i[t][r].shouldFilterOption=!1);return i},__sortFilterOptions:function(n,t){var i=n.name,r=t.name;return i.localeCompare(r)},__hasSelectedFilters:function(){var n=this.getSelectedFilters();return!(null===n||0===n.length)},__getNumProvidersWithOptions:function(t,i){for(var f=0,r,u=0;u<i.length;u++)if(r=i[u][t],Array.isArray(r)){for(n=0;n<r.length;n++)if(""!==r[n]){f++;break}}else""!==r&&f++;return f},__render:function(){var n,t=$afe.jq(document.activeElement),i;(n=this.__generateViewModel(this.getSelectedFilters()),this.__$root.empty().safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.Filters,n)),this.__bindChangeFunctions(),t.hasClass("filter-option"))&&(i=t.safeAttr("id"),this.__$root.find("#"+$.escapeSelector(i)).focus())},__onExpandFilters:function(){var n=$afe.jq(event.target).data("group");-1===this.__expandedFilters.indexOf(n)&&this.__expandedFilters.push(n);this.__render();$afe.select("#"+n+"-group").focus()},__onCollapseFilters:function(){var n=$afe.jq(event.target).data("group");-1!==this.__expandedFilters.indexOf(n)&&this.__expandedFilters.splice(this.__expandedFilters.indexOf(n),1);this.__render();$afe.select("#"+n+"-show-more").focus()},resetSelectedProviders:function(){null!==this.__selectedFilters&&0!==this.__selectedFilters.length&&(this.__totalFilterSelections=this.__selectedFilters.slice(0),this.__switchedAvailableProviders=!0);this.clearAllFilters();this.filterProvidersBySelection()},__onFilterSelectionChanged:function(){var n;(n=$afe.jq(event.target)).data("groupIndex")===t?this.__checkNetworkFilterByDefault&&(this.__checkNetworkFilterByDefault=!1):this.__togglePreselectedFilter(n.data("groupIndex"),n.data("optionIndex"));this.__selectedFilters=this.getSelectedFiltersFromDOM();this.__shouldAuditProviderFilterUse(this.__selectedFilters)&&this.__appointmentBuilder.setProperty("DidUseProviderFilters",!0);this.__shouldAuditPatientAgeFilterUse(this.__selectedFilters)&&this.__appointmentBuilder.setProperty("DidUsePatientAgeFilter",!0);this.filterProvidersBySelection();this.notifyProviderDepartmentFilterListeners();this.__render()},__togglePreselectedFilter:function(n,t){for(var r,i=0;i<this.__preselectedFilters.length;i++)if(0===(r=this.__preselectedFilters[i]).FilterGroup.localeCompare(n)&&0===r.FilterValue.localeCompare(t))return void this.__preselectedFilters.splice(i,1);this.__preselectedFilters.push({FilterGroup:n,FilterValue:t})},__processPreselectedFilters:function(){for(var t,n=0;n<this.__preselectedFilters.length;n++)(preselectedFilter=this.__preselectedFilters[n],0===preselectedFilter.FilterGroup.localeCompare(i))&&(t=preselectedFilter.FilterValue,"0"===t?preselectedFilter.FilterValue=$$WP.Scheduling.FilterController.PatientAgeFilterSeesChildrenValue():"1"===t&&(preselectedFilter.FilterValue=$$WP.Scheduling.FilterController.PatientAgeFilterSeesAdolescentsValue())),this.__initialPreselectedFilterGroups[preselectedFilter.FilterGroup]=1},notifyProviderDepartmentFilterListeners:function(){for(var n=0;n<this.__providerDepartmentFilterListeners.length;n++)this.__providerDepartmentFilterListeners[n]()},addProviderDepartmentFilterListener:function(n){this.__providerDepartmentFilterListeners.push(n)},clearProviderDepartmentFilterListener:function(){this.__providerDepartmentFilterListeners=[]},__shouldAuditProviderFilterUse:function(n){var t,i=0;if(null!==n)for(t=0;t<n.length;t++)if("PatientAge"!==n[t].GroupIndex){i=1;break}return i},__shouldAuditPatientAgeFilterUse:function(n){var t,i=0;if(null!==n)for(t=0;t<n.length&&!(i="PatientAge"===n[t].GroupIndex);t++);return i},filterProvidersBySelection:function(n){var t,i;this.getSelectedFilters();this.isProviderFilteringAvailable()&&(this.__isShowingOneAppointment=!this.__appointmentBuilder.IsSlotStepMultiApptPreGrouped,t=this.__getProvidersToRemove(),this.__removeProviders(t),i=this.__getProvidersToAdd(),this.__addProviders(i),0===t.length&&0===i.length&&!n&&this.onFiltersChangedSameResults&&this.onFiltersChangedSameResults(),this.__filterProvDeptPairsOnFirstRender&&(this.__filterProvDeptPairsOnFirstRender=!1,this.notifyProviderDepartmentFilterListeners()))},__removeProviders:function(n){var t;if(this.__isShowingOneAppointment)this.__selectedProviders[this.__activeAppointmentIndex].removeRange(n);else for(t=0;t<this.__selectedProviders.length;t++)this.__selectedProviders[t].removeRange(n)},__addProviders:function(n){var t,i,r;if(0!==n.length)if(this.__isShowingOneAppointment)i=this.__selectedProviders[this.__activeAppointmentIndex],r=n[this.__activeAppointmentIndex],i.addRange(r);else for(t=0;t<n.length;t++)i=this.__selectedProviders[t],r=n[t],i.addRange(r)},__checkIfEnoughFiltersToShow:function(){return 0!==this.__filtersMatrix.length},getSelectedFiltersFromDOM:function(){var n,i,t,u,f,r;if(null===this.__$root)return[];if(null===(n=this.__$root.find(":checked"))||0===n.length)return[];for(r=[],t=0;t<n.length;t++)!1===(i=$afe.jq(n[t])).prop("disabled")&&(u=i.data("group-index"),f=i.data("option-index"),r.push({GroupIndex:u,OptionIndex:f}));return r},__clearSelectedFiltersOnDOM:function(){var n,i,t;if(null!==this.__$root&&null!==(n=this.__$root.find(":checked"))&&0!==n.length)for(t=0;t<n.length;t++)!1===(i=$afe.jq(n[t])).prop("disabled")&&i.prop("checked",!1)},clearNetworkFilter:function(){null!==this.__$root&&(this.__$root.find("input[data-group-index=IsInNetwork]").prop("checked",!1),this.__checkNetworkFilterByDefault=!1,this.filterProvidersBySelection(),this.notifyProviderDepartmentFilterListeners())},draw:function(n){this.__$root=n;this.__setSelectedProviders();this.__render();this.filterProvidersBySelection(!0)},onFiltersChangedSameResults:function(){},getSelectedFilters:function(){return null===this.__selectedFilters||0===this.__selectedFilters.length?this.getSelectedFiltersFromDOM():this.__selectedFilters},getListOfSelectedProviders:function(){return this.__selectedProviders[this.__activeAppointmentIndex].toArray()},updateFilterSettings:function(n){this.__filterSettings=n},hasNetworkFilterBeenCleared:function(){return!this.__checkNetworkFilterByDefault}};$$WP.Scheduling.FilterController=u;u.extend($$WP.Controllers.Controller,"WP$Scheduling$FilterController")}();$$WP.Scheduling.FilterController.PatientAgeFilterSeesChildrenValue=function(){return $$WP.Strings.get("FilterPatientAgeOptions_Children","Scheduling")};$$WP.Scheduling.FilterController.PatientAgeFilterSeesAdolescentsValue=function(){return $$WP.Strings.get("FilterPatientAgeOptions_Adolescents","Scheduling")};$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n){this.WP$Controllers$Controller();this.proxify("__onTelehealthModeChanged");this._$carousel=new $$WP.UI.ChipCarouselController($$WP.Templates.Scheduling.TelehealthModes);this._appointmentBuilder=n};n.prototype={_$carousel:null,_appointmentBuilder:null,render:function(n){var t=this.__getViewModel();n.length>0&&(this._$carousel.render(n,t),this.__setupTelehealthModeCallbacks(n),this.__selectTelehealthChipsOnLoad(n))},__selectTelehealthChipsOnLoad:function(n){var t=0;this._appointmentBuilder.IsSlotStepMultiApptPreGrouped?this._appointmentBuilder.isSelectedTelehealthModeSameForAppts()&&this.__selectTelehealthChipForAppointmentOnLoad(0,n):(t=this._appointmentBuilder.getActiveApptIndex(),this.__selectTelehealthChipForAppointmentOnLoad(t,n))},__selectTelehealthChipForAppointmentOnLoad:function(n,t){var i,r=null,u=null;i=this._appointmentBuilder.getAppointment(n);!$$WPUtil.IsNullOrEmpty(i)&&i.SelectedTelehealthMode&&(r=i.SelectedTelehealthMode,(u=t.find(".telehealthChip"+r).find("input")).length>0&&this._$carousel.selectChip(u))},__setupTelehealthModeCallbacks:function(n){for(var r=null,t=0,i=this._appointmentBuilder.getAllowedTelehealthModes(),t=0;t<i.length;t++)r=i[t],n.find(".telehealthChip"+r).find("input").on("click",this.__onTelehealthModeChanged)},__onTelehealthModeChanged:function(n){var u=$afe.jq(n.target),f=0,t=null,i=null,r=0;if(u.length>0)if(this._$carousel.selectChip(u),i=parseInt(u.safeAttr("data-telehealthmode")),this._appointmentBuilder.IsSlotStepMultiApptPreGrouped)for(r=0;r<this._appointmentBuilder.numAppointments();r++)t=this._appointmentBuilder.getAppointment(r),i&&t.SelectedTelehealthMode!==i&&(t.setProperty("SelectedTelehealthMode",i),t.setProperty("HasUsedTelehealthToggles",!0));else this._appointmentBuilder.setProperty("UpdateAvailableProviders",!0),f=this._appointmentBuilder.getActiveApptIndex(),t=this._appointmentBuilder.getAppointment(f),i&&t.SelectedTelehealthMode!==i&&(t.setProperty("SelectedTelehealthMode",i),t.setProperty("HasUsedTelehealthToggles",!0))},__getViewModel:function(){var n={},t=this._appointmentBuilder.getAllowedTelehealthModes();return $$WPUtil.IsNullOrEmpty(t)||(n.CanShowInPersonTelehealthMode=t.includes(VisitType.TelehealthModeEnum.InPerson),n.CanShowVideoTelehealthMode=t.includes(VisitType.TelehealthModeEnum.Video),n.CanShowTelephoneTelehealthMode=t.includes(VisitType.TelehealthModeEnum.Telephone)),n}};$$WP.Scheduling.TelehealthModeController=n;n.extend($$WP.Controllers.Controller,"WP$Scheduling$TelehealthModeController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t,i,r){this.WP$Controllers$Controller();this._$parentContainer=n;this._schedulingDataPool=t;this._workflow=r;this._appointmentClickCallback=i;this.proxify("render","_buildViewModel","__onSummaryAppointmentClicked","__addEventListeners");this._slotSelectionSummaryTemplate=$$WP.Templates.Scheduling.SlotSelectionSummary};n.prototype={_$parentContainer:null,_slotSelectionSummaryTemplate:null,_schedulingDataPool:null,_workflow:null,render:function(){var n=null,t=this._buildViewModel();(n=this.findContainer()).length>0&&(n.empty(),n.safeAppend($afe.renderTemplate(this._slotSelectionSummaryTemplate,t)),this.__addEventListeners(n))},findContainer:function(){return this._$parentContainer.find(".slotSelectionSummaryContainer")},focusOnSummaryHeader:function(n){var t=this._$parentContainer.find('[data-appointment-index="'+n+'"]');0!==t.length&&$$WPSchedulingUtil.FocusElement(t[0])},_buildViewModel:function(){return{CurrentApptBeingSelected:this._schedulingDataPool.AppointmentBuilder.getActiveApptIndex(),AppointmentViewModels:this.__buildAppointmentViewModels(),CanAnimate:this.__canAnimate()}},__buildAppointmentViewModels:function(){for(var u=[],n=null,t=null,r=this._schedulingDataPool.AppointmentBuilder.Appointments.toArray(),i=0;i<r.length;i++)n=r[i],t=new $$WP.Scheduling.AppointmentViewModel,n.Slot?t.populateFromSlot(n.Slot,this._schedulingDataPool.AppointmentBuilder,n,this._schedulingDataPool,!0,this._workflow):t.populateFromEmptyAppointment(n,this._workflow),u.push(t);return u},__canAnimate:function(){return 0===this._schedulingDataPool.SlotLoader.numIncrementalLoadsCompleted()},__onSummaryAppointmentClicked:function(n){var t;(t=n.target.dataset.appointmentIndex)<this._schedulingDataPool.AppointmentBuilder.getActiveApptIndex()&&this._appointmentClickCallback(t)},__addEventListeners:function(n){n.on("click",".slotSelectionSummaryInput",this.__onSummaryAppointmentClicked)}};$$WP.Scheduling.SlotSelectionSummaryController=n;n.extend($$WP.Controllers.Controller,"WP$Scheduling$SlotSelectionSummaryController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t){this.WP$Controllers$Controller();this._$parentContainer=n;this._schedulingDataPool=t;this.proxify("render","_buildViewModel");this._schedulingInstructionsTemplate=$$WP.Templates.Scheduling.SchedulingInstructions};n.prototype={_$parentContainer:null,_schedulingInstructionsTemplate:null,_schedulingDataPool:null,render:function(n){var t=null,i=this._buildViewModel(n);(t=this.findContainer()).length>0&&(t.empty(),t.safeAppend($afe.renderTemplate(this._schedulingInstructionsTemplate,i)))},findContainer:function(){return this._$parentContainer.find(".schedulingInstructionsContainer")},_buildViewModel:function(n){var t={Instructions:null,CanShowSchedulingInstructions:!1};return t.Instructions=this._schedulingDataPool.AppointmentBuilder.getSchedulingInstructions(this._schedulingDataPool.VisitTypes,n),t.CanShowSchedulingInstructions=0!==t.Instructions.join("").length,t}};$$WP.Scheduling.SchedulingInstructionsController=n;n.extend($$WP.Controllers.Controller,"WP$Scheduling$SchedulingInstructionsController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});$$WP.Utilities.UI.Cards=function(n){$$WP.Utilities.UI.IsMobile||("echeckin"===$$WP.Utilities.queryString("src")||$afe.select("html").hasClass("respquestionnaire"))&&WP.DOM.Browser.isMobile||("load"===n.type&&($afe.select(".cardlist.hoverable").each($$WP.Utilities.UI.Cards.HandleHoverable),$afe.select("body").on("cardLoad",".cardlist",$$WP.Utilities.UI.Cards.LoadCardlist).on("matchCardHeights",".cardlist.matchHeights",$$WP.Utilities.UI.Cards.MatchHeights)),$afe.select(".cardlist.matchHeights").each($$WP.Utilities.UI.Cards.MatchHeights))};$$WP.Utilities.UI.Cards.LoadCardlist=function(){var n=$afe.jq(this);isDataTile()&&n.is(".cardlist.column_3, .cardlist.column_4")&&n.removeClass("column_3 column_4").addClass("column_2");n.hasClass("hoverable")&&$.proxy($$WP.Utilities.UI.Cards.HandleHoverable,n)();n.hasClass("matchHeights")&&$.proxy($$WP.Utilities.UI.Cards.MatchHeights,n)()};$$WP.Utilities.UI.Cards.HandleHoverable=function(){var n=$afe.jq(this);n.hasClass("hoverable")&&n.find(".card").each(function(){var n=$afe.jq(this);n.prop("hoverable")||(n.hover(function(n){"mouseenter"===n.type?$afe.jq(this).addClass("hover"):$afe.jq(this).removeClass("hover")}),n.find(".button, [data-id='additem']").on("focus blur",function(n){"focus"===n.type?$afe.jq(this).parentsUntil(".card").addBack().parent(".card").addClass("hover"):$afe.jq(this).parentsUntil(".card").addBack().parent(".card").removeClass("hover")}),n.prop("hoverable",!0))})};$$WP.Utilities.UI.Cards.MatchHeights=function(){if(!($$WP.Utilities.UI.IsMobile||78===$$WP.ApplicationContext||("echeckin"===$$WP.Utilities.queryString("src")||$afe.select("html").hasClass("respquestionnaire"))&&WP.DOM.Browser.isMobile)){var r,i,n,u,f=$afe.jq(this),t=f.prop("class");if(t=parseInt(t.substr(t.indexOf("column_")+7)),!isNaN(t))for(r=f.find(".card, .innercard").css("minHeight",""),i=0;i<r.length;i+=t){for(u=r.eq(i).outerHeight(),n=1;n<t;n++)u=Math.max(u,r.eq(i+n).outerHeight());for(n=0;n<t;n++)r.eq(i+n).css("minHeight",u)}}};$$WP.Utilities.UI.Map.Support.cards=$$WP.Utilities.UI.Cards;$$WP.ThirdPartyUsageTracking=$$WP.ThirdPartyUsageTracking||{};$$WP.ThirdPartyUsageTracking.LogViewEvent=function(){};!function(){var n=0,i=1,t=function(n,t,i,r){this.WP$Controllers$Controller();this.$container=n;null!=i&&(this._maxHeight=i);$$WPUtil.IsNullOrEmpty(r)&&($$WP.Strings.setDefaultNamespace("Visits"),r=$$WP.Strings.get("ViewFullInstructionsButtonText"));null!=t&&this.$container.empty().safeAppend($afe.renderTemplate($$WP.Templates.Visits.PatientInstruction,{PatientInstructionsHTML:t,ExpandText:r}));this.$container.find(".readmore a").html(r);this.$readmore=this.$container.find(".readmore");this.$readless=this.$container.find(".readless");this.proxify("_collapseOrExpand","_setupInstructionDiv","_afterTransition","_fitTablesInsideContainer");this.$container.on("click",".readmore",this._collapseOrExpand);this.$container.on("click",".readless a",this._collapseOrExpand);$afe.jq(window).on("resize",this._setupInstructionDiv);$afe.jq(window).on("resize",this._fitTablesInsideContainer);this.$container.on("transitionend webkitTransitionEnd oTransitionEnd",this._afterTransition);this._setupInstructionDiv();this._fitTablesInsideContainer()};t.prototype={$container:null,_state:n,_maxHeight:300,$readmore:null,$readless:null,_afterTransition:function(t){if(null==t||"height"===t.originalEvent.propertyName){var i=null;this._state===n?(this.$readmore.find("a").focus(),this.$container.safeAttr("aria-expanded","false")):(i=$afe.jq(window).scrollTop(),this.$container.find(".instructionContent").focus(),$afe.jq(window).scrollTop(i),this.$container.safeAttr("aria-expanded","true"))}},_setupInstructionDiv:function(){this.$container.contentHeight()>this._maxHeight&&(this.$readmore.hasClass("hidden")&&this.$readless.hasClass("hidden")?(this._state=n,this.$container.safeAttr("aria-expanded","false"),this._setTabIndexForLinksInside(-1),this.$container.height(this._maxHeight+"px"),this.$readmore.removeClass("hidden")):this.$readless.hasClass("hidden")||(this._state=i,this.$container.safeAttr("aria-expanded","true"),this._setTabIndexForLinksInside(0),this.$container.height(""),this.$container.height(this.$container.contentHeight()+"px")))},_fitTablesInsideContainer:function(){var n,t,i,r;for(i=this.$container.find(".fmtConv table"),r=this.$container.width(),n=0;n<i.length;n++)(t=$afe.jq(i[n])).css("word-break",""),t.width()>r&&t.css("word-break","break-all")},_setTabIndexForLinksInside:function(n){this.$container.find(".instructionContent a").safeAttr("tabindex",n)},_collapseOrExpand:function(){if(this._state===n)this._state=i,this._setTabIndexForLinksInside(0),this.$readmore.addClass("hidden"),this.$readless.removeClass("hidden"),this.$container.height(this.$container.contentHeight()+"px");else{this._state=n;this._setTabIndexForLinksInside(-1);this.$readmore.removeClass("hidden");this.$readless.addClass("hidden");this.$container.height(this._maxHeight+"px");var t=$afe.select("#header").contentHeight();$$WPUtil.SmoothScrollToElementWithOffset($$WPUtil.ScrollableBody(),this.$container,t,300)}}};$$WPUtil.guaranteeExistence($$WP,"Visits.PatientInstructionController");$$WP.Visits.PatientInstructionController=t;t.extend($$WP.Controllers.Controller,"WP$PatientInstructionController$Controller")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,r,u,f,e,o,s,h,c){var l;for(this.WP$Controllers$Controller(),this.SchedulingStringsNamespace=this.SchedulingStringsNamespace||$$WP.Strings.getNamespace("Scheduling"),this.Id=i++,this.$root=n,this.Data=r,this.template=o||$$WP.dudFunction,this.collapsedTemplate=s||o,this._defaultStepSettings=new t(e),this.stepSettings=Object.create(this._defaultStepSettings),this.Active=!1,this._isStacked=h||!1,this._onErrorCallback=c,this.SkipAfterRenderRefocus=!1,u=u||[],this.allowedIds={},l=0;l<u.length;l++)this.allowedIds[u[l]]=!0;for(this.allowedIds.size=u.length,f=f||[],this.preselectedIds={},l=0;l<f.length;l++)this.preselectedIds[f[l]]=!0;this.preselectedIds.size=f.length;this._viewEventListeners=[]},r={SchedulingStringsNamespace:null,Id:null,$root:null,allowedIds:null,preselectedIds:null,_defaultStepSettings:null,stepSettings:null,Data:null,ViewBinder:null,ViewModel:null,template:null,_reactSubcomponents:{},collapsedTemplate:null,_firstRender:!0,Active:!1,SkipAfterRenderRefocus:!1,_renderHidden:!0,_isStacked:!1,_onErrorCallback:null,_timerId:null,_viewEventListeners:null,_workflow:null,schedulingProgress:null,filterByAllowedIds:function(n,t,i){var r,u,f;if(u=n||[],t=t||"ID",this.allowedIds.size>0){for(f=[],r=0;r<n.length;r++)this.allowedIds[n[r][t]]&&f.push(n[r]);f.length>0?u=f:i&&(u=[])}else if(i)return[];return u},filterIdArrayByAllowedIds:function(n){var r,i,t;if(r=n||[],this.allowedIds.size>0){for(i=[],t=0;t<n.length;t++)this.allowedIds[n[t]]&&i.push(n[t]);i.length>0&&(r=i)}return r},getModelsToPreSelect:function(n,t){return n&&1===n.length?n:this.getPreSelectedModelsOnly(n,t)},getPreSelectedModelsOnly:function(n,t){if(n=n||[],t=t||"ID",0===this.preselectedIds.size)return[];for(var r=[],i=0;i<n.length;i++)this.preselectedIds[n[i][t]]&&r.push(n[i]);return r},hasPreselectedIds:function(){return this.preselectedIds.size>0},isModelPreselected:function(n){return this.preselectedIds[n]},isStepMarkedAsHidden:function(){return this.stepSettings.Hide||this.stepSettings.HideIfOne&&1===this.ViewModel.Count},isHidden:function(){return this.isStepMarkedAsHidden()&&!this._isStepForceShown()},shouldRenderCollapsed:function(){return this.stepSettings.Collapse||this.stepSettings.CollapseIfOne&&1===this.ViewModel.Count||this.renderCollapsed},scrollToStep:function(){var n=$afe.select("#header").height();$$WPUtil.IsNullOrEmpty(n)&&(n=0);isDataTile()&&null!=window.frameElement&&(n-=$afe.jq(window.frameElement).offset().top);this.scrollToElement(this.$root,n)},scrollToElement:function(n,t){$$WPUtil.SmoothScrollToElementWithOffset($$WPUtil.ScrollableBody(),n,t,600)},scrollToElementIfOffsceen:function(n){var t=0;this.isElementOffScreen(n)&&(t=window.innerHeight/2,this.scrollToElement(n,t))},isElementOffScreen:function(n){var t=n[0].getBoundingClientRect(),i=this.$root.find(".stickybanner").height();return t.top<0||t.bottom>window.innerHeight-i},show:function(){this._renderHidden=!1;this.$root.show();this.updateStep();this._workflow&&this._setSafeToRedirectOverrides()},_setSafeToRedirectOverrides:function(){$$WPUtil.SafeToRedirectOverrideSettings={TitleText:this.SchedulingStringsNamespace.getString("SchedulingRedirectTitle"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button(this.SchedulingStringsNamespace.getString("SchedulingRedirectCancel"),null,"","stay"),new $$WPComp.ComplexObjects.Button(this.SchedulingStringsNamespace.getString("SchedulingRedirectConfirm"),null,"inlinedelete","leave")]};$$WPUtil.SafeToRedirectOverrideSettings.Html=this._workflow&&this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.Reschedule?this.SchedulingStringsNamespace.getString("ReschedulingRedirectMessage"):this.SchedulingStringsNamespace.getString("SchedulingRedirectMessage")},__saveRootHeight:function(){var n=this.$root.height();n>0&&this.$root.css({"min-height":n})},hide:function(n){this.__saveRootHeight();this.$root.hide();this._renderHidden=!0;void 0!==n&&this.setComplete(n)},getComplete:function(){return this.Data.SchedulingSteps.getFromIndex("ID",this.Id).CompleteStatus},setComplete:function(n){this.Data.SchedulingSteps.getFromIndex("ID",this.Id).setProperty("CompleteStatus",n)},resetStepSettings:function(){this.stepSettings=Object.create(this._defaultStepSettings)},updateStep:function(){clearTimeout(this._timerId);this._timerId=setTimeout($.proxy(this._updateStepImmediately,this),0)},_updateStepImmediately:function(){var i,r,n,t,u,f;if(this.resetStepSettings(),this.arePrerequisitesComplete()?(this.updateViewModel(),this.ViewModel=this.ViewModel||{}):this.ViewModel={StepShouldBeActive:!1},this._isStepForceShown()&&(this._renderHidden=!1),this.ViewModel.StepShouldBeActive&&!this._renderHidden){if(this.Active||(this.$root.show(),this.Active=!0),this._firstRender&&(this.beforeFirstRender(),this._firstRender=!1,!this.Active))return;if(this.beforeRender(),!this.Active||!this._isStepOrStackActive())return;if(i=!this._isStepForceShown()&&this.isHidden(),r=this.shouldRenderCollapsed(),i)this.$root.hide(),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired);else{if(0===this.ViewModel.Count&&"function"==typeof this._onErrorCallback)return void this.showError(this.ViewModel);this.__saveRootHeight();this._isStacked||(n=(u=this.$root.find(":focus")).safeAttr("data-model-id"),$$WP.Utilities.IsNullOrEmpty(n)&&(t=u.safeAttr("id")),this.$root.empty());this.$root.show();null!==this.ViewBinder&&(this.ViewModel.ViewBinderId=this.ViewBinder.ViewBinderId);r?(this.$root.safeAppend($afe.renderTemplate(this.collapsedTemplate,this.ViewModel)),this.$root.css({"min-height":""})):(this._isStacked||(this.$root.safeAppend($afe.renderTemplate(this.template,this.ViewModel)),$afe.select("body").hasClass("isPrelogin")||$$WP.Utilities.IsNullOrEmpty(this._reactSubcomponents)||(this._updateReactSubcomponents(),this._renderReactSubcomponents())),this.$root.css({"min-height":""}),this.stepSettings.ReadOnly?this.$root.addClass("readonly"):this.$root.removeClass("readonly"),null!==this.ViewBinder&&this.ViewBinder.syncModelsToDOM());f=$afe.jq($afe.select("#header-accessible-text")).text();$afe.jq($afe.select("span.header-accessible-span")).text(f);!this._workflow||this._workflow.isTypeOpenScheduling()&&this._workflow.IsAnonymous||$afe.jq($afe.select("div.dtStep span.header-accessible-span")).empty();this.afterRender();this.triggerViewEvent();this.SkipAfterRenderRefocus||($$WP.Utilities.IsNullOrEmpty(n)?$$WP.Utilities.IsNullOrEmpty(t)||this.$root.find("#"+$.escapeSelector(t)).focus():this.$root.find("[data-model-id='"+n+"']").focus());this.SkipAfterRenderRefocus=!1}}else this.inactivate()},_renderReactSubcomponents:function(){var n,i,t;for(n in this._reactSubcomponents)i=this._reactSubcomponents[n].props||{},t=this._reactSubcomponents[n].id||n,EpicPx.removeReactPortal(t),EpicPx.addReactPortal("@epic-px/scheduling",n,i,t)},_updateReactSubcomponents:function(){},showError:function(n){"function"==typeof this._onErrorCallback&&(WP.Events.cancelBeforeUnload(),this._onErrorCallback(n))},_isStepOrStackActive:function(){var t=null,n=null,r=null,i=null;if(this.Data&&this.Data.SchedulingSteps&&!$$WPUtil.IsNullOrEmpty(this.Id)){if(""!==(t=this.Data.SchedulingSteps.getFromIndex("ID",this.Id)).StackId&&(n=this.Data.SchedulingSteps.getFromIndex("ID",t.StackId)),n&&""!==n.StackId&&(r=this.Data.SchedulingSteps.getFromIndex("ID",n.StackId)),(i=this.Data.SchedulingSteps.getFromIndex("ActiveStatus",$$WP.Scheduling.SchedulingStep.ActiveEnum.Active))&&i.IsAdHoc)return this.__isStepActive(t)||this._isStepHostingAdHocStep(t,i)||this._isStepHostingAdHocStep(n,i)||this._isStepHostingAdHocStep(r,i);if(!this.__isStepActive(t)&&!this.__isStepActive(n)&&!this.__isStepActive(r))return!1}return!0},_isStepHostingAdHocStep:function(n,t){return!!n&&t.HostId===n.ID},__isStepActive:function(n){return!!n&&n.ActiveStatus===$$WP.Scheduling.SchedulingStep.ActiveEnum.Active},_isStepForceShown:function(){var n=null;return!(!this.Data||!this.Data.SchedulingSteps||$$WPUtil.IsNullOrEmpty(this.Id))&&null!==(n=this.Data.SchedulingSteps.getFromIndex("ID",this.Id))&&n.ForceShowOnce},inactivate:function(){this.$root.hide();this._workflow&&this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.Reschedule&&0!==this.$root.find("#OriginalAppointmentInfo").length&&$$WP.Scheduling.OriginalAppointmentInfoController.StashPortal();this._isStacked||this.$root.empty();this.Active&&(this.Active=!1,this.afterInactivated())},arePrerequisitesComplete:function(){return!0},updateViewModel:function(){$$WP.Debug.logError(this._constructor.name+" did not override the virtual updateViewModel method from StepController.")},beforeFirstRender:function(){},beforeRender:function(){},afterRender:function(){},afterInactivated:function(){},beforeNavigateBack:function(){},onNavigateBack:function(){},setViewBinder:function(n){this.ViewBinder=n;n.setBindingRoot(this.$root)},addViewEventListener:function(n){this._viewEventListeners.push(n)},triggerViewEvent:function(){var n,t,i;(n=this._getViewEventSubmodule())&&(t=(new Date).toISOString(),i=this._getStepSpecificViewEventData(),this._invokeViewEventListeners(n,t,i))},_getViewEventSubmodule:function(){return null},_getStepSpecificViewEventData:function(){return null},_invokeViewEventListeners:function(n,t,i){for(var r=0;r<this._viewEventListeners.length;r++)"function"==typeof this._viewEventListeners[r]&&this._viewEventListeners[r](n,t,i,this.Data)},dispose:function(){this.inactivate();this.$root.empty()},_openChangeBatch:function(){this.Data.Providers.openChangeBatch();this.Data.ReasonsForVisit.openChangeBatch();this.Data.Departments.openChangeBatch();this.Data.ProviderDepartmentPairs.openChangeBatch();this.Data.ReasonForVisitDepartmentOverrides.openChangeBatch();this.Data.Locations.openChangeBatch();this.Data.VisitTypes.openChangeBatch();this.Data.VisitTypeDepartmentOverrides.openChangeBatch();this.Data.Solutions.openChangeBatch();this.Data.SchedulingSteps.openChangeBatch();this.__openAppointmentsChangeBatch()},__openAppointmentsChangeBatch:function(){var n=0,t=null;for(this.Data.AppointmentBuilder.Appointments.openChangeBatch(),n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)(t=this.Data.AppointmentBuilder.getAppointment(n)).Providers.openChangeBatch(),t.Locations.openChangeBatch()},_closeChangeBatch:function(){this.Data.Providers.closeChangeBatch();this.Data.ReasonsForVisit.closeChangeBatch();this.Data.Departments.closeChangeBatch();this.Data.ProviderDepartmentPairs.closeChangeBatch();this.Data.ReasonForVisitDepartmentOverrides.closeChangeBatch();this.Data.Locations.closeChangeBatch();this.Data.VisitTypes.closeChangeBatch();this.Data.VisitTypeDepartmentOverrides.closeChangeBatch();this.Data.Solutions.closeChangeBatch();this.Data.AppointmentBuilder.Appointments.closeChangeBatch();this.Data.SchedulingSteps.closeChangeBatch();this.__closeAppointmentsChangeBatch()},__closeAppointmentsChangeBatch:function(){var n=0,t=null;for(this.Data.AppointmentBuilder.Appointments.closeChangeBatch(),n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)(t=this.Data.AppointmentBuilder.getAppointment(n)).Providers.closeChangeBatch(),t.Locations.closeChangeBatch()},onWorkflowDestroyed:function(){},shouldRemainOnStep:function(){return!1},hasStickyBanner:function(){return!1},getSchedulingContinueBanner:function(){var n=this.$root.parent(),t=".continueBanner";return n.hasClass("scheduling-embedded")?n.find(t):$afe.select(t)},setCurrentSelectionCountInBanner:function(){},getContinueButton:function(n){return n.find("#scheduling-continue")},isUsingWorkflowNavigation:function(){return!0}},t=function(n){"object"===$.type(n)&&(this.ReadOnly=n.ReadOnly,this.Hide=n.Hide,this.HideIfOne=n.HideIfOne,this.HideIfPreselected=n.HideIfPreselected,this.Collapse=n.Collapse,this.CollapseIfOne=n.CollapseIfOne,this.PreselectAllModels=n.PreselectAllModels)},i;t.prototype={ReadOnly:!1,Hide:!1,HideIfOne:!1,HideIfPreselected:!1,Collapse:!1,CollapseIfOne:!1,PreselectAllModels:!1};i=0;n.prototype=r;n.StepSettings=t;n.$scrollable=null;n.extend($$WP.Controllers.Controller,"WP$Scheduling$StepController");$$WP.Scheduling.StepController=n;$$WP.dudFunction=$$WP.dudFunction||function(){}}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t,i,r,u,f,e,o,s){this.WP$Scheduling$StepController(n,t,i,r,u,f,e,o,s);this.__viewStatePropertyName="ViewState-Step"+this.Id;this.__eventManager=new $$WP.Scheduling.EventManager};n.prototype={__eventManager:null,_appointment:null,__viewStatePropertyName:"",linkAppointment:function(n){this._appointment!==n&&(this.__eventManager.removeAllListeners(),this.__attachAppointmentListeners(n,this.__eventManager),this._appointment=n)},hasMultipleLinkedAppointments:function(){return!1},isNeeded:function(){return!0},__attachAppointmentListeners:function(){$$WP.Debug.logError(this._constructor.name+" did not override the virtual __attachAppointmentListeners method from SingleAppointmentStepController.")},dispose:function(){this.__eventManager.removeAllListeners();this.WP$Scheduling$StepController$dispose()},updateViewModel:function(n){n=!!n;this.ViewModel={IsStacked:this.__isStacked(),IsFirstOnPage:!this.__isStacked()||this.__isFirstInStack(n),PositionInStack:this.__indexInStack()+1,StackLength:this.__stackLength()}},__indexInStack:function(n){for(var r=this.Data.SchedulingSteps.getFromIndex("ID",this.Id),i=null,t=0,i=(n=!!n)?this.__getVisibleStackSteps():this.__getAllStackSteps(),t=0;t<i.length;t++)if(i[t]===r)return t},__stackLength:function(){return this.__getAllStackSteps().length},__isStacked:function(){return this.__getAllStackSteps().length>1},__isFirstInStack:function(n){return n=!!n,0===this.__indexInStack(n)},__getVisibleStackSteps:function(){for(var i=this.Data.SchedulingSteps.getFromIndex("ID",this.Id),r=null===i?[]:this.Data.SchedulingSteps.getFromIndex("StackId",i.StackId),u=[],t=null,n=0,n=0;n<r.length;n++)(t=r[n]).IsHidden||""===t.StackId||u.push(t);return u},__getAllStackSteps:function(){for(var t=this.Data.SchedulingSteps.getFromIndex("ID",this.Id),i=null===t?[]:this.Data.SchedulingSteps.getFromIndex("StackId",t.StackId),r=[],u=null,n=0,n=0;n<i.length;n++)""!==(u=i[n]).StackId&&r.push(u);return r},isTheLastIncompleteStep:function(){for(var n=0,i=null,r=this.__getAllStackSteps(),u=this.getComplete()===$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete,t=!0,f=this.__indexInStack(),n=0;n<r.length;n++)n!==f&&(i=r[n],t=t&&i.CompleteStatus===$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete);return u&&t}};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.SingleAppointmentStepController=n;n.extend($$WP.Scheduling.StepController,"WP$Scheduling$SingleAppointmentStepController")}();!function(){var r=$$WP.Scheduling.ReasonForVisit,t=$$WP.Scheduling.TelehealthLocation,e=$$WP.Scheduling.Appointment,o=$$WP.Scheduling.SchedulingSelectableViewBinder,i=$$WP.Scheduling.TelehealthFilters,s=$$WP.Scheduling.Workflow,n={NoFiltering:0,FilterOnSelectedProviders:1,Request:2,OnDemandTelehealth:3,FilterOnSelectedSpecialty:4},h=0,c=1,f=2,u=function(t,i,u,f,e,s,h,c,l,a,v,y){var p=[];switch($$WPUtil.IsNullOrEmpty(f)||p.push(f),this.WP$Scheduling$StepController(t,i,u,p,e,$$WP.Templates.Scheduling.ReasonForVisitStep,null,!1,h),this.proxify("updateStep","_onReasonForVisitChanged","_onAncillaryDataChanged","_onViewModelChanged","_onRoutingDestinationValidated","__onReasonsForVisitDataLoaded"),this._mode=s||n.NoFiltering,this._stopSchedulingCallback=h,this._defaultToNoRFVs=c,this._appointment=this.Data.AppointmentBuilder.getFirstAppointment(),this._canShowStepPretext=l,this._isAnonymous=a,this._workflow=v,this.__isLoadingRfvData=!1,this.__hasPatientLocationRule=y,this.setViewBinder(new o("ViewState",r.StatesEnum.Selected,r.StatesEnum.Unselected)),this.Data.ReasonsForVisit.addPropertyListener("ViewState",this._onViewModelChanged),this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this._onReasonForVisitChanged),this.Data.ReasonsForVisit.addCollectionEventListener("add",this._onAncillaryDataChanged),this._mode){case n.FilterOnSelectedProviders:this._appointment.Providers.addCollectionEventListener("add",this._onAncillaryDataChanged);this._appointment.Providers.addCollectionEventListener("remove",this._onAncillaryDataChanged);break;case n.OnDemandTelehealth:this.Data.TelehealthLocations.addPropertyListener("State",this._onAncillaryDataChanged);break;case n.FilterOnSelectedSpecialty:this.Data.AppointmentBuilder.addPropertyListener("Specialty",this._onAncillaryDataChanged)}};u.prototype={_appointment:null,_mode:null,_stopSchedulingCallback:null,_defaultToNoRFVs:!1,_canShowStepPretext:!1,_isAnonymous:!1,__isLoadingRfvData:!1,_onDemandBackupArray:null,__hasPatientLocationRule:!1,updateViewModel:function(){var r=this._getAvailableReasonsForVisit(),l,o,y,a;this._setViewModelSelectedStates(r);var v=!1,u=this.Data.TelehealthLocations.getFirstInIndex("State",t.StatesEnum.Selected),e=null,s=!1;if(null!==u&&(e=u.SubLocations.getFirstInIndex("State",t.StatesEnum.Selected)),this.Data.TelehealthData.setProperty("SelectedWorkflow",null),l=this._mode===n.OnDemandTelehealth,l){for(y=r.length,a=!1,o=0;o<y;o++)if(s=i.AreProvidersLicensedAtLocation(r[o].AllProviderDepartmentPairs,u,e),r[o].EnabledForQuickSchedule=!!s,i.IsInLicensedLocation(r[o].AllowedTelemedicineLocations,u,e,null,!0)||s){a=!0;break}(r=i.FilterRFVsByLicensure(r)).sort($$WP.Scheduling.ReasonForVisit.sortReasonsForOnDemand);v=!a;(null===this._onDemandBackupArray||u!==this._onDemandBackupArray[h]||null!==e&&e!==this._onDemandBackupArray[c]||0!==r.length&&r.length!==this._onDemandBackupArray[f].length)&&(this._onDemandBackupArray=[u,e,r]);0===r.length&&(r=this._onDemandBackupArray[f])}else r.sort($$WP.Scheduling.ReasonForVisit.sortReasons);this.ViewModel={ReasonsForVisit:r,Count:r.length,StepShouldBeActive:!0,IsOnDemandTelehealth:l,HasNoLicensedTelehealthProviders:v,ReasonForVisitLoadingMessage:this.SchedulingStringsNamespace.getString("LoadingMessage"),RfvListAdditionalData:{ViewBinderId:this.ViewBinder.ViewBinderId,ListLabelledById:"ReasonForVisitStepHeader",ListDescribedById:"ReasonForVisitPretext"}}},_getAvailableReasonsForVisit:function(){var t;switch(this._mode){case n.NoFiltering:t=this._getUnfilteredReasonsForVisit(!0,!0);break;case n.FilterOnSelectedProviders:t=this._getReasonsForVisitFilterOnProvider();break;case n.Request:t=this._getUnfilteredReasonsForVisit(!1,!0);break;case n.OnDemandTelehealth:t=this.__getTelehealthReasonsForVisit();break;case n.FilterOnSelectedSpecialty:t=this._getReasonsForVisitFilterOnSpecialty()}return this._mode===n.FilterOnSelectedSpecialty?this.filterByAllowedIds(t,"DefaultVisitTypeId",this._defaultToNoRFVs):this.filterByAllowedIds(t,"Id",this._defaultToNoRFVs)},arePrerequisitesComplete:function(){switch(this._mode){case n.OnDemandTelehealth:return this._isTelehealthLocationSelected();case n.FilterOnSelectedProviders:return this._appointment.Providers.size()>0;case n.FilterOnSelectedSpecialty:return null!==this.Data.AppointmentBuilder.Specialty;default:return!0}},beforeFirstRender:function(){var t=[],i=this.ViewModel.ReasonsForVisit;(t=this._mode===n.FilterOnSelectedSpecialty?this.getPreSelectedModelsOnly(i,"DefaultVisitTypeId"):this.getPreSelectedModelsOnly(i,"Id")).length>0&&(this.stepSettings.HideIfPreselected&&(this.stepSettings.Hide=!0),this.__selectFirstRfvFromList(t))},beforeRender:function(){this.isHidden()&&!this.hasPreselectedIds()&&this.__autoSelectRfvIfHidden();$afe.select("#AnonymousSchedulingBanner").safeReplaceWith($$WP.SimpleTemplates.Div({id:"telehealthBannerWeb"}));$afe.select("#EmergencyWarningBanner").safeReplaceWith($$WP.SimpleTemplates.Div({id:"telehealthBannerWeb"}))},__autoSelectRfvIfHidden:function(){this.isHidden()&&!this.hasPreselectedIds()&&(this.__selectFirstRfvFromList(this.ViewModel.ReasonsForVisit),this.Data.AppointmentBuilder.ReasonForVisit||this.showError())},__selectFirstRfvFromList:function(n){var t=n[0];t&&this.Data.AppointmentBuilder.setProperty("ReasonForVisit",t)},afterRender:function(){this.__setupPretext();$$WPSchedulingUtil.HandleStickyBanner();$$WPSchedulingUtil.FocusElement(this.$root.find("h2.header"));this.__isLoadingRfvData&&$$WPSchedulingRfvsCore.ShowAjaxSpinner(this.$root)},beforeNavigateBack:function(){this.Data.AppointmentBuilder.setProperty("ReasonForVisit",null)},__setupPretext:function(){var t,i,n;this._canShowStepPretext&&(t=this.$root.find(".reasonforvisitstep .pretext"),i=$$WP.Strings.getForTemplate("StepPretextHeader","Scheduling.Fixed"),(n=$$WP.Strings.getForTemplate("ReasonForVisitStepPretextExpanded","Scheduling"))&&!$$WPUtil.IsNullOrEmpty(n.string)&&new $$WP.UI.ProgressiveDisclosureController(t,i,n,$$WP.UI.ProgressiveDisclosureTypeEnum.Info))},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.ReasonForVisitStep},_onViewModelChanged:function(n){var t,i;for(t in n)switch(i=n[t].model||$$WP.Common.Model.getInstance(t),n[t].to){case r.StatesEnum.Selected:this.Data.AppointmentBuilder.setProperty("ReasonForVisit",null);this.Data.AppointmentBuilder.setProperty("ReasonForVisit",i);break;case r.StatesEnum.Unselected:this.Data.AppointmentBuilder.ReasonForVisit===i&&this.Data.AppointmentBuilder.setProperty("ReasonForVisit",null)}},_onReasonForVisitChanged:function(){var i=this.Data.AppointmentBuilder.ReasonForVisit,r=$$WPUtil.IsNullOrEmpty(i)?null:i.DefaultVisitType,u=null;if(null!==i){if(i.HasIncompleteSchedulingData&&!i.DefaultVisitType.hasNonAnonymousLqf())return this.Data.AppointmentBuilder.Specialty&&(u=this.Data.AppointmentBuilder.Specialty.Id),this.__isLoadingRfvData=!0,$$WPSchedulingRfvsCore.ShowAjaxSpinner(this.$root),void $$WPSchedulingRfvsCore.LoadReasonForVisitData(i.Id,this._workflow,u,this.__onReasonsForVisitDataLoaded);if(this.Data.AppointmentBuilder.IsSlotStepMultiApptPreGrouped=!1,this.Data.AppointmentBuilder.updateAppointmentsCollectionForReasonForVisit(i,e.VisitTypeSourceEnum.Default,this._workflow,this.__hasPatientLocationRule),this._mode===n.OnDemandTelehealth&&this.Data.TelehealthData){this.Data.TelehealthData.resetData();var f=this.Data.TelehealthLocations.getFirstInIndex("State",t.StatesEnum.Selected),o=f.SubLocations.getFirstInIndex("State",t.StatesEnum.Selected),s=null!==o?o.Id:null;return void t.checkRoutingDestinationForLocation(f.Id,s,i.OnDemandRFV,this._isAnonymous,this._onRoutingDestinationValidated)}}else this.Data.AppointmentBuilder.resetAppointmentsCollection();$$WPUtil.IsNullOrEmpty(i)||$$WPUtil.IsNullOrEmpty(r)||!r.isVisitTypeMyChartLink()?this._updateViewOnRFVChanged():$$WPSchedulingUtil.OnMyChartLinkClicked(this._workflow,this.Data,r.MenuLinkCompleteUri,r.DataAttributes)},__onReasonsForVisitDataLoaded:function(n){var t,i=this.Data.AppointmentBuilder.Specialty;this._openChangeBatch();$$WPSchedulingRfvsCore.UpdateDataPoolReasonsForVisit(this.Data,n.SchedulingViewModel);i&&this.Data.ReasonsForVisit.getFromIndex("Id",n.ReasonForVisitLineId).setProperty("SpecialtyGroupId",i.Id);this._closeChangeBatch();this.__isLoadingRfvData=!1;$$WPSchedulingRfvsCore.HideAjaxSpinner(this.$root);t=this.Data.ReasonsForVisit.getFromIndex("Id",n.ReasonForVisitLineId);this.Data.AppointmentBuilder.setProperty("ReasonForVisit",t);this.Data.prepForWorkflowAgain()},_updateViewOnRFVChanged:function(){this._updateStepStatus();this._setViewModelSelectedStates(this._getAvailableReasonsForVisit());this.ViewBinder.syncModelsToDOM();$$WPSchedulingUtil.HandleStickyBanner()},_onRoutingDestinationValidated:function(n){n.HasValidRoutingDestination?this._updateViewOnRFVChanged():this.Data.AppointmentBuilder.ReasonForVisit&&(this.Data.AppointmentBuilder.ReasonForVisit.EnabledForQuickSchedule||this.Data.AppointmentBuilder.ReasonForVisit.ExternallyAvailableForTelehealth)?(this.Data.AppointmentBuilder.ReasonForVisit.InternallyAvailableForTelehealth=!1,this._updateViewOnRFVChanged()):(this.ViewModel.HasNoLicensedTelehealthProviders=!0,this.showError(this.ViewModel))},_onAncillaryDataChanged:function(){this._isSelectedReasonForVisitValid()||this.Data.AppointmentBuilder.setProperty("ReasonForVisit",null);this.updateStep()},_isSelectedReasonForVisitValid:function(){var n,i,t;for(i=this.Data.AppointmentBuilder.ReasonForVisit,t=this._getAvailableReasonsForVisit(),n=0;n<t.length;n++)if(t[n]===i)return!0;return!1},_updateStepStatus:function(){this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete);null!==this.Data.AppointmentBuilder.ReasonForVisit&&(this.isHidden()?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete))},_setViewModelSelectedStates:function(n){for(var u,i=this.Data.AppointmentBuilder.ReasonForVisit,t=0;t<n.length;t++)(u=n[t]).ViewState=u===i?r.StatesEnum.Selected:r.StatesEnum.Unselected},_getUnfilteredReasonsForVisit:function(n,t){var i=this.Data.ReasonsForVisit.toArray();return $$WP.Scheduling.Workflow.buildReasonsForVisitNoFiltering(i,n,t,this._isAnonymous,this._workflow.IsGuest,this._workflow.IsFromPrelogin)},_getReasonsForVisitFilterOnProvider:function(){var u,t=0,i=0,r=[],f=[],n=null,e=null,o=this.Data.AppointmentBuilder.ReasonForVisit;for(f=this._appointment.Providers.toArray(),u=this.Data.ReasonsForVisit.toArray(),t=0;t<u.length;t++)if(n=u[t],s.isReasonForVisitAvailableProviderFirst(n))for(i=0;i<n.AllProviderDepartmentPairs.length;i++)if(e=n.AllProviderDepartmentPairs[i],-1!==f.indexOf(e.Provider)&&e.Provider.IsStandardProvider){r.push(n);break}return o&&-1===r.indexOf(o)&&f.length>0&&r.push(o),r},_getReasonsForVisitFilterOnSpecialty:function(){var n,t,i,u,f,e,s,o,h=[],r=null,c=null;if(null===(f=this.Data.AppointmentBuilder.Specialty))return[];if((s=this.Data.ReasonsForVisit.getFromIndex("SpecialtyGroupId",f.Id)).length>0)return s;for(e=this.Data.Departments.getFromIndex("SpecialtyGroupId",f.Id),o=this.Data.ReasonsForVisit.toArray(),n=0;n<o.length;n++)for(r=o[n],t=0;t<r.AllProviderDepartmentPairs.length;t++){for(u=!1,c=r.AllProviderDepartmentPairs[t],i=0;i<e.length;i++)if(e[i].ID===c.DepartmentId){u=!0;break}if(u){h.push(r);break}}return h},__getTelehealthReasonsForVisit:function(){var u,e,o,n,r,f,a,c,l;if(e=[],null===(r=this.Data.TelehealthLocations.getFirstInIndex("State",t.StatesEnum.Selected)))return[];for(f=r.SubLocations.getFirstInIndex("State",t.StatesEnum.Selected),o=this.Data.ReasonsForVisit.toArray(),u=0;u<o.length;u++){(n=o[u]).IsNotAvailableForPatientsLocation=!1;(a=$$WP.Utilities.UI.IsMobile?$$WP.Scheduling.TelehealthFilters.IsInLicensedLocation(n.AllowedTelemedicineLocations,r,f,i.PlatformFilterValueEnum.Mobile):$$WP.Scheduling.TelehealthFilters.IsInLicensedLocation(n.AllowedTelemedicineLocations,r,f,null,!0))&&n.ExternallyAvailableForTelehealth&&this.Data.TelehealthData.IsXOrgEnabled||i.DoesRFVHaveAnyAvailablePlatforms(n)&&(!$$WP.Utilities.UI.IsMobile||i.IsRFVEnabledForPlatform(n,i.PlatformFilterValueEnum.Mobile,this.Data.TelehealthData.IsXOrgEnabled));var v=i.IsRFVInLicensedLocationForQuickSchedule(n,r,f),s=n.EnabledForOnDemandVideoVisits,h=this.Data.TelehealthData.AutoSelectedWorkflow!==$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing&&v;(s||h)&&(c=s&&!a,l=h&&!v,(c&&l||c&&!h||l&&!s)&&(n.IsNotAvailableForPatientsLocation=!0),e.push(n))}return e},_isTelehealthLocationSelected:function(){var n;return!!(n=this.Data.TelehealthLocations.getFirstInIndex("State",t.StatesEnum.Selected))&&(!!n.SubLocations.getFirstInIndex("State",t.StatesEnum.Selected)||0===n.SubLocations.size())},hasStickyBanner:function(){return!0}};u.ModesEnum=n;$$WP.Scheduling.ReasonForVisitStepController=u;u.extend($$WP.Scheduling.StepController,"WP$Scheduling$ReasonForVisitStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=$$WP.Scheduling.ReasonForVisit.PatientTypeEnum,t=function(n,t,i,r,u,f,e,o,s,h,c,l){this.WP$Scheduling$ReasonForVisitStepController(n,t,i,r,f,$$WP.Scheduling.ReasonForVisitStepController.ModesEnum.NoFiltering,e,!1,!1,o,s);this.template=$$WP.Templates.Scheduling.ProviderReasonForVisitStep;this.proxify("updateStep","__onPatientTypeToggleChanged","__onPatientTypeChanged","__onReasonForVisitChanged");this.__allowedProviderIds=h||[];this.__allowedDepartmentIds=c||[];this.__preselectedPatientType=u;this.__allowMobileSchedulingInlineRedirects=l;this.$root.on("change","input[type='radio']",this.__onPatientTypeToggleChanged);this.Data.AppointmentBuilder.addPropertyListener("PatientType",this.__onPatientTypeChanged);this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this.__onReasonForVisitChanged)};t.prototype={__allowedProviderIds:[],__allowedDepartmentIds:[],__isInitialRenderComplete:!1,__preselectedPatientType:null,updateViewModel:function(){this.WP$Scheduling$ReasonForVisitStepController$updateViewModel();this.ViewModel.PatientTypeOptions=this.__buildPatientTypeOptions(this.ViewModel.ReasonsForVisit,this.__getCanLoginToSchedule());this.ViewModel.ProviderContextViewModel=$$WP.Scheduling.ProvidersCore.GetProviderContextViewModel(this.__getPrimaryProvider());this.SchedulingStringsNamespace.addMnemonic("@MYCHART@PROVIDER@",this.ViewModel.ProviderContextViewModel.Name,$$WP.Strings.EncodingTypes.HTML);this.ViewModel.StepTitle=$$WP.Strings.getForTemplate("FirstVisitLabel","Scheduling.fixed");this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@PROVIDER@");1===this.ViewModel.PatientTypeOptions.length&&(this.ViewModel.StepTitle=this.ViewModel.PatientTypeOptions[0].Title,this.ViewModel.Emblem=this.ViewModel.PatientTypeOptions[0].Emblem,this.ViewModel.PatientTypeOptions[0].Title=null)},__buildPatientTypeOptions:function(t,i){var r=[];return this.__isPatientTypePreselected()?r.push(this.__buildPatientTypeSchedulingOption(this.__preselectedPatientType,t,this.__preselectedPatientType===n.EstablishedPatient&&i)):(r.push(this.__buildPatientTypeSchedulingOption(n.NewPatient,t,!1)),r.push(this.__buildPatientTypeSchedulingOption(n.EstablishedPatient,t,i))),r},__buildPatientTypeSchedulingOption:function(n,t,i){var r=this.__getRfvToPreselect(),s=!!r&&r.ExpectedPatientType===n,h=!!r&&r.ExpectedPatientType!==n,e=i&&!s,u=this.__filterRfvsForPatientType(n,t,r),c=0===u.length||1===u.length&&!e,f="workflow=ExistingProvider&selProv="+this.__allowedProviderIds[0],o={PatientType:n,IsSelected:n===this.Data.AppointmentBuilder.PatientType,IsDeviationFromDeepLink:h,ReasonsForVisit:u.sort($$WP.Scheduling.ReasonForVisit.sortReasons),IsRfvListHidden:c,CanLoginToSchedule:e,LoginUrl:$$WP.Utilities.UI.IsLoggedIn?$$WP.Utilities.UI.IsMobile&&!this.__allowMobileSchedulingInlineRedirects?makeLink("epichttp://scheduling?"+f):makeLink("Scheduling?"+f):makeLink("Home/LogOut?skipAbandonCurrent=1&postloginmode=schedulingproxysel&destination=1&"+f),RfvListAdditionalData:{ViewBinderId:this.ViewBinder.ViewBinderId,ListLabelledById:"PatientTypeHeader_"+n}};return this.__setPatientTypeOptionStrings(n,o),o},__filterRfvsForPatientType:function(t,i,r){var o=null,f=n.Unknown,e=[],u;if(r&&r.ExpectedPatientType===t)e=[r];else for(u=0;u<i.length;u++)(f=(o=i[u]).ExpectedPatientType)!==t&&f!==n.Unknown&&f!==n.Both||e.push(o);return e},beforeFirstRender:function(){var n,t=this.ViewModel.ReasonsForVisit;this.__isPatientTypePreselected()&&this.Data.AppointmentBuilder.setProperty("PatientType",this.__preselectedPatientType);n=this.getPreSelectedModelsOnly(t,"Id");this.__canPreselectRfv(n)&&this.WP$Scheduling$ReasonForVisitStepController$beforeFirstRender()},__canPreselectRfv:function(t){var i,r=n.Unknown;return 0!==t.length&&(!(i=(r=t[0].ExpectedPatientType)===n.NewPatient||r===n.EstablishedPatient)||i&&this.__isPatientTypePreselected())},__isPatientTypePreselected:function(){return this.__preselectedPatientType===n.NewPatient||this.__preselectedPatientType===n.EstablishedPatient},beforeRender:function(){if(this.WP$Scheduling$ReasonForVisitStepController$beforeRender(),1===this.ViewModel.PatientTypeOptions.length){var n=this.ViewModel.PatientTypeOptions[0];0!==n.ReasonsForVisit.length||!n.CanLoginToSchedule||$$WPUtil.IsNullOrEmpty(n.LoginUrl)||$$WP.Utilities.UI.IsMobile?1!==n.ReasonsForVisit.length||n.CanLoginToSchedule||(this.stepSettings.Hide=!0,this.Data.AppointmentBuilder.setProperty("ReasonForVisit",n.ReasonsForVisit[0])):(this.stepSettings.Hide=!0,window.location.replace(this.ViewModel.PatientTypeOptions[0].LoginUrl))}},__onPatientTypeToggleChanged:function(n){var t=parseInt(n.currentTarget.value,10);this.Data.AppointmentBuilder.setProperty("PatientType",t)},__onPatientTypeChanged:function(){this.Data.AppointmentBuilder.setProperty("ReasonForVisit",null);this.updateStep()},__onReasonForVisitChanged:function(){this.__isInitialRenderComplete=!0},__getDepartmentLookbackDays:function(){for(var i=this.Data.Departments.toArray(),n=0,t=0;t<i.length;t++)n=Math.max(i[t].LookbackDays,n);return n},__getDepartmentPhone:function(){var n=this.__getPrimaryDepartment();return n?n.PhoneNumber:""},__getCanLoginToSchedule:function(){for(var t=this.Data.ProviderDepartmentPairs.toArray(),r=this.__getPrimaryProvider(),i=null,n=0;n<t.length;n++)if((i=t[n]).Provider===r&&i.CanLoginToSchedule)return!0;return!1},__getPrimaryDepartment:function(){var n=this.Data.Departments,t=n.toArray();return 1===this.__allowedDepartmentIds.length?n.getFromIndex("ID",this.__allowedDepartmentIds[0]):1===t.length?t[0]:null},__getPrimaryProvider:function(){return 1===this.__allowedProviderIds.length?this.Data.Providers.getFromIndex("ID",this.__allowedProviderIds[0]):null},__getRfvToPreselect:function(){var n=null,i=this._getAvailableReasonsForVisit(),t=this.getPreSelectedModelsOnly(i,"Id");return t.length>0&&(n=t[0]),this.__isInitialRenderComplete?null:n},__setPatientTypeOptionStrings:function(t,i){var r=this.__getDepartmentPhone();switch(t){case n.NewPatient:this.__setNewPatientOptionStrings(i,r);break;case n.EstablishedPatient:this.__setEstablishedPatientOptionStrings(i,r)}},__setNewPatientOptionStrings:function(n,t){n.RadioLabel=$$WP.Strings.getForTemplate("FirstVisitRadioButtonText","Scheduling.fixed");n.Warning=n.IsDeviationFromDeepLink?{Title:$$WP.Strings.getForTemplate("PatientTypeWarningTitle","Scheduling.fixed"),Description:$$WP.Strings.getForTemplate("NewPatientWarning","Scheduling")}:null;n.IsRfvListHidden?0===n.ReasonsForVisit.length&&(n.Title=$$WP.Strings.getForTemplate("CallToScheduleHeader","Scheduling.fixed"),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@DEPARTMENTPHONE@",t,$$WP.Strings.EncodingTypes.HTML),n.Instructions=$$WPUtil.IsNullOrEmpty(t)?$$WP.Strings.getForTemplate("NewPatientNoSchedulingCallSchedulingPhoneInstructions","Scheduling"):$$WP.Strings.getForTemplate("NewPatientNoSchedulingCallDepartmentInstructions","Scheduling"),this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@DEPARTMENTPHONE@"),n.Emblem="library.svg#_emblem_blankphone"):n.Title=$$WP.Strings.getForTemplate("ReasonForVisitStepHeader","Scheduling")},__setEstablishedPatientOptionStrings:function(n,t){n.RadioLabel=this.__getEstablishedPatientRadioButtonText(this.__getDepartmentLookbackDays());n.Warning=n.IsDeviationFromDeepLink?{Title:$$WP.Strings.getForTemplate("PatientTypeWarningTitle","Scheduling.fixed"),Description:$$WP.Strings.getForTemplate("EstablishedPatientWarning","Scheduling")}:null;this.SchedulingStringsNamespace.addMnemonic("@MYCHART@DEPARTMENTPHONE@",t,$$WP.Strings.EncodingTypes.HTML);n.IsRfvListHidden?n.CanLoginToSchedule?(n.Title=$$WP.Utilities.UI.IsLoggedIn?"":$$WP.Strings.getForTemplate("ScheduleInMyChartHeader","Scheduling.fixed"),n.Instructions=$$WP.Utilities.UI.IsLoggedIn?$$WP.Strings.getForTemplate("LookbackProviderInstructions","Scheduling"):$$WPUtil.IsNullOrEmpty(t)?$$WP.Strings.getForTemplate("EstablishedPatientNoSchedulingLoginOrCallSchedulingPhoneInstructions","Scheduling"):$$WP.Strings.getForTemplate("EstablishedPatientNoSchedulingLoginOrCallDepartmentInstructions","Scheduling"),n.LoginButtonText=$$WP.Utilities.UI.IsLoggedIn?$$WP.Strings.getForTemplate("ScheduleInDirectButtonText","Scheduling"):$$WP.Strings.getForTemplate("LogInButtonText","Scheduling.fixed"),n.Emblem="library.svg#_emblem_calendarwitharrow"):0===n.ReasonsForVisit.length&&(n.Title=$$WP.Strings.getForTemplate("CallToScheduleHeader","Scheduling"),n.Instructions=$$WPUtil.IsNullOrEmpty(t)?$$WP.Strings.getForTemplate("EstablishedPatientNoSchedulingCallSchedulingPhoneInstructions","Scheduling"):$$WP.Strings.getForTemplate("EstablishedPatientNoSchedulingCallDepartmentInstructions","Scheduling"),n.Emblem="library.svg#_emblem_blankphone"):(n.Title=$$WP.Strings.getForTemplate("ReasonForVisitStepHeader","Scheduling"),n.CanLoginToSchedule&&(n.Instructions=$$WPUtil.IsNullOrEmpty(t)?$$WP.Utilities.UI.IsLoggedIn?$$WP.Strings.getForTemplate("EstablishedPatientGoToDirectOrCallSchedulingPhoneInstructions","Scheduling"):$$WP.Strings.getForTemplate("EstablishedPatientLoginOrCallSchedulingPhoneInstructions","Scheduling"):$$WP.Utilities.UI.IsLoggedIn?$$WP.Strings.getForTemplate("EstablishedPatientGoToDirectOrCallDepartmentInstructions","Scheduling"):$$WP.Strings.getForTemplate("EstablishedPatientLoginOrCallDepartmentInstructions","Scheduling"),n.LoginButtonText=$$WP.Utilities.UI.IsLoggedIn?$$WP.Strings.getForTemplate("ScheduleInDirectButtonText","Scheduling"):$$WP.Strings.getForTemplate("LogInButtonText","Scheduling.fixed")));this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@DEPARTMENTPHONE@")},__getEstablishedPatientRadioButtonText:function(n){return n>=150&&n<=210?$$WP.Strings.getForTemplate("EstablishedVisitRadioButtonTextSixMonths","Scheduling.fixed"):n>=211&&n<=400?$$WP.Strings.getForTemplate("EstablishedVisitRadioButtonTextOneYear","Scheduling.fixed"):n>=401&&n<=800?$$WP.Strings.getForTemplate("EstablishedVisitRadioButtonTextTwoYears","Scheduling.fixed"):n>=801&&n<=1200?$$WP.Strings.getForTemplate("EstablishedVisitRadioButtonTextThreeYears","Scheduling.fixed"):$$WP.Strings.getForTemplate("EstablishedVisitRadioButtonText","Scheduling.fixed")}};$$WP.Scheduling.ProviderReasonForVisitStepController=t;t.extend($$WP.Scheduling.ReasonForVisitStepController,"WP$Scheduling$ProviderReasonForVisitStepController")}();!function(){var e=$$WP.Scheduling.VisitType,t=$$WP.Scheduling.Lqf,o=$$WP.Scheduling.SchedulingOverride,r=$$WP.Scheduling.Appointment,f=Epic.PatientEngagement.Questionnaire.Ui,i=$$WP.Scheduling.Workflow,u=function(t,r,u,f,e,o,s){if(this.WP$Scheduling$StepController(t,r,o),this.proxify("updateStep","__onQuestionnaireAnswersEvaluated","_onAncillaryDataChanged","decisionTreeCallback","decisionTreeStepOnRenderCallback","questionnaireOnRenderCallback","_onResetLqfClicked","_onLqfDataChanged","_onResetClientStateLoadCompleted","__onAppointmentsChanged"),this._mode=u||n.Standard,this._workflow=e,this._ticketInfo=e.TicketInfo,this.__originalAppointmentInfo=e.OriginalAppointmentInfo,this._favoriteAppointmentInfo=e.FavoriteAppointmentInfo,this._stopSchedulingCallback=f,this._allowedProviderIds=o,this.__hasPatientLocationRule=s,this.__eventManager=new $$WP.Scheduling.EventManager,this.__addReasonForVisitListener(),this._mode===n.DepartmentOverride)for(var h=0;h<this.Data.SchedulingSteps.Models.length;h++)this.Data.SchedulingSteps.Models[h].Type===$$WP.Scheduling.SchedulingStep.StepTypeEnum.StandardLqf&&(this._prerequisiteStep=this.Data.SchedulingSteps.Models[h]);this._workflow.Type!==i.WorkflowTypesEnum.DecisionTreeNode&&this._workflow.Type!==i.WorkflowTypesEnum.Ticket||""!==this._workflow.SchedulingControllerParams.decisionTreeNodeCSN&&""!==this._workflow.SchedulingControllerParams.decisionTreeNodeID&&""!==this._workflow.SchedulingControllerParams.rootDecisionTreeID&&(this._workflow.decisionTreeNodeCSN=this._workflow.SchedulingControllerParams.decisionTreeNodeCSN,this._workflow.decisionTreeNodeID=this._workflow.SchedulingControllerParams.decisionTreeNodeID,this._workflow.rootDecisionTreeID=this._workflow.SchedulingControllerParams.rootDecisionTreeID);this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("add",this.__onAppointmentsChanged);this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("remove",this.__onAppointmentsChanged);this.__onAppointmentsChanged();this.$root.on("click","#reset-lqf",this._onResetLqfClicked);$$WPUtil.FixScrollingForIOS(this.$root)},s={__eventManager:null,_mode:null,renderCollapsed:null,_stopSchedulingCallback:null,_ticketInfo:null,__originalAppointmentInfo:null,_favoriteAppointmentInfo:null,_pendingResult:null,_questionnaireController:null,_questionnaireControllerLqfId:null,_decisionTreeController:null,_decisionTreeLqfId:null,_dataWasReloaded:!1,_lqfWasFiled:!1,_lastSelectedRfv:null,_lastSelectedDep:null,_prerequisiteStep:null,_isReloading:!1,_providersUpdatedViewModel:null,__reasonForVisitPropertyListenerId:null,__savedReasonForVisitFromReload:null,__hadAnyQuestions:!1,__currentVisitIndex:0,__isAskForEachAppointment:!1,__initialRfv:null,__hasPatientLocationRule:null,updateViewModel:function(){var t=this.Data.AppointmentBuilder.getFirstAppointment(),n;$$WPUtil.IsNullOrEmpty(t.BundleId)||(this.__isAskForEachAppointment=!0);n=this._getCurrentLqf();this.ViewModel={StepShouldBeActive:!0,Count:0,LqfId:n.LqfId,LqfType:n.LqfType,stepId:this.Id,ProvidersUpdated:this._providersUpdatedViewModel,HadAnyQuestions:this.__hadAnyQuestions,ProviderContextViewModel:this.__getProviderContextViewModel()};$$WPUtil.IsNullOrEmpty(this.ViewModel.LqfId)?this._lqfWasFiled?(this.stepSettings.Hide=!1,this.renderCollapsed=!0):this._isReloading?(this.stepSettings.Hide=!1,this.renderCollapsed=!1):(this.stepSettings.Hide=!0,this.renderCollapsed=!1):(this.stepSettings.Hide=!1,this.renderCollapsed=!1,null===this.__initialRfv&&this._workflow.Type!==i.WorkflowTypesEnum.ExistingProvider&&(this.__initialRfv=t.ReasonForVisit))},arePrerequisitesComplete:function(){var t=this.Data.AppointmentBuilder.allAppointmentsHaveAVisitTypeSpecified(),i=this.Data.AppointmentBuilder.allAppointmentsHaveALocationSelected();switch(this._mode){case n.Standard:return t;case n.DepartmentOverride:return t&&i&&this._isPrerequisiteStepComplete()}},arePrerequisitesCompleteForStatusChange:function(){return this.arePrerequisitesComplete()&&!this._isReloading},_isPrerequisiteStepComplete:function(){return!this._prerequisiteStep||this._prerequisiteStep.CompleteStatus!==$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete},beforeFirstRender:function(){this._updateStepStatus()},beforeRender:function(){switch(this.ViewModel.LqfType){case t.LqfTypeEnum.Questionnaire:this.template=$$WP.Templates.Scheduling.Questionnaire;this.collapsedTemplate=$$WP.Templates.Scheduling.QuestionnaireCollapsed;break;case t.LqfTypeEnum.DecisionTree:default:this.template=$$WP.Templates.Scheduling.DecisionTree;this.collapsedTemplate=$$WP.Templates.Scheduling.QuestionnaireCollapsed}},afterRender:function(){var n=this.ViewModel.LqfId;if($$WPUtil.IsNullOrEmpty(n))this._isReloading&&this.__showLoadingSpinner();else switch(this.ViewModel.LqfType){case t.LqfTypeEnum.Questionnaire:this._showQuestionnaire(n);break;case t.LqfTypeEnum.DecisionTree:this._showDecisionTree(n)}this.Data.AppointmentBuilder.OriginallySelectedProviders||this._workflow.Type!==$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider||(this.Data.AppointmentBuilder.OriginallySelectedProviders=this.Data.AppointmentBuilder.getFirstAppointment().Providers.toArray().slice());this.__setInitialFocus();this._providersUpdatedViewModel=null},onNavigateBack:function(){this.__initialRfv=null},__setInitialFocus:function(){var n=null;(n=this.$root.find(".providersUpdatedSubheader")).length<1&&(n=this.$root.find("h2.header"));$$WPSchedulingUtil.FocusElement(n)},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.LQFStep},_updateStepStatus:function(){this.arePrerequisitesCompleteForStatusChange()&&$$WPUtil.IsNullOrEmpty(this._getCurrentLqf().LqfId)?this._lqfWasFiled&&this.__hadAnyQuestions?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)},shouldRemainOnStep:function(){return!!this._providersUpdatedViewModel},__onAppointmentsChanged:function(){var i=0,t=null;for(this.__eventManager.removeAllListeners(),i=0;i<this.Data.AppointmentBuilder.numAppointments();i++)t=this.Data.AppointmentBuilder.getAppointment(i),this.__eventManager.addCollectionEventListener(t.Lqfs,"add",this._onLqfDataChanged),this.__eventManager.addCollectionEventListener(t.Lqfs,"remove",this._onLqfDataChanged),this._mode===n.DepartmentOverride&&(this.__eventManager.addCollectionEventListener(t.Locations,"add",this._onAncillaryDataChanged),this.__eventManager.addCollectionEventListener(t.Locations,"remove",this._onAncillaryDataChanged))},_onAncillaryDataChanged:function(){switch(this._mode){case n.Standard:this._resetClientStateIfRfvChanged();break;case n.DepartmentOverride:this._resetClientStateIfRfvChanged();this._resetClientStateIfDepChanged()}this._updateStepStatus();this.getComplete()!==$$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired&&this.getComplete()!==$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete||this._removeOldContent();this.updateStep()},_removeOldContent:function(){$$WPUtil.IsNullOrEmpty(this._questionnaireController)||this._removeQuestionnaire();$$WPUtil.IsNullOrEmpty(this._decisionTreeController)||this._removeDecisionTree()},_removeQuestionnaire:function(){this._questionnaireController.destroy();this._questionnaireController=null;this._questionnaireControllerLqfId=""},_removeDecisionTree:function(){this._decisionTreeController.destroy();this._decisionTreeController=null;this._decisionTreeLqfId=""},_onLqfDataChanged:function(){this._updateStepStatus();this.updateStep();$$WPSchedulingUtil.HandleStickyBanner()},_onResetLqfClicked:function(){this._showResetLqfPopup()},_showResetLqfPopup:function(){var n,t,i;n=new $$WPComp.ComplexObjects.Button($$WP.Strings.getForTemplate("RetakeQuestionnairePopupConfirmation","Scheduling"));t=new $$WPComp.ComplexObjects.Button($$WP.Strings.getForTemplate("RetakeQuestionnairePopupCancel","Scheduling"));i=new $$WPComp.ConfirmComponent({IsClosable:!0,TitleText:$$WP.Strings.getForTemplate("RetakeQuestionnairePopupTitle","Scheduling"),Html:$$WP.Strings.getForTemplate("RetakeQuestionnairePopupBody","Scheduling"),ToolbarButtons:[n,t],callback:$.proxy(this._resetLqfCallback,this)});$$WPUtil.quickPopup(i)},_resetLqfCallback:function(n){!1!==n&&(this._canResetLqfInline()?this._resetClientState():($$WP.Utilities.IsMobile||WP.Events.cancelBeforeUnload(),$$WPSchedulingUtil.Reload(this._workflow.IsAuthenticatedWidget)))},_canResetLqfInline:function(){var t,n=0;if(this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.Reschedule||this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.DecisionTreeNode||this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.Ticket)return!1;for(t=this.Data.AppointmentBuilder.getFirstAppointment().Lqfs.toArray(),n=0;n<t.length;n++)if(t[n].CompletingStep!==this.Id)return!1;return!0},_resetClientStateIfRfvChanged:function(){var n=this.Data.AppointmentBuilder.ReasonForVisit;!this._lastSelectedRfv||n&&n.Id===this._lastSelectedRfv.Id||this._resetClientState();this._lastSelectedRfv=n},_resetClientStateIfDepChanged:function(){var t,n;(t=this.Data.AppointmentBuilder.getFirstAppointment().Locations.toArray()[0])&&(n=t.Departments[0]);!n||this._lastSelectedDep&&n.ID===this._lastSelectedDep.ID||this._resetClientState();this._lastSelectedDep=n},_resetClientState:function(){this._lqfWasFiled&&(this._isReloading=!0,this.Data.NumStepsReloading++,this.__hadAnyQuestions=!1,this._lqfWasFiled=!1,this._resetLqfStatuses(),this._resetVisitType(),this.__clearSelectionsToTheRight(),this._dataWasReloaded?(this._dataWasReloaded=!1,this._reloadWorkflowData(this._onResetClientStateLoadCompleted,!0)):$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("ResetQuestionnaires",this._workflow)),cache:!1,success:this._onResetClientStateLoadCompleted}))},_reloadWorkflowData:function(n,t,i,r){var u;this._workflow&&this._workflow.isTypeNewProvider()?$$WPUtil.IsNullOrEmpty(this._workflow.SchedulingDataPool.AppointmentBuilder.Specialty)?this._onResetClientStateLoadCompleted():$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("GetSpecialtyData",this._workflow)),data:$$WPUtil.postify({SpecialtyId:this._workflow.SchedulingDataPool.AppointmentBuilder.Specialty.Id,ServiceAreas:this._workflow.ServiceAreas,isFirstLoad:t,schedulingOverridesString:JSON.stringify(i)}),cache:!1,success:n}):(this._workflow&&this._workflow.SchedulingControllerParams?(u=this._workflow.SchedulingControllerParams.workflow,this._workflow.SchedulingControllerParams.workflow=this._workflow.Type):(u=this._workflow.Type,this._workflow.SchedulingControllerParams={},this._workflow.SchedulingControllerParams.workflow=this._workflow.Type),$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("ReloadSchedulingWorkflowData",this._workflow)),data:{schedulingParameters:this._workflow.SchedulingControllerParams,isFirstLoad:t,schedulingOverridesString:JSON.stringify(i),schedulingOverridesListString:JSON.stringify(r)},cache:!1,success:n}),this._workflow.SchedulingControllerParams.workflow=u)},__clearSelectionsToTheRight:function(){this._mode===n.Standard&&this.__clearLocationSelections();this._workflow.Type!==$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider&&this.__clearProviderSelections()},__clearProviderSelections:function(){for(var t=this.Data.AppointmentBuilder.numAppointments(),n=0;n<t;n++)this.Data.AppointmentBuilder.getAppointment(n).clearProviderSelections()},__clearLocationSelections:function(){for(var t=this.Data.AppointmentBuilder.numAppointments(),n=0;n<t;n++)this.Data.AppointmentBuilder.getAppointment(n).clearLocationSelections()},_onResetClientStateLoadCompleted:function(n){this._isReloading=!1;$$WPUtil.IsNullOrEmpty(n)||this._onDataLoaded(n,!1,[],!1);this.Data.NumStepsReloading--;this.updateStep()},_resetLqfStatuses:function(){for(var n=null,r=null,t=0,i=0,u=[],t=0;t<this.Data.AppointmentBuilder.numAppointments();t++){for((n=this.Data.AppointmentBuilder.getAppointment(t)).Lqfs.openChangeBatch(),u=n.Lqfs.toArray().slice(),i=0;i<u.length;i++)(r=u[i]).CompletingStep===this.Id&&(r.Reset(),n.Lqfs.remove(r));n.SchedulingOverride=null;n.IsLqfChainStopped=!1;n.Lqfs.closeChangeBatch()}},_resetVisitType:function(){var n=null;(n=this._ticketInfo?this._ticketInfo.ReasonForVisit:this.Data.AppointmentBuilder.ReasonForVisit)&&this.Data.AppointmentBuilder.updateAppointmentsCollectionForReasonForVisit(n,r.VisitTypeSourceEnum.Default,this._workflow,this.__hasPatientLocationRule);this.__setOriginalVisitTypeIdOnAllAppointments("")},decisionTreeCallback:function(n,i){n===$$WP.DecisionTrees.Enums.TraversalStatus.Error?this._showErrorAndExit():this._evaluateLqfAnswers(this._decisionTreeLqfId,t.LqfTypeEnum.DecisionTree,i)},decisionTreeStepOnRenderCallback:function(){this.getSchedulingContinueBanner().addClass("stickybanner");$$WPSchedulingUtil.HandleStickyBanner()},questionnaireCallback:function(n,i,r){$$WPUtil.IsNullOrEmpty(r)?this._evaluateLqfAnswers(this._questionnaireControllerLqfId,t.LqfTypeEnum.Questionnaire,i):this._showErrorAndExit()},questionnaireOnRenderCallback:function(n){f.defaultAfterViewLoadCallback(n);this.getSchedulingContinueBanner().addClass("stickybanner");$$WPSchedulingUtil.HandleStickyBanner()},_showErrorAndExit:function(){var n;null!==this._stopSchedulingCallback&&(n={LqfInstructions:$$WP.Strings.get("ScheduleErrorMessage","Scheduling")},this._stopSchedulingCallback(n))},_evaluateLqfAnswers:function(r,u,f){var l,p,w,b,s=null,a=null,e=null,k={},c=null,v=[],y=[],d=[],g=0,h=0;for(this._lqfWasFiled=!0,s=this.Data.AppointmentBuilder.getAppointment(this.__currentVisitIndex),l=$$WPSchedulingLqfCore.GetVisitTypeFromAppointment(s,this.Data.VisitTypes),c=this.Data.Lqfs.getFromIndex(["Id","AppointmentIndex"],[r,this.__currentVisitIndex]),$$WPUtil.IsNullOrEmpty(c)&&(k={Id:r,Type:u,AppointmentIndex:this.__currentVisitIndex},c=new t(k),this.Data.Lqfs.add(c)),w=(p=s.Lqfs.toArray()).length,h=0;h<w;h++)v.push(p[h].Id);if(v.push(r),s.SchedulingOverride&&s.SchedulingOverride.HqaIds)for(g=(d=s.SchedulingOverride.HqaIds).length,h=0;h<g;h++)y.push(d[h]);y.push(f);e=new o({LqfIds:v,HqaIds:y,OriginalPrcId:l.ID});$$WPUtil.IsNullOrEmpty(this._ticketInfo)?(a=this.Data.AppointmentBuilder.ReasonForVisit,e.OriginalRfv=a.CategoryValue,e.OriginalRfvLine=a.Id,this._mode===n.DepartmentOverride&&(currentLqfInfo=this._getCurrentLqf(),e.SourceOverrideDepartmentId=currentLqfInfo.Department.ID),this._workflow.OriginalAppointmentInfo&&0!==s.AppointmentRequestIds.length&&(e.OriginalAppointmentRequestIds=s.AppointmentRequestIds)):(e.OriginalTicketId=this._ticketInfo.TicketId,e.OriginalAppointmentRequestIds=s.AppointmentRequestIds);this._workflow.Type!==i.WorkflowTypesEnum.DecisionTreeNode&&this._workflow.Type!==i.WorkflowTypesEnum.Ticket||(e.WorkflowType=this._workflow.Type,e.RootDecisionTreeId=this._workflow.rootDecisionTreeID,e.DecisionTreeNodeId=this._workflow.decisionTreeNodeID,e.DecisionTreeNodeCsn=this._workflow.decisionTreeNodeCSN);this.Data.SchedulingOverrides.add(e);this.__setOriginalVisitTypeIdOnAppropriateAppointments(l.ID);c.SchedulingOverride=e;b={workflow:this._workflow.toRawRequestObject(),schedulingOverridesString:JSON.stringify(e),nonce:$$WPUtil.GetPageNonce()};this.__showLoadingSpinner();$afe.select("#refresh-area"+this.Id).hide();$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("EvaluateQuestionnaireAnswers",this._workflow)),data:$$WPUtil.postify(b),cache:!1,success:this.__onQuestionnaireAnswersEvaluated,traditional:!0})},__addReasonForVisitListener:function(){null===this.__reasonForVisitPropertyListenerId&&(this.__reasonForVisitPropertyListenerId=this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this._onAncillaryDataChanged),this.__savedReasonForVisitFromReload=null)},__removeReasonForVisitListener:function(){this.Data.AppointmentBuilder.removePropertyListener(this.__reasonForVisitPropertyListenerId);this.__reasonForVisitPropertyListenerId=null;this.__savedReasonForVisitFromReload=this.Data.AppointmentBuilder.ReasonForVisit},__showLoadingSpinner:function(){this.template===$$WP.Templates.Scheduling.DecisionTree?$$WPUtil.ShowAjaxSpinner(this.$root.find(".dt-spinner .ajaxspinner")):this.template===$$WP.Templates.Scheduling.Questionnaire&&($$WPUtil.ShowAjaxSpinner(this.$root.find(".qnr-spinner .ajaxspinner")),this.$root.find(".qnr-spinner").safeAttr("style","display:block"))},__hideLoadingSpinner:function(){this.template===$$WP.Templates.Scheduling.DecisionTree?$$WPUtil.HideAjaxSpinner(this.$root.find(".dt-spinner .ajaxspinner")):this.template===$$WP.Templates.Scheduling.Questionnaire&&($$WPUtil.HideAjaxSpinner(this.$root.find(".qnr-spinner .ajaxspinner")),this.$root.find(".qnr-spinner").safeAttr("style","display:none"))},__setOriginalVisitTypeIdOnAppropriateAppointments:function(n){this.__isAskForEachAppointment?this.Data.AppointmentBuilder.getAppointment(this.__currentVisitIndex).setProperty("OriginalVisitTypeId",n):this.__setOriginalVisitTypeIdOnAllAppointments(n)},__setOriginalVisitTypeIdOnAllAppointments:function(n){for(var t=0,t=0;t<this.Data.AppointmentBuilder.numAppointments();t++)this.Data.AppointmentBuilder.getAppointment(t).setProperty("OriginalVisitTypeId",n)},__onQuestionnaireAnswersEvaluated:function(n){var o=null,r=null,u=null,t=null,f=[],e=null,s=null,i;if("object"!==$.type(n))this.__hideLoadingSpinner(),o=new $$WPComp.MessageComponent({TitleText:$$WP.Strings.get("ErrorTitle","Scheduling"),Message:$$WP.Strings.get("QuestionnaireEvaluationErrorMessage","Scheduling"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button($$WP.Strings.get("RequestErrorButtonLabel","Scheduling"),null,"cancelworkflow","")]}),$$WPUtil.quickPopup(o);else if(r=this.Data.Lqfs.getFromIndex(["Id","AppointmentIndex"],[n.LqfId,this.__currentVisitIndex]),this.__hadAnyQuestions=this.__hadAnyQuestions||this.__currentLqfHasAnyQuestions(),n.ReloadDynamicData){for(this._pendingResult=n,this.Data.AppointmentBuilder.setProperty("HasPendingDecisionTree",!$$WPUtil.IsNullOrEmpty(this._pendingResult)),i=0;i<this.Data.AppointmentBuilder.numAppointments();i++)(e=this.Data.AppointmentBuilder.getAppointment(i))&&e.SchedulingOverride&&f.push(e.SchedulingOverride);r&&(u=r.SchedulingOverride,f.push(u));this.__showLoadingSpinner();this.__removeReasonForVisitListener();t=$.proxy(function(t){this._onDataLoaded(t,!0,n.ProvidersToSelect,!0)},this);this._reloadWorkflowData(t,!1,u,f);this._dataWasReloaded=!0}else this.__getCurrentReasonForVisit().HasIncompleteSchedulingData?(t=$.proxy(function(t){this.__onReasonsForVisitDataLoaded(t,n)},this),this.__showLoadingSpinner(),this.__removeReasonForVisitListener(),this.Data.AppointmentBuilder.Specialty&&(s=this.Data.AppointmentBuilder.Specialty.Id),$$WPSchedulingRfvsCore.LoadReasonForVisitData(this.__getCurrentReasonForVisit().Id,this._workflow,s,t),this._dataWasReloaded=!0):(this._handleResult(n),this.updateStep())},__onReasonsForVisitDataLoaded:function(n,t){var r=this.__getCurrentReasonForVisit(),u=this.__getAppointmentSelections(),i=this.Data.AppointmentBuilder.Specialty;this._openChangeBatch();$$WPSchedulingRfvsCore.UpdateDataPoolReasonsForVisit(this.Data,n.SchedulingViewModel);i&&this.Data.ReasonsForVisit.getFromIndex("Id",n.ReasonForVisitLineId).setProperty("SpecialtyGroupId",i.Id);this.__updateAppointments(null,u,r,!1);this._closeChangeBatch();this.__hideLoadingSpinner();this._handleResult(t);this.updateStep()},_onDataLoaded:function(n,t,i,r){var e,f,u={};u.NetRemoved={};u.NetAdded={};u.ToSelect={};u.ToDeselect={};f=this.__getCurrentReasonForVisit();e=this.__getAppointmentSelections();t&&(this.__appendPreexistingProvDifferences(u),this.__handleIneligibleSelectedProvider(u));this._openChangeBatch();this.__updateSchedulingData(n);f&&this.__updateProviderDifferences(u,e,f,i,r);(this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider||this._workflow.isTypeOpenScheduling()&&this.__isProviderSpecifiedInQueryString()||this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.Reschedule)&&this.__updateAppointmentSelections(e,u);this.__updateAppointments(u,e,f,t);this._closeChangeBatch();this.__areSelectionsStillValid(f,e)||this._showErrorAndExit();this.__resolvePendingResults(f);this._onAncillaryDataChanged()},__updateProviderDifferences:function(n,t,i,r,u){var f;f=this.__getProviderIdsAvailableForSelection(i,t,u);this.__appendNewProvDifferences(n,r,f);this.__removeProviderIntersections(n);this.__handleReaddedProviders(n,f);this.__handleRemovedProviders(n)},__updateAppointments:function(n,t,i,r){var u,f,e;f=this.__canShowAddedProvidersInUpdatedViewModel(i);e=this.__canShowRemovedProvidersInUpdatedViewModel();u=t[0].Providers.length>0&&this.__areAllProvidersReplaced(n,t)||!!this._providersUpdatedViewModel&&this._providersUpdatedViewModel.WereAllProvidersEverReplaced;this.__canShowProviderUpdates(n)&&this.__setProviderUpdatedViewModel(n,u,r,f,e);r&&this.__flagModifiedProviders(n);this.__reapplyAppointmentSelections(t);this.__addReasonForVisitListener();this.__updateAppointmentReasonForVisit(i)},__setProviderUpdatedViewModel:function(n,t,i,r,u){this._providersUpdatedViewModel=$$WP.Scheduling.ProvidersUpdatedViewModel.buildViewModel(n,this.__hadAnyQuestions,t,i,r,u)},__getProviderContextViewModel:function(){var n,t,i;return t=this.__getCurrentReasonForVisit(),i=this.__getReasonForVisit(t),$$WPUtil.IsNullOrEmpty(this.ViewModel)||$$WPUtil.IsNullOrEmpty(this.ViewModel.ProviderContextViewModel)?($$WPSchedulingUtil.IsStandaloneWidget(this._workflow)&&i.DefaultVisitType.AllowProviderSelect&&!$$WPUtil.IsNullOrEmpty(this._allowedProviderIds)&&1===this._allowedProviderIds.length&&(n=this.Data.Providers.getFromIndex("ID",this._allowedProviderIds[0])),$$WP.Scheduling.ProvidersCore.GetProviderContextViewModel(n)):this.ViewModel.ProviderContextViewModel},__canShowProviderUpdates:function(n){return!$$WPUtil.IsNullOrEmpty(this._workflow)&&(this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider||!!(this._workflow.isTypeOpenScheduling()&&this.__isProviderSpecifiedInQueryString()&&this.__canShowOriginallySelectedProviderInUpdatedViewModel())||!!(this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.Reschedule&&n.NetRemoved&&Object.keys(n.NetRemoved).length>0))},__canShowAddedProvidersInUpdatedViewModel:function(n){var t=this.__getReasonForVisit(n),i=null;if(this.__isVisitTypeChanged(n,t))return t.DefaultVisitType.AllowProviderSelect;if(this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider&&t)return t.AllowProviderSelect;if(n){if(null!==n.AllowProviderSelect&&void 0!==n.AllowProviderSelect)return n.AllowProviderSelect;if(i=n.DefaultVisitType)return i.AllowProviderSelect}return!0},__canShowRemovedProvidersInUpdatedViewModel:function(){var n=null;if(this._workflow.Type===i.WorkflowTypesEnum.ExistingProvider)return!0;if(this.__initialRfv){if(n=this.__initialRfv.DefaultVisitType,"boolean"==typeof this.__initialRfv.AllowProviderSelect)return this.__initialRfv.AllowProviderSelect;if(n)return n.AllowProviderSelect}return!0},__canShowOriginallySelectedProviderInUpdatedViewModel:function(){var t,n,i;return n=this.__getCurrentReasonForVisit(),i=this.__getAppointmentSelections(),t=this.__getProviderIdsAvailableForSelection(n,i,!0),!this.__canShowAddedProvidersInUpdatedViewModel(n)||!$$WPSchedulingProvidersCore.IsSingleAllowedProviderStillElligibleForScheduling(t,this._allowedProviderIds)},__isProviderSpecifiedInQueryString:function(){var n=this._workflow.SchedulingControllerParams;return!$$WPUtil.IsNullOrEmpty(n.id)||!$$WPUtil.IsNullOrEmpty(n.provId)||!$$WPUtil.IsNullOrEmpty(n.prov)},__updateAppointmentReasonForVisit:function(n){var t=null;n&&(t=this.__getReasonForVisit(n),this.__setLastSelectedReasonForVisit(t),this.Data.AppointmentBuilder.setProperty("ReasonForVisit",t))},__getVisitTypeSource:function(t,i){return this.__isVisitTypeChanged(t,i)?this._mode===n.DepartmentOverride?r.VisitTypeSourceEnum.DepartmentOverrideLqf:r.VisitTypeSourceEnum.StandardLqf:r.VisitTypeSourceEnum.Default},__isVisitTypeChanged:function(n,t){return!!(n&&t&&n.DefaultVisitType&&t.DefaultVisitType)&&n.DefaultVisitType.ID!==t.DefaultVisitType.ID},__areAllProvidersReplaced:function(n,t){var i=0;return n&&(i=Object.keys(n.ToSelect).length),0!==i&&i===t[0].Providers.length},__currentLqfHasAnyQuestions:function(){var n=!1;return(this._questionnaireController&&this._questionnaireController.lqfId===this.ViewModel.LqfId||this._decisionTreeController&&this._decisionTreeController.hadAnyQuestions())&&(n=!0),n},__updateSchedulingData:function(n){this.Data.clearSchedulingData();this.__setSchedulingData(n)},__flagModifiedProviders:function(n){var t=null,i=null;for(i in n.NetAdded)(t=this.Data.Providers.getFirstInIndex("ID",i))&&(t.LqfProviderAction=$$WP.Scheduling.Provider.LqfActionEnum.Added);for(i in n.NetRemoved)(t=this.Data.Providers.getFirstInIndex("ID",i))&&(t.LqfProviderAction=$$WP.Scheduling.Provider.LqfActionEnum.Removed)},__appendNewProvDifferences:function(n,t,i){var e,u,r=[],f={},o=this.Data.AppointmentBuilder.Appointments.Models[0],s=this.Data.AppointmentBuilder.getOriginalAppointment(o,this.__originalAppointmentInfo);0===(r=o.Providers.Models).length&&this._workflow.isTypeOpenScheduling()&&this.__getProvidersFromReasonForVisit(r);0===r.length&&this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.Reschedule&&s.VisitTypes[0].AllowProviderSelect&&(r=s.Providers.Models);u=this.__getRemovedProviders(r,i);e=this.__areAllProvidersRemoved(r.length,u);f=this.__shouldSelectAllProviders(e,t,this._workflow.Type)?this.__getAddedProviders(r,i,i):this.__getAddedProviders(r,t,i);this.__assign(f,n.ToSelect);this.__assign(u,n.ToDeselect);this.__assign(f,n.NetAdded);this.__assign(u,n.NetRemoved)},__getProvidersFromReasonForVisit:function(n){if(this.Data.AppointmentBuilder.ReasonForVisit&&this.Data.AppointmentBuilder.ReasonForVisit.DirectProviderDepartmentPairs)for(var i=this.Data.AppointmentBuilder.ReasonForVisit.DirectProviderDepartmentPairs.length,t=0;t<i;t++)n.push(this.Data.AppointmentBuilder.ReasonForVisit.DirectProviderDepartmentPairs[t].Provider)},__assign:function(n,t){for(var i in n)t[i]=n[i]},__appendPreexistingProvDifferences:function(n){for(var i=0,t=null,r=this.Data.Providers.toArray(),i=0;i<r.length;i++)(t=r[i]).LqfProviderAction===$$WP.Scheduling.Provider.LqfActionEnum.Added?n.NetAdded[t.ID]=t:t.LqfProviderAction===$$WP.Scheduling.Provider.LqfActionEnum.Removed&&(n.NetRemoved[t.ID]=t)},__removeProviderIntersections:function(n){for(var t=0,i=null,r=Object.keys(n.NetRemoved),t=0;t<r.length;t++)i=r[t],n.NetAdded[i]&&(delete n.NetAdded[i],delete n.NetRemoved[i])},__handleReaddedProviders:function(n,t){for(var r=0,i=null,u=Object.keys(n.NetRemoved),r=0;r<u.length;r++)i=u[r],t.indexOf(i)>=0&&(n.ToSelect[i]=n.NetRemoved[i],delete n.NetRemoved[i])},__handleRemovedProviders:function(n){var i=null,t="";for(t in n.NetRemoved)i=n.NetRemoved[t],this.Data.Providers.getFromIndex("ID",t)||this.Data.Providers.add(i)},__handleIneligibleSelectedProvider:function(n){var t,i=null,r=this.__getCurrentReasonForVisit(),u=this.__getAppointmentSelections(),f=this.__getProviderIdsAvailableForSelection(r,u,!0);$$WPUtil.IsNullOrEmpty(this._allowedProviderIds)||$$WPUtil.IsNullOrEmpty(n)||(t=this._allowedProviderIds[0],!$$WPUtil.IsNullOrEmpty(t)&&!$$WPSchedulingProvidersCore.IsSingleAllowedProviderStillElligibleForScheduling(f,this._allowedProviderIds)&&n.NetRemoved&&Object.keys(n.NetRemoved).indexOf(t)<0&&(i=this.Data.Providers.getFromIndex("ID",t))&&(n.NetRemoved[t]=i))},__shouldSelectAllProviders:function(n,t,i){var r=this._pendingResult?this.Data.VisitTypes.getFirstInIndex("ID",this._pendingResult.VisitTypeId):null,u;return i===$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider&&r&&!r.AllowProviderSelect?!0:(u=t.length>0,n&&!u)},__getAddedProviders:function(n,t,i){for(var r=0,u=null,f=!1,e=!1,o=[],s={},r=0;r<n.length;r++)o.push(n[r].ID);for(r=0;r<t.length;r++)(u=this.Data.Providers.getFirstInIndex("ID",t[r]))&&(f=-1!==o.indexOf(u.ID),e=-1!==i.indexOf(u.ID),!f&&e&&(s[u.ID]=u));return s},__getRemovedProviders:function(n,t){for(var i=null,r=0,u={},r=0;r<n.length;r++)i=n[r],-1===t.indexOf(i.ID)&&(u[i.ID]=i);return u},__areAllProvidersRemoved:function(n,t){var i;return i=Object.keys(t).length,n>0&&n===i},__getProviderIdsAvailableForSelection:function(t,i,r){var o,e,f=0,s=[],h=[],u=[];for(e=this._mode===n.DepartmentOverride,o=this.__getReasonForVisit(t),e&&(h=this.__getDepartmentsFromSelections(i)),u=$$WPSchedulingUtil.BuildProvidersFiltered(!0,e,!1,o,h,!1),r||(u=u.filter(function(n){return n.IsStandardProvider},this)),f=0;f<u.length;f++)s.push(u[f].ID);return s},__getDepartmentsFromSelections:function(n){for(var i,r=[],f=[],t=[],u=0;u<n.length;u++)for(r=n[u].Locations,i=0;i<r.length;i++)f=r[i].Departments,t=t.concat(f);return $$WPSchedulingUtil.RemoveDuplicateElementsFromArray(t),t},__updateAppointmentSelections:function(n,t){this.__removeMissingProviders(n,t.ToDeselect);this.__addNewProviders(n,t.ToSelect)},__removeMissingProviders:function(n,t){var r=null,i=0,u=null;for(r in t)for(i=0;i<n.length;i++)(u=n[i]).Providers=this.__removeProviderFromList(u.Providers,r)},__removeProviderFromList:function(n,t){for(var i=0,i=n.length-1;i>=0;i--)t===n[i].ID&&n.splice(i,1);return n},__addNewProviders:function(n,t){var r=null,u=null,i=0;for(r in t)for(u=t[r],i=0;i<n.length;i++)n[i].Providers.push(u)},__getReasonForVisit:function(n){var t=null;return n?(t=$$WPUtil.IsNullOrEmpty(this._ticketInfo)?this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.DecisionTreeNode?this.Data.ReasonsForVisit.Models[0]:this.Data.ReasonsForVisit.getFirstInIndex("Id",n.Id):this._ticketInfo.ReasonForVisit,$$WPUtil.IsNullOrEmpty(t)&&(t=null),t):null},__getCurrentReasonForVisit:function(){return this.__savedReasonForVisitFromReload?this.__savedReasonForVisitFromReload:this.Data.AppointmentBuilder.ReasonForVisit},__setLastSelectedReasonForVisit:function(n){$$WPUtil.IsNullOrEmpty(this._ticketInfo)?this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.DecisionTreeNode&&(this._lastSelectedRfv=n):this._lastSelectedRfv=n},__getAppointmentSelections:function(){for(var i=[],n=0,t=null,n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)t=this.Data.AppointmentBuilder.getAppointment(n),i.push({VisitType:t.VisitType,Providers:t.Providers.toArray().slice(),Locations:t.Locations.toArray().slice()});return i},__setSchedulingData:function(n){$$WPUtil.IsNullOrEmpty(this._ticketInfo)?this.Data.populateWithRawSchedulingData(n):this.Data.populateForTicket(this._ticketInfo,n,!0);this.Data.prepForWorkflowAgain()},__resolvePendingResults:function(n){var t;t=this.__getReasonForVisit(n);this._pendingResult&&(this._pendingResult.ReasonForVisit=t,this.Data.AppointmentBuilder.setProperty("HasPendingDecisionTree",!1),this._pendingResult.VisitTypeSource=this.__getVisitTypeSource(n,t),this._handleResult(this._pendingResult),this._pendingResult=null)},__reapplyAppointmentSelections:function(n){for(var t=null,u=null,s=null,f=[],e=null,o=[],h=null,i=0,r=0,i=0;i<this.Data.AppointmentBuilder.numAppointments();i++)if(!this.__isAskForEachAppointment||i===this.__currentVisitIndex){for(t=this.Data.AppointmentBuilder.getAppointment(i),u=n[i].VisitType,f=n[i].Providers,o=n[i].Locations,u&&((s=this.Data.VisitTypes.getFirstInIndex("ID",u.ID))?t.setVisitTypeWithSource(s,t.VisitTypeSource,t.PanelId):t.setVisitTypeWithSource(null,t.VisitTypeSource,"")),t.Providers.empty(),r=0;r<f.length;r++)e=this.Data.Providers.getFirstInIndex("ID",f[r].ID),this.__canAddProviderToAppt(e,u)&&t.Providers.add(e);for(0===t.Providers.size()&&this.__selectOriginalProvider(t.Providers),t.Locations.empty(),r=0;r<o.length;r++)(h=this.Data.Locations.getFirstInIndex("Id",o[r].Id))&&t.Locations.add(h)}},__canAddProviderToAppt:function(n,t){var i=this.filterByAllowedIds(this.Data.Providers.toArray(),"ID",!1);return null!=n&&(!!t||(i&&0!==i.length?n.IsStandardProvider&&-1!==i.indexOf(n):n.IsStandardProvider))},__selectOriginalProvider:function(n){var i=null,r=null,t=0;if(this.Data.AppointmentBuilder.OriginallySelectedProviders)for(t=0;t<this.Data.AppointmentBuilder.OriginallySelectedProviders.length;t++)i=this.Data.AppointmentBuilder.OriginallySelectedProviders[t],(r=this.Data.Providers.getFirstInIndex("ID",i.ID))&&n.add(r)},__areSelectionsStillValid:function(t,i){var r=this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider;return!!this.__isRfvSelectionStillValid(t)&&!(r&&!this.__isProviderSelectionStillValid(i))&&!(this._mode===n.DepartmentOverride&&!this.__isLocationSelectionStillValid(i))},__isRfvSelectionStillValid:function(n){var t=this.Data.AppointmentBuilder.ReasonForVisit;return!n||!!t},__isProviderSelectionStillValid:function(n){for(var i=[],r={},t=0,t=0;t<this.Data.AppointmentBuilder.numAppointments();t++)if(i=this.Data.AppointmentBuilder.getAppointment(t).Providers.toArray(),((r=n[t])?r.Providers:[]).length>0&&0===i.length)return!1;return!0},__isLocationSelectionStillValid:function(n){for(var i=[],r={},t=0,t=0;t<this.Data.AppointmentBuilder.numAppointments();t++)if(i=this.Data.AppointmentBuilder.getAppointment(t).Locations.toArray(),((r=n[t])?r.Locations:[]).length>0&&0===i.length)return!1;return!0},_handleResult:function(n){var t=null,u={},i=0,r=null;if(n.ReasonForVisit&&this.Data.AppointmentBuilder.updateAppointmentsCollectionForReasonForVisit(n.ReasonForVisit,n.VisitTypeSource,this._workflow,!1),n.StopLqfChain&&this.__stopLqfChainForAppropriateAppointments(),(t=this.Data.Lqfs.getFromIndex(["Id","AppointmentIndex"],[n.LqfId,this.__currentVisitIndex])).Result=n,t.CompletingStep=this.Id,this.__isAskForEachAppointment)(r=this.Data.AppointmentBuilder.getAppointment(this.__currentVisitIndex)).Lqfs.add(t),r.SchedulingOverride=t.SchedulingOverride;else for(i=0;i<this.Data.AppointmentBuilder.numAppointments();i++)(r=this.Data.AppointmentBuilder.getAppointment(i)).Lqfs.add(t),r.SchedulingOverride=t.SchedulingOverride;this.__hasPatientLocationRule&&this.Data.AppointmentBuilder.evaluatePatientLocationRule(this._workflow);this.__setOriginalVisitTypeIdOnAppropriateAppointments(t.SchedulingOverride.OriginalPrcId);this.__hideLoadingSpinner();n.StopScheduling?null!==this._stopSchedulingCallback&&(u={VisitTypeInstructions:this._getCurrentVisitType().SchedulingInstructions,LqfInstructions:n.Instructions},this._stopSchedulingCallback(u)):this.__canWorkflowHandleCurrentAppointmentCount()||this._showErrorAndExit()},__stopLqfChainForAllAppoinments:function(){for(var n=0,n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)this.Data.AppointmentBuilder.getAppointment(n).IsLqfChainStopped=!0},__stopLqfChainForAppropriateAppointments:function(){this.__isAskForEachAppointment?this.Data.AppointmentBuilder.getAppointment(this.__currentVisitIndex).IsLqfChainStopped=!0:this.__stopLqfChainForAllAppoinments()},__canWorkflowHandleCurrentAppointmentCount:function(){return this._workflow.Type!==$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider||1===this.Data.AppointmentBuilder.numAppointments()},_getCurrentVisitType:function(){var i={},t=null;switch(t=this.__isAskForEachAppointment?this.Data.AppointmentBuilder.getAppointment(this.__currentVisitIndex):this.Data.AppointmentBuilder.getFirstAppointment(),this._mode){case n.Standard:return $$WPSchedulingLqfCore.GetVisitTypeFromAppointment(t,this.Data.VisitTypes);case n.DepartmentOverride:return i=this._getCurrentLqf(),e.getVisitTypeForDepartment(this.Data,t,i.Department)}},_showQuestionnaire:function(n){var i,t,r,u;i=f.getDomElementsForQuestionnaireView(this.Id);(t=new Epic.PatientEngagement.Questionnaire.WorkflowSettings).hideSummaryPage=!0;t.defaultAnswersFromDAT=$$WPUtil.IsNullOrEmpty(this._favoriteAppointmentInfo)?"":this._favoriteAppointmentInfo.Dat;t.wipeProgressTrail=!0;r=new Epic.PatientEngagement.Questionnaire.QuestionnaireWorkflowInformation(this,Epic.PatientEngagement.Questionnaire.QuestionnaireContextType.Scheduling,"",{shouldDisplayQuestionnaireName:!1,showBottomBackButton:!0,disableUnsavedChangesPopup:!0},null,t);u={afterViewLoadCallback:this.questionnaireOnRenderCallback};this._questionnaireControllerLqfId=n;this._questionnaireController=new Epic.PatientEngagement.Questionnaire.MyChart.QuestionnaireController(this._questionnaireControllerLqfId,i,r,u);this._questionnaireController.start()},_showDecisionTree:function(n){var u,f,e,o,t=null,i=[],s=null,r="";o=this._getCurrentVisitType();e=this.$root.find(".dt-main-container");u=new $$WP.DecisionTrees.Models.TraversalSettings({AllowBack:!1,AllowFinishLater:!1,AllowCancel:!1,OnStepRender:this.decisionTreeStepOnRenderCallback,DisableUnsavedChangesPopup:!0});this.__isAskForEachAppointment?(t=this.Data.AppointmentBuilder.getAppointment(this.__currentVisitIndex),(s=this.Data.AppointmentBuilder.getOriginalAppointment(t,this.__originalAppointmentInfo))&&(r=s.Dat),i=t.AppointmentRequestIds):(i=$$WPUtil.IsNullOrEmpty(this._ticketInfo)?[]:$$WP.Scheduling.Appointment.prototype.ordersToRawRequestObject(this._ticketInfo.AppointmentRequests),this.__originalAppointmentInfo&&(r=this.__originalAppointmentInfo.Dat));f=new $$WP.DecisionTrees.Models.TraversalAdditionalContext({VisitTypeID:o.ID,TicketID:$$WPUtil.IsNullOrEmpty(this._ticketInfo)?"":this._ticketInfo.TicketId,AppointmentRequestIds:i,OriginalApptDAT:r,FavoriteApptDAT:$$WPUtil.IsNullOrEmpty(this._favoriteAppointmentInfo)?"":this._favoriteAppointmentInfo.Dat,OrdersString:this.__generateOrdersStringForAllAppointments(),IsGuest:this._workflow.IsGuest,SchedulingWorkflowType:this._workflow.Type,TermIds:this.Data.AppointmentBuilder.TermIds,SchedGrouperIds:this.Data.AppointmentBuilder.SchedGrouperIds,IsAuthenticatedWidget:this._workflow.IsAuthenticatedWidget});this._decisionTreeLqfId=n;this._decisionTreeController=new $$WP.DecisionTrees.Controllers.DecisionTreeTraversalController(e,n,$$WP.DecisionTrees.Enums.TraversalSourceWorkflow.Scheduling,u,!0,this.decisionTreeCallback,f)},__generateOrdersStringForAllAppointments:function(){var n=0,t="";if(this.__isAskForEachAppointment)t=this.__generateOrdersStringForOneAppointment("",this.__currentVisitIndex);else for(n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)t=this.__generateOrdersStringForOneAppointment(t,n);return t},__generateOrdersStringForOneAppointment:function(n,t){for(var i=0,r=this.Data.AppointmentBuilder.getAppointment(t),i=0;i<r.Orders.length;i++)""!==n&&(n+="^"),n+=r.Orders[i].ID;return n},_getCurrentLqf:function(){var n;return this.__isAskForEachAppointment?this._getCurrentLqfBundle():(n=this.Data.AppointmentBuilder.getFirstAppointment(),this._getCurrentAppointmentLqf(n))},_getCurrentLqfBundle:function(){for(var i,t={},n=this.__currentVisitIndex;n<this.Data.AppointmentBuilder.numAppointments();n++)if(i=this.Data.AppointmentBuilder.getAppointment(n),t=this._getCurrentAppointmentLqf(i,n),!$$WPUtil.IsNullOrEmpty(t.LqfId)){this.__currentVisitIndex=n;break}return t},_getCurrentAppointmentLqf:function(t,i){var u=null;if(!t.IsLqfChainStopped&&this.arePrerequisitesCompleteForStatusChange())switch(this._mode){case n.Standard:if(t.VisitTypeSource!==r.VisitTypeSourceEnum.DepartmentOverrideLqf)return u=$$WPSchedulingLqfCore.GetVisitTypeFromAppointment(t,this.Data.VisitTypes),$$WPSchedulingLqfCore.GetCurrentLqfFromVisitType(this.Data,u,"",i,this._workflow);break;case n.DepartmentOverride:return $$WPSchedulingLqfCore.GetDepartmentLqfData(this.Data)}return{}},getSchedulingContinueBanner:function(){return this.$root.parent().find(".qnr-actions")},getContinueButton:function(n){var t="";return t=this.stepSettings.Hide||this.renderCollapsed?"#scheduling-continue":".questionnaire",n.find(t)},isUsingWorkflowNavigation:function(){return!1},onWorkflowDestroyed:function(){this._removeOldContent()}},n={Standard:1,DepartmentOverride:2};u.prototype=s;u.ModesEnum=n;$$WP.Scheduling.LqfStepController=u;u.extend($$WP.Scheduling.StepController,"WP$Scheduling$LqfStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t,i,r){this.WP$Scheduling$StepController(n,t);this.proxify("__onConfirmClick","__onAppointmentsChanged","__onAncillaryDataChanged","__onBundleReasonForVisitSelected");this.__eventManager=new $$WP.Scheduling.EventManager;this._workflow=i;this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this.__onAncillaryDataChanged);this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("add",this.__onAppointmentsChanged);this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("remove",this.__onAppointmentsChanged);this.__onAppointmentsChanged();this.$root.on("click","[data-id='panelconfirm']",this.__onConfirmClick);this.$root.on("click","[data-bundle-reschedule]",this.__onBundleReasonForVisitSelected);this.__hasPatientLocationRule=r};n.prototype={__eventManager:null,_workflow:null,__hasPatientLocationRule:!1,updateViewModel:function(){var n=!1,t=this._workflow.isBundleRescheduling(),i=!$$WPUtil.IsNullOrEmpty(this.__getFirstAppointmentBundleId()),r=this.__isFirstAppointmentPartOfMultiApptGroup();t||!i&&r?(n=!!i||this.Data.AppointmentBuilder.showAsMultipleVisits(this.Data.VisitTypes),this.ViewModel={StepShouldBeActive:!0,Count:1,ShowAsMultipleVisits:n,SolutionViewModel:this.__getSolutionViewModel(),BundleReschedulingCommandOptions:this.__getBundleReschedulingCommandOptions(),CanRescheduleFullBundle:this._workflow.canRescheduleFullBundle()},this.stepSettings.Hide=!1,this.template=t?$$WP.Templates.Scheduling.OnboardingBundleRescheduleStep:$$WP.Templates.Scheduling.OnboardingPanelStep):(this.ViewModel={},this.stepSettings.Hide=!0,this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired))},__getSolutionViewModel:function(){var n=new $$WP.Scheduling.SolutionViewModel,t=null,i=!1,r="";return $$WPUtil.IsNullOrEmpty(this.__getFirstAppointmentPanelId())||(i=!0),this._workflow.isBundleRescheduling()?(r=this._workflow.OriginalAppointmentInfo.BundleReasonForVisitId,t=this.Data.ReasonsForVisit.getFromIndex("Id",r),n.populateFromOriginalAppointmentInfo(this._workflow.OriginalAppointmentInfo)):(t=this.Data.AppointmentBuilder.ReasonForVisit,n.populateFromReasonForVisit(t,this._workflow,i)),n},__getBundleReschedulingCommandOptions:function(){var n=null;return this._workflow.isBundleRescheduling()&&(n={All:{Id:"bundleRescheduleAllCommand",DataAttrs:{"bundle-reschedule":"all"}},Single:{Id:"bundleRescheduleSingleCommand",DataAttrs:{"bundle-reschedule":"single"}}}),n},afterRender:function(){this.$root.find("h2").focus()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.OnboardingStep},__onBundleReasonForVisitSelected:function(n){var t="all"===$afe.jq(n.target).safeAttr("data-bundle-reschedule");this.__selectBundleRfv(t)},__selectBundleRfv:function(n){var t=null;t=n?this.Data.ReasonsForVisit.getFromIndex("Id",this._workflow.OriginalAppointmentInfo.BundleReasonForVisitId):this.Data.ReasonsForVisit.getFromIndex("Id",this._workflow.OriginalAppointmentInfo.SingleReasonForVisitId);this.Data.AppointmentBuilder.setProperty("ReasonForVisit",t);this.Data.AppointmentBuilder.updateAppointmentsCollectionForReasonForVisit(t,Appointment.VisitTypeSourceEnum.Default,this._workflow,this.__hasPatientLocationRule);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},__onConfirmClick:function(){this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},__onAppointmentsChanged:function(){var n=0,t=null;for(this.__eventManager.removeAllListeners(),n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)t=this.Data.AppointmentBuilder.getAppointment(n),this.__eventManager.addModelPropertyListener(t,"VisitType",this.__onAncillaryDataChanged)},__onAncillaryDataChanged:function(){this.__updateStepStatus()},__updateStepStatus:function(){this.__isFirstAppointmentPartOfMultiApptGroup()||this._workflow.isBundleRescheduling()?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},__isFirstAppointmentPartOfMultiApptGroup:function(){return!$$WPUtil.IsNullOrEmpty(this.__getFirstAppointmentPanelId())||!$$WPUtil.IsNullOrEmpty(this.__getFirstAppointmentBundleId())},__getFirstAppointmentPanelId:function(){return this.Data.AppointmentBuilder.getFirstAppointment().PanelId},__getFirstAppointmentBundleId:function(){return this.Data.AppointmentBuilder.getFirstAppointment().BundleId}};$$WP.Scheduling.OnboardingStepController=n;n.extend($$WP.Scheduling.StepController,"WP$Scheduling$OnboardingStepController")}();!function(){var n=$$WP.Scheduling.TelehealthLocation,r=$$WP.Scheduling.ReasonForVisit,u=$$WP.Common.SelectableViewBinder,t=$$WP.Scheduling.Workflow,f=3,i=function(t,i,r,f){this.WP$Scheduling$StepController(t,i,null,null,null,$$WP.Templates.Scheduling.OnDemandTelehealth.PatientLocationStep);this.proxify("updateStep","_onLocationStateChanged","_onCardFocus","_onCardBlur","_onButtonClicked","_onLocationSelect","_onSubLocationSelect","_onAncillaryDataChanged");this.setViewBinder(new u("State",n.StatesEnum.Selected,n.StatesEnum.Unselected));this.Data.TelehealthLocations.addPropertyListener("State",this._onLocationStateChanged);this._isAnonymous=r;this._workflow=f;this.Data.AppointmentBuilder.addPropertyListener("HasConfirmedPatientLocation",this._onAncillaryDataChanged);this.Data.AppointmentBuilder.addPropertyListener("CanSkipPatientLocationStep",this._onAncillaryDataChanged)};i.prototype={_mode:null,_prerequisiteSteps:null,_selectedPrimaryIndex:-1,_viewMode:0,_idPrefix:"",_isAnonymous:!1,_hasProvidersListener:null,_shouldDoInitialFocus:!0,_selectedSubIndices:{},_onAncillaryDataChanged:function(){this._updateStepStatus()},_updateStepStatus:function(){this._isStepRequired()?this._isFullLocationSelected()&&this.Data.AppointmentBuilder.HasConfirmedPatientLocation?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},_isStepRequired:function(){return!(!this._isTelehealthWorkflow()&&!this._isStepForceShown())||!this.Data.AppointmentBuilder.CanSkipPatientLocationStep&&!this.Data.AppointmentBuilder.HasConfirmedPatientLocation},updateViewModel:function(){var i,r;this._firstRender&&this.Data.TelehealthData.setProperty("TelehealthLoaded",!0);i=this._buildTelehealthLocationArray();-1===this._selectedPrimaryIndex&&this._findSelectedLocationIndex();r=this._buildTelehealthSubLocationArray();this._getSelectedSubIndexForCountry(this._selectedPrimaryIndex)===n.FakeLocationId&&this._findSelectedSubLocationIndex();this._idPrefix="PatientLocationStep_"+(this.Id||"");this.Data.TelehealthData.setProperty("SelectedWorkflow",null);this.ViewModel={TelehealthLocations:i,TelehealthSubLocations:r,StepShouldBeActive:i.length>0,IdPrefix:this._idPrefix,SelectedPrimaryIndex:this._selectedPrimaryIndex,SelectedSubIndex:this._getSelectedSubIndexForCountry(this._selectedPrimaryIndex),AlreadyComplete:this.getComplete()===$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete,ViewMode:this._viewMode,ValidationGroup:new $$WP.FormValidation.ValidationGroup({}),SubLocationValidation:new $$WP.FormValidation.ValidationSettings({required:!0,nullValue:n.FakeLocationId}),IsMobile:$$WP.Utilities.UI.IsMobile,IsAnonymous:this._isAnonymous,CanUseSchedulingStrings:!this._isTelehealthWorkflow(),HasSlot:this.Data.AppointmentBuilder.allAppointmentsHaveASlotSelected(),CanShowPretext:this._workflow.Type===t.WorkflowTypesEnum.OnDemandTelehealth}},_isTelehealthWorkflow:function(){return this._workflow.Type===t.WorkflowTypesEnum.OnDemandTelehealth||this._workflow.Type===t.WorkflowTypesEnum.EVisit},beforeRender:function(){var t=this.Data.TelehealthLocations.Models,i;if(t&&1===t.length&&(i=t[0].SubLocations.Models,i&&1===i.length))return t[0].setProperty("State",n.StatesEnum.Selected),i[0].setProperty("State",n.StatesEnum.Selected),void(this.stepSettings.ReadOnly=!0);null===this.Data.TelehealthLocations.getFirstInIndex("State",n.StatesEnum.Selected)&&(this.stepSettings.Hide=!1,this.stepSettings.HideIfOne=!1,this.stepSettings.Collapse=!1,this.stepSettings.CollapseIfOne=!1,this.stepSettings.ReadOnly=!1)},afterRender:function(){var r=this.Data.TelehealthLocations.Models[this._selectedPrimaryIndex],i=this._getSelectedSubIndexForCountry(this._selectedPrimaryIndex);r&&(-1!==i&&r.SubLocations.Models[i]&&r.SubLocations.Models[i].Id===n.FakeLocationId||i===n.FakeLocationId)&&$$WP.FormValidation.addValidationError(this.$root.find(".selectSubLocation"));document.getElementById("scheduling-workflow").style.minHeight="0vh";$$WP.Utilities.UI.IsMobile&&this._isTelehealthWorkflow()&&this._addHowToVideo();this._addDomHandlers();this._renderEmergencyWarningBanner();this._shouldDoInitialFocus&&($$WP.Utilities.UI.IsMobile?this.$root.find("h2.header").focus():0!==$afe.select(".button.completeworkflow").length&&this._workflow.Type===t.WorkflowTypesEnum.OnDemandTelehealth||$$WPSchedulingUtil.FocusElement($afe.select(".standardBanner.criticalType")));this._shouldDoInitialFocus=!1},_addHowToVideo:function(){var n;(n=$afe.select("#mobile-video-card-container"))&&new $$WP.UI.VideoViewModel("VideoVisitHowTo",null,function(t){var i,r;i=[];null!==t.Url&&i.push(t);i.length>0&&((r={}).VideoCard="TalkToADoctor",r.Videos=i,new $$WP.UI.VideoController(n,r,1))})},_addDomHandlers:function(){this.$root.find(".button").on("click",this._onButtonClicked);this.$root.find("select.selectLocation").on("change",this._onLocationSelect);this.$root.find("select.selectSubLocation").on("change",this._onSubLocationSelect);this.$root.find(".card").on("focus",this._onCardFocus);this.$root.find(".card").on("blur",this._onCardBlur)},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.PatientLocationStep},_buildTelehealthLocationArray:function(){for(var t=[],n=0;n<this.Data.TelehealthLocations.size();n++)t.push(this.Data.TelehealthLocations.Models[n]);return t},_buildTelehealthSubLocationArray:function(){var t=this.Data.TelehealthLocations.Models[this._selectedPrimaryIndex],i,n;if(!t)return[];for(i=[],n=0;n<t.SubLocations.size();n++)i.push(t.SubLocations.Models[n]);return i},_onButtonClicked:function(n){void 0===$afe.jq(n.target).data("id")||$afe.jq(n.target).hasClass("disabled")||"confirm"!==$afe.jq(n.target).data("id").split("-")[0]||(this._selectCurrentLocation(),this._updateStepStatus(),this.updateStep())},_selectCurrentLocation:function(){var r=this._findSelectedLocationIndex(),t=this.Data.TelehealthLocations.Models[r],u=this._findSelectedSubLocationIndex(),i=t.SubLocations.Models[u];i&&i.setProperty("State",n.StatesEnum.Selected);t.setProperty("State",n.StatesEnum.Selected);this.Data.AppointmentBuilder.setProperty("HasConfirmedPatientLocation",!0)},_setSelectionInAppointmentBuilder:function(n,t){this.Data.AppointmentBuilder.setProperty("PatientLocation",n);this.Data.AppointmentBuilder.setProperty("PatientSublocation",t)},_onLocationSelect:function(){var n=this.$root.find("select.selectSubLocation")[0];n&&(n.selectedIndex=0);this._findSelectedLocationIndex();this._updateStepStatus();WP.DOM.Browser.isMobile&&this.$root.find("select.selectLocation").blur();this.updateStep()},_findSelectedLocationIndex:function(){var t,r,u,i;return((r=this.Data.TelehealthLocations.getFirstInIndex("State",n.StatesEnum.Selected))&&r.setProperty("State",n.StatesEnum.Unselected),u=this.$root.find("select.selectLocation")[0])?t=u.selectedIndex:this.Data.TelehealthLocations.Models.indexOf(i)!=n.FakeLocationId?(i=this.Data.AppointmentBuilder.PatientLocation,t=this.Data.TelehealthLocations.Models.indexOf(i)):t=this._getDefaultLocationIndex(),this._selectedPrimaryIndex=t,t},_getDefaultLocationIndex:function(){for(var n=0;n<this.Data.TelehealthLocations.size();n++)if(this.Data.TelehealthLocations.Models[n].SelectedByDefault)return n;return-1},_onSubLocationSelect:function(){this._findSelectedSubLocationIndex();this._updateStepStatus();WP.DOM.Browser.isMobile&&this.$root.find("select.selectSubLocation").blur();this.updateStep()},_findSelectedSubLocationIndex:function(){var t,i,u,r;if(!(i=this.Data.TelehealthLocations.Models[this._selectedPrimaryIndex]))return-1;r=i.SubLocations.getFirstInIndex("State",n.StatesEnum.Selected);r&&r.setProperty("State",n.StatesEnum.Unselected);t=-1;try{t=this.$root.find("select.selectSubLocation")[0].selectedIndex}catch(n){this.Data.AppointmentBuilder.PatientSublocation?(u=this.Data.AppointmentBuilder.PatientSublocation,t=i.SubLocations.Models.indexOf(u)):t=this._getDefaultSublocationIndex(i)}return-1!==t&&this._setSelectedSubIndexForCountry(this._selectedPrimaryIndex,t),t},_getDefaultSublocationIndex:function(n){for(var t=0;t<n.SubLocations.size();t++)if(n.SubLocations.Models[t].SelectedByDefault)return t;return-1},_onLocationStateChanged:function(){var u,i=null,t=null,e=null;u=this.Data.AppointmentBuilder.allAppointmentsHaveASlotSelected();this.Data.TelehealthData.resetData();i=this.Data.AppointmentBuilder.ReasonForVisit;this._isTelehealthWorkflow()&&null!==i&&i.setProperty("State",r.StatesEnum.Unselected);this._isFullLocationSelected()?((t=this.Data.TelehealthLocations.getFirstInIndex("State",n.StatesEnum.Selected))&&(e=t.SubLocations.getFirstInIndex("State",n.StatesEnum.Selected),t.setLocationName()),this.$root.addClass("selectionmade"),WP&&WP.DOM&&WP.DOM.Browser&&!WP.DOM.Browser.isMobile&&(this._viewMode=f),this._setSelectionInAppointmentBuilder(t,e),u&&!this.Data.AppointmentBuilder.allAppointmentsHaveASlotSelected()&&$$WPSchedulingUtil.ReturnToSlotStepAndReloadSlots(this.Data)):this.$root.removeClass("selectionmade");this._updateStepStatus()},_isFullLocationSelected:function(){var t=this.Data.TelehealthLocations.getFirstInIndex("State",n.StatesEnum.Selected);return!!t&&(!!t.SubLocations.getFirstInIndex("State",n.StatesEnum.Selected)||0===t.SubLocations.size())},_onCardFocus:function(){this.$root.addClass("active")},_onCardBlur:function(){this.$root.removeClass("active")},_renderEmergencyWarningBanner:function(){var t,n,i;this._isTelehealthWorkflow()&&(n=this._workflow.IsAnonymous&&!this._workflow.SchedulingControllerParams.rootDecisionTreeID,((t={HeaderText:n?$$WP.Strings.get("SplashPageBannerHeader","ondemandtelehealth"):$$WP.Strings.get("EmergencyWarningBannerHeader","ondemandtelehealth"),DetailText:n?$$WP.Strings.get("SplashPageBannerDetails","ondemandtelehealth"):$$WP.Strings.get("EmergencyWarningBannerDetails","ondemandtelehealth"),BannerType:"criticalType",DisableDetailTextHtmlEncoding:!0,ButtonLabel:n?$$WP.Strings.get("SplashPageBannerButtonCaption","ondemandtelehealth"):null,ButtonUrl:n?$$WP.Strings.get("SplashPageBannerButtonUrl","ondemandtelehealth"):null,BannerID:n?"AnonymousSchedulingBanner":"EmergencyWarningBanner"}).HeaderText||t.DetailText||t.ButtonLabel)&&(i=$afe.renderTemplate($$WP.Templates.Core.Banner,t,{}),$afe.select($$WP.Utilities.UI.IsMobile?"#telehealthBannerMobile":"#telehealthBannerWeb").safeReplaceWith(i),n&&$afe.select("#AnonymousSchedulingBanner").addClass("anonymousSchedulingBanner")))},_setSelectedSubIndexForCountry:function(n,t){this._selectedSubIndices[n]=t},_getSelectedSubIndexForCountry:function(t){return t in this._selectedSubIndices?this._selectedSubIndices[t]:n.FakeLocationId}};$$WP.Scheduling.OnDemandTelehealth=$$WP.Scheduling.OnDemandTelehealth||{};$$WP.Scheduling.OnDemandTelehealth.PatientLocationStepController=i;i.extend($$WP.Scheduling.StepController,"WP$Scheduling$OnDemandTelehealth$PatientLocationStepController")}();!function(){var f=$$WP.Common.Model,e=$$WP.Common.SelectableViewBinder,n=$$WP.Scheduling.TelehealthOrganization,i=$$WP.Scheduling.TelehealthData,r=$$WP.Scheduling.TelehealthLocation,t=$$WP.Scheduling.TelehealthFilters,u=function(t,i,r){this.WP$Scheduling$StepController(t,r,null,null,null,$$WP.Templates.Scheduling.OnDemandTelehealth.OrganizationStep);this.proxify("updateStep","_onOrganizationStateChanged","_onCardFocus","_onCardBlur","updateOrgs","clearModel","_orgChooseCallbackSuccess","_onFilterSelect","_dataUpdated");this._workflow=i;this.setViewBinder(new e("State",n.StatesEnum.Selected,n.StatesEnum.Unselected));this.Data.TelehealthOrganizations.addPropertyListener("State",this._onOrganizationStateChanged);this.Data.TelehealthLocations.addPropertyListener("State",this.updateStep);this.Data.TelehealthData.addPropertyListener("",this._dataUpdated);this.$root.on("click","input.togglebutton",this._onFilterSelect);this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this.updateOrgs);this.Data.ReasonsForVisit.addCollectionEventListener("add",this.clearModel);this.Data.ReasonsForVisit.addCollectionEventListener("remove",this.clearModel);this.Data.TelehealthOrganizations.addCollectionEventListener("add",this.updateStep);this.Data.TelehealthOrganizations.addCollectionEventListener("remove",this.updateStep);this.$root.on("focus",".card",this._onCardFocus);this.$root.on("blur",".card",this._onCardBlur)},o={_mode:null,_prerequisiteSteps:null,_selectionMade:!1,_selectedIndex:0,_isLoading:!1,_selectedFilter:null,_isReviewResultLoaded:!1,_isLoadingReviewData:!1,_reviewResult:null,updateViewModel:function(){var o=this.Data.AppointmentBuilder.ReasonForVisit,l=this.Data.TelehealthLocations.getFirstInIndex("State",r.StatesEnum.Selected),f,s,v,c,e;this._selectedFilter=this._selectedFilter||t.Filters[0].Value;var u=t.BuildTelehealthOrganizationArray(this.Data,this._selectedFilter,null,!o||o.InternallyAvailableForTelehealth),a=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected),h=[];if(this.Data.TelehealthData.IsXOrgEnabled){if(this.Data.AppointmentBuilder.getAppointment(0).Slot&&null===this.Data.TelehealthData.QuickScheduleSlot)return this.Data.TelehealthData.QuickScheduleSlot=this.Data.AppointmentBuilder.getAppointment(0).Slot,void this._orgNotRequired(u);if(null===o)return this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),void(this.ViewModel={StepShouldBeActive:!1});if(1===u.length&&u[0].IsLocal||!o.ExternallyAvailableForTelehealth||this.Data.TelehealthData.SelectedWorkflow===i.TelehealthWorkflow.QuickSchedule||this.Data.TelehealthData.SelectedWorkflow===i.TelehealthWorkflow.SlotSelection||l&&"233"!==l.Id)this._orgNotRequired(u);else if(null===this.Data.TelehealthData.SelectedWorkflow)this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.ViewModel={StepShouldBeActive:!1};else if(a&&!a.ConsentCaptured())this.$root.hide();else{for(this.Data.TelehealthOrganizations.openChangeBatch(),f=0;f<u.length;f++)(s=u[f]).State===n.StatesEnum.Selected&&s.setProperty("State",n.StatesEnum.SelectedUnavailable);if(this._reviewResult&&this._reviewResult.Success){if(v=this.Data.AppointmentBuilder.getFirstAppointmentIndex(),c=this._reviewResult.Appointments[v],$$WPUtil.IsNullOrEmpty(c))return;e=c.VisitPayment;e&&""!==e.Amount&&0!==e.Type&&u[0].IsLocal?(u[0].CostDisplayString=e.Amount,u[0].MaxCost=e.RawAmount):u[0].IsLocal&&(u[0].CostDisplayString="",u[0].MaxCost="",u[0].CrossOrgShowCost=!1)}for(this._onOrganizationDisplay(u),h=this._updateFilterList(u,t.Filters,h),this.ViewModel={StepShouldBeActive:!0,Count:u.length,TelehealthOrganizations:u,Filter:this._selectedFilter,Filters:h,SelectedIndex:"",SelectedValue:"",HadConnectionFailure:this.Data.TelehealthData.HadConnectionFailure,ViewMode:this._viewMode,IsLoading:this._isLoading,LoadingClasses:"organizationstep",AdminLogin:this.Data.IsAdminLoginFromHyperspace},f=0;f<u.length;f++)(s=u[f]).State===n.StatesEnum.SelectedUnavailable&&s.setProperty("State",n.StatesEnum.Selected);this.Data.TelehealthOrganizations.closeChangeBatch()}}else this._orgNotRequired(u)},_orgNotRequired:function(t){this.Data.TelehealthData.setProperty("IsOrgSelectionComplete",!0);this.ViewModel={StepShouldBeActive:!1};var i=this._getLocalOrgIndex(t);i>-1&&t[i].setProperty("State",n.StatesEnum.Selected);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},_onFilterSelect:function(n){var t=n.target.value;t&&this._selectedFilter!==t&&(this._selectedFilter=t,this._showFilter(t,!0))},_updateFilterList:function(n,t,i){var f=this._getLocalOrgIndex(n),u=!1,r;if(n.length<=2)return i;for(r=0;r<n.length;r++)if(r!==f){u=n[r].CrossOrgShowCost;break}if(u)i=t;else for(r=0;r<t.length;r++)"cost"!==t[r].Value&&i.push(t[r]);return i},_onOrganizationDisplay:function(n){var i=this._getLocalOrgIndex(n),e=0,o=!1,s=!1,h=!1,c=!1,f=-1!=i,l=!1,r=!1,u=!1,t;if(!(null==n||n.length<2)){for(t=0;t<n.length;t++)if(t!==i){e=t;l=!0;break}for(f&&n[i].CostDisplayString&&(r=!0,n[i].CrossOrgShowCost=!0),l&&n[e].CrossOrgShowCost&&(u=!0),f&&u&&!r&&(h=!0),!u&&r&&(c=!0),u&&r&&(o=!0),u&&(!f||r||n.length>2)&&(s=!0),t=0;t<n.length;t++)t==i?(n[t].ShowCostComparisons=o,n[t].ShowDisclaimer=h):(n[t].ShowCostComparisons=s,n[t].ShowDisclaimer=c)}},_showFilter:function(i,r){var s=this.Data.AppointmentBuilder.ReasonForVisit,u=t.BuildTelehealthOrganizationArray(this.Data,i,null,!s||s.InternallyAvailableForTelehealth),f,o,e;this._onOrganizationDisplay(u);f=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);null===f||$.inArray(u,f)||(f.State=n.StatesEnum.Unselected,this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete));this.ViewModel.Count=u.length;this.ViewModel.TelehealthOrganizations=u;this.ViewModel.Filter=i;o=$afe.renderTemplate($$WP.Templates.Scheduling.OnDemandTelehealth.OrganizationList,this.ViewModel);e=this.$root.find(".telehealthContainer > div");r?e.fadeOut("fast",$.proxy(this._replaceOrgList,this,e,o)):(e.safeReplaceWith(o),this._fixCards())},_replaceOrgList:function(n,t){t.hide();n.safeReplaceWith(t);t.fadeIn("fast");this._fixCards()},_fixCards:function(){for(index in this.$root.find(".cardlist.matchHeights").each(function(){$$WP.Utilities.UI.Cards.MatchHeights.apply(this,arguments)}),this.ViewModel.TelehealthOrganizations)model=this.ViewModel.TelehealthOrganizations[index],model.Disabled?this.ViewBinder.unbindElement(this.ViewBinder.getBoundElements(model)):this.ViewBinder.bindModel(model);this.ViewBinder.syncModelsToDOM()},_getLocalOrgIndex:function(n){if(1===n.length)return 0;for(var t=0;t<n.length;t++)if(n[t].IsLocal)return t;return-1},beforeRender:function(){this._isReviewResultLoaded||this.Data.TelehealthData.SelectedWorkflow!==i.TelehealthWorkflow.Queueing||this._loadReviewData();var t=this.ViewModel.TelehealthOrganizations;this._onOrganizationDisplay(t);1===t.length&&t[0].IsLocal?(t[0].setProperty("State",n.StatesEnum.Selected),this.stepSettings.ReadOnly=!0):null===this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected)&&(this.stepSettings.Hide=!1,this.stepSettings.HideIfOne=!1,this.stepSettings.Collapse=!1,this.stepSettings.CollapseIfOne=!1,this.stepSettings.ReadOnly=!1)},afterRender:function(){var r=!1,t=this.ViewModel.TelehealthOrganizations,u=this._getLocalOrgIndex(t),n,i;for(this._showFilter(this._selectedFilter,!1),this._isOrgSelectedWithoutConsent()&&this.$root.hide(),this._isLoadingReviewData&&$$WPUtil.ShowAjaxSpinner(this.$root.find(".telehealthLoadingOverlay.organizationstep .ajaxspinner")),this._isReviewResultLoaded=!1,this._onOrganizationDisplay(t),n=0;n<t.length;n++)if(n!==u){r=t[n].CrossOrgShowCost;break}i=this.Data.AppointmentBuilder.ReasonForVisit;"1"===this.Data.TelehealthData.UseInsuranceForVisit&&i.InternallyAvailableForTelehealth&&i.ExternallyAvailableForTelehealth&&r&&this._renderEstimatedCostInfoBanner();this.$root.find("h2.header").focus()},_isOrgSelectedWithoutConsent:function(){var t=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);return!(!t||t.ConsentCaptured())},triggerViewEvent:function(){this._isOrgSelectedWithoutConsent()||this.WP$Scheduling$StepController$triggerViewEvent()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.OrganizationStep},updateOrgs:function(){null===this.Data.AppointmentBuilder.ReasonForVisit?this.clearModel():(this._isLoading=this._loadOrgs(),this.updateStep())},clearModel:function(){this._isLoading=!1;this.Data.TelehealthOrganizationLoader.CancelRequest()},_loadOrgs:function(){var t,i=this.Data.AppointmentBuilder.ReasonForVisit,n=this.Data.TelehealthLocations.getFirstInIndex("State",r.StatesEnum.Selected);return n&&(t=n.SubLocations.getFirstInIndex("State",r.StatesEnum.Selected)),this.Data.TelehealthOrganizations.openChangeBatch(),this.Data.TelehealthOrganizations.empty(),this.Data.TelehealthOrganizations.closeChangeBatch(),!(!i||!n||!t&&0!==n.SubLocations.size())&&(this.Data.TelehealthOrganizationLoader.LoadOrganizations(i,n,t,this._orgChooseCallbackSuccess),!0)},_orgChooseCallbackSuccess:function(n,t){var i,r,u;this.clearModel();i=this.Data.AppointmentBuilder.ReasonForVisit;i&&i===t&&(r=this.Data.TelehealthOrganizations.Models.length,this._processRelevantOrganizations(n,i),u=this.Data.TelehealthOrganizations.Models.length,0===r&&0===u&&this.updateStep())},_processRelevantOrganizations:function(n,i){this.Data.TelehealthOrganizations.openChangeBatch();this.Data.TelehealthOrganizations.empty();$$WP.Scheduling.TelehealthOrganization.convertRawTelehealthOrganizations(n,this.Data.TelehealthOrganizations);i.OnDemandOrganization&&this.Data.TelehealthOrganizations.add(i.OnDemandOrganization);t.FindNotableOrganizations(this.Data.TelehealthOrganizations.Models);this.Data.TelehealthOrganizations.closeChangeBatch()},_dataUpdated:function(t){switch(t.propertyName){case"TelehealthLoaded":this.Data.TelehealthData.IsXOrgEnabled||this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired);break;case"UseInsuranceForVisit":case"TelehealthSelectedPlatform":var r=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);r&&r.setProperty("State",n.StatesEnum.Unselected);this.updateStep();break;case"SelectedWorkflow":this.Data.TelehealthData.SelectedWorkflow===i.TelehealthWorkflow.Queueing&&this.Data.TelehealthData.IsXOrgEnabled?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete):(this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired),this.ViewModel={StepShouldBeActive:!1});this.Data.TelehealthData.setProperty("ReviewApptCalledOnOrgStep",!1);this.updateStep()}},_onOrganizationStateChanged:function(t){var i=this.Data.TelehealthOrganizations.getFromIndex("State",n.StatesEnum.Selected),r=this.Data.TelehealthOrganizations.getFromIndex("State",n.StatesEnum.SelectedUnavailable);i.size>0||r.size>0?(this.$root.addClass("selectionmade"),$afe.select(".content").trigger("resize"),this.Data.TelehealthData.setProperty("IsOrgSelectionComplete",!1),this.Data.TelehealthData.setProperty("IsOrgSelectionComplete",!0),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete),this.updateStep(),this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected).IsUnconnected()&&this.$root.hide()):(this.Data.TelehealthData.setProperty("ReviewApptCalledOnOrgStep",!1),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.updateStep());this._updateCardStatus(t)},_updateCardStatus:function(t){var r,e,u,i;for(r in t)e=f.getInstance(r),(i=t[r]).to!==i.from&&(u=this.ViewBinder.getBoundElements(e).closest(".card"),i.to===n.StatesEnum.Selected?u.addClass("selected"):i.from===n.StatesEnum.Selected&&u.removeClass("selected"))},_loadReviewData:function(){var t,n;this._isLoadingReviewData||this.Data.AppointmentBuilder.ReasonForVisit.InternallyAvailableForTelehealth&&((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildAppointmentBuilderForSlot(this.Data,null)).getAppointment(0).Slot=new $$WP.Scheduling.Slot(n.getAppointment(0).Slot),n.getAppointment(0).Slot&&(t={workflow:this._workflow.toRawRequestObject(),appointmentBuilder:n.toRawRequestObject()},$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("ReviewAppointment",this._workflow)),data:$$WPUtil.postify(t),cache:!1,success:$.proxy(this._onReviewDataLoaded,this),error:$.proxy(this._onScheduleError,this)}),this._isLoading=!0,this._isLoadingReviewData=!0,this.updateStep()))},_onReviewDataLoaded:function(n){this._reviewResult=n;this._isReviewResultLoaded=!0;this._isLoadingReviewData=!1;this._isLoading=!1;this.Data.TelehealthData.setProperty("ReviewApptCalledOnOrgStep",!0);this.updateStep()},_renderEstimatedCostInfoBanner:function(){var n={HeaderText:$$WP.Strings.get("EstimatedCostInfoBannerHeader","ondemandtelehealth"),DetailText:$$WP.Strings.get("EstimatedCostInfoBannerDetails","ondemandtelehealth"),BannerType:"informationalType",DisableDetailTextHtmlEncoding:!0,BannerID:"EstimatedCostInfoBanner",UseH3Header:!0},t;(n.HeaderText||n.DetailText||n.ButtonLabel)&&(t=$afe.renderTemplate($$WP.Templates.Core.Banner,n,{}),$afe.select("#estimatedCostInfoBanner").safeReplaceWith(t),$afe.select("#EstimatedCostInfoBanner").addClass("estimatedCostInfoBanner"))},_onCardFocus:function(){this.$root.addClass("active")},_onCardBlur:function(){this.$root.removeClass("active")}};u.prototype=o;$$WP.Scheduling.OnDemandTelehealth=$$WP.Scheduling.OnDemandTelehealth||{};$$WP.Scheduling.OnDemandTelehealth.OrganizationStepController=u;u.extend($$WP.Scheduling.StepController,"WP$Scheduling$OnDemandTelehealth$OrganizationStepController")}();!function(){var r=$$WP.Scheduling.ReasonForVisit,n=$$WP.Scheduling.TelehealthOrganization,i=$$WP.Scheduling.TelehealthLocation,u=$$WP.Scheduling.TelehealthData,f=0,e=1,t=function(n,t){this.WP$Scheduling$StepController(n,t,null,null,null,$$WP.Templates.Scheduling.OnDemandTelehealth.OrganizationAuthStep);this.proxify("updateStep","_onOrgStateChanged","_onCardFocus","_onCardBlur","_onClick","_onConsentChanged","_tryEstablishLinkSuccess","_processProxyWorkflow","_dataUpdated");this.$root.on("click",this._onClick);this.Data.TelehealthOrganizations.addPropertyListener("State",this._onOrgStateChanged);this.Data.TelehealthOrganizations.addPropertyListener("NeedsH2GConsent",this._onConsentChanged);this.Data.TelehealthData.addPropertyListener("",this._dataUpdated);this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this.updateStep);this.Data.ReasonsForVisit.addCollectionEventListener("add",this.updateStep);this.Data.ReasonsForVisit.addCollectionEventListener("remove",this.updateStep);this.$root.on("focus",".card",this._onCardFocus);this.$root.on("blur",".card",this._onCardBlur)};t.prototype={updateViewModel:function(){var n=this.Data.TelehealthOrganizations.getFirstInIndex("State",r.StatesEnum.Selected);if(this.Data.TelehealthData.IsOrgSelectionComplete&&!n||!this.Data.TelehealthData.IsXOrgEnabled||n&&n.ConsentCaptured()||this.Data.TelehealthData.SelectedWorkflow===u.TelehealthWorkflow.QuickSchedule)return this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired),void(this.ViewModel={StepShouldBeActive:!1});null===n?(this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.ViewModel={StepShouldBeActive:!1}):(this.ViewModel={Count:1,StepShouldBeActive:!0,SelectedValue:n,HomeOrganizationName:this.Data.HomeOrganizationName,OrganizationName:n.OrganizationName,IsMobile:$$WP.Utilities.UI.IsMobile,IsProxy:this.Data.IsProxy,PatientName:this.Data.ProxyContextName},this.Data.TelehealthData.IsOrgSelectionComplete||this._onConsentChanged())},afterRender:function(){$afe.select(".cardlist.matchHeights").each($$WP.Utilities.UI.Cards.MatchHeights);this.$root.find(".jqHidden").fadeIn("slow");this._isOrganizationSelected()&&$$WPUtil.HideAjaxSpinner(this.$root.find(".telehealthLoadingOverlay .ajaxspinner"));this.$root.find("h2.header").focus()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.OrganizationAuthStep},_isOrganizationSelected:function(){return!!this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected)},triggerViewEvent:function(){this._isOrganizationSelected()&&this.WP$Scheduling$StepController$triggerViewEvent()},_dataUpdated:function(n){"TelehealthLoaded"===n.propertyName?this.Data.TelehealthData.IsXOrgEnabled||this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):this.updateStep()},_onClick:function(t){if(void 0!==$afe.jq(t.target).data("id")&&!$afe.jq(t.target).hasClass("disabled"))switch($afe.jq(t.target).data("id").split("-")[0]){case"continue":t.preventDefault();this._linkAndContinue();break;case"reselect":case"cancel":t.preventDefault();var i=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);i&&(i.setProperty("State",n.StatesEnum.Unselected),this.updateStep())}},_onOrgStateChanged:function(){this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected)?$$WPUtil.HideAjaxSpinner(this.$root.find(".telehealthLoadingOverlay .ajaxspinner")):this._onConsentChanged()},_onConsentChanged:function(){var t=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);t?(this.Data.TelehealthData.setProperty("IsOrgSelectionComplete",t.ConsentCaptured()),t.ConsentCaptured()&&(this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired),this.updateStep())):this._setIncomplete()},_setIncomplete:function(){this.Data.TelehealthData.setProperty("IsOrgSelectionComplete",!1);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete);this.updateStep()},_linkAndContinue:function(){this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected)&&this._tryEstablishLink()},_tryEstablishLink:function(){var r,u=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected),f=this.Data.AppointmentBuilder.ReasonForVisit,t=this.Data.TelehealthLocations.getFirstInIndex("State",i.StatesEnum.Selected);t&&(r=t.SubLocations.getFirstInIndex("State",i.StatesEnum.Selected));u&&f&&t&&(r||0===t.SubLocations.size())&&($$WPUtil.ShowAjaxSpinner(this.$root.find(".telehealthLoadingOverlay .ajaxspinner")),$.post({url:makeLink("Scheduling/TryEstablishLink"),data:{orgId:u.OrganizationId,rfvId:f.OnDemandRFV,locationId:t.Id,sublocationId:r?r.Id:""},cache:!1,async:!0,success:this._tryEstablishLinkSuccess,failure:$.proxy(this._preH2GConnectionProblem,this,u)}))},_tryEstablishLinkSuccess:function(t){var i=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);t.LinkFailed||t.Error||!t.LinkEstablished?this._preH2GConnectionProblem(i):this.Data.IsProxy?$.post({url:makeLink("Scheduling/DetermineProxyWorkflow"),cache:!1,async:!0,data:{orgId:i.OrganizationId},success:this._processProxyWorkflow}):this._formH2GLink(i)},_preH2GConnectionProblem:function(n){var t,i,r;$$WP.Strings.addMnemonic("@MYCHART@OrganizationName@",n.OrganizationName,!1,"ondemandtelehealth");t=$$WP.Strings.get("TimeoutErrorMessage","ondemandtelehealth");$$WP.Strings.removeMnemonic("@MYCHART@OrganizationName@","ondemandtelehealth");i=$$WP.Strings.get("ErrorTitle","ondemandtelehealth");r=this._getErrorPopup(t,i);$$WPUtil.quickPopup(r);this._connectionProblem(n)},_getErrorPopup:function(n,t){var i;return i={ToolbarButtons:[{Text:$$WP.Strings.get("DismissErrorPopupButtonText","ondemandtelehealth"),Class:"otherbutton"}],TitleText:t,Html:n,IsClosable:!0,callback:function(){}},new $$WPComp.ConfirmComponent(i,{Size:$$WP.Containers.Popup.SizeEnum.SMALL})},_processProxyWorkflow:function(t){var i=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);if(null!==t&&t.Success&&!t.Error)switch(t.Workflow){case f:i.setProperty("HasPatientAccess",!1);this._sendToUnverifiedWorkflow(i);break;case e:this._formH2GLink(i);break;default:this._preH2GConnectionProblem(i)}else this._preH2GConnectionProblem(i)},_sendToUnverifiedWorkflow:function(n){$$WPUtil.HideAjaxSpinner(this.$root.find(".telehealthLoadingOverlay .ajaxspinner"));n.setProperty("NeedsH2GConsent",!1);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete);this.updateStep()},_formH2GLink:function(n){n&&($$WPUtil.HideAjaxSpinner(this.$root.find(".telehealthLoadingOverlay .ajaxspinner")),new $$WP.Community.CommunityController(null,!0).CreateLinkToOrganization(n.OrganizationId,$.proxy(this._h2gLinkSuccess,this,n),$.proxy(this._connectionProblem,this,n),$.proxy(this._notMyAccount,this,n)))},_h2gLinkSuccess:function(t,i){var r=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);i&&this._isStatusExpected(i.UserMyChartStatus)?r&&r===t&&(this._clearConnectionProblem(t),r.setProperty("NeedsH2GConsent",!1),r.setProperty("HasPatientAccess",!0),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete),this.updateStep()):this._connectionProblem(t)},_isStatusExpected:function(n){switch(n){case 1:case 4:case 3:case 5:case 6:return!0;default:return!1}},_connectionProblem:function(t){this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected)===t&&(t.setProperty("Disabled",!0),this.Data.TelehealthData.setProperty("HadConnectionFailure",!0),t.setProperty("State",n.StatesEnum.Unselected))},_clearConnectionProblem:function(n){n.setProperty("Disabled",!1)},_notMyAccount:function(n){this._connectionProblem(n)},_onCardFocus:function(){this.$root.addClass("active")},_onCardBlur:function(){this.$root.removeClass("active")}};$$WP.Scheduling.OnDemandTelehealth=$$WP.Scheduling.OnDemandTelehealth||{};$$WP.Scheduling.OnDemandTelehealth.OrganizationAuthStepController=t;t.extend($$WP.Scheduling.StepController,"WP$Scheduling$OnDemandTelehealth$OrganizationAuthStepController")}();!function(){var u=$$WP.Scheduling.Provider,e=$$WP.Common.SelectableViewBinder,n=$$WP.Scheduling.TelehealthData,t=$$WP.Scheduling.TelehealthFilters,f=$$WP.Scheduling.TelehealthOrganization,i=$$WP.Scheduling.TelehealthLocation,r=function(n,t,i,r,f,o,s,h,c){this.WP$Scheduling$StepController(n,t,i,r,f,$$WP.Templates.Scheduling.OnDemandTelehealth.QuickScheduleStep);this.proxify("updateStep","_onClick","clearModel","_dataUpdated","_onSlotsLoaded","_matchHeights");this.$root.on("click",this._onClick);this.setViewBinder(new e("State",u.StatesEnum.Selected,u.StatesEnum.Unselected));this.Data.TelehealthData.addPropertyListener("",this._dataUpdated);this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this.clearModel);this.Data.ReasonsForVisit.addCollectionEventListener("add",this.clearModel);this.Data.TelehealthLocations.addPropertyListener("State",this.updateStep);this._workflowSettings=s;this._hasProviderDetailsSecurity=this._workflowSettings.HasProviderDetailsSecurity;this._isAnonymous=h;this._isGuest=c;this._stepSettings=f;window.addEventListener("resize",this._matchHeights)};r.prototype={$root:null,_mode:null,_rfvStateListenerId:null,_allowSelectProvider:!1,_errorCount:0,_csn:null,_timerFinished:!1,_hardwareTested:!1,_hasProviderDetailsSecurity:!1,_isAnonymous:!1,_isGuest:!1,_stepSettings:null,updateViewModel:function(){var n,e,u;if(n=this.Data.AppointmentBuilder.ReasonForVisit,(this._isAnonymous||this._isGuest)&&(this.Data.TelehealthData.TelehealthSelectedPlatform=t.PlatformFilterValueEnum.Web),null!==n&&(!this.Data.TelehealthData.ShouldShowHardwareTest||this.Data.TelehealthData.IsHardwareTestComplete)&&this.Data.TelehealthData.TelehealthSelectedPlatform)if(this._allowSelectProvider=n.AllowProviderSelect,!this.ViewModel||!this.ViewModel.Slots||WP.DOM.Browser.isMobile&&this.ViewModel.NoneAvailable&&this.ViewModel.HasLoadedSlotsCount<2&&this.ViewModel.AvailableExternally){$afe.select(".isPrelogin>.ajaxspinner").empty();var r=this.Data.TelehealthLocations.getFirstInIndex("State",i.StatesEnum.Selected),f=null,o=this.Data.Providers.getFromIndex("ID","-2");null===r||$$WPUtil.IsNullOrEmpty(o)||(f=r.SubLocations.getFirstInIndex("State",i.StatesEnum.Selected));e=$$WP.Scheduling.TelehealthFilters.IsRFVEnabledForOnDemand(n,this.Data.TelehealthData.TelehealthSelectedPlatform,this.Data.TelehealthData.IsXOrgEnabled)&&t.IsInLicensedLocation(n.AllowedTelemedicineLocations,r,f,null,!0);u=$$WP.Scheduling.TelehealthFilters.IsRFVEnabledForQuickSchedule(n,this.Data.TelehealthData.TelehealthSelectedPlatform);this.ViewModel={Slots:null,StepShouldBeActive:!0,LoadingClasses:"quickschedulestep",HasOnDemandVideoVisitSecurity:this._workflowSettings.HasOnDemandVideoVisitSecurity,HasQuickScheduleSecurity:this._workflowSettings.HasQuickScheduleSecurity,HasAppointmentDetailsSecurity:this._workflowSettings.HasAppointmentDetailsSecurity,HasProviderDetailsSecurity:this._workflowSettings.HasProviderDetailsSecurity&&!$$WP.Utilities.UI.IsMobile&&!this._isGuest,EnableLinkToDirectScheduling:!0,EnabledForOnDemandVideoVisits:e,EnabledForQuickSchedule:u,NoneAvailable:!1,NoneAvailableData:this._getNoneAvailableData(),HasLoadedSlotsCount:0,Organization:null,AvailableExternally:n.ExternallyAvailableForTelehealth,IsIE:WP.DOM.Browser.isIE,IsAnonymous:this._isAnonymous};this.ViewModel.Providers=this.Data.Providers.Models;this._setTelehealthOrganizationDisplayingWait(u);this._loadSlots()}else this.ViewBinder.bindAllModels(this.ViewModel.Slots),this.ViewModel.LoadingClasses="quickschedulestep jqHidden",this.ViewModel.SelectedWorkflow=this.Data.TelehealthData.SelectedWorkflow,this.ViewModel.QuickScheduleSlotIndex=parseInt(this.Data.TelehealthData.QuickScheduleSlotIndex,10),this.ViewModel.HasLoadedSlotsCount=this.ViewModel.HasLoadedSlotsCount+1;else this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.ViewModel={StepShouldBeActive:!1}},clearModel:function(){null!==this.ViewModel&&(this.ViewModel.Slots=null);this.updateStep()},_onSlotsLoaded:function(n){var r,e,u,o,s,f;for(this.ViewModel.Slots=[],this.ViewModel.AllowProviderSelect=this._allowSelectProvider,e=!this._allowSelectProvider&&n.length>0?1:n.length,f=0,r=0;r<e;r++)u=this._getProviderById(n[r].ProviderId),s=(o=this.Data.TelehealthLocations.getFirstInIndex("State",i.StatesEnum.Selected)).SubLocations.getFirstInIndex("State",i.StatesEnum.Selected),t.IsProviderEnabledAtLocation(u,o,s)&&(this.ViewModel.Slots.push(new $$WP.Scheduling.Slot(n[r])),this.ViewModel.Slots[f].Provider=u,f+=1);this._setNoneAvailable();this.ViewModel.HasLoadedData=!0;this.ViewModel.HasLoadedSlotsCount=this.ViewModel.HasLoadedSlotsCount+1;0===this._errorCount?(this.updateStep(),setTimeout($.proxy(function(){$$WPUtil.HideAjaxSpinner(this.__getLoadingOverlay())},this),500)):this._reloadSlots()},_reloadSlots:function(){this.updateStep();setTimeout(function(){$afe.select(".content").trigger("resize")},500)},_getProviderById:function(n){var t,i=this.ViewModel.Providers;if(i)for(t=0;t<i.length;t++)if(n===i[t].ID)return i[t];return null},_onClick:function(t){var u;if(void 0!==$afe.jq(t.target).data("id")&&!$afe.jq(t.target).hasClass("disabled")){var f=$afe.jq(t.target).data("id").split("-"),r=f[0],i=f[1];if(("joinqueue"===r||"joinqueuephoto"===r)&&this.Data.TelehealthData.SelectedWorkflow===n.TelehealthWorkflow.Queueing||"schedule"===r&&this.Data.TelehealthData.SelectedWorkflow===n.TelehealthWorkflow.QuickSchedule&&this.Data.TelehealthData.QuickScheduleSlotIndex===i)return this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),void this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete);switch(r){case"joinqueue":case"joinqueuephoto":this._isAnonymous&&!this._isGuest||(this.Data.TelehealthData.setProperty("IsOrgSelectionComplete",!1),t.preventDefault());this.Data.TelehealthData.setProperty("SelectedWorkflow",n.TelehealthWorkflow.Queueing);this.Data.TelehealthData.setProperty("QuickScheduleSlotIndex","");this.__clearSelectedOrg();this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete);this.updateStep();break;case"schedule":this.Data.TelehealthData.setProperty("QuickScheduleSlot",this.ViewModel.Slots[i]);this.Data.TelehealthData.SelectedProviderName=this.ViewModel.Slots[i].Provider.Name;this.Data.TelehealthData.setProperty("QuickScheduleSlotIndex",i);this.Data.TelehealthData.setProperty("SelectedWorkflow",n.TelehealthWorkflow.QuickSchedule);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete);this.updateStep();break;case"provider":case"providerphoto":this._hasProviderDetailsSecurity&&!this._isGuest&&(this._isAnonymous?(u=makeLink("publicforms.asp?mode=provider&widgetmode=1&id="+encodeURIComponent(this.ViewModel.Slots[i].ProviderId)),window.open(u,null,"width=1024,height=600,resizable,status,scrollbars").focus()):(u=$$WP.Utilities.UI.IsMobile?makeLink("app/providers/details?id="+encodeURIComponent(this.ViewModel.Slots[i].ProviderId)+"&isIdEncrypted=1"):makeLink("app/providers/details?id="+encodeURIComponent(this.ViewModel.Slots[i].ProviderId)),window.open(u,null,"width=1024,height=600,resizable,status,scrollbars").focus()));break;case"moretimes":this.__onMoreTimesClicked(i)}}},__onMoreTimesClicked:function(t){var r=this.ViewModel.Slots[t],i=this.Data.AppointmentBuilder.getFirstAppointment(),u=new $$WP.Scheduling.ProviderDepartmentPair({ProviderId:r.ProviderId,DepartmentId:r.DepartmentId});this.Data.TelehealthData.setProperty("QuickScheduleSlot",null);this.Data.TelehealthData.setProperty("QuickScheduleSlotIndex",t);this._openChangeBatch();i.Providers.empty();i.Providers.add(r.Provider);i.Locations.empty();i.Locations.addRange(this.Data.Locations.toArray());this.Data.TelehealthData.setProperty("SelectedProviderName",r.Provider.Name);i.Slot=null;i.ProviderDepartmentPairs=[];i.ProviderDepartmentPairs.push(u);i.setProperty("SelectedTelehealthMode",VisitType.TelehealthModeEnum.Video);this._closeChangeBatch();this.Data.TelehealthData.setProperty("SelectedWorkflow",null);this.Data.TelehealthData.setProperty("SelectedWorkflow",n.TelehealthWorkflow.SlotSelection);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete)},_loadSlots:function(){var t=this.Data.AppointmentBuilder.ReasonForVisit;$$WP.Scheduling.TelehealthFilters.IsRFVEnabledForQuickSchedule(t,this.Data.TelehealthData.TelehealthSelectedPlatform)?$$WP.Scheduling.SlotLoader.LoadQuickScheduleSlots(t,1,$.proxy(this._onSlotsLoaded,this),this._isAnonymous,this._isGuest):this._stepSettings&&this._stepSettings.HideIfOne?(this.ViewModel.Slots=[],this.Data.TelehealthData.setProperty("SelectedWorkflow",n.TelehealthWorkflow.Queueing),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete),this.updateStep()):this._onSlotsLoaded({})},_setNoneAvailable:function(){var r=this.ViewModel.HasQuickScheduleSecurity,u=this.ViewModel.EnabledForQuickSchedule,n=this.ViewModel.Slots,t=!1;r&&u&&null!=n&&n.length>0&&(t=!0);var f=this.ViewModel.HasOnDemandVideoVisitSecurity,e=this.ViewModel.EnabledForOnDemandVideoVisits,o=this.ViewModel.Organization,i=!1;f&&e&&o&&(i=!0);this.ViewModel.NoneAvailable=!t&&!i},_getNoneAvailableData:function(){return{SchedulingStoppedTitle:$$WP.Strings.get("TelehealthUnavailableTitle","OnDemandTelehealth"),SchedulingStoppedPretext:$$WP.Strings.get("TelehealthUnavailablePretext","OnDemandTelehealth"),HideButton:!0}},_setTelehealthOrganizationDisplayingWait:function(){var n=this._getTelehealthOrganizationsLeastWait(),i=this.ViewModel.AvailableExternally,t=this.Data.AppointmentBuilder.ReasonForVisit.OnDemandOrganization;this.ViewModel.Organization=i&&n?n:t&&this.Data.AppointmentBuilder.ReasonForVisit.InternallyAvailableForTelehealth?t:null},_dataUpdated:function(n){switch(n.propertyName){case"SelectedWorkflow":case"TelehealthSelectedPlatform":this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)}},afterRender:function(){this.ViewModel&&this.ViewModel.Slots||($$WPUtil.ShowAjaxSpinner(this.__getLoadingOverlay()),null===this.ViewModel.Organization?this.__makeLoadingOverlayInline():this.__makeLoadingOverlayNotInline());$afe.select(".content").trigger("resize");this._matchHeights();this.$root.find("h2.header").focus()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.QuickScheduleStep},_matchHeights:function(){for(var t,i=$afe.select("div.providerinfo"),r=0,n=0;n<i.length;n++)(t=$afe.jq(i[n])).height("auto"),t.height()>r&&(r=t.height());for(n=0;n<i.length;n++)(t=$afe.jq(i[n])).height(r)},_getTelehealthOrganizationsLeastWait:function(){var i=this.Data.AppointmentBuilder.ReasonForVisit,n=t.BuildTelehealthOrganizationArray(this.Data,t.Filters[1].Value,null,!i||i.InternallyAvailableForTelehealth);return 0==n.length?null:1==n.length?n[0]:t.FindNotableOrganizations(n).shortestWaitOrg},__clearSelectedOrg:function(){var n=this.Data.TelehealthOrganizations.getFirstInIndex("State",f.StatesEnum.Selected);null!==n&&n.setProperty("State",f.StatesEnum.Unselected)},__getLoadingOverlay:function(){return this.$root.find(".telehealthLoadingOverlay.quickschedulestep .ajaxspinner")},__makeLoadingOverlayInline:function(){this.__getLoadingOverlay().removeClass("defaultajaxoverlay");this.__getLoadingOverlay().addClass("defaultajaxinline")},__makeLoadingOverlayNotInline:function(){this.__getLoadingOverlay().addClass("defaultajaxoverlay");this.__getLoadingOverlay().removeClass("defaultajaxinline")}};$$WP.Scheduling.OnDemandTelehealth=$$WP.Scheduling.OnDemandTelehealth||{};$$WP.Scheduling.OnDemandTelehealth.QuickScheduleStepController=r;r.extend($$WP.Scheduling.StepController,"WP$Scheduling$OnDemandTelehealth$QuickScheduleStepController")}();!function(){var n=$$WP.Scheduling.TelehealthFilters,r=$$WP.Scheduling.TelehealthLocation,t=0,u=1,f=2,i=function(n,t,i){this.WP$Scheduling$StepController(n,t,null,null,null,$$WP.Templates.Scheduling.OnDemandTelehealth.PlatformStep);this.proxify("updateStep","_onCardFocus","_onCardBlur","_onClick","_dataUpdated","_onPlatformFilterSelect");this.$root.on("click",this._onClick);this._isAnonymous=i;this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this.updateStep);this.Data.TelehealthLocations.addPropertyListener("State",this.updateStep);this.Data.ReasonsForVisit.addCollectionEventListener("add",this.updateStep);this.Data.TelehealthData.addPropertyListener("",this._dataUpdated);this.$root.on("click","input.platformFilter",this._onPlatformFilterSelect);this.$root.on("focus",".card",this._onCardFocus);this.$root.on("blur",".card",this._onCardBlur)};i.prototype={_mode:null,_prerequisiteSteps:null,_viewMode:t,_selectedPlatformFilter:null,_isAnonymous:!1,_dataUpdated:function(i){switch(i.propertyName){case"ShouldShowHardwareTest":case"ShouldShowMobileInfo":this._viewMode=t;this.Data.TelehealthData.setProperty("IsHardwareTestComplete",!1);null===this.Data.TelehealthData.AutoSelectedWorkflow&&this.Data.TelehealthData.setProperty("SelectedWorkflow",null);var r=null;this.Data.TelehealthData.ShouldShowMobileInfo?r=n.PlatformFilterValueEnum.Mobile:this.Data.TelehealthData.ShouldShowHardwareTest&&(r=n.PlatformFilterValueEnum.Web);this._selectedPlatformFilter!==r&&(this._selectedPlatformFilter=r)}},_onPlatformFilterSelect:function(n){var t=n.target.value;this._onPlatformFilterSelectHelper(t)},_onPlatformFilterSelectHelper:function(t){var r=!!WP.DOM.Browser.isMobile,i=$$WP.Utilities.UI.IsMobile,u=!i,f=i||r;if(this.Data.TelehealthData.setProperty("ShowPlatformToggle",u),this.Data.TelehealthData.setProperty("ShouldShowMobileHardwareImage",f),t&&this._selectedPlatformFilter!==t){if(this._selectedPlatformFilter=t,this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),i)this.Data.TelehealthData.setProperty("ShouldShowHardwareTest",!0),this.Data.TelehealthData.setProperty("ShouldShowMobileInfo",!1);else switch(this._selectedPlatformFilter){case n.PlatformFilterValueEnum.Web:this.Data.TelehealthData.setProperty("ShouldShowHardwareTest",!0);this.Data.TelehealthData.setProperty("ShouldShowMobileInfo",!1);break;case n.PlatformFilterValueEnum.Mobile:this.Data.TelehealthData.setProperty("ShouldShowMobileInfo",!0);this.Data.TelehealthData.setProperty("ShouldShowHardwareTest",!1)}this._updateViewModelHelper();this._updatePlatformContent()}},_updatePlatformContent:function(){var n=this.$root.find(".platformStepContainer > div"),t;n&&(t=$afe.renderTemplate($$WP.Templates.Scheduling.OnDemandTelehealth.PlatformContainer,this.ViewModel),n.safeReplaceWith(t))},updateViewModel:function(){this._updateViewModelHelper()},_updateViewModelHelper:function(){var o,i,u,f,e,s,h,c;this._selectedPlatformFilter||(o=WP.DOM.Browser.isMobile?n.PlatformFilterValueEnum.Mobile:n.PlatformFilterValueEnum.Web,this._onPlatformFilterSelectHelper(o));this.Data.TelehealthData.setProperty("TelehealthSelectedPlatform",this._selectedPlatformFilter);this.Data.TelehealthData.setProperty("TelehealthSelectedPlatformString",n.GetPlatformString(this._selectedPlatformFilter));this.Data.TelehealthData.setProperty("SelectedWorkflow",null);i=this.Data.AppointmentBuilder.ReasonForVisit;u=this.Data.TelehealthLocations.getFirstInIndex("State",r.StatesEnum.Selected);null===i||null===u?(this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.ViewModel={StepShouldBeActive:!1}):(f=!1,this._isAnonymous||(f=5===parseInt(i.ScheduledTelemedicineVendorId,10)||5===parseInt(i.OnDemandTelemedicineVendorId)),e=$$WP.Utilities.UI.IsMobile,s=f||!e&&null!=i.TelemedicineHardwareTestFdiId&&""!=i.TelemedicineHardwareTestFdiId||e&&null!=i.TelemedicineMobileHardwareTestFdiId&&""!=i.TelemedicineMobileHardwareTestFdiId,this.Data.TelehealthData.ShouldShowHardwareTest&&!this.Data.TelehealthData.IsHardwareTestComplete&&(this._viewMode=t,this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)),h=u.SubLocations.getFirstInIndex("State",r.StatesEnum.Selected),c=n.IsRFVEnabledForPlatformAtLocation(i,this.Data.TelehealthData.TelehealthSelectedPlatform,u,h,this.Data.TelehealthData.IsXOrgEnabled),this.ViewModel={IsVidyoWeb:f,ViewMode:this._viewMode,StepShouldBeActive:!0,SupportsHardwareTest:s,PlatformFilters:n.PlatformFilters,PlatformFilter:this._selectedPlatformFilter,ShouldShowMobileHardwareImage:this.Data.TelehealthData.ShouldShowMobileHardwareImage,ShowPlatformToggle:this.Data.TelehealthData.ShowPlatformToggle,ShouldShowMobileInfo:this.Data.TelehealthData.ShouldShowMobileInfo,ShouldShowHardwareTest:this.Data.TelehealthData.ShouldShowHardwareTest,IsMobileApp:$$WP.Utilities.UI.IsMobile,ShouldPlatformBeEnabled:c,AlreadyComplete:this.getComplete()===$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete})},_onClick:function(n){var t,r,i,e;if(void 0!==$afe.jq(n.target).data("id")&&!$afe.jq(n.target).hasClass("disabled")){r=$afe.jq(n.target).data("id").split("-")[0];i=$$WP.Utilities.UI.IsMobile;switch(r){case"testhardware":(t=this.Data.AppointmentBuilder.ReasonForVisit,5===parseInt(t.ScheduledTelemedicineVendorId)||5===parseInt(t.OnDemandTelemedicineVendorId))?(e=5===parseInt(t.ScheduledTelemedicineVendorId)?t.DefaultVisitTypeId:t.TelemedicineVisitTypeId,WP.TelehealthUtils.telemedPopup(makeLink("TelemedicineHome/StartTelemedSession?mode=TestOnly&prcId="+encodeURIComponent(e)))):(!i&&null!=t.TelemedicineHardwareTestFdiId&&""!=t.TelemedicineHardwareTestFdiId||i&&null!=t.TelemedicineMobileHardwareTestFdiId&&""!=t.TelemedicineMobileHardwareTestFdiId)&&WP.TelehealthUtils.telemedExecuteFDI(i?t.TelemedicineMobileHardwareTestFdiId:t.TelemedicineHardwareTestFdiId,null,t.UseDeepLinkForHardwareTest);this._viewMode=u;this.Data.TelehealthData.setProperty("IsHardwareTestComplete",!0);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete);this.updateStep();break;case"skiptesthardware":case"nohardwaretest":this._viewMode=f;this.Data.TelehealthData.setProperty("IsHardwareTestComplete",!0);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete);this.updateStep();break;case"useweb":this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete);this.Data.TelehealthData.setProperty("ShouldShowHardwareTest",!0);this.Data.TelehealthData.setProperty("ShouldShowMobileInfo",!1);this.updateStep();break;case"usemobile":this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete);this.Data.TelehealthData.setProperty("ShouldShowMobileInfo",!0);this.Data.TelehealthData.setProperty("ShouldShowHardwareTest",!1);this.updateStep();break;case"verifyhasapp":this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete);this.updateStep()}}},_onCardFocus:function(){this.$root.addClass("active")},_onCardBlur:function(){this.$root.removeClass("active")},afterRender:function(){$afe.select(".content").trigger("resize");this.$root.find("h2.header").focus()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.PlatformStep}};$$WP.Scheduling.OnDemandTelehealth=$$WP.Scheduling.OnDemandTelehealth||{};$$WP.Scheduling.OnDemandTelehealth.PlatformStepController=i;i.extend($$WP.Scheduling.StepController,"WP$Scheduling$OnDemandTelehealth$PlatformStepController")}();!function(){var t=$$WP.Scheduling.TelehealthData,r=$$WP.Scheduling.TelehealthLocation,n=$$WP.Scheduling.TelehealthOrganization,i=function(n,t,i,r,u,f,e,o,s){this.WP$Scheduling$StepController(n,i,null,null,null,$$WP.Templates.Scheduling.OnDemandTelehealth.SummaryStep);this.proxify("updateStep","_onCardFocus","_onCardBlur","_onKeyDown","_dataUpdated","_hideStep","_onClick","_onChange","_loadCallToAction","_loadCallToActionCallback","_continueRedirect","_onPersonalInfoCollectionChange","_loginUrlLoaded","_onScheduleError","_kickoffLogin");this.$root.on("click",this._onClick);this._workflow=t;this.Data.TelehealthData.addPropertyListener("",this._dataUpdated);this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this._hideStep);this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this._loadCallToAction);this._workflow.SchedulingControllerParams.rootDecisionTreeID&&(this._fromSelfTriage=!0,this.Data.AppointmentBuilder.addPropertyListener("IsInsuranceCollectionComplete",this._onPersonalInfoCollectionChange));this._workflowSettings=r;this._onWorkflowCompleteCallback=u;this._onStopSchedulingCallback=s;this._isAnonymous=f;this._isGuest=e;this._fromSelfTriageForAll=this._fromSelfTriage&&this._isGuest;this._anonymousSettings=o;this._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.Initial;this.$root.on("focus",".card",this._onCardFocus);this.$root.on("blur",".card",this._onCardBlur);this.$root.on("keydown",this._onKeyDown)};i.prototype={_workflow:null,_workflowSettings:null,_viewMode:0,_notificationOptions:null,_timerFinished:!1,_redirectCallbackId:null,_isAnonymous:!1,_idPrefix:null,_isGuest:!1,_anonymousSettings:null,_reviewResult:null,_isReviewResultLoaded:!1,_isCurrentlyLoadingReviewResult:!1,_fromSelfTriage:!1,_fromSelfTriageForAll:!1,updateViewModel:function(){var e,f,i;(this._isAnonymous||this._isGuest)&&null!=this.Data.AppointmentBuilder.ReasonForVisit&&(this.Data.TelehealthOrganizations=n.createTelehealthOrganizationCollection(),n.convertRawTelehealthOrganizations([this.Data.AppointmentBuilder.ReasonForVisit.OnDemandOrganization],this.Data.TelehealthOrganizations),this.Data.TelehealthOrganizations.Models[0].setProperty("State",n.StatesEnum.Selected),this.Data.TelehealthOrganizations.Models[0].setProperty("IsLocal",!0));this._fromSelfTriageForAll&&this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete);var u=this.Data.TelehealthData.SelectedWorkflow,r=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected),o=this.Data.AppointmentBuilder.ReasonForVisit;if(null!==u&&null!==o&&(u!==t.TelehealthWorkflow.Queueing||this._isAnonymous||this._isGuest||null!==r&&r.ConsentCaptured())){if(null===this._notificationOptions)return void this._getNotificationOptions();if(this.ViewModel=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(this,this.Data,this._workflowSettings,this._isAnonymous||this._fromSelfTriageForAll,!1,this._isGuest&&!this._fromSelfTriageForAll,this._anonymousSettings),this.ViewModel.IsLoadingReviewResult=this._isCurrentlyLoadingReviewResult,this._reviewResult&&this._reviewResult.Success){if(e=this.Data.AppointmentBuilder.getFirstAppointmentIndex(),f=this._reviewResult.Appointments[e],$$WPUtil.IsNullOrEmpty(f))return;i=f.VisitPayment;null!==i&&""!==i.Amount&&0!==i.Type||($$WP.Strings.setDefaultNamespace("OnDemandTelehealth"),i={Amount:$$WP.Strings.get("TelehealthEstimatedCostNotAvailable"),Type:0},$$WP.Strings.clearDefaultNamespace());i.IsPrepay=3===i.Type;i.IsHidden=!!this.ViewModel.SelectedOrg&&this.ViewModel.SelectedOrg.ODVVHideCost;u!==t.TelehealthWorkflow.Queueing||this.Data.TelehealthData.ReviewApptCalledOnOrgStep||r.IsLocal&&(r.CostDisplayString=i.Amount);this.ViewModel.VisitPayment=i}this._shouldHideStep=!1}else this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.ViewModel={StepShouldBeActive:!1}},_getID:function(n){return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetID(n,this)},_getIDPrefix:function(){return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetIDPrefix(this)},_getComments:function(){return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetComments(this.$root)},_onClick:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnClick(n,this,this.Data,this.$root)},_signUp:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SignUp(this.$root,this,this.Data,this._isGuest)},_saveEmail:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SaveEmail(this.$root,this)},_savePhone:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SavePhone(this.$root,this)},_enqueuePatient:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.EnqueuePatient(this.$root,this,this.Data,this._isAnonymous)},_scheduleAppointment:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ScheduleAppointment(this.$root,this,this.Data,this._isGuest,this._isAnonymous)},_buildRedirectionParameters:function(t){var i=this.Data.TelehealthLocations.getFirstInIndex("State",r.StatesEnum.Selected),f=null,u,o,e;i&&(f={Number:i.Id,Title:i.Name},u=i.SubLocations.getFirstInIndex("State",r.StatesEnum.Selected),u&&(o={Number:u.Id,Title:u.Name},f.SubLocations=[o]));e=null;this.Data.TelehealthData.QuickScheduleSlot&&(e=this.Data.Providers.getFromIndex("ID",this.Data.TelehealthData.QuickScheduleSlot.ProviderId));var s=this.Data.TelehealthData.toRawRequestObject(this._workflow.SchedulingControllerParams,this.Data.AppointmentBuilder.HasMatchingRecord,e),h=this.Data.AppointmentBuilder.ReasonForVisit.toRawRequestObject(),c=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetSourceWorkflowFromUrl();return{telehealthData:s,workflowSettings:this._workflowSettings,appointmentBuilder:{ReasonForVisit:h},telehealthLocation:f,telehealthOrganization:this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected),isForSomeoneElse:null!=t&&t,sourceWorkflow:c}},_loginUrlLoaded:function(n){WP.Events.cancelBeforeUnload();window.location=makeLink(n.Url)},_kickoffLogin:function(){var n=this._buildRedirectionParameters(this._anonymousSettings&&this._anonymousSettings.SchedulingForSomeoneElse);this._changeOverlayText(!0,!0);$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ShowOverlay(this.$root,this.Data,this._isAnonymous);$.post({url:makeLink("Scheduling/Anonymous/TelehealthRedirectTologin"),data:$$WPUtil.postify(n),cache:!1,success:this._loginUrlLoaded,error:this._onScheduleError})},_continue:function(){this._anonymousSettings&&this._anonymousSettings.DisableScheduleAsGuest?this._kickoffLogin():this._fromSelfTriageForAll&&!1===this.Data.AppointmentBuilder.IsInsuranceCollectionComplete?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete):this._continueRedirect()},_continueRedirect:function(){var n=this._buildRedirectionParameters(this._anonymousSettings&&this._anonymousSettings.SchedulingForSomeoneElse);this._changeOverlayText(!0,!0);$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ShowOverlay(this.$root,this.Data,this._isAnonymous);$.post({url:makeLink("Scheduling/Anonymous/TelehealthRedirectToSelfSignup"),data:$$WPUtil.postify(n),cache:!1,success:$.proxy(this._selfSignupUrlLoaded,this),error:$.proxy(this._onScheduleError,this)})},_onPersonalInfoCollectionChange:function(){!0===this.Data.AppointmentBuilder.IsInsuranceCollectionComplete&&this.getComplete()===$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete&&this._continueRedirect()},_selfSignupUrlLoaded:function(n){var t=n.Url,i="";if($$WPUtil.IsNullOrEmpty(t)){if($$WPUtil.IsNullOrEmpty(n.Token))return;if(i="skipAbandonCurrent=1&postlogoutmode=signup&postloginmode=schedulingproxysel&schedulingSession="+n.Token,100===this._workflow.SchedulingControllerParams.parentWorkflow){if($$WPUtil.IsNullOrEmpty(n.SelfSignupToken))return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.HideOverlay(this.$root,this.Data,this._isAnonymous),void this._onStopSchedulingCallback();if(n.DoesNotMeetMinSignupAge)return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.HideOverlay(this.$root,this.Data,this._isAnonymous),void this._onStopSchedulingCallback(null,$$WP.Scheduling.SchedulingController.NotScheduledReasonEnum.DoesNotMeetMinSignupAge);t="Signup?"+i;t+="&workflow=100";n.SelfSignupToken&&(t+="&token="+encodeURIComponent(n.SelfSignupToken))}else t="Home/LogOut?"+i;n.IsForSomeoneElse&&(t+="&signupOption=2&workflow=300");n.SignupMethod&&(t+="&signupOption="+n.SignupMethod);this._fromSelfTriage&&(t+="&fromselftriage=1");t=makeLink(t)}100===this._workflow.SchedulingControllerParams.parentWorkflow&&this.Data.AppointmentBuilder.HasMatchingRecord?$$WPSelfTriageUtil.ReconcileSessionForSignup(t,this._onScheduleError,!$$WPUtil.IsNullOrEmpty(n.Url)):(WP.Events.cancelBeforeUnload(),$$WPUtil.IsNullOrEmpty(n.Url)?$$WPUtil.TryRedirect(t):window.top.location.href=t)},_onScheduled:function(n,t,i,r,u,f,e,o,s){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnScheduled(n,t,i,r,u,f,e,this.$root,this,this.Data,this._workflowSettings,!1,null,o,this._isAnonymous,s)},_onScheduleError:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnScheduleError(this.$root,this,this.Data,this._isAnonymous)},_checkRedirectFromOverlay:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.CheckRedirectFromOverlay(n,this)},_redirectToVisitDetails:function(n,t){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.RedirectToVisitDetails(n,t,this._csn,this.ViewModel.SelectedOrg?this.ViewModel.SelectedOrg.OrganizationId:null)},_onEnqueued:function(n,t){var i=t.CSN,r=t.DxoId,u=t.IsECheckInAvailable,f=t.DidRefreshH2GLink,e=t.URL,o=t.Error;this._onScheduled(i,!0,n,r,u,f,o,null,e)},_onQuickScheduled:function(n){var t=null,i="",r="",u=!1,f=n.Error;n.Appointments.length>0&&(i=(t=n.Appointments[0]).CSN,u=t.IsECheckInAvailable,r=t.UCI);this._onScheduled(i,!1,!0,"",u,!1,f,r)},_changeOverlayText:function(n,t){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ChangeOverlayText(n,t,this.$root,this._workflowSettings)},_onCardFocus:function(){this.$root.addClass("active")},_onCardBlur:function(n){this.$root.removeClass("active");$afe.jq(n.target).hasClass("comments")&&WP.DOM.Browser.isMobile&&window.scrollTo(document.body.scrollLeft,document.body.scrollTop+1)},_dataUpdated:function(n){"SelectedWorkflow"!==n.propertyName&&"QuickScheduleSlot"!==n.propertyName&&"IsOrgSelectionComplete"!==n.propertyName||this.updateStep()},_loadReviewData:function(){var t,n;this._isCurrentlyLoadingReviewResult||(this.Data.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.SlotSelection?n=this.Data.AppointmentBuilder:(n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildAppointmentBuilderForSlot(this.Data,this._getComments())).getAppointment(0).Slot=new $$WP.Scheduling.Slot(n.getAppointment(0).Slot),n.getAppointment(0).Slot&&(t={workflow:this._workflow.toRawRequestObject(),appointmentBuilder:n.toRawRequestObject(),nonce:$$WPUtil.GetPageNonce()},$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("ReviewAppointment",this._workflow)),data:$$WPUtil.postify(t),cache:!1,success:$.proxy(this._onReviewDataLoaded,this),error:$.proxy(this._onScheduleError,this)}),this._isCurrentlyLoadingReviewResult=!0,this.updateStep()))},_onReviewDataLoaded:function(n){this._reviewResult=n;this._isReviewResultLoaded=!0;this._isCurrentlyLoadingReviewResult=!1;this.updateStep()},_updateViewModelWithError:function(){this.ViewModel={SchedulingStoppedTitle:this.__reviewResult.Error.PatientFriendlyErrorMessageTitle,SchedulingStoppedPretext:this.__reviewResult.Error.PatientFriendlyErrorMessage.join(" "),SchedulingStoppedButtontext:this.__reviewResult.Error.PatientFriendlyErrorMessageButtonText,HideButton:!this.__reviewResult.Error.IsPatientFriendlyErrorMessageRecoverable,HideStoppedIcon:this.__reviewResult.Error.IsPatientFriendlyErrorMessageIconHidden};this.ViewModel.StepShouldBeActive=!0;this.ViewModel.IsLoading=!1;this.template=$$WP.Templates.Scheduling.SchedulingStopped},_hideStep:function(){this._shouldHideStep=!0;this.updateStep()},_loadCallToAction:function(n){if(n.to&&n.to.OnDemandRFV&&!this._isAnonymous){var t={rfvId:n.to.OnDemandRFV};$.post({url:makeLink("TelemedicineHome/GetOnDemandCallToAction"),data:t,cache:!1,async:!0,success:$.proxy(this._loadCallToActionCallback,this)})}},_loadCallToActionCallback:function(n){this.Data.TelehealthData.TelehealthNotificationSettings.CallToAction=n.CallToAction;this.Data.TelehealthData.TelehealthNotificationSettings.TermsLink=n.TermsLink;this.Data.TelehealthData.TelehealthNotificationSettings.PrivacyLink=n.PrivacyLink},beforeFirstRender:function(){$$WPSchedulingUtil.RegisterConfirmationPartials()},beforeRender:function(){var i=this.Data.TelehealthData.SelectedWorkflow,r=this.Data.TelehealthOrganizations.getFirstInIndex("State",n.StatesEnum.Selected);this._skipReviewAppt=this._isReviewResultLoaded||this.Data.TelehealthData.ReviewApptCalledOnOrgStep||i===t.TelehealthWorkflow.Queueing&&!r.IsLocal;this._skipReviewAppt||this._loadReviewData()},afterRender:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.AfterRender(this.$root,this,this.Data,this._isAnonymous);this.$root.on("click",this._onClick);this.$root.on("keydown",this._onKeyDown);this._isCurrentlyLoadingReviewResult&&$$WPUtil.ShowAjaxSpinner(this.$root.find(".loadingReviewDataSpinner .ajaxspinner"));this._isReviewResultLoaded=!1},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.SummaryStep},_renderNotifications:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.RenderNotifications(n,this.$root,this,this.Data,this._isGuest)},_getNotificationOptions:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetNotificationOptions(this,this.Data);this.updateStep()},_onChange:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnChange(n,this.$root,this)},_resetFocus:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ResetFocus(n,this.$root)},_onKeyDown:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnKeyDown(n,this.$root,this)}};$$WP.Scheduling.OnDemandTelehealth=$$WP.Scheduling.OnDemandTelehealth||{};$$WP.Scheduling.OnDemandTelehealth.SummaryStepController=i;i.extend($$WP.Scheduling.StepController,"WP$Scheduling$OnDemandTelehealth$SummaryStepController")}();!function(){var n=$$WP.Scheduling.TelehealthLocation,t=$$WP.Scheduling.TelehealthOrganization,i=function(i,r,u,f,e,o,s){var h,c,l;this.WP$Controllers$Controller();WP.Events.beforeUnload();this.proxify("_onKeyDown","_onClick","_onChange","_onCancelPopupClosed");this._data=r;this.$root=i;this.$root.on("mousedown",this._onClick);this._workflowSettings=u;this._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.Initial;$$WPSchedulingUtil.RegisterConfirmationPartials();this.$root.on("keydown",this._onKeyDown);$afe.select("#main > .title").hide();this._data.TelehealthLocations=n.createTelehealthLocationCollection();n.convertRawTelehealthLocations(f,this._data.TelehealthLocations);h=0;(this._data.TelehealthLocations.Models[0].SubLocations.Models&&this._data.TelehealthLocations.Models[0].SubLocations.Models[0].Id==n.FakeLocationId&&(h=1),this._data.TelehealthLocations.Models[0].SubLocations.Models?this._data.TelehealthLocations.Models[0].SubLocations.Models[h].setProperty("State",n.StatesEnum.Selected):this._data.TelehealthLocations.Models[0].SubLocations=n.createTelehealthLocationCollection(),this._data.TelehealthLocations.Models[0].setProperty("State",n.StatesEnum.Selected),this._data.TelehealthOrganizations=t.createTelehealthOrganizationCollection(),t.convertRawTelehealthOrganizations(e,this._data.TelehealthOrganizations),this._data.TelehealthOrganizations.Models[0].setProperty("State",t.StatesEnum.Selected),this._data.TelehealthOrganizations.Models[0].setProperty("IsLocal",!0),this._data.TelehealthData.QuickScheduleSlot)&&(c=new $$WP.Scheduling.Slot(this._data.TelehealthData.QuickScheduleSlot),c.Provider=this._data.TelehealthData.QuickScheduleSlot.Provider,this._data.TelehealthData.QuickScheduleSlot=c,this._data.TelehealthData.QuickScheduleSlot.setProperty("State",$$WP.Scheduling.Slot.StatesEnum.Unselected));this._data.TelehealthData.ShowCancelButton=!0;this._errorUrlOverride=o;this._isGuest=s;this._hasGuestNotifications=s;this._updateViewModel();this._onWorkflowCompleteCallback=this._schedulingComplete;l=$afe.renderTemplate($$WP.Templates.Scheduling.OnDemandTelehealth.SummaryStep,this.ViewModel);$afe.select("#telehealthSummary").safeReplaceWith(l);this._afterRender()};i.prototype={$root:null,ViewModel:null,_workflowSettings:null,_viewMode:0,_notificationOptions:null,_timerFinished:!1,_redirectCallbackId:null,_onWorkflowCompleteCallback:null,_data:null,_csn:"",_errorCount:0,_idPrefix:null,_errorUrlOverride:"",_hasGuestNotifications:!1,_isGuest:!1,_updateViewModel:function(){null===this._notificationOptions&&this._getNotificationOptions();this.ViewModel=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(this,this._data,this._workflowSettings,!1,!0,this._hasGuestNotifications)},_getID:function(n){return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetID(n,this)},_getIDPrefix:function(){return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetIDPrefix(this)},_getComments:function(){return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetComments(this.$root)},_afterRender:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.AfterRender(this.$root,this,this._data,!1)},_onClick:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnClick(n,this,this._data,this.$root)},_signUp:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SignUp(this.$root,this,this._data,this._hasGuestNotifications)},_saveEmail:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SaveEmail(this.$root,this)},_savePhone:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SavePhone(this.$root,this)},_enqueuePatient:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.EnqueuePatient(this.$root,this,this._data,!1)},_scheduleAppointment:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ScheduleAppointment(this.$root,this,this._data,this._hasGuestNotifications,!1)},_onScheduled:function(n,t,i,r,u,f,e,o,s){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnScheduled(n,t,i,r,u,f,e,this.$root,this,this._data,this._workflowSettings,!0,this._errorUrlOverride,o,!1,s)},_onScheduleError:function(){var n=new $$WPComp.MessageComponent({TitleText:$$WP.Strings.get("ScheduleErrorTitle","Scheduling"),Message:$$WP.Strings.get("ErrorMessage","Scheduling"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button($$WP.Strings.get("ScheduleErrorButtonLabel","Scheduling"),null,"cancelworkflow","")]});$$WPUtil.quickPopup(n);WP.Events.cancelBeforeUnload();$$WP.Utilities.TryRedirect(makeLink("Scheduling/OnDemandTelehealth"))},_checkRedirectFromOverlay:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.CheckRedirectFromOverlay(n,this)},_redirectToVisitDetails:function(n,t){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.RedirectToVisitDetails(n,t,this._csn,this.ViewModel.SelectedOrg?this.ViewModel.SelectedOrg.OrganizationId:null)},_onEnqueued:function(n,t){var i=t.CSN,r=t.DxoId,u=t.IsECheckInAvailable,f=t.DidRefreshH2GLink,e=t.URL,o=t.Error;this._onScheduled(i,!0,n,r,u,f,o,null,e)},_onQuickScheduled:function(n){var t=null,i="",r=!1,u=n.Error;n.Appointments.length>0&&(i=(t=n.Appointments[0]).CSN,r=t.IsECheckInAvailable);this._onScheduled(i,!1,!0,"",r,!1,u)},_schedulingComplete:function(n){WP.Events.cancelBeforeUnload();this._data.TelehealthData.RootDecisionTreeID?(this._saveActionNodes(n),this._redirectToSelfTriage(this._data.TelehealthData.RootDecisionTreeID,this._data.TelehealthData.DecisionTreeAnswerID,this._data.TelehealthData.IsFromSelfTriageLandingPage)):$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.RedirectToVisitDetails("1",!0,this._csn,"")},_changeOverlayText:function(n,t){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ChangeOverlayText(n,t,this.$root,this._workflowSettings)},_getNotificationOptions:function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetNotificationOptions(this,this._data)},_renderNotifications:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.RenderNotifications(n,this.$root,this,this._data,this._hasGuestNotifications)},_onChange:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnChange(n,this.$root,this)},_resetFocus:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ResetFocus(n,this.$root)},_onKeyDown:function(n){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnKeyDown(n,this.$root,this)},_onCancel:function(){confirmComponent=new $$WPComp.MessageComponent({TitleText:$$WP.Strings.get("CancelSchedulingTitle","ondemandtelehealth"),Message:$$WP.Strings.get("CancelSchedulingMessage","ondemandtelehealth"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button($$WP.Strings.getForTemplate("StayButtonText","Core.SafeToRedirectPopup"),null,"previousstep",""),new $$WPComp.ComplexObjects.Button($$WP.Strings.get("CancelSchedulingCaption","ondemandtelehealth"),null,"cancelworkflow","")],callback:this._onCancelPopupClosed});$$WPUtil.quickPopup(confirmComponent)},_onCancelPopupClosed:function(n){"toolbar0"!==n&&"close"!==n&&($.post({url:makeLink("Scheduling/CancelSchedulingAppointment")}),WP.Events.cancelBeforeUnload(),this._redirectSafely("inside.asp"))},_redirectSafely:function(n){this._errorUrlOverride?$$WP.Utilities.TryRedirect(makeLink(this._errorUrlOverride)):$$WP.Utilities.TryRedirect(makeLink(n))},_saveActionNodes:function(n){var t={ID:this._data.TelehealthData.RootDecisionTreeID,AnswerID:this._data.TelehealthData.DecisionTreeAnswerID},i={ID:this._data.TelehealthData.DecisionTreeNodeID,CSN:this._data.TelehealthData.DecisionTreeNodeCSN,Type:25,EncounterCSN:n[0].CSN,EncounterUCI:n[0].UCI};$.ajax({url:makeLink("SymptomChecker/ActionNode/SaveActionNodes"),type:"POST",data:$$WPUtil.postify({tree:t,acceptanceResult:i})})},_redirectToSelfTriage:function(n,t,i){var r="";$.ajax({url:makeLink("SymptomChecker/ActionNode/SetAutoStart"),type:"POST",success:function(){t?(r="SymptomChecker/SelfTriage/Load?AnswerID="+encodeURIComponent(t),r+="&onrecommendationspage=1",i&&(r+="&fromList=1")):n?(r="SymptomChecker/SelfTriage/Load?TreeID="+encodeURIComponent(n),i&&(r+="&fromList=1")):r="SymptomChecker";$$WP.Utilities.TryRedirect(makeLink(r))}})}};$$WP.Scheduling.OnDemandTelehealth.StandaloneSummaryStepController=i;i.extend($$WP.Controllers.Controller,"WP$Scheduling$OnDemandTelehealth$StandaloneSummaryStepController")}();!function(n){!function(n){!function(n){!function(n){var t=function(){function t(n,t){this.__$root=n;this.__schedulingControllerParameters=t;this.__$root.on("keydown",$.proxy(this.__onKeyDown,this));this.__$root.on("click",$.proxy(this.__onClick,this))}return t.prototype.Render=function(t,i,r){var f,e,u,o;this.__continueCallback=r;f=n.AnonymousTelehealthHelpers.GetTelehealthSplashPageViewModel(i,this.__schedulingControllerParameters);e=$afe.renderTemplate($$WP.Templates.Scheduling.OnDemandTelehealth.SplashPage,f,{});t.safeReplaceWith(e);this.__detailsExpanded=this.__schedulingControllerParameters.expandByDefault;u={HeaderText:$$WP.Strings.get("SplashPageBannerHeader","ondemandtelehealth"),DetailText:$$WP.Strings.get("SplashPageBannerDetails","ondemandtelehealth"),BannerType:"criticalType",DisableDetailTextHtmlEncoding:!0,ButtonLabel:$$WP.Strings.get("SplashPageBannerButtonCaption","ondemandtelehealth"),ButtonUrl:$$WP.Strings.get("SplashPageBannerButtonUrl","ondemandtelehealth")};(u.HeaderText||u.DetailText||u.ButtonLabel)&&(o=$afe.renderTemplate($$WP.Templates.Core.Banner,u,{}),$afe.select("#anonymousSchedulingBanner").safeReplaceWith(o),$afe.select(".standardBanner").addClass("anonymousSchedulingBanner"))},t.prototype.__onClick=function(n){var r,u,t,i;if(void 0!==$afe.jq(n.target).data("id")&&!$afe.jq(n.target).hasClass("disabled")){r=$afe.jq(n.target).data("id").split("-")[0];u=window.location.href;switch(r){case"login":$.post({url:makeLink("Scheduling/Anonymous/RedirectToLoginStartWorkflow"),data:{workflow:this.__schedulingControllerParameters.workflow,sourceUrl:u},cache:!1,success:this.__onRedirectUrl});break;case"scheduleSelf":this.__schedulingControllerParameters.anonymousWorkflowForProxy=!1;this.__continueCallback(this.__schedulingControllerParameters);break;case"scheduleProxy":this.__schedulingControllerParameters.anonymousWorkflowForProxy=!0;this.__continueCallback(this.__schedulingControllerParameters);break;case"expandCollapseDetails":case"expandCollapseDetailsIcon":case"expandCollapseDetailsHeader":this.__schedulingControllerParameters.outsideBusinessHours||(t=this.__$root.find("#iconExpandDetails"),i=t.parent(),this.__detailsExpanded?(t.removeClass("splashPageCollapsible"),t.addClass("splashPageExpandable"),i.safeAttr("aria-expanded","false"),this.__$root.find("#splashPageDetails").hide(),this.__detailsExpanded=!1):(t.removeClass("splashPageExpandable"),t.addClass("splashPageCollapsible"),i.safeAttr("aria-expanded","true"),this.__$root.find("#splashPageDetails").show(),this.__detailsExpanded=!0))}}},t.prototype.__onKeyDown=function(n){void 0!==$afe.jq(n.target).data("id")&&($afe.jq(n.target).hasClass("disabled")||13!==n.which&&32!==n.which||(n.preventDefault(),this.__onClick(n)))},t.prototype.__onRedirectUrl=function(n){n.Url&&$$WP.Utilities.TryRedirect(makeLink(n.Url))},t}();n.SplashPageController=t}(n.OnDemandTelehealth||(n.OnDemandTelehealth={}))}(n.Scheduling||(n.Scheduling={}))}(n.PatientEngagement||(n.PatientEngagement={}))}(Epic||(Epic={}));$$WP.Scheduling.OnDemandTelehealth=$$WP.Scheduling.OnDemandTelehealth||{};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore||{};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildLink=function(n){return'<a tabindex="0" class="'+n.cssClass+'" data-id="'+n.dataId+'" role="link" title="'+n.title+'"aria-label="'+n.title+" "+n.content+'">'+n.content+'<img class="testimage" data-id="'+n.dataId+'" src="'+makeStaticLink("images/edit_pencil.svg")+'" alt="" aria-hidden="true" /><\/a>'};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode={Initial:0,EditEmail:1,EditPhone:2,TogglePhone:3,CloseEditPhone:4,ToggleEmail:5,CloseEditEmail:6};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel=function(n,t,i,r,u,f,e){var s,h,c,y,l,o,p=t.AppointmentBuilder.ReasonForVisit,w=i.MaxCommentsLength,a=!0,v=!0,b=t.ProxyContextName;return t.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing&&(o=t.TelehealthOrganizations.getFirstInIndex("State",$$WP.Scheduling.TelehealthOrganization.StatesEnum.Selected)),r?(s=!1,h=!1,c=!1):(s=!(!o||o.IsLocal)||i.RequireODVVComments,h=i.AllowODVVComments||s,c=s||(t.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing||f)&&!!o),y=new $$WP.FormValidation.ValidationSettings({required:s,maxLength:w,showCharacterCounter:!0}),t.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.SlotSelection&&t.AppointmentBuilder.getFirstAppointment&&(t.TelehealthData.QuickScheduleSlot=t.AppointmentBuilder.getFirstAppointment().Slot),!(l=t.TelehealthData.Provider)&&t.TelehealthData.QuickScheduleSlot&&(l=t.Providers.getFromIndex("ID",t.TelehealthData.QuickScheduleSlot.ProviderId)),n._idPrefix="OnDemandSummaryStep_"+(n.Id||""),e&&(a=i.AllowSelfSignup&&e.AdultWorkflowEnabled,v=e.ProxyWorkflowEnabled),{ReasonForVisit:p.Title,Workflow:t.TelehealthData.SelectedWorkflow,Slot:t.TelehealthData.QuickScheduleSlot,Provider:l,DayString:t.TelehealthData.QuickScheduleSlot?t.TelehealthData.QuickScheduleSlot.DateString:"",HasProviderDetailsSecurity:i.HasProviderDetailsSecurity&&!$$WP.Utilities.UI.IsMobile&&!n._isGuest,AllowComments:h,RequireComments:s,ShowRequiredIndicator:c,Comments:n._getComments(),CommentsValidationSettings:y,CommentsInitiallyInvalid:!0,StepShouldBeActive:!0,LoadingClasses:"summarystep jqHidden",SelectedOrg:o,HideNotifications:$$WP.Utilities.UI.IsMobile&&t.TelehealthData.TelehealthNotificationSettings.IsPushNotificationEnabled&&!!o&&o.HasPatientAccess||r||t.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.SlotSelection&&!f,IsAnonymous:r,AllowSelfSignup:a||v,ShowCancelButton:t.TelehealthData.ShowCancelButton,ShowOrganization:!r&&!u,ProxyOnly:v&&!a,IsStandalone:u,PatientName:b,IdPrefix:n._getIDPrefix(),CommentsTextId:n._getID("comments")}};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnClick=function(n,t,i,r){if(void 0!==$afe.jq(n.target).data("id"))if($afe.jq(n.target).hasClass("disabled")||$afe.jq(n.target).safeAttr("disabled"))n.preventDefault();else if(!i.IsSchedulingCompleting)switch($afe.jq(n.target).data("id").split("-")[0]){case"signup":t._signUp();break;case"continue":t._continue();break;case"provider":case"providerphoto":if(t._workflowSettings.HasProviderDetailsSecurity&&!t._isGuest)if(this._isAnonymous){var u=makeLink("publicforms.asp?mode=provider&widgetmode=1&id="+encodeURIComponent(i.TelehealthData.QuickScheduleSlot.ProviderId));window.open(u,null,"width=1024,height=600,resizable,status,scrollbars").focus()}else u=$$WP.Utilities.UI.IsMobile?makeLink("app/providers/details?id="+encodeURIComponent(i.TelehealthData.QuickScheduleSlot.ProviderId)+"&isIdEncrypted=1"):makeLink("app/providers/details?id="+encodeURIComponent(i.TelehealthData.QuickScheduleSlot.ProviderId)),window.open(u,null,"width=1024,height=600,resizable,status,scrollbars").focus();break;case"smsNotificationSelect":t._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.EditPhone;r.find('[data-id="signup"]').addClass("disabled");t._renderNotifications(!0);break;case"emailNotificationSelect":t._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.EditEmail;r.find('[data-id="signup"]').addClass("disabled");t._renderNotifications(!0);break;case"saveEmail":t._saveEmail();r.find('[data-id="signup"]').removeClass("disabled");break;case"savePhone":t._savePhone();r.find('[data-id="signup"]').removeClass("disabled");break;case"cancelPhone":t._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.CloseEditPhone;r.find('[data-id="signup"]').removeClass("disabled");t._renderNotifications(!0);break;case"cancelEmail":t._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.CloseEditEmail;r.find('[data-id="signup"]').removeClass("disabled");t._renderNotifications(!0);break;case"cancel":t._onCancel();break;case"startOver":WP.Events.cancelBeforeUnload();location.reload()}};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetID=function(n,t){return $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetIDPrefix(t)+"_"+n};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetIDPrefix=function(n){return null===n._idPrefix&&(n._idPrefix="OnDemandSummaryStep_"+(n.Id||"")),n._idPrefix};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetComments=function(n){var t="",i=n.find('[data-id="comments"]');return i&&(void 0===(t=i.val())||$$WPUtil.IsNullOrEmpty(t))&&(t=""),t};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SignUp=function(n,t,i,r){i.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing?($$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ParseNotificationsForSaving(n,t,i),t._enqueuePatient()):(r&&$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ParseNotificationsForSaving(n,t,i),t._scheduleAppointment())};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ParseNotificationsForSaving=function(n,t,i){i.TelehealthData.ShouldSaveNotifications=!0;i.TelehealthData.NotificationSelection=new $$WP.Scheduling.TelehealthNotificationSelection(n.find("#"+t._getID("smsNotificationCheckbox")).is(":checked"),n.find("#"+t._getID("emailNotificationCheckbox")).is(":checked"),t._notificationOptions.PhoneNumber,t._notificationOptions.EmailAddress)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SaveEmail=function(n,t){var i=n.find('[data-id="emailEntry"]')[0].value;""===i?t._notificationOptions.CheckEmailOption=!1:i!==t._notificationOptions.EmailAddress&&(t._notificationOptions.CheckEmailOption=!0);t._notificationOptions.EmailAddress=i;t._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.CloseEditEmail;t._renderNotifications(!0)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.SavePhone=function(n,t){for(var i=n.find('[data-id="textEntry"]')[0].value;"#"===i.substring(0,1);)i=i.substring(1);""===i?t._notificationOptions.CheckSMSOption=!1:i!==t._notificationOptions.PhoneNumber&&(t._notificationOptions.CheckSMSOption=!0);t._notificationOptions.PhoneNumber=i;t._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.CloseEditPhone;t._renderNotifications(!0)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.EnqueuePatient=function(n,t,i,r){var s,u,l=i.AppointmentBuilder.ReasonForVisit,f=i.TelehealthLocations.getFirstInIndex("State",$$WP.Scheduling.TelehealthLocation.StatesEnum.Selected),e=!1,a,h,c,v,o;(f&&(s=f.SubLocations.getFirstInIndex("State",$$WP.Scheduling.TelehealthLocation.StatesEnum.Selected)),e=!!r||!!(u=i.TelehealthOrganizations.getFirstInIndex("State",$$WP.Scheduling.TelehealthOrganization.StatesEnum.Selected))&&u.IsLocal,l&&f)&&(h="",c=!1,null==t._notificationOptions||$$WPUtil.IsNullOrEmpty(t._notificationOptions.PhoneNumber)||(a=new RegExp("[-. ()]","g"),h=t._notificationOptions.PhoneNumber.replace(a,"")),!e&&i.IsProxy&&(c=!u.HasPatientAccess),v=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetSourceWorkflowFromUrl(),o={rfvId:l.OnDemandRFV,locationId:f.Id,subLocationId:s?s.Id:"",comments:t._getComments(),sendSMS:!!t._notificationOptions&&t._notificationOptions.CheckSMSOption,sendEmail:!!t._notificationOptions&&t._notificationOptions.CheckEmailOption,phoneNumber:h,emailAddress:t._notificationOptions?t._notificationOptions.EmailAddress:"",shouldSaveNotifications:i.TelehealthData.ShouldSaveNotifications,isLocal:e,orgId:e?"":u.OrganizationId,sendAsUnverifiedProxy:c,completedInsuranceVerificationStep:!0===i.AppointmentBuilder.CompletedInsuranceVerificationStep,completedDemographicVerificationStep:!0===i.AppointmentBuilder.CompletedDemographicVerificationStep,sourceWorkflow:v,useInsuranceForVisit:i.AppointmentBuilder.UseInsuranceForVisit},n.find('[data-id="signup"]').addClass("disabled"),$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ShowOverlay(n,i,r),t._redirectCallbackId=setTimeout($.proxy(t._checkRedirectFromOverlay,t,o.isLocal),5e3),$.post({url:makeLink("TelemedicineHome/EnqueuePatient"),data:JSON.stringify(o),cache:!1,async:!0,success:$.proxy(t._onEnqueued,t,o.isLocal),contentType:"application/json"}))};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetSourceWorkflowFromUrl=function(){var n=new URL(window.location.href).searchParams.get("sourceWorkflow"),t=$$WP.Scheduling.Workflow.getWorkflowTypesEnumName($$WP.Scheduling.Workflow.WorkflowTypesEnum.OnMyWay);return($$WP.Utilities.IsNullOrEmpty(n)||n!==t)&&(n=$$WP.Scheduling.Workflow.getWorkflowTypesEnumName($$WP.Scheduling.Workflow.WorkflowTypesEnum.OnDemandTelehealth)),n};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ScheduleAppointment=function(n,t,i,r,u){var f,o=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildWorkflowObject(),s=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildAppointmentBuilderForSlot(i,t._getComments()),e;selectedNotificationOptions=r?{SendSMS:!!t._notificationOptions&&t._notificationOptions.CheckSMSOption,SendEmail:!!t._notificationOptions&&t._notificationOptions.CheckEmailOption,PhoneNumber:t._notificationOptions?t._notificationOptions.PhoneNumber:"",EmailAddress:t._notificationOptions?t._notificationOptions.EmailAddress:"",ShouldSaveNotifications:i.TelehealthData.ShouldSaveNotifications}:{ShouldSaveNotifications:!1};e=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetSourceWorkflowFromUrl();f={workflow:o.toRawRequestObject(),appointmentBuilder:s.toRawRequestObject(),selectedNotificationOptions:selectedNotificationOptions,sourceWorkflow:e,nonce:$$WPUtil.GetPageNonce()};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ShowOverlay(n,i,u);$.post({url:makeLink("Scheduling/ScheduleAppointment"),data:$$WPUtil.postify(f),cache:!1,success:$.proxy(t._onQuickScheduled,t),error:$.proxy(t._onScheduleError,t)})};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildWorkflowObject=function(){return new $$WP.Scheduling.Workflow({Type:$$WP.Scheduling.Workflow.WorkflowTypesEnum.OnDemandTelehealth})};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildAppointmentBuilderForSlot=function(n,t){var i,s,h;i=n.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing?n.AppointmentBuilder.ReasonForVisit.OnDemandSlot:n.TelehealthData.QuickScheduleSlot;var e,o,r=null,u=null,c=n.AppointmentBuilder.ReasonForVisit.OnDemandRFV,f=n.TelehealthLocations.getFirstInIndex("State",$$WP.Scheduling.TelehealthLocation.StatesEnum.Selected);return f&&(o=f.SubLocations.getFirstInIndex("State",$$WP.Scheduling.TelehealthLocation.StatesEnum.Selected)),s=n.AppointmentBuilder.CompletedInsuranceVerificationStep,h=n.AppointmentBuilder.CompletedDemographicVerificationStep,r=new $$WP.Scheduling.AppointmentBuilder({ReasonForVisit:new $$WP.Scheduling.ReasonForVisit({Id:n.AppointmentBuilder.ReasonForVisit.LineInWDF15000,CategoryValue:n.AppointmentBuilder.ReasonForVisit.CategoryValue}),OnDemandReasonForVisitValue:c,PatientLocation:f,PatientSublocation:o,SchedulingComments:t,UseInsuranceForVisit:n.TelehealthData.UseInsuranceForVisit,CompletedInsuranceVerificationStep:s,CompletedDemographicVerificationStep:h}),u=new $$WP.Scheduling.Appointment({VisitType:new $$WP.Scheduling.VisitType({ID:i.VisitTypeId,AllowedProviderDepartmentPairs:[]})}),e=new $$WP.Scheduling.ProviderDepartmentPair({ProviderId:i.ProviderId,DepartmentId:i.DepartmentId}),u.Slot=i,u.ProviderDepartmentPairs.push(e),r.Appointments.empty(),r.Appointments.add(u),r};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnScheduled=function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p){if(e&&!$$WPUtil.IsNullOrEmpty(e.ErrorCode)||$$WPUtil.IsNullOrEmpty(n)&&$$WPUtil.IsNullOrEmpty(v)&&$$WPUtil.IsNullOrEmpty(p))this.handleSchedulingProblems(o,h,s,e,a,n,i,r,y,l);else{if(s._csn=n,null!==s._onWorkflowCompleteCallback&&!0===c.IsEmbedded){var w;return w=[{CSN:n,UCI:v,isLocal:i,isOnDemand:t}],void s._onWorkflowCompleteCallback(w)}WP.Events.cancelBeforeUnload();v?$$WP.Utilities.TryRedirect(makeLink("Visits/VisitDetails?uci="+encodeURIComponent(v))):i||!p?i&&c.RequireECheckInForTelemedicine&&u?$$WP.Utilities.TryRedirect(makeLink("echeckin?csn="+encodeURIComponent(n))):t?this.handleOnDemandRedirection(s,f,i):s._redirectToVisitDetails("1",i):this.handleXOrgUnverifiedProxyRedirection(o,h,p,y)}};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.handleSchedulingProblems=function(n,t,i,r,u,f,e,o,s,h){var c;$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.HideOverlay(n,t,s);i._changeOverlayText(!1);c=e?$$WP.Strings.get("TelehealthErrorMessage","ondemandtelehealth"):$$WP.Strings.get("TelehealthAnywhereErrorMessage","ondemandtelehealth");null!==i._redirectCallbackId&&(clearTimeout(i._redirectCallbackId),i._redirectCallbackId=null,i._timerFinished=!1);!r||$$WPUtil.IsNullOrEmpty(r.ErrorCode)?this.createErrorPopup(i,c,null):this.handleSchedulingError(n,t,i,r.ErrorCode,u,c,f,e,o,h)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.handleSchedulingError=function(n,t,i,r,u,f,e,o,s,h){var l,a,c,v,y,p;switch(l=f,c=t.TelehealthOrganizations.getFirstInIndex("State",$$WP.Scheduling.TelehealthOrganization.StatesEnum.Selected),r){case"13":return i._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.EditEmail,i._renderNotifications(!0),$$WP.FormValidation.addValidationError(n.find('[data-id="emailEntry"]'),"InputNotEmail"),void $afe.select('[data-id="signup"]').removeClass("disabled");case"14":return i._viewMode=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.EditPhone,i._renderNotifications(!0),$$WP.FormValidation.addValidationError(n.find('[data-id="textEntry"]'),"InputNotPhoneNumber"),void $afe.select('[data-id="signup"]').removeClass("disabled");case"ALREADY-IN-QUEUE":if($$WP.Utilities.IsNullOrEmpty(c))break;if(h&&!$$WPUtil.IsNullOrEmpty(e))return v=o,y=c,$$WPUtil.IsNullOrEmpty(s)||(v=!1,y=s),WP.Events.cancelBeforeUnload(),void $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.RedirectToVisitDetails("1",v,e,y);$$WP.Strings.addMnemonic("@MYCHART@OrganizationName@",c.OrganizationName,null,"ondemandtelehealth");l=$$WP.Strings.get("AlreadyInQueueNoVisits","ondemandtelehealth");$$WP.Strings.removeMnemonic("@MYCHART@OrganizationName@");break;case"ALREADY-IN-QUEUE-VISITS":if($$WP.Utilities.IsNullOrEmpty(c))break;$$WP.Strings.addMnemonic("@MYCHART@OrganizationName@",c.OrganizationName,null,"ondemandtelehealth");l=$$WP.Strings.get("AlreadyInQueueVisits","ondemandtelehealth");$$WP.Strings.removeMnemonic("@MYCHART@OrganizationName@");a=function(){WP.Events.cancelBeforeUnload();$$WP.Utilities.TryRedirect(makeLink("Visits/visitslist"))};break;case"NO-WPR-SECURITY":l=$$WP.Strings.get("NoSecurityText","SelfTriage.AddOnDemandVideoVisitNode");p=u?makeLink(u):makeLink("inside.asp");a=function(){WP.Events.cancelBeforeUnload();$$WP.Utilities.TryRedirect(p)};break;case"UNKNOWN-ERROR":a=function(){WP.Events.cancelBeforeUnload();$$WP.Utilities.TryRedirect(makeLink("Scheduling/AnonymousTelehealth"))};break;default:h&&(a=function(){WP.Events.cancelBeforeUnload();$$WP.Utilities.TryRedirect(makeLink("Scheduling/AnonymousTelehealth"))})}this.createErrorPopup(i,l,a)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.createErrorPopup=function(n,t,i){var r,u;u=$$WP.Strings.get("DismissErrorPopupButtonText","ondemandtelehealth");r=new $$WPComp.MessageComponent({TitleText:$$WP.Strings.get("ErrorTitle","ondemandtelehealth"),Message:t,ToolbarButtons:[new $$WPComp.ComplexObjects.Button(u,null,"cancelworkflow","")],callback:i});$$WPUtil.quickPopup(r);$afe.select('[data-id="joinqueue"]').removeClass("disabled");0===n._errorCount&&n._loadSlots&&n._loadSlots();n._errorCount++};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.handleXOrgUnverifiedProxyRedirection=function(n,t,i,r){var u,f,e,o;if(u=t.TelehealthOrganizations.getFirstInIndex("State",$$WP.Scheduling.TelehealthOrganization.StatesEnum.Selected),f=t.ProxyContextName,$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.HideOverlay(n,t,r),$$WP.Strings.addMnemonic("@MYCHART@OrganizationName@",u.OrganizationName,null,"ondemandtelehealth"),$$WP.Strings.addMnemonic("@MYCHART@PatientName@",f,null,"ondemandtelehealth"),e=$afe.renderTemplate($$WP.Templates.Core.Banner,{BannerType:"successType",HeaderText:$$WP.Strings.get("XOrgUnverifiedProxyDoneSchedulingHeader","ondemandtelehealth"),DetailText:$$WP.Strings.get("XOrgUnverifiedProxyDoneSchedulingDetail","ondemandtelehealth")}),$$WP.Strings.removeMnemonic("@MYCHART@PatientName@"),$$WP.Strings.removeMnemonic("@MYCHART@OrganizationName@"),$afe.select("#scheduling-workflow-container").safeReplaceWith(e),(o=$afe.select("#scheduling-startover")).parents("#hasLinks").removeClass("hasLinks"),o.parent().remove(),$$WP.Utilities.UI.IsMobile)return i+="&mobile=0",void(window.location=i);$$WP.Utilities.TryRedirect(i,null,null,!0,!0)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.handleOnDemandRedirection=function(n,t,i){n._timerFinished?t?n._redirectCallbackId=setTimeout($.proxy(n._checkRedirectFromOverlay,n,i),3e3):n._redirectToVisitDetails("0",i):(t&&(null!==n._redirectCallbackId&&clearTimeout(n._redirectCallbackId),n._redirectCallbackId=setTimeout($.proxy(n._checkRedirectFromOverlay,n,i),3e3)),n._timerFinished=!0)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnScheduleError=function(n,t,i,r){var u;$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.HideOverlay(n,i,r);t._changeOverlayText(!1);u=new $$WPComp.MessageComponent({TitleText:$$WP.Strings.get("ErrorTitle","ondemandtelehealth"),Message:$$WP.Strings.get("TelehealthSchedulingErrorMessage","ondemandtelehealth"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button("Okay",null,"cancelworkflow","")]});$$WPUtil.quickPopup(u);$afe.select('[data-id="joinqueue"]').removeClass("disabled");0===t._errorCount&&t._loadSlots();t._errorCount++};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetErrorMessage=function(n){return"POOL-EMPTY"===n?$$WP.Strings.get("TelehealthEmptyPoolErrorMessage","ondemandtelehealth"):$$WP.Strings.get("TelehealthErrorMessage","ondemandtelehealth")};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.CheckRedirectFromOverlay=function(n,t){t._timerFinished?t._redirectToVisitDetails("0",n):t._timerFinished=!0};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.RedirectToVisitDetails=function(n,t,i,r){$$WP.Utilities.UI.IsMobile?t?$$WP.Utilities.TryRedirect(makeLink("Home/LogOut?mode=OnDemandTelehealth&skipCommunityLogout=1&workflowcomplete=1&eCSN="+encodeURIComponent(i))):$$WP.Utilities.TryRedirect(makeLink("Home/LogOut?mode=OnDemandTelehealth&skipCommunityLogout=1&workflowcomplete=1&eCSN="+encodeURIComponent(i)+"&xorgid="+encodeURIComponent(r))):t?$$WP.Utilities.TryRedirect(makeLink("Visits/VisitDetails?csn="+encodeURIComponent(i)+"&scheduled="+n)):$$WP.Utilities.TryRedirect(makeLink("Visits/visitslist?xorgcsn="+encodeURIComponent(i))+"&xorgid="+encodeURIComponent(r))};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ChangeOverlayText=function(n,t,i,r){var u=$$WP.Strings.get("LoadingMessage","Scheduling");n&&(u=r.RequireECheckInForTelemedicine&&t?$$WP.Strings.containsGlobalMnemonic("BrandECheckIn")?$$WP.Strings.get("OnDemandLoadingMessageWithEcheckin","ondemandtelehealth"):$$WP.Strings.get("OnDemandLoadingMessageWithEcheckinNoMnemonic","ondemandtelehealth"):$$WP.Strings.get("OnDemandLoadingMessageNoEcheckin","ondemandtelehealth"));i.find('[data-id="loadingmessage"]').text(u)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.AfterRender=function(n,t,i,r){$$WP.FormValidation.initializeDOMSubtree(n);t._renderNotifications(t._autoFocus);setTimeout($.proxy(function(){$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.HideOverlay(n,i,r)},t),500);$afe.select(".content").trigger("resize");n.find("h2.header").focus()};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.RenderNotifications=function(n,t,i,r,u){var f,o,s,e,h,c,l=r.TelehealthOrganizations.getFirstInIndex("State",$$WP.Scheduling.TelehealthOrganization.StatesEnum.Selected);if((i.ViewModel.Workflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing||u)&&l){if(h=u?$$WP.Strings.get("TelehealthNotificationsGuestProxyPretext","ondemandtelehealth"):$$WP.Strings.get("TelehealthNotificationsPretext","ondemandtelehealth"),f={NotificationGroup:new $$WP.FormValidation.ValidationGroup({}),ShowEmailOption:i._notificationOptions.ShowEmailOption,ShowSMSOption:i._notificationOptions.ShowSMSOption,CheckEmailOption:i._notificationOptions.CheckEmailOption,CheckSMSOption:i._notificationOptions.CheckSMSOption,EmailAddress:i._notificationOptions.EmailAddress,PhoneNumber:i._notificationOptions.PhoneNumber,CallToAction:i._notificationOptions.CallToAction,TermsLink:i._notificationOptions.TermsLink,PrivacyLink:i._notificationOptions.PrivacyLink,HasTermsLink:!!i._notificationOptions.TermsLink,HasPrivacyLink:!!i._notificationOptions.PrivacyLink,ViewMode:i._viewMode,IsEmailEmpty:$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.IsNullOrEmpty(i._notificationOptions.EmailAddress),IsPhoneEmpty:$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.IsNullOrEmpty(i._notificationOptions.PhoneNumber),IdPrefix:i._getIDPrefix(),HasGuestNotifications:u,Pretext:h,NoEmailMessage:$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildLink({cssClass:"notificationSelect",dataId:"emailNotificationSelect",title:$$WP.Strings.get("TelehealthEditEmailTooltip","ondemandtelehealth"),content:$$WP.Strings.get("TelehealthNotificationsNoEmail","ondemandtelehealth")}),NoPhoneMessage:$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildLink({cssClass:"notificationSelect",dataId:"smsNotificationSelect",title:$$WP.Strings.get("TelehealthEditPhoneTooltip","ondemandtelehealth"),content:$$WP.Strings.get("TelehealthNotificationsNoPhone","ondemandtelehealth")}),TextEditLink:$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildLink({cssClass:"notificationSelect",dataId:"smsNotificationSelect",title:$$WP.Strings.get("TelehealthEditPhoneTooltip","ondemandtelehealth"),content:i._notificationOptions.PhoneNumber}),EmailEditLink:$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.BuildLink({cssClass:"notificationSelect",dataId:"emailNotificationSelect",title:$$WP.Strings.get("TelehealthEditEmailTooltip","ondemandtelehealth"),content:i._notificationOptions.EmailAddress}),Validation:{Required:new $$WP.FormValidation.ValidationSettings({atLeastOneChecked:!0}),Email:new $$WP.FormValidation.ValidationSettings({isEmail:!0,required:!1}),Phone:new $$WP.FormValidation.ValidationSettings({required:!1})}},i.ViewModel.HideNotifications)return;o=$afe.renderTemplate($$WP.Templates.Scheduling.OnDemandTelehealth.NotificationStep,f);t.find(".notificationContainer > :first-child").safeReplaceWith(o);t.find(".button.confirmNotifications.completeworkflow");s=!(f.CheckSMSOption&&!f.IsPhoneEmpty||f.CheckEmailOption&&!f.IsEmailEmpty);e=i._viewMode===$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.EditEmail||i._viewMode===$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.EditPhone;s&&!e?$$WP.FormValidation.addValidationError(t.find(".fakeValidation > input").first()):e||((c=t.find(".summaryinfo")).removeAttr("data-invalid"),$$WP.FormValidation.checkIfFormIsValid(c,!0))}t.find("fieldset.notificationStep input").on("change",i._onChange);n&&!i.ViewModel.HideNotifications&&$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.FocusInputElement(t,i._viewMode)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.FocusInputElement=function(n,t){var i,u,r=!1;switch(t){case $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.EditEmail:i=n.find('input[data-id="emailEntry"]');r=!0;break;case $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.EditPhone:i=n.find('input[data-id="textEntry"]');r=!0;break;case $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.Initial:i=n.find("textarea");r=!0;break;case $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.TogglePhone:i=n.find('input[data-id="smsToggle"]');break;case $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.ToggleEmail:i=n.find('input[data-id="emailToggle"]');break;case $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.CloseEditPhone:i=n.find('a[data-id="smsNotificationSelect"]');break;case $$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.CloseEditEmail:i=n.find('a[data-id="emailNotificationSelect"]')}i&&i.length>0&&(i.focus(),u=i.val().length,r&&i.get(0).setSelectionRange(u,u))};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.IsNullOrEmpty=function(n){return!(n&&n.length>0)};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.GetNotificationOptions=function(n,t){n._notificationOptions={ShowEmailOption:t.TelehealthData.TelehealthNotificationSettings.ShowEmailOption,ShowSMSOption:t.TelehealthData.TelehealthNotificationSettings.ShowSMSOption,CheckEmailOption:t.TelehealthData.TelehealthNotificationSettings.CheckEmailOption,CheckSMSOption:t.TelehealthData.TelehealthNotificationSettings.CheckSMSOption,EmailAddress:t.TelehealthData.TelehealthNotificationSettings.EmailAddress,PhoneNumber:t.TelehealthData.TelehealthNotificationSettings.PhoneNumber,CallToAction:t.TelehealthData.TelehealthNotificationSettings.CallToAction,TermsLink:t.TelehealthData.TelehealthNotificationSettings.TermsLink,PrivacyLink:t.TelehealthData.TelehealthNotificationSettings.PrivacyLink}};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnChange=function(n,t,i){n.target.id!==i._getID("smsNotificationCheckbox")&&n.target.id!==i._getID("emailNotificationCheckbox")||(i._notificationOptions.CheckEmailOption=t.find("#"+i._getID("emailNotificationCheckbox")).is(":checked"),i._notificationOptions.CheckSMSOption=t.find("#"+i._getID("smsNotificationCheckbox")).is(":checked"),i._viewMode=n.target.id===i._getID("smsNotificationCheckbox")?$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.TogglePhone:$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ViewMode.ToggleEmail,i._renderNotifications(!0))};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ResetFocus=function(n,t){switch(n){case"smsNotificationLabel":case"emailNotificationLabel":t.find('[data-id="'+n+'"]').focus();break;case"textEntry":case"cancelPhone":case"savePhone":t.find('[data-id="smsNotificationSelect"]').focus();break;case"emailEntry":case"cancelEmail":case"saveEmail":t.find('[data-id="emailNotificationSelect"]').focus()}};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.OnKeyDown=function(n,t,i){var r;if(void 0!==$afe.jq(n.target).data("id")&&!$afe.jq(n.target).hasClass("disabled"))switch(r=$afe.jq(n.target).data("id").split("-")[0]){case"comments":return;case"textEntry":if(13!==n.which)return;n.preventDefault();i._savePhone();i._resetFocus(r);break;case"emailEntry":if(13!==n.which||t.find('[data-id="saveEmail"]').safeAttr("disabled"))return;n.preventDefault();i._saveEmail();i._resetFocus(r);break;case"smsNotificationLabel":13!==n.which&&32!==n.which||(t.find("#"+i._getID("smsNotificationCheckbox")).click(),i._resetFocus(r));break;case"emailNotificationLabel":13!==n.which&&32!==n.which||(t.find("#"+i._getID("emailNotificationCheckbox")).click(),i._resetFocus(r));break;case"signup":case"redirectToLogin":case"selfSignup":case"emailNotificationSelect":case"smsNotificationSelect":case"cancelEmail":case"cancelPhone":case"saveEmail":case"savePhone":case"startOver":case"cancel":13!==n.which&&32!==n.which||(n.preventDefault(),i._onClick(n),i._resetFocus(r))}};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.ShowOverlay=function(n,t,i){t.IsSchedulingCompleting=!0;n.find(".telehealthLoadingOverlay.summarystep").show();i?$$WPUtil.ShowAjaxSpinner($afe.select(":not(.telehealthLoadingOverlay, .rfvLoadingHeart) > .ajaxspinner.defaultajaxoverlay")):$$WPUtil.ShowAjaxSpinner(n.find(".telehealthLoadingOverlay.summarystep .ajaxspinner"))};$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.HideOverlay=function(n,t,i){t.IsSchedulingCompleting=!1;n.find(".telehealthLoadingOverlay.summarystep").hide();i?$$WPUtil.HideAjaxSpinner($afe.select(":not(.telehealthLoadingOverlay, .rfvLoadingHeart) > .ajaxspinner.defaultajaxoverlay")):$$WPUtil.HideAjaxSpinner(n.find(".telehealthLoadingOverlay.summarystep .ajaxspinner"))};$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){var r,t,u,s,h,e,o,f,i,n;r=$$WP.Debug.UnitTest.assert;t=$$WP.Debug.UnitTest.assertValue;(u={})._idPrefix="";u.Id="testId";u._getComments=function(){return"comments"};u._getIDPrefix=function(){return this._idPrefix};u._getID=function(n){return this._idPrefix+n};(s={}).Title="title";(h={}).ReasonForVisit=s;(e=new $$WP.Scheduling.TelehealthData).SelectedWorkflow=$$WP.Scheduling.TelehealthData.TelehealthWorkflow.SlotSelection;e.QuickScheduleSlot={};e.QuickScheduleSlot.DateString="Monday";e.Provider="testProvider";e.TelehealthNotificationSettings={};e.TelehealthNotificationSettings.IsPushNotificationEnabled=!1;e.ShowCancelButton=!0;o=$$WP.Scheduling.TelehealthOrganization.createTelehealthOrganizationCollection();$$WP.Scheduling.TelehealthOrganization.convertRawTelehealthOrganizations([{OrganizationId:"1"}],o);o.Models[0].setProperty("State",$$WP.Scheduling.TelehealthOrganization.StatesEnum.Selected);o.Models[0].setProperty("IsLocal",!0);(f={}).AppointmentBuilder=h;f.TelehealthOrganizations=o;f.TelehealthData=e;(i={}).MaxCommentsLength=500;i.RequireODVVComments=!1;i.AllowODVVComments=!0;i.AllowSelfSignup=!0;i.HasProviderDetailsSecurity=!1;n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!1,!1,!1,null);t(n.ReasonForVisit,"title","Incorrect title for summary step view model");t(n.Workflow,$$WP.Scheduling.TelehealthData.TelehealthWorkflow.SlotSelection,"Incorrect workflow for summary step view model scheduling");r(null!=n.Slot&&null!=n.Slot,"Slot not found for summary step view model");t(n.Provider,"testProvider","Incorrect provider for summary step view model");t(n.DayString,"Monday","Day string not set for summary step view model");t(n.HasProviderDetailsSecurity,!1,"Provider details security not correct for summary step view model");r(n.AllowComments,"Comments incorrectly disallowed for summary step view model");t(n.RequireComments,!1,"Comments incorrectly required for summary step view model");t(n.ShowRequiredIndicator,!1,"Not showing indicates required value div");t(n.Comments,"comments","Comments set incorrectly for summary step view model");t(n.CommentsValidationSettings.required,!1,"Comment validation settings incorrectly required for summary step view model");t(n.CommentsValidationSettings.maxLength,500,"Comment validation settings have incorrect length for summary step view model");r(n.CommentsValidationSettings.showCharacterCounter,"Comment validation settings have incorrect character counter setting for summary step view model");r(n.HideNotifications,"Notifications incorrectly shown for summary step view model scheduling");t(n.IsAnonymous,!1,"IsAnonymous incorrectly set for summary step view model");r(n.ShowCancelButton,"Cancel button incorrectly hidden for summary step view model");r(n.ShowOrganization,"Organization incorrectly hidden for summary step view model");t(n.IdPrefix,"OnDemandSummaryStep_testId","Id prefix incorrect for summary step view model");t(n.CommentsTextId,"OnDemandSummaryStep_testIdcomments","Comments element ID incorrectly set for summary step view model");e.SelectedWorkflow=$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing;t((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!1,!1,!1,null)).Workflow,$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing,"Incorrect workflow for summary step view model queueing");t(n.HideNotifications,!1,"Notifications incorrectly shown for summary step view model queueing");t(n.SelectedOrg.OrganizationId,"1","Can't read organization properly for summary step view model");anonymousSettings={AdultWorkflowEnabled:!0,ProxyWorkflowEnabled:!0};r((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!0,!1,!1,anonymousSettings)).HideNotifications,"Notifications incorrectly shown for anonymous summary step view model");r(n.AllowSelfSignup,"AllowSelfSignup incorrectly set for anonymous summary step view model with adult and proxy enabled");t(n.ProxyOnly,!1,"ProxyOnly incorrectly set for anonymous summary step view model with adult and proxy enabled");r(n.IsAnonymous,"IsAnonymous incorrectly set for anonymous summary step view model");t(n.ShowOrganization,!1,"Organization incorrectly shown for anonymous summary step view model");t(n.AllowComments,!1,"Comments incorrectly allowed for anonymous summary step view model");i.AllowSelfSignup=!1;r((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!0,!1,!1,anonymousSettings)).AllowSelfSignup,"AllowSelfSignup incorrectly set for anonymous summary step view model with adult and proxy enabled, self signup disabled");r(n.ProxyOnly,"ProxyOnly incorrectly set for anonymous summary step view model with adult and proxy enabled, self signup disabled");anonymousSettings.AdultWorkflowEnabled=!0;anonymousSettings.ProxyWorkflowEnabled=!1;t((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!0,!1,!1,anonymousSettings)).AllowSelfSignup,!1,"AllowSelfSignup incorrectly set for anonymous summary step view model with adult only, self signup disabled");t(n.ProxyOnly,!1,"ProxyOnly incorrectly set for anonymous summary step view model with adult only, self signup disabled");i.AllowSelfSignup=!0;anonymousSettings.AdultWorkflowEnabled=!1;anonymousSettings.ProxyWorkflowEnabled=!0;r((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!0,!1,!1,anonymousSettings)).AllowSelfSignup,"AllowSelfSignup incorrectly set for anonymous summary step view model with proxy only");r(n.ProxyOnly,"ProxyOnly incorrectly set for anonymous summary step view model with proxy only");t((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!1,!0,!1)).IsAnonymous,!1);t(n.ShowOrganization,!1,"Organization incorrectly shown for not-yet-patient postlogin summary step view model");t(n.HideNotifications,!1,"Notifications incorrectly hidden for not-yet-patient postlogin summary step view model queueing");e.SelectedWorkflow=$$WP.Scheduling.TelehealthData.TelehealthWorkflow.SlotSelection;r((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!1,!0,!1)).HideNotifications,"Notifications incorrectly shown for not-yet-patient postlogin summary step view model scheduling");t((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!1,!0,!0)).IsAnonymous,!1);t(n.ShowOrganization,!1,"Organization incorrectly shown for not-yet-proxy postlogin summary step view model");t(n.HideNotifications,!1,"Notifications incorrectly hidden for not-yet-proxy postlogin summary step view model scheduling");e.SelectedWorkflow=$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing;t((n=$$WP.Scheduling.OnDemandTelehealth.SummaryStepCore.UpdateViewModel(u,f,i,!1,!0,!0)).HideNotifications,!1,"Notifications incorrectly hidden for not-yet-proxy postlogin summary step view model queueing")});!function(n){!function(n){!function(n){!function(n){var i=function(){},t;n.SplashPageViewModel=i;t=function(){function n(){}return n.GetTelehealthSplashPageViewModel=function(n,t){var s=t.outsideBusinessHours?!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageOffHoursPretext","ondemandtelehealth")):!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPagePretext","ondemandtelehealth")),h=t.outsideBusinessHours?!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageOffHoursPosttext","ondemandtelehealth")):!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPagePosttext","ondemandtelehealth")),c=t.outsideBusinessHours&&(!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageOffHoursMessage","ondemandtelehealth"))||!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageOffHoursDetails","ondemandtelehealth"))),u=!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageHardwareTitle","ondemandtelehealth"))||!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageHardwareDetails","ondemandtelehealth")),f=!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPagePaymentTitle","ondemandtelehealth"))||!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPagePaymentDetails","ondemandtelehealth")),e=t.adultWorkflowEnabled&&(!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageAccountTitle","ondemandtelehealth"))||!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageAccountDetails","ondemandtelehealth"))),o=!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageCustomRequirementTitle","ondemandtelehealth"))||!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageCustomRequirementDetails","ondemandtelehealth"))||!$$WP.Utilities.IsNullOrEmpty($$WP.Strings.get("SplashPageCustomRequirementImage","ondemandtelehealth")),r=0,i="";return u&&r++,f&&r++,e&&r++,o&&(r++,i=$$WP.Strings.get("SplashPageCustomRequirementImage","ondemandtelehealth"),$$WP.Utilities.IsNullOrEmpty(i)||"http://"!==i.substr(0,7)&&"https://"!==i.substr(0,8)&&(i=makeStaticImageLink(i))),{MinimumAge:n.MinimumAge,LogoUrl:n.LogoUrl,HasPretext:s,HasPosttext:h,HasOutsideBusinessHoursWarning:c,ColType:r>0?12/r:0,HasHardwareRequirement:u,HasPaymentRequirement:f,HasAccountRequirement:e,HasCustomRequirement:o,CustomRequirementImage:i,CustomRequirementHeader:$$WP.Strings.get("SplashPageCustomRequirementTitle","ondemandtelehealth"),CustomRequirementText:$$WP.Strings.get("SplashPageCustomRequirementDetails","ondemandtelehealth"),OutsideBusinessHours:t.outsideBusinessHours,AdultWorkflowEnabled:t.adultWorkflowEnabled,ProxyWorkflowEnabled:t.proxyWorkflowEnabled,Expanded:t.expandByDefault||t.outsideBusinessHours,DisableScheduleAsGuest:t.disableScheduleAsGuest}},n}();n.AnonymousTelehealthHelpers=t}(n.OnDemandTelehealth||(n.OnDemandTelehealth={}))}(n.Scheduling||(n.Scheduling={}))}(n.PatientEngagement||(n.PatientEngagement={}))}(Epic||(Epic={}));$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){var t=$$WP.Debug.UnitTest.assertValue,u=new Epic.PatientEngagement.Scheduling.AnonymousSchedulingSettings,r=new Epic.PatientEngagement.Scheduling.AnonymousSchedulingControllerParameters,f=Epic.PatientEngagement.Scheduling.OnDemandTelehealth.AnonymousTelehealthHelpers,i=$$WP.Strings.getNamespace("ondemandtelehealth"),n;u.MinimumAge=12;r.adultWorkflowEnabled=!0;r.proxyWorkflowEnabled=!0;r.outsideBusinessHours=!1;r.expandByDefault=!1;n=f.GetTelehealthSplashPageViewModel(u,r);t(n.AdultWorkflowEnabled,!0,"Adult workflow incorrectly disabled when adult and proxy are on");t(n.ProxyWorkflowEnabled,!0,"Proxy workflow incorrectly disabled when adult and proxy are on");t(n.OutsideBusinessHours,!1,"Outside business hourse incorrectly set when adult and proxy are on");t(n.Expanded,!1,"Expanded incorrectly set when adult and proxy are on");t(n.HasAccountRequirement,!0,"Account requirement not set when adult and proxy are on");r.adultWorkflowEnabled=!0;r.proxyWorkflowEnabled=!1;r.outsideBusinessHours=!1;r.expandByDefault=!1;t((n=f.GetTelehealthSplashPageViewModel(u,r)).AdultWorkflowEnabled,!0,"Adult workflow incorrectly disabled when adult only");t(n.ProxyWorkflowEnabled,!1,"Proxy workflow incorrectly enabled when adult only");t(n.OutsideBusinessHours,!1,"Outside business hourse incorrectly set when adult only");t(n.Expanded,!1,"Expanded incorrectly set when adult only");t(n.HasAccountRequirement,!0,"Account requirement not set when adult only");r.adultWorkflowEnabled=!1;r.proxyWorkflowEnabled=!0;r.outsideBusinessHours=!1;r.expandByDefault=!1;t((n=f.GetTelehealthSplashPageViewModel(u,r)).AdultWorkflowEnabled,!1,"Adult workflow incorrectly disabled when proxy only");t(n.ProxyWorkflowEnabled,!0,"Proxy workflow incorrectly enabled when proxy only");t(n.OutsideBusinessHours,!1,"Outside business hourse incorrectly set when proxy only");t(n.Expanded,!1,"Expanded incorrectly set when proxy only");t(n.HasAccountRequirement,!1,"Account requirement set when proxy only");r.adultWorkflowEnabled=!0;r.proxyWorkflowEnabled=!0;r.outsideBusinessHours=!0;r.expandByDefault=!1;t((n=f.GetTelehealthSplashPageViewModel(u,r)).AdultWorkflowEnabled,!0,"Adult workflow incorrectly disabled when outside business hours");t(n.ProxyWorkflowEnabled,!0,"Proxy workflow incorrectly disabled when outside business hours");t(n.OutsideBusinessHours,!0,"Outside business hourse incorrectly set when outside business hours");t(n.Expanded,!0,"Expanded incorrectly set when outside business hours");r.adultWorkflowEnabled=!0;r.proxyWorkflowEnabled=!0;r.outsideBusinessHours=!1;r.expandByDefault=!0;t((n=f.GetTelehealthSplashPageViewModel(u,r)).AdultWorkflowEnabled,!0,"Adult workflow incorrectly disabled when expanded by default");t(n.ProxyWorkflowEnabled,!0,"Proxy workflow incorrectly disabled when expanded by default");t(n.OutsideBusinessHours,!1,"Outside business hours workflow incorrectly set when expanded by default");t(n.Expanded,!0,"Expanded incorrectly set when expanded by default");r.adultWorkflowEnabled=!0;r.proxyWorkflowEnabled=!0;r.outsideBusinessHours=!1;r.expandByDefault=!1;var e=$$WP.Strings.get("SplashPageHardwareTitle","ondemandtelehealth"),o=$$WP.Strings.get("SplashPageHardwareDetails","ondemandtelehealth"),s=$$WP.Strings.get("SplashPagePaymentTitle","ondemandtelehealth"),h=$$WP.Strings.get("SplashPagePaymentDetails","ondemandtelehealth"),c=$$WP.Strings.get("SplashPageAccountTitle","ondemandtelehealth"),l=$$WP.Strings.get("SplashPageAccountDetails","ondemandtelehealth"),a=$$WP.Strings.get("SplashPageCustomRequirementTitle","ondemandtelehealth"),v=$$WP.Strings.get("SplashPageCustomRequirementDetails","ondemandtelehealth"),y=$$WP.Strings.get("SplashPageCustomRequirementImage","ondemandtelehealth");i.SplashPageHardwareTitle.value="a";i.SplashPageHardwareDetails.value="a";i.SplashPagePaymentTitle.value="a";i.SplashPagePaymentDetails.value="a";i.SplashPageAccountTitle.value="a";i.SplashPageAccountDetails.value="a";i.SplashPageCustomRequirementTitle.value="";i.SplashPageCustomRequirementDetails.value="";i.SplashPageCustomRequirementImage.value="";i.SplashPageHardwareTitle.value="";i.SplashPageHardwareDetails.value="";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,6,"Incorrect col type when hardware requirement card disabled");t(n.HasHardwareRequirement,!1,"Hardware requirement not hidden when hardware requirement card disabled");i.SplashPageHardwareTitle.value="a";i.SplashPageHardwareDetails.value="";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when hardware requirement card enabled");t(n.HasHardwareRequirement,!0,"Hardware requirement hidden when hardware requirement card enabled");i.SplashPageHardwareTitle.value="";i.SplashPageHardwareDetails.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when hardware requirement card enabled");t(n.HasHardwareRequirement,!0,"Hardware requirement hidden when hardware requirement card enabled");i.SplashPageHardwareTitle.value="a";i.SplashPageHardwareDetails.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when hardware requirement card enabled");t(n.HasHardwareRequirement,!0,"Hardware requirement hidden when hardware requirement card enabled");i.SplashPagePaymentTitle.value="";i.SplashPagePaymentDetails.value="";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,6,"Incorrect col type when payment requirement card disabled");t(n.HasPaymentRequirement,!1,"Payment requirement not hidden when payment requirement card disabled");i.SplashPagePaymentTitle.value="a";i.SplashPagePaymentDetails.value="";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when payment requirement card enabled");t(n.HasPaymentRequirement,!0,"Payment requirement hidden when payment requirement card enabled");i.SplashPagePaymentTitle.value="";i.SplashPagePaymentDetails.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when payment requirement card enabled");t(n.HasPaymentRequirement,!0,"Payment requirement hidden when payment requirement card enabled");i.SplashPagePaymentTitle.value="a";i.SplashPagePaymentDetails.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when payment requirement card enabled");t(n.HasPaymentRequirement,!0,"Payment requirement hidden when payment requirement card enabled");i.SplashPageAccountTitle.value="";i.SplashPageAccountDetails.value="";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,6,"Incorrect col type when account requirement card disabled");t(n.HasAccountRequirement,!1,"Account requirement not hidden when account requirement card disabled");i.SplashPageAccountTitle.value="a";i.SplashPageAccountDetails.value="";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when account requirement card enabled");t(n.HasAccountRequirement,!0,"Account requirement hidden when account requirement card enabled");i.SplashPageAccountTitle.value="";i.SplashPageAccountDetails.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when account requirement card enabled");t(n.HasAccountRequirement,!0,"Account requirement hidden when account requirement card enabled");i.SplashPageAccountTitle.value="a";i.SplashPageAccountDetails.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when account requirement card enabled");t(n.HasAccountRequirement,!0,"Account requirement hidden when account requirement card enabled");i.SplashPageCustomRequirementTitle.value="";i.SplashPageCustomRequirementDetails.value="";i.SplashPageCustomRequirementImage.value="";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,4,"Incorrect col type when custom requirement card disabled");t(n.HasCustomRequirement,!1,"Custom requirement not hidden when custom requirement card disabled");i.SplashPageCustomRequirementTitle.value="a";i.SplashPageCustomRequirementDetails.value="";i.SplashPageCustomRequirementImage.value="";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,3,"Incorrect col type when custom requirement card enabled");t(n.HasCustomRequirement,!0,"Custom requirement hidden when custom requirement card enabled");i.SplashPageCustomRequirementTitle.value="";i.SplashPageCustomRequirementDetails.value="";i.SplashPageCustomRequirementImage.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,3,"Incorrect col type when custom requirement card enabled");t(n.HasCustomRequirement,!0,"Custom requirement hidden when custom requirement card enabled");i.SplashPageCustomRequirementTitle.value="";i.SplashPageCustomRequirementDetails.value="";i.SplashPageCustomRequirementImage.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,3,"Incorrect col type when custom requirement card enabled");t(n.HasCustomRequirement,!0,"Custom requirement hidden when custom requirement card enabled");i.SplashPageCustomRequirementTitle.value="a";i.SplashPageCustomRequirementDetails.value="a";i.SplashPageCustomRequirementImage.value="a";t((n=f.GetTelehealthSplashPageViewModel(u,r)).ColType,3,"Incorrect col type when custom requirement card enabled");t(n.HasCustomRequirement,!0,"Custom requirement hidden when custom requirement card enabled");i.SplashPageHardwareTitle.value=e;i.SplashPageHardwareDetails.value=o;i.SplashPagePaymentTitle.value=s;i.SplashPagePaymentDetails.value=h;i.SplashPageAccountTitle.value=c;i.SplashPageAccountDetails.value=l;i.SplashPageCustomRequirementTitle.value=a;i.SplashPageCustomRequirementDetails.value=v;i.SplashPageCustomRequirementImage.value=y});!function(){var t=$$WP.Scheduling.Provider,e=$$WP.Scheduling.SchedulingSelectableViewBinder,i=$$WP.Scheduling.Workflow,f=$$WP.Scheduling.OriginalAppointmentInfoController,r=function(i,r,f,o,s,h,c,l,a){this.WP$Scheduling$SingleAppointmentStepController(i,r,f,o,s,$$WP.Templates.Scheduling.ProviderStep,$$WP.Templates.Scheduling.ProviderStepCollapsed,!1,a);this.proxify("_onProviderAdded","_onProviderRemoved","_onAncillaryDataChanged","_onViewModelChanged","updateStep","__onChangeProviderClicked","__isProviderNotAnyOption","__isProviderNotAnyOrOtherOption","__onProviderSelectionToggled");this._providersToUse=c||u.Standard;this._mode=h||n.NoFiltering;this._workflow=l;this._onStopSchedulingCallback=a;this._allowedProviderIds=f;l.IsFavorite&&(this.__isFromFavorite=!0,this.__isFirstTimeThroughFromPreselections=!0);this._preselectedProviders=[];this._mode===n.NoFiltering&&this.Data.Providers.addCollectionEventListener("add",this._onAncillaryDataChanged);this.setViewBinder(new e(this.__viewStatePropertyName,t.StatesEnum.Selected,t.StatesEnum.Unselected));this.Data.Providers.addMonitoredProperty(this.__viewStatePropertyName);this.linkAppointment(this.Data.AppointmentBuilder.getFirstAppointment());this.$root.on("click","[data-id='editstep']",this.__onChangeProviderClicked);this.$root.on("change","input[type='radio']",this.__onProviderSelectionToggled);this._autoFocus=$$WP.Utilities.UI.IsMobile||this._mode===n.Request||this._mode===n.FilterOnSelectedReasonForVisitAndLocation;this.__originalAppointmentInfo=s.OriginalAppointmentInfo},o={_mode:null,_providersToUse:null,_onStopSchedulingCallback:null,_preselectedProviders:null,__isFromFavorite:!1,__isStepCollapsed:!1,__isStepCollapsing:!1,__$spacer:null,__isFirstTimeThroughFromPreselections:!1,__preselectedProviderNotAvailable:!1,__originalAppointmentInfo:null,__attachAppointmentListeners:function(t,i){switch(i.addCollectionPropertyListener(this.Data.Providers,this.__viewStatePropertyName,this._onViewModelChanged),this._mode){case n.Request:case n.FilterOnSelectedReasonForVisitAndLocation:i.addModelPropertyListener(this.Data.AppointmentBuilder,"ReasonForVisit",this._onAncillaryDataChanged)}i.addCollectionEventListener(t.Lqfs,"add",this._onAncillaryDataChanged);i.addCollectionEventListener(t.Lqfs,"remove",this._onAncillaryDataChanged);i.addCollectionEventListener(t.Providers,"add",this._onProviderAdded);i.addCollectionEventListener(t.Providers,"remove",this._onProviderRemoved);this._mode!==n.FilterOnSelectedReasonForVisitAndLocation&&this._mode!==n.FilterOnSelectedLocation||(i.addCollectionEventListener(t.Locations,"add",this._onAncillaryDataChanged),i.addCollectionEventListener(t.Locations,"remove",this._onAncillaryDataChanged));i.addModelPropertyListener(this.Data.AppointmentBuilder,"DidIncludeAdditionalProvidersInSearch",this._onAncillaryDataChanged)},updateViewModel:function(){var n,t,r;this.ViewModel={};this.WP$Scheduling$SingleAppointmentStepController$updateViewModel();this.__syncUIElements();n=this.__getViewModelAvailableProviders();t=this.__shouldIncludeAnyOption(n)&&this._workflow.Type===i.WorkflowTypesEnum.Procedure;this.__preselectedProviderNotAvailable=this.hasPreselectedIds()&&0===this._preselectedProviders.length;r=$$WPSchedulingUtil.GetVisitDisplayName(this._appointment,this._workflow.TicketInfo);this.ViewModel.Providers=n;this.ViewModel.SelectedProviders=this._appointment.Providers.toArray();this.ViewModel.ShowOptionsToggle=t;this.ViewModel.IsAnyProviderSelected=this._appointment.IsProviderAnyOptionSelected;this.ViewModel.Count=n.length;this.ViewModel.StepShouldBeActive=!0;this.ViewModel.ShowSmallCard=n.length>11;this.ViewModel.PreselectedProviderNotAvailable=this.__preselectedProviderNotAvailable;this.ViewModel.IsFromFavorite=this.__isFromFavorite;this.ViewModel.VisitType=this._appointment.VisitType;this.ViewModel.OtherProvider=this.__getOtherProvider();this.ViewModel.MultiSelectable=this.__isStepMultiselect();this.ViewModel.AppointmentDisplayName=r;this.ViewModel.ShowOriginalAppts=!!this.__originalAppointmentInfo;this.ViewModel.IsProviderSelectEnabled=this._allowProviderSelect();this.ViewModel.ModelId=this._appointment.ModelId},__getViewModelAvailableProviders:function(){var n=[],t=null;return n=this._getAvailableProviders(),this.__shouldIncludeAnyOption(n)&&(t=this.Data.Providers.getFromIndex("ID","-2"),n.push(t)),this._setViewModelSelectedStates(n),n=n.sort($$WP.Scheduling.Provider.sortProvidersByListDisplayName)},__getAvailableProvidersCountWithoutOtherOption:function(){var n=this.__getViewModelAvailableProviders().length;return this.__getOtherProvider()&&(n-=1),n},__getOtherProvider:function(){for(var t,n=0,i=(t=this._getAvailableProviders()).length,n=0;n<i;n++)if(t[n].OtherOption)return t[n];return null},arePrerequisitesComplete:function(){var t=this.Data.AppointmentBuilder.ReasonForVisit,i=this._appointment.Locations.toArray();return this._mode===n.NoFiltering||this._mode!==n.FilterOnSelectedReasonForVisitAndLocation&&null!==t||this._mode===n.FilterOnSelectedReasonForVisitAndLocation&&i.length>0&&null!==t||this._mode===n.FilterOnSelectedLocation&&i.length>0},_setViewModelSelectedStates:function(n){var i,f,u,r;for(f=this._appointment.Providers,u=this._appointment.IsProviderAnyOptionSelected,i=0;i<n.length;i++)r=n[i],r[this.__viewStatePropertyName]=u&&!r.OtherOption||!u&&f.contains(r)?t.StatesEnum.Selected:t.StatesEnum.Unselected},beforeFirstRender:function(){var n,t;this.__shouldAttemptToPreselectProvidersBeforeFirstRender()&&(t=this.ViewModel.Providers,0===(n=this.getModelsToPreSelect(t,"ID")).length&&this.stepSettings.PreselectAllModels&&(t.length>1&&(this._appointment.IsProviderAnyOptionSelected=!0),n=t.filter(this.__isProviderNotAnyOrOtherOption)),n.length>0?(this.stepSettings.Hide=this.__getStepSettingsHideValue(this.stepSettings),this.__isFirstTimeThroughFromPreselections=!0,this._preselectedProviders=n,this._appointment.Providers.addRange(n),this.updateStep()):this.__shouldIncludeAnyOption(t)&&(this.__setAnyProviderSelected(this._appointment),this.updateStep()))},__isProviderNotAnyOption:function(n){return!n.AnyOption},__isProviderNotOtherOption:function(n){return!n.OtherOption},__isProviderNotAnyOrOtherOption:function(n){return this.__isProviderNotAnyOption(n)&&this.__isProviderNotOtherOption(n)},__getStepSettingsHideValue:function(n){return n.Hide||!this._allowProviderSelect()||this.__doesSelectedVisitTypeHideStep()},__doesSelectedVisitTypeHideStep:function(){return this._workflow.Type===i.WorkflowTypesEnum.Procedure&&this._appointment.VisitType&&!this._appointment.VisitType.AllowProviderStepInDirectSched},__shouldAttemptToPreselectProvidersBeforeFirstRender:function(){var n=this.ViewModel.Providers;return!(1===n.length&&this.hasPreselectedIds()&&!this.isModelPreselected(n[0].ID))&&!(this._appointment.Providers.size()>0)},beforeRender:function(){this.stepSettings.Hide=this.__getStepSettingsHideValue(this.stepSettings);this.renderCollapsed=this.__isStepCollapsed;this._appointment.Providers.Models.length<1&&this.__autoSelectProvidersIfHidden();this._workflow&&this._workflow.Type===i.WorkflowTypesEnum.Reschedule&&0!==this.$root.find("#OriginalAppointmentInfo").length&&f.StashPortal()},__shouldPreselectAllowedProvider:function(){var n;return n=this._getAvailableProviders().map(function(n){return n.ID}),$$WPSchedulingProvidersCore.IsSingleAllowedProviderStillElligibleForScheduling(n,this._allowedProviderIds)&&this._workflow.isTypeOpenSchedulingWidget()&&this._allowProviderSelect()&&!this.Data.AppointmentBuilder.DidIncludeAdditionalProvidersInSearch},__autoSelectProvidersIfHidden:function(){var i="",n=this._getAvailableProviders(),t=this.getModelsToPreSelect(n,"ID");this.isHidden()&&(this.__shouldPreselectAllowedProvider()&&(i=this.Data.Providers.getFromIndex("ID",this._allowedProviderIds[0]),t.push(i)),!this.hasPreselectedIds()||this.hasPreselectedIds()&&!this._appointment.hasAProviderSelected()?t.length>0?(this.__selectProviders(t),this._preselectedProviders=t):(this._appointment.IsProviderAnyOptionSelected=!0,this.__selectProviders(n)):this.Data.AppointmentBuilder.DidIncludeAdditionalProvidersInSearch&&(this._appointment.IsProviderAnyOptionSelected=!0,this.__selectProviders(n)),!this._appointment.hasAProviderSelected()&&n.length>0&&this.showError())},__selectProviders:function(n){var i=[],t=0;if(n&&1===n.length&&n[0].OtherOption)i.push(n[0]);else for(t=0;t<n.length;t++)n[t].OtherOption||n[t].AnyOption||this._appointment.Providers.contains(n[t])||-1!==i.indexOf(n[t])||i.push(n[t]);this._appointment.Providers.addRange(i)},afterRender:function(){$$WPSchedulingUtil.HandleStickyBanner();$$WPSchedulingUtil.FocusElement(this.$root.find("h2.header"));this.__isStepCollapsing&&($$WPSchedulingUtil.ScrollToTopOfPage(),this.__collapseSpacer());this._workflow&&this._workflow.Type===i.WorkflowTypesEnum.Reschedule&&this.ViewModel.IsFirstOnPage&&f.Update(this.Data,$afe.select("#ProviderStepOriginalAppointmentInfo"))},__isStepMultiselect:function(){return this.__getAvailableProvidersCountWithoutOtherOption()>1&&!(this.__isStacked()&&this.__isIncomplete())},__makeStyleAutoAdvance:function(){var n=this.$root.find(".providerlist"),t=n.find(".card");n.removeClass("multiselect");n.addClass("autoadvance");t.removeAttr("role")},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.ProviderStep},__initializeSpacer:function(){this.__$spacer=$afe.jq(document.createElement("div"));var n=this.$root.find(".providerlist").height();this.__$spacer.height(n);this.__isStepCollapsing=!0},__collapseSpacer:function(){this.$root.append(this.__$spacer);this.__$spacer.slideUp(500,function(){$$WPSchedulingUtil.HandleStickyBanner();this.__isStepCollapsed=!0;this.__isStepCollapsing=!1})},__onChangeProviderClicked:function(){this.__isStepCollapsed=!1;this.updateStep()},__onProviderSelectionToggled:function(){"1"===event.target.value?(this.$root.find(".specificProviderSelection").fadeOut("fast"),setTimeout(function(){this.__setAnyProviderSelected(this._appointment)}.bind(this),200)):(this.__setAnyProviderUnselected(this._appointment,!0),this.$root.find(".specificProviderSelection").fadeIn(500))},_onViewModelChanged:function(n){var r,i;for(i in this._appointment.Providers.openChangeBatch(),this._appointment.IsProviderAnyOptionSelected&&this._appointment.Providers.size()!==this._getAvailableProviders().length&&this.__setAnyProviderSelected(this._appointment),n)if((r=n[i].model).AnyOption)n[i].to===t.StatesEnum.Selected?this.__setAnyProviderSelected(this._appointment):this.__setAnyProviderUnselected(this._appointment,!0);else switch(this._appointment.IsProviderAnyOptionSelected&&this.__setAnyProviderUnselected(this._appointment,!1),n[i].to){case t.StatesEnum.Selected:this._appointment.Providers.add(r);break;case t.StatesEnum.Unselected:this._appointment.Providers.remove(r)}this._appointment.Providers.closeChangeBatch();this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider&&this.__setOriginallySelectedProviders()},__setOriginallySelectedProviders:function(){for(var r,t=this.Data.AppointmentBuilder.getFirstAppointment().Providers.toArray().slice(),i=[],u=$$WP.Scheduling.SingleAppointmentStepController.prototype.filterByAllowedIds.call(this,this.Data.Providers.toArray(),"ID",!1),n=0;n<t.length;n++)(r=t[n]).IsStandardProvider&&-1!==u.indexOf(r)&&i.push(t[n]);i.length>0&&(this.Data.AppointmentBuilder.OriginallySelectedProviders=i)},__setAnyProviderSelected:function(n){var r=0,u=[],i=null;for(n.IsProviderAnyOptionSelected=!0,r=0;r<this.ViewModel.Providers.length;r++)(i=this.ViewModel.Providers[r]).AnyOption?i[this.__viewStatePropertyName]=t.StatesEnum.Selected:(i[this.__viewStatePropertyName]=t.StatesEnum.Selected,i.OtherOption?i[this.__viewStatePropertyName]=t.StatesEnum.Unselected:u.push(i));n.Providers.empty();n.Providers.addRange(u)},__setAnyProviderUnselected:function(n,i){var r=0,u=null,f=[];for(n.IsProviderAnyOptionSelected=!1,r=0;r<this.ViewModel.Providers.length;r++)((u=this.ViewModel.Providers[r]).AnyOption||i)&&(u[this.__viewStatePropertyName]=t.StatesEnum.Unselected,f.push(u));n.Providers.removeRange(f)},_onAncillaryDataChanged:function(){var n,r,t,i,u;if(this.__isAppointmentIncludedInBuilder()){for(i=[],r=this._getAvailableProviders(),t=this._appointment.Providers.toArray(),n=0;n<t.length;n++)u=t[n],-1===r.indexOf(u)&&i.push(u);this._appointment.Providers.removeRange(i);(i.length>0||this.__getAvailableProvidersCountWithoutOtherOption()!==t.length||!this.__shouldIncludeAnyOption(r))&&(this._appointment.IsProviderAnyOptionSelected=!1);this.__autoSelectProvidersIfHidden();this.Data.SchedulingSteps.getFromIndex("ID",this.Id).IsHidden=this.isHidden()||!this._allowProviderSelect();this.updateStep()}},__isAppointmentIncludedInBuilder:function(){return this.Data.AppointmentBuilder.Appointments.contains(this._appointment)},_onProviderAdded:function(){var n,t,i,r;n=(t=this._appointment.Providers.toArray())[t.length-1];i=this._canMultiselectProviders();n&&(this._appointment.Providers.openChangeBatch(),n.OtherOption?i=!1:this.__deselectOtherProvider(),!i&&t.length>1&&(this._appointment.Providers.empty(),this._appointment.Providers.add(n)),this._appointment.Providers.closeChangeBatch());r=this.__isStepCollapsed;this._updateStepStatus();r||this.__isStepCollapsed?this.updateStep():this.__syncUIElements()},__deselectOtherProvider:function(){var n=this.Data.Providers.getFromIndex("ID",-1);this._appointment.Providers.remove(n)},_onProviderRemoved:function(){this._updateStepStatus();this.__syncUIElements()},__syncUIElements:function(){this.ViewBinder.syncModelsToDOM();this.setCurrentSelectionCountInBanner();$$WPSchedulingUtil.HandleStickyBanner()},_updateStepStatus:function(){if(this._appointment.Providers.size()>0||this.Data.AppointmentBuilder.AreProvidersFilteredBySlotStep){var n=this.__isIncomplete(),t=this.isStepMarkedAsHidden()?$$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired:$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete;this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete);this.setComplete(t);this.__isStacked()&&n&&(this.__isStepCollapsed=!0,this.__initializeSpacer())}else this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.__isStepCollapsed=!1,this.__isStacked()&&this.__makeStyleAutoAdvance()},__isIncomplete:function(){return this.getComplete()===$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete},_allowProviderSelect:function(){return this._mode===n.NoFiltering||i.allowProviderSelectForAppointment(this.Data.AppointmentBuilder,this._appointment)},_canMultiselectProviders:function(){return this._mode!==n.Request},_getAvailableProviders:function(){var f=[],t=!1,i=!1,r=!1,u=!1;if(this.arePrerequisitesComplete())if(this._mode===n.NoFiltering)f=this._buildProvidersNoFiltering();else{switch(this._mode){case n.Request:t=!0;i=!1;r=!0;u=!0;break;case n.FilterOnSelectedLocation:t=!1;i=!0;r=!1;u=!1;break;case n.FilterOnSelectedReasonForVisitAndLocation:t=!0;i=!0;r=!1;u=!0}f=this.__buildProvidersFiltered(t,i,r,u)}return this.filterByAllowedIds(f,"ID")},filterByAllowedIds:function(n,t,i){var u,f=[],r=[];return n?(u=n.filter(function(n){return n.LqfProviderAction===$$WP.Scheduling.Provider.LqfActionEnum.Added}),this._workflow.isTypeOpenSchedulingWidget()&&$$WPSchedulingProvidersCore.IsProviderSpecifiedInQueryString(this._workflow)&&(f=n),r=(r=(r=$$WP.Scheduling.SingleAppointmentStepController.prototype.filterByAllowedIds.call(this,n,t,i)).concat(u)).concat(f),r=$$WPSchedulingUtil.RemoveDuplicateElementsFromArray(r)):[]},__shouldIncludeAnyOption:function(n){var e,r,t,f,u=this._workflow.Type;if(!!$$WPUtil.IsNullOrEmpty(this.Data.Providers.getFromIndex("ID","-2")))return!1;for(r=this._appointment.VisitType,f=[],t=0;t<n.length;t++)n[t].OtherOption||n[t].AnyOption||f.push(n[t]);return e=f.length>1,u!==i.WorkflowTypesEnum.Request&&(u===i.WorkflowTypesEnum.Ticket||u===i.WorkflowTypesEnum.Reschedule||u===i.WorkflowTypesEnum.NewProvider||!$$WPUtil.IsNullOrEmpty(r)&&r.IsAdvanced||!$$WPUtil.IsNullOrEmpty(r))&&e},_buildProvidersNoFiltering:function(){var n,t,r=[],i=null,f=null,e=null;if(this._providersToUse===u.All)for(n=0;n<this.Data.Providers.toArray().length;n++)(i=this.Data.Providers.toArray()[n]).AnyOption||r.push(i);else for(f=this.Data.ReasonsForVisit.Models,n=0;n<f.length;n++)for(e=f[n],t=0;t<e.AllProviderDepartmentPairs.length;t++)i=e.AllProviderDepartmentPairs[t].Provider,this.__tryIncludeProvider(i,r);return r},__tryIncludeProvider:function(n,t){var i=n.LqfProviderAction===$$WP.Scheduling.Provider.LqfActionEnum.Added;-1===t.indexOf(n)&&(n.IsStandardProvider||i)&&t.push(n)},__buildProvidersFiltered:function(n,t,i,r){var u=this._appointment.ReasonForVisit,f=this._appointment.getSelectedDepartmentsCollection().toArray();return $$WPSchedulingUtil.BuildProvidersFiltered(n,t,i,u,f,r)},shouldRemainOnStep:function(){return!!this.ViewModel&&!this.Data.AppointmentBuilder.IsUsingProviderDropdown&&(!this.__isFirstTimeThroughFromPreselections||this.__isFromFavorite&&0===this._preselectedProviders.length?!(this.ViewModel.SelectedProviders&&this.ViewModel.SelectedProviders.length>0&&this.ViewModel.SelectedProviders[0].OtherOption)&&1!==this.__getAvailableProvidersCountWithoutOtherOption()&&!this.isHidden():(this.__isFirstTimeThroughFromPreselections=!1,!1))},setCurrentSelectionCountInBanner:function(){var n,t=this.getSchedulingContinueBanner().find(".selected-count");this.Active&&this.ViewModel&&this.$root.is(":visible")&&!this.stepSettings.Hide&&(n=this.__getCurrentSelectionCountString(),t.text(n))},__getCurrentSelectionCountString:function(){var i=this.Data.AppointmentBuilder.getAppointment(0),t=this._appointment.Providers.toArray().length,r=this.__getAvailableProvidersCountWithoutOtherOption(),n="";return 0===t||r<2||this.__isStacked()||i.IsProviderAnyOptionSelected?n="":1===t?n=this.SchedulingStringsNamespace.getString("ProvidersSelectedCount_Singular"):(this.SchedulingStringsNamespace.addMnemonic("@MYCHART@PROVIDERSCOUNT@",t,$$WP.Strings.EncodingTypes.HTML),n=this.SchedulingStringsNamespace.getString("ProvidersSelectedCount_Plural"),this.SchedulingStringsNamespace.clearMnemonics()),n},hasStickyBanner:function(){return!0},isStepMarkedAsHidden:function(){var n,t=this.Data.SchedulingSteps.getFromIndex("ID",this.Id);return""!==t.StackId&&(n=this.Data.SchedulingSteps.getFromIndex("ID",t.StackId)),!(this._allowProviderSelect()&&n&&n.ForceShowOnce)&&this.WP$Scheduling$StepController$isStepMarkedAsHidden()}},n={NoFiltering:0,Request:2,FilterOnSelectedReasonForVisitAndLocation:3,FilterOnSelectedLocation:4},u={Standard:0,All:1};r.prototype=o;r.ModesEnum=n;r.ProvidersToUseEnum=u;$$WP.Scheduling.ProviderStepController=r;r.extend($$WP.Scheduling.SingleAppointmentStepController,"WP$Scheduling$ProviderStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var i=$$WP.Scheduling.Location,h=$$WP.Scheduling.SchedulingSelectableViewBinder,f=$$WP.Scheduling.ReasonForVisitDepartmentOverride,e=$$WP.Geo.Coordinates.Helpers,s=$$WP.Scheduling.OriginalAppointmentInfoController,u=function(n,r,u,f,e,o,s,c,l,a,v,y){this.WP$Scheduling$SingleAppointmentStepController(n,u,f,e,o,$$WP.Templates.Scheduling.LocationStep,$$WP.Templates.Scheduling.LocationStepCollapsed,!1,l);this.proxify("_onViewModelChanged","updateStep","_onSelectProviderClicked","_onProviderSelected","_onAncillaryDataChanged","_onRFVchanged","_onLocationAdded","_onLocationRemoved","_onGeolocationChanged","__anyDepartmentHasInPersonVTOverride","__onGetBrowserCoordinatesSuccess","__onGetBrowserCoordinatesFailure","__onZipEntered","__onZipInputFocused","__setFocusInZipInput","__onShowNearBrowserClicked","__onShowNearHomeClicked","__onShowAllLocationsClicked","__onGetZipSuccess","__onGetZipFailure","__filterByGeolocation","__onChangeLocationClicked","__anyAppointmentHasLocationStepTelehealthOverride","__onUserEnteredZipCoordinatesChanged","__setAvailableProvidersDisplayString","__filterNearHomeIfGeolocationEnabled");this._mode=s||t.FilterOnSelectedReasonForVisitAndProviders;this.__locationGroupingBehavior=c;this._fromFavorite=a;this.__isFirstTimeThroughFromPreselections=a;this._preselectedLocations=[];this._workflow=r;this.setViewBinder(new h(this.__viewStatePropertyName,i.StatesEnum.Selected,i.StatesEnum.Unselected));this.Data.Locations.addMonitoredProperty(this.__viewStatePropertyName);this._registerHandlebarsHelpers();this.__geolocationSettings=v;$$WPSchedulingUtil.CheckIfGeolocationPermissionsAreDenied(this.__onGetBrowserCoordinatesFailure);this.linkAppointment(this.Data.AppointmentBuilder.getFirstAppointment());this.__carouselController=new $$WP.UI.ChipCarouselController($$WP.Templates.Scheduling.GeolocationFilters);$$WPUtil.FixScrollingForIOS(this.$root);this.$root.on("click","[data-id='editstep']",this.__onChangeLocationClicked);this.__originalAppointmentInfo=y},c={_mode:null,_preselectedLocations:null,_fromFavorite:!1,__locationGroupingBehavior:null,__coordinatesOfUserEnteredZip:null,__coordinatesOfBrowser:null,__isGeolocationEnabled:!1,__geolocationSettings:null,__geolocationErrorMessage:null,__hasBrowserDeniedGeoSecurity:!1,__carouselController:null,__previousGeolocationMethod:null,__isFirstTimeThroughFromPreselections:!1,__isStepCollapsed:!1,__isStepCollapsing:!1,__$spacer:null,__hasCollapsedBefore:!1,__telehealthTypeString:"None",__$preRedrawFocusedElement:null,__originalAppointmentInfo:null,updateViewModel:function(){var n,r,t,i,u;this.__isGeolocationEnabled=this.__shouldEnableGeolocationAndResetMethodIfNot();r=this._isCheckboxAndNotArrow();n=this._getAvailableLocations();this.Data.AppointmentBuilder.AvailableLocations=this._getAvailableLocationsByAppointment();this.Data.AppointmentBuilder.recalculateDepartmentGrouperAddresses(this.Data.AppointmentBuilder.ReasonForVisit);this._shouldIncludeAnyOption(n)&&(t=this.Data.Locations.getFromIndex("Id","-1"),this.__includeLocationInFilter(t),n.push(t));this.__isFilteringByGeolocation()||this.__includeEachLocationInFilter(n);this.__sortLocations(n);this._setViewModelSelectedStates(n);this.ViewModel={};this.WP$Scheduling$SingleAppointmentStepController$updateViewModel(!0);i=$$WPSchedulingUtil.GetVisitDisplayName(this._appointment,this._workflow.TicketInfo);this.__registerClearLabelDisplayNameFunction(i);u={Locations:n,Count:n.length,SelectedLocations:this._appointment.Locations.toArray(),StepShouldBeActive:!0,MultiSelectable:r,ShowSmallCards:n.length>11,AvailableProviders:this._getAvailableProvidersForLocationStep(),ProviderDropdownValidationSettings:$$WP.FormValidation.ValidationSettings.Required,FavoritedLocationNotAvailable:this._fromFavorite&&0===this._preselectedLocations.length,ZipCodeSearchValue:this.Data.AppointmentBuilder.UserEnteredZip,HasInvalidZipCodeError:this.__hasInvalidZipCodeError(),HasDeclinedGeoSecurity:this.__hasBrowserDeniedGeoSecurity,HasHomeCoordinates:this.__doesAnyAvailableLocationHaveDistanceFromHome(),ShouldSeparateLocationsByGeolocation:this.__isGeolocationEnabled&&this.__isAtLeastOneLocationFilteredOut(n),ShouldShowDistanceOnCard:null===this.__geolocationErrorMessage||!this.__isFilteringNearZip(),GeolocationError:this.__getGeolocationError(),ShouldShowStreetAddress:this.__isFilteringNearHome()&&this.__geolocationSettings.GeolocationStreetAddress.length>0,VisitType:this._appointment.VisitType,isShown:!this.isHidden()&&this.__isNeeded(),hasCollapsedBefore:this.__hasCollapsedBefore,isNotTelehealthCollapsed:!this.isCollapsedToShowTelehealth()||this._appointment.VisitType.ShowLocationStepForTelehealthVisit,IsVideoVisit:this.__isVideoVisit(),IsTelephoneVisit:this.__isTelephoneVisit(),TelehealthLocationWarningBannerViewModel:this.__getTelehealthLocationWarningViewModel(),ShouldShowLocationStepBanner:this.__anyAppointmentHasLocationStepTelehealthOverride()&&!this.__anyDepartmentHasInPersonVTOverride(),AppointmentDisplayName:i,ShowOriginalAppts:!!this.__originalAppointmentInfo};$.extend(this.ViewModel,u)},__attachAppointmentListeners:function(n,t){t.addCollectionPropertyListener(this.Data.Locations,this.__viewStatePropertyName,this._onViewModelChanged);t.addCollectionEventListener(n.Locations,"add",this._onLocationAdded,n);t.addCollectionEventListener(n.Locations,"remove",this._onLocationRemoved,n);this.__stepShouldListenForProviderChanges()&&(t.addCollectionEventListener(n.Providers,"add",this._onAncillaryDataChanged,n),t.addCollectionEventListener(n.Providers,"remove",this._onAncillaryDataChanged,n));t.addModelPropertyListener(this.Data.AppointmentBuilder,"Specialty",this._onAncillaryDataChanged);t.addModelPropertyListener(this.Data.AppointmentBuilder,"ReasonForVisit",this._onRFVchanged);t.addModelPropertyListener(this.Data.AppointmentBuilder,"GeolocationFilterMethod",this._onGeolocationChanged);t.addModelPropertyListener(n,"SelectedTelehealthMode",this._onAncillaryDataChanged);t.addModelPropertyListener(this.Data.AppointmentBuilder,"UserEnteredZipCoordinates",this.__onUserEnteredZipCoordinatesChanged)},arePrerequisitesComplete:function(){var n=this.Data.AppointmentBuilder.ReasonForVisit,i=this.Data.AppointmentBuilder.allAppointmentsHaveAProviderSelected(),r=this.Data.AppointmentBuilder.allAppointmentsHaveAVisitTypeSpecified();switch(this._mode){case t.FilterOnSelectedReasonForVisit:return!!n&&r;case t.FilterOnSelectedProviders:return i;case t.FilterOnSelectedReasonForVisitAndProviders:return!!n&&i&&r;case t.FilterOnSelectedSpecialtyAndReasonForVisit:return!!n&&r&&null!==this.Data.AppointmentBuilder.Specialty;case t.Request:return!!n&&i;default:return!1}},_setViewModelSelectedStates:function(n){var t,f,r,u,e;if(null!==n)for(e=(u=this.hasMultipleLinkedAppointments()?this.Data.AppointmentBuilder.getFirstAppointment():this._appointment).IsLocationAnyOptionSelected,u.IsOnlyLocationAnyOptionSelected=this.__isOnlyAnyLocationSelected(),f=u.Locations.toArray(),t=0;t<n.length;t++)r=n[t],r[this.__viewStatePropertyName]=e&&r.IsAnyOption||-1!==f.indexOf(r)?i.StatesEnum.Selected:i.StatesEnum.Unselected},beforeFirstRender:function(){for(var t=this._getAssociatedAppointments(),n=0;n<t.length;n++)this.__shouldAttemptToPreselectLocationsBeforeFirstRender(t[n])&&this.__preselectAllAvailableLocationsForAppointment(t[n]);this.__setDistanceToHomeOnEachLocation();this.renderCollapsed=this.__isStepCollapsed||this.isCollapsedForSingleLocation()||this.isCollapsedToShowTelehealth();this.__filterNearHomeIfGeolocationEnabled();$$WPSchedulingUtil.RegisterConfirmationPartials()},isCollapsedToShowTelehealth:function(){return!this.__isHiddenBasedOnInPersonStatus()&&this.__isNonInPersonVisitTypeSelected()},isCollapsedForSingleLocation:function(){return 1===this._getAvailableLocations().length&&this.__currentAppointmentAssociationStatus()===r.MultiApptToMultiSelector},__shouldAttemptToPreselectLocationsBeforeFirstRender:function(n){var t=this.ViewModel.Locations;return!(1===t.length&&this.hasPreselectedIds()&&!this._doesLocationContainAtLeastOnePreselectedDepartmentId(t[0]))&&!n.hasALocationSelected()},_doesLocationContainAtLeastOnePreselectedDepartmentId:function(n){for(var t=0;t<n.Departments.length;t++)if(this.isModelPreselected(n.Departments[t].ID))return!0;return!1},__preselectAllAvailableLocationsForAppointment:function(n){for(var u=0,f=0,t=[],r=this.ViewModel.Locations,u=0;u<r.length;u++)for(f=0;f<r[u].Departments.length;f++)if(this.preselectedIds[r[u].Departments[f].ID]){t.push(r[u]);break}if(1===r.length&&0===t.length&&t.push(r[0]),0===t.length&&this.stepSettings.PreselectAllModels&&(r.length>1&&this.ViewModel.MultiSelectable?this.__setAnyLocationSelected(n):1===r.length&&t.push(r[0])),t.length>0&&(1===t.length||this.ViewModel.MultiSelectable)){for(this.__isFirstTimeThroughFromPreselections=!0,this._preselectedLocations=t,n.Locations.empty(),n.Locations.addRange(t),u=0;u<t.length;u++)t[u][this.__viewStatePropertyName]=i.StatesEnum.Selected;this.updateStep()}},beforeRender:function(){this.__autoSelectLocationsIfHidden();this.renderCollapsed=this.__isRenderCollapsed();this.__isStepCollapsed&&(this.__hasCollapsedBefore=!0);this.__$preRedrawFocusedElement=$afe.jq(document.activeElement);this._workflow&&this._workflow.Type===Workflow.WorkflowTypesEnum.Reschedule&&0!==this.$root.find("#OriginalAppointmentInfo").length&&s.StashPortal()},__isRenderCollapsed:function(){return this.__isStepCollapsed&&!this.__hasCollapsedBefore||this.isCollapsedForSingleLocation()&&!this.__hasCollapsedBefore||this.isCollapsedToShowTelehealth()&&!this.__anyAppointmentHasLocationStepTelehealthOverride()},__autoSelectLocationsIfHidden:function(){var n,t,i;if(i=this.ViewModel.Locations,this.isHidden()||this.isCollapsedForSingleLocation()&&!this.__hasCollapsedBefore||this.isCollapsedToShowTelehealth()&&!this.__anyAppointmentHasLocationStepTelehealthOverride()){for(t=this._getAssociatedAppointments(),n=0;n<t.length;n++)this.hasPreselectedIds()&&(!this.hasPreselectedIds()||t[n].hasALocationSelected())||this.__selectLocationsForAppointment(t[n],i,this._allowMultiselect());for(t=this._getAssociatedAppointments(),n=0;n<t.length;n++)t[n].Locations.toArray().length<1&&this.showError()}},__selectLocationsForAppointment:function(n,t,i){var r=0,u=null,f=[],e=null;if(null!==t&&0!==t.length)if(i){for(r=0;r<t.length;r++)u=t[r],n.Locations.contains(u)||u.IsAnyOption||f.push(u);n.Locations.addRange(f)}else e=n.Locations.toArray()[0],-1===t.indexOf(e)&&n.Locations.add(t[0])},afterRender:function(){var n,t=this.$root.find("#streetAddress"),i=Handlebars.helpers.GetStreetAddressWithLabel();this.__isGeolocationEnabled&&this.ViewModel.IsFirstOnPage&&(this.__carouselController.render(this.$root.find(".geolocationContainer"),this.ViewModel),this.__bindGeolocationElements());this.__isStepCollapsing&&(this.__collapseSpacer(),this.__hasCollapsedBefore=!0);$$WPSchedulingUtil.HandleStickyBanner();$$WPSchedulingUtil.FocusElement(this.$root.find("h2.header"));this.$root.find("#providerselect").click(this._onSelectProviderClicked);this.Data.AppointmentBuilder.IsUsingProviderDropdown&&(this.Data.AppointmentBuilder.IsUsingProviderDropdown=!1);(n=this.__$preRedrawFocusedElement.safeAttr("class"))&&n.includes("geolocation")&&$$WPSchedulingUtil.FocusElement(this.$root.find("."+n));this.__syncUIElements();this._workflow&&this._workflow.Type===Workflow.WorkflowTypesEnum.Reschedule&&this.ViewModel.IsFirstOnPage&&s.Update(this.Data,$afe.select("#LocationStepOriginalAppointmentInfo"));t.length>0&&setTimeout(function(){$streetAddress=$afe.renderTemplate($$WP.Templates.Scheduling.StreetAddress,i);t.safeAppend($streetAddress)},100)},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.LocationStep},_onSelectProviderClicked:function(){this.$root.find(".card.helptip").addClass("expanded");this.$root.find("#providerSelectButton").click(this._onProviderSelected);$$WPSchedulingUtil.FocusElement(this.$root.find("#locationProviderList"));$$WP.UI.Dropdown.bindOnChange(this.$root.find("#locationProviderList"));$$WP.FormValidation.initializeDOMSubtree(this.$root)},_onProviderSelected:function(){var r,n,u,f="",e=[],o=null,s=!1,i=0,t=null;if(r=this.$root.find(".card.helptip select").val(),!$$WPUtil.IsNullOrEmpty(r)&&(n=this.Data.Providers.getFromIndex("ID",r),!$$WPUtil.IsNullOrEmpty(n)&&!($$WPUtil.IsNullOrEmpty(this.ViewModel.Locations)||this.ViewModel.Locations.length<1))){for(u=this._getAssociatedAppointments(),i=0;i<u.length;i++)(t=u[i]).Locations.empty(),this.Data.AppointmentBuilder.IsUsingProviderDropdown=!0,f=(o=this.Data.AppointmentBuilder.ReasonForVisit)?this._getDepartmentIdsFilterOnSelectedReasonForVisitAndProviders(o,[n]):this._getDepartmentIdsFilterOnSelectedProviders([n]),s=this._isLocationArrayGrouped(this.ViewModel.Locations),e=this._getLocationsForDepartments(f,s),t.Locations.addRange(e),t.Providers.empty(),t.IsProviderAnyOptionSelected=!1,t.Providers.add(n);this.$root.find(".card.helptip").hide()}},_onViewModelChanged:function(n){var f=0,u="",r=null,t=null,e=[];for(u in n){if(n[u].to,r=n[u].model,$$WP.Utilities.IsNullOrEmpty(r))break;for(e=this._getAssociatedAppointments(),f=0;f<e.length;f++){if((t=e[f]).Locations.openChangeBatch(),r.IsAnyOption)n[u].to===i.StatesEnum.Selected?this.__setAnyLocationSelected(t):this.__setAnyLocationUnselected(t,!0);else switch(t.IsLocationAnyOptionSelected&&r.IsIncludedByFilter&&this.__setAnyLocationUnselected(t,!1),n[u].to){case i.StatesEnum.Selected:t.Locations.add(r);break;case i.StatesEnum.Unselected:t.Locations.remove(r)}t.Locations.closeChangeBatch();t.IsOnlyLocationAnyOptionSelected=this.__isOnlyAnyLocationSelected()}}},__setAnyLocationSelected:function(n){var r=0,u=[],t=null;for(n.IsLocationAnyOptionSelected=!0,r=0;r<this.ViewModel.Locations.length;r++)(t=this.ViewModel.Locations[r]).IsAnyOption?t[this.__viewStatePropertyName]=i.StatesEnum.Selected:(t.IsIncludedByFilter&&(t[this.__viewStatePropertyName]=i.StatesEnum.Selected),t.OtherOption||t.IsIncludedByFilter&&u.push(t));n.Locations.removeRange(u);n.Locations.addRange(u);this._updateStepStatus()},__setAnyLocationUnselected:function(n,t){var r=0,u=null,f=[];for(n.IsLocationAnyOptionSelected=!1,r=0;r<this.ViewModel.Locations.length;r++)((u=this.ViewModel.Locations[r]).IsAnyOption||u.IsIncludedByFilter&&t)&&(u[this.__viewStatePropertyName]=i.StatesEnum.Unselected,f.push(u));n.Locations.removeRange(f)},__setAnyLocationName:function(){var i=this.Data.Locations.getFromIndex("Id","-1"),n="",t="";this.__isFilteringByGeolocation()?this.__isFilteringNearBrowser()?(n=this.SchedulingStringsNamespace.getString("AnyLocationNearMeHeader"),t=this.SchedulingStringsNamespace.getString("AnyLocationNearMeDescription")):this.__isFilteringNearHome()?(n=this.SchedulingStringsNamespace.getString("AnyLocationNearHomeHeader"),t=this.SchedulingStringsNamespace.getString("AnyLocationNearHomeDescription")):(this.SchedulingStringsNamespace.addMnemonic("@MYCHART@ZIPCODE@",this.Data.AppointmentBuilder.UserEnteredZip,$$WP.Strings.EncodingTypes.HTML),n=this.SchedulingStringsNamespace.getString("AnyLocationNearZipHeader"),t=this.SchedulingStringsNamespace.getString("AnyLocationNearZipDescription"),this.SchedulingStringsNamespace.clearMnemonics()):(n=this.SchedulingStringsNamespace.getString("AnyLocationHeader"),t=this.SchedulingStringsNamespace.getString("AnyLocationDescription"));i.Name=n;i.Address[0]=t},__stepShouldListenForProviderChanges:function(){return this._mode===t.FilterOnSelectedProviders||this._mode===t.FilterOnSelectedReasonForVisitAndProviders||this._mode===t.Request},__stepShouldListenForRfvChanges:function(){return this._mode===t.FilterOnSelectedReasonForVisitAndProviders||this._mode===t.FilterOnSelectedReasonForVisit||this._mode===t.FilterOnSelectedSpecialtyAndReasonForVisit||this._mode===t.Request},_onAncillaryDataChanged:function(){var t,n=0,i=null,r=this._getAssociatedAppointments();if(t=this._allowMultiselect(),this.updateViewModel(),this._updateStepStatus(),this.updateStep(),this.__isGeolocationEnabled=this.__shouldEnableGeolocationAndResetMethodIfNot(),this._deselectInvalidLocations(t),this.hasMultipleLinkedAppointments()&&!this.__doAllAppointmentsHaveTheSameLocationsSelected())for(n=0;n<r.length;n++)(i=r[n]).IsLocationAnyOptionSelected=!1,i.Locations.empty();null!==this.__getGeolocationFilterMethod()&&this.__isGeolocationEnabled?this.__setGeolocationFilterMethod(this.__getGeolocationFilterMethod(),!0):(this.__clearGeolocationErrorMessage(),this.__clearDistanceToUserOnEveryLocation());this.__isFilteringByGeolocation()||this.__setDistanceToHomeOnEachLocation()},_onRFVchanged:function(){this._onAncillaryDataChanged();this.__resetOtherLocationSelection();this.__filterNearHomeIfGeolocationEnabled()},__resetOtherLocationSelection:function(){var n=null;this.__isOtherLocationSelected()&&(n=this._appointment.Locations).remove(n.toArray()[0])},_deselectInvalidLocations:function(n){for(var u=0,f=0,t=[],i=[],e=[],o=null,r=null,s=!1,h=!1,c=!1,l=!1,a=this._getAssociatedAppointments(),u=0;u<a.length;u++){for(r=a[u],e=[],t=this._getAvailableLocations(),i=r.Locations.toArray(),s=this._isLocationArrayGrouped(t),h=this._isLocationArrayGrouped(i),c=s&&!h,l=!n&&i.length>1,f=0;f<i.length;f++)o=i[f],(-1===t.indexOf(o)||l)&&(c&&this._selectGroupedLocationThatContainsDepartmentIfAvailable(r,o,t),e.push(o));r.Locations.removeRange(e);r.IsLocationAnyOptionSelected&&(e.length>0||t.length!==i.length&&!this.__isAtLeastOneLocationFilteredOut(t)||!this._shouldIncludeAnyOption(t))&&this.__setAnyLocationUnselected(r,!1)}},_isLocationArrayGrouped:function(n){for(var t=0,i=null,t=0;t<n.length;t++)if(!(i=n[t]).IsAnyOption&&!i.OtherOption)return!i.IsSingleDepartment;return!1},_selectGroupedLocationThatContainsDepartmentIfAvailable:function(n,t,i){var u,r;t.IsSingleDepartment&&(u=t.DepartmentIds[0],r=this._getLocationsForDepartments(u,!0)[0],-1!==i.indexOf(r)&&n.Locations.add(r))},__doAllAppointmentsHaveTheSameLocationsSelected:function(){var i=[],n=0,r=this.Data.AppointmentBuilder.numAppointments(),t=!1;if(1===r)t=!0;else{for(n=0;n<r;n++)i.push(this.Data.AppointmentBuilder.getAppointment(n).Locations.toArray());t=$$WPSchedulingUtil.DoAllArraysContainTheSameValues(i)}return t},_onLocationAdded:function(n){var r=n.Locations.toArray(),u=r[r.length-1],e=this._allowMultiselect(),o=this.__isStepCollapsed,f=null,t=0;if(u){if(n.Locations.openChangeBatch(),!e&&r.length>1)for(n.Locations.empty(),n.Locations.add(u),t=0;t<this.ViewModel.Locations.length;t++)(f=this.ViewModel.Locations[t])!==u&&(f[this.__viewStatePropertyName]=i.StatesEnum.Unselected);n.Locations.closeChangeBatch()}this._updateStepStatus();o||this.__isStepCollapsed?this.updateStep():this.__syncUIElements()},_onLocationRemoved:function(){this._updateStepStatus();this.__syncUIElements()},__syncUIElements:function(){this.ViewBinder.syncModelsToDOM();this.__syncProviderSelectionDropdown();this.setCurrentSelectionCountInBanner();$$WPSchedulingUtil.HandleStickyBanner()},_updateStepStatus:function(){var t=this._appointment.hasALocationSelected(),i=this.__isIncomplete(),n=!1;t?this.isStepMarkedAsHidden()||this.__isOtherLocationSelected()||!this.__isNeeded()?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):(this.shouldSkipStep()&&this.isTheLastIncompleteStep()&&(n=!0),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete),i&&this.__currentAppointmentAssociationStatus()===r.MultiApptToMultiSelector&&!this.__hasCollapsedBefore&&(this.__isStepCollapsed=!0,this.__initializeSpacer(),this.updateStep(),n&&(this.__hasCollapsedBefore=!0))):(this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.__removeCollapse())},__isNeeded:function(){return!(this._appointment!==this.Data.AppointmentBuilder.getFirstAppointment()&&this.hasMultipleLinkedAppointments())},__isIncomplete:function(){return this.getComplete()===$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete},__isOtherLocationSelected:function(){var n=null;return 1===(n=this._appointment.Locations).size()&&n.toArray()[0].OtherOption},__isOnlyAnyLocationSelected:function(){var n=this._appointment;return n.IsLocationAnyOptionSelected&&n.Locations.size()===this.__getNumberOfViewModelLocationsIncludedByFilter()},shouldRemainOnStep:function(){return this.shouldSkipForPreselections()?(this.__isFirstTimeThroughFromPreselections=!1,!1):!this.shouldSkipStep()},shouldSkipStep:function(){return this.shouldSkipForPreselections()||this.shouldSkipForOtherReasons()},shouldSkipForPreselections:function(){return this.__isFirstTimeThroughFromPreselections&&!(this._fromFavorite&&0===this._preselectedLocations.length)},shouldSkipForOtherReasons:function(){return!(this.ViewModel&&this.ViewModel.Locations&&1!==this.ViewModel.Locations.length&&this._isCheckboxAndNotArrow()&&!this.Data.AppointmentBuilder.IsUsingProviderDropdown&&!this.isHidden()&&!this.__isStepCollapsed)},setCurrentSelectionCountInBanner:function(){var n,t=this.getSchedulingContinueBanner().find(".selected-count");this.Active&&this.ViewModel&&this.$root.is(":visible")&&(n=this.__getCurrentSelectionCountString(),t.text(n))},__getCurrentSelectionCountString:function(){var t=this._getAssociatedAppointments()[0].Locations.toArray().length,n="";return 0===t||this.ViewModel.Count<2||!this._isCheckboxAndNotArrow()||this.__currentAppointmentAssociationStatus()===r.MultiApptToMultiSelector?n="":this.__isOnlyAnyLocationSelected()?n=this.Data.Locations.getFromIndex("Id","-1").Name:1===t?n=this.SchedulingStringsNamespace.getString("LocationsSelectedCount_Singular"):(this.SchedulingStringsNamespace.addMnemonic("@MYCHART@LOCATIONSCOUNT@",t,$$WP.Strings.EncodingTypes.HTML),n=this.SchedulingStringsNamespace.getString("LocationsSelectedCount_Plural"),this.SchedulingStringsNamespace.clearMnemonics()),n},hasStickyBanner:function(){return!0},isStepMarkedAsHidden:function(){var n;return this.resetStepSettings(),this.stepSettings.Hide=this.__getStepSettingsHideValue(this.stepSettings),null!==(n=this.Data.SchedulingSteps.getFromIndex("ID",this.Id))&&(n.IsHidden=this.stepSettings.Hide),this.WP$Scheduling$StepController$isStepMarkedAsHidden()},__getStepSettingsHideValue:function(){return this.stepSettings.Hide||this.stepSettings.HideIfOne&&1===this._getAvailableLocations().length||this.__isHiddenBasedOnInPersonStatus()||this.__isOtherLocationTheOnlyAvailableLocation()},__isHiddenBasedOnInPersonStatus:function(){return!this.__anyAppointmentHasLocationStepTelehealthOverride()&&this.__isNonInPersonVisitTypeSelected()&&!(this.__currentAppointmentAssociationStatus()===r.MultiApptToMultiSelector)},__isOtherLocationTheOnlyAvailableLocation:function(){var n=[];return this.ViewModel&&(n=this.ViewModel.Locations),!!n&&1===n.length&&n[0].OtherOption},_getAvailableLocations:function(){for(var n=[],i=[],t=0,r=this._getAssociatedAppointments(),t=0;t<r.length;t++)i=this._getAvailableLocationsForAppointment(r[t]),n.push(i);return 0===n.length&&(n=[[]]),$$WPSchedulingUtil.GetIntersectionOfArrays(n)},_getAvailableLocationsByAppointment:function(){for(var t=[],i=[],n=0,r=this.Data.AppointmentBuilder.Appointments.toArray(),n=0;n<r.length;n++)i=this._getAvailableLocationsForAppointment(r[n]),t[n]=i;return 0===t.length&&(t=[[]]),t},_getAvailableLocationsForAppointment:function(n){var t=this._getAvailableDepartmentIds(n),i=this._shouldGroupByLocation(t);return this._getLocationsForDepartments(t,i)},_getAvailableLocationsGlobal:function(){for(var n=[],i=null,r=!1,u=[],t=0,f=this.Data.AppointmentBuilder.Appointments.toArray(),t=0;t<f.length;t++)i=this._getAvailableDepartmentIds(f[t]),r=this._shouldGroupByLocation(i),u=this._getLocationsForDepartments(i,r),n.push(u);return 0===n.length&&(n=[[]]),$$WPSchedulingUtil.RemoveDuplicateElementsFromArray($$WPSchedulingUtil.GetUnionOfArrays(n))},_getAvailableDepartmentIds:function(n){var r=n.ReasonForVisit,u=n.Providers.toArray(),i=[];if(this.arePrerequisitesComplete())switch(this._mode){case t.Request:i=this._getDepartmentIdsForRequest(r,u);break;case t.FilterOnSelectedReasonForVisitAndProviders:i=this._getDepartmentIdsFilterOnSelectedReasonForVisitAndProviders(r,u);break;case t.FilterOnSelectedProviders:i=this._getDepartmentIdsFilterOnSelectedProviders(u);break;case t.FilterOnSelectedReasonForVisit:i=this._getDepartmentIdsFilterOnSelectedReasonForVisit(r);break;case t.FilterOnSelectedSpecialtyAndReasonForVisit:i=this._getDepartmentIdsFilterOnSelectedSpecialtyAndReasonForVisit(r,this.Data.AppointmentBuilder.Specialty)}return this.filterIdArrayByAllowedIds(i)},_getLocationsForDepartments:function(n,t){var f,r,u,e,i;for(f=[],e=this.Data.Locations.toArray(),r=0;r<e.length;r++)if(!(i=e[r]).IsAnyOption&&i.IsSingleDepartment!==t)for(u=0;u<i.Departments.length;u++)if(-1!==n.indexOf(i.Departments[u].ID)){f.push(i);break}return f},_isCheckboxAndNotArrow:function(){return this.__currentAppointmentAssociationStatus()===r.MultiApptToMultiSelector?this.__hasCollapsedBefore:this._getAvailableLocations().length>1&&this._directOptionsExistForAssociatedAppointments()&&!this._hasMultipleLqfs()},_allowMultiselect:function(){return this._getAvailableLocations().length>1&&this._directOptionsExistForAssociatedAppointments()&&!this._hasMultipleLqfs()},_shouldIncludeAnyOption:function(n){return!(n.length<2||!this._allowMultiselect())&&(!this.__isFilteringByGeolocation()||this.__getNumberOfViewModelLocationsIncludedByFilter()>1)},_hasMultipleLqfs:function(){var u,i,e,n=0,o=null,s=null,r=null,h=0,t=[],c=null,l=null,a=[];if(!(e=this.Data.AppointmentBuilder.ReasonForVisit))return!1;for(n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)o=this.Data.AppointmentBuilder.getAppointment(n),a.push(this._getAvailableDepartmentIds(o));for(u=$$WPSchedulingUtil.GetUnionOfArrays(a),i=this._getLocationsForDepartments(u,!0),n=0;n<i.length;n++)c=i[n],t=t.concat(c.Departments);for(n=0;n<t.length;n++)s=t[n],(l=f.getOverride(e,s.ID,this.Data.ReasonForVisitDepartmentOverrides))&&(!(r=l.VisitType)||$$WPUtil.IsNullOrEmpty(r.QuestionnaireId)&&$$WPUtil.IsNullOrEmpty(r.DecisionTreeId)||h++);return t.length>1&&h>0},__anyDepartmentHasInPersonVTOverride:function(){var r,i,u,n=0,e=null,o=null,s=null,t=[],h=null,c=null,l=[];if(!(u=this.Data.AppointmentBuilder.ReasonForVisit))return!1;for(n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)e=this.Data.AppointmentBuilder.getAppointment(n),l.push(this._getAvailableDepartmentIds(e));for(r=$$WPSchedulingUtil.GetUnionOfArrays(l),i=this._getLocationsForDepartments(r,!0),n=0;n<i.length;n++)h=i[n],t=t.concat(h.Departments);for(n=0;n<t.length;n++)if(o=t[n],(c=f.getOverride(u,o.ID,this.Data.ReasonForVisitDepartmentOverrides))&&(s=c.VisitType)&&s.isInPerson())return!0;return!1},_directOptionsExistForAssociatedAppointments:function(){for(var n=0,t=null,i=[],r=null,u=this._getAssociatedAppointments(),n=0;n<u.length;n++)if(r=(t=this.Data.AppointmentBuilder.getAppointment(n)).ReasonForVisit,i=t.Providers.toArray(),this._directOptionsExist(r,i))return!0;return!1},_directOptionsExist:function(n,i){var r,u,f=null;if(this._mode===t.FilterOnSelectedProviders||this._mode===t.FilterOnSelectedReasonForVisit||this._mode===t.FilterOnSelectedSpecialtyAndReasonForVisit)return!0;if(!n)return!1;for(u=n.DirectProviderDepartmentPairs,r=0;r<u.length;r++)if(f=u[r].Provider,-1!==i.indexOf(f))return!0;return!1},_getDepartmentIdsFilterOnSelectedReasonForVisit:function(n){return this._getDepartmentIdsFilterOnSelectedSpecialtyAndReasonForVisit(n,null)},_getDepartmentIdsFilterOnSelectedSpecialtyAndReasonForVisit:function(n,t){var i,e,o,r=[],f=null,s=!1,u=null;if(null===n)return r;for(e=n.DirectProviderDepartmentPairs,o=n.RequestProviderDepartmentPairs,i=0;i<e.length;i++)u=(f=e[i]).DepartmentId,this._isDepartmentValidForSpecialty(r,u,f,t,n,!0,!1)&&r.push(u);for(i=0;i<o.length;i++)"-1"!==(u=(f=o[i]).DepartmentId)?this._isDepartmentValidForSpecialty(r,u,f,t,n,!1,!0)&&r.push(u):s=!0;return 0===r.length&&s&&r.push("-1"),r},_isDepartmentValidForSpecialty:function(n,t,i,r,u,f,e){return!(!this._isReasonForVisitAllowedWithOverride(u,t,f,e)||-1!==n.indexOf(t)||r&&u.SpecialtyGroupId!==r.Id&&r!==i.Department.Specialty)},_isReasonForVisitAllowedWithOverride:function(n,t,i,r){var u;return null===(u=f.getOverride(n,t,this.Data.ReasonForVisitDepartmentOverrides))||!(i&&!1===u.CanDirectSchedule||r&&!1===u.CanRequest)},_getDepartmentIdsFilterOnSelectedReasonForVisitAndProviders:function(n,t){for(var o=null,s=[],h=[],e=null,u=null,r=n.AllProviderDepartmentPairs,i=0;i<r.length;i++)if(!h[u=r[i].DepartmentId]){if(null!==(e=f.getOverride(n,u,this.Data.ReasonForVisitDepartmentOverrides))&&!1===e.CanDirectSchedule&&!1===e.CanRequest)continue;if(o=r[i].Provider,-1===t.indexOf(o))continue;s.push(u);h[u]=!0}return s},_getDepartmentIdsFilterOnSelectedProviders:function(n){for(var r,e=[],o={},f=[],t=null,u=this.Data.ReasonsForVisit.Models,i=0;i<u.length;i++)for(f=u[i].AllProviderDepartmentPairs,r=0;r<f.length;r++)t=f[r],-1===n.indexOf(t.Provider)||o[t.DepartmentId]||(e.push(t.DepartmentId),o[t.DepartmentId]=!0);return e},_getDepartmentIdsForRequest:function(n,t){for(var f=[],u=null,r=n.RequestProviderDepartmentPairs,i=0;i<r.length;i++)u=r[i],-1!==t.indexOf(u.Provider)&&f.push(u.DepartmentId);return f},_shouldGroupByLocation:function(n){return this._mode!==t.Request&&!!i.areAllDepartmentsGrouped(this.Data.Locations,this.Data.Departments)&&!this._hasMultipleLqfs(n)&&this.__shouldDepartmentsBeGroupedBasedOnGroupingBehavior()},__shouldDepartmentsBeGroupedBasedOnGroupingBehavior:function(){switch(this.__locationGroupingBehavior){case o.AlwaysGroup:return!0;case o.GroupForMultipleAppointmentsOnly:return this.Data.AppointmentBuilder.numAppointments()>1&&this.hasMultipleLinkedAppointments()}},_getAvailableProvidersForLocationStep:function(){var i=null,t=null,n=[],r=[],u=!1;return this.__shouldShowProviderSelection()&&(i=this.Data.AppointmentBuilder.getFirstAppointment(),t=this.Data.AppointmentBuilder.ReasonForVisit,r=i.getSelectedDepartmentsCollection().toArray(),u=!!t,n=(n=$$WPSchedulingUtil.BuildProvidersFiltered(u,!1,!1,t,r,!1)).sort($$WP.Scheduling.Provider.sortProvidersByLastName)),n.forEach(this.__setAvailableProvidersDisplayString),n},__setAvailableProvidersDisplayString:function(n,t,i){var r=n.Name;n.IsPCP&&(this.SchedulingStringsNamespace.addMnemonic("@MYCHART@PROVIDER@",n.Name,$$WP.Strings.EncodingTypes.HTML),r=this.SchedulingStringsNamespace.getString("PcpProviderLabel"),this.SchedulingStringsNamespace.clearMnemonics());i[t].DisplayString=r},__isNonInPersonVisitTypeSelected:function(){for(var n=0,i=null,r=null,t=!0,u=this._getAssociatedAppointments(),n=0;n<u.length;n++)r=(i=u[n]).VisitType,t=t&&!!r&&!i.isAppointmentInPerson();return t},__anyAppointmentHasLocationStepTelehealthOverride:function(){var n=0,r=null,i=null,t=!1,u=this._getAssociatedAppointments();if(this.VisitType&&!this.VisitType.MultiSelectable)return!0;for(n=0;n<u.length&&!t;n++)(i=(r=u[n]).VisitType)&&r.isAppointmentInPerson()||(t=t||!!i&&i.ShowLocationStepForTelehealthVisit);return t},__getTelehealthLocationWarningViewModel:function(){var n={},t=$$WP.Strings.getNamespace("Scheduling");return!this.__anyAppointmentHasLocationStepTelehealthOverride()||this.__anyDepartmentHasInPersonVTOverride()?{}:(n.BannerType="warningType",n.DisableDetailTextHtmlEncoding=!0,n.DetailText="<span>"+t.getString("TelehealthPhysicalLocationInstructions")+"<\/span>",n)},__isVideoVisit:function(){for(var n=0,i=null,t=!0,r=this._getAssociatedAppointments(),n=0;n<r.length;n++)i=r[n],t=t&&i.isVideoVisit();return t},__isTelephoneVisit:function(){for(var n=0,i=null,t=!0,r=this._getAssociatedAppointments(),n=0;n<r.length;n++)i=r[n],t=t&&i.isTelephoneVisit();return t},__shouldShowProviderSelection:function(){if(this._mode===t.FilterOnSelectedSpecialtyAndReasonForVisit)return!1;var n=this.Data.AppointmentBuilder.getFirstAppointment();return!(n.hasAProviderSelected()||n.hasALocationSelected()||1!==this.Data.AppointmentBuilder.numAppointments()||this._workflow.isTypeOpenSchedulingWidget())&&$$WP.Scheduling.Workflow.allowProviderSelectForAppointment(this.Data.AppointmentBuilder,n)},__setGeolocationFilterMethod:function(n,t){if(this.__saveLastGeolocationMethod(),this.__clearGeolocationErrorMessage(),null===n)return this.Data.AppointmentBuilder.setProperty("GeolocationFilterMethod",n),this.__setAnyLocationName(),void this.__clearAllSelectedLocations();this.__isFilteringNearZip()||this.__getGeolocationFilterMethod()!==n||t?(this.Data.AppointmentBuilder.setProperty("GeolocationFilterMethod",n),t||this.__clearAllSelectedLocations(),this.__setAnyLocationName(),this.__isFilteringByGeolocation()&&this.__setDistanceToUserOnEveryLocation(),this.__filterByGeolocation(),this.__isFilteringNearZip()?$$WPSchedulingUtil.FocusElement(this.$root.find(".geolocation_nearZip_search")):(this.__getCurrentlySelectedGeolocationFilterElement().closest(".chip").addClass("selected"),$$WPSchedulingUtil.FocusElement(this.__getCurrentlySelectedGeolocationFilterElement())),this.updateStep()):this.__setGeolocationFilterMethod(null)},__setDistanceToHomeOnEachLocation:function(){this.__doesAnyAvailableLocationHaveDistanceFromHome()&&this.__isGeolocationEnabled&&(this.Data.AppointmentBuilder.setProperty("GeolocationFilterMethod",n.NearHome),this.__setDistanceToUserOnEveryLocation(),this.__previousGeolocationMethod=n.NearHome,this.Data.AppointmentBuilder.setProperty("GeolocationFilterMethod",n.DoNotFilter),this.updateStep())},__saveLastGeolocationMethod:function(){if(this.__isFilteringByGeolocation()){if(this.__isFilteringNearZip()&&!this.__areCoordinatesValid(this.__coordinatesOfUserEnteredZip))return;this.__previousGeolocationMethod=this.Data.AppointmentBuilder.GeolocationFilterMethod}},__getGeolocationFilterMethod:function(){return this.Data.AppointmentBuilder.GeolocationFilterMethod},__clearGeolocationErrorMessage:function(){this.__setGeolocationError(null)},__hasGeolocationError:function(){return(this.ViewModel.IsFirstOnPage||!this.Data.AppointmentBuilder.HasFatalGeolocationError)&&null!==this.__geolocationErrorMessage},__setGeolocationError:function(n,t){this.ViewModel&&this.ViewModel.IsFirstOnPage&&this.Data.AppointmentBuilder.setProperty("HasFatalGeolocationError",!0===t);this.__geolocationErrorMessage=n},__getGeolocationError:function(){return this.__hasGeolocationError()?this.__geolocationErrorMessage:null},__hasInvalidZipCodeError:function(){return!!this.Data.AppointmentBuilder.HasFatalGeolocationError&&this.__getGeolocationFilterMethod()===n.NearZip},__onGetBrowserCoordinatesSuccess:function(t,i){var r;r={Latitude:t,Longitude:i};this.__coordinatesOfBrowser=r;this.__setGeolocationFilterMethod(n.NearBrowser)},__onGetBrowserCoordinatesFailure:function(){this.__hasBrowserDeniedGeoSecurity=!0;this.updateStep()},__onGetZipSuccess:function(t,i){this.__coordinatesOfUserEnteredZip={Latitude:t,Longitude:i};this.Data.AppointmentBuilder.setProperty("UserEnteredZipCoordinates",this.__coordinatesOfUserEnteredZip);this.__setGeolocationFilterMethod(n.NearZip)},__onGetZipFailure:function(){this.__coordinatesOfUserEnteredZip={Latitude:null,Longitude:null};this.Data.AppointmentBuilder.setProperty("UserEnteredZipCoordinates",this.__coordinatesOfUserEnteredZip);this.__setGeolocationFilterMethod(n.NearZip)},__onUserEnteredZipCoordinatesChanged:function(){this.__coordinatesOfUserEnteredZip=this.Data.AppointmentBuilder.UserEnteredZipCoordinates;this.__setGeolocationFilterMethod(n.NearZip)},__onShowNearBrowserClicked:function(){this.__areCoordinatesValid(this.__coordinatesOfBrowser)?this.__setGeolocationFilterMethod(n.NearBrowser):(e.getCoordinatesFromBrowser(this.__onGetBrowserCoordinatesSuccess,this.__onGetBrowserCoordinatesFailure,3e4),this.$root.find(".loadingIcon").delay(250).show(0))},__onShowNearHomeClicked:function(){this.__setGeolocationFilterMethod(n.NearHome)},__onShowAllLocationsClicked:function(){this.__setGeolocationFilterMethod(n.DoNotFilter)},__onZipEntered:function(){var n=this.$root.find(".geolocation_nearZip_input").val();""!==n&&(this.Data.AppointmentBuilder.setProperty("UserEnteredZip",n),e.lookUpCoordinatesFromDatabase(this.Data.AppointmentBuilder.UserEnteredZip,this.__onGetZipSuccess,this.__onGetZipFailure))},__filterByGeolocation:function(){var n,t;if(this.__isGeolocationEnabled)for(t=this._getAssociatedAppointments(),n=0;n<t.length;n++)this.__filterAppointmentByGeolocation(t[n])},__filterAppointmentByGeolocation:function(){var r,n,i,u,t;for(n=this._getAvailableLocations(),this.__clearGeolocationErrorMessage(),this.__sortLocations(n),i=0;i<n.length;i++)n[i].IsIncludedByFilter=!1;if(this.__isFilteringByGeolocation())if(r=this.__getCoordinatesFromGeolocationMethod(),this.__isFilteringNearZip()&&!this.__areCoordinatesValid(r))this.__clearDistanceToUserOnEveryLocation(),this.__setGeolocationError(this.SchedulingStringsNamespace.getString("InvalidZipCodeErrorMessage"),!0);else if(this.__isAtLeastOneLocationInRange(n)){for(t=0;t<n.length;t++)this.__isLocationWithinRange(n[t])||n.splice(t--,1);this.__applyGeolocationFilter(n)}else u=this.SchedulingStringsNamespace.getString("DistanceUnits_"+this.__geolocationSettings.GeolocationDistanceUnits),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@DISTANCE@",this.__geolocationSettings.GeolocationOuterRadius,$$WP.Strings.EncodingTypes.HTML),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@DISTANCEUNITS@",u,$$WP.Strings.EncodingTypes.HTML),this.__isFilteringNearZip()?(this.SchedulingStringsNamespace.addMnemonic("@MYCHART@ZIPCODE@",this.Data.AppointmentBuilder.UserEnteredZip,$$WP.Strings.EncodingTypes.HTML),this.__setGeolocationError(this.SchedulingStringsNamespace.getString("NoLocationsNearZip"))):this.__isFilteringNearBrowser()?this.__setGeolocationError(this.SchedulingStringsNamespace.getString("NoLocationsNearBrowser")):this.__isFilteringNearHome()&&this.__setGeolocationError(this.SchedulingStringsNamespace.getString("NoLocationsNearHome")),this.SchedulingStringsNamespace.clearMnemonics();else this.__includeEachLocationInFilter(n)},__getCoordinatesFromGeolocationMethod:function(){switch(this.__getGeolocationFilterMethod()){case n.NearZip:return this.__coordinatesOfUserEnteredZip;case n.NearBrowser:return this.__coordinatesOfBrowser;default:return null}},__getStreetAddressFormattedWithHTML:function(){return this.__geolocationSettings.GeolocationStreetAddress.length<1?"":'<span class="bold">'+HTMLEncode(this.__geolocationSettings.GeolocationStreetAddress.join(" "))+"<\/span>"},__registerClearLabelDisplayNameFunction:function(n){Handlebars.registerHelper("GetClearLabelForLocationWithVisitType",function(){var t;return $$WP.Strings.addMnemonic("@MYCHART@VisitTypeForClearLabelLocation@",n,!1,"Scheduling",$$WP.Strings.EncodingTypes.None),t=$$WP.Strings.getForTemplate("ClearLabelForLocationWithVisitType"),$$WP.Strings.removeMnemonic("@MYCHART@VisitTypeForClearLabelLocation@"),t})},__sortLocations:function(n){this.__isFilteringByGeolocation()?i.sortLocations(n,i.SortMethodEnum.ByDistance):i.sortLocations(n,i.SortMethodEnum.Alphabetically)},__setDistanceToUserOnEveryLocation:function(){var u,r,t,n,f=null;if(r=this.Data.Locations.Models,u=this.__getCoordinatesFromGeolocationMethod(),this.Data.Locations.openChangeBatch(),this.__isFilteringNearHome())for(n=0;n<r.length;n++)(t=r[n]).IsAnyOption||t.setProperty("DistanceToUser",t.DistanceFromHome);else if(this.__areCoordinatesValid(u))for(n=0;n<r.length;n++)t=r[n],i.doesLocationHaveCoordinates(t)&&(f=e.getHaversineDistance(t.Coordinates,u,this.__geolocationSettings.GeolocationDistanceUnits),t.setProperty("DistanceToUser",f));this.Data.Locations.closeChangeBatch()},__clearDistanceToUserOnEveryLocation:function(){var n;for(this.Data.Locations.openChangeBatch(),n=0;n<this.Data.Locations.Models.length;n++)this.Data.Locations.Models[n].setProperty("DistanceToUser",null);this.Data.Locations.closeChangeBatch()},__clearAllSelectedLocations:function(){for(var n=0,r=this._getAvailableLocations(),t=this.Data.AppointmentBuilder.Appointments.toArray(),n=0;n<r.length;n++)r[n][this.__viewStatePropertyName]=i.StatesEnum.Unselected;for(n=0;n<t.length;n++)t[n].IsLocationAnyOptionSelected=!1,t[n].Locations.empty()},__isAtLeastOneLocationFilteredOut:function(n){if(!n||!this.__isFilteringByGeolocation())return!1;for(var t=null,t=0;t<n.length;t++)if(!n[t].IsIncludedByFilter)return!0;return!1},__applyGeolocationFilter:function(n){this._isGeolocationEnabled||this.__isFilteringByGeolocation()&&(this.__addEveryLocationWithinInnerRadius(n),this.__addSomeLocationsWithinOuterRadius(n))},__addEveryLocationWithinInnerRadius:function(n){for(var t,r=0;r<n.length;r++)t=n[r],i.doesLocationHaveDistanceToUser(t)&&t.DistanceToUser<=this.__geolocationSettings.GeolocationInnerRadius&&(this.__includeLocationInFilter(t),n.splice(r--,1))},__addSomeLocationsWithinOuterRadius:function(n){for(var t=null,u=this.__getNumberOfViewModelLocationsIncludedByFilter(),r=0;r<n.length;r++){if(t=n[r],u>=this.__geolocationSettings.GeolocationNumLocationsToSelect)return;(!i.doesLocationHaveDistanceToUser(t)||t.DistanceToUser<=this.__geolocationSettings.GeolocationOuterRadius)&&(this.__includeLocationInFilter(t),n.splice(r--,1),u++)}},__includeLocationInFilter:function(n){n.IsIncludedByFilter=!0},__includeEachLocationInFilter:function(n){for(var t=null,i=null,t=0;t<n.length;t++)i=n[t],this.__includeLocationInFilter(i)},__getNumberOfViewModelLocationsIncludedByFilter:function(){var n=this.__getViewModelLocationsIncludedByFilter(),t=0;if($$WPUtil.IsNullOrEmpty(n)||0===n.length)return 0;for(t=0;t<n.length;t++)if(n[t].IsAnyOption)return n.length-1;return n.length},__getViewModelLocationsIncludedByFilter:function(){var n,t=0,i=null,r=[];if(!this.ViewModel)return null;if(n=this.ViewModel.Locations,!this.__isFilteringByGeolocation())return n;for(t=0;t<n.length;t++)(i=n[t]).IsIncludedByFilter&&r.push(i);return r},__isAtLeastOneLocationInRange:function(n){for(var i,t=0;t<n.length;t++)if(i=n[t],this.__isLocationWithinRange(i))return!0;return!1},__isLocationWithinRange:function(n){return n.DistanceToUser<=this.__geolocationSettings.GeolocationOuterRadius},__areCoordinatesValid:function(n){return null!=n&&null!==n.Latitude&&!isNaN(n.Latitude)&&null!==n.Longitude&&!isNaN(n.Longitude)},__isFilteringByGeolocation:function(){return this.__isFilteringNearZip()||this.__isFilteringNearBrowser()||this.__isFilteringNearHome()},__isFilteringNearBrowser:function(){return this.__getGeolocationFilterMethod()===n.NearBrowser},__isFilteringNearHome:function(){return this.__getGeolocationFilterMethod()===n.NearHome},__isFilteringNearZip:function(){return this.__getGeolocationFilterMethod()===n.NearZip},__filterNearHomeIfGeolocationEnabled:function(){this.__isGeolocationEnabled&&this.__doesAnyAvailableLocationHaveDistanceFromHome()&&this.__setGeolocationFilterMethod(n.NearHome,!0)},__isReadOnly:function(){return this.stepSettings.ReadOnly},__shouldEnableGeolocationAndResetMethodIfNot:function(){var f=null,r=this._getAvailableLocationsGlobal(),u=0,t;if(this.__isReadOnly())return!1;for(t=0;t<r.length;t++)i.doesLocationHaveCoordinates(r[t])&&u++;return!(f=!(u<2)&&u/r.length>=.8)&&this.__isFilteringByGeolocation()&&this.__setGeolocationFilterMethod(n.DoNotFilter,!0),f},__bindGeolocationElements:function(){var t;this.$root.find(".geolocation_nearZip_input").on("keydown",$.proxy(function(n){"Enter"===n.key&&this.__onZipEntered()},this));this.$root.find(".geolocation_nearZip_input").on("focus",this.__onZipInputFocused);this.$root.find(".geolocation_nearZip_search").on("click",this.__onZipEntered);this.__getGeolocationElementFromMethod(n.NearZip).on("click",this.__setFocusInZipInput);this.__getGeolocationElementFromMethod(n.NearBrowser).on("click",this.__onShowNearBrowserClicked);this.__getGeolocationElementFromMethod(n.NearHome).on("click",this.__onShowNearHomeClicked);this.__getGeolocationElementFromMethod(n.DoNotFilter).on("click",this.__onShowAllLocationsClicked);(t=this.__getCurrentlySelectedGeolocationFilterElement())&&t.length>0&&this.__carouselController.selectChip(t)},__getCurrentlySelectedGeolocationFilterElement:function(){return this.__getGeolocationElementFromMethod(this.__getGeolocationFilterMethod())},__getGeolocationElementFromMethod:function(t){var i="",r=null;switch(t){case n.DoNotFilter:i=".geolocation_showAll";break;case n.NearZip:i=".geolocation_nearZip_radio";break;case n.NearBrowser:i=".geolocation_nearMe";break;case n.NearHome:i=".geolocation_nearHome"}return i&&(r=this.$root.find(i)),r},__getDefaultGeolocationFilter:function(){return n.DoNotFilter},__setFocusInZipInput:function(){var n=this.$root.find(".geolocation_nearZip").parent().find("input[type='text']"),t=n.val();$$WPSchedulingUtil.FocusElement(n);n.val("").val(t)},__onZipInputFocused:function(){var n=this.$root.find(".geolocation_nearZip").parent();this.__carouselController.scrollChipIntoView(n)},__doesAnyAvailableLocationHaveDistanceFromHome:function(){for(var t=this._getAvailableLocations(),n=0,r=null,n=0;n<t.length;n++)if(r=t[n],i.doesLocationHaveDistanceFromHome(r))return!0;return!1},__syncProviderSelectionDropdown:function(){0===this.Data.AppointmentBuilder.getAppointment(0).Locations.size()?this.$root.find(".providerDropdown").show():this.$root.find(".providerDropdown").hide()},__getDistanceToUserRoundedWithUnits:function(n){var t;return null===n?null:(this.SchedulingStringsNamespace.addMnemonic("@MYCHART@DISTANCE@",$$WP.I18N.formatNumber(n,1),$$WP.Strings.EncodingTypes.HTML),t=this.SchedulingStringsNamespace.getString("DistanceAway_"+this.__geolocationSettings.GeolocationDistanceUnits),this.SchedulingStringsNamespace.clearMnemonics(),t)},_registerHandlebarsHelpers:function(){var t=$$WP.Strings.getNamespace("Scheduling"),i=this;Handlebars.registerHelper("DistanceToUserRoundedWithMethod",function(r){var e,f="",u=null;return e=i.__geolocationErrorMessage===t.getString("InvalidZipCodeErrorMessage"),null===(r=i.__getDistanceToUserRoundedWithUnits(r))?"":(t.addMnemonic("@MYCHART@DISTANCEWITHUNITS@",r,$$WP.Strings.EncodingTypes.HTML),t.addMnemonic("@MYCHART@ZIPCODE@",i.Data.AppointmentBuilder.UserEnteredZip,$$WP.Strings.EncodingTypes.HTML),u=i.__isFilteringByGeolocation()?i.__getGeolocationFilterMethod():i.__previousGeolocationMethod,e&&(u=n.DoNotFilter),u===n.NearHome?f=t.getString("DistanceFromHomeLabel"):u===n.NearBrowser?f=t.getString("DistanceFromMeLabel"):u===n.NearZip&&(f=t.getString("DistanceFromZipLabel")),t.clearMnemonics(),f)});Handlebars.registerHelper("GetStreetAddressWithLabel",function(){var n,t=i.__getStreetAddressFormattedWithHTML();return $$WP.Strings.addMnemonic("@MYCHART@STREETADDRESS@",t,!1,"Scheduling",$$WP.Strings.EncodingTypes.None),n=$$WP.Strings.getForTemplate("ShowingLocationsNearHomeAddressLabel"),$$WP.Strings.removeMnemonic("@MYCHART@STREETADDRESS"),n})},_onGeolocationChanged:function(){this.__isFilteringByGeolocation()&&this.__setDistanceToUserOnEveryLocation();this.__filterByGeolocation();this.updateStep()},_getAssociatedAppointments:function(){var n=[];return this.hasMultipleLinkedAppointments()?n=this.Data.AppointmentBuilder.Appointments.toArray():n.push(this._appointment),n},hasMultipleLinkedAppointments:function(){return!$$WPSchedulingUtil.AllowsLocationsSeparate(this.Data)&&this.Data.AppointmentBuilder.Appointments.toArray().length>1},__initializeSpacer:function(){this.__$spacer=$afe.jq(document.createElement("div"));var n=this.$root.find(".locationlist").height();this.__$spacer.height(n);this.__isStepCollapsing=!0},__collapseSpacer:function(){this.$root.append(this.__$spacer);this.__$spacer.slideUp(500,function(){$$WPSchedulingUtil.HandleStickyBanner();this.__isStepCollapsed=!0;this.__isStepCollapsing=!1})},__onChangeLocationClicked:function(){this.__hasCollapsedBefore=!0;this.__removeCollapse()},__removeCollapse:function(){var n;n=this.__isStepCollapsed;this.__isStepCollapsed=!1;n&&this.updateStep()},__currentAppointmentAssociationStatus:function(){return 1===this.Data.AppointmentBuilder.Appointments.toArray().length?r.OneApptToOneSelector:this.hasMultipleLinkedAppointments()?r.MultiApptToOneSelector:this.Data.AppointmentBuilder.Appointments.toArray().length>1&&!this.hasMultipleLinkedAppointments()?r.MultiApptToMultiSelector:null}},t={FilterOnSelectedReasonForVisitAndProviders:0,FilterOnSelectedProviders:1,Request:2,FilterOnSelectedReasonForVisit:3,FilterOnSelectedSpecialtyAndReasonForVisit:4},o={AlwaysGroup:0,GroupForMultipleAppointmentsOnly:1},n={DoNotFilter:0,NearZip:1,NearBrowser:2,NearHome:3},r={OneApptToOneSelector:0,MultiApptToOneSelector:1,MultiApptToMultiSelector:2};u.prototype=c;u.ModesEnum=t;u.LocationGroupingBehaviorEnum=o;u.GeolocationFilterMethod=n;$$WP.Scheduling.LocationStepController=u;u.extend($$WP.Scheduling.SingleAppointmentStepController,"WP$Scheduling$LocationStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=$$WP.Scheduling.Specialty,r=$$WP.Scheduling.SchedulingSelectableViewBinder,i={NoFiltering:0},t=function(t,u,f,e,o,s,h,c){this.WP$Scheduling$StepController(t,f,o,[s],h,$$WP.Templates.Scheduling.SpecialtyStep,null,!1,null);this.proxify("updateStep","_onSpecialtyChanged","_onViewModelChanged","_onLoadSpecialtiesSuccess");this._mode=e||i.NoFiltering;this.__specialtyToPreselect=null;this.__isHidden=!1;this._workflow=u;this.__canShowStepPretext=c;this.setViewBinder(new r("ViewState",n.StatesEnum.Selected,n.StatesEnum.Unselected));this.Data.Specialties.addPropertyListener("ViewState",this._onViewModelChanged);this.Data.AppointmentBuilder.addPropertyListener("Specialty",this._onSpecialtyChanged);$$WP.Analytics.UsageTrackingController.logFormFactor(u.IsAnonymous)};t.prototype={_mode:null,__specialtyToPreselect:null,__isHidden:!1,__canShowStepPretext:!1,updateViewModel:function(){var n=this.__getAvailableSpecialties();n.sort($$WP.Scheduling.Specialty.sortSpecialties);this.ViewModel={Specialties:n,Count:n.length,StepShouldBeActive:!0}},__getAvailableSpecialties:function(){var n;return n=this.__getUnfilteredSpecialties(),this.filterByAllowedIds(n,"Id")},beforeFirstRender:function(){var n,t;n=this.ViewModel.Specialties;t=this.getModelsToPreSelect(n,"Id");this.__cacheSettingsBeforeFirstRender(t)},__cacheSettingsBeforeFirstRender:function(n){0!==n.length&&null!==n[0]?(this.__specialtyToPreselect=n[0],(this.stepSettings.Hide||this.stepSettings.HideIfOne)&&this.__cacheHideStepSetting()):this.stepSettings.ReadOnly||this.__disableHideAndReadOnlyStepSettings()},__cacheHideStepSetting:function(){this.__isHidden=!0;this.stepSettings.HideIfOne=!1;this.stepSettings.Hide=!1},__disableHideAndReadOnlyStepSettings:function(){this.stepSettings.ReadOnly=!1;this.stepSettings.HideIfOne=!1;this.stepSettings.Hide=!1},afterRender:function(){this.__setupPretext();this.__setInitialFocus();this.__selectPreselectedSpecialty()},__setupPretext:function(){var t,i,n;this.__canShowStepPretext&&(t=this.$root.find(".specialtystep .pretext"),i=$$WP.Strings.getForTemplate("StepPretextHeader","Scheduling.Fixed"),(n=$$WP.Strings.getForTemplate("SpecialtyStepPretextExpanded","Scheduling"))&&!$$WPUtil.IsNullOrEmpty(n.string)&&new $$WP.UI.ProgressiveDisclosureController(t,i,n,$$WP.UI.ProgressiveDisclosureTypeEnum.Info))},__setInitialFocus:function(){var n;0===(n=$afe.select("#workflow-help .banner-header-text h4")).length&&(n=$afe.select("#workflow-help .mainText"));0===n.length&&(n=this.$root.find("h2.header"));n.focus()},__selectPreselectedSpecialty:function(){null!==this.__specialtyToPreselect&&(this.Data.AppointmentBuilder.setProperty("Specialty",this.__specialtyToPreselect),this._setViewModelSelectedStates(this.ViewModel.Specialties),this.ViewBinder.syncModelsToDOM(),this.__specialtyToPreselect=null)},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.SpecialtyStep},_onViewModelChanged:function(t){var i,r;for(i in t)switch(r=t[i].model||$$WP.Common.Model.getInstance(i),t[i].to){case n.StatesEnum.Selected:this.Data.AppointmentBuilder.setProperty("Specialty",r);break;case n.StatesEnum.Unselected:this.Data.AppointmentBuilder.Specialty===r&&this.Data.AppointmentBuilder.setProperty("Specialty",null)}},_onSpecialtyChanged:function(){var n=this.Data.AppointmentBuilder.Specialty;this._updateStepStatus();null!=n?n.IsDataLoaded?(this._setViewModelSelectedStates(this.__getAvailableSpecialties()),this.ViewBinder.syncModelsToDOM()):(this.__showLoadingSpinner(),this.__isHidden&&this.__hideStepContents(),$$WPSchedulingSpecialtiesCore.LoadSpecialtyData(this._workflow,n.Id,this._onLoadSpecialtiesSuccess)):this.ViewBinder.syncModelsToDOM()},__hideStepContents:function(){this.$root.find(".cardlist").hide();this.$root.find("h2.header").hide()},_onLoadSpecialtiesSuccess:function(n){this._updateAfterSpecialtiesLoaded(n);this.__hideLoadingSpinner()},_updateAfterSpecialtiesLoaded:function(n){$$WPSchedulingSpecialtiesCore.UpdateDataPoolSpecialties(this.Data,n,this.Data.AppointmentBuilder.Specialty.Id);this.__isHidden&&(this.stepSettings.Hide=!0);this._updateStepStatus();this._setViewModelSelectedStates(this.__getAvailableSpecialties());this.ViewBinder.syncModelsToDOM()},__showLoadingSpinner:function(){$$WPUtil.ShowAjaxSpinner(this.$root.find(".specialtystep .ajaxspinner"))},__hideLoadingSpinner:function(){$$WPUtil.HideAjaxSpinner(this.$root.find(".specialtystep .ajaxspinner"))},_updateStepStatus:function(){var n=this.Data.AppointmentBuilder.Specialty;this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete);null!==n&&n.IsDataLoaded&&(this.isHidden()?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete))},_setViewModelSelectedStates:function(t){for(var u,r=this.Data.AppointmentBuilder.Specialty,i=0;i<t.length;i++)(u=t[i]).ViewState=u===r?n.StatesEnum.Selected:n.StatesEnum.Unselected},__getUnfilteredSpecialties:function(){return this.Data.Specialties.toArray()},hasStickyBanner:function(){return!0}};t.ModesEnum=i;$$WP.Scheduling.SpecialtyStepController=t;t.extend($$WP.Scheduling.StepController,"WP$Scheduling$SpecialtyStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var e={Standard:0,RequestOnly:1},r={Dropdown:0,LeftSidebar:1,RightSidebar:2},k=function(n){for(var i,t=0;t<n.length;t++)for(i=0;i<n[t].length;i++)if(null!==n[t][i])return n[t];return null},l=function(n){return n.sort().join("|")+"|"},a=function(n,t,i){var r=new $$WP.Scheduling.SolutionViewModel;return r.populateFromSolution(n,t,i),r},d=function(n,t,i,r){return!!n&&!!t&&(i.contains(t)||r)},v=function(n){return n.Providers.Models[0]},o=function(n){return n.Locations.Models[0]},s=function(n){return n.SlotGroups[0][0].Slots[0]},y=function(n,t,i){for(var r=0,r=0;r<n.length;r++)if(n[r].ProviderId===t&&n[r].DepartmentId===i)return!0;return!1},g=makeStaticLink("images/calendar.svg"),p=$$WP.Common.Model,i=$$WP.Scheduling.VisitType,t=$$WP.Scheduling.Slot,nt=$$WP.Scheduling.Solution,n=$$WP.Scheduling.Workflow,f=$$WP.Scheduling.Location,w=$$WP.Scheduling.Provider,u=$$WP.Utilities.UI.TimePreferenceWidgetController,tt=$$WP.Scheduling.FilterController,it=$$WP.Scheduling.TelehealthModeController,rt=$$WP.Scheduling.SlotSelectionSummaryController,ut=$$WP.Scheduling.SchedulingInstructionsController,h=$$WP.Scheduling.TelehealthFilters,b=$$WP.Scheduling.OriginalAppointmentInfoController,c=function(n,i,r,u,f,o,s,h,c){var l;this._workflow=i;this.__slotStepSettings=u;this.__mode=f||e.Standard;this.__queryStringPreferences=this.__slotStepSettings.TimePreferences;this.__focusOnTimePreferenceLabel=!1;this.__workflowEventCallbacks=o;this.__preselectedSlotUID=s;this.__allowScrollLoading=!isDataTile()&&!$$WP.WidgetMode;this.__originalAppointmentInfo=u.OriginalAppointmentInfo;null!==u.StartDate?(this.__firstDteToShow=WP.Utils.date2dte(new Date(u.StartDate)),this.__firstDteToShow<t.todaysDte&&(this.__firstDteToShow=t.todaysDte)):this.__firstDteToShow=t.todaysDte;this.WP$Scheduling$StepController(n,r,u.AllowedProviderIds,u.PreselectedProviderIds,null,$$WP.Templates.Scheduling.SlotStep,function(){return""});this.proxify("__closePopupCallback","__onAncillaryDataChanged","__onVisitTypeChanged","__onTelehealthDataChanged","__onSlotChanged","updateStep","__onCalendarDatePicked","__onDateInputChanged","__onLoadAnotherBatchKeyDown","__onScroll","__onLoadAnotherBatchClicked","__onRequestOptionClicked","__onExpandRequestClicked","__onClearTimeFiltersClicked","__onTimePreferenceChanged","__onUseTeamsCheckboxClicked","__onUseTeamsButtonClicked","__onSelectOneApptAtATimeClicked","__onPickFullSolutionClicked","__changeMultiApptView","__editSlot","__onSlotsLoaded","__onFilterToggleClicked","__onFilterCollapseClicked","__onFilterTabPressed","__onSolutionClicked","__onAppointmentsChanged","__onRetryClick","__onApptsDetailsToggleClicked","__onTelehealthWorkflowSelected","__onTelehealthLoaded","__onDateInputKeydown","__afterSolutionPreviewSlide","__onStartOverFromWarning","__onContinueFromWarning","__onRequestFromHardStop","__getSortProviderDepartmentPairsForDisplay","__sortProviderForDisplay","__sortByAvailability","__sortProviderGroupsForDisplay","__sortProviderLocationObjectsForDisplay","__onEditLocationClicked","__onEditProviderClicked","__onClearFiltersClicked","__onResetCalendarFilterClicked","__sortLocationGroupsByAvailability","__onChangeLocationButtonClicked","__onAddVideoVisitProvidersClicked","__onShowAllProvidersClicked","__onShowOutOfNetworkProvidersClicked","__onOptInToTicketWaitListClicked");this.$root.on("keydown",'input[name="'+this.__fromDateFieldId()+'"]',this.__onDateInputKeydown);$afe.select("body").on("change","input#"+this.__fromDateFieldId(),this.__onDateInputChanged);this.$root.on("keydown",".loadanotherbatchbutton",this.__onLoadAnotherBatchKeyDown);this.$root.on("click",".loadanotherbatchbutton",this.__onLoadAnotherBatchClicked);this.$root.on("click",".request .departmentbutton",this.__onRequestOptionClicked);this.$root.on("click",".requestheader .expandrequestoptions",this.__onExpandRequestClicked);this.$root.on("change",'input[name="toggleTeams"]',this.__onUseTeamsCheckboxClicked);this.$root.on("click","#useTeamsButton",this.__onUseTeamsButtonClicked);this.$root.on("click",".oneApptAtATimeSelectbutton",this.__onSelectOneApptAtATimeClicked);this.$root.on("click",".pickFullSolutionbutton",this.__onPickFullSolutionClicked);this.$root.on("click",".filtertogglesection",this.__onFilterToggleClicked);this.$root.on("keydown",".filtersContainerFull",this.__onFilterTabPressed);this.$root.on("click",".filtercollapsesection",this.__onFilterCollapseClicked);this.$root.on("click","#clear-filters-button",this.__onClearFiltersClicked);this.$root.on("click","#clear-filters-no-providers-button",this.__onClearFiltersClicked);this.$root.on("click",".cleartimefiltersbutton",this.__onClearTimeFiltersClicked);this.$root.on("click","#clear-filters-mid-slots",this.__onClearFiltersClicked);this.$root.on("click",".resetcalendarfilterbutton",this.__onResetCalendarFilterClicked);this.$root.on("click",".slotsData",this.__onSolutionClicked);this.$root.on("click",".retryButton",this.__onRetryClick);this.$root.on("click",".apptsDetailsToggle",this.__onApptsDetailsToggleClicked);this.$root.on("click",".changeLocationBtn",this.__onChangeLocationButtonClicked);this.$root.on("click",".addVideoVisitProviders",this.__onAddVideoVisitProvidersClicked);this.$root.on("click","#showAllProvidersButton",this.__onShowAllProvidersClicked);this.$root.on("click","#showOutOfNetworkProvidersButton",this.__onShowOutOfNetworkProvidersClicked);this.$root.on("click","#optInToTicketWaitListButton",this.__onOptInToTicketWaitListClicked);this.__eventManager=new $$WP.Scheduling.EventManager;this.Data.AppointmentBuilder.addPropertyListener("UseTeams",this.__onAncillaryDataChanged);this.Data.AppointmentBuilder.addPropertyListener("CountOfFailedAttemptsToReviewSlot",this.__onAncillaryDataChanged);this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("add",this.__onAppointmentsChanged);this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("remove",this.__onAppointmentsChanged);this.Data.AppointmentBuilder.Appointments.addPropertyListener("VisitType",this.__onVisitTypeChanged);this.__onAppointmentsChanged();this.Data.TelehealthData.addPropertyListener("SelectedWorkflow",this.__onTelehealthWorkflowSelected);this.Data.TelehealthData.addPropertyListener("TelehealthLoaded",this.__onTelehealthLoaded);this.Data.AppointmentBuilder.addPropertyListener("PatientLocation",this.__onTelehealthDataChanged);this.Data.AppointmentBuilder.addPropertyListener("PatientSublocation",this.__onAncillaryDataChanged);this.Data.AppointmentBuilder.addPropertyListener("CanSearchAllLicensedVideoProviders",this.__onAncillaryDataChanged);this.Data.AppointmentBuilder.addPropertyListener("IsPatientLocationRuleRunning",this.__onAncillaryDataChanged);navigator.userAgent.match(/Trident\/7./)&&this.$root.on("mousewheel",".slotsData",function(n){n.stopPropagation()});this.__distanceUnits=u.GeolocationDistanceUnits;this.__preselectedFilters=h||[];this.__forceShowFilters=(this.isInsuranceSelectionValid()||this.__preselectedFilters.length>0)&&!this.__isAnyProviderSelectedInAllActiveAppointments();this.__availableFilters=c||[];l={IsInsuranceSelectionValid:this.isInsuranceSelectionValid(),IsAnyProviderSelectedInAllActiveAppointments:this.__isAnyProviderSelectedInAllActiveAppointments(),forceShowFilters:this.__forceShowFilters,ShowingAddAllProviders:this.__shouldShowAddAllProvidersOption(),FiltersToLoad:this.__getProviderFiltersToLoad()};this.FilterController=new tt(this.__slotStepSettings.DefaultProviderLanguages,this.Data.AppointmentBuilder,i,l,this.__preselectedFilters);this.FilterController.onFiltersChangedSameResults=this.updateStep;this.FilterController.clearProviderDepartmentFilterListener();this.FilterController.addProviderDepartmentFilterListener(this.__onAncillaryDataChanged);this.TelehealthModeController=new it(this.Data.AppointmentBuilder);this.SlotSelectionSummaryController=new rt(this.$root,this.Data,this.__editSlot,i);this.SchedulingInstructionsController=new ut(this.$root,this.Data)};c.prototype={$root:null,TimePreferenceWidget:null,FilterController:null,TelehealthModeController:null,SlotSelectionSummaryController:null,SchedulingInstructionsController:null,__selectedTimePreferenceFilterTimes:null,__selectedTimePreferenceFilterLabel:null,__checkedBox:null,__focusOnTimePreferenceLabel:null,__handleFocusAfterRedrawingSlotStep:!1,__queryStringPreferences:null,__slotStepSettings:null,__mode:null,__renderHidden:!0,__isDirty:!0,__areFiltersCollapsed:!0,__isWPPopupOpen:!1,__minDte:0,__maxDte:0,__maxCalendarDte:0,__latestUserSelectedDte:0,__firstDteToShow:0,__eventManager:null,__currentPreviewedSolution:null,__currentWarningSolution:null,__distanceUnits:null,__isSimpleMultiApptWorkflow:!1,__isComplexMultiApptWorkflow:!1,__showDetailedSolutionsView:!1,__showSingleApptSelectSolutionsView:!1,__midSlotsMultiApptViewBannerDaysBeforeContent:0,$preRedrawFocusedElement:null,__preRedrawLastDTE:0,__shouldTryFocusOnNextDTE:!1,__isTeamSchedulingAllowed:!1,__isLoadingTeams:!1,__isLoadingAdditionalProviders:!1,__workflowEventCallbacks:{},__shouldMoveOverlayDown:!1,__shouldAnimateFilters:!1,__allowScrollLoading:!0,__preselectedSlotUID:null,__hasNewFilteredSlots:!1,__adHocJoinWaitListStepController:null,__adHocPatientLocationStepController:null,__showSlotsWhenLoading:!1,__focusSlotPreview:!0,__forceShowFilters:!1,__isUserSelectingSlots:!1,__preselectedFilters:[],__numConsecutiveEmbeddedSlotLoads:0,__minimumNewSlotsNeededEachEmbeddedLoad:20,__runningCountSlotsLoadedPerEmbeddedSlotLoad:0,__onAppointmentsChanged:function(){var i,t=0,n=null;for(this.__eventManager.removeAllListeners(),i=this.Data.AppointmentBuilder.numAppointments(),t=0;t<i;t++)n=this.Data.AppointmentBuilder.getAppointment(t),this.__eventManager.addCollectionEventListener(n.Providers,"add",this.__onAncillaryDataChanged),this.__eventManager.addCollectionEventListener(n.Providers,"remove",this.__onAncillaryDataChanged),this.__eventManager.addCollectionEventListener(n.Locations,"add",this.__onAncillaryDataChanged),this.__eventManager.addCollectionEventListener(n.Locations,"remove",this.__onAncillaryDataChanged),this.__eventManager.addCollectionEventListener(n.Lqfs,"add",this.__onAncillaryDataChanged),this.__eventManager.addCollectionEventListener(n.Lqfs,"remove",this.__onAncillaryDataChanged),this.__eventManager.addModelPropertyListener(n,"Slot",this.__onSlotChanged),this.__eventManager.addModelPropertyListener(n,"SelectedTelehealthMode",this.__onTelehealthDataChanged),this.__eventManager.addModelPropertyListener(n,"CanSkipLicensureCheck",this.__onAncillaryDataChanged)},updateViewModel:function(){this.__initializeDateRange();this.__isSlotsStepHiddenForFullPageReservations()?this.stepSettings.Collapse=!0:this.__isDirty?this.__resetAndLoad():(this.__buildViewModel(),this.ViewModel.StepShouldBeActive=!0)},__isSlotsStepHiddenForFullPageReservations:function(){return this.Data.AppointmentBuilder.allAppointmentsHaveASlotSelected()&&(this.Data.AppointmentBuilder.getFirstAppointment().Slot.IsPreselected||$$WP.WidgetMode)},arePrerequisitesComplete:function(){var t,n=0;if($$WPSchedulingLqfCore.CanWorkflowSupportLqf(this._workflow.Type)&&$$WPSchedulingLqfCore.HasUnansweredQuestions(this.Data,this._workflow)||this.Data.AppointmentBuilder.IsPatientLocationRuleRunning)return!1;for(t=this.Data.AppointmentBuilder.numAppointments(),n=0;n<t;n++)if(!this.__arePrerequisitesCompleteForSingleAppointment(this.Data.AppointmentBuilder.getAppointment(n)))return!1;return!0},__arePrerequisitesCompleteForSingleAppointment:function(n){var t=n.Locations,i=this.Data.AppointmentBuilder.ReasonForVisit;return(this.__isRescheduleWorkflow()||this.__isTicketWorkflow()||this.__isDecisionTreeNodeWorkflow()||!!i)&&t.size()>0},show:function(){this.__deselectAllSlots();this.Data.AppointmentBuilder.setProperty("IsUsingProviderFilter",!1);this.__renderHidden=!1;this.WP$Scheduling$StepController$show();this.__focusStepHeader()},hide:function(){this.__renderHidden=!0;this.WP$Scheduling$StepController$hide()},beforeFirstRender:function(){var n=null;Handlebars.registerPartial("Scheduling.Solution",$$WP.Templates.Scheduling.Solution);Handlebars.registerPartial("Scheduling.SolutionDetailed",$$WP.Templates.Scheduling.SolutionDetailed);Handlebars.registerPartial("Scheduling.SolutionAlerts",$$WP.Templates.Scheduling.SolutionAlerts);Handlebars.registerHelper("hasValue",function(n,t){return $$WPUtil.IsNullOrEmpty(n)?t.inverse(this):t.fn(this)});2===this.__slotStepSettings.ShowTeamBeforeSearch&&!this.__isOpenSchedulingWorkflow()&&this.__getIsTeamSchedulingAllowed()&&this.Data.AppointmentBuilder.setProperty("UseTeams",!0);this.__preselectedSlotUID&&(n=nt.createSolutionFromUid(this.__preselectedSlotUID),this.__isPreselectedSolutionValid(n)&&(n.Slots[0].IsPreselected=!0,this.__selectSolution(n),this.stepSettings.Hide=!0))},__isPreselectedSolutionValid:function(n){return!!n&&1===n.Slots.length&&this.__isSlotValidForAppointment(n.Slots[0],this.Data.AppointmentBuilder.getFirstAppointment())},beforeRender:function(){var r=[],u=!1,t=null,i;this.$preRedrawFocusedElement=$afe.jq(document.activeElement);this.__preRedrawLastDTE=this.$root.find(".day").last().safeAttr("data-dte");i=null;this.ViewModel.CanEditLocations=$$WPSchedulingUtil.CanEditStep(this.Data,this._workflow.Type,$$WP.Scheduling.SchedulingStep.StepTypeEnum.Location,this.__slotStepSettings.IsDepartmentStepHiddenByQueryParams);this.__filtersScrollPosition=$afe.select(".filtersSectionContainer").scrollTop();1===this.Data.AppointmentBuilder.numAppointments()&&(t=this.Data.AppointmentBuilder.getFirstAppointment(),r=this.__getAvailableRequestSolutions(t),u=t.ProviderDepartmentPairs.length>0,null!==(i=this.__getSingleLocationRequestSolution(t,r))&&this.__canShowRequestWorkflow(u)&&!this.__isAtLeastOneProviderFilterSelected()&&t.setProperty("Slot",i.Slots[0]));this.ViewModel.ShowSingleApptSelectSolutionsView&&this.__setupSlotStepHeader();(this.__renderHidden||!this.__isSlotStepStackActive())&&(this.Active=!1,this.$root.hide());this._workflow&&this._workflow.Type===n.WorkflowTypesEnum.Reschedule&&0!==this.$root.find("#OriginalAppointmentInfo").length&&b.StashPortal()},__isSlotStepStackActive:function(){var n,t=null,i=null;return(n=this.Data.SchedulingSteps.getFromIndex("ID",this.Id))&&(t=this.Data.SchedulingSteps.getFromIndex("ID",n.StackId)),this.__adHocPatientLocationStepController&&(i=this.Data.SchedulingSteps.getFromIndex("ID",this.__adHocPatientLocationStepController.stepId)),this.__isStepActive(n)||this.__isStepActive(t)||this.__isStepActive(i)},__setupSlotStepHeader:function(){var u,f,r,e,n="",t="",i="";switch(r=this.Data.AppointmentBuilder.getActiveApptIndex(),e=(u=this.Data.AppointmentBuilder.getAppointment(r)).SelectedTelehealthMode,f=$$WPSchedulingUtil.GetVisitDisplayName(u,this._workflow.TicketInfo,e),r){case 0:t="FirstSlotStepTitleWithVisitType";n="@MYCHART@CURRENTVISITTYPEBEINGSELECTEDFORFIRST@";i="SlotStepTitleScreenReaderHelperForFirst";break;case 1:t="SecondSlotStepTitleWithVisitType";n="@MYCHART@CURRENTVISITTYPEBEINGSELECTEDFORSECOND@";i="SlotStepTitleScreenReaderHelperForSecondOrMore";break;case 2:t="ThirdSlotStepTitleWithVisitType";n="@MYCHART@CURRENTVISITTYPEBEINGSELECTEDFORTHIRD@";i="SlotStepTitleScreenReaderHelperForSecondOrMore";break;case 3:t="FourthSlotStepTitleWithVisitType";n="@MYCHART@CURRENTVISITTYPEBEINGSELECTEDFORFOURTH@";i="SlotStepTitleScreenReaderHelperForSecondOrMore";break;default:t="FifthOrMoreSlotStepTitleWithVisitType";n="@MYCHART@CURRENTVISITTYPEBEINGSELECTEDFORFIFTHORMORE@";i="SlotStepTitleScreenReaderHelperForSecondOrMore"}this.ViewModel.SlotStepTitleWithVisitType=t;this.SchedulingStringsNamespace.addMnemonic(n,"<span class='bold'>"+HTMLEncode(f)+"<\/span>",$$WP.Strings.EncodingTypes.None);this.ViewModel.SlotStepTitleScreenReaderHelper=i},__filterProvidersByAllowedIds:function(n,t,i){var u,r=[];return n?(u=n.filter(function(n){return n.LqfProviderAction===$$WP.Scheduling.Provider.LqfActionEnum.Added}),r=(r=this.filterByAllowedIds(n,t,i)).concat(u),r=$$WPSchedulingUtil.RemoveDuplicateElementsFromArray(r)):[]},afterRender:function(){var t,u=this.$root,i=null,f=null;t=this.__getLoadingOverlay();i=u.find(".nodata");this.Data.SlotLoader.isLoading()?(this.__showSlotsWhenLoading||this.__hideSlots(),$$WPUtil.ShowAjaxSpinner(t),i.hide(),this.__handleLoadingHeartBasedOnLoadContext()):(this.__showSlotsWhenLoading||this.__showSlots(),$$WPUtil.HideAjaxSpinner(t),i.show(),this.ViewModel.Days&&0!==this.ViewModel.Days.length||u.find(".requestSection").empty());this.__setupStartDateField();this.__allowScrollLoading&&$afe.jq(window).on("scroll",this.__onScroll);this.__isTimePreferencesWidgetVisible()&&this.__setupTimePreferencesWidget();this.__shouldShowGranularProviderFilters()&&(this.__isAnyProviderSelectedInAllActiveAppointments()||this.__forceShowFilters)&&this.__doesAnyAppointmentAllowProviderSelection()&&(this.__setupProviderFilters(),this.FilterController.draw(this.$root.find(".filtercontainerparent")));this.__forceShowFilters||this.__isAnyProviderSelectedInAllActiveAppointments()||!this.Data.AppointmentBuilder.AreProvidersFilteredBySlotStep||this.FilterController.clearAllFilters();this.__shouldAnimateFilters=!1;this.ViewModel.ShouldAnimateFilters=!1;this.__setupEmergencyMessage();this.__canShowTelehealthToggle()&&this.TelehealthModeController.render(this.$root.find(".telehealthModeContainer"));this.SlotSelectionSummaryController.render();this.SchedulingInstructionsController.render(this._workflow);this._workflow.Type===n.WorkflowTypesEnum.Reschedule&&b.Update(this.Data,this.$root.find("#SlotStepOriginalAppointmentInfo"),this.__showSingleApptSelectSolutionsView);this.__setFocusAfterRender();this.__renderOpenPreviewOrWarning();this.__handleFocusAfterRedrawingSlotStep=!1;this.$preRedrawFocusedElement=null;this.__preRedrawLastDTE=0;this.__shouldTryFocusOnNextDTE=!1;this.__isLoadingTeams=!1;this.__isLoadingAdditionalProviders=!1;this.__focusSlotPreview=!0;this.__isFullPageFilters()||this.$root.find(".filtertogglesection").safeAttr("aria-expanded",!this.__areFiltersCollapsed);(f=this.$root.find(".filtersContainerFull")).siblings().filter(":not([aria-hidden])").safeAttr("data-hide-during-modal",!0);f.parentsUntil("body > *").siblings().filter(":not([aria-hidden])").safeAttr("data-hide-during-modal",!0);this.__setupSelectionFilters();this.__setAriaHiddenForFullPageFilters();this.ViewModel.FilterPosition!==r.Dropdown||this.__areFiltersCollapsed||$afe.select(".filtersSectionContainer").scrollTop(this.__filtersScrollPosition);this.ViewModel.FilterPosition!==r.RightSidebar&&this.ViewModel.FilterPosition!==r.LeftSidebar||this.__areFiltersCollapsed||this.__showBodyElementsNoOverlay();this.__areFiltersCollapsed||this.ViewModel.FilterPosition!==r.Dropdown||!$afe.select("body, #wrap").hasClass("scrollDisabled")&&this.__isFullPageFilters()&&$afe.select("body, #wrap").addClass("scrollDisabled")},__handleLoadingHeartBasedOnLoadContext:function(){this.__getFilterPosition()===r.Dropdown&&!this.__areFiltersCollapsed||this.ViewModel.ShowExpandedRequestOptions?this.__lockLoadOverlayPosition():this.ViewModel.Days&&this.ViewModel.Days.length>0&&this.__showSlotsWhenLoading?this.__releaseLoadOverlayPosition():this.__lockLoadOverlayPosition()},onNavigateBack:function(){this.__areFiltersFullScreenExpanded()&&this.__collapseFilters()},__showSlots:function(){this.$root.find(".day").removeClass("hidden");this.$root.find(".loadmorecontainer").removeClass("hidden");this.__getFilterNoSlotsLoaded().removeClass("hidden")},__hideSlots:function(){this.$root.find(".day").addClass("hidden");this.$root.find(".loadmorecontainer").addClass("hidden");this.__getFilterNoSlotsLoaded().addClass("hidden")},__isAnyProviderSelectedInAllActiveAppointments:function(){var n,t=this.Data.AppointmentBuilder.Appointments.Models;if(this.__showSingleApptSelectSolutionsView)return t[this.Data.AppointmentBuilder.getActiveApptIndex()].IsProviderAnyOptionSelected;for(n=0;n<t.length;n++)if(!t[n].IsProviderAnyOptionSelected)return!1;return!0},__isFullPageFilters:function(){return!($$WP.WidgetMode||isDataTile())},__hideBodyElementsForOverlay:function(){var i,t=$afe.select("body");this.__isFullPageFilters()&&(this.$root.find(".summaryBannerContainer").hide(),t.find("#sidebar").hide(),t.find("#footer").hide(),$afe.select(".summary-back").addClass("invisible"),t.css("overflow-y","hidden"),t.css("touch-action","none"),t.css("position","fixed"),$afe.select("body, #wrap").addClass("scrollDisabled"),(i=$afe.select(".button.startover")).addClass("invisible"),i.prop("disabled",!0),this._workflow.IsAnonymous&&this._workflow.Type!==n.WorkflowTypesEnum.OnDemandTelehealth?this.__shouldMoveOverlayDown=!1:($afe.select("#header").addClass("compact"),$afe.select(".summaryBannerContainer").addClass("invisible"),$afe.select("#startOverMobile").addClass("invisible"),this.__shouldMoveOverlayDown=!0))},__showBodyElementsNoOverlay:function(){var t,n=$afe.select("body");this.__isFullPageFilters()&&(this.$root.find(".summaryBannerContainer").show(),n.find("#sidebar").show(),n.find("#footer").show(),$afe.select(".summary-back").removeClass("invisible"),n.css("overflow-y","scroll"),n.css("touch-action","auto"),n.css("position","relative"),$afe.select("body, #wrap").removeClass("scrollDisabled"),(t=$afe.select(".button.startover")).removeClass("invisible"),t.prop("disabled",!1),$afe.select("#header").removeClass("compact"),$afe.select(".summaryBannerContainer").removeClass("invisible"),$afe.select("#startOverMobile").removeClass("invisible"))},__setupProviderFilters:function(){for(var t,i,r,u,f=this.Data.AppointmentBuilder.numAppointments(),n=0;n<f;n++)t=this.Data.AppointmentBuilder.getAppointment(n),this.__showSingleApptSelectSolutionsView&&n!==this.Data.AppointmentBuilder.getActiveApptIndex()||(i=this.__getAllAvailableProviders(t),this.FilterController.updateAvailableProviders(i,n),r=this.__getAllAvailableProviderDepartmentPairs(t),this.FilterController.updateAvailableProviderDepartmentPairs(r,n));u={IsInsuranceSelectionValid:this.isInsuranceSelectionValid(),IsAnyProviderSelectedInAllActiveAppointments:this.__isAnyProviderSelectedInAllActiveAppointments(),forceShowFilters:this.__forceShowFilters,ShowingAddAllProviders:this.__shouldShowAddAllProvidersOption(),FiltersToLoad:this.__getProviderFiltersToLoad()};this.FilterController.updateFilterSettings(u)},__getProviderFiltersToLoad:function(){var t,r,i=[];if(this._workflow.Type===n.WorkflowTypesEnum.ProviderFinder)for(i=["IsInNetwork"],t=0;t<this.__availableFilters.length;t++)r=this.__availableFilters[t].FilterGroup,i.push(r);else i=["IsInNetwork","Gender","Languages","ClinicalInterests","Credentials","PatientAge"];return i},__getAllAvailableProviders:function(n){var i,e,r,s,u,f,t,h=n.getSelectedDepartmentsCollection(),o=$$WPSchedulingUtil.BuildProvidersFiltered(!0,!0,!1,n.ReasonForVisit,n.getSelectedDepartmentsCollection().toArray(),!1);if(i=o.slice(0),this.Data.AppointmentBuilder.UseTeams)for(f=0;f<o.length;f++)for(e=o[f].TeamProviderDepartmentPairs,r=$$WPSchedulingUtil.AddProvidersFromProviderDepartmentPairs(e,!1,!0,!1),t=0;t<r.length;t++)-1===i.indexOf(r[t])&&h.contains(e[t].Department)&&i.push(r[t]);if(this.Data.AppointmentBuilder.CanSearchAllLicensedVideoProviders&&n.isVideoVisit())for(s=this.__getAvailablePairsForPatientLocation(n),u=$$WPSchedulingUtil.AddProvidersFromProviderDepartmentPairs(s,!1,!0,!1),t=0;t<u.length;t++)-1===i.indexOf(u[t])&&i.push(u[t]);return this.Data.AppointmentBuilder.UseTeams?i:this.__filterProvidersByAllowedIds(i,"ID")},__getAllAvailableProviderDepartmentPairs:function(n){var t,i,r;if(i=$$WPSchedulingUtil.BuildProviderDepartmentPairsFiltered(!0,!1,n.ReasonForVisit).slice(0),this.Data.AppointmentBuilder.CanSearchAllLicensedVideoProviders&&n.isVideoVisit())for(r=this.__getAvailablePairsForPatientLocation(n),t=0;t<r.length;t++)-1===i.indexOf(r[t])&&i.push(r[t]);return this.__filterProviderDepartmentPairsToAvailableDepartments(n,i)},__filterProviderDepartmentPairsToAvailableDepartments:function(n,t){var i,r,f,u;if(void 0===t)return t;for(f=n.getSelectedDepartmentsCollection(),r=[],i=0;i<t.length;i++)u=t[i],f.contains(u.Department)&&r.push(u);return r},__setupTimePreferencesWidget:function(){var r,t=this.$root,n="",i=!1;($$WP.Utilities.UI.IsMobile||this.__handleFocusAfterRedrawingSlotStep)&&(this.__focusOnTimePreferenceLabel=!1);this.__shouldShowSimpleTimePreferences()?(n=u.LabelValueEnum.Other,i=!0):(n=this.__selectedTimePreferenceFilterLabel,i=!1);(r=t.find(".timepreferencecontainer")).length>0&&(this.TimePreferenceWidget=new u(r,this.__selectedTimePreferenceFilterTimes,this.__onTimePreferenceChanged,n,this.__slotStepSettings.OnFileSchedulePreferences,this.__slotStepSettings.DaysOfWeekList,this.__focusOnTimePreferenceLabel,this.__checkedBox,i),null===n&&"1"!==this.$root.find("input.clearradio:checked").val()&&this.__onTimePreferenceChanged(t.find(".timepreferencewidget input.radio:checked"),t.find(".timepreferencewidget input.clearradio:checked"),!0),$$WP.Strings.setDefaultNamespace("Scheduling"))},__setupSelectionFilters:function(){this.__shouldShowGranularProviderFilters()&&(this.$root.find("#editLocation").click(this.__onEditLocationClicked),this.$root.find("#editProvider").click(this.__onEditProviderClicked))},__setupEmergencyMessage:function(){var t=this.$root.find(".slotsstep .disclaimerContainer"),n=$$WP.Strings.getForTemplate("EmergencyDisclaimer","Scheduling"),i=$$WP.Strings.getForTemplate("EmergencyDisclaimerExpanded","Scheduling");n&&!$$WPUtil.IsNullOrEmpty(n.string)&&new $$WP.UI.ProgressiveDisclosureController(t,n,i,$$WP.UI.ProgressiveDisclosureTypeEnum.Emergency)},__renderOpenPreviewOrWarning:function(){var n=null,t=null;this.__currentWarningSolution?(n=this.__currentWarningSolution,this.__currentWarningSolution=null,this.__showSlotWarning(n,!0)):this.__currentPreviewedSolution&&(t=this.__currentPreviewedSolution,this.__currentPreviewedSolution=null,this.__openSolutionPreview(t,!0))},__setFocusAfterRender:function(){if(!this.__isWPPopupOpen&&!$$WPSchedulingUtil.IsCaptchaLightboxOpen()){if(this.ViewModel.ShowExpandedRequestOptions)return void this.__focusStepHeader();this.__handleFocusAfterRedrawingSlotStep?this.__afterSlotStepRedrawFocusHandler():this.__focusOnStepHeaderOrFilterPopup()}this.__tryLoadOnScroll()},__focusOnFilterPopup:function(){var n=this.__getFirstFocusableElementInPopup();n&&this.__focusElementRespectingFilterModalDialog(n)},__focusOnStepHeaderOrFilterPopup:function(){this.__areFiltersCollapsed?this.__focusStepHeader():this.__focusOnFilterPopup()},__focusStepHeader:function(){var n=this.$root.find("h2.header");this.__focusElementRespectingFilterModalDialog(n)},__setupStartDateField:function(){null!==this.__slotStepSettings.DateRangeSettings&&this.__slotStepSettings.DateRangeSettings.ReadOnly?this.$root.find("#"+this.__fromDateFieldId()).safeAttr("disabled"):writeCalendar(this.__fromDateFieldId(),"range",g,this.__minDte,this.__maxCalendarDte,this.__onCalendarDatePicked,null,this.__fromDateFieldId()+"_calendar");$$WP.FormValidation.initializeDOMSubtree(this.$root)},triggerViewEvent:function(){this.__hasFinishedLoadingABatch()&&this.WP$Scheduling$StepController$triggerViewEvent()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.SlotStep},__hasFinishedLoadingABatch:function(){return this.Data.SlotLoader.numIncrementalLoadsCompleted()>0||!this.Data.SlotLoader.isLoading()},__afterSlotStepRedrawFocusHandler:function(){this.Data.SlotLoader.hasVerboseError()?this.__focusElementRespectingFilterModalDialog(this.__getVerboseError()):this.__shouldTryFocusOnNextDTE?this.__tryFocusOnNextDTE():this.__setFocusBasedOnPrevious();this.SkipAfterRenderRefocus=!0},__setFocusBasedOnPrevious:function(){var n=null;1===this.$root.find(this.$preRedrawFocusedElement).length?this.$preRedrawFocusedElement.focus():this.$preRedrawFocusedElement.hasClass("slot")?this.__focusOnSlot():this.$preRedrawFocusedElement.hasClass("daterangeinput")?this.__setFocusAfterDateSelection():this.$preRedrawFocusedElement.hasClass("togglebutton")?(n=this.$root.find(".timepreferencewidget input.togglebutton[value='"+this.$preRedrawFocusedElement.val()+"']"),this.__focusElementRespectingFilterModalDialog(n)):this.$preRedrawFocusedElement.hasClass("toggleTeams")?(n=this.$root.find("#toggleTeams_"+this.Id),this.__focusElementRespectingFilterModalDialog(n)):this.$preRedrawFocusedElement.hasClass("expandSearchBtn")&&this.__isLoadingAdditionalProviders?this.__focusStepHeader():this.$preRedrawFocusedElement.hasClass("telehealthInput")?(n=this.$root.find("[data-telehealthmode="+this.$preRedrawFocusedElement.safeAttr("data-telehealthmode")+"]"),this.__focusElementRespectingFilterModalDialog(n)):this.$preRedrawFocusedElement.hasClass("changeLocationBtn")?this.__setFocusAfterChangeLocationButton():this.$preRedrawFocusedElement.hasClass("slotSelectionSummaryInput")||this.$preRedrawFocusedElement.hasClass("slotSelectionSummary")?this.__focusOnSummaryHeader():this.$preRedrawFocusedElement.hasClass("pickFullSolutionbutton")||this.$preRedrawFocusedElement.hasClass("oneApptAtATimeSelectbutton")?this.__focusStepHeader():this.__setDefaultFocus()},__focusOnSlot:function(){var n;n=this.$root.find("[data-model-id='"+this.$preRedrawFocusedElement.safeAttr("data-model-id")+"']");$$WPUtil.IsElementInView(n)&&this.__focusElementRespectingFilterModalDialog(n)},__setFocusAfterDateSelection:function(){var n=null;n=this.$root.find("#"+this.__fromDateFieldId());$$WPUtil.IsElementInView(n)&&n.length>0&&(this.__focusElementRespectingFilterModalDialog(n),n[0].selectionStart=n[0].selectionEnd=n.val().length)},__setFocusAfterChangeLocationButton:function(){var n,t,i;n=this.Data.AppointmentBuilder.getActiveApptIndex();t=this.Data.AppointmentBuilder.getAppointment(n).SelectedTelehealthMode;i=this.$root.find("[data-telehealthmode="+t+"]");this.__focusElementRespectingFilterModalDialog(i)},__focusOnSummaryHeader:function(){var n;n=this.$root.find(".slotSelectionSummary");$$WPUtil.IsElementInView(n)&&this.SlotSelectionSummaryController.focusOnSummaryHeader(this.$preRedrawFocusedElement.safeAttr("data-appointment-index"))},__setDefaultFocus:function(){var t,n=null;if(n=this.__areFiltersCollapsed?this.$root.find("h2.header"):this.__getFirstFocusableElementInPopup(),t=this.__getEquivalentElementAfterRedraw(this.$preRedrawFocusedElement))$$WPUtil.IsElementInView(t)&&this.__focusElementRespectingFilterModalDialog(t);else if(this.$preRedrawFocusedElement.hasClass("header")&&this.SlotSelectionSummaryController.findContainer().length>0&&this.Data.AppointmentBuilder.getActiveApptIndex()>0)this.__focusStepHeader();else{if(!n||0===n.length||!$$WPUtil.IsElementInView(n))return;this.__focusStepHeader()}},__getEquivalentElementAfterRedraw:function(n){var t=null,i=n.safeAttr("data-model-id"),r=n.safeAttr("id");return $$WP.Utilities.IsNullOrEmpty(i)?$$WP.Utilities.IsNullOrEmpty(r)||(t=this.$root.find("#"+$.escapeSelector(r))):t=this.$root.find("[data-model-id='"+i+"']"),($$WP.Utilities.IsNullOrEmpty(t)||0===t.length)&&(t=null),t},__focusElementRespectingFilterModalDialog:function(n){this.__areFiltersFullScreenExpanded()?this.$root.find(".filtersContainerFull").has(n).length>0&&$$WPSchedulingUtil.FocusElement(n):$$WPSchedulingUtil.FocusElement(n)},__tryFocusOnNextDTE:function(){var n,t=this.$root.find("[data-dte='"+this.__preRedrawLastDTE+"']").next();t&&t.length>0&&(n=t.find(".slot").first())&&n.length>0&&$$WPUtil.IsElementInView(n)?this.__focusElementAndDisableFocusSlotPreview(n):this.__tryFocusOnLoadMore()},__tryFocusOnLoadMore:function(){$$WPUtil.IsElementInView(this.$preRedrawFocusedElement)?this.__focusElementAndDisableFocusSlotPreview(this.$preRedrawFocusedElement):this.__tryFocusOnLastDTE()},__tryFocusOnLastDTE:function(){var n,t=this.$root.find("[data-dte='"+this.__preRedrawLastDTE+"']");t&&t.length>0&&(n=t.find(".slot").last(),$$WPUtil.IsElementInView(n)&&this.__focusElementAndDisableFocusSlotPreview(n))},__focusElementAndDisableFocusSlotPreview:function(n){this.__focusElementRespectingFilterModalDialog(n);this.__focusSlotPreview=!1},__isTimePreferencesWidgetVisible:function(){return this.__isTimePreferencesFilteringEnabled()&&!this.__queryStringPreferences},__isTimePreferencesFilteringEnabled:function(){return!this.__slotStepSettings.DateRangeSettings.ReadOnly&&!this.__slotStepSettings.UseOnFileTimePreferences&&!this.__showDetailedSolutionsView},__tryLoadOnScroll:function(){this.__isOkToLoadByScroll()&&(this.__showSlotsWhenLoading=!0,this.__handleFocusAfterRedrawingSlotStep=!0,this.__loadNextSlotsBatch())},__isOkToLoadByScroll:function(){return this.__allowScrollLoading&&this.__isSlotStepStackActive()&&this.__canSearchMoreDates()&&!this.Data.SlotLoader.isLoading()&&this.Data.SlotLoader.isLastLoadSuccess()&&this.__isWithinScrollLoadLimit()&&this.__isBottomOfSlotsInView()},__canSearchMoreDates:function(){return this.Data.SlotLoader.getSearchRangeEndDte()<this.__maxDte&&!this.Data.SlotLoader.isStopSearch()||this.Data.SlotLoader.isSearchRangeEndDtePartiallyLoaded()},__isWithinScrollLoadLimit:function(){return this.Data.SlotLoader.numIncrementalDateRangeLoadsCompleted()<4},__isBottomOfSlotsInView:function(){var n=this.$root.find(".slotsData"),t;return n.length<1?!1:(t=window.innerHeight+$afe.jq(window).scrollTop(),n.offset().top+n.outerHeight()-2*parseInt(n.find(".day").last().css("padding-bottom"),10)<=t)},__isOkToShowLoadMoreLink:function(){return this.__canSearchMoreDates()&&!this.Data.SlotLoader.isLoading()&&!this.__slotStepSettings.DateRangeSettings.NoIncremental&&(this.Data.SlotLoader.canAttemptToRecoverFromError()||!this.__isWithinScrollLoadLimit()||!this.__allowScrollLoading||this.ViewModel.NoSlotsShown)},__onSolutionClicked:function(n){var i=$afe.jq(n.target).closest("[data-model-id]"),r=i.safeAttr("data-model-id"),t=p.getInstance(r);this.Data.AppointmentBuilder.IsSlotSelectionBlocked||0!==i.length&&(!t||t.Slots.length!==this.Data.AppointmentBuilder.numAppointments()||t.IsRequest?$afe.jq(n.target).closest("#solutionpreview").length>0||this.__closeSolutionPreview(this.__currentPreviewedSolution):this.__shouldShowSlotWarning(t)?this.__showSlotWarning(t,!1,i):this.__shouldPreviewSolution(t,i)?this.__previewSolution(t):this.__selectSolution(t))},__shouldShowSlotWarning:function(n){var t=this.Data.AppointmentBuilder.getActiveApptIndex();return n.Slots[t].IsAllowedDuplicate&&!this.__hasShownAllowedDuplicateWarning(n)||n.Slots[t].IsDisallowedDuplicate},__hasShownAllowedDuplicateWarning:function(n){for(var t=0,i=this.Data.AppointmentBuilder.getActiveApptIndex(),t=0;t<i;t++)if(n.Slots[t].IsAllowedDuplicate)return!0;return!1},__shouldPreviewSolution:function(n,t){return n.Slots.length>1&&this.__isSimpleMultiApptWorkflow&&!this.__showSingleApptSelectSolutionsView&&t.hasClass("slot")},__previewSolution:function(n){this.__currentPreviewedSolution===n?this.__closeSolutionPreview(this.__currentPreviewedSolution):this.__currentPreviewedSolution?(this.__closeSolutionPreview(this.__currentPreviewedSolution,!0),this.__openSolutionPreview(n,!0)):this.__currentWarningSolution?(this.__removeSlotWarning(this.__currentWarningSolution,!0),this.__openSolutionPreview(n,!0)):this.__openSolutionPreview(n)},__showSlotWarning:function(n,t,i){var r=null,f=null,e=null,u=null;if(this.__currentPreviewedSolution!==n)if(this.__currentWarningSolution!==n){if(this.__currentWarningSolution&&this.__removeSlotWarning(this.__currentWarningSolution,!0),this.__currentPreviewedSolution&&this.__closeSolutionPreview(this.__currentPreviewedSolution,!0),this.__currentWarningSolution=n,r=this.$root.find(".slot[data-model-id='"+n.ModelId+"']"),(u=this.$root.find("#slotwarning")).empty().safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.SlotWarning,this.__buildWarningViewModel(n))),r.length>0)f=this.__findLastSlotGroupElementInRow(r.parent()),this.__grayOutOtherSlots(),this.__expandSelectedSlot(r),this.__addSlotsWarningAfterElement(u,r.parent(),f,t);else{if((e=this.$root.find("a[data-model-id='"+n.ModelId+"']").closest(".card.solution")).length<1)return;this.__addSlotsWarningAfterElement(u,e.find(".solutiondetails "))}this.__bindSlotWarningEvents()}else this.__removeSlotWarning(n);else this.__shouldPreviewSolution(n,i)?this.__closeSolutionPreview(n):this.__selectSolution(n)},__addSlotsWarningAfterElement:function(n,t,i,r){var u=r?0:400,f=void 0!==i;f&&this.__addSolutionPreviewOrWarningSpacer(n,i,u);n.safeInsertAfter(t).slideDown(u,"",this.__afterSolutionPreviewSlide).addClass(f?"withSpacer":"");this.__shouldFocusSlotPreview(n)&&this.__focusElementRespectingFilterModalDialog(n.find(".warningMessage"))},__addSolutionPreviewOrWarningSpacer:function(n,t,i){var u=this.__getContainerHeight(n),r=$afe.renderTemplate($$WP.Templates.Scheduling.SlotWarningSpacer);r.height(u);r.safeInsertAfter(t).slideDown(i);this.__startListenAndReactToScreenSizeChange()},__bindSlotWarningEvents:function(){this.$root.find("#slotwarning .warningStartOver").on("click",this.__onStartOverFromWarning);this.$root.find("#slotwarning .warningContinue").on("click",this.__onContinueFromWarning);this.$root.find("#slotwarning .warningRequest").on("click",this.__onRequestFromHardStop)},__onStartOverFromWarning:function(){this.__workflowEventCallbacks.onNavigateBack()},__onContinueFromWarning:function(){var n=this.__currentWarningSolution;this.__currentWarningSolution.Slots.length>1&&!this.__shouldShowDetailedSolutionView()&&!this.__showSingleApptSelectSolutionsView?(this.__removeSlotWarning(n,!0),this.__previewSolution(n)):this.__selectSolution(this.__currentWarningSolution)},__onRequestFromHardStop:function(){var n=this.__getRequestSlotFromTimeSlot(this.__currentWarningSolution),t=this.Data.AppointmentBuilder.getActiveApptIndex();this.Data.AppointmentBuilder.getFirstAppointment().setProperty("Slot",n);this.Data.AppointmentBuilder.DidRequestFromHardStop=this.__currentWarningSolution.Slots[t].IsDisallowedDuplicate;this.Data.AppointmentBuilder.DidContinueFromSoftStop=!1;this.__renderHidden=!0;this.$root.hide()},__getRequestSlotFromTimeSlot:function(n){var r=n.Slots[0].ProviderId,u=n.Slots[0].DepartmentId,t=this.ViewModel.ProvidersForRequest.map(function(n){return n.Provider.ID}).indexOf(r),i;return-1===t?null:(i=this.ViewModel.ProvidersForRequest[t].Slots.map(function(n){return n.DepartmentId}).indexOf(u),-1===i?null:this.ViewModel.ProvidersForRequest[t].Slots[i])},__shouldShowRequestOnHardStop:function(n){return null!==this.__getRequestSlotFromTimeSlot(n)},__buildWarningViewModel:function(n){var f,i="",t=this.Data.AppointmentBuilder.getActiveApptIndex(),e=n.Slots[t].IsAllowedDuplicate,r=n.Slots[t].IsDisallowedDuplicate,s=$$WPSchedulingUtil.FormatDteAsDate(n.Slots[t].DuplicateEncounterDte),h=n.Slots[t].DuplicateVisitTypeName,u="",o=r&&this.__shouldShowRequestOnHardStop(n);return this.SchedulingStringsNamespace.addMnemonic("@MYCHART@DUPLICATEVISITTYPENAME@",h),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@DUPLICATEAPPOINTMENTDATE@",s),$$WP.Strings.setDefaultNamespace("Scheduling"),e?(i=$$WP.Strings.getForTemplate("DuplicateAppointmentsWarning"),u="library.svg#scheduling_warning"):r&&(i=o?$$WP.Strings.getForTemplate("DuplicateAppointmentsErrorRequest"):$$WP.Strings.getForTemplate("DuplicateAppointmentsErrorHardStop"),u="library.svg#scheduling_error"),f={IsAllowedDuplicate:e,IsDisallowedDuplicate:r,IconKey:u,DisplayString:i,ShowRequestButton:o},this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@DUPLICATEVISITTYPENAME@"),this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@DUPLICATEAPPOINTMENTDATE@"),$$WP.Strings.clearDefaultNamespace(),f},__startListenAndReactToScreenSizeChange:function(){$afe.jq(window).off("resize").resize(this.__reactToScreenSizeChange.bind(this))},__reactToScreenSizeChange:function(){setTimeout(function(){var t=this.$root.find("#solutionpreview"),u,n,r,e;if((t.length<1||t.children().length<1)&&(t=this.$root.find("#slotwarning")),u=this.__getContainerHeight(t),n=this.$root.find(".slotWarningSpacer, .solutionPreviewSpacer"),n.height(u),r=this.__currentPreviewedSolution||this.__currentWarningSolution,null!==r){n.hide();var o=this.$root.find(".slot[data-model-id='"+r.ModelId+"']"),i=this.__findLastSlotGroupElementInRow(o.parent()),s=i.find(".slot").safeAttr("data-model-id"),f=n.prev(".slotgroup").find(".slot").safeAttr("data-model-id");f&&s!==f?(n.remove(),e=i.hasClass("preview")?i.next():i,this.__addSolutionPreviewOrWarningSpacer(t,e,0)):n.show()}}.bind(this),0)},__getContainerHeight:function(n){return n.outerHeight()},__stopListenToScreenSizeChange:function(){$afe.jq(window).off("resize")},__removeSlotWarning:function(n,t){if(n){var i,r=null,u=t?0:400;i=this.$root.find(".slot[data-model-id='"+n.ModelId+"']");r=this.$root.find("#slotwarning");this.__ungrayOutOtherSlots();this.__shrinkPreviouslySelectedSlot(i);this.$root.find(".slotWarningSpacer").slideUp(u,"",function(){$afe.jq(this).remove()});r.slideUp(u,"",this.__afterSolutionPreviewSlide);this.__stopListenToScreenSizeChange();this.__currentWarningSolution=null}},__openSolutionPreview:function(n,t){var r=null,u=null,i=null,f={},e=t?0:400;(r=this.$root.find(".slot[data-model-id='"+n.ModelId+"']")).length>0&&(i=this.$root.find("#solutionpreview"),u=this.__findLastSlotGroupElementInRow(r.parent()),f={Solution:n,SolutionViewModel:a(this.Data,n,this._workflow)},i.empty().safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.SolutionPreview,f)),this.__addSolutionPreviewOrWarningSpacer(i,u,e),this.__grayOutOtherSlots(),this.__expandSelectedSlot(r),i.safeInsertAfter(r.parent()).slideDown(e,"",this.__afterSolutionPreviewSlide).addClass("withSpacer"),this.__shouldFocusSlotPreview(i)&&this.__focusElementRespectingFilterModalDialog(i.find(".verticalSubwayStop:first-child")),this.__currentPreviewedSolution=n)},__shouldFocusSlotPreview:function(n){return this.__focusSlotPreview&&$$WPUtil.IsElementInView(n)},__closeSolutionPreview:function(n,t){var r=null,i=null,u=t?0:400;n&&(r=this.$root.find(".slot[data-model-id='"+n.ModelId+"']"),i=this.$root.find("#solutionpreview"),this.__ungrayOutOtherSlots(),this.__shrinkPreviouslySelectedSlot(r),i.slideUp(u,"",this.__afterSolutionPreviewSlide),this.$root.find(".solutionPreviewSpacer").slideUp(u,"",function(){$afe.jq(this).remove();i.removeClass("withSpacer");i.empty()}),this.__stopListenToScreenSizeChange());this.__currentPreviewedSolution=null},__grayOutOtherSlots:function(){this.$root.find(".slotsData").addClass("previewmode")},__ungrayOutOtherSlots:function(){this.$root.find(".slotsData").removeClass("previewmode")},__expandSelectedSlot:function(n){n.parent().addClass("preview");n.safeAttr("aria-expanded",!0)},__shrinkPreviouslySelectedSlot:function(n){n.parent().removeClass("preview");n.safeAttr("aria-expanded",!1).blur()},__afterSolutionPreviewSlide:function(){this.__reactToScreenSizeChange()},__findLastSlotGroupElementInRow:function(n){for(var t=null,i=null,r=0,t=n,r=0;r<n.siblings(".slotgroup").length;r++){if(0===(i=t.nextAll(".slotgroup").first()).length||i.position().top>t.position().top)return t;t=i}return t},__selectSolution:function(n){this.__isUserSelectingSlots=!0;this.__showSingleApptSelectSolutionsView?this.__selectSingleSlot(n):this.__selectAllSlots(n)},__selectSingleSlot:function(n){var t=this.Data.AppointmentBuilder.getActiveApptIndex(),r=this.Data.AppointmentBuilder.getAppointment(t),i=null;this.Data.AppointmentBuilder.DidContinueFromSoftStop=n.Slots[t].IsAllowedDuplicate;this.__addSlotToAppointment(t,n);t+1<this.Data.AppointmentBuilder.numAppointments()&&this.__setNextApptSearchDte(t+1,n);this.Data.AppointmentBuilder.allAppointmentsHaveASlotSelected()||(this.__focusStepHeader(),i=r.Slot.Dte,this.__firstDteToShow===i?(this.__lockLoadOverlayPosition(),this.__resetAndLoad()):this.__changeSlotDateRange(i),this.$root.find('input[name = "'+this.__fromDateFieldId()+'"]').val($$WPSchedulingUtil.FormatDteAsDate(this.__firstDteToShow)),this.updateStep())},__selectAllSlots:function(n){var t=0,i=this.Data.AppointmentBuilder.numAppointments();for(this.Data.AppointmentBuilder.DidContinueFromSoftStop=n.Slots[0].IsAllowedDuplicate,t=0;t<i;t++)this.__addSlotToAppointment(t,n)},__deselectAllSlots:function(){this.__isUserSelectingSlots=!1;this.Data.AppointmentBuilder.deselectAllSlots()},__addSlotToAppointment:function(n,t){var i=this.Data.AppointmentBuilder.getAppointment(n),r=t.Slots[n];r.IsApptSrchHeld=!0;i.setProperty("Slot",null);i.setProperty("Slot",r);i.setProperty("SearchStartDte",this.__firstDteToShow)},__setNextApptSearchDte:function(n,t){var i=this.Data.AppointmentBuilder.getAppointment(n),r=t.Slots[n];null!==i&&null!==r&&i.setProperty("SearchStartDte",r.Dte)},__onSlotChanged:function(n){var t=n.from,i=n.to;this.Data.AppointmentBuilder.allAppointmentsHaveASlotSelected()?(this.Data.AppointmentBuilder.DidIncludeAdditionalProvidersInSearch&&1===this.__slotStepSettings.AllowedProviderIds.length&&this.Data.AppointmentBuilder.setProperty("DidScheduleWithAddedProvider",!this.__slotStepSettings.AllowedProviderIds.includes(i.ProviderId)),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete),this._workflow.MultiApptSlotStepSelectionView=this.__determineMultiApptSlotStepView(),this.updateStep(),this.__isSlotsStepHiddenForFullPageReservations()&&this.$root.hide()):(t&&this.__showSingleApptSelectSolutionsView&&(this.__shouldResetPatientLocation()&&(this._workflow.ResetPatientLocationToDefault(),this.__adHocPatientLocationStepController=null),this.__isDirty=!0,this.__initializeDateRange(),this.__changeSlotDateRange(this.__latestUserSelectedDte),this.__eventManager.removelListenersFromModel(t)),this.getComplete()!==$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete||this.Data.AppointmentBuilder.IsSlotStepMultiApptPreGrouped||this.FilterController.clearAllFilters(),!this.__isUserSelectingSlots&&t&&this.getComplete()===$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete&&(this.__isDirty=!0),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.updateStep());this.Data.AppointmentBuilder.DidRequestFromHardStop=!1},__determineMultiApptSlotStepView:function(){if(this.Data.AppointmentBuilder.numAppointments()>1){if(this.__isSimpleMultiApptWorkflow&&!this.__showSingleApptSelectSolutionsView)return n.MultiApptSlotStepViewTypeEnum.SimpleSlotsView;if(this.__showSingleApptSelectSolutionsView)return n.MultiApptSlotStepViewTypeEnum.OneApptAtATimeView;if(this.__isComplexMultiApptWorkflow&&!this.__showSingleApptSelectSolutionsView)return n.MultiApptSlotStepViewTypeEnum.DetailedPreGroupedView}},__onVisitTypeChanged:function(){this.__showSingleApptSelectSolutionsView=this.Data.AppointmentBuilder.showAsMultipleVisits(this.Data.VisitTypes);this.__isSimpleMultiApptWorkflow=!1;this.__isComplexMultiApptWorkflow=!1;this.__showDetailedSolutionsView=!1;this.Data.AppointmentBuilder.setProperty("CanSearchAllLicensedVideoProviders",!1);!this.__showSingleApptSelectSolutionsView&&this.Data.AppointmentBuilder.numAppointments()>1&&(this.Data.AppointmentBuilder.IsSlotStepMultiApptPreGrouped=!0);this.__onAncillaryDataChanged()},__onTelehealthDataChanged:function(){this.__handleFocusAfterRedrawingSlotStep=!0;this.__onAncillaryDataChanged()},__onAncillaryDataChanged:function(){var n=!1;this.Data.AppointmentBuilder.setProperty("AreProvidersFilteredBySlotStep",this.__isAtLeastOneProviderFilterSelected());this.Data.AppointmentBuilder.CanUpdateAvailableProviders&&(this.FilterController.resetSelectedProviders(),this.Data.AppointmentBuilder.setProperty("CanUpdateAvailableProviders",!1));this.__isTeamSchedulingAllowed=this.__getIsTeamSchedulingAllowed();null!==this.ViewModel&&(n=this.ViewModel.TeamSchedulingDefaultChecked);this.__isTeamSchedulingAllowed||n||this.Data.AppointmentBuilder.setProperty("UseTeams",!1);this.__recalculateProvDepPairs();this.__areAllSelectedSlotsValid()||this.__deselectAllSlots();(this.__isSimpleMultiApptWorkflow&&!this.Data.AppointmentBuilder.hasAllSameSingleLocationSelected()||this.__isComplexMultiApptWorkflow&&this.Data.AppointmentBuilder.hasAllSameSingleLocationSelected())&&(this.__isSimpleMultiApptWorkflow=!1,this.__isComplexMultiApptWorkflow=!1);this.__isDirty=!0;this.__firstDteToShow===this.__minDte&&(this.__firstDteToShow=0);this.__setupProviderFilters();this.updateStep();this.Data.AppointmentBuilder.setProperty("CanSkipPatientLocationStep",this.__canSkipPatientLocationStep())},__getSortProviderDepartmentPairsForDisplay:function(n){var t=n.areLocationsGrouped(),i=this.Data.Locations,r=this.__sortProviderLocationObjectsForDisplay;return function(n,u){var e,o;return e=f.getLocationFromDepartment(n.Department,i,t),o=f.getLocationFromDepartment(u.Department,i,t),r(n.Provider,e,u.Provider,o,null,null)}},__sortProviderGroupsForDisplay:function(n,t){var i,r,u,f,e,h;return this.__shouldShowLocationHeaders()&&(this.__canSortByAvailability()?(n.LocationGroups.sort(this.__sortLocationGroupsByAvailability),t.LocationGroups.sort(this.__sortLocationGroupsByAvailability)):(n.LocationGroups.sort(this.__sortLocationGroupsForDisplay),t.LocationGroups.sort(this.__sortLocationGroupsForDisplay))),i=v(n),r=v(t),u=o(n.LocationGroups[0]),f=o(t.LocationGroups[0]),e=s(n.LocationGroups[0]),h=s(t.LocationGroups[0]),this.__sortProviderLocationObjectsForDisplay(i,u,r,f,e,h)},__sortProviderLocationObjectsForDisplay:function(n,t,i,r,u,e){return this.__canSortLocationsByDistance()?f.doLocationsHaveSameRoundedDistanceToUser(t,r)?this.__sortProviderForDisplay(u,e,n,i):f.sortLocationPairByDistance(t,r):this.__sortProviderForDisplay(u,e,n,i)},__canSortLocationsByDistance:function(){var i=0,n=null,t=!1;return this.__showSingleApptSelectSolutionsView?(i=this.Data.AppointmentBuilder.getActiveApptIndex(),(n=this.Data.AppointmentBuilder.getAppointment(i)).VisitType&&n.isAppointmentInPerson()&&n.Locations.toArray().length>1&&(t=!0)):t=this.__doesAnyAppointmentWithMultipleLocationsDisplayLocationInformation(),t&&!this.__canSortByAvailability()},__sortProviderForDisplay:function(n,t,i,r){var u=0;return this.__canSortByAvailability()&&(u=this.__sortByAvailability(n,t)),0===u&&(u=w.sortProviderPair(i,r,w.SortMethodEnum.NameLastFirst)),u},__canSortByAvailability:function(){return!this.__isNewProviderWorkflow()&&this.__slotStepSettings.IsSortingByAvailability},__sortLocationGroupsByAvailability:function(n,i){var r=s(n),u=s(i);return t.slotSortFunction(r,u)},__sortByAvailability:function(n,i){return n&&i?t.slotSortFunction(n,i):0},__sortLocationGroupsForDisplay:function(n,t){var i=o(n),r=o(t);return f.sortLocationPairByDistance(i,r)},__areAllSelectedSlotsValid:function(){for(var r=null,n=0,u=null,t=!0,i=this.Data.AppointmentBuilder.numAppointments(),n=0;n<i;n++)(r=(u=this.Data.AppointmentBuilder.getAppointment(n)).Slot)&&(t=t&&this.__isSlotValidForAppointment(r,u));return t},__isSlotValidForAppointment:function(n,t){var r,o,s,h,c,l=[],a=[],v=null,y="",e=!1,u=[],p=[],w=!1,f=0;if(r=this.Data.Providers.getFromIndex("ID",n.ProviderId),o=this.Data.Departments.getFromIndex("ID",n.DepartmentId),l=t.getSelectedDepartmentsCollection(),a=t.Providers,$$WPUtil.IsNullOrEmpty(n.SlotKey)?e=!!(v=this.Data.AppointmentBuilder.ReasonForVisit)&&v.DefaultVisitTypeId===n.VisitTypeId:(y=this.__getSlotKeyForCurrentSelections(),e=n.slotKey===y),this.Data.AppointmentBuilder.CanSearchAllLicensedVideoProviders)for(u=this.__getAvailablePairsForPatientLocation(t),p=$$WPSchedulingUtil.AddProvidersFromProviderDepartmentPairs(u,!1,!0,!1),f=0;f<u.length;f++)if(u[f].DepartmentId===n.DepartmentId){w=!0;break}return s=l.contains(o)||w,h=this.__isProviderAvailableForSlots(r,t)&&(a.contains(r)||p.includes(r)),c=(n.TelehealthMode||i.TelehealthModeEnum.NotDefined)===(t.SelectedTelehealthMode||i.TelehealthModeEnum.NotDefined),(e||this.Data.AppointmentBuilder.numAppointments()>1)&&s&&h&&c},__onTelehealthWorkflowSelected:function(){this.Data.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing||this.Data.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.QuickSchedule||null===this.Data.TelehealthData.SelectedWorkflow?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):(this.__isDirty=!0,this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete));this.__isTeamSchedulingAllowed=this.__getIsTeamSchedulingAllowed();this.updateStep()},__onTelehealthLoaded:function(){this._workflow.Type===n.WorkflowTypesEnum.OnDemandTelehealth&&this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired);this.updateStep()},__isProviderAvailableForSlots:function(n,t){var r,u,i=0;if(!n||!t||!(r=t.ProviderDepartmentPairs))return!1;for(u=r.length,i=0;i<u;i++)if(r[i].ProviderId===n.ID)return!0;return!1},__getIsTeamSchedulingAllowed:function(){var n;return n=this.Data.AppointmentBuilder.getFirstAppointment(),this.__getTeamOnlyProviders(n).length>0},__getTeamOnlyProviders:function(t){var i,e=[],r=[],u=[],f=[];return i=this.__getAvailableDirectTeamProviderDepartmentPairs(t),this._workflow.Type===n.WorkflowTypesEnum.ExistingProvider?f=i:(selectedVisitType=t.VisitType,u=this.__getAvailableDirectNonTeamProviderDepartmentPairs(t),r=(u=this.__filterPairsByFilterSelections(u,t)).slice(),this.__appendProviderDepartmentPairs(r,i),e=$$WPSchedulingUtil.BuildProviderDepartmentPairsFiltered(!0,!1,t.ReasonForVisit),f=this.__removeProviderArray(r,e)),f},__removeProviderArray:function(n,t){return n.filter(function(n){return!y(t,n.ProviderId,n.DepartmentId)})},__buildViewModelForMidSlotsMultiApptBanner:function(){var n=0,t=!1,i=0;this.__showDetailedSolutionsView&&0===this.__midSlotsMultiApptViewBannerDaysBeforeContent?this.__midSlotsMultiApptViewBannerDaysBeforeContent=1:0===this.__midSlotsMultiApptViewBannerDaysBeforeContent&&(this.__midSlotsMultiApptViewBannerDaysBeforeContent=3);0!==this.__midSlotsMultiApptViewBannerDaysBeforeContent&&(n=this.__getMidSlotsShowBeforeDte(this.__midSlotsMultiApptViewBannerDaysBeforeContent,this.__firstDteToShow+730));0!==n||this.__canSearchMoreDates()&&!this.ViewModel.ShowLoadAnotherBatch||(t=!0,this.ViewModel.Days.length>0&&(i=this.ViewModel.Days.length,this.__midSlotsMultiApptViewBannerDaysBeforeContent=i));this.ViewModel.MultiApptViewBannerShowBeforeDte=n;this.ViewModel.MultiApptViewBannerShowAfterSlots=t},__buildViewModelForMidSlotsTeams:function(){var n=this.SchedulingStringsNamespace.getString("SeeMoreTimesHeading"),t=this.SchedulingStringsNamespace.getString("TeamsHelpText"),i=this.SchedulingStringsNamespace.getString("UseTeamsCheckbox");this.__buildViewModelForMidSlotsBanner("useTeamsButton",n,t,i)},__buildViewModelForMidSlotsShowAllProviders:function(){var n=this.SchedulingStringsNamespace.getString("ShowAllProvidersHeader"),t=this.SchedulingStringsNamespace.getString("ShowAllProvidersHelpText"),i=this.SchedulingStringsNamespace.getString("ShowAllProvidersButton");this.__buildViewModelForMidSlotsBanner("showAllProvidersButton",n,t,i)},__buildViewModelForMidSlotsShowOutOfNetworkProviders:function(){var n=this.SchedulingStringsNamespace.getString("ShowOutOfNetworkProvidersHeader"),t=this.SchedulingStringsNamespace.getString("ShowOutOfNetworkProvidersHelpText"),i=this.SchedulingStringsNamespace.getString("ShowOutOfNetworkProvidersButton");this.__buildViewModelForMidSlotsBanner("showOutOfNetworkProvidersButton",n,t,i)},__buildViewModelForMidSlotsBanner:function(n,t,i,r){var u,f=!1;0!==(u=this.__getMidSlotsShowBeforeDte(3,this.__firstDteToShow+28))||this.__canSearchMoreDates()||(f=!0);this.ViewModel.ShowMidSlotsBanner=!0;this.ViewModel.MidSlotsBannerViewModel={MidSlotsBannerShowBeforeDte:u,MidSlotsBannerShowAfterSlots:f,MidSlotsBannerButtonId:n,MidSlotsBannerHeader:t,MidSlotsBannerHelpText:i,MidSlotsBannerButtonText:r}},__getMidSlotsShowBeforeDte:function(n,t){var r=0,u=0,i;if(this.ViewModel.Days.length>0)for(i=0;i<this.ViewModel.Days.length;i++)if((r=this.ViewModel.Days[i].Dte)>t||i>=n){u=r;break}return u},__buildViewModelForMidSlotsFilters:function(){var n;this.ViewModel.Days.length>1&&(n=this.ViewModel.Days[1].Dte,this.ViewModel.FiltersHelperShowBeforeDte=n,this.ViewModel.FiltersHelperShowMidSlots=!0)},__isDteFourWeeksAway:function(n){return n>this.__firstDteToShow+28},__getAllowTeamScheduling:function(n,t){var u,r;return u=this.Data.VisitTypeDepartmentOverrides.getFromIndex("Id",n.ID+"^"+t.ID),$$WPUtil.IsNullOrEmpty(u)||(r=u.AllowTeamScheduling),$$WP.Utilities.IsNullOrEmpty(r)&&(r=t.AllowTeamScheduling),$$WP.Utilities.IsNullOrEmpty(r)&&(r=n.AllowTeamScheduling),$$WP.Utilities.IsNullOrEmpty(r)&&(r=this.__slotStepSettings.AllowTeamScheduling||i.AllowTeamSchedulingEnum.NoTeamScheduling),r},__onCalendarDatePicked:function(n,t,i,r){var u,f;r&&(u=new Date(n,t,i),f=new $$WP.I18N.Date(formatDate(u),"string"),r.value=$$WP.I18N.formatPatientGivenDate(f.DateObject),this.__latestUserSelectedDte=WP.Utils.date2dte(u),this.__changeSlotDateRange(WP.Utils.date2dte(u)))},__onUseTeamsCheckboxClicked:function(n){this.__setUseTeamsProperty(n.currentTarget.checked);$$WPSchedulingUtil.FocusElement(n.currentTarget);this.__isLoadingTeams=!0},__onUseTeamsButtonClicked:function(){this.__setUseTeamsProperty(!0);this.__isLoadingTeams=!0},__setUseTeamsProperty:function(n){this.Data.AppointmentBuilder.setProperty("UseTeams",n);this.ViewModel.TeamSchedulingDefaultChecked=this.Data.AppointmentBuilder.UseTeams},__onSelectOneApptAtATimeClicked:function(){this.__changeMultiApptView()},__onPickFullSolutionClicked:function(){this.__changeMultiApptView()},__changeMultiApptView:function(){var n=0,t=0;this.__shouldShowGranularProviderFilters()&&this.__isAnyProviderSelectedInAllActiveAppointments()&&(this.FilterController.clearAllFilters(),this.FilterController.filterProvidersBySelection());this.__showSingleApptSelectSolutionsView=!this.__showSingleApptSelectSolutionsView;this.Data.AppointmentBuilder.IsSlotStepMultiApptPreGrouped=!this.Data.AppointmentBuilder.IsSlotStepMultiApptPreGrouped;this.__isComplexMultiApptWorkflow&&(this.__showDetailedSolutionsView=!this.__showDetailedSolutionsView);this.__closeSolutionPreview(this.__currentPreviewedSolution);this.__removeSlotWarning(this.__currentWarningSolution,!0);this.__focusStepHeader();this.Data.AppointmentBuilder.isContainingSelectedSlots()?(this.__showSingleApptSelectSolutionsView?(this.Data.AppointmentBuilder.holdSelectedSlots(),this.Data.AppointmentBuilder.setTelehealthModesForSelectedSlots(),0===(n=this.__latestUserSelectedDte)&&(t=this.Data.AppointmentBuilder.getActiveApptIndex(),n=this.Data.AppointmentBuilder.getAppointment(t-1).Slot.Dte)):(this.Data.AppointmentBuilder.unholdSelectedSlots(),n=this.__latestUserSelectedDte),this.__changeSlotDateRange(n),this.__lockLoadOverlayPosition(),this.__resetAndLoad()):this.__isSimpleMultiApptWorkflow?($$WPUtil.ShowAjaxSpinner(this.__getLoadingOverlay()),this.__lockLoadOverlayPosition(),this.__generateSolutionGroupKeys(this.Data.Solutions.toArray())):this.__generateSolutionGroupKeys(this.Data.Solutions.toArray());this.updateStep()},__editSlot:function(n){this.__isUserSelectingSlots=!0;this.Data.AppointmentBuilder.deselectSlotAndAllFollowingSlots(n);this.SlotSelectionSummaryController.focusOnSummaryHeader(0);this.updateStep()},__canSkipLicensureCheckForActiveAppointment:function(){var n,t;if(this.Data.AppointmentBuilder.IsSlotStepMultiApptPreGrouped){for(n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)if((t=this.Data.AppointmentBuilder.getAppointment(n)).isVideoVisit()&&!t.CanSkipLicensureCheck)return!1;return!0}return this.Data.AppointmentBuilder.getAppointment(this.Data.AppointmentBuilder.getActiveApptIndex()).CanSkipLicensureCheck},__shouldResetPatientLocation:function(){var n=0;if(this.__showSingleApptSelectSolutionsView){for(n=0;n<=this.Data.AppointmentBuilder.getActiveApptIndex();n++)if(this.Data.AppointmentBuilder.getAppointment(n).isVideoVisit())return!1;return!0}return!1},__onDateInputKeydown:function(n){13===n.which&&(n.preventDefault(),WP.Events.fireEvent(n.target,"change"))},__onDateInputChanged:function(n){var t=null;$$WP.FormValidation.checkIfFormIsValid(this.$root.find("form.daterangecontainer"),!1)&&(t=parseDate(n.target.value,!0),this.__changeSlotDateRange(WP.Utils.date2dte(t)),$$WPSchedulingUtil.FocusElement(this.$root.find(".datechooserAnchor")))},__areFiltersFullScreenExpanded:function(){return!!this.__isFullPageFilters()&&!this.__areFiltersCollapsed},__setAriaHiddenForFullPageFilters:function(){var n=this.__areFiltersFullScreenExpanded();this.$root.find("[data-hide-during-modal='true']").safeAttr("aria-hidden",n)},__onFilterToggleClicked:function(){this.__areFiltersCollapsed?this.__expandFilters():this.__collapseFilters()},__onFilterCollapseClicked:function(){this.__collapseFilters()},__expandFilters:function(){var n,t="0";this.__shouldAnimateFilters=this.__isFullPageFilters();this.__shouldAnimateFilters||(t="1");this.__hideBodyElementsForOverlay();this.$root.find(".filtertogglecontent").show();this.$root.find(".filtertogglecontent").css("opacity",t);this.__isFullPageFilters()||this.$root.find(".filtertogglesection").safeAttr("aria-expanded",!0);(n=this.__getFirstFocusableElementInPopup())&&this.__isFullPageFilters()&&($$WPSchedulingUtil.FocusElement(n),this.__handleFocusAfterRedrawingSlotStep=!1);this.__areFiltersCollapsed=!1;this.updateStep()},__getFirstFocusableElementInPopup:function(){var n,t;return t=this.$root.find(".filtersContainerFull"),(n=this.__getFocusableElements(t)).length>2?$afe.jq(n[0]):null},__collapseFilters:function(){this.__showBodyElementsNoOverlay();this.$root.find(".filtertogglecontent").hide();this.__isFullPageFilters()||this.$root.find(".filtertogglesection").safeAttr("aria-expanded",!1);this.__handleFocusAfterRedrawingSlotStep=!0;$$WPSchedulingUtil.FocusElement(this.$root.find(".filtertogglesection"));this.__areFiltersCollapsed=!0;this.updateStep()},__onFilterTabPressed:function(){function r(){document.activeElement===t[0]&&(event.preventDefault(),$$WPSchedulingUtil.FocusElement(i))}if(this.__areFiltersFullScreenExpanded()){var n=this.$root.find(".filtersContainerFull"),u=this.__getFocusableElements(n),t=this.$root.find(".filtercollapsesection"),i=$afe.jq(u[1]);switch(event.keyCode){case 9:event.shiftKey?function(){document.activeElement===i[0]&&(event.preventDefault(),$$WPSchedulingUtil.FocusElement(t))}():r();break;case 27:n.find(".filtercollapsesection").trigger("click");break;case 40:r()}}},__onApptsDetailsToggleClicked:function(){this.$root.find(".detailsIcon").toggleClass("selected");this.$root.find(".apptsDetailsecontent").slideToggle(400)},__onRetryClick:function(){this.__resetAndLoad()},__fromDateFieldId:function(){return"fromDate_"+this.Id},__changeSlotDateRange:function(n){var t=this.__getValidSlotDte(n);this.__firstDteToShow!==t&&(this.__lockLoadOverlayPosition(),this.__firstDteToShow=t,this.__resetAndLoad(),this.$root.find('input[name="'+this.__fromDateFieldId()+'"]').val($$WPSchedulingUtil.FormatDteAsDate(this.__firstDteToShow)))},__onScroll:function(){this.__tryLoadOnScroll()},__onLoadAnotherBatchKeyDown:function(n){13===n.which&&(this.__getLoadAnotherBatchButton().click(),n.preventDefault())},__onLoadAnotherBatchClicked:function(n){this.__shouldTryFocusOnNextDTE=!0;this.__showSlotsWhenLoading=!0;this.__loadNextSlotsBatch();this.__handleFocusAfterRedrawingSlotStep=!0;this.__getFilterNoSlotsLoaded().css("visibility","hidden");this.__getLoadAnotherBatchButton().css("visibility","hidden");this.__getVerboseError().hide();n.preventDefault()},__onRequestOptionClicked:function(n){var t,i;t=$afe.jq(n.target).closest(".departmentbutton").safeAttr("data-model-id");i=p.getInstance(t);this.__addSlotToAppointment(0,i);this.$root.find(".expandedrequestsection").hide();this.__renderHidden=!0;this.$root.hide()},__onExpandRequestClicked:function(){this.$root.find(".expandedrequestsection").show();$$WPSchedulingUtil.FocusElement(this.$root.find(".expandedrequestsection a").first())},__onTimePreferenceChanged:function(n,t,i,r){var e,s,f,h,c,o,l;switch(this.__focusOnTimePreferenceLabel=!i,this.__handleFocusAfterRedrawingSlotStep=!i,this.__selectedTimePreferenceFilterLabel=null===t?u.LabelValueEnum.AllAvailable:t.safeAttr("value"),this.__checkedBox=r,this.__selectedTimePreferenceFilterLabel){case u.LabelValueEnum.AllAvailable:this.__slotStepSettings.TimePreferences=null;this.__selectedTimePreferenceFilterTimes=[];break;case u.LabelValueEnum.OnFile:this.__slotStepSettings.TimePreferences=this.TimePreferenceWidget.OnFilePreferences;break;case u.LabelValueEnum.Other:if(this.__selectedTimePreferenceFilterTimes=[],0===n.length)this.__slotStepSettings.TimePreferences=null;else for(this.__slotStepSettings.TimePreferences=Array([],[],[],[],[],[],[]),e=0;e<n.length;e++)s=$afe.jq(n[e]),f=(o=$$WPSchedulingUtil.GetTimePreferenceRangeProps(s)).DayOfWeekIndex,h=o.StartTime,c=o.EndTime,l=o.RangeElement,this.__slotStepSettings.TimePreferences[f]=this.__slotStepSettings.TimePreferences[f]||[],this.__slotStepSettings.TimePreferences[f].push([h,c]),this.__selectedTimePreferenceFilterTimes.push({DayIndex:f,RangeElement:l})}this.__hasNewFilteredSlots=!1;this.updateStep()},__onClearFiltersClicked:function(){this.__isAtLeastOneFilterSelected()&&(this.FilterController.clearAllFilters(!0),this._workflow.Type===n.WorkflowTypesEnum.OnDemandTelehealth&&this.Data.TelehealthData.SelectedWorkflow===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.SlotSelection?this.__onResetCalendarFilterClicked():(this.FilterController.filterProvidersBySelection(),this.FilterController.notifyProviderDepartmentFilterListeners()),this.__onClearTimeFiltersClicked())},__onClearTimeFiltersClicked:function(){this.__onTimePreferenceChanged(null,null,!0,null)},__onResetCalendarFilterClicked:function(){this.__latestUserSelectedDte=this.__minDte;this.__changeSlotDateRange(this.__minDte)},__resetAndLoad:function(){0===this.Data.NumStepsReloading&&(this.__isDirty=!1,this.__midSlotsMultiApptViewBannerDaysBeforeContent=0,this.Data.SlotLoader.initialize(this.__firstDteToShow,this._workflow,this.Data.AppointmentBuilder,this.__slotStepSettings.UseOnFileTimePreferences),this.__hasNewFilteredSlots=!1,this.__loadNextSlotsBatch())},__loadNextSlotsBatch:function(){this.__announceSlotsLoadAlert();this.Data.SlotLoader.loadNextSlots(this.__onSlotsLoaded);this.Active?this.Data.SlotLoader.isLoading()?(this.__handleFocusAfterRedrawingSlotStep=!0,$$WPUtil.ShowAjaxSpinner(this.__getLoadingOverlay()),this.$root.find(".nodata").hide(),this.__showSlotsWhenLoading||this.__hideSlots(),this.__getFilterPosition()!==r.Dropdown||this.__areFiltersCollapsed||this.__lockLoadOverlayPosition()):(this.__getFilterNoSlotsLoaded().show(),this.__getLoadAnotherBatchButton().show()):(this.__handleFocusAfterRedrawingSlotStep=!1,this.updateStep())},__recalculateProvDepPairs:function(){for(var t,i=this.Data.AppointmentBuilder.numAppointments(),n=0;n<i;n++)(t=this.Data.AppointmentBuilder.getAppointment(n)).ProviderDepartmentPairs=this.__getAvailableDirectProviderDepartmentPairs(t),t.ProviderDepartmentPairs.sort(this.__getSortProviderDepartmentPairsForDisplay(t))},__onSlotsLoaded:function(n){this.__generateSolutionViewModelProperties(n);this.__generateSolutionGroupKeys(n);this.__releaseLoadOverlayPosition();this.__handleFocusAfterRedrawingSlotStep=!0;this.__hasNewFilteredSlots=this.__checkHasNewFilteredSlots(n);this.__showSlotsWhenLoading=!1;this.__tryLoadNextBatchForEmbeddedWorkflow(n);this.updateStep()},__tryLoadNextBatchForEmbeddedWorkflow:function(n){this.__allowScrollLoading||(this.__numConsecutiveEmbeddedSlotLoads>=this.__slotStepSettings.EmbeddedConsecutiveSlotLoadLimit-1||this.__runningCountSlotsLoadedPerEmbeddedSlotLoad>=this.__minimumNewSlotsNeededEachEmbeddedLoad||this.Data.AppointmentBuilder.allAppointmentsHaveASlotSelected()?(this.__numConsecutiveEmbeddedSlotLoads=0,this.__runningCountSlotsLoadedPerEmbeddedSlotLoad=0):(this.__numConsecutiveEmbeddedSlotLoads=this.__numConsecutiveEmbeddedSlotLoads+1,this.__runningCountSlotsLoadedPerEmbeddedSlotLoad=this.__runningCountSlotsLoadedPerEmbeddedSlotLoad+n.length,this.__showSlotsWhenLoading=!0,this.__loadNextSlotsBatch()))},__announceSlotsLoadAlert:function(){this._firstRender||$$WPSchedulingUtil.AnnounceMessage($$WP.Strings.getForTemplate("SlotsLoadAccessibilityAlert"))},__generateSolutionGroupKeys:function(n){for(var i=0,t=null,i=0;i<n.length;i++)(t=n[i]).setProperty("DateKey",this.__getSolutionDateKey(t)),t.setProperty("ProviderGroupKey",this.__getSolutionProviderGroupKey(t)),t.setProperty("LocationGroupKey",this.__getSolutionLocationGroupKey(t)),t.setProperty("EffectiveApptTimeKey",this.__getSolutionApptTimeKey(t))},__getSolutionDateKey:function(n){var t=this.Data.AppointmentBuilder.getActiveApptIndex();return n.Slots[t].DisplayDte},__getSolutionProviderGroupKey:function(n){return l(this.__getVisibleSolutionProviderIds(n))},__checkHasNewFilteredSlots:function(n){var r,f,e,o,u,i;if(null===n||0===n.length)return!1;if(!Array.isArray(this.__slotStepSettings.TimePreferences))return!0;for(u=0;u<n.length;u++)if((r=n[u])&&r.Slots)for(i=0;i<r.Slots.length;i++)if((!this.__showSingleApptSelectSolutionsView||i===this.Data.AppointmentBuilder.getActiveApptIndex())&&(f=r.Slots[i])&&(e=t.Dte2Date(f.Dte).getDay(),o=f.StartTime,this.__isSlotInSelectedPreferences(o,this.__slotStepSettings.TimePreferences[e])))return!0;return!1},__isCalendarSetToEarliestDte:function(){return this.__firstDteToShow===this.__minDte},__getVisibleSolutionProviderIds:function(n){for(var i=[],t=0,t=0;t<n.Slots.length;t++)this.__showSingleApptSelectSolutionsView&&t!==this.Data.AppointmentBuilder.getActiveApptIndex()||$$WP.Scheduling.Workflow.allowProviderSelectForAppointment(this.Data.AppointmentBuilder,this.Data.AppointmentBuilder.getAppointment(t))&&i.push(n.Slots[t].ProviderId);return i},__getSolutionLocationGroupKey:function(n){return l(this.__getVisibleSolutionLocationIds(n))},__getVisibleSolutionLocationIds:function(n){for(var r=[],u=[],t=0,i=null,t=0;t<n.Slots.length;t++)this.__showSingleApptSelectSolutionsView&&t!==this.Data.AppointmentBuilder.getActiveApptIndex()||(i=this.Data.AppointmentBuilder.getAppointment(t),this.__canAppointmentDisplayLocationInformation(i)&&(r=[n.Slots[t].DepartmentId],u.push(this.__getLocationIdsFromDepartmentIds(r,i))));return u},__getLocationIdsFromDepartmentIds:function(n,t){for(var i=0,r=[],u=null,e=null,o=t.areLocationsGrouped(),i=0;i<n.length;i++)u=this.Data.Departments.getFromIndex("ID",n[i]),(e=f.getLocationFromDepartment(u,this.Data.Locations,o))&&r.push(e.Id);return r},__getSolutionApptTimeKey:function(n){var t=this.Data.AppointmentBuilder.getActiveApptIndex();return n.Slots[t].EffectiveApptTime},__generateSolutionViewModelProperties:function(t){for(var i=0,r=null,i=0;i<t.length;i++)(r=t[i]).Slots.length>1&&(this.__doesSolutionRequireComplexMultiApptView(r)||this.__isSimpleMultiApptWorkflow||this.__isComplexMultiApptWorkflow?this.__doesSolutionRequireComplexMultiApptView(r)&&!this.__isSimpleMultiApptWorkflow&&(this.__isComplexMultiApptWorkflow=!0,this.__showDetailedSolutionsView||(this.__showSingleApptSelectSolutionsView=!0,this.Data.AppointmentBuilder.IsSlotStepMultiApptPreGrouped=!1,this._workflow.MultiApptSlotStepStartingView=n.MultiApptSlotStepViewTypeEnum.OneApptAtATimeView)):(this.__isSimpleMultiApptWorkflow=!0,this._workflow.MultiApptSlotStepStartingView=n.MultiApptSlotStepViewTypeEnum.SimpleSlotsView))},__doesSolutionRequireComplexMultiApptView:function(n){return!(n.areAllSlotsOnTheSameDay()&&this.Data.AppointmentBuilder.hasAllSameSingleLocationSelected())},__getAvailableDirectProviderDepartmentPairs:function(n){var i,t=[],r=[],u=[],f=this.Data.AppointmentBuilder.getActiveApptIndex(),e=this.Data.AppointmentBuilder.getAppointment(f);for(t=this.__getAvailableDirectNonTeamProviderDepartmentPairs(n),this.Data.AppointmentBuilder.UseTeams&&(r=this.__getAvailableDirectTeamProviderDepartmentPairs(n),this.__appendProviderDepartmentPairs(t,r)),this.Data.AppointmentBuilder.CanSearchAllLicensedVideoProviders&&n.isVideoVisit()&&(u=this.__getAvailablePairsForPatientLocation(n),this.__appendProviderDepartmentPairs(t,u)),n.isVideoVisit()&&this.__canLoadProvidersWithTelehealthLocations()&&!n.CanSkipLicensureCheck&&(t=h.GetPairsLicensedInLocation(t,this.Data.AppointmentBuilder.PatientLocation,this.Data.AppointmentBuilder.PatientSublocation)),this.__isAtLeastOneProviderFilterSelected()&&(t=this.__filterPairsByFilterSelections(t,n)),i=0;i<t.length;i++)t[i].determinePatientAge(e.VisitType.ID),t[i].setNetworkStatusOnProvider();return this.FilterController.filterProviderDepartments(t)},__filterPairsByFilterSelections:function(n,t){for(var r=[],u,i=0;i<n.length;i++)u=n[i].Provider,t.Providers.contains(u)&&r.push(n[i]);return r},__getAvailablePairsForPatientLocation:function(n){var t=[];return this.__mode!==e.RequestOnly&&this.arePrerequisitesComplete()&&(t=n.CanSkipLicensureCheck?n.ReasonForVisit.DirectProviderDepartmentPairs:h.GetPairsLicensedInLocation(n.ReasonForVisit.DirectProviderDepartmentPairs,this.Data.AppointmentBuilder.PatientLocation,this.Data.AppointmentBuilder.PatientSublocation)),t},__appendProviderDepartmentPairs:function(n,t){for(var i=null,r=0,r=0;r<t.length;r++)i=t[r],y(n,i.ProviderId,i.DepartmentId)||n.push(i)},__isProviderDepartmentPairInList:function(n,t,i){for(var r=0,r=0;r<n.length;r++)if(n[r].ProviderId===t&&n[r].DepartmentId===i)return!0;return!1},__getAvailableDirectNonTeamProviderDepartmentPairs:function(n){var t,u=[],f=(n.VisitType,[]),i=0,r=null,s=null,o=null;if(this.__mode===e.RequestOnly||!this.arePrerequisitesComplete())return u;if(t=n.ReasonForVisit,f=n.getSelectedDepartmentsCollection(),$$WPUtil.IsNullOrEmpty(t))return[];for(i=0;i<t.DirectProviderDepartmentPairs.length;i++)r=t.DirectProviderDepartmentPairs[i],s=this.Data.Providers.getFromIndex("ID",r.ProviderId),o=this.Data.Departments.getFromIndex("ID",r.DepartmentId),(n.IsProviderAnyOptionSelected&&f.contains(o)||n.Providers.contains(s)&&f.contains(o))&&u.push(r);return u},__getAvailableDirectTeamProviderDepartmentPairs:function(n){var r,s,h,c,t=0,u=0,f=null,o=null,l=null,a=null,v=null,y=[],p=null,e=null;if(r=this.__getAvailableDirectNonTeamProviderDepartmentPairs(n),s=n.VisitType,h=n.getSelectedDepartmentsCollection(),c=!!s&&!n.isAppointmentInPerson(),!this.arePrerequisitesComplete()||this.__isTicketWorkflow()||this.__isRescheduleWorkflow())return[];for(t=0;t<r.length;t++)if(f=this.Data.Providers.getFromIndex("ID",r[t].ProviderId),o=this.Data.Departments.getFromIndex("ID",r[t].DepartmentId),v=i.getVisitTypeForDepartment(this.Data,n,o),(a=this.__getAllowTeamScheduling(v,o))!==i.AllowTeamSchedulingEnum.NoTeamScheduling&&(a!==i.AllowTeamSchedulingEnum.PcpOnly||f.IsPCP))for(u=0;u<f.TeamProviderDepartmentPairs.length;u++)e=f.TeamProviderDepartmentPairs[u],p=this.Data.Providers.getFromIndex("ID",e.ProviderId),l=this.Data.Departments.getFromIndex("ID",e.DepartmentId),d(p,l,h,c)&&y.push(e);return y},__initializeDateRange:function(){var v,h,c=null,a=[],r=null,l=0,e=0,o=0,s=0,f=null,u=null,n=null;for(h=this.__getDefaultOffsets(),v=this.Data.AppointmentBuilder.numAppointments(),o=0;o<v;o++)for(a=(c=this.Data.AppointmentBuilder.getAppointment(o)).getSelectedDepartmentsCollection().toArray(),s=0;s<a.length;s++)(f=a[s])&&"-1"===f.ID||(u=null,(r=$$WPUtil.IsNullOrEmpty(c.PanelId)?i.getVisitTypeForDepartment(this.Data,c,f):this.Data.VisitTypes.getFromIndex("ID",c.PanelId))&&(u=this.Data.VisitTypeDepartmentOverrides.getFromIndex("Id",r.ID+"^"+f.ID)),n=k([[u&&u.FromMinutesOffset,u&&u.FromDaysOffset,u&&u.ToDaysOffset],[f.FromMinutesOffset,f.FromDaysOffset,f.ToDaysOffset],[r&&r.FromMinutesOffset,r&&r.FromDaysOffset,r&&r.ToDaysOffset],[this.__slotStepSettings.FromMinutesOffset,this.__slotStepSettings.FromDaysOffset,this.__slotStepSettings.ToDaysOffset],h]),$$WP.Utilities.IsNullOrEmpty(n[1])&&(n[1]=h[1]),$$WP.Utilities.IsNullOrEmpty(n[2])&&(n[2]=h[2]),this.__setNewProviderOffsetOverrides(n),0===o&&0===s?(l=n[1],e=n[2]):(l=Math.min(l,n[1]),e=Math.max(e,n[2])));this.__minDte=t.todaysDte+l;this.__maxDte=t.todaysDte+e;this.__maxCalendarDte=t.todaysDte+e;(this.__isTicketWorkflow()||this.__isRescheduleWorkflow())&&this.__adjustDatesForTickets();this.__firstDteToShow=this.__getValidSlotDte(this.__firstDteToShow)},__adjustDatesForTickets:function(){var r=this.Data.AppointmentBuilder.getActiveApptIndex(),n=null,t=0,i=0;this.__showSingleApptSelectSolutionsView?(t=(n=this.Data.AppointmentBuilder.getAppointment(r)).ReasonForVisit.ApptComponentItems.FromDte,(i=n.ReasonForVisit.ApptComponentItems.ExpirationDte)>0&&(this.__maxCalendarDte=Math.min(this.__maxCalendarDte,i)),!$$WP.Utilities.IsNullOrEmpty(this.__slotStepSettings.ToDte)&&this.__slotStepSettings.ToDte>0&&(this.__maxCalendarDte=Math.min(this.__maxCalendarDte,this.__slotStepSettings.ToDte))):$$WP.Utilities.IsNullOrEmpty(this.__slotStepSettings.BundleId)?!$$WP.Utilities.IsNullOrEmpty(this.__slotStepSettings.ToDte)&&this.__slotStepSettings.ToDte>0&&(this.__maxCalendarDte=Math.min(this.__maxCalendarDte,this.__slotStepSettings.ToDte)):!$$WP.Utilities.IsNullOrEmpty(this.__slotStepSettings.ExpirationDte)&&this.__slotStepSettings.ExpirationDte>0&&(this.__maxCalendarDte=Math.min(this.__maxCalendarDte,this.__slotStepSettings.ExpirationDte));$$WP.Utilities.IsNullOrEmpty(this.__slotStepSettings.FromDte)||(this.__minDte=Math.max(this.__minDte,this.__slotStepSettings.FromDte,t));!$$WP.Utilities.IsNullOrEmpty(this.__slotStepSettings.ToDte)&&this.__slotStepSettings.ToDte>0&&(this.__maxDte=Math.min(this.__maxDte,this.__slotStepSettings.ToDte))},__isAtLeastOneFilterSelected:function(){return this.__isAtLeastOneProviderFilterSelected()||this.__isAtLeastOneTimeFilterSelected()},__isAtLeastOneProviderFilterSelected:function(){var n=this.FilterController.getSelectedFilters();return null!==n&&n.length>0},__isAtLeastOneTimeFilterSelected:function(){return null!==this.__selectedTimePreferenceFilterTimes&&this.__selectedTimePreferenceFilterTimes.length>0||null!==this.__selectedTimePreferenceFilterLabel&&this.__selectedTimePreferenceFilterLabel===u.LabelValueEnum.OnFile},__shouldRenderRefineSearch:function(){return this.__shouldShowGranularProviderFilters()&&(this.__isTimePreferencesWidgetVisible()||(this.__forceShowFilters||this.__isAnyProviderSelectedInAllActiveAppointments())&&this.__doesAnyAppointmentAllowProviderSelection()&&this.FilterController.isProviderFilteringAvailable())},__getDefaultOffsets:function(){return this.__isOpenSchedulingWorkflow()?[null,this.__slotStepSettings.NewProvFromDaysOffset,this.__slotStepSettings.NewProvToDaysOffset]:[null,5,30]},__setNewProviderOffsetOverrides:function(n){this.__isOpenSchedulingWorkflow()&&(n[1]=Math.max(n[1],this.__slotStepSettings.NewProvFromDaysOffset),n[2]=Math.min(n[2],this.__slotStepSettings.NewProvToDaysOffset))},__getValidSlotDte:function(n){var t=n;return t=Math.max(t,this.__minDte),t=Math.min(t,this.__maxDte)},__buildViewModel:function(){var i,u,f,n,t;u=$$WP.Utilities.UI.IsSmallScreen();f=$$WP.Utilities.UI.IsMobile;n=this.Data.SlotLoader.getError(this.SchedulingStringsNamespace);t=this.__getAnotherBatchButtonLabels();this.ViewModel={StepControllerId:this.Id,Days:[],ShowLocationHeaders:!1,ShowProviderHeaders:!1,ShowGranularFilters:this.__shouldShowGranularProviderFilters(),ShowProviderFilters:this.__shouldShowGranularProviderFilters()&&this.__isAnyProviderSelectedInAllActiveAppointments()&&this.__doesAnyAppointmentAllowProviderSelection(),forceShowFilters:this.__forceShowFilters,StepSelections:this.__getStepSelectionsViewModel(),IsLocationSummaryVisible:this.__shouldShowLocationSummary(),CanEditLocations:$$WPSchedulingUtil.CanEditStep(this.Data,this._workflow.Type,$$WP.Scheduling.SchedulingStep.StepTypeEnum.Location,this.__slotStepSettings.IsDepartmentStepHiddenByQueryParams),IsProviderSummaryVisible:this.__shouldShowProviderSummary(),CanEditProviders:$$WPSchedulingUtil.CanEditStep(this.Data,this._workflow.Type,$$WP.Scheduling.SchedulingStep.StepTypeEnum.Provider,this.__slotStepSettings.IsProviderStepHiddenByQueryParams),ShowLoadAnotherBatch:!1,ShowNoNewFilteredSlotsMessage:!this.__hasNewFilteredSlots,NoSlotsShown:!1,IsCalendarSetToEarliestDte:this.__isCalendarSetToEarliestDte(),FromDate:$$WPSchedulingUtil.FormatDteAsDate(this.__firstDteToShow),FromDateFieldId:this.__fromDateFieldId(),ProvidersForRequest:null,ShowDirectRequestLink:!1,TeamSchedulingDefaultChecked:this.Data.AppointmentBuilder.UseTeams,TeamSchedulingShowInSidebar:this.__shouldShowTeamSchedulingInSidebar(),MidSlotsBannerViewModel:null,ShowMidSlotsBanner:!1,FiltersHelperShowBeforeDte:0,FiltersHelperShowMidSlots:!1,FilterPosition:this.__getFilterPosition(),FilterPositionEnum:r,AreFiltersCollapsed:this.__areFiltersCollapsed,IsFullPageFilters:this.__isFullPageFilters(),ShowRequestsInSidebar:!(u||f),SlotsLoadingMessage:this.__getSlotLoadingMessage(),SlotsLoadingMoreMessage:this.SchedulingStringsNamespace.getString("SlotsLoadingMoreMessage"),ShowRetryButton:this.Data.SlotLoader.isLastLoadTemporaryFail(),ShowVerboseError:this.Data.SlotLoader.hasVerboseError(),ScheduledAppointmentName:this.Data.AppointmentBuilder.TicketName,RelatedScheduledAppts:this.Data.AppointmentBuilder.RelatedAppointments,HasFutureAppointment:this.Data.AppointmentBuilder.HasFutureAppointment,VerboseErrorDescription:n.Description,VerboseErrorInstructions:n.Instructions,AnotherBatchButtonLabel:t.Label,AnotherBatchButtonLabelDetailed:t.DetailedLabel,ShowSolutionDetails:!1,ShowSingleApptSelectSolutionsView:!1,CurrentApptBeingSelected:this.__getCurrentApptBeingSelected(),SlotStepTitleWithVisitType:"",SlotStepTitleScreenReaderHelper:"",ShowOneApptAtATimeButtonMidSlots:!1,ShowFullSolutionsButtonMidSlots:!1,MultiApptViewBannerShowBeforeDte:0,MultiApptViewBannerShowAfterSlots:!1,ShowTicketWaitListOptInMessage:this.__shouldShowTicketWaitListOptions(),ShowTimePreferences:this.__isTimePreferencesWidgetVisible(),StartDateValidationSettings:$$WPSchedulingUtil.GetDateFieldValidationSettings(WP.Utils.dte2date(this.__minDte),WP.Utils.dte2date(this.__maxDte),!0),PhoneNumberToDisplayForNoSlots:"",IsAtLeastOneFilterSelected:this.__isAtLeastOneFilterSelected(),IsAtLeastOneTimeFilterSelected:this.__isAtLeastOneTimeFilterSelected(),ViewResultsText:this.__getViewResultsText(),NoProvidersFound:0===this.__getSelectedProviderCount(),ShouldMoveOverlayDown:this.__shouldMoveOverlayDown,ShouldAnimateFilters:this.__shouldAnimateFilters,StepHeader:this.__getStepHeaderText(),UseAnonymousOSFiltersButton:!$$WP.WidgetMode&&this.__isOpenSchedulingWorkflow()&&this._workflow.IsAnonymous,IsInPersonTelehealthMode:!1,IsVideoTelehealthMode:!1,IsTelephoneTelehealthMode:!1,CanShowProviderTelehealthBadges:!1,IsEmbedded:this._workflow.SchedulingControllerParams.embedded,hasApptRequest:this.Data.AppointmentBuilder.ReasonForVisit.AppointmentRequestIds.length>0,ShouldRenderRefineSearch:this.__shouldRenderRefineSearch(),ShowOriginalAppts:!!this.__originalAppointmentInfo,ViewModelApptIndex:this.Data.AppointmentBuilder.getActiveApptIndex(),IsBundled:""!=this.Data.AppointmentBuilder.getBundleID(),IsRescheduleWorkflow:this.__isRescheduleWorkflow(),IsCurrentDteGreaterThanMaxCalendarDte:this.Data.SlotLoader.getSearchRangeStartDte()>=this.__maxCalendarDte,HasOnlyOneAppointment:1===this.Data.AppointmentBuilder.numAppointments(),HasSlots:this.Data.Solutions.Models.length>0};this.arePrerequisitesComplete()&&(i=this.__getSlotKeyForCurrentSelections(),this.__buildViewModelForTelehealthMode(),this.__buildViewModelForProvidersForRequest(),this.__buildViewModelForAllSlots(i),(this.__shouldShowFullSolutionsButtonMidSlots()||this.__shouldShowOneApptAtATimeButtonMidSlots())&&this.__buildViewModelForMidSlotsMultiApptBanner(),this.__shouldShowAddAllProvidersOption()?this.__buildViewModelForMidSlotsShowAllProviders():this.__shouldShowAddOutOfNetworkProvidersOption()?this.__buildViewModelForMidSlotsShowOutOfNetworkProviders():this.__shouldShowTeamsMidSlots()&&this.__buildViewModelForMidSlotsTeams(),this.__isAtLeastOneProviderFilterSelected()&&this.Data.AppointmentBuilder.UseTeams&&this.__buildViewModelForMidSlotsFilters(),this.__buildViewModelForRedirectionPhoneNumber(),this.__buildViewModelForPatientLocation())},__shouldShowFilterHelperMidSlots:function(){return this.__isAtLeastOneProviderFilterSelected()&&(this.Data.AppointmentBuilder.UseTeams||this.Data.AppointmentBuilder.CanSearchAllLicensedVideoProviders)},__getStepHeaderText:function(){var n="",t=null,i="";return this.__isOpenSchedulingWorkflow()?(t=this.Data.AppointmentBuilder.getFirstAppointment(),i=$$WPSchedulingUtil.GetVisitDisplayName(t,null,t.SelectedTelehealthMode),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@REASONFORVISITTITLE@",i,$$WP.Strings.EncodingTypes.None),$$WPUtil.IsNullOrEmpty(this.__slotStepSettings.WidgetStringKey)||(n=this.SchedulingStringsNamespace.getString("OpenSchedulingSlotStepTitle_"+this.__slotStepSettings.WidgetStringKey)),$$WPUtil.IsNullOrEmpty(n)&&(n=this.SchedulingStringsNamespace.getString("OpenSchedulingSlotStepTitle")),this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@REASONFORVISITTITLE@")):n=this.__shouldShowMultiApptDetailedSlotView()?this.SchedulingStringsNamespace.getString("MultipleAppointmentDetailedSlotStepTitle"):this.__shouldShowMultiApptSimpleSlotView()?this.SchedulingStringsNamespace.getString("MultipleAppointmentSimpleSlotStepTitle"):this.SchedulingStringsNamespace.getString("SlotStepTitle"),n},__getFilterPosition:function(){return $$WP.Utilities.UI.IsLargePhoneOrSmaller()||$$WP.Utilities.UI.IsMobile?r.Dropdown:r.RightSidebar},__getStepSelectionsViewModel:function(){var n,t;return t=$$WPSchedulingUtil.GetLocationsSummaryArray(this.Data),n=$$WPSchedulingUtil.GetProvidersSummaryArray(this.Data),{Locations:$$WPSchedulingUtil.GetCondensedFilterString(t),Providers:$$WPSchedulingUtil.GetCondensedFilterString(n)}},__getCurrentApptBeingSelected:function(){return this.__showSingleApptSelectSolutionsView?this.Data.AppointmentBuilder.getActiveApptIndex():0},__buildViewModelForRedirectionPhoneNumber:function(){for(var n=0,t=0,e=null,o=[],i=null,r="",u="",s=0,f=this.Data.AppointmentBuilder.numAppointments(),n=0;n<f;n++)for(e=this.Data.AppointmentBuilder.getAppointment(n),s=(o=this.__getAvailableDirectProviderDepartmentPairs(e)).length,t=0;t<s;t++){if(null===(i=o[t]).Department)return;if(r=i.Department.IsUsingOverridePhoneNumber?i.Department.OverridePhoneNumber:i.Department.PhoneNumber,$$WPUtil.IsNullOrEmpty(r))return;if(""!==u&&u!==r)return;u=r}this.ViewModel.PhoneNumberToDisplayForNoSlots=u},__buildViewModelForPatientLocation:function(){var n=null;this.__canShowPatientLocationBanner()&&((n=this.Data.AppointmentBuilder.PatientLocation)?(this.__setPatientLocationMnemonics(n),this.ViewModel.NoVideoProvidersHeading=this.SchedulingStringsNamespace.getString("NoVideoProvidersHeading")):this.ViewModel.NoVideoProvidersHeading=this.SchedulingStringsNamespace.getString("SlotsNoVideoProvidersMessage"),this.ViewModel.NoVideoVisitProviders=!this.Data.AppointmentBuilder.hasVideoVisitLicensedProviders()&&!this.__isAtLeastOneFilterSelected(),this.ViewModel.CanAddVideoVisitProviders=this.__canAddVideoVisitProviders(),this.__buildViewModelForPatientLocationBanner(),this.ViewModel.NoVideoProvidersHelpText=this.__getNoVideoProvidersHelpText(n),this.SchedulingStringsNamespace.clearMnemonics())},__setPatientLocationMnemonics:function(n){this.SchedulingStringsNamespace.addMnemonic("@MYCHART@PATIENTLOCATION@",n.LocationName,$$WP.Strings.EncodingTypes.None)},__canShowPatientLocationBanner:function(){var i,t;return!this.Data.AppointmentBuilder.IsPatientLocationRuleRunning&&!this.__canSkipLicensureCheckForActiveAppointment()&&(i=this.Data.AppointmentBuilder.numAppointments(),t=this.__isActiveSolutionVideoVisit(),!this.__showSingleApptSelectSolutionsView&&i>1&&(0!==this.Data.SlotLoader.numIncrementalLoadsCompleted()||!this.Data.SlotLoader.isLoading()&&!this.Data.SlotLoader.isLastLoadSuccess())&&(t=this.Data.AppointmentBuilder.hasVideoVisit()),this._workflow.Type!==n.WorkflowTypesEnum.OnDemandTelehealth&&t&&this.__canLoadProvidersWithTelehealthLocations())},__canLoadProvidersWithTelehealthLocations:function(){return this.__hasTelehealthLocations()&&this.Data.AppointmentBuilder.hasProvidersWithTelehealthLocations()&&!this.__isOtherProviderSelected()},__canSkipPatientLocationStep:function(){return!(!this.Data.AppointmentBuilder.canSkipLicensureForAllVideoVisits()&&this.__hasTelehealthLocations())||(this.__slotStepSettings.IsPatientLocationStepRequiredBySetting?!this.__isActiveSolutionVideoVisit():!this.__canShowPatientLocationBanner())},__isActiveSolutionVideoVisit:function(){var n=0,t=this.Data.AppointmentBuilder.numAppointments();return!(!this.__showSingleApptSelectSolutionsView||(n=this.Data.AppointmentBuilder.getActiveApptIndex(),!this.Data.AppointmentBuilder.getAppointment(n).isVideoVisit()))||1===t&&this.Data.AppointmentBuilder.hasVideoVisit()},__hasTelehealthLocations:function(){return 0!==this.Data.TelehealthLocations.size()},__isOtherProviderSelected:function(){return 0!==this.Data.AppointmentBuilder.getFirstAppointment().Providers.size()&&"-1"===this.Data.AppointmentBuilder.getFirstAppointment().Providers.Models[0].ID},__canAddVideoVisitProviders:function(){var r,u=this.Data.AppointmentBuilder.PatientLocation,f=this.Data.AppointmentBuilder.PatientSublocation,n=0,t=null;if(n=this.Data.AppointmentBuilder.getActiveApptIndex(),r=(t=this.Data.AppointmentBuilder.getAppointment(n)).SelectedTelehealthMode,!this.Data.AppointmentBuilder.IsSlotStepMultiApptPreGrouped&&r!==i.TelehealthModeEnum.Video)return t.CanSkipLicensureCheck||h.HasAtLeastOnePairLicensedInLocation(t.ReasonForVisit.DirectProviderDepartmentPairs,u,f);for(n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)if(!(t=this.Data.AppointmentBuilder.getAppointment(n)).CanSkipLicensureCheck&&!h.HasAtLeastOnePairLicensedInLocation(t.ReasonForVisit.DirectProviderDepartmentPairs,u,f))return!1;return!0},__onAddVideoVisitProvidersClicked:function(){this.Data.AppointmentBuilder.setProperty("CanSearchAllLicensedVideoProviders",!0)},__buildViewModelForPatientLocationBanner:function(){this.ViewModel.PatientLocationBanner={BannerType:"informationalType",HeaderText:this.__getPatientLocationBannerHeaderText(),DetailText:this.__getPatientLocationBannerDetailText(),DisableDetailTextHtmlEncoding:!0}},__onShowAllProvidersClicked:function(){this.__isLoadingAdditionalProviders=!0;this.Data.AppointmentBuilder.setProperty("DidIncludeAdditionalProvidersInSearch",!0);this.__isTeamSchedulingAllowed&&(this.__isLoadingTeams=!0,this.Data.AppointmentBuilder.setProperty("UseTeams",!0))},__onShowOutOfNetworkProvidersClicked:function(){this.FilterController.clearNetworkFilter()},__getPatientLocationBannerHeaderText:function(){return null===this.Data.AppointmentBuilder.PatientLocation?this.SchedulingStringsNamespace.getString("PatientLocationBannerHeaderNoLocation"):this.SchedulingStringsNamespace.getString("PatientLocationBannerHeader")},__getPatientLocationBannerDetailText:function(){return null===this.Data.AppointmentBuilder.PatientLocation?this.SchedulingStringsNamespace.getString("PatientLocationBannerDetailTextNoLocation"):this.SchedulingStringsNamespace.getString("PatientLocationBannerDetailText")},__getNoVideoProvidersHelpText:function(n){return this.__canAddVideoVisitProviders()?n?this.SchedulingStringsNamespace.getString("NoVideoProvidersHelpTextCanAdd"):this.SchedulingStringsNamespace.getString("NoVideoProvidersHelpTextCanAddNoLocation"):n?this.SchedulingStringsNamespace.getString("NoVideoProvidersHelpText"):this.SchedulingStringsNamespace.getString("NoVideoProvidersHelpTextNoLocation")},__getViewResultsText:function(){var n,t=this.__getSelectedProviderCount();return this.SchedulingStringsNamespace.addMnemonic("@MYCHART@PROVIDERRESULTSCOUNT@",t,$$WP.Strings.EncodingTypes.None),n=this.SchedulingStringsNamespace.getString("ViewResultsLabel"),this.SchedulingStringsNamespace.clearMnemonics(),n},__getSelectedProviderCount:function(){var u,t,n=0,f=null,i=[],r=null;for(u=this.Data.AppointmentBuilder.getActiveApptIndex(),t=this.Data.AppointmentBuilder.getAppointment(u).ProviderDepartmentPairs,n=0;n<t.length;n++)f=t[n],r=this.Data.Providers.getFromIndex("ID",f.ProviderId),-1===i.indexOf(r)&&i.push(r);return i.length},__getSlotLoadingMessage:function(){return this.SchedulingStringsNamespace.getString("SlotsLoadingMessage")},__getAnotherBatchButtonLabels:function(){var n={},t="",i="";return this.Data.SlotLoader.hasVerboseError()?(t="RetryButtonLabel",i="RetryButtonLabelForScreenReader"):(t="AnotherBatchButton",i="AnotherBatchButtonDetailed"),n.Label=this.SchedulingStringsNamespace.getString(t),n.DetailedLabel=this.SchedulingStringsNamespace.getString(i),n},__getSlotKeyForCurrentSelections:function(){return t.getSlotKeyForBuilder(this._workflow,this.Data.AppointmentBuilder)},__buildViewModelForAllSlots:function(n){var r,u=null,f=0,i=0,e=null,o=null;if(r=this.Data.Solutions.getIndex(["SlotKey","DateKey","ProviderGroupKey","LocationGroupKey","EffectiveApptTimeKey"])[n],this.__isTypeObject(r)){for(this.ViewModel.ShowLocationHeaders=this.__shouldShowLocationHeaders(),this.ViewModel.ShowProviderHeaders=this.__shouldShowProviderHeaders(),null!==this.ViewModel.RelatedScheduledAppts&&0!==this.ViewModel.RelatedScheduledAppts.length&&(this.ViewModel.ScheduleAppointmentTitle=this.__getScheduledAppointmentsTitle(),this.ViewModel.StandingOrderAppointments=this.__buildStandingOrderAppointments(),this.__focusStepHeader()),this.ViewModel.Appointments=this.Data.AppointmentBuilder.Appointments.toArray(),f=Math.min(this.Data.SlotLoader.getSearchRangeEndDte(),this.__maxDte),i=this.__firstDteToShow;i<=f;i++)o=t.Dte2Date(i),this.__isDateIncludedInSelectedPreferences(o)&&(u=r[i],(e=this.__buildViewModelForDay(u,i))&&this.ViewModel.Days.push(e));this.ViewModel.NoSlotsShown=0===this.ViewModel.Days.length;this.ViewModel.ShowLoadAnotherBatch=this.__isOkToShowLoadMoreLink()}this.ViewModel.ShowOneApptAtATimeButtonMidSlots=this.__shouldShowOneApptAtATimeButtonMidSlots();this.ViewModel.ShowFullSolutionsButtonMidSlots=this.__shouldShowFullSolutionsButtonMidSlots();this.ViewModel.ShowSolutionDetails=this.__shouldShowDetailedSolutionView();this.ViewModel.ShowSingleApptSelectSolutionsView=this.__shouldShowOneApptAtATimeSolutionsView()},__shouldShowOneApptAtATimeButtonMidSlots:function(){return this.Data.AppointmentBuilder.numAppointments()>1&&!this.__showSingleApptSelectSolutionsView},__shouldShowFullSolutionsButtonMidSlots:function(){return this.Data.AppointmentBuilder.numAppointments()>1&&this.__showSingleApptSelectSolutionsView},__shouldShowDetailedSolutionView:function(){return this.Data.AppointmentBuilder.numAppointments()>1&&!this.__showSingleApptSelectSolutionsView&&this.__showDetailedSolutionsView&&!this.__isSimpleMultiApptWorkflow},__shouldShowOneApptAtATimeSolutionsView:function(){return this.Data.AppointmentBuilder.numAppointments()>1&&this.__showSingleApptSelectSolutionsView&&!this.__showDetailedSolutionsView},__shouldShowMultiApptSimpleSlotView:function(){return this.Data.AppointmentBuilder.numAppointments()>1&&!this.__showSingleApptSelectSolutionsView&&!this.__showDetailedSolutionsView},__shouldShowMultiApptDetailedSlotView:function(){return this.Data.AppointmentBuilder.numAppointments()>1&&!this.__showSingleApptSelectSolutionsView&&this.__showDetailedSolutionsView},__shouldShowLocationHeaders:function(){var t=null,i=null;return this._workflow.Type!==n.WorkflowTypesEnum.OnDemandTelehealth&&!($$WP.WidgetMode&&this.__slotStepSettings.AllowedDepartmentIds&&1===this.__slotStepSettings.AllowedDepartmentIds.length&&(i=(t=this.Data.AppointmentBuilder.getAppointment(this.__getCurrentApptBeingSelected())).Locations.toArray()[0])&&1===t.Locations.size()&&i.DepartmentIds[0]===this.__slotStepSettings.AllowedDepartmentIds[0])&&this.__canAnyAppointmentDisplayLocationInformation()},__shouldShowLocationSummary:function(){var t,i;return this.ViewModel.CanEditLocations=$$WPSchedulingUtil.CanEditStep(this.Data,this._workflow.Type,$$WP.Scheduling.SchedulingStep.StepTypeEnum.Location,this.__slotStepSettings.IsDepartmentStepHiddenByQueryParams),!(!this.ViewModel.CanEditLocations||this._workflow.Type===n.WorkflowTypesEnum.OnDemandTelehealth)&&(this.__showSingleApptSelectSolutionsView?!!(t=(i=this.Data.AppointmentBuilder.getAppointment(this.Data.AppointmentBuilder.getActiveApptIndex())).VisitType)&&(i.isAppointmentInPerson()||t.ShowLocationStepForTelehealthVisit)&&this.Data.AppointmentBuilder.AvailableLocations[this.Data.AppointmentBuilder.getActiveApptIndex()].length>1:this.ViewModel.CanEditLocations)},__shouldShowProviderSummary:function(){var t=this.Data.AppointmentBuilder.ReasonForVisit;return this.__doesAnyAppointmentAllowProviderSelection()&&!!t&&t.hasMultipleProviders()&&this._workflow.Type!==n.WorkflowTypesEnum.OnDemandTelehealth&&!this.isInsuranceSelectionValid()&&this.__preselectedFilters&&this.__preselectedFilters.length<1},__shouldShowGranularProviderFilters:function(){return this._workflow.Type!==n.WorkflowTypesEnum.ExistingProvider},__shouldShowSimpleTimePreferences:function(){return this._workflow.IsAnonymous},__getAppointmentsWithDisplayedLocations:function(){for(var n=0,t=null,r=[],i=this.Data.AppointmentBuilder.numAppointments(),n=0;n<i;n++)t=this.Data.AppointmentBuilder.getAppointment(n),this.__canAppointmentDisplayLocationInformation(t)&&r.push(t);return r},__canAppointmentDisplayLocationInformation:function(n){var t=n.VisitType;return n.isAppointmentInPerson()||!!t&&t.ShowLocationStepForTelehealthVisit},__canAnyAppointmentDisplayLocationInformation:function(){return this.__getAppointmentsWithDisplayedLocations().length>0},__doesAnyAppointmentWithMultipleLocationsDisplayLocationInformation:function(){for(var t=this.__getAppointmentsWithDisplayedLocations(),n=0,n=0;n<t.length;n++)if(t[n].Locations.toArray().length>1)return!0;return!1},__shouldShowProviderHeaders:function(){var t=null,n=[];if($$WP.WidgetMode&&this.__slotStepSettings.AllowedProviderIds&&1===this.__slotStepSettings.AllowedProviderIds.length){if(this.Data.AppointmentBuilder.DidIncludeAdditionalProvidersInSearch)return!0;if(t=this.Data.AppointmentBuilder.getAppointment(this.__getCurrentApptBeingSelected()),(n=this.__getAllAvailableProviders(t))&&1===n.length&&n[0].ID===this.__slotStepSettings.AllowedProviderIds[0])return!1}return this.__doApptsBeingSelectedHaveMultipleSelectedProviders()||this.__doesMoreThanOneApptBeingSelectedAllowProviderSelection()||this.Data.AppointmentBuilder.UseTeams||this.Data.AppointmentBuilder.CanSearchAllLicensedVideoProviders||this.__isAtLeastOneProviderFilterSelected()||this.__doesAnyAppointmentAllowProviderSelection()},__doApptsBeingSelectedHaveMultipleSelectedProviders:function(){for(var n=0,t=null,i=this.Data.AppointmentBuilder.numAppointments(),n=0;n<i;n++)if((!this.__showSingleApptSelectSolutionsView||n===this.Data.AppointmentBuilder.getActiveApptIndex())&&(t=this.Data.AppointmentBuilder.getAppointment(n),$$WP.Scheduling.Workflow.allowProviderSelectForAppointment(this.Data.AppointmentBuilder,t)&&t.Providers.toArray().length>1))return!0;return!1},__doesMoreThanOneApptBeingSelectedAllowProviderSelection:function(){for(var n=0,i=0,r=null,t=this.Data.AppointmentBuilder.numAppointments(),n=0;n<t;n++)this.__showSingleApptSelectSolutionsView&&n!==this.Data.AppointmentBuilder.getActiveApptIndex()||(r=this.Data.AppointmentBuilder.getAppointment(n),$$WP.Scheduling.Workflow.allowProviderSelectForAppointment(this.Data.AppointmentBuilder,r)&&i++);return i>1},__doesAnyAppointmentAllowProviderSelection:function(){var n=null,t;return this.__showSingleApptSelectSolutionsView?(t=this.Data.AppointmentBuilder.getActiveApptIndex(),n=this.Data.AppointmentBuilder.getAppointment(t),$$WP.Scheduling.Workflow.allowProviderSelectForAppointment(this.Data.AppointmentBuilder,n)):this.Data.AppointmentBuilder.hasAppointmentThatAllowsProviderSelection()},__isDateIncludedInSelectedPreferences:function(n){var t=!(Array.isArray(this.__slotStepSettings.TimePreferences)&&Array.isArray(this.__slotStepSettings.TimePreferences[n.getDay()])&&Array.isArray(this.__slotStepSettings.TimePreferences[n.getDay()][0])&&-1===this.__slotStepSettings.TimePreferences[n.getDay()][0][0]);return!this.__isTimePreferencesFilteringEnabled()||t},__buildStandingOrderAppointments:function(){var n=[],t="",i=this.__sortScheduledAppts(this.ViewModel.RelatedScheduledAppts),r;for(r in i)t=this.__buildAppointmentDateString(i[r]),n.push(t);return n},__sortScheduledAppts:function(n){return n.sort(function(n,t){return new Date(n.DateTimeISO)-new Date(t.DateTimeISO)})},__buildAppointmentDateString:function(n){var i,t=new Date(n.DateTimeISO);return this.SchedulingStringsNamespace.addMnemonic("@MYCHART@APPOINTMENTYEAR@",t.getFullYear()),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@APPOINTMENTMONTH@",getMonthName(t.getMonth()+1)),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@APPOINTMENTDAYNUMBER@",t.getDate()),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@APPOINTMENTDAY@",getDayName(t.getDay())),i=this.SchedulingStringsNamespace.getString("AppointmentDate"),this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@APPOINTMENTYEAR@"),this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@APPOINTMENTMONTH@"),this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@APPOINTMENTDAYNUMBER@"),this.SchedulingStringsNamespace.removeMnemonic("@MYCHART@APPOINTMENTDAY@"),i},__getScheduledAppointmentsTitle:function(){var n,i,t="";return n=this.ViewModel.RelatedScheduledAppts.length,i=this.ViewModel.ScheduledAppointmentName,this.SchedulingStringsNamespace.addMnemonic("@MYCHART@SCHEDULEDAPPOINTMENTNAME@",i,$$WP.Strings.EncodingTypes.None),1===n?(this.ViewModel.ScheduledAppointmentSubTitle=this.ViewModel.HasFutureAppointment?this.SchedulingStringsNamespace.getString("UpcomingAppointmentSubTitle"):this.SchedulingStringsNamespace.getString("PastAppointmentSubTitle"),t=this.SchedulingStringsNamespace.getString("ScheduledAppointmentTitleSingular")):(this.ViewModel.ScheduledAppointmentSubTitle=this.SchedulingStringsNamespace.getString("ScheduledAppointmentSubTitle"),this.SchedulingStringsNamespace.addMnemonic("@MYCHART@SCHEDULEDAPPOINTMENTCOUNT@",n,$$WP.Strings.EncodingTypes.None),t=this.SchedulingStringsNamespace.getString("ScheduledAppointmentTitlePlural"),$$WP.Strings.removeMnemonic("@MYCHART@SCHEDULEDAPPOINTMENTCOUNT@")),$$WP.Strings.removeMnemonic("@MYCHART@SCHEDULEDAPPOINTMENTNAME@"),t},__buildViewModelForDay:function(n,i){var r=null,f=null,u="";if(!this.__isTypeObject(n))return null;for(u in r={Dte:i,DayString:t.Dte2DateString[i],ProviderGroups:[]},n)""!==u&&(f=this.__buildViewModelForProviders(n[u]))&&r.ProviderGroups.push(f);return 0===r.ProviderGroups.length?null:(r.ProviderGroups.sort(this.__sortProviderGroupsForDisplay),r)},__buildViewModelForProviders:function(n){var t={},i=null,r="";if(!this.__isTypeObject(n))return null;for(r in t={Providers:{},LocationGroups:[]},n)$$WPUtil.IsNullOrEmpty(r)||null!==(i=this.__buildViewModelForLocations(n[r]))&&(t.LocationGroups.push(i),i.HasUnfilteredSolution&&(t.HasUnfilteredSolution=!0));return t.LocationGroups.length>0&&(t.Providers=this.__getProviderHeaderViewModel(t.LocationGroups[0].SlotGroups[0][0])),t.LocationGroups.length>0?t:null},__getProviderHeaderViewModel:function(n){for(var i=0,t=null,r={},f=[],e=[],o="",s=this.FilterController.getSelectedFilters(),u=this.__getVisibleSolutionProviderIds(n),i=0;i<u.length;i++)t=this.Data.Providers.getFromIndex("ID",u[i]),-1===f.indexOf(t)&&(f.push(t),e.push(t.Name)),null!==s&&(o=this.__buildProviderMoreInfoString(t,this.__slotStepSettings.DefaultProviderLanguages,s));return r.Models=f,r.Names=e.join(this.SchedulingStringsNamespace.getString("SolutionListSeparator")),r.MatchString=o,r},__buildProviderMoreInfoString:function(n,t,i){for(var r={},h=[],e=0,o=0,u,f,s,c,e=0;e<i.length;e++)u=i[e].GroupIndex,f=i[e].OptionIndex,this.FilterController.isFiltersOptionsMutuallyExclusive(u)||(Array.isArray(n[u])?-1!==n[u].indexOf(f)&&(null!==r[u]&&void 0!==r[u]?r[u].push(f):r[u]=[f]):n[u]===f&&(null!==r[u]&&void 0!==r[u]?r[u].push(f):r[u]=[f]));if((null!==t||0!==t.length)&&void 0!==r.Languages&&0!==r.Languages.length)for(o=0;o<t.length;o++)r.Languages.push(t[o].Title);for(s in r)c=$$WP.Strings.get("FilterGroupTitle_"+s,"Scheduling"),h.push(c+r[s].join(this.SchedulingStringsNamespace.getString("SolutionListSeparator")));return h.join(this.SchedulingStringsNamespace.getString("ProviderFilterGroupSeparator"))},__buildViewModelForLocations:function(n){var i={},f="",e=[],u=null,r=0,o=0,h=null,c={},s=0;if(!this.__isTypeObject(n))return null;for(f in i={Locations:{},SlotGroups:[]},this.__showSingleApptSelectSolutionsView&&(s=this.Data.AppointmentBuilder.getActiveApptIndex()),n)for(e=n[f],f=Number(f),h=t.Dte2Date(e[0].Slots[s].Dte).getDay(),r=0;r<e.length;r++)u=e[r],Array.isArray(this.__slotStepSettings.TimePreferences)&&!this.__isSlotInSelectedPreferences(f,this.__slotStepSettings.TimePreferences[h])||(c[u.Slots[s].EffectiveApptTime]=u);for(i.SlotGroups=function(n){var u,t,r,i;for(u in t=[],n)t.push(Number(u));for(t.sort(function(n,t){return n-t}),r=[],i=0;i<t.length;i++)r.push(n[t[i]]);return r}(c),r=0;r<i.SlotGroups.length;r++)i.SlotGroups[r]=[i.SlotGroups[r]],i.SlotGroups[r][0].HasPassedFilterCheck&&(i.HasUnfilteredSolution=!0);if(this.__showDetailedSolutionsView||this.__showSingleApptSelectSolutionsView)for(r=0;r<i.SlotGroups.length;r++)for(o=0;o<i.SlotGroups[r].length;o++)(u=i.SlotGroups[r][o]).SolutionViewModel||(u.SolutionViewModel=a(this.Data,u,this._workflow));return i.SlotGroups.length>0&&(i.Locations=this.__getLocationHeaderViewModel(i.SlotGroups[0][0])),i.SlotGroups.length>0?i:null},__getLocationHeaderViewModel:function(n){for(var r=0,t=null,s=[],f=[],e=[],o=[],i={},h=0,u=this.__getVisibleSolutionLocationIds(n),r=0;r<u.length;r++)t=this.Data.Locations.getFromIndex("Id",u[r]),-1===o.indexOf(t)&&(h++,o.push(t),s.push(t.Name),null!==t.Address&&f.push(t.Address.join(" ")),null!==t.DistanceToUser&&e.push(t.DistanceToUser));return i.Models=o,i.Name=s.join(this.SchedulingStringsNamespace.getString("SolutionListSeparator")),1===h&&(1===f.length&&(i.Address=f[0]),1===e.length&&(i.DistanceToUser=e[0])),i},__isSlotInSelectedPreferences:function(n,t){for(var i=0,r=!1,i=0;i<t.length;i++)if(n>=t[i][0]&&n<t[i][1]){r=!0;break}return!this.__isTimePreferencesFilteringEnabled()||r},__getAvailableRequestSolutions:function(n){var s,h,i,r=0,u=0,f=null,c=null,l=null,a=null,e=[],v=null,o=[];if(null===(s=this.Data.AppointmentBuilder.ReasonForVisit)||this.Data.AppointmentBuilder.numAppointments()>1)return e;for(1===(i=n.Providers.toArray().slice(0)).length&&(this.__isProviderFirstWorkflow()||this.Data.AppointmentBuilder.IsUsingProviderDropdown)||this.__tryAddOtherProvider(i),h=t.getRequestSlotKey(s.Id),(f=n.getSelectedDepartmentsCollection()).Models.length>1&&this.__addOtherDepartmentLocally(f),r=0;r<i.length;r++)for(v=i[r],o=this.Data.Solutions.getFromIndex(["SlotKey","ProviderId"],[h,v.ID]),u=0;u<o.length;u++)c=(a=o[u]).Slots[0],l=this.Data.Departments.getFromIndex("ID",c.DepartmentId),f.contains(l)&&e.push(a);return e},__tryGetOtherProvider:function(){for(var n=0,i=this.Data.AppointmentBuilder.getFirstAppointment(),t=$$WPSchedulingUtil.BuildProvidersFiltered(!0,!0,!1,i.ReasonForVisit,i.getSelectedDepartmentsCollection().toArray(),!0),r=null,n=0;n<t.length;n++)"-1"===t[n].ID&&(r=t[n]);return r},__tryAddOtherProvider:function(n){var t=this.__tryGetOtherProvider();null!==t&&-1===n.indexOf(t)&&n.push(t)},__buildViewModelForProvidersForRequest:function(){var c,u=[],f=0,e=0,o=0,l=0,t=null,a=null,s="",y="",p=null,r=null,v=null,n=[],h=[],w=!1;for(this.ViewModel.ProvidersForRequest=[],c=this.Data.AppointmentBuilder.numAppointments(),o=0;o<c;o++)for(t=this.Data.AppointmentBuilder.getAppointment(o),n=this.__getAvailableRequestSolutions(t),w=t.ProviderDepartmentPairs.length>0,1===(u=t.Providers.toArray().slice(0)).length&&(this.__isProviderFirstWorkflow()||this.Data.AppointmentBuilder.IsUsingProviderDropdown)||this.__tryAddOtherProvider(u),f=0;f<u.length;f++){for(a=u[f],h=[],e=0;e<n.length;e++)(v=(r=n[e]).Slots[0]).ProviderId===a.ID&&("-1"===v.DepartmentId?r.DepartmentLink=this.SchedulingStringsNamespace.getString("OtherDepartmentRequestString"):(p=this.Data.Departments.getFromIndex("ID",v.DepartmentId),this.SchedulingStringsNamespace.addMnemonics({"@MYCHART@DEPARTMENT@":{Value:p.Name,EncodingType:$$WP.Strings.EncodingTypes.None}}),r.DepartmentLink=this.SchedulingStringsNamespace.getString("DepartmentRequestString"),this.SchedulingStringsNamespace.clearMnemonics()),h.push(r),y=r.ModelId);h.length>0&&this.ViewModel.ProvidersForRequest.push({Provider:a,Solutions:h})}this.__canShowRequestWorkflow(w)?1===c&&this.__getSingleLocationRequestSolution(t,n)&&!this.__isAtLeastOneProviderFilterSelected()?this.stepSettings.Hide=!0:n.length>0&&(this.ViewModel.ShowExpandedRequestOptions=!0,this.stepSettings.Hide=!1):(l=this.Data.AppointmentBuilder.getActiveApptIndex(),this.Data.AppointmentBuilder.getAppointment(l).SelectedTelehealthMode===i.TelehealthModeEnum.Video&&this.Data.AppointmentBuilder.getAppointment(l).VisitType.AllowedTelehealthModes.length>1&&!this.ViewModel.IsAtLeastOneFilterSelected&&(this.ViewModel.NoProvidersAvailableForTelehealthMode=!0),1===n.length?(this.ViewModel.ShowSingleRequestLink=!0,s="<a href='#' class='departmentbutton' data-model-id='"+y+"'>"+this.SchedulingStringsNamespace.getString("RequestableProvidersLinkSinglePair")+"<\/a>",this.stepSettings.Hide=!1):n.length>1&&(this.ViewModel.ShowExpandableRequestLink=!0,s="<button type='button' class='expandrequestoptions linktextdecoration linkcolor' id='requestoption_"+this.Id+"'>"+this.SchedulingStringsNamespace.getString("RequestableProvidersLinkMultiplePairs")+"<\/button>",this.stepSettings.Hide=!1),$$WPUtil.IsNullOrEmpty(s)||(this.SchedulingStringsNamespace.addMnemonics({"@MYCHART@REQUESTLINK@":{Value:s,EncodingType:$$WP.Strings.EncodingTypes.None}}),this.ViewModel.RequestTitle=this.SchedulingStringsNamespace.getString("RequestableProvidersTitle"),this.ViewModel.RequestLink=this.SchedulingStringsNamespace.getString("RequestableProvidersLink")))},__canShowRequestWorkflow:function(n){return!n&&!(this.__canShowPatientLocationBanner()&&!this.__isProviderFirstWorkflow())&&!this.__getIsTeamSchedulingAllowed()},__buildViewModelForTelehealthMode:function(){var r=this.Data.AppointmentBuilder.getActiveApptIndex(),n=this.Data.AppointmentBuilder.getAppointment(r).SelectedTelehealthMode,t=this.Data.AppointmentBuilder.getAllowedTelehealthModes();n===i.TelehealthModeEnum.InPerson?this.ViewModel.IsInPersonTelehealthMode=!0:n===i.TelehealthModeEnum.Video?this.ViewModel.IsVideoTelehealthMode=!0:n===i.TelehealthModeEnum.Telephone&&(this.ViewModel.IsTelephoneTelehealthMode=!0);this.ViewModel.CanShowProviderTelehealthBadges=!$$WPUtil.IsNullOrEmpty(t)&&t.length>1&&(this.Data.AppointmentBuilder.isSelectedTelehealthModeSameForAppts()||this.__showSingleApptSelectSolutionsView)},__getSingleLocationRequestSolution:function(n,t){return 1===t.length?t[0]:null},__getOtherSolution:function(n){for(var t=0,t=0;t<n.length;t++)if("-1"===n[t].Slots[0].DepartmentId)return n[t];return null},__addOtherDepartmentLocally:function(n){var t;(t=this.Data.Departments.getFromIndex("ID","-1"))&&!n.contains(t)&&n.add(t)},__shouldShowTicketWaitListOptions:function(){return this.__isTicketWorkflow()&&!this.Data.SlotLoader.isLoading()&&0===this.Data.Solutions.Models.length&&this._workflow.TicketInfo.CanBeSentOffers&&!this._workflow.TicketInfo.IsOptedInToOffers},__shouldShowTeamSchedulingInSidebar:function(){return this.__isTeamSchedulingAllowed&&(1===this.__slotStepSettings.ShowTeamBeforeSearch||2===this.__slotStepSettings.ShowTeamBeforeSearch)},__shouldShowTeamsMidSlots:function(){var n=this.ViewModel.Days.length,t=null,i=null;return!this.ViewModel.TeamSchedulingDefaultChecked&&!!this.__isTeamSchedulingAllowed&&(n>0?(t=this.ViewModel.Days[0],i=this.ViewModel.Days[n-1],0===this.__slotStepSettings.ShowTeamBeforeSearch&&this.__isDteFourWeeksAway(t.Dte)||this.ViewModel.TeamSchedulingShowInSidebar&&this.__isReadyToShowTeamsMidSlots(i)):this.__shouldOfferTeamsOnNoData())},__shouldOfferTeamsOnNoData:function(){return this.__isTeamSchedulingAllowed&&!this.Data.SlotLoader.isLoading()&&!this.Data.AppointmentBuilder.UseTeams},__isReadyToShowTeamsMidSlots:function(n){return!this.__canSearchMoreDates()||this.ViewModel.Days.length>2||this.__isDteFourWeeksAway(n.Dte)},__shouldShowAddAllProvidersOption:function(){var n,t;return n=this.Data.AppointmentBuilder.getFirstAppointment(),t=this.__getAllAvailableProviders(n).map(function(n){return n.ID}),$$WPSchedulingProvidersCore.IsSingleAllowedProviderStillElligibleForScheduling(t,this.__slotStepSettings.AllowedProviderIds)&&!this.Data.AppointmentBuilder.DidIncludeAdditionalProvidersInSearch&&this._workflow.isTypeOpenSchedulingWidget()&&this.__doesAnyAppointmentAllowProviderSelection()&&!$$WPSchedulingProvidersCore.AreAllProvidersSelected(n)&&!this.__isAtLeastOneProviderFilterSelected()},__shouldShowAddOutOfNetworkProvidersOption:function(){return appointment=this.Data.AppointmentBuilder.getFirstAppointment(),this._workflow.isTypeOpenSchedulingWidget()&&this.__doesAnyAppointmentAllowProviderSelection()&&!$$WPSchedulingProvidersCore.AreAllProvidersSelected(appointment)&&!this.__shouldShowAddAllProvidersOption()&&!this.FilterController.hasNetworkFilterBeenCleared()},__getLoadingOverlay:function(){return this.ViewModel.ShowExpandedRequestOptions?this.$root.find(".requestList .ajaxspinner"):this.$root.find(".slotsData .ajaxspinner")},__lockLoadOverlayPosition:function(){this.__getLoadingOverlay().addClass("defaultajaxoverlay");this.__getLoadingOverlay().removeClass("defaultajaxinline")},__releaseLoadOverlayPosition:function(){this.__getLoadingOverlay().removeClass("defaultajaxoverlay");this.__getLoadingOverlay().addClass("defaultajaxinline")},__getLoadAnotherBatchButton:function(){return this.$root.find(".loadanotherbatchbutton")},__getFilterNoSlotsLoaded:function(){return this.$root.find(".filterNoSlotsLoaded")},__getVerboseError:function(){return this.$root.find(".verboseError")},__isTicketWorkflow:function(){return this._workflow.Type===n.WorkflowTypesEnum.Ticket},__isRescheduleWorkflow:function(){return this._workflow.Type===n.WorkflowTypesEnum.Reschedule},__isDecisionTreeNodeWorkflow:function(){return this._workflow.Type===n.WorkflowTypesEnum.DecisionTreeNode},__isNewProviderWorkflow:function(){return this._workflow.Type===n.WorkflowTypesEnum.NewProvider},__isWidgetWorkflow:function(){return this._workflow.isTypeOpenSchedulingWidget()},__isOpenSchedulingWorkflow:function(){return this._workflow.isTypeOpenScheduling()},__isProviderFirstWorkflow:function(){return this._workflow.Type===n.WorkflowTypesEnum.ExistingProvider},__canShowTelehealthToggle:function(){var t=this.Data.AppointmentBuilder.getAllowedTelehealthModes();return!this.__isRescheduleWorkflow()&&!this.__areFiltersFullScreenExpanded()&&this._workflow.Type!==n.WorkflowTypesEnum.OnDemandTelehealth&&!$$WPUtil.IsNullOrEmpty(t)&&t.length>1},__isTypeObject:function(n){return"object"===$.type(n)},hasStickyBanner:function(){return!1},__getFocusableElements:function(n){return n.find($afe.select("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), *[tabindex]"))},__onOptInToTicketWaitListClicked:function(){this.__renderAdHocJoinWaitListStep();this.__isWPPopupOpen=!0},__renderAdHocJoinWaitListStep:function(){this.__adHocJoinWaitListStepController||this.__createAdHocJoinWaitListStep();this.__adHocJoinWaitListStepController.renderInPopup(this.SchedulingStringsNamespace.getString("JoinTicketWaitListStepHeader"))},__createAdHocJoinWaitListStep:function(){var n={type:$$WP.Scheduling.SchedulingStep.StepTypeEnum.JoinWaitList},t=this.Data.SchedulingSteps.getFromIndex("ID",this.Id).StackId,i={SchedulePreferences:this.__slotStepSettings.OnFileSchedulePreferences,DaysOfWeekList:this.__slotStepSettings.DaysOfWeekList};this.__adHocJoinWaitListStepController=new $$WP.Scheduling.AdHocStepWorkflowController(n,t,this.Data,this._workflow,i,this.__workflowEventCallbacks,this.__closePopupCallback)},__onChangeLocationButtonClicked:function(){this.__renderAdHocPatientLocationStep();this.__isWPPopupOpen=!0},__renderAdHocPatientLocationStep:function(){this.__adHocPatientLocationStepController||this.__createAdHocPatientLocationStep();this.__adHocPatientLocationStepController.renderInPopup(this.SchedulingStringsNamespace.getString("ChangeLocationTitle"))},__createAdHocPatientLocationStep:function(){var n,t;t=this.Data.SchedulingSteps.getFromIndex("ID",this.Id).StackId;n={type:$$WP.Scheduling.SchedulingStep.StepTypeEnum.TelehealthLocation};this.__adHocPatientLocationStepController=new $$WP.Scheduling.AdHocStepWorkflowController(n,t,this.Data,this._workflow,null,this.__workflowEventCallbacks,this.__closePopupCallback)},__closePopupCallback:function(){this.__isWPPopupOpen=!1},__onEditLocationClicked:function(){this.__areFiltersCollapsed||this.__onFilterCollapseClicked();this.__setAriaHiddenForFullPageFilters();$$WPSchedulingUtil.ReturnToStep($$WP.Scheduling.SchedulingStep.StepTypeEnum.Location,this.Data,this.__workflowEventCallbacks.onNavigateBack,!0,this.ViewModel.ViewModelApptIndex)},__onEditProviderClicked:function(){this.__areFiltersCollapsed||this.__onFilterCollapseClicked();this.Data.AppointmentBuilder.setProperty("CanSearchAllLicensedVideoProviders",!1);this.__setAriaHiddenForFullPageFilters();$$WPSchedulingUtil.ReturnToStep($$WP.Scheduling.SchedulingStep.StepTypeEnum.Provider,this.Data,this.__workflowEventCallbacks.onNavigateBack,!0,this.ViewModel.ViewModelApptIndex)},onWorkflowDestroyed:function(){removeCalendarExternal()},isInsuranceSelectionValid:function(){var n=this._workflow.SchedulingControllerParams.insuranceId;return!$$WPUtil.IsNullOrEmpty(n)&&"-2"!==n&&"-3"!==n}};c.ModesEnum=e;$$WP.Scheduling.SlotStepController=c;c.extend($$WP.Scheduling.StepController,"WP$Scheduling$SlotStepController")}();!function(){var n=$$WP.Scheduling.Workflow,i=$$WP.Scheduling.VisitType,t=function(t,i,r,u,f,e,o,s,h,c,l,a,v){this.WP$Scheduling$StepController(t,r,null,null,null,$$WP.Templates.Scheduling.ConfirmationStep);this.proxify("updateStep","_onClickSchedule","_onScheduled","_loadReviewData","_onReviewDataLoaded","_onCommentsModified","_onFavoriteCheckboxChanged","_onWaitListCheckboxChanged","__returnToSlotStep","__onSchedulingStopButtonClicked","__onRedirectUrlReceived","__onClickLogin","__onClickScheduleAsGuest","__onEditLocationClicked","__onSchedulingErrorCallback","__onChangeLocationButtonClicked","__isInSelfTriageForAll","__isCondensedScheduling","__isLoggedIn","__isInSelfTriage");this._workflow=i;this.__isRescheduling=this._workflow.Type===n.WorkflowTypesEnum.Reschedule;this.__isPreLogin=this._workflow.Type===n.WorkflowTypesEnum.NewProvider||this._workflow.Type===n.WorkflowTypesEnum.Widget;this.__rescheduleReasons=e||[];this.__requireRescheduleReason=o||!1;this.__onSchedulingCompleteCallback=u;this.__onErrorCallback=f;this.__disableFavoriteAppointments=s||!1;this.__disableAddToWaitList=h||!1;this.__isLoginEnabled=c||!1;this.__isScheduleAsGuestDisabled=l;this.__isDepartmentStepHiddenByQueryParams=a;this.__isDemoMode=v||!1};t.prototype={__comments:null,__disableFavoriteAppointments:null,__disableAddToWaitList:null,__requireRescheduleReason:null,__rescheduleReasons:null,__selectedRescheduleReason:null,__onSchedulingCompleteCallback:null,__onErrorCallback:null,__previouslySelectedSlot:null,__reviewResult:null,__isLoaded:!1,__isCurrentlyLoading:!1,__favoriteCheckboxValue:!1,__waitListCheckboxValue:!1,__isRescheduling:!1,__isPreLogin:!1,__isLoginEnabled:!1,__isScheduleAsGuestDisabled:!1,__isDepartmentStepHiddenByQueryParams:!1,__isDemoMode:!1,updateViewModel:function(){var a,v,y,u,p,f,e,w,b,o=!1,k=!1,d=-1,n=null,s=null,t=null,h="",r=!1,c=null,g=[],l=!1,nt=!1,tt=!1,it=!1,rt="";a=new $$WP.FormValidation.ValidationSettings({required:this.__doesStepRequireComments(),maxLength:this.__getMaxCommentsLength(),showCharacterCounter:!0,stringsNamespace:"Core.FormValidation.Scheduling.ConfirmationStep"});v=new $$WP.FormValidation.ValidationSettings({required:this.__requireRescheduleReason,stringsNamespace:"Core.FormValidation.Scheduling.ConfirmationStep"});this.template=$$WP.Templates.Scheduling.ConfirmationStep;this.__selectedRescheduleReason=this._getSelectedRescheduleReasonFromDom();this.__isLoaded?this.__reviewResult.Success?(d=this.Data.AppointmentBuilder.getFirstAppointmentIndex(),n=this.__reviewResult.Appointments[d],r=this.__shouldShowSolutionDetails(),s=this.__getProviderToUseForPhoto(),(t=new $$WP.Scheduling.SolutionViewModel).populateFromReviewResult(this.Data,this.__reviewResult,this._workflow),t.HasPatientLocation=!$$WPUtil.IsNullOrEmpty(this.Data.AppointmentBuilder.PatientLocation)&&this.Data.AppointmentBuilder.hasProvidersWithTelehealthLocations(),c=this.__getPrimaryAppointmentViewModel(t),h=this.__getCompiledInstructionsFromReviewResult(this.__reviewResult),y=n.TelehealthMode===$$WP.Scheduling.VisitType.TelehealthModeEnum.Video,u=i.isInPersonTelehealthMode(n.TelehealthMode),b=n.TelehealthMode===$$WP.Scheduling.VisitType.TelehealthModeEnum.Telephone,o=n.DepartmentInstructions.length>0&&u&&!r,k=""!==h,l=0!==(g=this.Data.AppointmentBuilder.getSchedulingInstructions(this.Data.VisitTypes,this._workflow)).join("").length&&!this.__didPatientSeeSchedulingInstructionsOnSlotsStep(),p=k||o||l,f=this._canFavoriteAppointment(),e=this._canAddToWaitList(),w=this._getAddToWaitListByDefault(),nt=this.__isLoginEnabled&&!this.Data.AppointmentBuilder.ReasonForVisit.IsDemographicAuthRequired,it=(tt=!this.__isScheduleAsGuestDisabled)||!tt&&!this.__isLoginEnabled,this.ViewModel={StepShouldBeActive:!0,IsLoading:!1,PrimaryAppointmentViewModel:c,ShowProvider:!!s&&!r,Provider:s,Warnings:this.__reviewResult.Warnings,ShowWarnings:this.__reviewResult.Warnings.length>0,VTMWarningBannerViewModel:$$WPSchedulingUtil.GetVTMWarningBannerModel(this.__reviewResult.VTMWarnings),AllowComments:this.__doesStepAllowComments(),RequireComments:this.__doesStepRequireComments(),CommentsValidationSettings:a,Comments:this.__comments,RescheduleReasons:this.__rescheduleReasons,RequireRescheduleReason:this.__requireRescheduleReason,RescheduleReasonsValidationSettings:v,HasRightColumnContent:p,CanShowDepartmentDirections:o,DepartmentDirections:n.DepartmentInstructions,CanShowSchedulingInstructions:l,Instructions:g,PatientInstructions:h,IsVideoVisit:y,IsInPersonVisit:u,IsTelephoneVisit:b,CommentsElementId:"schedulingConfirmationComments_"+this.Id,WaitListElementId:"waitListCheckbox_"+this.Id,FavoritesElementId:"favoritesCheckbox_"+this.Id,IsMobile:$$WP.Utilities.UI.IsMobile,IsRescheduling:this.__isRescheduling,IsPreLogin:this.__isPreLogin,CanFavoriteAppointment:f,CanAddToWaitList:e,AddToWaitListByDefault:w,ShowExtraOptions:f||e,HasMultipleAppointments:this.Data.AppointmentBuilder.numAppointments()>1,SolutionViewModel:t,CanShowSolutionDetails:r,IsBundle:this.__isBundle(),IsEmbedded:$$WP.WidgetMode,IsCustomBranded:isCustomBranded(),IsLoggedIn:this.__isLoggedIn(),IsAuthenticatedWidget:this._workflow.IsAuthenticatedWidget,HasPatientLocation:!$$WPUtil.IsNullOrEmpty(this.Data.AppointmentBuilder.PatientLocation)&&this.Data.AppointmentBuilder.hasProvidersWithTelehealthLocations()&&!this.Data.AppointmentBuilder.canSkipLicensureForAllVideoVisits(),IsCondensedScheduling:this.__isCondensedScheduling(),CanEditLocations:$$WPSchedulingUtil.CanEditStep(this.Data,this._workflow.Type,$$WP.Scheduling.SchedulingStep.StepTypeEnum.Location,this.__isDepartmentStepHiddenByQueryParams),CanShowCaptchaDeclaration:this._workflow.IsAnonymous&&!!this._workflow.SecureSessionToken&&!$$WP.Captcha.IsVisible(),IsLoginEnabled:nt,CanContinueToLoginOrScheduleAsGuest:it,ReservationBlurbViewModel:{IsSlotReserved:!!this.Data.AppointmentBuilder.getAppointment(0).Slot.ReservationKey},CaptchaDeclaration:this.__getCaptchaDeclaration(),HasSchedulingReason:this.__doesStepAllowComments()||this.__rescheduleReasons.length,IsDemoMode:this.__isDemoMode},$$WPUtil.IsNullOrEmpty(this.Data.AppointmentBuilder.PatientLocation)||(rt=this.Data.AppointmentBuilder.PatientLocation.LocationName),this.SchedulingStringsNamespace.addMnemonics({"@MYCHART@DEPARTMENT@":{Value:c.Department.Name,EncodingType:$$WP.Strings.EncodingTypes.HTML},"@MYCHART@RESERVATIONEXPIRATIONTIME@":{Value:this.Data.AppointmentBuilder.getAppointment(0).Slot.ReservationExpirationTimeString,EncodingType:$$WP.Strings.EncodingTypes.HTML},"@MYCHART@PATIENTLOCATION@":{Value:rt,EncodingType:$$WP.Strings.EncodingTypes.HTML}})):this.__updateViewModelWithError():(this.ViewModel={StepShouldBeActive:!0,IsLoading:!0},this._loadReviewData())},__isLoggedIn:function(){return!(this.__isInSelfTriageForAll()&&!this._workflow.SchedulingControllerParams.isInsuranceCollectionComplete)&&!this._workflow.IsAnonymous},__isCondensedScheduling:function(){return!(!this.__isInSelfTriageForAll()||this._workflow.SchedulingControllerParams.isInsuranceCollectionComplete)||this._workflow.isTypeOpenScheduling()},__didPatientSeeSchedulingInstructionsOnSlotsStep:function(){return!this.Data.AppointmentBuilder.getFirstAppointment().Slot.IsPreselected},__getCaptchaDeclaration:function(){if("undefined"==typeof $$WP||void 0===$$WP.Captcha||"function"!=typeof $$WP.Captcha.GetProvider||void 0===$$WP.Captcha.ProviderType)return"";var f,t=null,i=null,r="",u="",n=$$WP.Strings.getNamespace("Scheduling.Fixed");return(t=document.createElement("a")).innerText=n.getString("PrivacyPolicy"),(i=document.createElement("a")).innerText=n.getString("TermsOfService"),$$WP.Captcha.GetProvider()===$$WP.Captcha.ProviderType.Google?(t.href="https://policies.google.com/privacy",i.href="https://policies.google.com/terms",r=n.getString("GoogleCompanyName"),u=n.getString("ReCaptchaName")):(t.href="https://www.hcaptcha.com/privacy",i.href="https://www.hcaptcha.com/terms",r=n.getString("IntuitionMachinesName"),u=n.getString("HCaptchaName")),n.addMnemonics({"@MYCHART@PRIVACYPOLICYMNEMONIC@":{Value:t.outerHTML,EncodingType:$$WP.Strings.EncodingTypes.None},"@MYCHART@TERMSOFSERVICEMNEMONIC@":{Value:i.outerHTML,EncodingType:$$WP.Strings.EncodingTypes.None},"@MYCHART@CAPTCHAPROVIDER@":{Value:r,EncodingType:$$WP.Strings.EncodingTypes.None},"@MYCHART@CAPTCHATITLE@":{Value:u,EncodingType:$$WP.Strings.EncodingTypes.None}}),f=n.getString("CaptchaBlurb"),n.clearMnemonics(),f},__updateViewModelWithError:function(){this.ViewModel={SchedulingStoppedTitle:this.__reviewResult.Error.PatientFriendlyErrorMessageTitle,SchedulingStoppedPretext:this.__reviewResult.Error.PatientFriendlyErrorMessage.join(" "),SchedulingStoppedButtontext:this.__reviewResult.Error.PatientFriendlyErrorMessageButtonText,HideButton:!this.__reviewResult.Error.IsPatientFriendlyErrorMessageRecoverable,HideStoppedIcon:this.__reviewResult.Error.IsPatientFriendlyErrorMessageIconHidden};this.ViewModel.StepShouldBeActive=!0;this.ViewModel.IsLoading=!1;this.template=$$WP.Templates.Scheduling.SchedulingStopped},__getPrimaryAppointmentViewModel:function(n){var i=n.Appointments[0],t=new $$WP.Scheduling.AppointmentViewModel(i.toRawObject());return t.TitleHtml=this.__getCardTitleHtml(),t.LengthInMinutes=this.__shouldShowDuration()?this.Data.AppointmentBuilder.getTotalLengthInMinutes():0,t},__getCompiledInstructionsFromReviewResult:function(n){var s=this.__getSortedInstructions(n,this.Data.AppointmentBuilder),r=[],t=0,u=this.Data.AppointmentBuilder.numAppointments(),f=u>1,e=null,i="",o=null;for(null!==n.PatientInstructionsHtml&&n.PatientInstructionsHtml.length>0&&this.__appendInstructionsToArray(n.PatientInstructionsHtml,this.__getAppointmentNameForCardTitle(),f,r),t=0;t<u;t++)o=this.Data.AppointmentBuilder.getAppointment(t),i=s[t].InstructionsHtml,e=$$WPSchedulingUtil.GetVisitDisplayName(o,this._workflow.TicketInfo),null!==i&&i.length>0&&this.__appendInstructionsToArray(i,e,f,r);return r.join("")},__getSortedInstructions:function(n,t){for(var i=0,f=null,e=null,r=null,o={},u=[],i=0;i<t.numAppointments();i++)e=(f=t.getAppointment(i)).Slot,r=n.Appointments[i],o={DateTimeUtc:e.DateTimeUtc,InstructionsHtml:r.PatientInstructionsHTML,DisplayName:r.DisplayName||f.VisitType.DisplayName},u.push(o);return u.sort($$WP.Scheduling.Slot.slotSortFunction),u},__appendInstructionsToArray:function(n,t,i,r){i&&r.push("<section><div class='bold'>"+HTMLEncode(t)+"<\/div>");r.push(n);i&&r.push("<\/section>")},arePrerequisitesComplete:function(){for(var n=0,t=null,i=!1,n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)if(i=null!==(t=this.Data.AppointmentBuilder.getAppointment(n).Slot)&&t.IsRequest,!t||i)return!1;return!0},__getProviderToUseForPhoto:function(){for(var t=0,r=null,u=null,i=[],t=0;t<this.Data.AppointmentBuilder.numAppointments();t++)r=this.Data.AppointmentBuilder.getAppointment(t),n.allowProviderSelectForAppointment(this.Data.AppointmentBuilder,r)&&(u=this.Data.Providers.getFromIndex("ID",r.Slot.ProviderId),-1===i.indexOf(u)&&i.push(u));return 1===i.length?i[0]:null},__shouldShowDuration:function(){return this.__reviewResult.Appointments[0].AppointmentLength>0},__getCardTitleHtml:function(){var r,t,u,i=null,f=!0;return t=this.Data.AppointmentBuilder.getFirstAppointment(),r=this.__getAppointmentNameForCardTitle(),u=this.Data.Departments.getFromIndex("ID",t.Slot.DepartmentId),1===this.Data.AppointmentBuilder.numAppointments()?(i=this.Data.Providers.getFromIndex("ID",t.Slot.ProviderId),f=n.allowProviderSelectForAppointment(this.Data.AppointmentBuilder,t)):i=this.__getProviderToUseForPhoto(),$$WPSchedulingUtil.ConstructAppointmentStringHtml(i,u,r,f)},__getAppointmentNameForCardTitle:function(){var t=this.Data.AppointmentBuilder.getFirstAppointmentIndex(),i=this.Data.AppointmentBuilder.getFirstAppointment();switch(this._workflow.Type){case n.WorkflowTypesEnum.Ticket:return this.__isBundle()?this._workflow.Title:this._workflow.TicketInfo.DisplayName;case n.WorkflowTypesEnum.Reschedule:case n.WorkflowTypesEnum.DecisionTreeNode:return this.__reviewResult.Appointments[t].DisplayName||i.VisitType.DisplayName;default:return this.Data.AppointmentBuilder.numAppointments()>1?this.Data.AppointmentBuilder.ReasonForVisit.Title:this.__reviewResult.Appointments[t].DisplayName||i.VisitType.DisplayName}},beforeFirstRender:function(){$$WPSchedulingUtil.RegisterConfirmationPartials()},afterRender:function(){var n,t,i="#"+this.ViewModel.WaitListElementId,r="#"+this.ViewModel.FavoritesElementId;$$WP.FormValidation.initializeDOMSubtree(this.$root);this.$root.find("#reschedulereason_label_"+this.__selectedRescheduleReason).trigger("click");$afe.select(".cardlist.matchHeights").each($$WP.Utilities.UI.Cards.MatchHeights);this.SchedulingStringsNamespace.clearMnemonics();$$WP.Utilities.UI.IsMobile&&$$WP.Utilities.Mobile.Optimization.ChangeToFlexboxLayout();this.__isLoaded?($$WPUtil.HideAjaxSpinner(this.$root.find(".confirmationstep .ajaxspinner")),this.triggerViewEvent($$WP.Analytics.ViewEvent.SubmodulesEnum.ConfirmationStep),null===(n=this.Data.AppointmentBuilder.getFirstAppointment().Slot)||this.__previouslySelectedSlot===n||n.IsRequest||this.$root.find("h2.header").focus(),this.__previouslySelectedSlot=n,this.$root.find("[data-id='schedule']").on("click",this._onClickSchedule),this.$root.find("[data-id='schedule-login']").on("click",this.__onClickLogin),this.__isInSelfTriageForAll()&&!this._workflow.SchedulingControllerParams.isInsuranceCollectionComplete?(this.$root.find("[data-id='schedule-guest']").on("click",this._onClickSchedule),this.$root.find("[data-id='schedule-condensed']").on("click",this._onClickSchedule),this.$root.find("[data-id='schedule-condensed']").on("auxclick",this._onClickSchedule)):(this.$root.find("[data-id='schedule-guest']").on("click",this.__onClickScheduleAsGuest),this.$root.find("[data-id='schedule-condensed']").on("click",this.__onClickScheduleAsGuest),this.$root.find("[data-id='schedule-condensed']").on("auxclick",this.__onAuxClickSchedule)),this.$root.find("textarea[name='comments']").on("change",this._onCommentsModified),this.$root.find(r).on("change",this._onFavoriteCheckboxChanged),this.$root.find(i).on("change",this._onWaitListCheckboxChanged),this.$root.find("#schedulingstop-button").click(this.__onSchedulingStopButtonClicked),this.$root.find("#editSlot").click(this.__returnToSlotStep),this.$root.find("#editLocationConfirmation").click(this.__onEditLocationClicked),$$WPSchedulingUtil.SetUpInstructions(this.ViewModel),this.$root.find(".schedulebutton").addClass("stickybanner"),this.$root.find(".changeLocationBtn").click(this.__onChangeLocationButtonClicked),(isCustomBranded()||$$WP.WidgetMode)&&this.__addConfirmationStepMyChartBranding()):(t=this.$root.find(".confirmationstep .ajaxspinner"),$$WPUtil.ShowAjaxSpinner(t));this.__isLoaded=!1;this.__waitListCheckboxValue=this._getAddToWaitListByDefault();this.__setAddToWaitListForAllAppointments(this.__waitListCheckboxValue);$$WPSchedulingUtil.HandleStickyBanner()},__addConfirmationStepMyChartBranding:function(){var n;n=$afe.select("#footer .sidebarStyle").clone();this.$root.find(".card.differentHeights").safeAppend(n)},triggerViewEvent:function(){this.__isLoaded&&this.WP$Scheduling$StepController$triggerViewEvent()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.ConfirmationStep},_canFavoriteAppointment:function(){if(this.__isGuestOrAnonymousContext()||!this.__reviewResult||!this.__reviewResult.Appointments[0].CanSaveAsFavorite||this.__disableFavoriteAppointments)return!1;var t=this._workflow.Type;return t===n.WorkflowTypesEnum.Standard||t===n.WorkflowTypesEnum.Procedure||t===n.WorkflowTypesEnum.ExistingProvider},_canAddToWaitList:function(){return!this.__isBundle()&&!this.__isGuestOrAnonymousContext()&&!this.__disableAddToWaitList&&!!this.__reviewResult&&this.__reviewResult.Appointments[0].CanAddToWaitListWithFastPass},_getAddToWaitListByDefault:function(){return!this.__isGuestOrAnonymousContext()&&!this.__disableAddToWaitList&&!!this.__reviewResult&&this.__reviewResult.Appointments[0].AddToWaitListByDefault},__isGuestOrAnonymousContext:function(){return this._workflow.IsAnonymous||this._workflow.IsGuest},_loadReviewData:function(){var n;this.__isCurrentlyLoading||(n=this.__getAjaxParameters(!1),$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("ReviewAppointment",this._workflow)),data:$$WPUtil.postify(n),cache:!1,success:this._onReviewDataLoaded,error:this.__onErrorCallback}),this.__isCurrentlyLoading=!0)},_onReviewDataLoaded:function(n){this.__reviewResult=n;this.__isLoaded=!0;this.__isCurrentlyLoading=!1;this.updateStep()},_onClickSchedule:function(n){n.preventDefault();this.__validateForm()&&($afe.select(".startover").prop("disabled",!0),this.__isInSelfTriageForAll()&&!this._workflow.SchedulingControllerParams.isInsuranceCollectionComplete?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete):this.__schedulePostlogin())},__isInSelfTriage:function(){return!!this._workflow.SchedulingControllerParams&&this._workflow.SchedulingControllerParams.rootDecisionTreeID},__isInSelfTriageForAll:function(){return this.__isInSelfTriage()&&this._workflow.IsGuest},__validateForm:function(){return!(!this._areCommentsValid()||!this._isSelectedRescheduleReasonValid())||(this.__updateRescheduleReasonValidationUI(),this.scrollToElementIfOffsceen(this.__getInvalidElement()),!1)},__schedulePostlogin:function(){var n,t;this.Data.IsSchedulingCompleting||(t=this.$root.find(".confirmationstep .ajaxspinner"),$$WPUtil.ShowAjaxSpinner(t),$afe.select("#schedulingoverlay").css("z-index",1e3),this.Data.IsSchedulingCompleting=!0,n=this.__getAjaxParameters(!1),$.post({url:makeLink("Scheduling/ScheduleAppointment"),data:$$WPUtil.postify(n),cache:!1,success:this._onScheduled,error:this.__onSchedulingErrorCallback}))},__onSchedulingErrorCallback:function(n,t,i){return $afe.select(".startover").prop("disabled",!1),this.__onErrorCallback(n,t,i)},__schedulePostSelfTriageReconciliation:function(){var n,t;this.Data.IsSchedulingCompleting||(t=this.$root.find(".confirmationstep .ajaxspinner"),$$WPUtil.ShowAjaxSpinner(t),$afe.select("#schedulingoverlay").css("z-index",1e3),n=this.__getAjaxParameters(!0),$$WPSelfTriageUtil.ReconcileSession(this._workflow.SchedulingControllerParams.rootDecisionTreeID,this._workflow.SchedulingControllerParams.decisionTreeAnswerID,n,this.__onErrorCallback))},__getInvalidElement:function(){return this._isSelectedRescheduleReasonValid()?$afe.select(".commentssection"):this.$root.find("#reschedulereason")},__onClickLogin:function(n){var t={};n.preventDefault();this.__validateForm()&&(t=this.__getAjaxParameters(!0),$$WPSchedulingUtil.RedirectToLogin(t,this._workflow,this.__onRedirectUrlReceived,this.__onErrorCallback))},__onRedirectUrlReceived:function(n){$$WP.Scheduling.SlotReservationHelpers.DestroyAllReservationCleanUpListeners();WP.Events.cancelBeforeUnload();window.top.location.href=makeLink(n.Url)},__onClickScheduleAsGuest:function(n){n.preventDefault();this.__validateForm()&&this.__redirectToScheduleAsGuest()},__onAuxClickSchedule:function(n){n.preventDefault()},__redirectToScheduleAsGuest:function(){var n=this.__getAjaxParameters(!0);$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("SchedulingRedirectToScheduleAsGuest",this._workflow)),data:$$WPUtil.postify(n),cache:!1,success:this.__onRedirectUrlReceived,error:this.__onErrorCallback})},__getAjaxParameters:function(n){this.Data.AppointmentBuilder.SchedulingComments=this.__comments;this.Data.AppointmentBuilder.RescheduleReason=this._getSelectedRescheduleReasonFromDom();var t={};return t.workflow=this._workflow.toRawRequestObject(),t.appointmentBuilder=n?this.Data.AppointmentBuilder.toRawRequestObject():this.Data.AppointmentBuilder.toSparseRawRequestObject(),t.nonce=$$WPUtil.GetPageNonce(),t},_areCommentsValid:function(){return this.__updateCommentsValidationUI(),!((this.__comments||"").length>0&&!this.__doesStepAllowComments())&&!(this.$root.find("textarea[name='comments'][data-invalid]").length>0)},__doesStepRequireComments:function(){if(this.__reviewResult&&this.__reviewResult.CommentsSettings)return this.__reviewResult.CommentsSettings.AreCommentsRequired},__doesStepAllowComments:function(){if(this.__reviewResult&&this.__reviewResult.CommentsSettings)return this.__reviewResult.CommentsSettings.AreCommentsAllowed},__getMaxCommentsLength:function(){if(this.__reviewResult&&this.__reviewResult.CommentsSettings)return this.__reviewResult.CommentsSettings.MaxCommentsLength},__updateCommentsValidationUI:function(){this.$root.find("[name='comments']").trigger("change")},_getSelectedRescheduleReasonFromDom:function(){return this.__getAvailableRescheduleReasonsFromDom().filter(":checked").val()||""},__getAvailableRescheduleReasonsFromDom:function(){return this.$root.find("input[name='reschedulereason']")},__updateRescheduleReasonValidationUI:function(){this.__getAvailableRescheduleReasonsFromDom().trigger("change");this.$root.find("#reschedulereason").focus()},_isSelectedRescheduleReasonValid:function(){var n=this._getSelectedRescheduleReasonFromDom();return(0!==n.length||!this.__requireRescheduleReason)&&!(n.length>0&&0===this.__rescheduleReasons.length)},_onScheduled:function(n){var i,t;this.Data.IsSchedulingCompleting=!1;$afe.select(".startover").prop("disabled",!1);$$WPUtil.IsNullOrEmpty(n)?($$WP.Debug.log("Error scheduling appointment. No response from web server."),t=$$WP.Strings.get("ErrorMessage","Scheduling")):n.Success?($$WP.Scheduling.SlotReservationHelpers.DestroyAllReservationCleanUpListeners(),null!==this.__onSchedulingCompleteCallback&&this.__onSchedulingCompleteCallback(n.Appointments,this.__shouldShowSolutionDetails(),n.HasMobileLoginToken)):t=n.Error.PatientFriendlyErrorMessage.join(" ");$$WPUtil.IsNullOrEmpty(t)||(this.$root.find(".loadingoverlay").hide(),i=new $$WPComp.MessageComponent({TitleText:$$WP.Strings.get("ScheduleErrorTitle","Scheduling"),Message:t,ToolbarButtons:[new $$WPComp.ComplexObjects.Button($$WP.Strings.get("ScheduleErrorButtonLabel","Scheduling"),null,"cancelworkflow","")],callback:this.__returnToSlotStep}),$$WPUtil.quickPopup(i),$afe.select("#schedulingoverlay").css("z-index",-1e3))},_onCommentsModified:function(){this.__comments=this._getCommentsFromDOM()},_getCommentsFromDOM:function(){return this.$root.find("textarea[name='comments']").val()||""},_onFavoriteCheckboxChanged:function(n){var t=$afe.jq(n.target);this.__favoriteCheckboxValue=t.is(":checked");this.Data.AppointmentBuilder.SaveAsFavorite=this.__favoriteCheckboxValue},_onWaitListCheckboxChanged:function(n){var t=$afe.jq(n.target);this.__waitListCheckboxValue=t.is(":checked");this.__setAddToWaitListForAllAppointments(this.__waitListCheckboxValue)},__setAddToWaitListForAllAppointments:function(n){for(var t=0,t=0;t<this.Data.AppointmentBuilder.numAppointments();t++)this.Data.AppointmentBuilder.getAppointment(t).setProperty("AddToWaitList",n)},__onSchedulingStopButtonClicked:function(){this.__returnToSlotStep()},__returnToSlotStep:function(){$$WPSchedulingUtil.ReturnToSlotStepAndReloadSlots(this.Data)},__onChangeLocationButtonClicked:function(){$$WPSchedulingUtil.ReturnToStep($$WP.Scheduling.SchedulingStep.StepTypeEnum.TelehealthLocation,this.Data,null,!0)},__onEditLocationClicked:function(){$$WPSchedulingUtil.ReturnToStep($$WP.Scheduling.SchedulingStep.StepTypeEnum.Location,this.Data,null,!0)},getSchedulingContinueBanner:function(){return this.$root.parent().find(".schedulebutton")},getContinueButton:function(n){if(this.ViewModel){if(this.ViewModel.IsLoggedIn)return n.find("[data-id='schedule']");if(this.ViewModel.CanContinueToLoginOrScheduleAsGuest)return n.find("[data-id='schedule-condensed']")}return n.find("[data-id='schedule-login']")},isUsingWorkflowNavigation:function(){return!1},__shouldShowSolutionDetails:function(){return!!this.__isBundle()||this.Data.AppointmentBuilder.numAppointments()>1&&!this.Data.AppointmentBuilder.hasAllSameSlotDepartmentsSelected()||this.Data.AppointmentBuilder.numAppointments()>1&&!this.Data.AppointmentBuilder.isSelectedTelehealthModeSameForAppts()||this.Data.AppointmentBuilder.showAsMultipleVisits(this.Data.VisitTypes)},__isBundle:function(){return!!this.Data.AppointmentBuilder.getFirstAppointment().BundleId}};$$WP.Scheduling.ConfirmationStepController=t;t.extend($$WP.Scheduling.StepController,"WP$Scheduling$ConfirmationStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=$$WP.Utilities.UI.TimePreferenceWidgetController,t=function(n,t,i,r,u,f,e,o,s){var h=0;if(this.WP$Scheduling$StepController(n,i,null,null,null,$$WP.Templates.Scheduling.RequestStep),this.proxify("__onClickLogin","__onClickRequest","_onRequestCompleted","_onCommentsModified","_onCalendarDatePicked","_onDateInputChanged","_onViewersModified","__onSlotChanged"),this._workflow=t,this._appointment=this.Data.AppointmentBuilder.getFirstAppointment(),this._onRequestCompletedCallback=u,this.__onErrorCallback=f,this.__isLoginEnabled=e||!1,this.__isScheduleAsGuestDisabled=o,this.__isDemoMode=s||!1,this._viewers=r.Viewers||[],this._viewersString="",this._allowSelectViewers=r.AllowSelectViewers||!1,this._showViewers=r.ShowViewers||!1,this._drawViewersSection=(this._allowSelectViewers||this._showViewers)&&!(1===this._viewers.length&&this._viewers[0].IsSelf),!this._allowSelectViewers&&this._showViewers)for(h=0;h<this._viewers.length;h++)$$WP.Utilities.IsNullOrEmpty(this._viewers[h].Name)||(""!==this._viewersString&&(this._viewersString=this._viewersString+this.SchedulingStringsNamespace.getString("RequestViewersListDelimiter")),this._viewersString=this._viewers[h].IsSelf?this._viewersString+this.SchedulingStringsNamespace.getString("RequestViewerButtonSelf"):this._viewersString+this._viewers[h].Name);this._onFilePreferences=r.SchedulePreferences||null;this._daysOfWeekList=r.DaysOfWeekList||["","","","","","",""];this._requireComments=r.RequireRequestComments;this._maxCommentsLength=r.MaxCommentsLength;null!==r.StartDate&&(this._startDte=WP.Utils.date2dte(new Date(r.StartDate)));null!==r.EndDate&&(this._endDte=WP.Utils.date2dte(new Date(r.EndDate)));this._appointment.addPropertyListener("Slot",this.__onSlotChanged);this.$root.on("click","[data-id='request-login']",this.__onClickLogin);this.$root.on("click","[data-id='request']",this.__onClickRequest);$afe.select("body").on("change","input[name='"+this.__fromDateFieldId()+"'],input[name='"+this.__toDateFieldId()+"']",this._onDateInputChanged);this.$root.on("change","textarea[name='comments']",this._onCommentsModified);this.$root.on("change","input[name='otherprovider']",this._onCommentsModified);this.$root.on("change","input[name='otherrfv']",this._onCommentsModified);this.$root.on("click","[data-id='viewers']",this._onViewersModified);this.$root.find(".requestViewerCheckbox").on("click",function(){$$WP.Utilities.UI.ToggleButtonClick(this,event,0)})};t.prototype={_appointment:null,TimePreferenceWidget:null,_startDte:null,_endDte:null,_drawViewersSection:!1,_viewers:null,_viewersString:null,_allowSelectViewers:!1,_showViewers:!1,_otherProviderText:null,_otherRfvText:null,_comments:null,_requireComments:null,_maxCommentsLength:null,_maxOtherLength:200,_onRequestCompletedCallback:null,__onErrorCallback:null,_onFilePreferences:null,_daysOfWeekList:null,_previouslySelectedSlot:null,__isLoginEnabled:!1,__isScheduleAsGuestDisabled:!1,__isDemoMode:!1,updateViewModel:function(){var n,t,u,i,f,r,e,o,s,h;f=new $$WP.FormValidation.ValidationSettings({required:this.__doesStepRequireComments(),maxLength:this._maxCommentsLength,showCharacterCounter:!0});r=new $$WP.FormValidation.ValidationSettings({required:!0,maxLength:this._maxOtherLength});t=(i=this._getCurrentRequestSelections()).ReasonForVisit;n=i.Provider;u=i.Department;e=WP.Utils.dte2date(this.__getNearestFutureDteAllowed());o=WP.Utils.dte2date(this.__getFurthestFutureDteAllowed());h=(s=!this.__isScheduleAsGuestDisabled)||!s&&!this.__isLoginEnabled;this.ViewModel={StepControllerId:this.Id,Provider:n,ReasonForVisit:t,Department:u,StepShouldBeActive:!0,Viewers:this._viewers,ViewersString:this._viewersString,AllowSelectViewers:this._allowSelectViewers,ShowViewers:this._showViewers,DrawViewersSection:this._drawViewersSection,Comments:this._comments,FromDate:$$WPSchedulingUtil.FormatDteAsDate(this._startDte),FromDateFieldId:this.__fromDateFieldId(),ToDate:$$WPSchedulingUtil.FormatDteAsDate(this._endDte),ToDateFieldId:this.__toDateFieldId(),DateValidationSettings:$$WPSchedulingUtil.GetDateFieldValidationSettings(e,o,!1),RequireComments:this.__doesStepRequireComments(),CommentsValidationSettings:f,CommentsInitiallyInvalid:!$$WPUtil.IsNullOrEmpty(this._comments),CommentsElementId:"requestComments_"+this.Id,IsMobile:$$WP.Utilities.UI.IsMobile,OtherProviderValidationSettings:r,OtherRfvValidationSettings:r,IsLoggedIn:!this._workflow.IsAnonymous,IsLoginEnabled:this.__isLoginEnabled,CanContinueToLoginOrScheduleAsGuest:h,IsDemoMode:this.__isDemoMode};this.SchedulingStringsNamespace.addMnemonics({"@MYCHART@PROVIDER@":{Value:n.Name,EncodingType:$$WP.Strings.EncodingTypes.HTML},"@MYCHART@REASONFORVISIT@":{Value:t.Title,EncodingType:$$WP.Strings.EncodingTypes.HTML}})},arePrerequisitesComplete:function(){return null!==this._getCurrentRequestSelections()},beforeFirstRender:function(){$$WPSchedulingUtil.RegisterConfirmationPartials()},afterRender:function(){var t;this.SchedulingStringsNamespace.clearMnemonics();this.TimePreferenceWidget=new n(this.$root.find(".timepreferencecontainer"),null,null,null,this._onFilePreferences,this._daysOfWeekList,!1,null);$$WP.Strings.setDefaultNamespace("Scheduling");this.__setupDateRangeFields();t=this._appointment.Slot;this.$root.find("h2.header").focus();this._previouslySelectedSlot=t;$$WP.FormValidation.initializeDOMSubtree(this.$root);$afe.select(".requestbutton").addClass("stickybanner");$$WPUtil.SafeToRedirectOverrideSettings={};$$WPSchedulingUtil.HandleStickyBanner()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.RequestStep},__onSlotChanged:function(){var n=this._appointment.Slot;$$WPUtil.IsNullOrEmpty(n)||n.IsRequest?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired);this.Data.AppointmentBuilder.RequestPreferences=null;this.updateStep()},_getCurrentRequestSelections:function(){var n;return null!==(n=this._appointment.Slot)&&n.IsRequest?{Slot:n,ReasonForVisit:this.Data.AppointmentBuilder.ReasonForVisit,Provider:this.Data.Providers.getFromIndex("ID",n.ProviderId),ChildProviderIds:n.RequestChildProviderIds,Department:this.Data.Departments.getFromIndex("ID",n.DepartmentId),VisitTypeId:this._appointment.VisitType.ID,SchedulingOverride:this._appointment.SchedulingOverride}:null},__getSelectedViewers:function(){var n=0,t=[];if(this._drawViewersSection)for($viewers=this.$root.find("[name='viewers']:checked"),n=0;n<$viewers.length;n++)t.push($afe.jq($viewers.get(n)).val());else if(this._allowSelectViewers)for(n=0;n<this._viewers.length;n++)t.push(this._viewers[n].WprId);return t},_getPreferredTimes:function(){var t=null,i=null,f=null,r=0,u=0,e=[],o=null;switch(this.$root.find(".timepreferencewidget input.clearradio:checked").safeAttr("value")){case n.LabelValueEnum.AllAvailable:t=this.__buildPreferredTimesObject(!0,!1);break;case n.LabelValueEnum.OnFile:t=this.__buildPreferredTimesObject(!1,!0);break;case n.LabelValueEnum.Other:if(0===(i=this.$root.find(".timepreferencewidget input[type='checkbox']:checked")).length)t=this.__buildPreferredTimesObject(!0,!1);else{for(r=0;r<7;r++)for(i=this.$root.find(".timepreferencewidget input[type='checkbox']:checked[data-day-index='"+r+"']"),u=0;u<i.length;u++)f=$afe.jq(i[u]),o=$$WPSchedulingUtil.GetTimePreferenceRangeProps(f),e.push(o);t=this.__buildPreferredTimesObject(!1,!1,e)}}return t},__buildPreferredTimesObject:function(n,t,i){return{IsAllAvailable:n,IsUseOnFile:t,PreferredDays:i}},__setupDateRangeFields:function(){var n,t;n=makeStaticLink("images/calendar.svg");t=WP.Utils.date2dte(new Date);clearCalendarDateRange();writeCalendar(this.__fromDateFieldId(),"range",n,t,"",this._onCalendarDatePicked);writeCalendar(this.__toDateFieldId(),"range",n,t,"",this._onCalendarDatePicked)},__onClickLogin:function(n){var t={};n.preventDefault();this.__isRequestFormValid()&&(t=this.__getAjaxParameters(),$$WPSchedulingUtil.RedirectToLogin(t,this._workflow,this.__onRedirectUrlReceived,this.__onErrorCallback))},__onClickRequest:function(n){var t={};n.preventDefault();this.__isRequestFormValid()&&(t=this.__getAjaxParameters(),this._workflow.IsAnonymous?this.__redirectToRequestAsGuest(t):this.__requestAppointment(t))},__getAjaxParameters:function(){var t=this._getCurrentRequestSelections(),n={};return this.Data.AppointmentBuilder.RequestPreferences={Comments:this._comments,Viewers:this.__getSelectedViewers(),StartDte:this._startDte,EndDte:this._endDte,PreferredTimes:this._getPreferredTimes(),OtherProvider:t.Provider.OtherOption?this._otherProviderText:null,OtherRfv:t.ReasonForVisit.IsOtherRfv?this._otherRfvText:""},n.workflow=this._workflow.toRawRequestObject(),n.appointmentBuilder=this.Data.AppointmentBuilder.toRawRequestObject(),n},__isRequestFormValid:function(){var n=this._getCurrentRequestSelections();return null!==n&&(n.Provider.OtherOption&&($$WPUtil.IsNullOrEmpty(this._otherProviderText)||this._otherProviderText.length>this._maxOtherLength)?(this.$root.find("[name='otherprovider']").trigger("change"),this.scrollToElementIfOffsceen(this.$root.find(".otherprovidersection")),!1):n.ReasonForVisit.IsOtherRfv&&($$WPUtil.IsNullOrEmpty(this._otherRfvText)||this._otherRfvText.length>this._maxOtherLength)?(this.$root.find("[name='otherrfv']").trigger("change"),this.scrollToElementIfOffsceen(this.$root.find(".otherrfvsection")),!1):(comments=this._comments||"",0===comments.length&&this.__doesStepRequireComments()||comments.length>this._maxCommentsLength?(this.$root.find("[name='comments']").trigger("change"),this.scrollToElementIfOffsceen(this.$root.find(".commentssection")),!1):!!this.__areDateInputsProperlyFormatted()||(this.scrollToElementIfOffsceen(this.$root.find(".datesection")),this.__getInvalidDateInputs().trigger("change"),!1)))},__requestAppointment:function(n){this.Data.IsSchedulingCompleting||($$WPUtil.ShowAjaxSpinner(this.$root.find(".requeststep .ajaxspinner")),this.Data.IsSchedulingCompleting=!0,$.post({url:makeLink("Scheduling/RequestAppointment"),data:$$WPUtil.postify(n),cache:!1,success:this._onRequestCompleted,traditional:!0}))},__redirectToRequestAsGuest:function(n){$.post({url:makeLink($$WPSchedulingUtil.GetEndpointUrl("SchedulingRedirectToScheduleAsGuest",this._workflow)),data:$$WPUtil.postify(n),cache:!1,success:this.__onRedirectUrlReceived,error:this.__onErrorCallback})},__onRedirectUrlReceived:function(n){WP.Events.cancelBeforeUnload();window.top.location.href=makeLink(n.Url)},__doesStepRequireComments:function(){return this._requireComments||this.Data.AppointmentBuilder.DidRequestFromHardStop},_onRequestCompleted:function(n){var t;this.Data.IsSchedulingCompleting=!1;$$WPUtil.HideAjaxSpinner($afe.select(".schedulingSpinner .ajaxspinner"));n.Success?this._onRequestCompletedCallback&&this._onRequestCompletedCallback(n.HasMobileLoginToken):(t=new $$WPComp.MessageComponent({TitleText:this.SchedulingStringsNamespace.getString("RequestErrorTitle"),Message:this.SchedulingStringsNamespace.getString("RequestErrorMessage"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button(this.SchedulingStringsNamespace.getString("RequestErrorButtonLabel"),null,"cancelworkflow","")]}),$$WPUtil.quickPopup(t))},_onCommentsModified:function(){var n,t;this._comments=this.$root.find("textarea[name='comments']").val()||"";this._otherProviderText=(n=this.$root.find("input[name='otherprovider']")).length>0?n.val().trim():"";this._otherRfvText=(t=this.$root.find("input[name='otherrfv']")).length>0?t.val().trim():""},_onCalendarDatePicked:function(n,t,i,r){var f,u;void 0!==r&&(f=new Date(n,t,i),u=WP.Utils.date2dte(f),r.name===this.__fromDateFieldId()?(this._startDte=u,this.$root.find(".daterangeinput[name="+this.__toDateFieldId()+"]").focus()):(this._endDte=u,this.$root.find(".timeTable .togglebutton:checked").focus()),this.__swapDatesIfBackwards(),this._updateDateFields())},_onDateInputChanged:function(n){var i,r,t;i=n.target.value;t=null;this.__areDateInputsProperlyFormatted()&&(""===i?t=null:(r=parseDate(i,!0),t=WP.Utils.date2dte(r)),n.target.name===this.__fromDateFieldId()?this._startDte=t:this._endDte=t,this.__swapDatesIfBackwards(),this._updateDateFields())},__areDateInputsProperlyFormatted:function(){return 0===this.__getInvalidDateInputs().length},__getInvalidDateInputs:function(){return this.$root.find(".daterangeinput[data-invalid='true']")},__swapDatesIfBackwards:function(){var n,t,i;n=this._startDte;t=this._endDte;i=null;n&&t&&n>t&&(i=t,t=n,n=i);this._startDte=n;this._endDte=t},__getNearestFutureDteAllowed:function(){return WP.Utils.date2dte(new Date)},__getFurthestFutureDteAllowed:function(){return this.__getNearestFutureDteAllowed()+3650},_updateDateFields:function(){var n,t;n=$$WPSchedulingUtil.FormatDteAsDate(this._startDte);t=$$WPSchedulingUtil.FormatDteAsDate(this._endDte);this.$root.find("input[name='"+this.__fromDateFieldId()+"']").val(n);this.$root.find("input[name='"+this.__toDateFieldId()+"']").val(t)},__fromDateFieldId:function(){return"fromDate_"+this.Id},__toDateFieldId:function(){return"toDate_"+this.Id},_onViewersModified:function(){for(var n=0;n<this._viewers.length;n++)this._viewers[n].Selected=this.$root.find("input[name='viewers'][value='"+this._viewers[n].WprId+"']").get(0).checked},getSchedulingContinueBanner:function(){return this.$root.parent().find(".requestbutton")},getContinueButton:function(n){return n.find("[data-id='request']")},isUsingWorkflowNavigation:function(){return!1}};$$WP.Scheduling.RequestStepController=t;t.extend($$WP.Scheduling.StepController,"WP$Scheduling$RequestStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t,i,r){this.WP$Scheduling$StepController(n,t,null,null,null,$$WP.Templates.Scheduling.CustomStep);this.__isLandingStep=i;this.__customStringsKey=r;this.__schedulingStringsNamespace=$$WP.Strings.getNamespace("Scheduling");this.proxify("updateStep","_onClick","clearStepStatus");this.__isLandingStep||this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this.clearStepStatus);this.$root.on("click","[data-id='custom']",this._onClick)};n.prototype={__isLandingStep:!1,__customStringsKey:null,__schedulingStringsNamespace:null,updateViewModel:function(){this.ViewModel={Count:0,StepShouldBeActive:!1,IsLandingStep:this.__isLandingStep};this.__isLandingStep?this.__updateViewModelForLandingPage():this.__updateViewModelForVisitType()},__updateViewModelForVisitType:function(){var t,n=this.__getCustomStepVisitType();null===n||$$WPUtil.IsNullOrEmpty(n.CustomStepBodyKey)?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):(t=this.__schedulingStringsNamespace.getString("CustomStepStrings_"+n.CustomStepBodyKey),this.__updateViewModelFromStrings(n.CustomStepHeader,t,n.CustomStepBodyKey,n.CustomStepContinueButtonText))},__updateViewModelForLandingPage:function(){if($$WPUtil.IsNullOrEmpty(this.__customStringsKey))this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired);else{var t=this.__schedulingStringsNamespace.getString("CustomLandingPageTitle_"+this.__customStringsKey),n=this.__schedulingStringsNamespace.getString("CustomLandingPageBody_"+this.__customStringsKey),i=this.__schedulingStringsNamespace.getString("CustomLandingPageButtonText_"+this.__customStringsKey);$$WPUtil.IsNullOrEmpty(n)?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):this.__updateViewModelFromStrings(t,n,this.__customStringsKey,i)}},__updateViewModelFromStrings:function(n,t,i,r){this.ViewModel={Count:0,StepShouldBeActive:!0,CustomStepHeader:n,CustomStepBody:t,CustomStepBodyKey:i,CustomStepContinueButtonText:r,IsLandingStep:this.__isLandingStep}},__getCustomStepVisitType:function(){var n;return n=this.Data.AppointmentBuilder.getFirstAppointment(),$$WPUtil.IsNullOrEmpty(n.PanelId)?n.VisitType:this.Data.VisitTypes.getFirstInIndex("ID",n.PanelId)},afterRender:function(){$$WPSchedulingUtil.FocusElement(this.$root.find("h2.header"));this.getSchedulingContinueBanner().addClass("stickybanner");$$WPSchedulingUtil.HandleStickyBanner()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.CustomStep},clearStepStatus:function(){this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)},_onClick:function(){this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},getContinueButton:function(n){return n.find("[data-id='custom']")},isUsingWorkflowNavigation:function(){return!1},getSchedulingContinueBanner:function(){return this.$root.parent().find(".customstepbutton")}};$$WP.Scheduling.CustomStepController=n;n.extend($$WP.Scheduling.StepController,"WP$Scheduling$CustomStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t,i,r,u){this.WP$Scheduling$StepController(n,i,null,null,null,$$WP.Templates.Scheduling.ReservationStep);this.proxify("__onSlotChanged","__onSlotReservationChanged","__onAppointmentsChanged","__makeReservation","__onMakeReservationCallback","__onMakeReservationError","__returnToSlotsStep","__onRfvChanged");this._workflow=t;this.__isReservationAllowed=r;this.__stopSchedulingCallback=u;this.__secureSessionController=new $$WP.Scheduling.SecureSessionController;this.__eventManager=new $$WP.Scheduling.EventManager;this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("add",this.__onAppointmentsChanged);this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("remove",this.__onAppointmentsChanged);this.__onAppointmentsChanged()};n.prototype={__secureSessionController:null,__eventManager:null,__isReservationAllowed:!1,__stopSchedulingCallback:null,arePrerequisitesComplete:function(){return this.Data.AppointmentBuilder.allAppointmentsHaveASlotSelected()},updateViewModel:function(){this.__isReservationAllowed&&!this.Data.AppointmentBuilder.allAppointmentsHaveASlotReserved()?this.ViewModel={Count:1,StepShouldBeActive:!0,IsFullPageMode:this.Data.AppointmentBuilder.getFirstAppointment().Slot.IsPreselected||$$WP.WidgetMode,IsCaptchaVisible:this.__secureSessionController.IsContainerRequired(),IsSlotsStepLinkVisible:$$WP.WidgetMode}:(this.stepSettings.Hide=!0,this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired))},afterRender:function(){this.ViewModel.IsFullPageMode&&($$WPSchedulingUtil.FocusElement(this.$root.find("h2.header")),$$WPSchedulingUtil.ScrollToTopOfPage(),this.ViewModel.IsSlotsStepLinkVisible&&($afe.select(".summary-back").addClass("invisible"),this.$root.find(".slots-step-link").on("click",this.__returnToSlotsStep)));this.__isReservationAllowed&&!this.Data.AppointmentBuilder.allAppointmentsHaveASlotReserved()&&this.__establishSecureSessionAndMakeReservation()},__onAppointmentsChanged:function(){var t,n=0,i=null;for(this.__eventManager.removeAllListeners(),this.__eventManager.addModelPropertyListener(this.Data.AppointmentBuilder,"ReasonForVisit",this.__onRfvChanged),t=this.Data.AppointmentBuilder.numAppointments(),n=0;n<t;n++)i=this.Data.AppointmentBuilder.getAppointment(n),this.__eventManager.addModelPropertyListener(i,"Slot",this.__onSlotChanged)},hide:function(n){this.WP$Scheduling$StepController$hide(n);this.ViewModel&&this.ViewModel.IsSlotsStepLinkVisible&&$afe.select(".summary-back").removeClass("invisible")},__onRfvChanged:function(n){var t=n.to;t&&this.__secureSessionController.Initialize(this._workflow,t.AccessCode,t.IsDemographicAuthRequired,t.AccessCodeFirstName)},__onSlotChanged:function(n){var i=n.from,t=n.to;i&&(this.__deleteSlotReservationIfPresent(i),this.__eventManager.removelListenersFromModel(i));t&&(this.__eventManager.addModelPropertyListener(t,"ReservationKey",this.__onSlotReservationChanged),this.__eventManager.addModelPropertyListener(t,"IsIneligibleForReservation",this.__onSlotReservationChanged),t.IsRequest&&t.setProperty("IsIneligibleForReservation",!0))},__onSlotReservationChanged:function(){this.Data.AppointmentBuilder.allAppointmentsHaveASlotReserved()?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)},__deleteSlotReservationIfPresent:function(n){this.__canDeleteSlotReservation(n)&&this.__deleteSlotReservation(n);n.setProperty("ReservationExpirationTimeString","");n.setProperty("ReservationKey","");n.setProperty("IsIneligibleForReservation",!1)},__canDeleteSlotReservation:function(n){var t=!$$WPUtil.IsNullOrEmpty(n.ReservationKey),i=!this._workflow.IsAnonymous||!$$WPUtil.IsNullOrEmpty(this._workflow.SecureSessionToken);return t&&i},__deleteSlotReservation:function(n){$$WP.Scheduling.SlotReservationHelpers.DestroyReservationCleanUpListenerFromSlot(n);$$WP.Scheduling.SlotReservationHelpers.DeleteReservationFromSlot(n,this._workflow)},__makeReservation:function(){$$WP.Scheduling.SlotReservationHelpers.MakeReservation(this.Data.AppointmentBuilder,this._workflow,this.__onMakeReservationCallback,this.__onMakeReservationError)},__onMakeReservationCallback:function(n){if(this.Data.AppointmentBuilder.setProperty("IsSlotSelectionBlocked",!1),n.IsSuccess)this.__updateDataModelWithReserveResult(n);else if("SessionExpired"===n.Error.ErrorCode)this.__secureSessionController.ResetSession(),this.updateStep();else if("ValidationError"===n.Error.ErrorCode)this.__stopSchedulingCallback();else{resetLightbox();var t=new $$WPComp.MessageComponent({TitleText:this.SchedulingStringsNamespace.getString("ReserveSlotFailTitle"),Message:this.SchedulingStringsNamespace.getString("ReserveSlotFailMessage"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button(this.SchedulingStringsNamespace.getString("RefreshSlotsButtonCaption"),null,"previousstep","")],callback:this.__returnToSlotsStep});$$WPUtil.quickPopup(t)}},__onMakeReservationError:function(){this.Data.AppointmentBuilder.setProperty("IsSlotSelectionBlocked",!1);var n=new $$WPComp.MessageComponent({TitleText:this.SchedulingStringsNamespace.getString("ReserveSlotFailTitle"),Message:this.SchedulingStringsNamespace.getString("ReserveSlotFailMessage"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button(this.SchedulingStringsNamespace.getString("RefreshSlotsButtonCaption"),null,"previousstep","")],callback:this.__returnToSlotsStep});$$WPUtil.quickPopup(n)},__returnToSlotsStep:function(){$$WPSchedulingUtil.ReturnToSlotStepAndReloadSlots(this.Data)},__updateDataModelWithReserveResult:function(n){for(var t=null,r=null,u=null,f=null,i=0;i<this.Data.AppointmentBuilder.numAppointments();i++)t=this.Data.AppointmentBuilder.getAppointment(i).Slot,(r=n.Reservations[i])&&(u=r.ReservationKey,f=r.ReservationExpirationTimeString,$$WPUtil.IsNullOrEmpty(u)||(t.setProperty("ReservationKey",u),t.setProperty("ReservationExpirationTimeString",f)),$$WP.Scheduling.SlotReservationHelpers.CreateReservationCleanUpListenerFromSlot(t,this._workflow)),"Ineligible for reservation"===n.Error.ErrorCode&&t.setProperty("IsIneligibleForReservation",!0)},__establishSecureSessionAndMakeReservation:function(){if(this.__secureSessionController.IsContainerRequired())if(this.ViewModel.IsFullPageMode)this.__secureSessionController.EstablishSession(this.__makeReservation,this.__stopSchedulingCallback,this.$root.find(".captchaContainer"));else{var n=$$WPSchedulingUtil.GetCaptchaLightbox(this.__onCaptchaLightboxClosedCallback),t=$$WPSchedulingUtil.InitializeCaptchaLightbox,i=$$WPSchedulingUtil.CloseCaptchaLightbox;this.__secureSessionController.EstablishSession(this.__makeReservation,this.__stopSchedulingCallback,n,t,i)}else this.__secureSessionController.EstablishSession(this.__makeReservation,this.__stopSchedulingCallback)},__onCaptchaLightboxClosedCallback:function(){$$WPSchedulingUtil.ScrollToTopOfPageIfEmbeddedInIframe()},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.ReservationStep},onWorkflowDestroyed:function(){var t,n=0,i=null;for($$WPSchedulingUtil.CloseCaptchaLightbox(),t=this.Data.AppointmentBuilder.numAppointments(),n=0;n<t;n++)(i=this.Data.AppointmentBuilder.getAppointment(n)).Slot&&this.__deleteSlotReservationIfPresent(i.Slot);this.__secureSessionController.ResetSession()}};$$WP.Scheduling.ReservationStepController=n;n.extend($$WP.Scheduling.StepController,"WP$Scheduling$ReservationStepController")}();!function(){var n=$$WP.Utilities.UI.TimePreferenceWidgetController,t=function(n,t,i,r,u){this.WP$Scheduling$StepController(n,i,null,null,null,$$WP.Templates.Scheduling.JoinWaitListStep);this.proxify("_onClickOptIn","_onClickCancel","_onClickOptOut","_onClickUpdatePreferences","__onSetTicketWaitListPreferencesSuccess");this._workflow=t;this.__daysOfWeekList=r.DaysOfWeekList||["","","","","","",""];this.__onFilePreferences=r.SchedulePreferences||null;this.__onTicketWaitListPreferencesUpdated=u};t.prototype={_appointment:null,_workflow:null,__daysOfWeekList:null,__onFilePreferences:null,__onTicketWaitListPreferencesUpdated:null,__shouldRemainOnStep:null,__timePreferenceWidget:null,afterRender:function(){var t=this._workflow.TicketInfo.WaitListPreferences,r=t.PreferredDays?this.__convertPreferredDaysToSelectedTimes(t.PreferredDays,timePreferenceConfig):null,i=null;t.IsAllAvailable?i=n.LabelValueEnum.AllAvailable:t.IsUseOnFile&&null!==this.__onFilePreferences?i=n.LabelValueEnum.OnFile:t.PreferredDays.length>0&&(i=n.LabelValueEnum.Other);this.__timePreferenceWidget=new n(this.$root.find(".timepreferencecontainer"),r,null,i,this.__onFilePreferences,this.__daysOfWeekList,!1,null);this.__addDomListeners()},updateViewModel:function(){this.ViewModel={StepShouldBeActive:!0,IsOptedInToOffers:this._workflow.TicketInfo.IsOptedInToOffers}},shouldRemainOnStep:function(){return this.__shouldRemainOnStep},__addDomListeners:function(){this.$root.on("click","button#opt-in",this._onClickOptIn);this.$root.on("click","button#opt-out",this._onClickOptOut);this.$root.on("click","button#update-preferences",this._onClickUpdatePreferences);this.$root.on("click","button#cancel",this._onClickCancel)},_onClickOptIn:function(n){$$WPUtil.preventEvent(n);this.__shouldRemainOnStep=!0;this.__setTicketWaitListPreferences(!0)},_onClickOptOut:function(){this.__shouldRemainOnStep=!1;this.__setTicketWaitListPreferences(!1)},_onClickUpdatePreferences:function(){this.__shouldRemainOnStep=!1;this.__setTicketWaitListPreferences(!0)},__showAjaxSpinner:function(){this.$root.safeAppend($afe.renderTemplate($$WP.Templates.UI.AjaxSpinner));$$WPUtil.ShowAjaxSpinner(this.$root.find(".ajaxspinner"))},__getPreferredTimes:function(){switch(this.$root.find(".timepreferencewidget input.clearradio:checked").safeAttr("value")){case n.LabelValueEnum.AllAvailable:return this.__buildPreferredTimesObject(!0,!1);case n.LabelValueEnum.OnFile:return this.__buildPreferredTimesObject(!1,!0);case n.LabelValueEnum.Other:return this.__getAppointmentLevelPreferences()}},__getAppointmentLevelPreferences:function(){var n=0,t=0,i=this.$root.find(".timepreferencewidget input[type='checkbox']:checked"),r=null,u=[],f=null;if(0===i.length)return this.__buildPreferredTimesObject(!0,!1);for(n=0;n<7;n++)for(i=this.$root.find(".timepreferencewidget input[type='checkbox']:checked[data-day-index='"+n+"']"),t=0;t<i.length;t++)r=$afe.jq(i[t]),f=$$WPSchedulingUtil.GetTimePreferenceRangeProps(r),u.push(f);return this.__buildPreferredTimesObject(!1,!1,u)},__buildPreferredTimesObject:function(n,t,i){return{IsAllAvailable:n,IsUseOnFile:t,PreferredDays:i}},__convertPreferredDaysToSelectedTimes:function(n,t){for(var r=[],i=0;i<n.length;i++)r.push({DayIndex:n[i].DayOfWeekIndex,RangeElement:this.__convertRangeStringToElement(n[i].RangeString,this.__findRangesForDay(n[i].DayOfWeekIndex,t))});return r},__findRangesForDay:function(n,t){for(var i=0;i<t.Days.length;i++)if(t.Days[i].DayOfWeek===n)return t.Days[i].Ranges;return[]},__convertRangeStringToElement:function(n,t){for(var i=0;i<t.length;i++)if(t[i].Display===n)return t[i].Element;return""},_onClickCancel:function(){this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},__setTicketWaitListPreferences:function(n){this.__showAjaxSpinner();var t={isOptingIn:n,appointmentRequestId:this._workflow.TicketInfo.AppointmentRequestIds[0],preferredTimes:this.__getPreferredTimes()};$.post({url:makeLink("Scheduling/SetTicketWaitListPreferences"),data:$$WPUtil.postify(t),success:$.proxy(function(t){this.__onSetTicketWaitListPreferencesSuccess(t,n)},this)})},__onSetTicketWaitListPreferencesSuccess:function(n,t){n.Success?(this._workflow.TicketInfo.IsOptedInToOffers=t,this._workflow.TicketInfo.WaitListPreferences=this.__getPreferredTimes(),this.__onTicketWaitListPreferencesUpdated&&this.__onTicketWaitListPreferencesUpdated(this._workflow.TicketInfo.IsOptedInToOffers),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete)):($$WPUtil.HideAjaxSpinner(this.$root.find(".ajaxspinner")),this.$root.find(".warningBannerContainer").show())}};$$WP.Scheduling.JoinWaitListStepController=t;t.extend($$WP.Scheduling.StepController,"WP$Scheduling$JoinWaitListStepController")}();!function(){var t=$$WP.Scheduling.Workflow,n=function(n,t,i,r,u){this.proxify("updateStep","_onClick","_onSelectionChange","_onCoverageChange","_onRFVSelected","_onTelehealthWorkflowSelected");this.WP$Scheduling$StepController(n,t,null,null,null,$$WP.Templates.Scheduling.InsuranceVerificationStep,$$WP.Templates.Scheduling.InsuranceVerificationStep);this._showStep=i;this._isAlwaysSelfPay=r;this._workflowSettings=u;this.Data.AppointmentBuilder.addPropertyListener("ReasonForVisit",this._onRFVSelected);this.Data.TelehealthData.addPropertyListener("SelectedWorkflow",this._onTelehealthWorkflowSelected)};n.prototype={_showStep:!1,updateViewModel:function(){this.ViewModel={Count:0,StepShouldBeActive:!1};this._showStep?(this.ViewModel={Count:0,StepShouldBeActive:!0,StepControllerId:this.Id,Settings:{ShowInsurance:!0,ShowUseInsuranceForVisitQuestion:!this._isAlwaysSelfPay,VerifyCallback:this._onClick,ChangeCallback:this._onCoverageChange,CacheNewCoveragesForScheduling:!0,IsFromScheduling:!0},ReservationBlurbViewModel:{IsSlotReserved:!!this.Data.AppointmentBuilder.getAppointment(0).Slot&&!!this.Data.AppointmentBuilder.getAppointment(0).Slot.ReservationKey}},this.SchedulingStringsNamespace.addMnemonics({"@MYCHART@RESERVATIONEXPIRATIONTIME@":{Value:this.Data.AppointmentBuilder.getAppointment(0).Slot?this.Data.AppointmentBuilder.getAppointment(0).Slot.ReservationExpirationTimeString:null,EncodingType:$$WP.Strings.EncodingTypes.HTML}})):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},afterRender:function(){var t,n;n=(t=this.Data.TelehealthData.SelectedWorkflow)===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing?this.Data.AppointmentBuilder.ReasonForVisit.OnDemandSlot:t===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.QuickSchedule?this.Data.TelehealthData.QuickScheduleSlot:this.Data.AppointmentBuilder.getAppointment(0).Slot;new $$WP.Insurance.CoveragesController(this.$root.find(".insuranceVerificationContainer"),!1,null,null,n.DepartmentId,n.Dte).render(this.ViewModel);this.Data.BlockDemographicInsuranceVerification=!1;this.$root.find("h2.header, .schedulingStepBanners .standardBanner").first().focus();this.$root.find("[data-id='custom']").on("click",this._onClick);$$WPSchedulingUtil.HandleStickyBanner()},beforeRender:function(){null!==this.Data.TelehealthData.SelectedWorkflow&&this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.InsuranceVerificationStep},_onSelectionChange:function(){this.Active||this.updateStep()},_onClick:function(){if(!this.Data.BlockDemographicInsuranceVerification){var n=this.$root.find("input[name='useInsuranceForVisitButton']:checked");n.length>0&&(this.Data.AppointmentBuilder.UseInsuranceForVisit=n.val(),this.Data.TelehealthData.setProperty("UseInsuranceForVisit",n.val()));this.Data.AppointmentBuilder.setProperty("CompletedInsuranceVerificationStep",!0);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete)}},_onCoverageChange:function(){this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)},_onRFVSelected:function(){var n=this.Data.AppointmentBuilder.ReasonForVisit;null!==n&&this._workflowSettings.WorkflowType===t.WorkflowTypesEnum.OnDemandTelehealth&&(n.InternallyAvailableForTelehealth||n.EnabledForQuickSchedule||n.CanDirectSchedule||!this.Data.TelehealthData.HideInsuranceStepForXOrg?this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete):(this.Data.AppointmentBuilder.setProperty("CompletedInsuranceVerificationStep",!1),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)),this.updateStep())},_onTelehealthWorkflowSelected:function(){var t=this.Data.AppointmentBuilder.ReasonForVisit,n=this.Data.TelehealthData.SelectedWorkflow;null!==n&&(n===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing&&!t.InternallyAvailableForTelehealth&&this.Data.TelehealthData.HideInsuranceStepForXOrg?(this.Data.AppointmentBuilder.setProperty("CompletedInsuranceVerificationStep",!1),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.updateStep())},getContinueButton:function(n){return n.find("[data-id='buttonNext']")}};$$WP.Scheduling.InsuranceVerificationStepController=n;n.extend($$WP.Scheduling.StepController,"WP$Scheduling$InsuranceVerificationStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t){this.WP$Controllers$Controller();"function"!=typeof t&&$$WP.Debug.logError("EditableViewController subclass did not provide the Handlebars template needed to render this view.");this.$root=n;this._template=t;this.loadData();this.proxify("onEditClicked","onSaveClicked","onCancelClicked");this.$root.on("click",".editButton",this.onEditClicked);this.$root.on("click",".saveButton",this.onSaveClicked);this.$root.on("click",".cancelButton",this.onCancelClicked)};n.prototype={$root:null,ViewModel:null,_template:null,focusAfterRender:!0,onEditClicked:function(n){this.$root.find(".button").remove();this.render(!0);n.preventDefault()},onSaveClicked:function(n){this.$root.find(".button").remove();this.$root.find("input, select, textarea").prop("disabled",!0);this.saveData();n.preventDefault()},onCancelClicked:function(n){this.$root.find(".button").remove();this.render(!1);n.preventDefault()},loadData:function(){$$WP.Debug.logError("EditableViewController subclass did not override the virtual loadData method.")},saveData:function(){$$WP.Debug.logError("EditableViewController subclass did not override the virtual saveData method.")},render:function(n){if(this.$root.empty(),this.ViewModel=this.ViewModel||{},this.ViewModel.DisplayEditable=n,this.$root.safeAppend($afe.renderTemplate(this._template,this.ViewModel)),!n&&this.focusAfterRender){var t=this.$root.find(".editButton");t&&t.focus()}this.afterRender()},afterRender:function(){0===$afe.select(":focus").length&&this.focusAfterRender&&this.$root.find("input, select, textarea, button").filter(":visible:enabled").first().focus()},dispose:function(){this.$root.empty()}};n.getValIfExists=function(n){return 1===n.length?n.val():null};$$WPUtil.guaranteeExistence($$WP,"Controllers");$$WP.Controllers.EditableViewController=n;n.extend($$WP.Controllers.Controller,"WP$Controllers$EditableViewController")}();!function(){var t={},r={},u="",f=!1,i=function(n,t,i,r,u,f){this._prefix=n;this._requiredFields=i||[];this._isPatientAddress=!0===r;this._vrkFields=u||[];this._isViewOnly=f||!1;this.WP$Controllers$Controller();this.proxify("_onCountryChanged");this.proxify("_onStateChanged");this.setViewModel(t)},h={ViewModel:{},_isPatientAddress:!1,_prefix:"",_requiredFields:[],_vrkFields:[],_lastFocusedElementId:"",_isViewOnly:!1,_onCountryChanged:function(){this.ViewModel.AddressConfiguration.Counties=this.ViewModel.AddressConfiguration.AllCounties;this.updateViewModel();this.render()},_onStateChanged:function(n){this._handleState(n.target.value)&&(this._trueRender(),this._lastFocusedElementId=n.target.id,this._refocusLastElement())},_onAddressConfigurationLoadSuccess:function(n){t[n.DefaultCountryCat]=n;this.ViewModel.AddressConfiguration=n;this.ViewModel.AddressConfiguration.AllCounties=n.Counties;this._trueRender();this.onDataLoadEnd()},onDataLoadStart:function(){},onDataLoadEnd:function(){},_handleAddressConfiguration:function(){var i=this.ViewModel.Country.Number,n=t[i];n&&!$.isEmptyObject(n)?(this.ViewModel.AddressConfiguration=$.extend(!0,{},n),this.ViewModel.AddressConfiguration.AllCounties=n.Counties,this._trueRender()):(this.onDataLoadStart(),this.$root.find("textarea,input,select").prop("disabled",!0),this.$root.addClass("loading").safePrepend($$WP.SimpleTemplates.Div({"class":"loadingIndicator"}).safeAppend($$WP.SimpleTemplates.Div({"class":"indicator"}))),$.ajax({type:"POST",url:makeLink("PersonalInformation/GetAddressConfiguration"),data:{countryId:i},dataType:"json",success:$.proxy(this._onAddressConfigurationLoadSuccess,this)}))},_handleAddressFilter:function(){var i=this.ViewModel.Country.Number,t;(r[i]||s(i),this.$root)&&(t=n($afe.select("#"+this._prefix+"_State",this.$root)),t&&this._handleState(t)&&this._trueRender())},_handleState:function(n){var i,u;return(this.updateViewModel(),i=this.ViewModel.Country.Number,!r[i])?!1:t[i]?(u=r[i].StateToCounties,!$.isEmptyObject(u)&&(this.ViewModel.AddressConfiguration.Counties=n?u.hasOwnProperty(n)?u[n]:[]:this.ViewModel.AddressConfiguration.AllCounties,!0)):!1},_refocusLastElement:function(){var n=$afe.select("#"+this._lastFocusedElementId);0!==n.length&&n.focus();this._lastFocusedElementId=""},setViewModel:function(n){var i,t,r;for(r=n&&null!==n.Country&&n.Country.Number?n.Country.Number:f?"":u,this.ViewModel=n?{HouseNumber:n.HouseNumber,Street:n.Street,City:n.City,County:{Number:n.County.Number},State:{Number:n.State.Number},Zip:n.Zip,Country:{Number:r},District:{Number:n.District.Number},Building:this._isPatientAddress?n.Building:"",Floor:this._isPatientAddress?n.Floor:"",Unit:this._isPatientAddress?n.Unit:""}:{HouseNumber:"",Street:"",City:"",County:{Number:null},State:{Number:null},Zip:"",Country:{Number:r},District:{Number:null},Building:"",Floor:"",Unit:""},this.ViewModel.Prefix=this._prefix,i={},t=0;t<this._requiredFields.length;t++)this._vrkFields[this._requiredFields[t]]||(i[this._requiredFields[t]]=!0);this.ViewModel.RequiredFieldNames=i;this.ViewModel.VRKFieldNames=this._vrkFields;this.ViewModel.IsViewOnly=this._isViewOnly;this.ViewModel.Validation={Required:$$WP.FormValidation.ValidationSettings.Required};this.ViewModel.Validation.StreetAddress=new $$WP.FormValidation.ValidationSettings({required:this.ViewModel.RequiredFieldNames.Street,maxLength:254});this.ViewModel.Validation.City=new $$WP.FormValidation.ValidationSettings({required:this.ViewModel.RequiredFieldNames.City,maxLength:50});this.ViewModel.Validation.HouseNumber=new $$WP.FormValidation.ValidationSettings({required:this.ViewModel.RequiredFieldNames.HouseNumber,maxLength:254});this.ViewModel.Validation.Building=new $$WP.FormValidation.ValidationSettings({required:this.ViewModel.RequiredFieldNames.Building,maxLength:254});this.ViewModel.Validation.Floor=new $$WP.FormValidation.ValidationSettings({required:this.ViewModel.RequiredFieldNames.Floor,maxLength:254});this.ViewModel.Validation.Unit=new $$WP.FormValidation.ValidationSettings({required:this.ViewModel.RequiredFieldNames.Unit,maxLength:18})},updateViewModel:function(){var u,f,e,o,s,h,c,l,t,i,r;this.$root&&(u=$afe.select("#"+this._prefix+"_HouseNumber",this.$root),f=$afe.select("#"+this._prefix+"_Street",this.$root),e=$afe.select("#"+this._prefix+"_City",this.$root),o=$afe.select("#"+this._prefix+"_County",this.$root),s=$afe.select("#"+this._prefix+"_State",this.$root),h=$afe.select("#"+this._prefix+"_Zip",this.$root),c=$afe.select("#"+this._prefix+"_Country",this.$root),l=$afe.select("#"+this._prefix+"_District",this.$root),this._isPatientAddress?(t=$afe.select("#"+this._prefix+"_Building",this.$root),i=$afe.select("#"+this._prefix+"_Floor",this.$root),r=$afe.select("#"+this._prefix+"_Unit",this.$root)):(t="",i="",r=""),this.ViewModel=this.ViewModel||{},this.ViewModel.HouseNumber=n(u),this.ViewModel.Street=n(f),this.ViewModel.City=n(e),this.ViewModel.County.Number=n(o),this.ViewModel.State.Number=n(s),this.ViewModel.Zip=n(h),this.ViewModel.Country.Number=n(c),this.ViewModel.District.Number=n(l),this.ViewModel.Building=n(t),this.ViewModel.Floor=n(i),this.ViewModel.Unit=n(r))},getViewModel:function(){return this.updateViewModel(),{HouseNumber:this.ViewModel.HouseNumber,Street:this.ViewModel.Street,City:this.ViewModel.City,County:{Number:this.ViewModel.County.Number},State:{Number:this.ViewModel.State.Number},Zip:this.ViewModel.Zip,Country:{Number:this.ViewModel.Country.Number},District:{Number:this.ViewModel.District.Number},Building:this.ViewModel.Building,Floor:this.ViewModel.Floor,Unit:this.ViewModel.Unit}},_trueRender:function(){this.$root.empty();this.$root.safeAppend($afe.renderTemplate($$WP.Templates.PersonalInformation.BaseAddress,this.ViewModel)).removeClass("loading");this._refocusLastElement();this.afterRender()},render:function(){this.$root&&0!==this.$root.length&&(null!==document.activeElement&&document.activeElement.id&&(this._lastFocusedElementId=document.activeElement.id),this.$root.off("change.addressCountryChange").on("change.addressCountryChange","#"+this._prefix+"_Country",this._onCountryChanged),this.$root.off("change.addressStateChange").on("change.addressStateChange","#"+this._prefix+"_State",this._onStateChanged),this._handleAddressConfiguration(),this._handleAddressFilter())},renderTo:function(n){this.$root=n;this.render()},afterRender:function(){}},e=function(n){n&&($.isEmptyObject(n.StateToCounties)||$.isEmptyObject(r[n.DefaultCountryCat])&&(r[n.DefaultCountryCat]=n))},o=function(n){n&&(t[n.DefaultCountryCat]={},u!=n.LocaleCountryCat&&(u=n.LocaleCountryCat),f!=n.AddressHxEnabled&&(f=n.AddressHxEnabled),$.isEmptyObject(t[n.DefaultCountryCat])&&(t[n.DefaultCountryCat]=n))},s=function(n){n&&!r.hasOwnProperty(n)&&(r[n]={},$.ajax({type:"POST",url:makeLink("PersonalInformation/GetAddressFilter"),data:{countryId:n},dataType:"json",success:$.proxy(e,this)}))},n=function(n){return 1===n.length?n.val():null};i.prototype=h;i.getAddressConfiguration=function(n){var i=t[n];return!i||$.isEmptyObject(i)?null:i};i.addAddressFilter=e;i.addAddressConfiguration=o;i.createAddressConfigurationRequest=function(n){t.hasOwnProperty(n)||(t[n]={},$.ajax({type:"POST",url:makeLink("PersonalInformation/GetAddressConfiguration"),async:!1,data:{countryId:n},dataType:"json",success:$.proxy(o,this)}))};i.createAddressFilterRequest=s;$$WP.PersonalInformation=$$WP.PersonalInformation||{};$$WP.PersonalInformation.AddressController=i;i.extend($$WP.Controllers.Controller,"WP$PersonalInformation$Controllers$AddressController")}();!function(){var i,o,s,f,t,h,n=$$WP.Controllers.EditableViewController,r=new Date(1841,0,1),u=new Date(2114,9,15),e=function(n,t){this._settings=t||new i;this.WP$Controllers$EditableViewController(n,$$WP.Templates.PersonalInformation.ContactInformation);this.$root.addClass("contact-information-content card");this._addLoadingHeartToContactInformationContainer();this.$root.parents(".cardlist").trigger("cardLoad");this.proxify("_onAddTemporaryAddressClicked","_onRemoveTemporaryAddressClicked","_onPreferredDeviceSelectorClicked","_onStartDateUpdate","_onEndDateUpdate","_onStartDateCalendarClick","_onEndDateCalendarClick","_afterTemporaryAddressRender","_onAddressLoadStart","_onAddressLoadEnd","_addressAfterRender","_onAddressListSelect","_launchContactVerification","abortLoadingAjax");this.$root.on("click",".addTemporaryAddressLink",this._onAddTemporaryAddressClicked);this.$root.on("click",".removeTemporaryAddressLink",this._onRemoveTemporaryAddressClicked);this.$root.on("click",".preferredDeviceSelector",this._onPreferredDeviceSelectorClicked);this.$root.on("click",".defaultSelect",this._onAddressListSelect);this.$root.on("blur","#ContactInformation_TemporaryStartDate",this._onStartDateUpdate);this.$root.on("blur","#ContactInformation_TemporaryEndDate",this._onEndDateUpdate);this.$root.on("click","#ContactInformation_TemporaryStartDate_Calendar",this._onStartDateCalendarClick);this.$root.on("click","#ContactInformation_TemporaryEndDate_Calendar",this._onEndDateCalendarClick);this.$root.on("keyup",".addressDefaultListItem",function(n){13===n.keyCode&&n.target.click()});this.$root.on("click","#launchVerificationButton",this._launchContactVerification)},c={_addressData:null,_initialViewModel:null,_permanentAddressController:null,_temporaryAddressController:null,_pendingAddressLoads:0,_wasJumpedToEditMode:!1,_settings:null,_permanentAddressIndex:-1,_temporaryAddressIndex:-1,_hasTemporaryAddressDefaults:!1,_hasPermanentAddressDefaults:!1,_contactVerificationPopup:null,_contactVerificationSettings:null,_jqXHRForLoadingContactInfo:null,onEditClicked:function(n){this._initialViewModel=$.extend(!0,{},this.ViewModel);this.ViewModel.EditTemporaryAddress=!this.ViewModel.HideTemporaryAddress;this.ViewModel.SecureCommunicationInfo.InfoUpdated=!1;this.WP$Controllers$EditableViewController$onEditClicked(n);this._scrollToTopOfCard();"function"==typeof this._settings.onEditClickedCallback&&this._settings.onEditClickedCallback()},onSaveClicked:function(n){if(!0===this._hasTemporaryAddressDefaults?this._hasTemporaryAddressDefaults=!1:this._hasPermanentAddressDefaults=!1,null!=this._addressData&&(this._hasPermanentAddressDefaults||this._hasTemporaryAddressDefaults))return this._moveToNextDefaultScreen(),void n.preventDefault();!0===this.$root.find("#ContactInformation_TemporaryDefaultOverrideCheck").prop("checked")&&(this._temporaryAddressIndex=-2);!0===this.$root.find("#ContactInformation_PermanentDefaultOverrideCheck").prop("checked")&&(this._permanentAddressIndex=-2);this._scrollToTopOfCard();this.WP$Controllers$EditableViewController$onSaveClicked(n)},onCancelClicked:function(n){this._resetDefaults();this.ViewModel=this._initialViewModel;this._permanentAddressController.setViewModel(this._initialViewModel.PermanentAddress);this.ViewModel.IsNonPatientProxyRecord||this.ViewModel.IsTemporaryAddressDisabled||this._temporaryAddressController.setViewModel(this._initialViewModel.TemporaryAddress);this.ViewModel.SecureCommunicationInfo.InfoUpdated=!1;this.WP$Controllers$EditableViewController$onCancelClicked(n);this._scrollToTopOfCard();"function"==typeof this._settings.onCancelClickedCallback&&this._settings.onCancelClickedCallback();var t=$afe.select("#launchVerificationButton");null!==t&&this._settings.autoLaunchPopup&&(t.removeClass("secondary neutral"),t.addClass("positive primary"))},_onAddTemporaryAddressClicked:function(n){this.ViewModel.DisplayEditable?(this.ViewModel.EditTemporaryAddress=!0,this.ViewModel.HideTemporaryAddress=!1,this.ViewModel.RemoveTemporaryAddress=!1,this._showOrHideTemporaryAddress(),n.preventDefault()):(this._initialViewModel=$.extend(!0,{},this.ViewModel),this.ViewModel.EditTemporaryAddress=!0,this.ViewModel.HideTemporaryAddress=!1,this.ViewModel.RemoveTemporaryAddress=!1,this.WP$Controllers$EditableViewController$onEditClicked(n));"function"==typeof this._settings.onEditTemporaryAddressCallback&&this._settings.onEditTemporaryAddressCallback();this._scrollToTopOfCard();this.$root.find(".temporaryInformation .address").find("input, select, textarea").filter(":visible:enabled").first().focus()},_onRemoveTemporaryAddressClicked:function(n){this.ViewModel.EditTemporaryAddress=!1;this.ViewModel.HideTemporaryAddress=!0;this.ViewModel.RemoveTemporaryAddress=!this._initialViewModel.HideTemporaryAddress;this.ViewModel.TemporaryAddress.EndDateDisplay=formatDate(t());this.ViewModel.TemporaryAddress.StartDateDisplay&&parseDate(this.ViewModel.TemporaryAddress.StartDateDisplay,!0)>t()&&(this.ViewModel.TemporaryAddress.StartDateDisplay=formatDate(t()));this._showOrHideTemporaryAddress();n.preventDefault();this._scrollToTopOfCard();$afe.select(".addTemporaryAddressLink").focus()},_onPreferredDeviceSelectorClicked:function(n){var t=$afe.jq(n.currentTarget);$afe.jq(n.target).is("input")||n.preventDefault();t.hasClass("selected")?(t.removeClass("selected").find("input").prop("checked",!1),$afe.select("#ContactInformation_PreferredDevice").val("")):(this.$root.find(".preferredDeviceSelector").removeClass("selected").find("input").prop("checked",!1),t.addClass("selected"),$afe.select("#ContactInformation_PreferredDevice").val(t.find("input").prop("checked",!0).val()));this._setPreferredDeviceToBeRequired()},_onLoadSuccess:function(n){var i,l,e,s,f,o,h,c;for(this._jqXHRForLoadingContactInfo=null,o=!1,this.ViewModel=n,h=this.ViewModel.PermanentAddress.Country.Number,this.ViewModel.CurrentHeaderLevel=this._settings.currentHeaderLevel,this.ViewModel.IsNonPatientProxyRecord||this.ViewModel.IsTemporaryAddressDisabled||!this.ViewModel.TemporaryAddress.StartDateDisplay||this.ViewModel.TemporaryAddress.EndDateDisplay&&parseDate(this.ViewModel.TemporaryAddress.EndDateDisplay,!0)<=t()?this.ViewModel.HideTemporaryAddress=!0:(this._initialHideTemporaryAddress=!1,this.ViewModel.EditTemporaryAddress=!0,this.ViewModel.HideTemporaryAddress=!1,this.ViewModel.RemoveTemporaryAddress=!1,this._initialTemporaryAddressEndDate=this.ViewModel.TemporaryAddress?this.ViewModel.TemporaryAddress.EndDateDisplay:""),i={},e=0;e<this.ViewModel.RequiredFieldNames.length;e++)i[this.ViewModel.RequiredFieldNames[e]]=!0;for(this.ViewModel.RequiredFieldNames=i,l={},e=0;e<this.ViewModel.ReadOnlyFieldNames.length;e++)l[this.ViewModel.ReadOnlyFieldNames[e]]=!0;if(this.ViewModel.ReadOnlyFieldNames=l,this.ViewModel.PreferredDeviceOptions={},this.ViewModel.IsNonPatientProxyRecord||((!this.ViewModel.ReadOnlyFieldNames.HomePhone||this.ViewModel.HomePhone.length>0)&&(this.ViewModel.PreferredDeviceOptions.HomePhone=!0),(!this.ViewModel.ReadOnlyFieldNames.MobilePhone||this.ViewModel.SecureCommunicationInfo.MobilePhone.length>0)&&(this.ViewModel.PreferredDeviceOptions.MobilePhone=!0),(!this.ViewModel.ReadOnlyFieldNames.WorkPhone||this.ViewModel.WorkPhone.length>0)&&(this.ViewModel.PreferredDeviceOptions.WorkPhone=!0)),this._settings.fromWorkflow&&(this.ViewModel.SecureCommunicationInfo.DoNeitherNeedAttention=!0),this.ViewModel.VerificationAlert=this._setVerificationAlertViewModel(),this.ViewModel.EditButtonCmdOptions={CssClasses:"button editButton",IconPath:"library.svg#_flat_edit",AriaLabel:$$WP.Strings.get("EditContactInfoButtonScreenReaderLabel","PersonalInformation.ContactInformation")},this.ViewModel.Validation={Required:$$WP.FormValidation.ValidationSettings.Required},this.ViewModel.Validation.Email=new $$WP.FormValidation.ValidationSettings({isEmail:!0,required:!0===this.ViewModel.RequiredFieldNames.Email}),this.ViewModel.IsNonPatientProxyRecord||this.ViewModel.IsTemporaryAddressDisabled||(this.ViewModel.TemporaryAddress.Validation={},this.ViewModel.TemporaryAddress.Validation.StartDate=new $$WP.FormValidation.ValidationSettings({isDate:!0,minDate:r,maxDate:this.ViewModel.TemporaryAddress.EndDateDisplay?parseDate(this.ViewModel.TemporaryAddress.EndDateDisplay,!0):u,required:!0}),this.ViewModel.TemporaryAddress.Validation.EndDate=new $$WP.FormValidation.ValidationSettings({isDate:!0,minDate:this.ViewModel.TemporaryAddress.StartDateDisplay?parseDate(this.ViewModel.TemporaryAddress.StartDateDisplay,!0):r,maxDate:u,required:!0}),-1!==$.inArray("Phone",this.ViewModel.TemporaryAddress.RequiredFieldNames)&&(this.ViewModel.TemporaryAddress.IsPhoneRequired=!0)),$$WP.PersonalInformation.AddressController.createAddressConfigurationRequest(h),(s=$$WP.PersonalInformation.AddressController.getAddressConfiguration(h))||($$WP.PersonalInformation.AddressController.createAddressConfigurationRequest(""),s=$$WP.PersonalInformation.AddressController.getAddressConfiguration("")),this.ViewModel.AddressHxEnabled=s.AddressHxEnabled,this._permanentAddressController=new $$WP.PersonalInformation.AddressController("PermanentAddress",this.ViewModel.PermanentAddress,this.ViewModel.PermanentAddress.RequiredFieldNames,!this.ViewModel.IsNonPatientProxyRecord,null,this.ViewModel.PermanentAddress.IsViewOnly),this._permanentAddressController.onDataLoadStart=this._onAddressLoadStart,this._permanentAddressController.onDataLoadEnd=this._onAddressLoadEnd,this._permanentAddressController.afterRender=this._addressAfterRender,$$WP.PersonalInformation.AddressController.createAddressFilterRequest(h),this.ViewModel.IsNonPatientProxyRecord||this.ViewModel.IsTemporaryAddressDisabled||(this._temporaryAddressController=new $$WP.PersonalInformation.AddressController("TemporaryAddress",this.ViewModel.TemporaryAddress,this.ViewModel.TemporaryAddress.RequiredFieldNames,!0),this._temporaryAddressController.onDataLoadStart=this._onAddressLoadStart,this._temporaryAddressController.onDataLoadEnd=this._onAddressLoadEnd,this._temporaryAddressController.afterRender=this._addressAfterRender),o=this.ViewModel.RequiredFieldNames.HomePhone&&!this.ViewModel.HomePhone||this.ViewModel.RequiredFieldNames.MobilePhone&&!this.ViewModel.SecureCommunicationInfo.MobilePhone||this.ViewModel.RequiredFieldNames.WorkPhone&&!this.ViewModel.WorkPhone||this.ViewModel.RequiredFieldNames.Email&&!this.ViewModel.SecureCommunicationInfo.EmailAddress,this.ViewModel.PermanentAddress.IsViewOnly&&this.ViewModel.HideTemporaryAddress||(f=s_buildAddressFieldsList(s.AddressFieldRows)),!this.ViewModel.PermanentAddress.IsViewOnly){for(i={},e=0;e<this.ViewModel.PermanentAddress.RequiredFieldNames.length;e++)i[this.ViewModel.PermanentAddress.RequiredFieldNames[e]]=!0;o=o||i.HouseNumber&&!this.ViewModel.PermanentAddress.HouseNumber&&f[7]||i.Street&&!this.ViewModel.PermanentAddress.Street&&f[1]||i.City&&!this.ViewModel.PermanentAddress.City&&f[2]||i.County&&!this.ViewModel.PermanentAddress.County.Number&&f[5]||i.State&&!this.ViewModel.PermanentAddress.State.Number&&f[3]||i.Zip&&!this.ViewModel.PermanentAddress.Zip&&f[4]||i.Country&&!this.ViewModel.PermanentAddress.Country.Number&&f[6]||i.District&&!this.ViewModel.PermanentAddress.District.Number&&f[8]||i.Building&&!this.ViewModel.PermanentAddress.Building&&f[10]||i.Floor&&!this.ViewModel.PermanentAddress.Floor&&f[11]||i.Unit&&!this.ViewModel.PermanentAddress.Unit&&f[12]}if(!this.ViewModel.HideTemporaryAddress){for(i={},e=0;e<this.ViewModel.TemporaryAddress.RequiredFieldNames.length;e++)i[this.ViewModel.TemporaryAddress.RequiredFieldNames[e]]=!0;o=o||i.HouseNumber&&!this.ViewModel.TemporaryAddress.HouseNumber&&f[7]||i.Street&&!this.ViewModel.TemporaryAddress.Street&&f[1]||i.City&&!this.ViewModel.TemporaryAddress.City&&f[2]||i.County&&!this.ViewModel.TemporaryAddress.County.Number&&f[5]||i.State&&!this.ViewModel.TemporaryAddress.State.Number&&f[3]||i.Zip&&!this.ViewModel.TemporaryAddress.Zip&&f[4]||i.Country&&!this.ViewModel.TemporaryAddress.Country.Number&&f[6]||i.District&&!this.ViewModel.TemporaryAddress.District.Number&&f[8]||i.Building&&!this.ViewModel.TemporaryAddress.Building&&f[10]||i.Floor&&!this.ViewModel.TemporaryAddress.Floor&&f[11]||i.Unit&&!this.ViewModel.TemporaryAddress.Unit&&f[12]}this._updateViewModel();this.focusAfterRender=this._settings.focusOnLoad;this.render(o);this.focusAfterRender=!0;c=$afe.select("#launchVerificationButton");null!==c&&this._settings.autoLaunchPopup&&(c.removeClass("secondary neutral"),c.addClass("positive primary"));"function"==typeof this._settings.onLoadSuccessCallback&&this._settings.onLoadSuccessCallback();o&&(this._initialViewModel=$.extend(!0,{},this.ViewModel),this.ViewModel.EditTemporaryAddress=!this.ViewModel.HideTemporaryAddress,this.$root.find(".cancelButton").remove(),this._wasJumpedToEditMode=!0,"function"==typeof this._settings.onEditClickedCallback&&this._settings.onEditClickedCallback(),this._settings.fromWorkflow||this.$root.find("input, select, textarea").filter(":visible:enabled").first().focus());"function"==typeof this._settings.onBothCardsLoadAndEdit&&this._settings.onBothCardsLoadAndEdit();this._settings.initialLaunchPopup&&!this.ViewModel.SecureCommunicationInfo.DoNeitherNeedAttention&&this._launchContactVerification()},_onSaveSuccess:function(n){var i,u,r;if(this._resetDefaults(),this.ViewModel.EditTemporaryAddress||delete n.ViewModel.TemporaryAddress,delete n.ViewModel.RequiredFieldNames,delete n.ViewModel.ReadOnlyFieldNames,delete n.ViewModel.IsNonPatientProxyRecord,delete n.ViewModel.IsTemporaryAddressDisabled,this.ViewModel.TemporaryAddress&&delete this.ViewModel.TemporaryAddress.FormattedValues,this.ViewModel.PermanentAddress&&delete this.ViewModel.PermanentAddress.FormattedValues,this.ViewModel=$.extend(!0,{},this.ViewModel,n.ViewModel),this._settings.fromWorkflow?this.ViewModel.SecureCommunicationInfo.DoNeitherNeedAttention=!0:this.ViewModel.VerificationAlert=this._setVerificationAlertViewModel(),n.Success)this._updateViewModel(),(this.ViewModel.EditTemporaryAddress||this.ViewModel.RemoveTemporaryAddress)&&(this.ViewModel.HideTemporaryAddress=this.ViewModel.TemporaryAddress.EndDateDisplay&&parseDate(this.ViewModel.TemporaryAddress.EndDateDisplay,!0)<=t(),this.ViewModel.EditTemporaryAddress=!1,this.ViewModel.RemoveTemporaryAddress=!1),this._showNoMatches(!1,!1,!1),this.render(!1),r=$afe.select("#launchVerificationButton"),null!==r&&this._settings.autoLaunchPopup&&(r.removeClass("secondary neutral"),r.addClass("positive primary")),this._wasJumpedToEditMode=!1,this._permanentAddressController.setViewModel(this.ViewModel.PermanentAddress),this.ViewModel.IsNonPatientProxyRecord||this.ViewModel.IsTemporaryAddressDisabled||this._temporaryAddressController.setViewModel(this.ViewModel.TemporaryAddress),this._settings.autoLaunchPopup&&(this.ViewModel.SecureCommunicationInfo.DoesEmailNeedAttention&&!this.ViewModel.SecureCommunicationInfo.IsEmailDeleted||this.ViewModel.SecureCommunicationInfo.DoesMobileNeedAttention&&!this.ViewModel.SecureCommunicationInfo.IsMobileDeleted)&&this._launchContactVerification(),"function"==typeof this._settings.onSaveSuccessCallback&&this._settings.onSaveSuccessCallback();else if(null===n.ViewModel.TemporaryAddress&&null===n.ViewModel.PermanentAddress||!n.ViewModel.AllowDefaults?this.render(!0):n.ViewModel.TemporaryAddress&&!n.ViewModel.TemporaryAddress.Success&&0===n.ViewModel.TemporaryDefaults.length||n.ViewModel.PermanentAddress&&!n.ViewModel.PermanentAddress.Success&&0===n.ViewModel.PermanentDefaults.length?(this.render(!0),this._showNoMatches(n.ViewModel.TemporaryAddress&&!n.ViewModel.TemporaryAddress.Success&&0===n.ViewModel.TemporaryDefaults.length,n.ViewModel.PermanentAddress&&!n.ViewModel.PermanentAddress.Success&&0===n.ViewModel.PermanentDefaults.length,n.ViewModel.AllowArbitraryInput)):(this._addressData=n,n.ViewModel.TemporaryAddress&&!n.ViewModel.TemporaryAddress.Success&&n.ViewModel.TemporaryDefaults.length>0&&(this._hasTemporaryAddressDefaults=!0),n.ViewModel.PermanentAddress&&!n.ViewModel.PermanentAddress.Success&&n.ViewModel.PermanentDefaults.length>0&&(this._hasPermanentAddressDefaults=!0),this._moveToNextDefaultScreen()),this._wasJumpedToEditMode&&this.$root.find(".cancelButton").remove(),n.ViewModel.ValidationErrors)for(i=0;i<n.ViewModel.ValidationErrors.length;i++)u=$afe.select(h(n.ViewModel.ValidationErrors[i].ErrorIndex)),$$WP.FormValidation.addValidationError(u,n.ViewModel.ValidationErrors[i].ErrorKey)},_onAddressListSelect:function(n){var i,t;i=$afe.jq(n.target);t=parseInt(i.safeAttr("data-id"));this._hasTemporaryAddressDefaults?t===this._temporaryAddressIndex?($$WP.Utilities.UI.ToggleButtonClick(i,n,0),this._temporaryAddressIndex=-1,t=-1):(-1!==this._temporaryAddressIndex&&$$WP.Utilities.UI.ToggleButtonClick($(this.$root.find("#default"+this._temporaryAddressIndex)),n,0),$$WP.Utilities.UI.ToggleButtonClick(i,n,0),this._temporaryAddressIndex=t):this._hasPermanentAddressDefaults&&(t===this._permanentAddressIndex?($$WP.Utilities.UI.ToggleButtonClick(i,n,0),this._permanentAddressIndex=-1,t=-1):(-1!==this._permanentAddressIndex&&$$WP.Utilities.UI.ToggleButtonClick($(this.$root.find("#default"+this._permanentAddressIndex)),n,0),$$WP.Utilities.UI.ToggleButtonClick(i,n,0),this._permanentAddressIndex=t));-1!==t?this.$root.find(".saveButton").prop("disabled",!1):this.$root.find(".saveButton").prop("disabled",!0)},_onStartDateUpdate:function(n){var t=this.ViewModel.TemporaryAddress.Validation.EndDate;t.minDate=n.currentTarget.value?parseDate(n.currentTarget.value,!0):r;$afe.select("#ContactInformation_TemporaryEndDate").safeAttr("data-validation-settings",t.toJSON());$afe.select("#ContactInformation_TemporaryEndDate.invalid").change()},_onStartDatePicked:function(n,t,i){void 0!==n&&void 0!==t&&void 0!==i&&$afe.select("#ContactInformation_TemporaryStartDate").val(formatDate(new Date(n,t,i))).change().focus()},_onEndDatePicked:function(n,t,i){void 0!==n&&void 0!==t&&void 0!==i&&$afe.select("#ContactInformation_TemporaryEndDate").val(formatDate(new Date(n,t,i))).change().focus()},_onEndDateUpdate:function(n){var t=this.ViewModel.TemporaryAddress.Validation.StartDate;t.maxDate=n.currentTarget.value?parseDate(n.currentTarget.value,!0):u;$afe.select("#ContactInformation_TemporaryStartDate").safeAttr("data-validation-settings",t.toJSON());$afe.select("#ContactInformation_TemporaryStartDate.invalid").change()},_onStartDateCalendarClick:function(){var t=$afe.select("#ContactInformation_TemporaryStartDate_Calendar"),n=$afe.select("#ContactInformation_TemporaryStartDate");new DateChooser(t[0],this._onStartDatePicked,o,parseDate(n.val(),!0),n).drawCalendar()},_onEndDateCalendarClick:function(){var t=$afe.select("#ContactInformation_TemporaryEndDate_Calendar"),n=$afe.select("#ContactInformation_TemporaryEndDate");new DateChooser(t[0],this._onEndDatePicked,s,parseDate(n.val(),!0),n).drawCalendar()},_onAddressLoadStart:function(){this._pendingAddressLoads++;this.$root.find(".saveButton").prop("disabled",!0)},_onAddressLoadEnd:function(){this._pendingAddressLoads--},_addressAfterRender:function(){$$WP.FormValidation.initializeDOMSubtree(this.$root.find("form"));this._pendingAddressLoads>1&&this.$root.find(".saveButton").prop("disabled",!0);this.ViewModel.PermanentAddress.IsViewOnly&&this.$root.find(".permanentInformation .address").find("input, select, textarea").prop("disabled",!0)},_setPreferredDeviceToBeRequired:function(){var i,r,u,n,t;n=$$WP.FormValidation.ValidationSettings.Required.toJSON();t=$$WP.FormValidation.ValidationSettings.noInvalidCharacters.toJSON();this.ViewModel.RequiredFieldNames.HomePhone||this.ViewModel.ReadOnlyFieldNames.HomePhone||((i=$afe.select("#ContactInformation_HomePhone")).siblings(".preferredDeviceSelector.selected").length?($afe.select("label[for='ContactInformation_HomePhone']").addClass("required"),i.safeAttr("data-validation-settings",n).safeAttr("aria-required",!0).change()):($afe.select("label[for='ContactInformation_HomePhone']").removeClass("required"),i.safeAttr("data-validation-settings",t).safeAttr("aria-required",!1).change()));this.ViewModel.RequiredFieldNames.MobilePhone||this.ViewModel.ReadOnlyFieldNames.MobilePhone||((r=$afe.select("#ContactInformation_MobilePhone")).siblings(".preferredDeviceSelector.selected").length?($afe.select("label[for='ContactInformation_MobilePhone']").addClass("required"),r.safeAttr("data-validation-settings",n).safeAttr("aria-required",!0).change()):($afe.select("label[for='ContactInformation_MobilePhone']").removeClass("required"),r.safeAttr("data-validation-settings",t).safeAttr("aria-required",!1).change()));this.ViewModel.RequiredFieldNames.WorkPhone||this.ViewModel.ReadOnlyFieldNames.WorkPhone||((u=$afe.select("#ContactInformation_WorkPhone")).siblings(".preferredDeviceSelector.selected").length?($afe.select("label[for='ContactInformation_WorkPhone']").addClass("required"),u.safeAttr("data-validation-settings",n).safeAttr("aria-required",!0).change()):($afe.select("label[for='ContactInformation_WorkPhone']").removeClass("required"),u.safeAttr("data-validation-settings",t).safeAttr("aria-required",!1).change()))},_showNoMatches:function(n,t,i){n?(this.$root.find(".temporaryInformation").addClass("noMatchesContainer"),this.$root.find(".temporaryInformation .noMatchesMessage").removeClass("hidden"),i&&this.$root.find(".temporaryInformation p.buttoncheck").removeClass("hidden checked").addClass("unchecked")):(this.$root.find(".temporaryInformation").removeClass("noMatchesContainer"),this.$root.find(".temporaryInformation .noMatchesMessage").addClass("hidden"),this.$root.find(".temporaryInformation p.buttoncheck").addClass("hidden"));t?(this.$root.find(".permanentInformation").addClass("noMatchesContainer"),this.$root.find(".permanentInformation .noMatchesMessage").removeClass("hidden"),i&&this.$root.find(".permanentInformation p.buttoncheck").removeClass("hidden checked").addClass("unchecked")):(this.$root.find(".permanentInformation").removeClass("noMatchesContainer"),this.$root.find(".permanentInformation .noMatchesMessage").addClass("hidden"),this.$root.find(".permanentInformation p.buttoncheck").addClass("hidden"));(n||t)&&setupButtoncheck(this.$root.find("form"))},_moveToNextDefaultScreen:function(){var n;(this._hasPermanentAddressDefaults||this._hasTemporaryAddressDefaults)&&null!==this._addressData&&(this.$root.empty(),n=this._hasTemporaryAddressDefaults?{DefaultList:this._addressData.ViewModel.TemporaryDefaults,EnteredAddress:this._addressData.ViewModel.TemporaryAddress,Title:$$WP.Strings.get("TemporaryAddressLabel","PersonalInformation.ContactInformation"),AllowArbitraryInput:this._addressData.ViewModel.AllowArbitraryInput}:{DefaultList:this._addressData.ViewModel.PermanentDefaults,EnteredAddress:this._addressData.ViewModel.PermanentAddress,Title:$$WP.Strings.get("PermanentAddressLabel","PersonalInformation.ContactInformation"),AllowArbitraryInput:this._addressData.ViewModel.AllowArbitraryInput},this.$root.safeAppend($afe.renderTemplate($$WP.Templates.PersonalInformation.AddressDefaultsCard,n)),this.$root.find(".addressList .togglebutton").first().focus())},_resetDefaults:function(){this._addressData=null;this._hasTemporaryAddressDefaults=!1;this._hasPermanentAddressDefaults=!1;this._temporaryAddressIndex=-1;this._permanentAddressIndex=-1;this.$root.find("#ContactInformation_TemporaryDefaultOverrideCheck").prop("checked",!1);this.$root.find("#ContactInformation_PermanentDefaultOverrideCheck").prop("checked",!1)},_afterTemporaryAddressRender:function(){$$WP.FormValidation.checkIfFormIsValid(this.$root.find("form"),!0);this._pendingAddressLoads>0&&this.$root.find(".saveButton").prop("disabled",!0)},_showOrHideTemporaryAddress:function(){this.ViewModel.EditTemporaryAddress?($afe.select(".permanentHeader").show(),$afe.select(".addTemporaryAddressLinkContainer").hide(),$afe.select(".temporaryAddressContent").slideDown(500,"",this._afterTemporaryAddressRender)):($afe.select(".permanentHeader").hide(),$afe.select(".addTemporaryAddressLinkContainer").show(),$afe.select(".temporaryAddressContent").slideUp(500,this._afterTemporaryAddressRender))},_scrollToTopOfCard:function(){$$WPUtil.SmoothScrollToElementWithOffset($$WPUtil.ScrollableBody(),$afe.select("#contact-information-container"),$afe.select("#header").height())},loadData:function(){var n={useLoginUserEpt:this._settings.useLoginUserEpt};this._jqXHRForLoadingContactInfo=$.ajax({type:"POST",url:makeLink("PersonalInformation/GetContactInformation"),data:$$WPUtil.postify(n),dataType:"json",success:$.proxy(this._onLoadSuccess,this)})},saveData:function(){var t,n,i,r;$$WPUtil.ShowAjaxSpinner(this.$root.find(".ajaxspinner"));$afe.select(".addTemporaryAddressLinkContainer").hide();$afe.select(".removeTemporaryAddressLinkContainer").hide();this.updateViewModel();n=null;(this.ViewModel.EditTemporaryAddress||this.ViewModel.RemoveTemporaryAddress)&&(this.ViewModel.EditTemporaryAddress&&this.ViewModel.AddressHxEnabled&&!this.ViewModel.TemporaryAddress.StartDateDisplay&&(this.ViewModel.TemporaryAddress.StartDateDisplay=formatDate(new Date)),this.ViewModel.TemporaryAddress.StartDateISO=f(this.ViewModel.TemporaryAddress.StartDateDisplay),this.ViewModel.TemporaryAddress.EndDateISO=f(this.ViewModel.TemporaryAddress.EndDateDisplay),-1===this._temporaryAddressIndex||null===this._addressData?n=$.extend(!0,{},this.ViewModel.TemporaryAddress):-2===this._temporaryAddressIndex?((n=this._addressData.ViewModel.TemporaryAddress).StartDateISO=this.ViewModel.TemporaryAddress.StartDateISO,n.EndDateISO=this.ViewModel.TemporaryAddress.EndDateISO):((n=this._addressData.ViewModel.TemporaryDefaults[this._temporaryAddressIndex]).StartDateISO=this.ViewModel.TemporaryAddress.StartDateISO,n.EndDateISO=this.ViewModel.TemporaryAddress.EndDateISO),delete n.Validation);i=-1===this._permanentAddressIndex||null===this._addressData?this.ViewModel.PermanentAddress:-2===this._permanentAddressIndex?this._addressData.ViewModel.PermanentAddress:this._addressData.ViewModel.PermanentDefaults[this._permanentAddressIndex];r={EmailAddress:this.ViewModel.SecureCommunicationInfo.EmailAddress,MobilePhone:this.ViewModel.SecureCommunicationInfo.MobilePhone};t={PermanentAddress:i,TemporaryAddress:n,HomePhone:this.ViewModel.HomePhone,WorkPhone:this.ViewModel.WorkPhone,PreferredDevice:this.ViewModel.PreferredDevice,SecureCommunicationInfo:r};$.ajax({type:"POST",url:makeLink("PersonalInformation/UpdateContactInformation"),data:JSON.stringify({ViewModel:t,UseLoginUserEpt:this._settings.useLoginUserEpt,NeedTempDefault:-2!==this._temporaryAddressIndex,NeedPermDefault:-2!==this._permanentAddressIndex}),contentType:"application/json",dataType:"json",success:$.proxy(this._onSaveSuccess,this)});this.WP$Controllers$EditableViewController$afterRender()},updateViewModel:function(){var t,i,r,u,f,e,o,s,h,c,l;this.$root.find(".addressDefaults").length>0||(this.ViewModel.EditTemporaryAddress&&(u=$afe.select("#ContactInformation_TemporaryPhoneNumber",this.$root),f=$afe.select("#ContactInformation_TemporaryStartDate",this.$root),e=$afe.select("#ContactInformation_TemporaryEndDate",this.$root),this.ViewModel=this.ViewModel||{},this.ViewModel.TemporaryAddress=this.ViewModel.TemporaryAddress||{},t=this.ViewModel.TemporaryAddress.RequiredFieldNames,r=this.ViewModel.TemporaryAddress.Validation,i=this.ViewModel.TemporaryAddress.FormattedValues,this.ViewModel.TemporaryAddress=this._temporaryAddressController.getViewModel(),this.ViewModel.TemporaryAddress.PhoneNumber=n.getValIfExists(u),this.ViewModel.TemporaryAddress.StartDateDisplay=n.getValIfExists(f),this.ViewModel.TemporaryAddress.EndDateDisplay=n.getValIfExists(e),this.ViewModel.TemporaryAddress.RequiredFieldNames=t,this.ViewModel.TemporaryAddress.Validation=r,this.ViewModel.TemporaryAddress.FormattedValues=i,-1!==$.inArray("Phone",t)&&(this.ViewModel.TemporaryAddress.IsPhoneRequired=!0)),this.ViewModel=this.ViewModel||{},this.ViewModel.PermanentAddress=this.ViewModel.PermanentAddress||{},this.ViewModel.PermanentAddress.IsViewOnly||(t=this.ViewModel.PermanentAddress.RequiredFieldNames,i=this.ViewModel.PermanentAddress.FormattedValues,this.ViewModel.PermanentAddress=this._permanentAddressController.getViewModel(),this.ViewModel.PermanentAddress.RequiredFieldNames=t,this.ViewModel.PermanentAddress.FormattedValues=i),o=$afe.select("#ContactInformation_HomePhone",this.$root),s=$afe.select("#ContactInformation_MobilePhone",this.$root),h=$afe.select("#ContactInformation_WorkPhone",this.$root),c=$afe.select("#ContactInformation_Email",this.$root),l=$afe.select("#ContactInformation_PreferredDevice",this.$root),this.ViewModel=this.ViewModel||{},this.ViewModel.HomePhone=n.getValIfExists(o),this.ViewModel.SecureCommunicationInfo.MobilePhone=n.getValIfExists(s),this.ViewModel.WorkPhone=n.getValIfExists(h),this.ViewModel.SecureCommunicationInfo.EmailAddress=n.getValIfExists(c),this.ViewModel.PreferredDevice=n.getValIfExists(l))},_setVerificationAlertViewModel:function(){var n={};return this.ViewModel.SecureCommunicationInfo.DoNeitherNeedAttention||($$WP.Strings.setDefaultNamespace("PersonalInformation.ContactInformation"),this.ViewModel.SecureCommunicationInfo.DoBothNeedAttention?this.ViewModel.SecureCommunicationInfo.AreBothDeleted?(n.Text=$$WP.Strings.getForTemplate("BothContactsDeletedAlert"),n.ButtonCaption=$$WP.Strings.getForTemplate("AlertRestoreButtonText")):(n.Text=$$WP.Strings.getForTemplate("BothContactsNeedAttentionAlert"),n.ButtonCaption=$$WP.Strings.getForTemplate("AlertVerifyButtonText")):this.ViewModel.SecureCommunicationInfo.AreNeitherDeleted?this.ViewModel.SecureCommunicationInfo.DoesEmailNeedAttention?(n.Text=$$WP.Strings.getForTemplate("EmailNeedsAttentionAlert"),n.ButtonCaption=$$WP.Strings.getForTemplate("AlertVerifyButtonText")):this.ViewModel.SecureCommunicationInfo.DoesMobileNeedAttention&&(n.Text=$$WP.Strings.getForTemplate("MobileNeedsAttentionAlert"),n.ButtonCaption=$$WP.Strings.getForTemplate("AlertVerifyButtonText")):(this.ViewModel.SecureCommunicationInfo.IsEmailDeleted?n.Text=$$WP.Strings.getForTemplate("EmailDeletedAlert"):this.ViewModel.SecureCommunicationInfo.IsMobileDeleted&&(n.Text=$$WP.Strings.getForTemplate("MobileDeletedAlert")),n.ButtonCaption=$$WP.Strings.getForTemplate("AlertRestoreButtonText")),$$WP.Strings.clearDefaultNamespace()),n},_launchContactVerification:function(){this._contactVerificationSettings={};this._contactVerificationSettings.SecureCommunicationInfo=this.ViewModel.SecureCommunicationInfo;this._contactVerificationSettings.ControllerReference=this;null!=this._settings.autoSendEmailCode&&(this._contactVerificationSettings.AutoSendEmailCode=this._settings.autoSendEmailCode);null!=this._settings.autoSendMobileCode&&(this._contactVerificationSettings.AutoSendMobileCode=this._settings.autoSendMobileCode);this._settings.autoSendEmailCode=!1;this._settings.autoSendMobileCode=!1;new $$WP.Authentication.SecondaryValidation.Controllers.ContactVerificationController($afe.select("#contact-information-container"),this._contactVerificationSettings)},afterRender:function(){var n,t;this.ViewModel.DisplayEditable?(this._permanentAddressController.renderTo(this.$root.find(".permanentAddress")),this.ViewModel.IsNonPatientProxyRecord||this.ViewModel.IsTemporaryAddressDisabled||this._temporaryAddressController.renderTo(this.$root.find(".temporaryAddress")),this._settings.isEmbedded)||(n=this.$root[0],n&&n.addEventListener("change",$.proxy(function(){WP.Events.beforeUnload()},this))):this._settings.isEmbedded||WP.Events.cancelBeforeUnload();(this.ViewModel.PermanentAddress.IsViewOnly&&$afe.select(".permanentInformation .address").find("input, select, textarea").prop("disabled",!0),this._showOrHideTemporaryAddress(),this._setPreferredDeviceToBeRequired(),$$WP.FormValidation.initializeDOMSubtree(this.$root),this._pendingAddressLoads>0&&this.$root.find(".saveButton").prop("disabled",!0),this.$root.find(".hideLongContentWithEllipses").each(function(){if(this.getClientRects().length>.97){var n=$afe.jq(this);n.addClass("overflowHiddenWithEllipses").safeAttr("title",n.text())}}),0===$afe.select(":focus").length&&this.focusAfterRender)&&(t=this.$root.find("#focusHeader"),t?t.focus():this.$root.find("input, select, textarea, button").filter(":visible:enabled").first().focus())},_addLoadingHeartToContactInformationContainer:function(){$afe.renderTemplate($$WP.Templates.UI.AjaxSpinner,{inline:1}).safePrependTo($afe.select("#contact-information-container .loadingIndicator"));$$WPUtil.ShowAjaxSpinner($afe.select("#contact-information-container .ajaxspinner"))},_updateViewModel:function(){this.ViewModel.HideEmptyFields=this._settings.hideEmptyFields;this.ViewModel.HasContactNumber=0!==this.ViewModel.HomePhone.length||0!==this.ViewModel.SecureCommunicationInfo.MobilePhone.length||0!==this.ViewModel.WorkPhone.length?!0:!1},abortLoadingAjax:function(){this._jqXHRForLoadingContactInfo&&(this._jqXHRForLoadingContactInfo.abort(),this._jqXHRForLoadingContactInfo=null)}};o=function(n,t,i){var f,e;return void 0===n||void 0===t||void 0===i||(f=$afe.select("#ContactInformation_TemporaryEndDate").val(),e=new Date(n,t,i),r<=e&&e<=(f?parseDate(f,!0):u))};s=function(n,t,i){var f,e;return void 0===n||void 0===t||void 0===i||(f=$afe.select("#ContactInformation_TemporaryStartDate").val(),e=new Date(n,t,i),(f?parseDate(f,!0):r)<=e&&e<=u)};f=function(n){return n?$$WP.I18N.parseDate(n).toISOString().split("T")[0]:""};t=function(){var n=new Date;return n.setDate(n.getDate()-1),n};h=function(n){switch(n){case"PermanentAddress.Zip":return"#PermanentAddress_Zip";case"TemporaryAddress.Zip":return"#TemporaryAddress_Zip";case"TemporaryPhone":return"#ContactInformation_TemporaryPhoneNumber";case"HomePhone":case"MobilePhone":case"WorkPhone":return"#ContactInformation_"+n}return""};s_buildAddressFieldsList=function(n){for(var i,r={},t=0;t<n.length;t++)for(i=0;i<n[t].AddressFields.length;i++)r[n[t].AddressFields[i].AddressSubField]=!0;return r};i=function(){};e.prototype=c;i.prototype={onEditClickedCallback:null,onSaveSuccessCallback:null,onCancelClickedCallback:null,onEditTemporaryAddressCallback:null,onLoadSuccessCallback:null,onBothCardsLoadAndEdit:null,useLoginUserEpt:!1,focusOnLoad:!1,isEmbedded:!1,autoLaunchPopup:!1,initialLaunchPopup:!1,hideEmptyFields:!1,currentHeaderLevel:3};$$WP.PersonalInformation=$$WP.PersonalInformation||{};$$WP.PersonalInformation.ContactInformationController=e;$$WP.PersonalInformation.ContactInformationSettings=i;e.extend(n,"WP$PersonalInformation$Controllers$ContactInformationController");i.extend($$WP.BaseObject,"WP$PersonalInformation$Controllers$ContactInformationSettings")}();!function(){var t,i,n=function(n,i){this._settings=i||new t;this.WP$Controllers$EditableViewController(n,$$WP.Templates.PersonalInformation.OtherInformation);this.$root.addClass("other-information-content card");this._addLoadingHeartToOtherInformationContainer();this.$root.parents(".cardlist").trigger("cardLoad");this.$root.on("submit",function(n){n.preventDefault()})},r={_settings:null,_initialViewModel:null,_wasJumpedToEditMode:!1,_jqXHRForLoadingOtherInfo:null,_onLoadSuccess:function(t){var i,r,u,f;if(this._jqXHRForLoadingOtherInfo=null,u=!1,this.ViewModel=t,this.ViewModel.IsMobile=WP.DOM.Browser.isMobile||$$WP.Utilities.UI.IsMobile,this.ViewModel.CurrentHeaderLevel=this._settings.currentHeaderLevel,0===this.ViewModel.Fields.length)return this.$root.hide(),void("function"==typeof this._settings.onLoadSuccessCallback&&this._settings.onLoadSuccessCallback());if(!n.WereRELFieldsShown)for(r=0;r<this.ViewModel.Fields.length;r++)"7"!==this.ViewModel.Fields[r].FieldId&&"8"!==this.ViewModel.Fields[r].FieldId&&"9"!==this.ViewModel.Fields[r].FieldId&&"10"!==this.ViewModel.Fields[r].FieldId||(n.WereRELFieldsShown=!0);for(this.ViewModel.HideEmptyFields=!!this.ViewModel.HasEditableField&&this._settings.hideEmptyFields,this.ViewModel.NoInformationAlert=!0,i=0;i<this.ViewModel.Fields.length;i++)switch(this.ViewModel.Fields[i].DisplayField=!0,1===this.ViewModel.Fields[i].Type&&0===this.ViewModel.Fields[i].Values[0].length&&(this.ViewModel.Fields[i].Values=[]),0===this.ViewModel.Fields[i].Values.length&&this.ViewModel.HideEmptyFields?this.ViewModel.Fields[i].DisplayField=!1:this.ViewModel.NoInformationAlert=!1,this.ViewModel.Fields[i].FieldId){case"1":this.ViewModel.Fields[i].HelpText=$$WP.Strings.get("OtherInformationPreferredNameHelpText","PersonalInformation.OtherInformation");break;case"2":this.ViewModel.Fields[i].HelpText=$$WP.Strings.get("OtherInformationSOGIHelpText","PersonalInformation.OtherInformation");break;case"3":this.ViewModel.Fields[i].HelpText=$$WP.Strings.get("OtherInformationGenderIdentityHelpText","PersonalInformation.OtherInformation");break;case"4":this.ViewModel.Fields[i].HelpText=$$WP.Strings.get("OtherInformationSexAssignedAtBirthHelpText","PersonalInformation.OtherInformation");break;case"5":this.ViewModel.Fields[i].HelpText=$$WP.Strings.get("OtherInformationSexualOrientationHelpText","PersonalInformation.OtherInformation")}for(f=this.ViewModel.NoInformationAlert?"":"library.svg#_flat_edit",this.ViewModel.ProxyContextName?($$WP.Strings.addMnemonic("@MYCHART@PATIENT@",this.ViewModel.ProxyContextName),this.ViewModel.EditButtonCmdOptions={CssClasses:"editButton",IconPath:f,AriaLabel:$$WP.Strings.get("EditDetailsAboutProxyButtonScreenReaderLabel","PersonalInformation.OtherInformation")}):this.ViewModel.EditButtonCmdOptions={CssClasses:"editButton",IconPath:f,AriaLabel:$$WP.Strings.get("EditDetailsAboutMeButtonScreenReaderLabel","PersonalInformation.OtherInformation")},this.ViewModel.ValidationSettings=$$WP.FormValidation.ValidationSettings.Required,r=0;r<this.ViewModel.Fields.length;r++)this.ViewModel.Fields[r].IsRequired&&(1===this.ViewModel.Fields[r].Type&&""===this.ViewModel.Fields[r].Values[0]||0===this.ViewModel.Fields[r].Values.length)&&(u=!0);this.focusAfterRender=this._settings.focusOnLoad;this.render(u);this.focusAfterRender=!0;"function"==typeof this._settings.onLoadSuccessCallback&&this._settings.onLoadSuccessCallback();u&&(this._initialViewModel=$.extend(!0,{},this.ViewModel),this.$root.find(".cancelButton").remove(),this._wasJumpedToEditMode=!0,"function"==typeof this._settings.onEditClickedCallback&&this._settings.onEditClickedCallback(),this._settings.fromWorkflow||this.$root.find("input, select, textarea").filter(":visible:enabled").first().focus());"function"==typeof this._settings.onBothCardsLoadAndEdit&&this._settings.onBothCardsLoadAndEdit()},_onSaveSuccess:function(n){for(var u,r,t=0;t<n.ViewModel.Fields.length;t++)delete n.ViewModel.Fields[t].IsRequired,delete n.ViewModel.Fields[t].IsReadOnly;if(this.ViewModel=$.extend(!0,{},this.ViewModel,n.ViewModel),this.ViewModel.HideEmptyFields=!!this.ViewModel.HasEditableField&&this._settings.hideEmptyFields,this.ViewModel.NoInformationAlert=!0,r="",n.Success){for(t=0;t<this.ViewModel.Fields.length;t++)this.ViewModel.Fields[t].DisplayField=!0,1===this.ViewModel.Fields[t].Type&&0===this.ViewModel.Fields[t].Values[0].length&&(this.ViewModel.Fields[t].Values=[]),0===this.ViewModel.Fields[t].Values.length&&this.ViewModel.HideEmptyFields?this.ViewModel.Fields[t].DisplayField=!1:this.ViewModel.NoInformationAlert=!1;r=this.ViewModel.NoInformationAlert?"":"library.svg#_flat_edit";this.ViewModel.ProxyContextName?($$WP.Strings.addMnemonic("@MYCHART@PATIENT@",this.ViewModel.ProxyContextName),this.ViewModel.EditButtonCmdOptions={CssClasses:"editButton",IconPath:r,AriaLabel:$$WP.Strings.get("EditDetailsAboutProxyButtonScreenReaderLabel","PersonalInformation.OtherInformation")}):this.ViewModel.EditButtonCmdOptions={CssClasses:"editButton",IconPath:r,AriaLabel:$$WP.Strings.get("EditDetailsAboutMeButtonScreenReaderLabel","PersonalInformation.OtherInformation")};this.render(!1);this._wasJumpedToEditMode=!1;"function"==typeof this._settings.onSaveSuccessCallback&&this._settings.onSaveSuccessCallback()}else if(this.render(!0),this._wasJumpedToEditMode&&this.$root.find(".cancelButton").remove(),n.ViewModel.ValidationErrors)for(t=0;t<n.ViewModel.ValidationErrors.length;t++)u=$afe.select(i(n.ViewModel.ValidationErrors[t].ErrorIndex)),$$WP.FormValidation.addValidationError(u,n.ViewModel.ValidationErrors[t].ErrorKey)},onEditClicked:function(n){this._initialViewModel=$.extend(!0,{},this.ViewModel);this.WP$Controllers$EditableViewController$onEditClicked(n);"function"==typeof this._settings.onEditClickedCallback&&this._settings.onEditClickedCallback();this._scrollToTopOfCard()},onSaveClicked:function(n){this.WP$Controllers$EditableViewController$onSaveClicked(n);this._scrollToTopOfCard()},onCancelClicked:function(n){this.ViewModel=this._initialViewModel;this.WP$Controllers$EditableViewController$onCancelClicked(n);"function"==typeof this._settings.onCancelClickedCallback&&this._settings.onCancelClickedCallback();this._scrollToTopOfCard()},_getPostableViewModel:function(){for(var i,t,r=[],n=0;n<this.ViewModel.Fields.length;n++){if(1===this.ViewModel.Fields[n].Type)i=this.ViewModel.Fields[n].Values.length?this.ViewModel.Fields[n].Values:[""];else for(i=[],t=0;t<this.ViewModel.Fields[n].Categories.length;t++)this.ViewModel.Fields[n].Categories[t].IsSelected&&i.push(this.ViewModel.Fields[n].Categories[t].Number);r.push({FieldId:this.ViewModel.Fields[n].FieldId,Type:this.ViewModel.Fields[n].Type,Values:i})}return{Fields:r,disableUTF8:this._settings.disableUTF8}},loadData:function(){this._jqXHRForLoadingOtherInfo=$.ajax({type:"POST",url:makeLink("PersonalInformation/GetOtherInformation?checkRELFrequency="+this._settings.checkRELFrequency),data:$$WPUtil.postify({disableUTF8:this._settings.disableUTF8}),dataType:"json",success:$.proxy(this._onLoadSuccess,this)})},saveData:function(){$$WPUtil.ShowAjaxSpinner(this.$root.find(".ajaxspinner"));this.updateViewModel();$.ajax({type:"POST",url:makeLink("PersonalInformation/UpdateOtherInformation"),data:$$WPUtil.postify(this._getPostableViewModel()),dataType:"json",success:$.proxy(this._onSaveSuccess,this)})},_scrollToTopOfCard:function(){$$WPUtil.SmoothScrollToElementWithOffset($$WPUtil.ScrollableBody(),$afe.select("#other-information-container"),$afe.select("#header").height())},afterRender:function(){if(!this._settings.isEmbedded)if(this.ViewModel.DisplayEditable){var n=this.$root[0];n&&n.addEventListener("change",$.proxy(function(){WP.Events.beforeUnload()},this))}else WP.Events.cancelBeforeUnload();$$WP.FormValidation.initializeDOMSubtree(this.$root);this.$root.find(".hideLongContentWithEllipses").each(function(){if(this.getClientRects().length>2){var n=$afe.jq(this);n.addClass("overflowHiddenWithEllipses").safeAttr("title",n.text())}});this.focusAfterRender=!0!==this._settings.focusAfterRender&&!this.ViewModel.DisplayEditable||this._settings.launchesWithPopup?!1:!0;this.WP$Controllers$EditableViewController$afterRender()},_addLoadingHeartToOtherInformationContainer:function(){$afe.renderTemplate($$WP.Templates.UI.AjaxSpinner,{inline:1}).safePrependTo($afe.select("#other-information-container .loadingIndicator"));$$WPUtil.ShowAjaxSpinner($afe.select("#other-information-container .ajaxspinner"))},updateViewModel:function(){var i,n,t;for(this.$root.find(".button, input, select, textarea").prop("disabled",!1),i=this.$root.find("form").serializeArray(),this.$root.find(".button, input, select, textarea").prop("disabled",!0),n=0;n<this.ViewModel.Fields.length;n++){if(this.ViewModel.Fields[n].Values=[],1!==this.ViewModel.Fields[n].Type)for(t=0;t<this.ViewModel.Fields[n].Categories.length;t++)this.ViewModel.Fields[n].Categories[t].IsSelected=!1;$.each(i,$.proxy(function(i,r){if(this.ViewModel.Fields[n].FieldId===r.name)if(1===this.ViewModel.Fields[n].Type)r.value&&this.ViewModel.Fields[n].Values.push(r.value);else for(t=0;t<this.ViewModel.Fields[n].Categories.length;t++)if(this.ViewModel.Fields[n].Categories[t].Number===r.value){this.ViewModel.Fields[n].Categories[t].IsSelected=!0;this.ViewModel.Fields[n].Values.push(this.ViewModel.Fields[n].Categories[t].Title);break}},this))}},abortLoadingAjax:function(){this._jqXHRForLoadingOtherInfo&&(this._jqXHRForLoadingOtherInfo.abort(),this._jqXHRForLoadingOtherInfo=null)}};i=function(){return"#OtherInformation_1"};t=function(){};n.prototype=r;n.WereRELFieldsShown=n.WereRELFieldsShown||!1;t.prototype={checkRELFrequency:!1,onEditClickedCallback:null,onSaveSuccessCallback:null,onCancelClickedCallback:null,onEditTemporaryAddressCallback:null,onLoadSuccessCallback:null,onBothCardsLoadAndEdit:null,isEmbedded:!1,disableUTF8:!1,hideEmptyFields:!1,launchesWithPopup:!1,currentHeaderLevel:3};$$WP.PersonalInformation=$$WP.PersonalInformation||{};$$WP.PersonalInformation.OtherInformationController=n;$$WP.PersonalInformation.OtherInformationSettings=t;n.extend($$WP.Controllers.EditableViewController,"WP$PersonalInformation$Controllers$OtherInformationController");t.extend($$WP.BaseObject,"WP$PersonalInformation$Controllers$OtherInformationSettings")}();!function(){var n=function(n,t,i,r){this.WP$Controllers$Controller();this.proxify("__onContactCardLoaded","__onContactCardEdit","__onContactCardCancel","__onContactCardSaved","__onOtherCardLoaded","__onOtherCardEdit","__onOtherCardCancel","__onOtherCardSaved","__onBothCardsLoadAndEdit","deactivate");this.$root=n;this.__onIsCompleteChangedCallback=t;this.__disableUTF8=i;this.__hideEmptyFields=r;this.__initializeDom();this.__initializeControllers()};n.prototype={IsDataModified:!1,IsComplete:!1,__onIsCompleteChangedCallback:null,__disableUTF8:!1,__hideEmptyFields:!1,$root:null,$contactInformationContainer:null,$othertInformationContainer:null,__contactInformationController:null,__otherInformationController:null,__isContactInformationInEditMode:!1,__isOtherInformationInEditMode:!1,__isContactInformationLoaded:!1,__isOtherInformationLoaded:!1,MarkDemographicsAsVerified:function(n){var t;this.__isLoadingComplete()?this.__isAnyCardInEditMode()?$$WP.Debug.logError("MarkDemographicsAsVerified was called while demographics were being edited."):(t=$$WP.PersonalInformation.OtherInformationController.WereRELFieldsShown,$.post({url:makeLink("PersonalInformation/VerifyPatientInformation"),data:{verifyREL:t},cache:!1,success:n})):$$WP.Debug.logError("MarkDemographicsAsVerified was called before demographics were finished loading.")},__initializeDom:function(){this.$root.safeAppend($afe.renderTemplate($$WP.Templates.PersonalInformation.DemographicVerification));this.$contactInformationContainer=this.$root.find("#contact-information-container");this.$othertInformationContainer=this.$root.find("#other-information-container")},__initializeControllers:function(){var n=null,t=null;(n=new $$WP.PersonalInformation.ContactInformationSettings).onEditClickedCallback=this.__onContactCardEdit;n.onEditTemporaryAddressCallback=this.__onContactCardEdit;n.onCancelClickedCallback=this.__onContactCardCancel;n.onSaveSuccessCallback=this.__onContactCardSaved;n.isEmbedded=!0;n.disableUTF8=this.__disableUTF8;n.onLoadSuccessCallback=this.__onContactCardLoaded;n.hideEmptyFields=this.__hideEmptyFields;n.focusOnLoad=!1;n.fromWorkflow=!0;n.onBothCardsLoadAndEdit=this.__onBothCardsLoadAndEdit;(t=new $$WP.PersonalInformation.OtherInformationSettings).onEditClickedCallback=this.__onOtherCardEdit;t.onCancelClickedCallback=this.__onOtherCardCancel;t.onSaveSuccessCallback=this.__onOtherCardSaved;t.checkRELFrequency=!0;t.isEmbedded=!0;t.disableUTF8=this.__disableUTF8;t.onLoadSuccessCallback=this.__onOtherCardLoaded;t.hideEmptyFields=this.__hideEmptyFields;t.focusOnLoad=!1;t.fromWorkflow=!0;t.onBothCardsLoadAndEdit=this.__onBothCardsLoadAndEdit;this.__contactInformationController=new $$WP.PersonalInformation.ContactInformationController(this.$contactInformationContainer,n);this.__otherInformationController=new $$WP.PersonalInformation.OtherInformationController(this.$othertInformationContainer,t)},__onContactCardLoaded:function(){this.__isContactInformationLoaded=!0;this.__updateIsComplete()},__onContactCardEdit:function(){this.__isContactInformationInEditMode=!0;this.__updateIsComplete()},__onContactCardCancel:function(){this.__isContactInformationInEditMode=!1;this.__updateIsComplete()},__onContactCardSaved:function(){this.__isContactInformationInEditMode=!1;this.IsDataModified=!0;this.__updateIsComplete()},__onOtherCardLoaded:function(){this.__isOtherInformationLoaded=!0;this.__updateIsComplete()},__onOtherCardEdit:function(){this.__isOtherInformationInEditMode=!0;this.__updateIsComplete()},__onOtherCardCancel:function(){this.__isOtherInformationInEditMode=!1;this.__updateIsComplete()},__onOtherCardSaved:function(){this.__isOtherInformationInEditMode=!1;this.IsDataModified=!0;this.__updateIsComplete()},__updateIsComplete:function(){this.__isLoadingComplete()&&(this.IsComplete=!this.__isAnyCardInEditMode(),"function"==typeof this.__onIsCompleteChangedCallback&&this.__onIsCompleteChangedCallback(this.IsComplete,this.IsDataModified))},__isLoadingComplete:function(){return this.__isContactInformationLoaded&&this.__isOtherInformationLoaded},__isAnyCardInEditMode:function(){return this.__isContactInformationInEditMode||this.__isOtherInformationInEditMode},__onBothCardsLoadAndEdit:function(){this.__isLoadingComplete()&&this.__isAnyCardInEditMode()&&this.$root.find("input, select, textarea").filter(":visible:enabled").first().focus()},deactivate:function(){this.__contactInformationController&&this.__contactInformationController.abortLoadingAjax();this.__otherInformationController&&this.__otherInformationController.abortLoadingAjax()}};$$WP.PersonalInformation.DemographicVerificationController=n;n.extend($$WP.Controllers.Controller,"WP$PersonalInformation$DemographicVerificationController")}();!function(){var n=$$WP.Strings.getNamespace("Authentication.ContactVerification"),t;$$WP.Utilities.guaranteeExistence($$WP,"Authentication.SecondaryValidation.Controllers");t=function(n,t){this.$container=n;this.proxify("_createPopup","_loadVerification","_bindEvents","_startVerifyEmailWorkflow","_startVerifyMobileWorkflow","_updateEmailSection","_updateMobileSection","_cancelWorkflow","_overwriteMismatchedEmail","_overwriteMismatchedMobile","_overwriteMismatchedCore","_disposePopup");this._secureCommunicationInfo=t.SecureCommunicationInfo;this._controllerReference=t.ControllerReference;t.AutoSendEmailCode?(this._secureCommunicationInfo.AutoSendCode=!0,this._createPopup(!0,!1)):t.AutoSendMobileCode?(this._secureCommunicationInfo.AutoSendCode=!0,this._createPopup(!1,!0)):(this._secureCommunicationInfo.AutoSendCode=!1,this._createPopup(!1,!1))};t.prototype={$container:null,_context:null,_emailAllowed:!1,_emailEnabled:!1,_phoneAllowed:!1,_phoneEnabled:!1,_secureCommunicationInfo:null,_verificationPopup:null,_secondaryValidationSettings:null,_controllerReference:null,_secondaryValidationController:null,_bindEvents:function(){this.$container.on("click","#sendCodeToEmailButton",this._startVerifyEmailWorkflow);this.$container.on("click","#overwriteEmailButton",this._overwriteMismatchedEmail);this.$container.on("click","#sendCodeToMobileButton",this._startVerifyMobileWorkflow);this.$container.on("click","#overwriteMobileButton",this._overwriteMismatchedMobile);$afe.select("div.Popup").on("click",".previouspage",this._disposePopup);var n=$afe.select("div.Popup").find("#contact_verification_container")[0];void 0!==n&&new MutationObserver($.proxy(function(){null!=this._verificationPopup&&this._verificationPopup._resizePopup()},this)).observe(n,{subtree:!0,childList:!0})},_loadVerification:function(n,t){var i={SecureCommunicationInfo:this._secureCommunicationInfo,IsEmailUpdated:n,IsMobileUpdated:t};$afe.select("div.Popup").removeClass("small").addClass("medium");this.$container.parent().empty().safeAppend($afe.renderTemplate($$WP.Templates.SecondaryAuthentication.ContactVerification,i));this.$container=$afe.select("#contact_verification_container");this._bindEvents();n?$afe.select("#emailUpdatedSuccessMessage").focus():t&&$afe.select("#mobileUpdatedSuccessMessage").focus()},_createPopup:function(t,i){var r,e,u,f;0===window.pageYOffset&&(u=$afe.select("#header"),u.hasClass("compact")&&u.removeClass("compact"));e=n.getString("BackButtonText");this._secureCommunicationInfo.DoBothNeedAttention?r=n.getString("ContactVerificationHeader"):this._secureCommunicationInfo.DoesEmailNeedAttention?r=n.getString("EmailVerificationHeader"):this._secureCommunicationInfo.DoesMobileNeedAttention&&(r=n.getString("MobileVerificationHeader"));f=new $$WPComp.TemplateComponent({template:$$WP.Templates.SecondaryAuthentication.ContactVerification,IsClosable:!0,TitleText:r});f.setData({SecureCommunicationInfo:this._secureCommunicationInfo,IsEmailUpdated:!1,IsMobileUpdated:!1});this._verificationPopup=$$WPUtil.quickPopup(f,{Size:$$WPContain.Popup.SizeEnum.MEDIUM,BackButtonText:e});this.$container=$afe.select("#contact_verification_container");this._secureCommunicationInfo.AutoSendCode&&this._verificationPopup.hide();this._bindEvents();$afe.select("div.Popup").addClass("fullscreen");$afe.select("div.Popup")[0].removeAttribute("aria-live");t?this._startVerifyEmailWorkflow():i&&this._startVerifyMobileWorkflow()},_startVerifyEmailWorkflow:function(){var t=n.getString("SendEmailStepThreeDescription");this._secondaryValidationSettings={TwoFactorSettings:this._getTwoFactorSettings("email",this._secureCommunicationInfo.EmailAddress),TwoFactorDescriptionSettings:{StepThreeText:t},CallbackSettings:{Success:$.proxy(function(){this._secureCommunicationInfo.SecureEmail=this._secureCommunicationInfo.EmailAddress;this._updateEmailSection()},this),GoBackFromSecondaryValidation:$.proxy(function(){this._loadVerification(!1,!1)},this)},RememberMeSettings:{Enabled:!1},SignupSettings:null!=this._templateContext?SignupSettings:null,ValidationSettings:new $$WP.FormValidation.ValidationSettings({required:!0,nullValue:"default"}),PopupSettings:{IsPopup:!0},Workflow:3,PopupToShow:this._verificationPopup};this._secondaryValidationController=new $$WP.Authentication.SecondaryValidation.Controllers.SecondaryValidationController($afe.select("#contact_review_container"),this._secondaryValidationSettings)},_startVerifyMobileWorkflow:function(){var t=n.getString("SendMobileStepThreeDescription");this._secondaryValidationSettings={TwoFactorSettings:this._getTwoFactorSettings("phone","‪"+this._secureCommunicationInfo.MobilePhone+"‬"),TwoFactorDescriptionSettings:{StepThreeText:t},CallbackSettings:{Success:$.proxy(function(){this._secureCommunicationInfo.SecureMobile=this._secureCommunicationInfo.MobilePhone;this._updateMobileSection()},this),GoBackFromSecondaryValidation:$.proxy(function(){this._loadVerification(!1,!1)},this)},RememberMeSettings:{Enabled:!1},SignupSettings:null!=this._templateContext?SignupSettings:null,ValidationSettings:new $$WP.FormValidation.ValidationSettings({required:!0,nullValue:"default"}),PopupSettings:{IsPopup:!0},Workflow:3,PopupToShow:this._verificationPopup};this._secondaryValidationController=new $$WP.Authentication.SecondaryValidation.Controllers.SecondaryValidationController($afe.select("#contact_review_container"),this._secondaryValidationSettings)},_getTwoFactorSettings:function(n,t){var i={Enabled:!0,AllowEmail:!1,AllowSMS:!1,IsPostLogin2FA:!0,ShowIntro:!1,ShowTitle:!1,ShowRecip:!0};switch(n){case"email":i.AllowEmail=!0;i.DisplayEmail=t;break;case"phone":i.AllowSMS=!0;i.DisplayPhone=t;i.ShowIntro=!0}return i},_updateEmailSection:function(){this._secureCommunicationInfo.DoBothNeedAttention=!1;this._secureCommunicationInfo.DoesEmailNeedAttention=!1;this._secureCommunicationInfo.DoNeitherNeedAttention=!this._secureCommunicationInfo.DoesMobileNeedAttention;this._handleInformationUpdate();this._controllerReference.ViewModel.SecureCommunicationInfo=this._secureCommunicationInfo;this._controllerReference.render(!1);var n=$afe.select("#launchVerificationButton");null!==n&&this._controllerReference._settings.autoLaunchPopup&&(n.removeClass("secondary neutral"),n.addClass("positive primary"));this._secureCommunicationInfo.DoNeitherNeedAttention&&this._disposePopup();this._loadVerification(!0,!1)},_updateMobileSection:function(){this._secureCommunicationInfo.DoBothNeedAttention=!1;this._secureCommunicationInfo.DoesMobileNeedAttention=!1;this._secureCommunicationInfo.DoNeitherNeedAttention=!this._secureCommunicationInfo.DoesEmailNeedAttention;this._handleInformationUpdate();this._controllerReference.ViewModel.SecureCommunicationInfo=this._secureCommunicationInfo;this._controllerReference.render(!1);var n=$afe.select("#launchVerificationButton");null!==n&&this._controllerReference._settings.autoLaunchPopup&&(n.removeClass("secondary neutral"),n.addClass("positive primary"));this._secureCommunicationInfo.DoNeitherNeedAttention&&this._disposePopup();this._loadVerification(!1,!0)},_overwriteMismatchedEmail:function(){var n=$.proxy(function(){this._secureCommunicationInfo.EmailAddress=this._secureCommunicationInfo.SecureEmail;this._secureCommunicationInfo.IsEmailDeleted=!1;this._secureCommunicationInfo.AreBothDeleted=!1;this._secureCommunicationInfo.AreNeitherDeleted=!this._secureCommunicationInfo.IsMobileDeleted;this._updateEmailSection()},this);this._overwriteMismatchedCore("overwriteEmail",n)},_overwriteMismatchedMobile:function(){var n=$.proxy(function(){this._secureCommunicationInfo.MobilePhone=this._secureCommunicationInfo.SecureMobile;this._secureCommunicationInfo.IsMobileDeleted=!1;this._secureCommunicationInfo.AreBothDeleted=!1;this._secureCommunicationInfo.AreNeitherDeleted=!this._secureCommunicationInfo.IsEmailDeleted;this._updateMobileSection()},this);this._overwriteMismatchedCore("overwriteMobile",n)},_overwriteMismatchedCore:function(n,t){var i={};i[n]=!0;$.ajax({url:makeLink("Authentication/ContactVerification/OverwriteMismatch"),type:"POST",data:i,dataType:"json",success:t()})},_cancelWorkflow:function(){this._loadVerification(!1,!1)},_disposePopup:function(){this._verificationPopup.dispose()},_handleInformationUpdate:function(){requestAnimationFrame(function(){requestAnimationFrame(function(){var n=$$WP.Strings.getNamespace("PersonalInformation.ContactInformation");$afe.select("#success_alert_title").text(n.getString("ContactsVerifiedTitle"));$afe.select("#success_alert_text").text(n.getString("ContactsVerifiedMessage"))})});this._secureCommunicationInfo.InfoUpdated=!0}};$$WP.Authentication.SecondaryValidation.Controllers.ContactVerificationController=t;t.extend($$WP.Controllers.Controller,"WP$Authentication$SecondaryValidation$Controllers$ContactVerificationController")}();!function(){$$WP.Utilities.guaranteeExistence($$WP,"Authentication.SecondaryValidation.Controllers");var n=$$WP.Strings.getNamespace("secondaryvalidation"),t=function(n,t){if(this.proxify("_initializeDefaultSettings","_resendTwoFactorCodeByEmail","_resendTwoFactorCodeByText","_registerBeforeUnloadHandler","_useTwoFactorCodeByTotp","_loadTwoFactorIntro","_loadSecondaryAuthenticationEntry","_bindEvents","_sendTwoFactorCodeByEmail","_sendTwoFactorCodeByText","_sendTwoFactorCodeCore","_submitSecondaryValidationInfo","_showPopup","_renderDescription","_returnToPreviousScreen","_resendTwoFactorCode","_executeReturnCallback","_success","_pushAnswers","_popAnswers","reload","_showReturnDialogue","_logout","_registerPartials","_setupDemographicAndTwoFactorViews","_handleTwoFactorMustLogout"),this.$container=n,this._context=t,this._initializeDefaultSettings(),this._registerPartials(),this._successCallback=this._context.CallbackSettings.Success,this._cancelCallback=this._context.CallbackSettings.Cancel,this._context.PopupSettings.IsPopup&&(this._closePopup=this._context.PopupSettings.Close),this._context.TwoFactorSettings.IsSelfSignupWorkflow){var i=this._createBackToSelfSignupURL();this._context.CallbackSettings.GoBackFromSecondaryValidation=function(){$$WPUtil.TryRedirect(i)};this._setPreloginTimeout()}$$WPUtil.IsNullOrEmpty(this._context.CallbackSettings.GoBackFromSecondaryValidation)||(this._returnCallback=this._context.CallbackSettings.GoBackFromSecondaryValidation,this._context.TwoFactorSettings.HasBackButton=!0);this._context&&this._context&&this._context.SignupSettings&&this._context.SignupSettings.Enabled&&this._context.SignupSettings.UpdateStepCount(this._context,1,"twoFactorEntryLoad");this._context.DemographicSettings.IsGuestLogin&&WP.Events.beforeUnload();this._operationInProgress=!1;this._bindEvents();this._context.TwoFactorSettings.Enabled?this._prepareIntro():this._loadSecondaryAuthenticationEntry()};t.prototype={$container:null,_context:null,_successCallback:null,_cancelCallback:null,_closePopup:null,_operationInProgress:!1,_reloadCallback:null,_descriptionController:null,_returnCallback:null,_showIntro:!1,_firstDemogAttempt:!0,reload:function(n){null!==this._reloadCallback&&($$WPUtil.IsNullOrEmpty(n)||(this.$container=n),this._reloadCallback(),this._popAnswers())},_initializeDefaultSettings:function(){$$WP.Utilities.guaranteeExistence(this._context,"TwoFactorSettings.IsPostLogin2FA",!1);$$WP.Utilities.guaranteeExistence(this._context,"TwoFactorSettings.ShowTitle",!0);$$WP.Utilities.guaranteeExistence(this._context,"TwoFactorSettings.ShowLearnMore",!0);$$WP.Utilities.guaranteeExistence(this._context,"FormValidation.RequiredSettings",new $$WP.FormValidation.ValidationSettings({required:!0}));$$WP.Utilities.guaranteeExistence(this._context,"FormValidation.CodeEntrySettings",new $$WP.FormValidation.ValidationSettings({required:!0,isNumericString:!0}));$$WP.Utilities.guaranteeExistence(this._context,"FormValidation.DateSettings",new $$WP.FormValidation.ValidationSettings({required:!0,isDate:!0,isDOB:!0,maxDate:(new Date).toISOString().slice(0,10)}));$$WP.Utilities.guaranteeExistence(this._context,"FormValidation.Email",new $$WP.FormValidation.ValidationSettings({required:!0,isEmail:!0}));$$WP.Utilities.guaranteeExistence(this._context,"PopupSettings.IsPopup",!1);$$WP.Utilities.guaranteeExistence(this._context,"PopupSettings.ResetFocus",function(){});$$WP.Utilities.guaranteeExistence(this._context,"DemographicSettings.Enabled",!1)},_prepareIntro:function(){this._context.TwoFactorSettings.ShowIntro||this._context.TwoFactorSettings.AllowSMS&&this._context.ConsentStrings&&this._context.ConsentStrings.ShowConsent||this._context.TwoFactorSettings.AllowMultiple||this._context.TwoFactorSettings.IsSelfSignupWorkflow?(this._showIntro=!0,this._consentSeemsPopulated()?this._loadTwoFactorIntro():this._tryPopulateConsent(this._loadTwoFactorIntro)):this._context.TwoFactorSettings.AllowEmail?this._sendTwoFactorCodeByEmail():this._context.TwoFactorSettings.AllowSMS?this._sendTwoFactorCodeByText():this._context.TwoFactorSettings.AllowTotp&&this._useTwoFactorCodeByTotp()},_loadTwoFactorIntro:function(n){$$WPUtil.IsNullOrEmpty(n)||(this._showPopup(),"toolbarBack"===n)?(null===this._returnCallback&&(this._context.TwoFactorSettings.HasBackButton=!1),this.$container.empty().safeAppend($afe.renderTemplate($$WP.Templates.SecondaryAuthentication.TwoFactorIntro,this._context)),this._reloadCallback=this._loadTwoFactorIntro,this._context.PopupSettings.IsPopup?this._context.PopupSettings.ResetFocus():WP.DOM.Search.getNextFocusable(this.$container.get(0)).focus()):$afe.select("#secondaryValidationGoBack").focus()},_consentSeemsPopulated:function(){var t=0,n=this._context.ConsentStrings;return null!=n&&(t+=$$WPUtil.IsNullOrEmpty(n.CallToAction)?0:n.CallToAction.length,t+=$$WPUtil.IsNullOrEmpty(n.TermsAndConditionsURL)?0:n.TermsAndConditionsURL.length,(t+=$$WPUtil.IsNullOrEmpty(n.PrivacyPolicyURL)?0:n.PrivacyPolicyURL.length)>0)},_tryPopulateConsent:function(n){getCSRFTokenAsQS($.proxy(function(){$.ajax({url:makeLink("Authentication/SecondaryValidation/GetSMSConsentStrings"),type:"GET",dataType:"json",success:$.proxy(function(t){this._context.ConsentStrings={ShowConsent:!0,CallToAction:t.CallToAction,TermsAndConditionsURL:t.TermsAndConditionsURL,PrivacyPolicyURL:t.PrivacyPolicyURL};n()},this)})},this))},_loadSecondaryAuthenticationEntry:function(){var n;this._context.TwoFactorSettings.AllowMultiple?this._context.TwoFactorSettings.HasBackButton=!0:this._context.TwoFactorSettings.AllowEmail||this._context.TwoFactorSettings.AllowSMS||$$WPUtil.IsNullOrEmpty(this._context.CallbackSettings.GoBackFromSecondaryValidation)||this._context.CallbackSettings.GoBackFromSecondaryValidation();this.$container.empty().safeAppend($afe.renderTemplate($$WP.Templates.SecondaryAuthentication.TwoFactorEntry,this._context));this._showPopup();this._reloadCallback=this._loadSecondaryAuthenticationEntry;$afe.select("#twofactorform").length>0&&(this._context.AutoSendToEmail||this._context.AutoSendToSMS)&&this._registerBeforeUnloadHandler();n=$afe.select("#two-factor-wrapper-form");$$WP.FormValidation.initializeDOMSubtree(n);this._setupDemographicAndTwoFactorViews();this._context.PopupSettings.IsPopup&&this._context.PopupSettings.ResetFocus()},_bindEvents:function(){this.$container.on("click","#resendCode",this._resendTwoFactorCode);this.$container.on("click","#twofactorsend #emailCode",this._sendTwoFactorCodeByEmail);this.$container.on("click","#twofactorsend #textCode",this._sendTwoFactorCodeByText);this.$container.on("click","#twofactorsend #totpCode",this._useTwoFactorCodeByTotp);this.$container.on("submit","#two-factor-wrapper-form",this._submitSecondaryValidationInfo);this.$container.on("click","#submitSecondaryValidation",this._submitSecondaryValidationInfo);this.$container.on("click","#learnMore",this._renderDescription);this.$container.on("click","#secondaryValidationGoBack",this._returnToPreviousScreen);this.$container.on("focus","#twofactorcode",function(){$afe.select(".Popup").safeAttr("aria-live","off");$afe.select("#update_twofactor_status_popup_container").safeAttr("aria-live","off")});this.$container.on("click","#demographicsSignOut",this._logout)},_sendTwoFactorCodeByEmail:function(n){this._context.TwoFactorSettings.SentByEmail=!0;this._context.TwoFactorSettings.SentByText=!1;this._context.TwoFactorSettings.UsedTOTP=!1;this._sendTwoFactorCodeCore(n,"deliveryMethodEmail",!1)},_sendTwoFactorCodeByText:function(n){this._context.TwoFactorSettings.SentByEmail=!1;this._context.TwoFactorSettings.SentByText=!0;this._context.TwoFactorSettings.UsedTOTP=!1;this._sendTwoFactorCodeCore(n,"deliveryMethodSMS",!1)},_useTwoFactorCodeByTotp:function(){this._context.TwoFactorSettings.SentByEmail=!1;this._context.TwoFactorSettings.SentByText=!1;this._context.TwoFactorSettings.UsedTOTP=!0;this._loadSecondaryAuthenticationEntry()},_resendTwoFactorCode:function(n){!0===this._context.TwoFactorSettings.SentByEmail?this._resendTwoFactorCodeByEmail(n):!0===this._context.TwoFactorSettings.SentByText&&this._resendTwoFactorCodeByText(n)},_resendTwoFactorCodeByEmail:function(n){this._sendTwoFactorCodeCore(n,"deliveryMethodEmail",!0)},_resendTwoFactorCodeByText:function(n){this._sendTwoFactorCodeCore(n,"deliveryMethodSMS",!0)},_sendTwoFactorCodeCore:function(t,i,r){if(!this._operationInProgress){this._operationInProgress=!0;void 0!==t&&t.preventDefault();var f,u={};u[i]=!0;u.resendCode=r;u.workflow=this._context.Workflow;$.post({url:makeLink("Authentication/SecondaryValidation/SendCode"),data:u,success:function(n){n.Success||this._handleCodeSendFailure(r,f)}.bind(this),error:function(){this._handleCodeSendFailure(r,f)}.bind(this),complete:function(){this._operationInProgress=!1}.bind(this)});r?(f=$$WPUtil.quickMessageBox(n.getString("CodeResent"),n.getString("CodeResentHeader"),[new $$WPComp.ComplexObjects.Button(n.getString("ConfirmCodeResent"),null,"otherbutton enrollmentbutton")],null,[],null,!1)).focus():this._loadSecondaryAuthenticationEntry()}},_handleCodeSendFailure:function(t,i){t&&i.hide();$$WPUtil.quickMessageBox(n.getString("CodeSendFailure"),n.getString("CodeSendFailureHeader"),[new $$WPComp.ComplexObjects.Button(n.getString("ConfirmCodeSendFailure"),null,"otherbutton enrollmentbutton")],null,[],null,!1).focus()},_handleTwoFactorMustLogout:function(){if(this._context.TwoFactorSettings.IsSelfSignupWorkflow)$$WPUtil.quickMessageBox(n.getString("SignupFailed"),n.getString("SignupFailedHeader"),[new $$WPComp.ComplexObjects.Button(n.getString("BackToLoginPage"),null,"","btnBackToLoginPage")],function(){$$WPUtil.TryRedirect(makeLink("Authentication/Login"))}).focus();else{if($$WP.Utilities.UI.IsMobile)return WP.Events.cancelBeforeUnload(),void $$WP.Utilities.TryRedirect("epichttp://logout?contactverification=1");WP.Events.cancelBeforeUnload();var t=!0===this._context.TwoFactorSettings.IsPostLogin2FA?"failedentryattempts":"failedentryattemptslocked";$$WPUtil.logoutAndShowError(t)}},_submitSecondaryValidationInfo:function(t){var i;if(t.preventDefault(),i=$afe.select("#twofactorcode").first().val(),!this._operationInProgress&&$$WP.FormValidation.checkIfFormIsValid($afe.select("#two-factor-wrapper-form"),!1)){this._operationInProgress=!0;var u=$.proxy(function(n){var u=!0,t,f,r;($afe.select("#twofactorcode").first().val(i),n.Success)?(this._context.SignupSettings&&this._context.SignupSettings.Enabled&&this._context.SignupSettings.UpdateStepCount(this._context,1),WP.Events.cancelBeforeUnload(),u=!1,this._context.TwoFactorSettings&&this._context.TwoFactorSettings.Enabled?($afe.select("#twofactorcode").safeAttr("style","background-image: url("+makeStaticImageLink("authentication/wp_two_factor_icon_animated_success.gif?"+Math.random(1e4))+");"),window.setTimeout(this._success,700)):this._success()):(t=!1,(n.MustLogout&&this._handleTwoFactorMustLogout(),n.InvalidTwoFactorCode)&&(f=($$WP.Strings.addMnemonic("@MYCHART@TWOFACODE@",i),this._context.TwoFactorSettings.UsedTOTP)?$$WP.Strings.get("IncorrectTotpTwoFactorCode"):"codeexpiredtf"===n.TwoFactorCodeFailReason?$$WP.Strings.get("ExpiredTwoFactorCode"):$$WP.Strings.get("IncorrectTwoFactorCode"),$$WP.Strings.removeMnemonic("@MYCHART@TWOFACODE@"),r=$afe.select("#twofactorcode"),$$WP.FormValidation.addValidationError(r,void 0,f),r.safeAttr("style","background-image: url("+makeStaticImageLink("authentication/wp_two_factor_icon_animated_failure.gif?"+Math.random(1e4))+");"),t=!0),n.InvalidDemographics?(null!=n.Errors?n.Errors.forEach(function(n){$$WP.FormValidation.addValidationError($afe.select(n.ErrorIndex),n.ErrorKey)}):n.IsEncodingError?this._updateEncodingErrors("SpecialCharError",n.EncodingErrors):($afe.select("#dateOfBirth").first().safeAttr("data-invalid","true"),this._updateInvalidDemographicsError("InvalidDemographicsErrorMessage")),t=!0):$afe.select("#demographics-mismatch-error").first().addClass("hidden"),t&&($$WP.FormValidation.checkIfFormIsValid($afe.select("#two-factor-wrapper-form"),!0),$("input.invalid:first").focus()));u&&window.setTimeout($.proxy(function(){this._operationInProgress=!1},this),500)},this),f=$.proxy(function(){this._operationInProgress=!1},this),r={url:makeLink("Authentication/SecondaryValidation/Validate"),data:{TwoFactorCode:i,RememberMe:!0===$afe.select("#rememberMe").first().is(":checked")?"checked":"",IsPostLogin2FA:this._context.TwoFactorSettings.IsPostLogin2FA,EnrollDeviceTrackingOnRemember:!!this._context.RememberMeSettings.Enabled&&!!this._context.RememberMeSettings.EnrollDeviceTracking,DeviceId:localStorage.getItem(getDeviceIdKey()),Workflow:this._context.Workflow,isTOTP:this._context.TwoFactorSettings.UsedTOTP},success:u,error:f,complete:function(t){200===t.status&&void 0!==t.responseJSON||$$WPUtil.quickMessageBox(n.getString("ValidationFailure"),n.getString("ValidationFailureHeader"),[new $$WPComp.ComplexObjects.Button(n.getString("ValidationFailureOKButton"),null,"otherbutton enrollmentbutton")],null,[],null,!1).focus()}};$afe.select(".demographics-entry").each(function(){r.data[this.id]=this.value});$.post(r)}},_updateInvalidDemographicsError:function(n){function i(){t.text($$WP.Strings.get(n,"secondaryvalidation"));$afe.select("#demographics-mismatch-error").first().removeClass("hidden").removeAttr("role","alert").attr("role","alert")}var t=$afe.select("#demographics-mismatch-error-text").first();this._firstDemogAttempt?(i(),this._firstDemogAttempt=!1):t.fadeOut(400,function(){i();t.fadeIn(400)});$("form:first *:input[type!=hidden]:first").focus()},_updateEncodingErrors:function(n,t){for(var r=$$WP.Strings.get(n,"secondaryvalidation"),i=0;i<t.length;i++)$$WP.FormValidation.addValidationError($afe.select("#".concat(t[i])),void 0,r)},_registerBeforeUnloadHandler:function(){$$WPUtil.SafeToRedirectOverrideSettings={TitleText:n.getString("NavigationTitle"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button(n.getString("NavigationCancel"),null,"","stay"),new $$WPComp.ComplexObjects.Button(n.getString("NavigationConfirm"),null,"inlinedelete","leave")],Html:n.getString("NavigationDetails"),IsClosable:!1};WP.Events.registerBeforeUnloadMessage(n.getString("NavigationDetails"));WP.Events.beforeUnload()},_showPopup:function(){null==this._context.PopupToShow||this._context.PopupToShow._isDisposed||($$WP.Debug.UpdateTopMarginForBanners(),this._context.PopupToShow.show(),this._context.PopupToShow.focus())},_pushAnswers:function(){window.sessionStorage.setItem("twoFactorCode",$afe.select("#twofactorcode").val())},_popAnswers:function(){var n;n=window.sessionStorage.getItem("twoFactorCode");$$WPUtil.IsNullOrEmpty(n)||($afe.select("#twofactorcode").val(n).trigger("change"),window.sessionStorage.removeItem("twoFactorCode"))},_renderDescription:function(n){n.preventDefault();this._operationInProgress||(this._pushAnswers(),null===this._descriptionController&&(this._descriptionController=new $$WP.Authentication.SecondaryValidation.Controllers.TwoFactorDescriptionController(this.$container,this._context)),this._descriptionController.render(this.reload),this._context.PopupSettings.IsPopup&&this._context.PopupSettings.ResetFocus())},_returnToPreviousScreen:function(n){n.preventDefault();this._operationInProgress||(this._context.TwoFactorSettings.UsedTOTP?this._loadTwoFactorIntro():this._showIntro&&this._reloadCallback===this._loadSecondaryAuthenticationEntry?this._showReturnDialogue(this._loadTwoFactorIntro):this._reloadCallback===this._loadSecondaryAuthenticationEntry&&null!==this._returnCallback?this._showReturnDialogue(this._executeReturnCallback):null!==this._returnCallback&&this._executeReturnCallback("toolbarBack"))},_showReturnDialogue:function(t){var i=$$WPUtil.quickMessageBox(n.getString("BackConfirmDetails"),n.getString("BackConfirmHeader"),[new $$WPComp.ComplexObjects.Button(n.getString("BackConfirmGoBackButton"),null,"primary negative enrollmentbutton","Back"),new $$WPComp.ComplexObjects.Button(n.getString("BackConfirmReturnButton"),null,"primary neutral enrollmentbutton","Cancel")],t);i.setFocus();i.focus()},_executeReturnCallback:function(n){$$WPUtil.IsNullOrEmpty(n)||(this._showPopup(),"toolbarBack"===n)?(this._context&&this._context.SignupSettings&&this._context.SignupSettings.Enabled&&this._context.SignupSettings.UpdateStepCount(this._context,-1,"SecondaryAuthenticationBack"),this._returnCallback()):$afe.select("#secondaryValidationGoBack").focus()},_success:function(){this._context&&this._context.SignupSettings&&this._context.SignupSettings.Enabled&&this._context.SignupSettings.UpdateStepCount(this._context,1,"SecondaryAuthenticationComplete");this._successCallback();this._context.PopupSettings.IsPopup&&this._context.PopupSettings.ResetFocus()},_logout:function(){window.location=makeLink("Home/Logout?skipabandoncurrent=1")},_registerPartials:function(){var n,t;if(this._context.DemographicSettings.Enabled)for(n=0;n<this._context.DemographicSettings.ConfiguredFields.length;n++)t=this._context.DemographicSettings.Partials[this._context.DemographicSettings.ConfiguredFields[n]],Handlebars.registerPartial(t,$$WP.Templates.SecondaryAuthentication.Partials[t])},_setupDemographicAndTwoFactorViews:function(){var n,i,t;(this._context.TwoFactorSettings.Enabled||$afe.select("#submitSecondaryValidation").children().first().remove(),this._context.DemographicSettings.Enabled)&&((n=$afe.select("#demographics-desc")).addClass("alignCenter"),i=this._context.DemographicSettings.IsProxyContext?$$WP.Strings.get("DemographicsSectionDescriptionProxy","secondaryvalidation").replace("@MYCHART@PATIENTDISPLAYNAME@",this._context.DemographicSettings.PatientDisplayName):n.text(),t=document.createElement("textarea"),t.innerHTML=i,n.text(t.value),(n=$afe.select("#demographics-mismatch-error")).addClass("alignCenter"),(n=$afe.select("#twoFactorHeader")).addClass("alignCenter"),(n=$afe.select("#secondaryValidationGoBack")).removeClass("inlinebutton"),n.addClass("centerBackButton"),(n=$afe.select("#content")).addClass("minHeightZero"),n.addClass("narrow2FA"),(n=$afe.select("#main")).addClass("minHeightZero"),$afe.select("title").first().text($$WP.Strings.get("DemogAuthPageTitle","secondaryvalidation")),this._context.TwoFactorSettings.Enabled&&((n=$afe.select("#code-sent-desc")).removeClass("alignStart"),n.addClass("alignCenter"),(n=$afe.select("#learnMore")).removeClass("linkbutton"),n.addClass("centerButton"),n.css("padding-bottom","1rem"),(n=$afe.select("#resendCode")).addClass("centerButton")))},_createBackToSelfSignupURL:function(){var n="Signup",t;return window.location.search.length>0&&(t=$$WPUtil.removeParamsFromQueryString("SelfSignupToken"),t.length>0&&(n=n+"?"+t)),makeLink(n)},_setPreloginTimeout:function(){this._resetTimer();document.body.addEventListener("click",$.proxy(this._resetTimer,this),!0);document.body.addEventListener("keypress",$.proxy(this._resetTimer,this),!0);document.body.addEventListener("input",$.proxy(this._resetTimer,this),!0)},_resetTimer:function(){clearTimeout(this._timer);this._timer=setTimeout($.proxy(this._popupWarning,this),6e5)},_popupWarning:function(){$$WPUtil.quickPopup(new $$WPComp.TimeoutWarningComponent({SecondsLeft:30,isPreLogin:!1}))}};$$WP.Authentication.SecondaryValidation.Controllers.SecondaryValidationController=t;t.extend($$WP.Controllers.Controller,"WP$Authentication$SecondaryValidation$Controllers$SecondaryValidationController")}();!function(){$$WP.Utilities.guaranteeExistence($$WP,"Authentication.SecondaryValidation.Controllers");var n=$$WP.Strings.getNamespace("secondaryvalidation"),t=function(n,t){this.$container=n;this._returnCallback=null;this._context=t;this.proxify("render","_return","_initializeDefaultSettings","_bindEvents");this._initializeDefaultSettings();this._bindEvents()};t.prototype={$container:null,_returnCallback:null,_context:null,render:function(n){this._context.PopupSettings.IsPopup?($afe.select("div.Popup").removeClass("small").addClass("medium"),this._context.PopupSettings.ResetFocus()):WP.DOM.Search.getNextFocusable(this.$container.get(0)).focus();$$WPUtil.IsNullOrEmpty(n)||(this._returnCallback=n);this._context.TwoFactorDescriptionSettings.IsRTL="rtl"===$afe.select("html").safeAttr("dir");this.$container.empty().safeAppend($afe.renderTemplate($$WP.Templates.SecondaryAuthentication.TwoFactorDescription,this._context));this._context.PopupSettings.IsPopup||this._renderSidebar()},_return:function(){this._context.PopupSettings.IsPopup||this._removeSidebar();$$WPUtil.IsNullOrEmpty(this._returnCallback)||this._returnCallback()},_renderSidebar:function(){new $$WP.UI.VideoViewModel("TwoFactorHowTo",null,function(n){if(n){var t,i,r=$afe.select("#content"),u=$afe.select("#main");r.addClass("hasSidebar");$("<aside id='sidebar'><\/aside>").insertAfter(u);i=[];null!==n.Url&&i.push(n);i.length>0&&((t={}).VideoCard="TwoFactorHowTo",t.Videos=i,new $$WP.UI.VideoController($afe.select("#sidebar"),t,0,1),new $$WP.UI.VideoController($afe.select("#videoFooter"),t,1,0))}})},_removeSidebar:function(){$afe.select("#sidebar").remove();$afe.select("#content").removeClass("hasSidebar")},_bindEvents:function(){this.$container.on("click","#returnButton",this._return)},_initializeDefaultSettings:function(){$$WP.Utilities.guaranteeExistence(this._context,"TwoFactorDescriptionSettings.StepOneText",n.getString("SendCodeHelptext"));$$WP.Utilities.guaranteeExistence(this._context,"TwoFactorDescriptionSettings.StepTwoText",n.getString("EnterCodeHelptext"));$$WP.Utilities.guaranteeExistence(this._context,"TwoFactorDescriptionSettings.StepThreeText",n.getString("VerifyIdentityHelptext"));$$WP.Utilities.guaranteeExistence(this._context,"PopupSettings.IsPopup",!1)}};$$WP.Authentication.SecondaryValidation.Controllers.TwoFactorDescriptionController=t;t.extend($$WP.Controllers.Controller,"WP$Authentication$SecondaryValidation$Controllers$TwoFactorDescriptionController")}();!function(){var t=$$WP.Scheduling.TelehealthOrganization,n=function(n,t,i,r){this.WP$Scheduling$StepController(n,t,null,null,null,$$WP.Templates.Scheduling.DemographicsVerification,$$WP.Templates.Scheduling.DemographicsVerification);this.proxify("__onVerifyClick","__onVerifyDemographicsSuccess","__onIsCompleteChanged","_onOrgSelected","_onTelehealthWorkflowSelected");this.$root=n;this.__isStepConfiguredToDisplay=i;this.__disableUTF8=r;this.Data.TelehealthData.addPropertyListener("SelectedWorkflow",this._onTelehealthWorkflowSelected);this.Data.TelehealthData.addPropertyListener("IsOrgSelectionComplete",this._onOrgSelected)};n.prototype={$root:null,$demographicVerificationContainer:null,__demographicVerificationController:null,__isStepConfiguredToDisplay:!1,__isVerified:!1,__disableUTF8:!1,updateViewModel:function(){var n=this.Data.SchedulingSteps.getFromIndex("ID",this.Id).isComplete===$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete;this.ViewModel={Count:0,StepShouldBeActive:!1,Incomplete:!n,IsProxy:this.Data.IsProxy,ProxyContextName:this.Data.ProxyContextName};this.__isStepConfiguredToDisplay?(this.ViewModel={Count:0,ShowOtherInformation:!0,StepShouldBeActive:!0,StepControllerId:this.Id,Incomplete:!n,ReservationBlurbViewModel:{IsSlotReserved:!!this.Data.AppointmentBuilder.getAppointment(0).Slot&&!!this.Data.AppointmentBuilder.getAppointment(0).Slot.ReservationKey},IsProxy:this.Data.IsProxy,ProxyContextName:this.Data.ProxyContextName},this.SchedulingStringsNamespace.addMnemonics({"@MYCHART@RESERVATIONEXPIRATIONTIME@":{Value:this.Data.AppointmentBuilder.getAppointment(0).Slot?this.Data.AppointmentBuilder.getAppointment(0).Slot.ReservationExpirationTimeString:null,EncodingType:$$WP.Strings.EncodingTypes.HTML}})):this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)},afterRender:function(){var n;n=this.$root.find(".demographicsVerificationContent");this.__demographicVerificationController=new $$WP.PersonalInformation.DemographicVerificationController(n,this.__onIsCompleteChanged,this.__disableUTF8);this.__disableVerifyButton();this.getContinueButton(this.$root).on("click",this.__onVerifyClick);this.$root.find("h2.header, .schedulingStepBanners .standardBanner").first().focus();$afe.select(".verifyButtons").addClass("stickybanner");$$WPSchedulingUtil.HandleStickyBanner();this.__isVerified=!1},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.DemographicVerificationStep},__onIsCompleteChanged:function(n){n?(this.__enableVerifyButton(),$$WPSchedulingUtil.HandleStickyBanner()):this.__disableVerifyButton()},__enableVerifyButton:function(){this.getContinueButton(this.$root).removeClass("hidden")},__disableVerifyButton:function(){this.getContinueButton(this.$root).addClass("hidden")},getContinueButton:function(n){return n.find("[data-id='demographicsVerifyButton']")},__onVerifyClick:function(){this.__demographicVerificationController.MarkDemographicsAsVerified(this.__onVerifyDemographicsSuccess)},__onVerifyDemographicsSuccess:function(){this.__isVerified||(this.__isVerified=!0,this.__disableVerifyButton(),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete),this.Data.AppointmentBuilder.setProperty("CompletedDemographicVerificationStep",!0))},_onOrgSelected:function(){var n=this.Data.TelehealthOrganizations.getFirstInIndex("State",t.StatesEnum.Selected),i=this.Data.TelehealthData.SelectedWorkflow;null===n||i!==$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing||n.IsLocal?this.__isStepConfiguredToDisplay=!0:(this.__isStepConfiguredToDisplay=!1,this.Data.AppointmentBuilder.setProperty("CompletedDemographicVerificationStep",!1));this.updateStep()},_onTelehealthWorkflowSelected:function(){var n=this.Data.TelehealthData.SelectedWorkflow;null!==n&&(n!==$$WP.Scheduling.TelehealthData.TelehealthWorkflow.QuickSchedule&&n!==$$WP.Scheduling.TelehealthData.TelehealthWorkflow.SlotSelection||(this.__isStepConfiguredToDisplay=!0,this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)),this.updateStep())}};$$WP.Scheduling.DemographicVerificationStepController=n;n.extend($$WP.Scheduling.StepController,"WP$Scheduling$DemographicVerificationStepController")}();!function(){var n=$$WP.Scheduling.Workflow,t=function(n,t,i,r,u,f){this.WP$Scheduling$StepController(n,i,null,null,null,$$WP.Templates.Scheduling.PersonalInfoCollectionStep);this.$root=n;this._workflow=t;this._stopSchedulingCallback=r;this._workflowEventCallbacks=u;this._workflowSettings=f;this.proxify("updateViewModel","afterRender","__onCollectPersonalInfoSuccess","__onCollectPersonalInfoFailure")};t.prototype={$root:null,PersonalInformationController:null,_stopSchedulingCallback:null,updateViewModel:function(){var t=this.Data.SchedulingSteps.getFromIndex("ID",this.Id).isComplete===$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete,n=!!this.Data.AppointmentBuilder.getAppointment(0).Slot&&this.Data.AppointmentBuilder.getAppointment(0).Slot.ReservationKey;this.ViewModel={Count:0,ShowOtherInformation:!0,StepShouldBeActive:!0,StepControllerId:this.Id,Incomplete:!t,ReservationBlurbViewModel:{IsSlotReserved:n}};n&&this.SchedulingStringsNamespace.addMnemonics({"@MYCHART@RESERVATIONEXPIRATIONTIME@":{Value:this.Data.AppointmentBuilder.getAppointment(0).Slot.ReservationExpirationTimeString,EncodingType:$$WP.Strings.EncodingTypes.HTML}})},setSchedulingCallbacks:function(n,t,i){this._loginCallback=n;this.schedule=t;this.reconSchedule=i},beforeFirstRender:function(){var t,i=void 0;!this._workflow.SchedulingControllerParams.IsPromoted&&this._workflow.SchedulingControllerParams.HasDOB&&(i=this._loginCallback);this._workflow.Type===n.WorkflowTypesEnum.DecisionTreeNode&&this._workflow.SchedulingDataPool.VisitTypes.Models&&(t=this._workflow.SchedulingDataPool.VisitTypes.Models);this.PersonalInformationController=new $$WP.ShopperPatient.Controllers.PersonalInformationController(this.$root,this.__onCollectPersonalInfoSuccess,this.__onCollectPersonalInfoFailure,this._workflow.SchedulingControllerParams.demographicCollectionElementID,this.Data.AppointmentBuilder.IsPersonalInfoCollectionComplete,null,this._workflowSettings.WorkflowType!==n.WorkflowTypesEnum.OnDemandTelehealth?$$WP.Strings.get("ScheduleButtonLabel","SignupDemographicForm"):void 0,t,void 0,void 0,void 0,this._workflowEventCallbacks.onPromoted,i,this._workflowEventCallbacks.onRecordMatched)},afterRender:function(){this.PersonalInformationController.render();this.getContinueButton(this.$root).on("click",this.__onContinueClick);this.$root.find("h2.header, .schedulingStepBanners .standardBanner").first().focus()},__onCollectPersonalInfoSuccess:function(t,i,r,u){this.Data.AppointmentBuilder.setProperty("IsPersonalInfoCollectionComplete",t);this.Data.AppointmentBuilder.setProperty("HasMatchingRecord",r);this.Data.AppointmentBuilder.setProperty("IsInsuranceCollectionComplete",i);this.Data.AppointmentBuilder.setProperty("IsPromoted",this.Data.AppointmentBuilder.IsPromoted||u);this._workflow.Type!==n.WorkflowTypesEnum.OnDemandTelehealth&&(r?this.reconSchedule():this.schedule(),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete))},__onCollectPersonalInfoFailure:function(n,t,i){this.Data.AppointmentBuilder.setProperty("IsPersonalInfoCollectionComplete",n);this.Data.AppointmentBuilder.setProperty("HasMatchingRecord",i);this.Data.AppointmentBuilder.setProperty("IsInsuranceCollectionComplete",t);this._stopSchedulingCallback()}};$$WP.Scheduling.PersonalInfoCollectionStepController=t;t.extend($$WP.Scheduling.StepController,"WP$Scheduling$PersonalInfoCollectionStepController")}();!function(){var n=$$WP.Scheduling.Workflow,t=function(n,t,i){this.WP$Controllers$Controller();this.proxify("_update");this._linksSidebarWidget=n;this._workflow=t;this._workflowSettings=i;this._update()};t.prototype={_linksSidebarWidget:null,_workflow:null,_workflowSettings:null,_update:function(){var n;(this._linksSidebarWidget&&this._linksSidebarWidget.update(this._getLinksViewModel()),n=$afe.select("#HowToVideoContainer"),!$$WP.Utilities.IsMobile&&n.length>0)&&new $$WP.UI.VideoViewModel("VideoVisitHowTo",null,function(t){var i,r;i=[];null!==t.Url&&i.push(t);i.length>0&&((r={}).VideoCard="TalkToADoctor",r.Videos=i,new $$WP.UI.VideoController(n,r))})},_getLinksViewModel:function(){var t;return(t={}).NumLinks=0,t.HasVideo=!1,this._workflowSettings.ShowSidebarLinks&&(this._workflow?(this._workflow.Type===n.WorkflowTypesEnum.OnDemandTelehealth&&(t.HasVideo=!0),this._workflow.Type!==n.WorkflowTypesEnum.Reschedule&&this._workflow.Type!==n.WorkflowTypesEnum.OnDemandTelehealth&&this._workflowSettings.ShowVideoVisitSidebar&&(t.VideoVisitQuickLink=makeLink("Scheduling/OnDemandTelehealth"),t.NumLinks++),this._workflow.Type!==n.WorkflowTypesEnum.Reschedule&&this._workflowSettings.ShowEVisitSidebar&&(t.EVisitQuickLink=makeLink("inside.asp?mode=evisit"),t.NumLinks++),this._workflow.Type!==n.WorkflowTypesEnum.Reschedule&&this._workflowSettings.AllowOnMyWay&&(t.OnMyWayLink=makeLink("Scheduling/OnMyWay/PostLogin"),t.NumLinks++),this._workflow.ShowSchedulingHubLink&&(t.HubLink=makeLink("Scheduling"),t.NumLinks++)):(this._workflowSettings.ShowVideoVisitSidebar&&(t.VideoVisitQuickLink=makeLink("Scheduling/OnDemandTelehealth"),t.NumLinks++),this._workflowSettings.ShowEVisitSidebar&&(t.EVisitQuickLink=makeLink("inside.asp?mode=evisit"),t.NumLinks++),this._workflowSettings.AllowOnMyWay&&(t.OnMyWayLink=makeLink("Scheduling/OnMyWay/PostLogin"),t.NumLinks++))),t.EVisitQuickLink&&($$WP.Strings.containsGlobalMnemonic("BrandEVisit")?(t.EVisitQuickLinkString=$$WP.Strings.get("SidebarEVisitLink","Scheduling"),t.EVisitQuickLinkTooltip=$$WP.Strings.get("SidebarEVisitButtonToolTip","Scheduling")):(t.EVisitQuickLinkString=$$WP.Strings.get("SidebarEVisitLinkNoMnemonic","Scheduling"),t.EVisitQuickLinkTooltip=$$WP.Strings.get("SidebarEVisitButtonToolTipNoMnemonic","Scheduling"))),t.VideoVisitQuickLink&&(t.VideoVisitQuickLinkString=$$WP.Strings.containsGlobalMnemonic("BrandVideoVisits")?$$WP.Strings.get("SidebarVideoVisitLink","Scheduling"):$$WP.Strings.get("SidebarVideoVisitLinkNoMnemonic","Scheduling")),t}};$$WP.Scheduling.SidebarController=t;t.extend($$WP.Controllers.Controller,"WP$Scheduling$SidebarController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var r=$$WP.Common.Model,t=$$WP.Scheduling.Workflow,f={LandingPage:"LandingPage"},n={Workflow:"workflow",Provider:"provider",ReasonForVisit:"rfv",Slot:"slot",Specialty:"specialty"},u=function(n,t,i,r,u){var o,s,e;this.WP$Scheduling$StepController(n,null,i.AllowedSpecialtyIds,null,null,$$WP.Templates.Scheduling.LandingPage);this.proxify("updateStep","_onWorkflowElementClick","_onRemoveFavoriteButtonClicked","_onRemoveFavoriteButtonKeyPress","_onRemoveFavoritePopupButtonClicked","_onSpecialtyLoadSuccess","_onDeclineTicketButtonClicked","_onSelectRfv","_onSelectNewProviderRfv","_onSelectProviderFinder","_onSelectProvider","_onSelectRecentProviders","_onSelectTicket","_onSelectFavorite","_onSelectSpecialtyGrouper","_onRemoveFavorite","_onDeclineTicket","_onSelectNewProvider","__onSelectUpdateTicketWaitListPreferences");this._workflows=t;this._workflowSettings=i;this.__banners=i.Banners;this._isMobile=$$WP.Utilities.UI.IsMobile;this._isGuest=r;this._preselectedTicketId=i.TicketId;this.__workflowEventCallbacks=u;this._providerWorkflow=this._workflows.getFromIndex("Id","ExistingProvider");this._newProviderWorkflow=this._workflows.getFromIndex("Id","NewProvider");this._reasonWorkflow=this._workflows.getFromIndex("Id","Procedure");this.__promotedSpecialtyIds=i.PromotedSpecialtyIds;this.__allowedSpecialtyIDs=i.AllowedSpecialtyIds;this.__specialtyStepSettings=i.SpecialtyStepSettings;this.__allowMobileSchedulingInlineRedirects=i.AllowMobileSchedulingInlineRedirects;this.$root.on("click","[data-type]",this._onWorkflowElementClick);this._workflows.addCollectionEventListener("remove",this.updateStep);this.$root.on("click",".card.favorite .removeButton",this._onRemoveFavoriteButtonClicked);this.$root.on("keypress",".card.favorite .removeButton",this._onRemoveFavoriteButtonKeyPress);this.$root.on("click",".card.ticket [data-id='declineTicket']",this._onDeclineTicketButtonClicked);o="";s="";for(o in f)s=f[o],this._reactSubcomponents[s]={};e=document.getElementsByClassName("previousstep")[0];!$$WP.Utilities.UI.IsLoggedIn||$$WP.Utilities.UI.IsWorkflowRestricted||this._isGuest||e&&e.classList.remove("hidden");this._isGuest&&e.remove()};u.prototype={_updateReactSubcomponents:function(){var n={dataPool:this._getKeyValueDataStore(),handlers:this._getReactHandlers()};this._reactSubcomponents[f.LandingPage].props=n},_getReactHandlers:function(){return this._reactHandlers||(this._reactHandlers={},this._reactHandlers.onSelectRfv=this._onSelectRfv,this._reactHandlers.onSelectProvider=this._onSelectProvider,this._reactHandlers.onSelectRecentProviders=this._onSelectRecentProviders,this._reactHandlers.onSelectTicket=this._onSelectTicket,this._reactHandlers.onSelectFavorite=this._onSelectFavorite,this._reactHandlers.onRemoveFavorite=this._onRemoveFavorite,this._reactHandlers.onDeclineTicket=this._onDeclineTicket,this._reactHandlers.onSelectNewProvider=this._onSelectNewProvider,this._reactHandlers.onSelectSpecialtyGrouper=this._onSelectSpecialtyGrouper,this._reactHandlers.onSelectNewProviderRfv=this._onSelectNewProviderRfv,this._reactHandlers.onSelectProviderFinder=this._onSelectProviderFinder,this._reactHandlers.onSelectUpdateTicketWaitListPreferences=this.__onSelectUpdateTicketWaitListPreferences,this._reactHandlers.onTicketWaitListPreferencesUpdatedJSCallback=this.__workflowEventCallbacks.onTicketWaitListPreferencesUpdated),this._reactHandlers},__onSelectUpdateTicketWaitListPreferences:function(n,t){var r={type:$$WP.Scheduling.SchedulingStep.StepTypeEnum.JoinWaitList},i=this._getWorkflowForTicket(n),u={onTicketWaitListPreferencesUpdated:t};new $$WP.Scheduling.AdHocStepWorkflowController(r,"-1",i.SchedulingDataPool,i,this._workflowSettings,u).renderInPopup(this.SchedulingStringsNamespace.getString("EditAppointmentPreferencesLabel"))},_getKeyValueDataStore:function(){var n=this._workflows.getFromIndex("Id","React").SchedulingDataPool;return store={favoriteAppointments:this.__getFavoriteAppointmentKeyValueDataStore(),providerDepartmentPairs:n.ProviderDepartmentPairs.getKeyValueFormat("Id"),providers:n.Providers.getKeyValueFormat("ID"),reasonsForVisit:this.__getReasonForVisitKeyValueDataStore(),schedulingMenus:n.SchedulingMenus.getKeyValueFormat("ID"),schedulingMenuReasonForVisits:n.SchedulingMenuReasonsForVisit.getKeyValueFormat("Id"),specialties:n.Specialties.getKeyValueFormat("Id"),tickets:this.__getTicketKeyValueDataStore(),orderMap:n.OrderMap,visitTypes:n.VisitTypes.getKeyValueFormat("ID"),canSelectOtherRfv:n.ShowOtherRfvOption,canFindNewProvider:n.ShowNewProviderWorkflow,canShowProviderFinderDefaultLink:n.ShowProviderFinderDefaultLink,banners:this.__banners,preselectedTicketStatus:n.PreselectedTicketStatus,hideBackNavigation:n.HideBackNavigation},this.__lowercaseStore(store),store},__lowercaseStore:function(n){for(var u={},i=Object.keys(n),r=null,t=0;t<i.length;t++)"object"==typeof(r=n[i[t]])&&(n[i[t]]=this.__getLowercaseCollectionCopy(r,u))},__getLowercaseCollectionCopy:function(n,t){for(var u=null,f=[],r=Object.keys(n),i=0;i<r.length;i++)"object"==typeof(u=n[r[i]])?(newObject=this.__lowercaseObject(u,t),f[r[i]]=newObject):f[r[i]]=u;return f},__lowercaseObject:function(n,t){for(var i=null,u=Object.keys(n),f={},r=0;r<u.length;r++)i=u[r],f[this.__lowercaseProperty(i,t)]=this.__isObjectObjectProperty(i)?this.__lowercaseObject(n[i],t):this.__isObjectArrayProperty(i)?this.__lowercaseObjectArray(n[i],t):n[i];return f},__isObjectObjectProperty:function(n){return"ReasonForVisit"===n},__isObjectArrayProperty:function(n){switch(n){case"Specialties":case"ApptComponents":case"RawApptComponents":return!0;default:return!1}},__lowercaseObjectArray:function(n,t){var r=[],i;if(null==n)return[];for(i=0;i<n.length;i++)r[i]=this.__lowercaseObject(n[i],t);return r},__lowercaseProperty:function(n,t){var i=t[n];return i||(i="ID"===n?"id":n.slice(0,1).toLowerCase()+n.slice(1),t[n]=i),i},__getReasonForVisitKeyValueDataStore:function(){var n=this._workflows.getFromIndex("Id","React").SchedulingDataPool.ReasonsForVisit.getKeyValueFormat("Id");return this.__filterUnavailableRfvs(n),this.__appendTicketRfvs(n,this._workflows),this.__appendBundledRfvs(n),n},__filterUnavailableRfvs:function(n){for(var t="",r=Object.keys(n),i=0;i<r.length;i++)t=r[i],$$WP.Scheduling.Workflow.shouldIncludeReasonForVisit(n[t],!0,!0)||delete n[t]},__appendTicketRfvs:function(n,t){for(var i=null,u=null,r=0;r<t.Models.length;r++)null!==(i=t.Models[r]).TicketInfo&&null!==i.TicketInfo.ReasonForVisit&&(n[(u=i.TicketInfo.ReasonForVisit).Id]=u)},__appendBundledRfvs:function(n){var r=null,f=null,u=[],t,i;for(key in n)u.push(n[key]);for(t=0;t<u.length;t++)if((r=u[t]).ApptComponents)for(i=0;i<r.ApptComponents.length;i++)n[(f=r.ApptComponents[i]).Id]=f},__getFavoriteAppointmentKeyValueDataStore:function(){var n,t={},r=this._workflows.getFromIndex("IsFavorite",!0);for(i=0;i<r.length;i++)(n=r[i].FavoriteAppointmentInfo).Title=this.__getFavoriteWorkflowTitle(n.ReasonForVisitTitle,n.ProviderName,n.HideProviderName),n.Id=n.Csn,t[n.Csn]=n;return t},__getTicketKeyValueDataStore:function(){for(var t,i={},n=0;n<this._workflows.Models.length;n++)t=this._workflows.Models[n],$.extend(i,t.getTicketKeyValueStore());return i},_reactHandlers:null,$root:null,_workflows:null,_workflowSettings:null,_providerWorkflow:null,_newProviderWorkflow:null,_reasonWorkflow:null,__banners:null,__promotedSpecialtyIds:null,_isMobile:!1,_isFirstRender:!0,_preselectedTicketId:!0,__workflowEventCallbacks:null,_loadOneClickSlots:function(){var n,r,i;if((n=this._workflows.getFromIndex("Type",t.WorkflowTypesEnum.Ticket))&&0!==n.length)for(i=0;i<n.length;i++)(r=n[i]).SchedulingDataPool.SlotLoader.loadOneClickTicketSlots(r.TicketInfo.TicketId,this.updateStep)},updateViewModel:function(){this.ViewModel={Workflows:null,Count:0,StepShouldBeActive:!0,HasDirectOptions:!1,Providers:null,ReasonsForVisit:null,CardColumns:null,SideBySide:!1,HasTickets:!1,TicketWorkflows:null,HasFavorites:!1,FavoriteAppointmentWorkflows:null,HasTicketsOrFavorites:!1,ShouldShowProviderWorkflow:!1,ShouldShowReasonForVisitWorkflow:!1,ShouldShowNewProviderWorkflow:!1,ShouldFadeIn:!1,DataTypes:null,HasPreselectedTicket:!$$WPUtil.IsNullOrEmpty(this._preselectedTicketId),PreselectedTicketWorkflow:null};var n=$afe.select("body").hasClass("isPrelogin");this.ViewModel.IsPrelogin=n;this.ViewModel.ShouldFadeIn=this._isFirstRender;this.ViewModel.Banners=this.__banners;n?this.__updateOpenSchedViewModel():this.__updateDirectSchedViewModel()},__updateOpenSchedViewModel:function(){this.__updateNewProviderWorkflowViewModel();this.__setCount();this.ViewModel.ShowOpenSchedulingHeader=!0},__updateDirectSchedViewModel:function(){this.__updateProvidersWorkflowViewModel();this.__updateNewProviderWorkflowViewModel();this.__updateReasonsForVisitWorkflowViewModel();this.ViewModel.ShouldShowNewProviderWorkflow&&!this.ViewModel.ShouldShowProviderWorkflow&&(this.ViewModel.ShouldShowProviderWorkflow=!0);(this.ViewModel.ShouldShowProviderWorkflow||this.ViewModel.ShouldShowReasonForVisitWorkflow)&&(this.ViewModel.HasDirectOptions=!0,this.__updateFavoriteAppointmentWorkflowsViewModel());this.__updateTicketWorkflowsViewModel();this.ViewModel.HasTicketsOrFavorites=this.ViewModel.HasTickets||this.ViewModel.HasFavorites;this.ViewModel.DataTypes=n;this.__setCount();this.__updateCardDisplay()},__updateProvidersWorkflowViewModel:function(){var n=[];this._providerWorkflow&&(n=this._buildProviderArray(),this.ViewModel.Providers=n,n.length>0&&(this.ViewModel.ShouldShowProviderWorkflow=!0),this.ViewModel.ProvidersWorkflow=this._providerWorkflow)},__updateReasonsForVisitWorkflowViewModel:function(){var n=[];this._reasonWorkflow&&(n=this._getUnfilteredReasonsForVisit(),this.ViewModel.ReasonsForVisit=n,n.length>0&&(this.ViewModel.ShouldShowReasonForVisitWorkflow=!0),this.ViewModel.ReasonsForVisitWorkflow=this._reasonWorkflow)},__updateNewProviderWorkflowViewModel:function(){var n,i,t=!1,r=!1,u=this.ViewModel.IsPrelogin;void 0!==this._newProviderWorkflow&&null!==this._newProviderWorkflow&&(this.ViewModel.NewProviderWorkflow=this._newProviderWorkflow,n=this.ViewModel.NewProviderWorkflow.SchedulingDataPool,this.ViewModel.NewProviderWorkflow&&(t=n.Specialties.Models.length>0,r=n.ShowNewProviderWorkflow,this.ViewModel.ShouldShowNewProviderWorkflow=t&&r,t&&(i=this.filterByAllowedIds(n.Specialties.toArray(),"Id"),$$WPSchedulingSpecialtiesCore.SetSpecialtiesViewModel(this.ViewModel,i,this.__promotedSpecialtyIds,u))))},__updateCardDisplay:function(){var n=this.ViewModel.ShouldShowProviderWorkflow,t=this.ViewModel.ShouldShowReasonForVisitWorkflow;n&&t&&!isDataTile()?(this.ViewModel.CardColumns=6,this.ViewModel.SideBySide=!0):n&&t&&isDataTile()?(this.ViewModel.CardColumns=12,this.ViewModel.SideBySide=!0):(this.ViewModel.CardColumns=4,this.ViewModel.SideBySide=!1)},__updateTicketWorkflowsViewModel:function(){var i,n,r,u;if((i=this._workflows.getFromIndex("Type",t.WorkflowTypesEnum.Ticket))&&0!==i.length){for(this.ViewModel.HasTickets=!0,r=0;r<i.length;r++)(n=i[r]).TicketInfo.BundleId&&(n.TicketInfo.GroupOrdersIntoVisits=!0),n.IsPreselectedTicket&&(u=n),n.ExpireDateString=n.getTicketExpireDateString(),n.AvailableDateString=n.getTicketAvailableDateString(),this.__organizeOrders(n.TicketInfo),this._buildOneClickSlots(n);(i=i.filter(function(n){return n!==u})).sort(this.__sortTickets);this.ViewModel.TicketWorkflows=i;this.ViewModel.PreselectedTicketWorkflow=u}},__setCount:function(){this.ViewModel.HasTickets&&this.ViewModel.Count++;this.ViewModel.HasFavorites&&this.ViewModel.Count++;this.ViewModel.ShouldShowProviderWorkflow&&this.ViewModel.Count++;this.ViewModel.ShouldShowReasonForVisitWorkflow&&this.ViewModel.Count++;this.ViewModel.ShouldShowNewProviderWorkflow&&!this.ViewModel.ShouldShowProviderWorkflow&&this.ViewModel.Count++},__sortTickets:function(n,t){return n.IsCurrentlyAvailable&&!t.IsCurrentlyAvailable?-1:!n.IsCurrentlyAvailable&&t.IsCurrentlyAvailable?1:0},__updateFavoriteAppointmentWorkflowsViewModel:function(){var n,r,t,i;if((n=this._workflows.getFromIndex("IsFavorite",!0))&&0!==n.length)for(this.ViewModel.HasFavorites=!0,this.ViewModel.FavoriteAppointmentWorkflows=n,i=0;i<n.length;i++)t=(r=n[i]).FavoriteAppointmentInfo,r.Title=this.__getFavoriteWorkflowTitle(t.ReasonForVisitTitle,t.ProviderName,t.HideProviderName)},__getFavoriteWorkflowTitle:function(n,t,i){if($$WPUtil.IsNullOrEmpty(t)||i)return n;this.SchedulingStringsNamespace.addMnemonics({"@MYCHART@REASONFORVISIT@":{Value:n,EncodingType:$$WP.Strings.EncodingTypes.None},"@MYCHART@PROVIDER@":{Value:t,EncodingType:$$WP.Strings.EncodingTypes.None}});var r=this.SchedulingStringsNamespace.getString("WorkflowProviderRfvTitle");return this.SchedulingStringsNamespace.clearMnemonics(),r},beforeRender:function(){this.__hasOnlyOneSpecialty()&&this.__selectOnlySpecialtyAndAdvance()},__hasOnlyOneSpecialty:function(){return!!this.__allowedSpecialtyIDs&&1==this.__allowedSpecialtyIDs.length},__selectOnlySpecialtyAndAdvance:function(){var n=this.ViewModel.NewProviderWorkflow,t=this.__getOnlyPreselectedSpecialty();t&&(n.SchedulingDataPool.AppointmentBuilder.setProperty("Specialty",t),$$WPSchedulingUtil.ShowWorkflowLoadingIndicator(),$$WPSchedulingSpecialtiesCore.LoadSpecialtyData(n,n.SchedulingDataPool.AppointmentBuilder.Specialty.Id,this._onSpecialtyLoadSuccess(n,null)),this._onAdvancePastLandingPage())},afterRender:function(){this._isFirstRender=!1;this.ViewModel.IsPrelogin&&this.ViewModel.ShouldShowNewProviderWorkflow&&($$WPSchedulingSpecialtiesCore.SetUpPretext("centered"),this.$root.find(".landingPage, .LandingPageReact").toggleClass("hidden"),$(document).find(".title:has(h1)").toggleClass("hidden"));this.ViewModel.ShowOpenSchedulingHeader&&this.__setUpPretext();$afe.select(".cardlist.matchHeights").each($$WP.Utilities.UI.Cards.MatchHeights);this.__setInitialFocus()},__getOnlyPreselectedSpecialty:function(){return this._newProviderWorkflow.SchedulingDataPool.Specialties.getFromIndex("Id",this.__allowedSpecialtyIDs[0])},__setInitialFocus:function(){$afe.select("#announcementBanner").hasClass("jqHidden")?this.$root.find("h2.header, h4.header").first().focus():$afe.select("#announcementBanner").focus()},__setUpPretext:function(){var t=$afe.select(".schedulingPretext"),n=$$WP.Strings.get("OpenSchedulingPretext","Scheduling"),i=$$WP.Strings.get("OpenSchedulingPretextExpanded","Scheduling");$$WPUtil.IsNullOrEmpty(n)||new $$WP.UI.ProgressiveDisclosureController(t,n,i,null,"centered")},_getViewEventSubmodule:function(){return $$WP.Analytics.ViewEvent.SubmodulesEnum.LandingPage},_onWorkflowElementClick:function(t){var o,s,u,h,i,c,l,f,a,e;switch(t.preventDefault(),h=$afe.jq(t.target).closest("[data-workflow-model-id]").safeAttr("data-workflow-model-id"),e=(i=r.getInstance(h)).SchedulingDataPool.AppointmentBuilder.getAppointment(0),o=$afe.jq(t.target).closest("[data-type]").safeAttr("data-type"),s=$afe.jq(t.target).closest("[data-type]").safeAttr("data-model-id"),u=r.getInstance(s),o){case n.Workflow:i.IsTicket&&this._onSelectTicket(i.TicketInfo.AppointmentRequests[0].ID);i.IsFavorite&&this._onSelectFavorite(i.Id);i.Type==$$WP.Scheduling.Workflow.WorkflowTypesEnum.NewProvider&&this._onSelectNewProvider();break;case n.Slot:f=u;c=i.SchedulingDataPool.Providers.getFromIndex("ID",f.ProviderId);l=this._getLocationForSlot(f,i);i.setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);e.Providers.add(c);e.Locations.add(l);e.setProperty("Slot",f);break;case n.Provider:this._onSelectProvider(u.ID);break;case n.ReasonForVisit:this._onSelectRfv(u.Id);break;case n.Specialty:a=u;i.SchedulingDataPool.AppointmentBuilder.setProperty("Specialty",a);$$WPSchedulingUtil.ShowWorkflowLoadingIndicator();$$WPSchedulingSpecialtiesCore.LoadSpecialtyData(i,i.SchedulingDataPool.AppointmentBuilder.Specialty.Id,this._onSpecialtyLoadSuccess(i))}this._onAdvancePastLandingPage()},_onSelectRfv:function(n,t){var i=this._workflows.getFromIndex("Type",$$WP.Scheduling.Workflow.WorkflowTypesEnum.Procedure)[0],r=i.SchedulingDataPool.ReasonsForVisit.getFromIndex("Id",n);r.DefaultVisitType.isVisitTypeMyChartLink()?(i.SchedulingDataPool.AppointmentBuilder.setProperty("ReasonForVisit",r),$$WPSchedulingUtil.OnMyChartLinkClicked(i,i.SchedulingDataPool,r.DefaultVisitType.MenuLinkCompleteUri,r.DefaultVisitType.DataAttributes)):(i.setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected),i.SchedulingDataPool.AppointmentBuilder.setProperty("ReasonForVisit",r),i.SchedulingDataPool.AppointmentBuilder.setProperty("SchedGrouperIds",t));this._onAdvancePastLandingPage()},_onSelectProviderFinder:function(){this._isMobile&&!this.__allowMobileSchedulingInlineRedirects?$$WPUtil.TryRedirect(makeLink("epichttp://app/providers/search")):$$WP.Utilities.TryRedirect(makeLink("app/providers/search"))},_onSelectNewProviderRfv:function(n,t){var i=this._workflows.getFromIndex("Type",$$WP.Scheduling.Workflow.WorkflowTypesEnum.NewProvider)[0],r=i.SchedulingDataPool.ReasonsForVisit.getFromIndex("Id",n),u=i.SchedulingDataPool.Specialties.getFromIndex("Id",r.SpecialtyGroupId);i.setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);i.SchedulingDataPool.AppointmentBuilder.setProperty("Specialty",u);i.SchedulingDataPool.AppointmentBuilder.setProperty("ReasonForVisit",r);i.SchedulingDataPool.AppointmentBuilder.setProperty("SchedGrouperIds",t);this._onAdvancePastLandingPage()},_onSelectProvider:function(n){var t,i,r;i=(t=this._workflows.getFromIndex("Type",$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider)[0]).SchedulingDataPool.Providers.getFromIndex("ID",n);r=t.SchedulingDataPool.AppointmentBuilder.getAppointment(0);t.setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);r.Providers.add(i);this._onAdvancePastLandingPage()},_onSelectRecentProviders:function(){this._workflows.getFromIndex("Type",$$WP.Scheduling.Workflow.WorkflowTypesEnum.ExistingProvider)[0].setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);this._onAdvancePastLandingPage()},_onSelectTicket:function(n){this._getWorkflowForTicket(n).setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);this._onAdvancePastLandingPage()},_onSelectFavorite:function(n){this._workflows.getFromIndex("Id",n).setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);this._onAdvancePastLandingPage()},_onSelectNewProvider:function(){this._workflows.getFromIndex("Type",$$WP.Scheduling.Workflow.WorkflowTypesEnum.NewProvider)[0].setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);this._onAdvancePastLandingPage()},_onSelectSpecialtyGrouper:function(n,t){var u=this._newProviderWorkflow,f=u.SchedulingDataPool.ReasonsForVisit.Models,i=this._getUnloadedSpecialtyIds(n),e=0,o=function(n,r){$$WPSchedulingSpecialtiesCore.UpdateDataPoolSpecialties(u.SchedulingDataPool,r,n);(e+=1)===i.length&&t(this.__getLowercaseCollectionCopy(f,{}))},r;if(0!==i.length)for(r=0;r<i.length;r++)$$WPSchedulingSpecialtiesCore.LoadSpecialtyData(u,i[r],o.bind(this,i[r]))},_getUnloadedSpecialtyIds:function(n){for(var r,i=[],t=0;t<n.length;t++)r=this._newProviderWorkflow.SchedulingDataPool.Specialties.getFromIndex("Id",n[t]),r&&r.IsDataLoaded||i.push(n[t]);return i},_onRemoveFavorite:function(n){var t=this._workflows.getFromIndex("Id",n);this._removeFavoriteFromDatabase(n);this._workflows.remove(t)},_onAdvancePastLandingPage:function(){$afe.select("#announcementBanner").addClass("hidden");$$WPSchedulingUtil.HideBackButton()},_getWorkflowForTicket:function(n){for(var u,t,r,i=0;i<this._workflows.Models.length;i++)if((t=this._workflows.Models[i]).IsTicket){if(n===t.TicketInfo.TicketId)return t;for(u=t.TicketInfo.AppointmentRequests,r=0;r<u.length;r++)if(u[r].ID===n)return t}return null},_onSpecialtyLoadSuccess:function(n){return function(t){$$WPSchedulingSpecialtiesCore.UpdateDataPoolSpecialties(n.SchedulingDataPool,t,n.SchedulingDataPool.AppointmentBuilder.Specialty.Id);n.setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);$$WPSchedulingUtil.HideWorkflowLoadingIndicator()}},_getLocationForSlot:function(n,t){for(var u,r=t.SchedulingDataPool.Locations.toArray(),i=0;i<r.length;i++)if(-1!==(u=r[i]).DepartmentIds.indexOf(n.DepartmentId)&&!u.IsSingleDepartment)return u},__organizeOrders:function(n){var t,i,r=this.SchedulingStringsNamespace;n.OrderingProviderString="";n.HasMultipleOrders=!1;t=this.__getTicketOrderList(n);(i=this.__getTicketLinkedOrders(n)).length>0?(this.__organizeOrderList(n,i,t,r),1===i.length&&(n.OrderDisplayName=i[0].DisplayName)):Array.isArray(t)&&this.__organizeOrderList(n,t,t,r);r.clearMnemonics()},__organizeOrderList:function(n,t,i,r){n.BundleId?(n.OrderGroups=this.__buildBundleOrderGroup(i,n.ReasonForVisit,r),n.HasMultipleOrders=!0):1===t.length?(n.OrderingProviderString=this.__buildOrderingProviderString(t[0].ProviderName,r),t[0].IsStanding&&(n.StandingOccurrences=this.__buildStandingOrderString(t[0],r))):t.length>1&&(n.OrderGroups=this.__buildOrderGroups(t,r),n.HasMultipleOrders=!0)},__getTicketLinkedOrders:function(n){var t=this.__getLinkedOrdersFromOrders(n.Orders);return t.concat(this.__getLinkedOrdersFromOrders(n.AppointmentRequests))},__getLinkedOrdersFromOrders:function(n){var i=[],t=0;if(Array.isArray(n))for(t=0;t<n.length;t++)order=n[t],Array.isArray(order.LinkedOrders)&&(i=i.concat(order.LinkedOrders));return i},__getTicketOrderList:function(n){var t;return Array.isArray(n.Orders)&&n.Orders.length>0?t=n.Orders:Array.isArray(n.AppointmentRequests)&&n.AppointmentRequests.length>0&&(t=n.AppointmentRequests),t},__buildOrderingProviderString:function(n,t){var i="";return $$WPUtil.IsNullOrEmpty(n)||(t.addMnemonics({"@MYCHART@ORDERINGPROVIDER@":{Value:n,EncodingType:$$WP.Strings.EncodingTypes.None}}),i=t.getString("TicketOrderingProvider")),i},__buildTwoOrderingProvidersString:function(n,t,i){var r="";return $$WPUtil.IsNullOrEmpty(n)||$$WPUtil.IsNullOrEmpty(t)||(i.addMnemonics({"@MYCHART@ORDERINGPROVIDER1@":{Value:n,EncodingType:$$WP.Strings.EncodingTypes.None}}),i.addMnemonics({"@MYCHART@ORDERINGPROVIDER2@":{Value:t,EncodingType:$$WP.Strings.EncodingTypes.None}}),r=i.getString("TicketTwoOrderingProviders")),r},__buildTwoPlusOrderingProvidersString:function(n,t,i){var r="";return $$WPUtil.IsNullOrEmpty(n)||(i.addMnemonics({"@MYCHART@FIRSTORDERINGPROVIDER@":{Value:n,EncodingType:$$WP.Strings.EncodingTypes.None}}),i.addMnemonics({"@MYCHART@ADDITIONALORDERINGPROVIDERCOUNT@":{Value:t.toString(),EncodingType:$$WP.Strings.EncodingTypes.None}}),r=i.getString("TicketTwoPlusOrderingProviders")),r},__buildStandingOrderString:function(n,t){var i="";return $$WPUtil.IsNullOrEmpty(n.IsStanding)||("1"!==n.StandingOccurrences?n.IsInfinite?i=t.getString("TicketStandingInfiniteMedicationOrder"):(t.addMnemonics({"@MYCHART@STANDINGOCCURRENCES@":{Value:n.StandingOccurrences,EncodingType:$$WP.Strings.EncodingTypes.None}}),i=t.getString("TicketStandingOrderOccurrencesPlural"),$$WP.Strings.removeMnemonic("@MYCHART@STANDINGOCCURRENCES@")):i=t.getString("TicketStandingOrderOccurrencesSingle")),i},__buildOrderGroups:function(n,t){for(var r=0,e=null,u="",i=null,o=[],s=[],f=n.length,r=0;r<f;r++)(i=o[u=(e=n[r]).ProviderName])||((i={}).Orders=[],i.ProviderName=u,i.OrderingProviderString=this.__buildOrderingProviderString(u,t),o[u]=i,s.push(i)),i.Orders.push(e);return s},__buildBundleOrderGroup:function(n,t,i){for(var u=null,e={},f=null,o=null,r=0,u={Orders:[]},r=0;r<n.length;r++)e[n[r].ID]=n[r];for(r=0;r<t.ApptComponents.length;r++)(f=t.ApptComponents[r]).AppointmentRequestIds.length>1?u.Orders.push({DisplayName:f.DefaultVisitType.DisplayName}):(o=e[f.AppointmentRequestIds[0]])&&u.Orders.push(this.__getOrderDetails(o));return u.OrderingProviderString=this.__buildBundleOrderingProviderString(n,i),[u]},__getOrderDetails:function(n){for(var t=0,i={DisplayName:n.DisplayName,LinkedOrders:[]},t=0;t<n.LinkedOrders.length;t++)linkedOrder=n.LinkedOrders[t],i.LinkedOrders.push({DisplayName:linkedOrder.DisplayName});return i},__buildBundleOrderingProviderString:function(n,t){var i,r,u="",f=[];return r=(i=(f=n.map(function(n){return n.ProviderName})).filter(function(n,t){return f.indexOf(n)===t}))[0],2===i.length?u=this.__buildTwoOrderingProvidersString(r,i[1],t):i.length>2?u=this.__buildTwoPlusOrderingProvidersString(r,i.length-1,t):$$WPUtil.IsNullOrEmpty(r)||(u=this.__buildOrderingProviderString(r,t)),u},_buildOneClickSlots:function(n){var r,u,i,e,o,f;if(n.Slots=n.getOneClickSlots(),n.Slots.length>0){for(f=t.allowProviderSelect(t.WorkflowTypesEnum.Ticket,"",n.TicketInfo.VisitType),n.AllowProviderSelect=f,n.SlotGroups=[],r=null,u=0;u<n.Slots.length;u++)i=n.Slots[u],f&&(e=n.SchedulingDataPool.Providers.getFromIndex("ID",i.ProviderId)),o=n.SchedulingDataPool.Departments.getFromIndex("ID",i.DepartmentId),($$WPUtil.IsNullOrEmpty(r)||i.ProviderId!==r.ProviderId||i.DepartmentId!==r.DepartmentId||i.Dte!==r.Dte)&&(r={ProviderId:i.ProviderId,Provider:e,DepartmentId:i.DepartmentId,Department:o,Dte:i.Dte,DateString:i.DateString,Slots:[]},n.SlotGroups.push(r)),r.Slots.push(i);n.HasOneClickSlots=!0}},_onRemoveFavoriteButtonClicked:function(n){var t;t=$afe.jq(n.target).closest("[data-model-id]").safeAttr("data-model-id");this._promptToRemoveFavorite(t)},_onRemoveFavoriteButtonKeyPress:function(n){var t;" "!==n.key&&"Enter"!==event.key||(t=$afe.jq(n.target).closest("[data-model-id]").safeAttr("data-model-id"),this._promptToRemoveFavorite(t))},_promptToRemoveFavorite:function(n){var t,i;t=$$WPUtil.createRemoveGoBackButtons();i=[n];$$WPUtil.quickMessageBox($$WP.Strings.get("RemoveSchedulingFavoriteConfirmation","Scheduling"),$$WP.Strings.get("RemoveSchedulingFavoritePopupTitle","Scheduling"),t,this._onRemoveFavoritePopupButtonClicked,i)},_onRemoveFavoritePopupButtonClicked:function(n,t){var i;"toolbarcontinue"===t&&(i=r.getInstance(n),this._onRemoveFavorite(i.FavoriteAppointmentInfo.Csn))},_removeFavoriteFromDatabase:function(n){$.post({url:makeLink("api/Scheduling/RemoveFavoriteAppointment"),data:{csn:n}})},_onDeclineTicketButtonClicked:function(n){var u,t,i;u=$afe.jq(n.target).closest("[data-workflow-model-id]").safeAttr("data-workflow-model-id");i=(t=r.getInstance(u)).TicketInfo.TicketId;t.TicketInfo.AppointmentRequests.length>0&&(i=t.TicketInfo.AppointmentRequests[0].ID);this._onDeclineTicket(i)},_onDeclineTicket:function(n){var i="app/scheduling/decline-appointment?ticketId="+n+"&isGuest="+(this._workflows.getFromIndex("Type",t.WorkflowTypesEnum.Ticket)[0].IsGuest?1:0)+"&fromScheduling=1";this._isMobile&&(i="epichttp://"+i);$$WPUtil.TryRedirect(makeLink(i))},_buildProviderArray:function(){for(var i,t=[],r=(i=this._providerWorkflow.SchedulingDataPool.ReasonsForVisit.Models).length,n=0;n<r;n++)this._addProvidersFromReasonForVisit(i[n],t);return(t=this.filterByAllowedIds(t,"ID")).sort($$WP.Scheduling.Provider.sortProvidersByListDisplayName)},_addProvidersFromReasonForVisit:function(n,i){var f,r,e=[],u=null;if(t.isReasonForVisitAvailableProviderFirst(n))for(f=(e=n.AllProviderDepartmentPairs).length,r=0;r<f;r++)(u=e[r].Provider).IsStandardProvider&&-1===i.indexOf(u)&&i.push(u)},_getUnfilteredReasonsForVisit:function(){var n=this._reasonWorkflow.SchedulingDataPool.ReasonsForVisit.Models;return $$WP.Scheduling.Workflow.buildReasonsForVisitNoFiltering(n,!0,!0)}};u.LandingPageDataTypesEnum=n;$$WP.Scheduling.LandingPageController=u;u.extend($$WP.Scheduling.StepController,"WP$Scheduling$LandingPageController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t,i,r,u){this.WP$Controllers$Controller();this.$root=n;this._stepControllers=[];this._stepMapById={};this.proxify("showPrevStep","startover","__onViewEventTriggered");!0===t&&(this._promptUnsavedChanges=!1);this._workflow=i||{};this.__canReturnToPreviousPage=r;this.__onBeforeUnloadChanged=u};n.prototype={$root:null,_stepControllers:null,_stepMapById:null,_currentStep:0,_continueButton:null,_cancelButton:null,_promptUnsavedChanges:!0,_workflow:null,__canReturnToPreviousPage:!1,__onBeforeUnloadChanged:null,showStep:function(n){void 0!==this._stepMapById[n]&&this._stepMapById[n]!==this._currentStep&&this._showStepInArray(this._stepMapById[n])},_showStepInArray:function(n){var i,t;n<this._stepControllers.length&&(this.deactivateStep(this._stepControllers[this._currentStep]),this._currentStep=n,this.activateStep(this._stepControllers[n]));this._continueButton&&(this.isComplete(this._stepControllers[this._currentStep].Id)?(this.$root.addClass("hasFloatingNavigation"),this._continueButton.css("display","inline-block")):(this._continueButton.hide(),this.$root.removeClass("hasFloatingNavigation"),this._stepControllers[n].getSchedulingContinueBanner().removeClass("stickybanner")));(t=this.$root.find(".summary-back")).length>0&&(this.__shouldShowBackButton(n)?t.removeClass("hidden"):t.addClass("hidden"));(i=$afe.select("#workflow-help"))&&n>0&&i.slideUp(300)},showNextStep:function(n){this._currentStep<this._stepControllers.length&&(this._showStepInArray(this._currentStep+1),n&&(n.stopPropagation(),n.preventDefault()))},showPrevStep:function(n){this._currentStep>0&&(this._showStepInArray(this._currentStep-1),n&&(n.stopPropagation(),n.preventDefault()))},getStep:function(n){return this._stepControllers[n]},getCurrentStep:function(){return this.getStep(this._currentStep)},deactivateRange:function(n){for(var t=0,i=this._stepMapById[n],t=i+1;t<this._stepControllers.length;t++)this.deactivateStep(this._stepControllers[t],!0);this._currentStep>i&&(this._currentStep=i)},activateAllSteps:function(){this.activateRange(0,this._stepControllers.length-1)},activateUpToCurrentStep:function(){this.activateRange(0,this._currentStep)},activateRange:function(n,t){for(var i=0,i=n;i<=t;i++)this.activateStep(this._stepControllers[i])},hookupNavigationButtons:function(n,t,i,r){this._continueButton=n;this._cancelButton=t;n&&"function"==typeof i&&this._continueButton.click(i);t&&"function"==typeof r&&this._cancelButton.click(r)},startover:function(){this.clearBeforeUnload();$$WPSchedulingUtil.Reload(this._workflow.IsAuthenticatedWidget)},setBeforeUnload:function(){this._promptUnsavedChanges&&(this.__onBeforeUnloadChanged?this.__onBeforeUnloadChanged(!0):WP.Events.beforeUnload())},clearBeforeUnload:function(){this._promptUnsavedChanges&&(this.__onBeforeUnloadChanged?this.__onBeforeUnloadChanged(!1):WP.Events.cancelBeforeUnload())},addStep:function(n){this._stepControllers.push(n);this._stepMapById[n.Id]=this._stepControllers.length-1},removeStep:function(n){n.dispose();this._stepControllers.splice(this._stepControllers.indexOf(n),1)},render:function(){this._currentStep=-1;this.showNextStep()},destroy:function(){$$WP.Debug.logError("Virtual method destroy must be overridden")},activateStep:function(){$$WP.Debug.logError("Virtual method activateStep must be overridden")},deactivateStep:function(){$$WP.Debug.logError("Virtual method deactivateStep must be overridden")},isComplete:function(){$$WP.Debug.logError("Virtual method isComplete must be overridden")},__onViewEventTriggered:function(n,t,i,r){$$WP.Scheduling.SchedulingController.logSchedulingViewEvent(n,t,i,r,this._workflow)},__shouldShowBackButton:function(n){var t=this._stepControllers[0].Data;return this.__canReturnToPreviousPage||null!==$$WPSchedulingUtil.GetPreviousVisibleStep(n,this._stepControllers,t)}};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.WorkflowController=n;n.extend($$WP.Controllers.Controller,"WP$Scheduling$WorkflowController")}();!function(){var n=$$WP.Scheduling.SchedulingStep,t=$$WP.Scheduling.Workflow,i=function(i,r,u,f){var e,o,s;this.WP$Scheduling$WorkflowController(i,!1,r);this.$root.safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.VerificationStep,{}));this.proxify("_onStepCompleteChanged","_update");this.$root=i;this._dataPool=r.SchedulingDataPool;this._stackId=this.Id;this._summarySteps=[];this._stepContainers=[];this._isMobile=$$WP.Utilities.UI.IsMobile;this._isEmbedded=u.IsEmbedded;f=$$WPUtil.IsNullOrEmpty(f)?new $$WP.Scheduling.StepFactory(r,u):f;u.ShowDemographicVerificationStep&&(e=f.createStep(n.StepTypeEnum.Demographics),n.addSchedulingStepToCollection(this._dataPool.SchedulingSteps,e.Id,!0,this._stackId),this._stepContainers.push(e.$root),this.addStep(e),e.addViewEventListener(this.__onViewEventTriggered),this._summarySteps.push({type:"Demographic",Id:e.Id}));u.ShowInsuranceVerificationStep&&u.WorkflowType!==t.WorkflowTypesEnum.OnDemandTelehealth&&(e=f.createStep(n.StepTypeEnum.Insurance),n.addSchedulingStepToCollection(this._dataPool.SchedulingSteps,e.Id,!0,this._stackId),this._stepContainers.push(e.$root),this.addStep(e),e.addViewEventListener(this.__onViewEventTriggered),this._summarySteps.push({type:"Insurance",Id:e.Id}));u.WorkflowType===t.WorkflowTypesEnum.OnDemandTelehealth?(o=n.StepTypeEnum.TelehealthSummary,s="TelehealthSummary"):(o=n.StepTypeEnum.Confirmation,s="Confirmation");e=f.createStep(o);n.addSchedulingStepToCollection(this._dataPool.SchedulingSteps,e.Id,!0,this._stackId);this._stepContainers.push(e.$root);this.addStep(e);e.addViewEventListener(this.__onViewEventTriggered);this._summarySteps.push({type:s,Id:e.Id});this._dataPool.AppointmentBuilder.setProperty("IsPersonalInfoCollectionComplete",this._workflow.SchedulingControllerParams.isPersonalInfoCollectionComplete);this._dataPool.AppointmentBuilder.setProperty("HasMatchingRecord",this._workflow.SchedulingControllerParams.hasMatchingRecord);this._dataPool.AppointmentBuilder.setProperty("IsInsuranceCollectionComplete",this._workflow.SchedulingControllerParams.isInsuranceCollectionComplete);this._dataPool.AppointmentBuilder.setProperty("IsPromoted",this._dataPool.AppointmentBuilder.IsPromoted||this._workflow.SchedulingControllerParams.isPromoted);this.__canShowPersonalInfoCollectionStep(r,u)&&(this.reviewStep=e,this.__addPersonalInfoCollectionStep(f,o));this._dataPool.SchedulingSteps.addPropertyListener("CompleteStatus",this._onStepCompleteChanged);$$WPUtil.FixScrollingForIOS(this.$root)};i.prototype={$root:null,Id:"verification_step",_dataPool:null,_stackId:null,_summarySteps:null,_stepContainers:null,_isMobile:!1,_isEmbedded:!1,show:function(){this._update();this.render();this.$root.parent().css({"min-height":""})},hide:function(n){this.$root.hide();void 0!==n&&this.setComplete(n);this.deactivateRange(this._summarySteps[0].Id,!0)},activateStep:function(n){n.show();this._isEmbedded||$$WPSchedulingUtil.ScrollToTopOfPage();this._dataPool.BlockDemographicInsuranceVerification=!1},deactivateStep:function(n){n&&(n.hide($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.getSchedulingContinueBanner().removeClass("stickybanner"),this.$root.parent().find(".startover").removeClass("fixToTop"))},onWorkflowDestroyed:function(){for(var n=0,n=0;n<this._stepControllers.length;n++)this._stepControllers[n].onWorkflowDestroyed()},_update:function(){this.$root.show();this.$root.empty().safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.VerificationStep));for(var n=0;n<this._stepContainers.length;n++)this.$root.find(".verificationContent").safeAppend(this._stepContainers[n]);this._isMobile&&($afe.select(".verificationContent .formbuttons").addClass("floatingButtonContainer"),$afe.select(".verificationContent .button").addClass("floating"))},_onStepCompleteChanged:function(t){var r,u,i,f;for(r in t)u=t[r].from,i=t[r].to,(f=t[r].model||$$WP.Common.Model.getInstance(r)).IsStacked&&f.StackId===this._stackId&&(u===i||i!==n.CompleteEnum.Complete&&i!==n.CompleteEnum.NotRequired?u!==i&&i===n.CompleteEnum.Incomplete&&this.deactivateRange(f.ID):(this.showNextStep(),this._update()))},hasStickyBanner:function(){return!1},setCurrentSelectionCountInBanner:function(){},getSchedulingContinueBanner:function(){return this.$root.parent().find(".verifyButtons")},getContinueButton:function(n){return this.__getCurrentVerificationStepController().getContinueButton(n)},isUsingWorkflowNavigation:function(){return!1},onNavigateBack:function(){},__getCurrentVerificationStepController:function(){var n=this._currentStep;return this._stepControllers[n]},__canShowPersonalInfoCollectionStep:function(n,i){return!!n.IsGuest&&!(!n.SchedulingControllerParams||void 0===n.SchedulingControllerParams.isPersonalInfoCollectionComplete||void 0===n.SchedulingControllerParams.isInsuranceCollectionComplete)&&!!(n.Type===t.WorkflowTypesEnum.DecisionTreeNode||i.WorkflowType===t.WorkflowTypesEnum.OnDemandTelehealth&&n.SchedulingControllerParams.rootDecisionTreeID||n.Type===t.WorkflowTypesEnum.Ticket&&void 0!==n.decisionTreeNodeID)&&(!n.SchedulingControllerParams.isPersonalInfoCollectionComplete||!n.SchedulingControllerParams.isInsuranceCollectionComplete)},__addPersonalInfoCollectionStep:function(t,i){var r=t.createStep(n.StepTypeEnum.PersonalInfoCollection);i===n.StepTypeEnum.TelehealthSummary?r.setSchedulingCallbacks(this.reviewStep._kickoffLogin):(this.reviewStep.storeSelfTriageSessionSuccessCallback=t.__workflowEventCallbacks.storeSelfTriageSessionSuccessCallback,r.setSchedulingCallbacks($.proxy(this.personalInformationLoginCallback,this.reviewStep),$.proxy(this.reviewStep.__schedulePostlogin,this.reviewStep),$.proxy(this.reviewStep.__schedulePostSelfTriageReconciliation,this.reviewStep)));n.addSchedulingStepToCollection(this._dataPool.SchedulingSteps,r.Id,!0,this._stackId);this._stepContainers.push(r.$root);this.addStep(r);r.addViewEventListener(this.__onViewEventTriggered);this._summarySteps.push({type:"PersonalInfo",Id:r.Id})},personalInformationLoginCallback:function(){var n=this.__getAjaxParameters(!0);$.ajax({url:makeLink("SymptomChecker/SelfTriage/StoreSelfTriageSession"),type:"POST",data:$$WPUtil.postify({session:{TreeID:this._workflow.SchedulingControllerParams.rootDecisionTreeID,AnswerID:this._workflow.SchedulingControllerParams.decisionTreeAnswerID,InProgressActionNodeID:this._workflow.SchedulingControllerParams.decisionTreeNodeID,SchedulingWorkflow:n.workflow,AppointmentBuilder:n.appointmentBuilder,FromList:this._workflow.SchedulingControllerParams.FromList}}),success:this.storeSelfTriageSessionSuccessCallback})}};$$WP.Scheduling.VerificationStepController=i;i.extend($$WP.Scheduling.WorkflowController,"WP$Scheduling$VerificationStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t,i,r,u,f){this.WP$Scheduling$StepController(n,i.SchedulingDataPool,null,null,null,$$WP.Templates.Scheduling.StackedStep,$$WP.Templates.Scheduling.StackedStep,!0);this.proxify("_onStepCompleteChanged");this.stackId=this.Id;this._dataPool=i.SchedulingDataPool;this._stackedWorkflowController=new $$WP.Scheduling.StackedWorkflowController(n,t,i,r,u,this.stackId,f);this._dataPool.SchedulingSteps.addPropertyListener("CompleteStatus",this._onStepCompleteChanged)};n.prototype={_stackedWorkflowController:null,stackId:null,_dataPool:null,_isComplete:!1,updateViewModel:function(){this.ViewModel={Count:1,StepShouldBeActive:!0}},beforeFirstRender:function(){this._stackedWorkflowController.render();this._stackedWorkflowController.showNextIncompleteStep();(this._isComplete||this._dataPool.SchedulingSteps.getFromIndex("ID",this.Id).CompleteStatus===$$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)&&(this.Active=!1)},_onStepCompleteChanged:function(n){var t,i,r,u,f;for(r in u=0,f=0,n)if((n[r].model||$$WP.Common.Model.getInstance(r)).StackId===this.stackId&&n[r].to!==n[r].from){for(t=this._dataPool.SchedulingSteps.getFromIndex("StackId",this.stackId),i=0;i<t.length;i++)if(t[i].CompleteStatus===$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete)u++;else if(t[i].CompleteStatus===$$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)f++;else if(t[i].CompleteStatus===$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)return this._isComplete=!1,void this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete);u>0?(this._isComplete=!0,this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Complete)):f===t.length&&this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired)}},afterRender:function(){var n=this._dataPool.SchedulingSteps.getFromIndex("ID",this.Id);this._dataPool.SchedulingSteps.openChangeBatch();this._stackedWorkflowController.activateStack();this._dataPool.SchedulingSteps.closeChangeBatch();n.CompleteStatus!==$$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired||n.ForceShowOnce||(this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete),this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired))},onNavigateBack:function(){for(var n=0,n=0;n<this._stackedWorkflowController._stepControllers.length;n++)this._stackedWorkflowController._stepControllers[n].onNavigateBack()},beforeNavigateBack:function(){for(var n=0,n=0;n<this._stackedWorkflowController._stepControllers.length;n++)this._stackedWorkflowController._stepControllers[n].beforeNavigateBack()},shouldRemainOnStep:function(){for(var n=0,n=0;n<this._stackedWorkflowController._stepControllers.length;n++)if(this._stackedWorkflowController._stepControllers[n].shouldRemainOnStep())return!0;return!1},setCurrentSelectionCountInBanner:function(){if(this.hasStickyBanner())for(var n=0,t=null,n=0;n<this._stackedWorkflowController._stepControllers.length;n++)if((t=this._stackedWorkflowController._stepControllers[n]).hasStickyBanner())return void t.setCurrentSelectionCountInBanner()},hasStickyBanner:function(){for(var n=0,n=0;n<this._stackedWorkflowController._stepControllers.length;n++)if(this._stackedWorkflowController._stepControllers[n].hasStickyBanner())return!0;return!1},getContinueButton:function(n){return this.__getCurrentChildStepController().getContinueButton(n)},isUsingWorkflowNavigation:function(){return this.__getCurrentChildStepController().isUsingWorkflowNavigation()},__getCurrentChildStepController:function(){var n=this._stackedWorkflowController._currentStep;return this._stackedWorkflowController._stepControllers[n]},hide:function(n){for(var t=0,t=0;t<this._stackedWorkflowController._stepControllers.length;t++)this._stackedWorkflowController._stepControllers[t].hide(n);this.WP$Scheduling$StepController$hide(n)},onWorkflowDestroyed:function(){for(var n=0,n=0;n<this._stackedWorkflowController._stepControllers.length;n++)this._stackedWorkflowController._stepControllers[n].onWorkflowDestroyed()}};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.StackedStepController=n;n.extend($$WP.Scheduling.StepController,"WP$Scheduling$StackedStepController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n,t,i,r,u){this.WP$Scheduling$StackedStepController(n,[t],i,r,$$WP.Scheduling.StackedWorkflowController.ModesEnum.ShowAllAtOnce,u);this.__stepDefinition=t;this.proxify("__onAppointmentsChanged");this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("add",this.__onAppointmentsChanged);this.Data.AppointmentBuilder.Appointments.addCollectionEventListener("remove",this.__onAppointmentsChanged)};n.prototype={__stepDefinition:null,__onAppointmentsChanged:function(){var n=0,t=null;for(this.__resetSteps(),n=0;n<this.Data.AppointmentBuilder.numAppointments();n++)t=this.Data.AppointmentBuilder.getAppointment(n),this._stackedWorkflowController.createStepAndAddToDom(this.__stepDefinition).linkAppointment(t);this.setComplete($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)},__resetSteps:function(){var t,n=0,i=null;if((t=this._stackedWorkflowController._stepControllers).length>0){for(n=t.length-1;n>=0;n--)i=t[n],this._stackedWorkflowController.destroyStepAndRemoveFromDom(i);this._stackedWorkflowController._currentStep=0}}};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.MultiAppointmentStepController=n;n.extend($$WP.Scheduling.StackedStepController,"WP$Scheduling$MultiAppointmentStepController")}();!function(){var t=$$WP.Scheduling.SchedulingStep.StepTypeEnum,n=$$WP.Scheduling.Workflow,i=$$WP.Scheduling.ProviderStepController,u=$$WP.Scheduling.LocationStepController,h=$$WP.Scheduling.SpecialtyStepController,c=$$WP.Scheduling.SlotStepController,f=$$WP.Scheduling.LqfStepController,l=$$WP.Scheduling.StackedStepController,e=$$WP.Scheduling.CustomStepController,a=$$WP.Scheduling.DemographicVerificationStepController,v=$$WP.Scheduling.InsuranceVerificationStepController,y=$$WP.Scheduling.JoinWaitListStepController,o=$$WP.Scheduling.ConfirmationStepController,p=$$WP.Scheduling.RequestStepController,w=$$WP.Scheduling.VerificationStepController,r=$$WP.Scheduling.ReasonForVisitStepController,b=$$WP.Scheduling.ProviderReasonForVisitStepController,k=$$WP.Scheduling.OnDemandTelehealth.QuickScheduleStepController,d=$$WP.Scheduling.OnDemandTelehealth.PatientLocationStepController,g=$$WP.Scheduling.OnDemandTelehealth.OrganizationStepController,nt=$$WP.Scheduling.OnDemandTelehealth.OrganizationAuthStepController,tt=$$WP.Scheduling.OnDemandTelehealth.PlatformStepController,it=$$WP.Scheduling.OnDemandTelehealth.SummaryStepController,rt=$$WP.Scheduling.PersonalInfoCollectionStepController,s=function(n,t,i,r){this._workflow=n;this._workflowSettings=t;this.__workflowEventCallbacks=i;this.__disableUTF8=r};s.prototype={_workflow:null,_workflowSettings:null,__workflowEventCallbacks:null,__disableUTF8:!1,createStep:function(n,i){var r;switch(n){case t.Provider:r=this._getProviderStep();break;case t.Location:r=this._getLocationStep();break;case t.Slot:r=this._getSlotStep();break;case t.JoinWaitList:r=this._getJoinWaitListStep();break;case t.Reservation:r=this._getReservationStep();break;case t.ReasonForVisit:r=this._getReasonForVisitStep();break;case t.StandardLqf:r=this._getStandardLqfStep();break;case t.Stacked:r=this._getStackedStep(i);break;case t.DepartmentLqf:r=this._getDepartmentLqfStep();break;case t.Custom:r=this._getCustomStep();break;case t.CustomLanding:r=this._getCustomLandingStep();break;case t.Demographics:r=this._getDemographicStep();break;case t.Insurance:r=this._getInsuranceStep();break;case t.Confirmation:r=this._getConfirmationStep();break;case t.Request:r=this._getRequestStep();break;case t.QuickSchedule:r=this._getQuickScheduleStep();break;case t.Verification:r=this._getVerificationStep();break;case t.TelehealthLocation:r=this._getPatientLocationStep();break;case t.TelehealthSummary:r=this._getTelehealthSummaryStep();break;case t.TelehealthOrganization:r=this._getTelehealthOrganizationStep();break;case t.TelehealthAuth:r=this._getTelehealthAuthStep();break;case t.PlatformStep:r=this._getTelehealthPlatformStep();break;case t.MultiAppointment:r=this._getMultiAppointmentStep(i[0]);break;case t.Onboarding:r=this._getOnboardingStep();break;case t.Specialty:r=this._getSpecialtyStep();break;case t.PersonalInfoCollection:r=this._getPersonalInfoCollectionStep()}return r},_getTelehealthSummaryStep:function(){return new it(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings,this.__workflowEventCallbacks.onSchedulingComplete,this._workflow.IsAnonymous,this._workflow.IsGuest,this._workflow.AnonymousSettings,this.__workflowEventCallbacks.onStopScheduling)},_getPatientLocationStep:function(){return new d(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflow.IsAnonymous,this._workflow)},_getVerificationStep:function(){return new w(this._createStepContainer(),this._workflow,this._workflowSettings,this)},_getTelehealthOrganizationStep:function(){return new g(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings)},_getTelehealthAuthStep:function(){return new nt(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings)},_getTelehealthPlatformStep:function(){return new tt(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflow.IsAnonymous)},_getQuickScheduleStep:function(){return new k(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedProviderIds,this._workflowSettings.PreselectedProviderIds,this._workflowSettings.QuickScheduleStepSettings,this._workflowSettings.RequireECheckInForTelemedicine,this._workflowSettings,this._workflow.IsAnonymous,this._workflow.IsGuest)},_getRequestStep:function(){return new p(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings,this.__workflowEventCallbacks.onRequestComplete,this.__workflowEventCallbacks.onError,this._workflowSettings.IsLoginEnabled,this._workflowSettings.DisableScheduleAsGuest,this._workflowSettings.IsDemoMode)},_getConfirmationStep:function(){switch(this._workflow.Type){case n.WorkflowTypesEnum.Reschedule:return new o(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this.__workflowEventCallbacks.onSchedulingComplete,this.__workflowEventCallbacks.onError,this._workflowSettings.RescheduleReasons,this._workflowSettings.RequireRescheduleReason,this._workflowSettings.DisableFavoriteAppointments||this._workflow.IsFavorite,!0,"",this._workflowSettings.DisableScheduleAsGuest,this._workflowSettings.DepartmentStepSettings.Hide,this._workflowSettings.IsDemoMode);case n.WorkflowTypesEnum.NewProvider:case n.WorkflowTypesEnum.ProviderFinder:case n.WorkflowTypesEnum.Widget:return new o(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this.__workflowEventCallbacks.onSchedulingComplete,this.__workflowEventCallbacks.onError,null,!1,this._workflowSettings.DisableFavoriteAppointments||this._workflow.IsFavorite,!1,this._workflowSettings.IsLoginEnabled,this._workflowSettings.DisableScheduleAsGuest,this._workflowSettings.DepartmentStepSettings.Hide,this._workflowSettings.IsDemoMode);default:return new o(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this.__workflowEventCallbacks.onSchedulingComplete,this.__workflowEventCallbacks.onError,null,!1,this._workflowSettings.DisableFavoriteAppointments||this._workflow.IsFavorite,!1,this._workflowSettings.IsLoginEnabled,!1,this._workflowSettings.DepartmentStepSettings.Hide,this._workflowSettings.IsDemoMode)}},_getInsuranceStep:function(){return new v(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.ShowInsuranceVerificationStep,this._workflowSettings.IsAlwaysSelfPay,this._workflowSettings)},_getDemographicStep:function(){return new a(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.ShowDemographicVerificationStep,this.__disableUTF8)},_getPersonalInfoCollectionStep:function(){return new rt(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this.__workflowEventCallbacks.onStopScheduling,this.__workflowEventCallbacks,this._workflowSettings)},_getCustomStep:function(){return this._workflow.Type,n.WorkflowTypesEnum.Reschedule,new e(this._createStepContainer(),this._workflow.SchedulingDataPool,!1)},_getCustomLandingStep:function(){switch(this._workflow.Type){case n.WorkflowTypesEnum.ProviderFinder:case n.WorkflowTypesEnum.Widget:return new e(this._createStepContainer(),this._workflow.SchedulingDataPool,!0,this._workflowSettings.StringKey);default:return new e(this._createStepContainer(),this._workflow.SchedulingDataPool,!0)}},_getMultiAppointmentStep:function(n){return new $$WP.Scheduling.MultiAppointmentStepController(this._createStepContainer(),n,this._workflow,this._workflowSettings,this.__workflowEventCallbacks)},_getOnboardingStep:function(){return new $$WP.Scheduling.OnboardingStepController(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflow,this._workflowSettings.HasPatientLocationRule)},_getStackedStep:function(n){return new l(this._createStepContainer(),n,this._workflow,this._workflowSettings,$$WP.Scheduling.StackedWorkflowController.ModesEnum.ShowOneAtATime,this.__workflowEventCallbacks)},_getStandardLqfStep:function(){return new f(this._createStepContainer(),this._workflow.SchedulingDataPool,f.ModesEnum.Standard,this.__workflowEventCallbacks.onStopScheduling,this._workflow,this._workflowSettings.AllowedProviderIds,this._workflowSettings.HasPatientLocationRule)},_getDepartmentLqfStep:function(){return new f(this._createStepContainer(),this._workflow.SchedulingDataPool,f.ModesEnum.DepartmentOverride,this.__workflowEventCallbacks.onStopScheduling,this._workflow,this._workflowSettings.AllowedProviderIds,this._workflowSettings.HasPatientLocationRule)},_getReasonForVisitStep:function(){switch(this._workflow.Type){case n.WorkflowTypesEnum.ExistingProvider:return new r(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedReasonForVisitIds,this._workflowSettings.PreselectedReasonForVisitId,this._workflowSettings.ReasonForVisitStepSettings,r.ModesEnum.FilterOnSelectedProviders,this.__workflowEventCallbacks.onStopScheduling,null,null,null,this._workflow,this._workflowSettings.HasPatientLocationRule);case n.WorkflowTypesEnum.NewProvider:return new r(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedReasonForVisitIds,this._workflowSettings.PreselectedReasonForVisitId,this._workflowSettings.ReasonForVisitStepSettings,r.ModesEnum.FilterOnSelectedSpecialty,this.__workflowEventCallbacks.onStopScheduling,!1,!0,this._workflow.IsAnonymous,this._workflow,this._workflowSettings.HasPatientLocationRule);case n.WorkflowTypesEnum.Request:return new r(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedReasonForVisitIds,this._workflowSettings.PreselectedReasonForVisitId,this._workflowSettings.ReasonForVisitStepSettings,r.ModesEnum.Request,this.__workflowEventCallbacks.onStopScheduling,null,null,null,this._workflow,this._workflowSettings.HasPatientLocationRule);case n.WorkflowTypesEnum.OnDemandTelehealth:return new r(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedReasonForVisitIds,this._workflowSettings.PreselectedReasonForVisitId,this._workflowSettings.ReasonForVisitStepSettings,r.ModesEnum.OnDemandTelehealth,this.__workflowEventCallbacks.onStopScheduling,this._workflowSettings.IsEmbedded&&(!this._workflow.IsAnonymous||!!this._workflow.SchedulingControllerParams.rootDecisionTreeID),!1,this._workflow.IsAnonymous,this._workflow,!1);case n.WorkflowTypesEnum.ProviderFinder:return this._workflowSettings.ReasonForVisitStepSettings.HideIfPreselected=!0,!$$WPUtil.IsNullOrEmpty(this._workflowSettings.PreselectedSlotUID)&&$$WPUtil.IsNullOrEmpty(this._workflowSettings.PreselectedReasonForVisitId)&&(this._workflowSettings.PreselectedReasonForVisitId=this.__findRfvForSlotUid(this._workflowSettings.PreselectedSlotUID,this._workflow.SchedulingDataPool.ReasonsForVisit.toArray())),this.__isExpectedPatientTypeSet(this._workflow.SchedulingDataPool.ReasonsForVisit)?new b(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedReasonForVisitIds,this._workflowSettings.PreselectedReasonForVisitId,parseInt(this._workflowSettings.PreselectedPatientType,10),this._workflowSettings.ReasonForVisitStepSettings,this.__workflowEventCallbacks.onStopScheduling,this._workflow.IsAnonymous,this._workflow,this._workflowSettings.AllowedProviderIds,this._workflowSettings.AllowedDepartmentIds,this._workflowSettings.AllowMobileSchedulingInlineRedirects):(this._workflowSettings.ReasonForVisitStepSettings.HideIfOne=!0,new r(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedReasonForVisitIds,this._workflowSettings.PreselectedReasonForVisitId,this._workflowSettings.ReasonForVisitStepSettings,r.ModesEnum.NoFiltering,this.__workflowEventCallbacks.onStopScheduling,!1,!0,this._workflow.IsAnonymous,this._workflow));case n.WorkflowTypesEnum.Widget:return this._workflowSettings.ReasonForVisitStepSettings.HideIfOne=!0,new r(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedReasonForVisitIds,this._workflowSettings.PreselectedReasonForVisitId,this._workflowSettings.ReasonForVisitStepSettings,r.ModesEnum.NoFiltering,this.__workflowEventCallbacks.onStopScheduling,!1,!0,this._workflow.IsAnonymous,this._workflow,this._workflowSettings.HasPatientLocationRule);default:return new r(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedReasonForVisitIds,this._workflowSettings.PreselectedReasonForVisitId,this._workflowSettings.ReasonForVisitStepSettings,r.ModesEnum.NoFiltering,this.__workflowEventCallbacks.onStopScheduling,null,null,null,this._workflow,this._workflowSettings.HasPatientLocationRule)}},__findRfvForSlotUid:function(n,t){for(var r=null,u=$$WP.Scheduling.Solution.createSolutionFromUid(n).Slots[0].VisitTypeId,i=0;i<t.length;i++)if((r=t[i]).DefaultVisitTypeId===u)return r.Id;return""},__isExpectedPatientTypeSet:function(n){for(var i=n.toArray(),r=$$WP.Scheduling.ReasonForVisit.PatientTypeEnum.Unknown,t=0;t<i.length;t++)if((r=i[t].ExpectedPatientType)===$$WP.Scheduling.ReasonForVisit.PatientTypeEnum.NewPatient||r===$$WP.Scheduling.ReasonForVisit.PatientTypeEnum.EstablishedPatient)return!0;return!1},_getReservationStep:function(){return new $$WP.Scheduling.ReservationStepController(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings.IsReservationAllowed,this.__workflowEventCallbacks.onStopScheduling)},_getSlotStep:function(){var t,i;(t={FromMinutesOffset:this._workflowSettings.FromMinutesOffset,FromDaysOffset:this._workflowSettings.FromDaysOffset,ToDaysOffset:this._workflowSettings.ToDaysOffset,StartDate:this._workflowSettings.StartDate,EndDate:this._workflowSettings.EndDate,DateRangeSettings:this._workflowSettings.DateRangeSettings,TimePreferences:this._workflowSettings.TimePreferences,UseOnFileTimePreferences:this._workflowSettings.UseOnFileTimePreferences,ShowTeamBeforeSearch:this._workflowSettings.ShowTeamBeforeSearch,AllowTeamScheduling:this._workflowSettings.AllowTeamScheduling,OnFileSchedulePreferences:this._workflowSettings.SchedulePreferences,DaysOfWeekList:this._workflowSettings.DaysOfWeekList,GeolocationDistanceUnits:this._workflowSettings.GeolocationDistanceUnits,MaxOpenSchedulingApptCount:this._workflowSettings.MaxOpenSchedulingApptCount,CurrentDTE:this._workflowSettings.CurrentDTE,FallbackSchedulingPhone:this._workflowSettings.FallbackSchedulingPhone,DefaultProviderLanguages:this._workflowSettings.DefaultProviderLanguages,IsSortingByAvailability:this._workflowSettings.IsSortingByAvailability,WidgetStringKey:this._workflowSettings.StringKey,AllowedProviderIds:this._workflowSettings.AllowedProviderIds,AllowedDepartmentIds:this._workflowSettings.AllowedDepartmentIds,PreselectedProviderIds:this._workflowSettings.PreselectedProviderIds,IsProviderStepHiddenByQueryParams:this._workflowSettings.ProviderStepSettings.Hide,IsDepartmentStepHiddenByQueryParams:this._workflowSettings.DepartmentStepSettings.Hide,IsPatientLocationStepRequiredBySetting:this._workflowSettings.IsPatientLocationStepRequired,EmbeddedConsecutiveSlotLoadLimit:this._workflowSettings.EmbeddedConsecutiveSlotLoadLimit}).DateRangeSettings=t.DateRangeSettings||{ReadOnly:!1,NoIncremental:!1,NoMinimum:!1};i=null;switch(this._workflow.Type){case n.WorkflowTypesEnum.Ticket:t.FromDte=this._workflow.TicketInfo.FromDte;t.ToDte=this._workflow.TicketInfo.ToDte;t.BundleId=this._workflow.TicketInfo.BundleId;t.ExpirationDte=this._workflow.TicketInfo.ExpirationDte;break;case n.WorkflowTypesEnum.Request:i=c.ModesEnum.RequestOnly;break;case n.WorkflowTypesEnum.Reschedule:t.FromDte=this._workflow.OriginalAppointmentInfo.FromDte;t.ToDte=this._workflow.OriginalAppointmentInfo.ToDte;t.OriginalAppointmentInfo=this._workflow.OriginalAppointmentInfo;break;case n.WorkflowTypesEnum.NewProvider:case n.WorkflowTypesEnum.ProviderFinder:case n.WorkflowTypesEnum.Widget:case n.WorkflowTypesEnum.SimpleWidget:t.NewProvFromDaysOffset=this._workflowSettings.NewProvFromDaysOffset;t.NewProvToDaysOffset=this._workflowSettings.NewProvToDaysOffset}return new c(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,t,i,this.__workflowEventCallbacks,this._workflowSettings.PreselectedSlotUID,this._workflowSettings.PreselectedFilters,this._workflowSettings.AvailableFilters)},_getLocationStep:function(){var i={GeolocationNumLocationsToSelect:this._workflowSettings.GeolocationNumLocationsToSelect,GeolocationInnerRadius:this._workflowSettings.GeolocationInnerRadius,GeolocationOuterRadius:this._workflowSettings.GeolocationOuterRadius,GeolocationDistanceUnits:this._workflowSettings.GeolocationDistanceUnits,GeolocationStreetAddress:this._workflowSettings.GeolocationStreetAddress},t={};switch($.extend(t,this._workflowSettings.DepartmentStepSettings),this._workflow.Type){case n.WorkflowTypesEnum.Reschedule:return t.HideIfOne=!0,new u(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings.AllowedDepartmentIds,this._workflowSettings.PreselectedDepartmentIds,t,u.ModesEnum.FilterOnSelectedReasonForVisit,this._workflowSettings.LocationGroupingBehavior,this.__workflowEventCallbacks.onStopScheduling,null,i,this._workflow.OriginalAppointmentInfo);case n.WorkflowTypesEnum.DecisionTreeNode:case n.WorkflowTypesEnum.Ticket:return new u(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings.AllowedDepartmentIds,this._workflowSettings.PreselectedDepartmentIds,t,u.ModesEnum.FilterOnSelectedReasonForVisit,this._workflowSettings.LocationGroupingBehavior,this.__workflowEventCallbacks.onStopScheduling,null,i,null);case n.WorkflowTypesEnum.Request:return new u(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings.AllowedDepartmentIds,this._workflowSettings.PreselectedDepartmentIds,t,u.ModesEnum.Request,this._workflowSettings.LocationGroupingBehavior,this.__workflowEventCallbacks.onStopScheduling,null,i,null);case n.WorkflowTypesEnum.NewProvider:return new u(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings.AllowedDepartmentIds,this._workflowSettings.PreselectedDepartmentIds,t,u.ModesEnum.FilterOnSelectedSpecialtyAndReasonForVisit,this._workflowSettings.LocationGroupingBehavior,this.__workflowEventCallbacks.onStopScheduling,this._workflow.IsFavorite,i,null);case n.WorkflowTypesEnum.Procedure:return new u(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings.AllowedDepartmentIds,this._workflowSettings.PreselectedDepartmentIds,t,u.ModesEnum.FilterOnSelectedReasonForVisit,this._workflowSettings.LocationGroupingBehavior,this.__workflowEventCallbacks.onStopScheduling,this._workflow.IsFavorite,i,null);case n.WorkflowTypesEnum.ProviderFinder:case n.WorkflowTypesEnum.Widget:return t.Hide=!0,t.PreselectAllModels=!0,new u(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,[],this._workflowSettings.PreselectedDepartmentIds,t,u.ModesEnum.FilterOnSelectedReasonForVisit,this._workflowSettings.LocationGroupingBehavior,this.__workflowEventCallbacks.onStopScheduling,this._workflow.IsFavorite,i,null);default:return new u(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings.AllowedDepartmentIds,this._workflowSettings.PreselectedDepartmentIds,t,null,this._workflowSettings.LocationGroupingBehavior,this.__workflowEventCallbacks.onStopScheduling,this._workflow.IsFavorite,i,null)}},_getProviderStep:function(){var t={},r,u;$.extend(t,this._workflowSettings.ProviderStepSettings);r=i.ModesEnum.NoFiltering;u=i.ProvidersToUseEnum.Standard;switch(this._workflow.Type){case n.WorkflowTypesEnum.ProviderFinder:case n.WorkflowTypesEnum.Widget:t.Hide=!0;t.PreselectAllModels=!0;r=i.ModesEnum.FilterOnSelectedReasonForVisitAndLocation;break;case n.WorkflowTypesEnum.Procedure:t.Hide=this._workflowSettings.ProviderStepSettings.Hide;t.PreselectAllModels=!1;r=i.ModesEnum.FilterOnSelectedReasonForVisitAndLocation;break;case n.WorkflowTypesEnum.NewProvider:t.Hide=!0;t.PreselectAllModels=!0;r=i.ModesEnum.FilterOnSelectedReasonForVisitAndLocation;break;case n.WorkflowTypesEnum.ExistingProvider:u=i.ProvidersToUseEnum.Standard;break;case n.WorkflowTypesEnum.Ticket:t={ReadOnly:this._workflowSettings.ProviderStepSettings.ReadOnly,Collapse:this._workflowSettings.ProviderStepSettings.Collapse,CollapseIfOne:this._workflowSettings.ProviderStepSettings.CollapseIfOne,PreselectAllModels:!0,Hide:!0};r=i.ModesEnum.FilterOnSelectedLocation;u=i.ProvidersToUseEnum.All;break;case n.WorkflowTypesEnum.DecisionTreeNode:t={ReadOnly:this._workflowSettings.ProviderStepSettings.ReadOnly,Collapse:this._workflowSettings.ProviderStepSettings.Collapse,CollapseIfOne:this._workflowSettings.ProviderStepSettings.CollapseIfOne,Hide:!0,PreselectAllModels:!0};r=i.ModesEnum.FilterOnSelectedReasonForVisitAndLocation;u=i.ProvidersToUseEnum.All;break;case n.WorkflowTypesEnum.Request:r=i.ModesEnum.Request;break;case n.WorkflowTypesEnum.Reschedule:t.Hide=!0;t.HideIfOne=!0;t.PreselectAllModels=!0;r=i.ModesEnum.FilterOnSelectedReasonForVisitAndLocation;u=i.ProvidersToUseEnum.All;r=i.ModesEnum.FilterOnSelectedLocation;t.OriginalAppointmentInfo=this._workflow.OriginalAppointmentInfo;break;default:u=i.ProvidersToUseEnum.All}return new i(this._createStepContainer(),this._workflow.SchedulingDataPool,this._workflowSettings.AllowedProviderIds,this._workflowSettings.PreselectedProviderIds,t,r,u,this._workflow,this.__workflowEventCallbacks.onStopScheduling,this._workflow)},_getSpecialtyStep:function(){return new h(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,h.ModesEnum.NoFiltering,this._workflowSettings.AllowedSpecialtyIds,this._workflowSettings.PreselectedSpecialtyId,this._workflowSettings.SpecialtyStepSettings,!0)},_getJoinWaitListStep:function(){return new y(this._createStepContainer(),this._workflow,this._workflow.SchedulingDataPool,this._workflowSettings,this.__workflowEventCallbacks.onTicketWaitListPreferencesUpdated)},_createStepContainer:function(){return $$WP.SimpleTemplates.Div({"class":"jqHidden stepcontainer"})}};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.StepFactory=s;s.extend($$WP.Controllers.Controller,"WP$Scheduling$StepFactory")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=$$WP.Scheduling.SchedulingStep,i=$$WP.Scheduling.SidebarController,t=function(t,i,r,u,f,e,o){var s,y,h,c,p,l,a,v;for(this.$root=t,this._workflow=r,this._workflowSettings=u||{},this._dataPool=r.SchedulingDataPool||{},this._summarySteps=[],this.__onNavigateBack=f.onNavigateBack,this._isEmbeddedInAnotherMyChartWorkflow=u.IsEmbedded,this.WP$Scheduling$WorkflowController(t,!1,r,o,f.onBeforeUnloadChanged),this.proxify("_onStepActiveChanged","_onStepCompleteChanged","showNextStep","__handleStickyBanner","__onBackButtonClick","__onMobileBack","__onMobileClose"),y=new $$WP.Scheduling.StepFactory(this._workflow,this._workflowSettings,f,e),s=0;s<i.length;s++)i[s].isReadOnly?c="-1":(h=y.createStep(i[s].type,i[s].stackedSteps),this.addStep(h),$$WP.Scheduling.StepController.isInstance(h)&&h.addViewEventListener(this.__onViewEventTriggered),c=h.Id,h.$root.addClass("fadeIn delay"),this.$root.safeAppend(h.$root)),this._summarySteps.push({Id:c,summaryType:i[s].summaryType}),stepModel=n.addSchedulingStepToCollection(this._dataPool.SchedulingSteps,c,!1,"",i[s].type,i[s].isReadOnly,"",this._workflow.Type);Handlebars.registerPartial("Scheduling.EditLinkInline",$$WP.Templates.Scheduling.EditLinkInline);window.EpicPx=window.EpicPx||{};window.EpicPx.MobileIntegration=window.EpicPx.MobileIntegration||{};this.$root.safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.NavigationButtons,{IsStartOverButtonIncluded:this.__isStartOverButtonIncluded()}));p=this.$root.find(".startover");l=$afe.select("body").find("#scheduling-startover");a=p.add(l);v=this.$root.find("#scheduling-continue");this._isEmbeddedInAnotherMyChartWorkflow||r.isTypeOpenSchedulingWidget()?(a.remove(),this.hookupNavigationButtons(v,null,this.showNextStep)):(l.removeClass("hidden"),this.hookupNavigationButtons(v,a,this.showNextStep,this.startover));this.__setUpSummaryHeader(r);this.__setUpSidebar();$$WP.Utilities.UI.IsLoggedIn||this.__setUpPrelogin();this._startListening();$afe.jq(window).on("resize scroll click handleStickyBanner orientationchange",this.__handleStickyBanner)};t.prototype={$root:null,_workflow:null,_workflowSettings:null,_dataPool:null,_summarySteps:null,_stepActiveListenerId:null,_stepCompleteListenerId:null,_sidebarController:null,__onNavigateBack:null,_isEmbeddedInAnotherMyChartWorkflow:!1,activateStep:function(t){var i=this._dataPool.SchedulingSteps.getFromIndex("ID",t.Id);i.CompleteStatus!==n.CompleteEnum.NotRequired||i.ForceShowOnce?(this._stopListening(),i.setProperty("ActiveStatus",n.ActiveEnum.Active),this._startListening(),this._isEmbeddedInAnotherMyChartWorkflow&&!$$WP.Utilities.UI.IsMobile||$$WPSchedulingUtil.ScrollToTopOfPage(),t.show()):this.showNextStep();t.hasStickyBanner()?t.getSchedulingContinueBanner().addClass("stickybanner"):$afe.select(".continueBanner").css({left:"",width:""});this.__canStartOver()?$afe.select(".startover").removeClass("hidden"):$afe.select(".startover").addClass("hidden");$$WP.Utilities.UI.IsSelfTriageForAll||this.__setBeforeUnloadIfNotOnFirstStep();$$WPSchedulingUtil.SetPreloginTimeout()},__setBeforeUnloadIfNotOnFirstStep:function(){null!==this.__getPreviousVisibleStep()?this.setBeforeUnload():this.clearBeforeUnload()},__canStartOver:function(){return this.__canReturnToPreviousPage||null!==this.__getPreviousVisibleStep()},deactivateStep:function(t){var i=null;t&&(this._stopListening(),this.setPropertyOnStepAndChildren(t,"ActiveStatus",n.ActiveEnum.Active),this.setPropertyOnStepAndChildren(t,"ActiveStatus",n.ActiveEnum.Inactive),this._startListening(),(i=t.getSchedulingContinueBanner()).removeClass("stickybanner"),this.$root.parent().find(".startover").removeClass("fixToTop"),i.find(".selected-count").empty(),this.setPropertyOnStepAndChildren(t,"ForceShowOnce",!1),t.hide())},setPropertyOnStepAndChildren:function(t,i,r){var u=0,f=this._dataPool.SchedulingSteps.getFromIndex("ID",t.Id);if(f.Type===n.StepTypeEnum.MultiAppointment||f.Type===n.StepTypeEnum.Stacked)for(f.setProperty(i,r),u=0;u<t._stackedWorkflowController._stepControllers.length;u++)this.setPropertyOnStepAndChildren(t._stackedWorkflowController._stepControllers[u],i,r);else f.setProperty(i,r)},destroy:function(n){var t=0;for(n||this.deactivateStep(this.getCurrentStep()),t=0;t<this._stepControllers.length;t++)this._stepControllers[t].onWorkflowDestroyed();this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.Reschedule&&$$WP.Scheduling.OriginalAppointmentInfoController.Destroy();this.clearBeforeUnload();$$WPSchedulingUtil.ClearPreloginTimeout();this._stopListening();this.$root.off("click","a.summary-back",this.__onBackButtonClick);window.EpicPx.MobileIntegration.onMobileBack=null;window.EpicPx.MobileIntegration.onMobileClose=null;n||(this.$root.empty(),this._sidebarController&&this._sidebarController._linksSidebarWidget.remove())},startOver:function(){"function"==typeof this.__onNavigateBack&&this.__onNavigateBack()},isComplete:function(t){return this._dataPool.SchedulingSteps.getFromIndex("ID",t).CompleteStatus===n.CompleteEnum.Complete||this._dataPool.SchedulingSteps.getFromIndex("ID",t).CompleteStatus===n.CompleteEnum.NotRequired},__setUpSummaryHeader:function(n){var i=$$WP.SimpleTemplates.Div({"class":"summaryBannerContainer"}),t=0,r=!1;n.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.NewProvider&&n.IsAnonymous||n.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.ProviderFinder&&n.IsAnonymous?(t=$$WP.Scheduling.SummaryHeader.DisplayModeEnum.Condensed,r=!0):n.isTypeOpenSchedulingWidget()?(t=$$WP.Scheduling.SummaryHeader.DisplayModeEnum.NoSubway,r=!0):t=$$WP.Scheduling.SummaryHeader.DisplayModeEnum.Standard;this.$root.safePrepend(i);new $$WP.Scheduling.SummaryHeader(t,i,this._summarySteps,this._dataPool,this._workflow);r&&($afe.renderTemplate($$WP.Templates.Scheduling.SummaryNavigationBar).safeInsertAfter(i),this.$root.on("click","a.summary-back",null,this.__onBackButtonClick));window.EpicPx.MobileIntegration.onMobileBack=this.__onMobileBack;window.EpicPx.MobileIntegration.onMobileClose=this.__onMobileClose;$$WP.Utilities.UI.IsMobile||n.Type!==$$WP.Scheduling.Workflow.WorkflowTypesEnum.OnDemandTelehealth||this.$root.safePrepend($$WP.SimpleTemplates.Div({id:"telehealthBannerWeb"}))},__setUpSidebar:function(){var n;!this._isEmbeddedInAnotherMyChartWorkflow&&$$WP.Utilities.UI.IsLoggedIn&&(n=$$WP.Utilities.UI.SidebarManager.addWidget($$WP.Templates.Scheduling.SchedulingSidebarLinks,{},3,!1),this._sidebarController=new i(n,this._workflow,this._workflowSettings))},__setUpPrelogin:function(){$afe.jq(document).off("ajaxStart ajaxEnd");$afe.select(".startover,.backbutton").addClass("hidden")},_onStepCompleteChanged:function(t){var f="",e=0,u=0,i=null,r=null;for(f in t){if(e=t[f].from,u=t[f].to,i=t[f].model,r=this.getCurrentStep(),!i)return;e===u||u!==n.CompleteEnum.Complete&&u!==n.CompleteEnum.NotRequired||i.IsStacked||i.IsAdHoc||r.Id!==i.ID?u!==n.CompleteEnum.Incomplete||i.IsStacked||i.IsAdHoc||i.ID!==r.Id||(this.$root.find("#scheduling-continue").hide(),this.$root.removeClass("hasFloatingNavigation"),r.getSchedulingContinueBanner().removeClass("stickybanner"),this.$root.find(".startover").removeClass("fixToTop")):(r.shouldRemainOnStep()?(this.$root.find("#scheduling-continue").show(),r.getSchedulingContinueBanner().addClass("stickybanner")):this.showNextRequiredStep(),this.__canStartOver()&&$afe.select(".startover,.backbutton").removeClass("hidden"))}},showNextRequiredStep:function(){do this.showNextStep();while(this.__stepIsNotRequired())},__stepIsNotRequired:function(){return this._currentStep<this._stepControllers.length-1&&this._dataPool.SchedulingSteps.getFromIndex("ID",this.getCurrentStep().Id).CompleteStatus===n.CompleteEnum.NotRequired},__onMobileBack:function(){this.showPrevVisibleStep()},__onMobileClose:function(){$$WPUtil.TryRedirect(makeLink("inside.asp?moworkflow=completeandclose"))},__onBackButtonClick:function(n){n.preventDefault();this.showPrevVisibleStep()},onNavigateBack:function(){this._stepControllers[this._currentStep].onNavigateBack()},showPrevVisibleStep:function(){var n;n=this.__getPreviousVisibleStep();this.onNavigateBack();n||0===n?(this._stepControllers[n].beforeNavigateBack(),this._showStepInArray(n)):!$$WP.Utilities.UI.IsMobile||this.__canReturnToPreviousPage||this._isEmbeddedInAnotherMyChartWorkflow?this.startOver():$$WPUtil.TryRedirect(makeLink("inside.asp?moworkflow=completeandclose"))},__getPreviousVisibleStep:function(){return $$WPSchedulingUtil.GetPreviousVisibleStep(this._currentStep,this._stepControllers,this._dataPool)},_onStepActiveChanged:function(t){var i,f,u,r;for(i in t)f=t[i].from,u=t[i].to,r=t[i].model,u===f||u!==n.ActiveEnum.Active||r.IsStacked||this.showStep(r.ID,r.IsStacked)},_startListening:function(){this._stepActiveListenerId=this._dataPool.SchedulingSteps.addPropertyListener("ActiveStatus",this._onStepActiveChanged);this._stepCompleteListenerId=this._dataPool.SchedulingSteps.addPropertyListener("CompleteStatus",this._onStepCompleteChanged)},_stopListening:function(){this._dataPool.SchedulingSteps.removePropertyListener("ActiveStatus",this._stepActiveListenerId);this._dataPool.SchedulingSteps.removePropertyListener("CompleteStatus",this._stepCompleteListenerId)},__handleStickyBanner:function(){var r=this.getCurrentStep(),t=r.getContinueButton(this.$root),u=t.is(":hidden"),f=t.is("[disabled]"),n=t.closest(".stickybanner"),i=null,e="rtl"===$afe.select("html").safeAttr("dir"),o=window.innerHeight||document.documentElement.clientHeight;if(n.length){if(this.__toggleStartOverButtonVisibility(n),u||isDataTile()||isCustomBranded()||$$WP.WidgetMode||f||this._isEmbeddedInAnotherMyChartWorkflow&&this.$root[0].getBoundingClientRect().top>o)return n.addClass("static"),n.addClass("continueHidden"),n.css({left:"",width:""}),n.css({}),void this.__toggleStartOverButtonVisibility(n);if(n.removeClass("continueHidden"),this._isEmbeddedInAnotherMyChartWorkflow){if(this.__isOneOfMultipleEmbedded())return;$$WP.Utilities.UI.IsMobile||(n.css({left:this.$root[0].getBoundingClientRect().left}),n.innerWidth(this.$root.innerWidth()))}else i=$afe.select("#main"),$$WP.Utilities.UI.IsMobile||(n.css({left:i.offset().left}),n.innerWidth(i.innerWidth()),e&&n.css({right:"auto"}));n.hasClass("static")&&!this.__isBannerOnScreen(n)?n.removeClass("static"):!n.hasClass("static")&&0!==this.$root[0].getBoundingClientRect().bottom&&this.__isButtonInNaturalPosition(n)&&(n.addClass("static"),$afe.jq(window).trigger("resize"));n.hasClass("static")&&n.css({left:"",width:""});this.__toggleStartOverButtonVisibility(n);r.setCurrentSelectionCountInBanner()}},__isBannerOnScreen:function(n){var t=n.find(".schedulebutton-separator");return(0==t.length||t.is(":hidden"))&&(t=n),t[0].getBoundingClientRect().bottom<=window.innerHeight},__isButtonInNaturalPosition:function(n){var t=null;return(0==(t=n.siblings(".sentinelDiv")).length?this.$root[0].getBoundingClientRect().bottom:t[0].getBoundingClientRect().top)<=n[0].getBoundingClientRect().top},__isStartOverButtonIncluded:function(){var n=this._workflow.Type===$$WP.Scheduling.Workflow.WorkflowTypesEnum.NewProvider&&this._workflow.IsAnonymous,t=$$WP.Utilities.UI.IsMobile,i=this._workflow.isTypeOpenSchedulingWidget();return!n&&!t&&!i},__toggleStartOverButtonVisibility:function(n){var t=null;this.getCurrentStep().isUsingWorkflowNavigation()||(t=this.$root.find(".startover"),n.hasClass("static")?t.removeClass("fixToTop"):t.addClass("fixToTop"))},__isOneOfMultipleEmbedded:function(){return $afe.select(".actionNode.container").length>1}};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.SchedulingWorkflowController=t;t.extend($$WP.Scheduling.WorkflowController,"WP$Scheduling$SchedulingWorkflowController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=$$WP.Scheduling.SchedulingStep,t=function(n,t,i,r,u,f,e){var o=$$WP.SimpleTemplates.Div({"class":"stepcontainer"});this.__dataPool=i;this.__workflowEventCallbacks=f;this.__onCloseCallback=e;this.__step=n;this.__hostId=t;this.__workflowSettings=u;this.WP$Scheduling$WorkflowController(o,!0,r,!1);this.proxify("__onStepCompleteChanged","__onClosePopupClicked")};t.prototype={stepId:"",__dataPool:null,__workflowEventCallbacks:null,__onCloseCallback:null,__step:null,__hostId:null,__stepCompleteListenerId:"",__$stepContainer:null,__stepController:null,__workflowSettings:null,__popupComponent:null,renderInPopup:function(t){var r,u,i;this.__$stepContainer||this.__createStep();this.__popupComponent=new $$WPComp.ConfirmComponent({IsClosable:!0,TitleText:t,forcePrompt:!0,Html:'<div class="adHocStep"><\/div>',callback:this.__onClosePopupClicked,ToolbarButtons:[]});r={Size:$$WPContain.Popup.SizeEnum.MEDIUM,canResetFocusOnKeydown:!0};i=$$WPUtil.quickPopup(this.__popupComponent,r);u="[data-id='"+$$WPComp.TITLEBARIDENTIFIER+"close']";i.$container.on("click",u,this.__onClosePopupClicked);$afe.select(".lightbox_overlay").on("click",this.__onClosePopupClicked);i.$container.safeAppend(this.$root);$afe.select(".adHocStep").safeAppend(this.__$stepContainer);this.__stopListening();this._stepControllers[0].setComplete(n.CompleteEnum.Incomplete);this.__startListening();this.render()},__onClosePopupClicked:function(){this.destroy();"function"==typeof this.__onCloseCallback&&this.__onCloseCallback()},__createStep:function(){var t=null;t=new $$WP.Scheduling.StepFactory(this._workflow,this.__workflowSettings,this.__workflowEventCallbacks);this.__stepController=t.createStep(this.__step.type,this.__step.stackedSteps);this.addStep(this.__stepController);$$WP.Scheduling.StepController.isInstance(this.__stepController)&&this.__stepController.addViewEventListener(this.__onViewEventTriggered);this.stepId=this.__stepController.Id;this.__$stepContainer=this.__stepController.$root;n.addSchedulingStepToCollection(this.__dataPool.SchedulingSteps,this.stepId,!1,"",this.__step.type,this.__step.isReadOnly,this.__hostId)},__startListening:function(){this.__stepCompleteListenerId=this.__dataPool.SchedulingSteps.addPropertyListener("CompleteStatus",this.__onStepCompleteChanged)},__onStepCompleteChanged:function(t){var i,e,r,u,f;for(i in t)e=t[i].from,r=t[i].to,u=t[i].model,f=this.getCurrentStep(),u&&u.IsAdHoc&&(e===r||r!==n.CompleteEnum.Complete&&r!==n.CompleteEnum.NotRequired||f.Id!==u.ID||f.shouldRemainOnStep()||this.destroy())},__stopListening:function(){this.__dataPool.SchedulingSteps.removePropertyListener("CompleteStatus",this.__stepCompleteListenerId)},destroy:function(){this.clearBeforeUnload();this.__stopListening();this.$root.detach();this.__activateHostStep()},__activateHostStep:function(){hostStep=this.__dataPool.SchedulingSteps.getFromIndex("ID",this.__hostId);hostStep&&hostStep.setProperty("ActiveStatus",$$WP.Scheduling.SchedulingStep.ActiveEnum.Active);this.__popupComponent.dispose()},activateStep:function(t){var i=this.__dataPool.SchedulingSteps.getFromIndex("ID",t.Id);this.__stopListening();i.setProperty("ForceShowOnce",!0);i.setProperty("ActiveStatus",n.ActiveEnum.Active);this.__startListening();t.show()},deactivateStep:function(t){if(t){this.__stopListening();var i=this.__dataPool.SchedulingSteps.getFromIndex("ID",t.Id);i.setProperty("ActiveStatus",n.ActiveEnum.Active);i.setProperty("ActiveStatus",n.ActiveEnum.Inactive);this.__startListening();i.setProperty("ForceShowOnce",!1);t.hide()}},isComplete:function(t){return this.__dataPool.SchedulingSteps.getFromIndex("ID",t).CompleteStatus===n.CompleteEnum.Complete||this.__dataPool.SchedulingSteps.getFromIndex("ID",t).CompleteStatus===n.CompleteEnum.NotRequired}};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.AdHocStepWorkflowController=t;t.extend($$WP.Scheduling.WorkflowController,"WP$Scheduling$AdHocStepWorkflowController")}();!function(){var r=$$WP.Scheduling.StepFactory,n=$$WP.Scheduling.SchedulingStep,u=$$WP.Scheduling.Workflow,i=function(n,i,f,e,o,s,h){var c=0;for(this.$root=n,this._dataPool=f.SchedulingDataPool||{},this._stackId=s,this._mode=o||t.ShowOneAtATime,this.WP$Scheduling$WorkflowController(n,f.Type===u.WorkflowTypesEnum.OnDemandTelehealth,f),this.proxify("_onStepCompleteChanged"),this._stepFactory=new r(f,e,h),c=0;c<i.length;c++)this.createStepAndAddToDom(i[c]);this._dataPool.SchedulingSteps.addPropertyListener("CompleteStatus",this._onStepCompleteChanged)},f={$root:null,_dataPool:null,_stackId:null,_stepFactory:null,_mode:0,createStepAndAddToDom:function(t){var i=null;return i=this._stepFactory.createStep(t.type,t.stackedSteps),this.addStep(i),i.addViewEventListener(this.__onViewEventTriggered),n.addSchedulingStepToCollection(this._dataPool.SchedulingSteps,i.Id,!0,this._stackId,t.type),this.$root.safeAppend(i.$root),i},destroyStepAndRemoveFromDom:function(n){this.removeStep(n);this._dataPool.SchedulingSteps.remove(this._dataPool.SchedulingSteps.getFromIndex("ID",n.Id));n.$root.remove()},activateStack:function(){switch(this._mode){case t.ShowOneAtATime:this.activateUpToCurrentStep();break;case t.ShowAllAtOnce:this.activateAllSteps()}},activateStep:function(n){n.show()},deactivateStep:function(n,t){n&&t&&n.hide($$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)},showNextIncompleteStep:function(){for(;this._currentStep<this._stepControllers.length-1&&this._dataPool.SchedulingSteps.getFromIndex("ID",this.getCurrentStep().Id).CompleteStatus!==n.CompleteEnum.Incomplete;)this.showNextStep()},_onStepCompleteChanged:function(i){var u,e,r,f;for(u in i)e=i[u].from,r=i[u].to,(f=i[u].model||$$WP.Common.Model.getInstance(u))&&f.IsStacked&&f.StackId===this._stackId&&(e===r||r!==n.CompleteEnum.Complete&&r!==n.CompleteEnum.NotRequired?e!==r&&r===n.CompleteEnum.Incomplete&&this._mode===t.ShowOneAtATime&&this.deactivateRange(f.ID):this.showNextIncompleteStep())}},t={ShowOneAtATime:0,ShowAllAtOnce:1};i.prototype=f;$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.StackedWorkflowController=i;$$WP.Scheduling.StackedWorkflowController.ModesEnum=t;i.extend($$WP.Scheduling.WorkflowController,"WP$Scheduling$StackedWorkflowController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var t={None:0,ReasonForVisit:1,Location:2,Time:3,Provider:4,Questionnaire:5,Confirmation:6,Request:7,TelehealthLocation:8,QuickSchedule:9,TelehealthOrganization:10,TelehealthSummary:11,Ticket:12,TelehealthPlatform:13,Specialty:14,InsuranceVerification:15},n={Incomplete:0,Complete:1,Inactive:2},i={Standard:0,Condensed:1,NoSubway:2},r=function(n,t,i,r,u){this.WP$Controllers$Controller();this.$root=t;this._steps=i;this._dataPool=r;this._workflow=u;this._summaryTemplate=$$WP.Templates.Scheduling.SummaryHeader;this._displayMode=n;this.proxify("_update","_onSummaryClick","_updateBuffer","_onAppointmentsChanged","_matchHeights");this._eventManager=new $$WP.Scheduling.EventManager;this._dataPool.AppointmentBuilder.Appointments.addCollectionEventListener("add",this._onAppointmentsChanged);this._dataPool.AppointmentBuilder.Appointments.addCollectionEventListener("remove",this._onAppointmentsChanged);this._dataPool.AppointmentBuilder.addPropertyListener("ReasonForVisit",this._updateBuffer);this._dataPool.AppointmentBuilder.addPropertyListener("Specialty",this._updateBuffer);this._dataPool.SchedulingSteps.addPropertyListener("CompleteStatus",this._updateBuffer);this._dataPool.SchedulingSteps.addPropertyListener("ActiveStatus",this._updateBuffer);this.$root.click(this._onSummaryClick);$afe.jq(window).on("resize",this._matchHeights);this._onAppointmentsChanged();this._update()};r.prototype={$root:null,_steps:null,_dataPool:null,_workflow:null,_summaryTemplate:null,_previouslyActiveStepId:null,_previouslyActiveStepIndex:null,_timerId:null,_eventManager:null,_displayMode:null,_currentStepNumber:0,_onAppointmentsChanged:function(){var t=0,n=null;for(this._eventManager.removeAllListeners(),t=0;t<this._dataPool.AppointmentBuilder.numAppointments();t++)n=this._dataPool.AppointmentBuilder.getAppointment(t),this._eventManager.addCollectionEventListener(n.Providers,"add",this._updateBuffer),this._eventManager.addCollectionEventListener(n.Providers,"remove",this._updateBuffer),this._eventManager.addCollectionEventListener(n.Locations,"add",this._updateBuffer),this._eventManager.addCollectionEventListener(n.Locations,"remove",this._updateBuffer)},_update:function(){var i,r,t,n,u;if(this.$root.empty(),i=this._getViewModel(),r=$afe.renderTemplate(this._summaryTemplate,i),this.$root.safeAppend(r),t=this._getFirstActiveStep(i.Steps))for(this._previouslyActiveStepId=t.Id,this._previouslyActiveStepIndex=0,this._currentStepNumber=t.Index,n=0;n<this._steps.length;n++)if(this._steps[n].Id===t.Id){this._previouslyActiveStepIndex=n;break}u=$afe.jq($afe.select("#header-accessible-text")).text();$afe.jq($afe.select("span.header-accessible-span")).text(u);this._matchHeights()},_updateBuffer:function(){clearTimeout(this._timerId);this._timerId=setTimeout(this._update,0)},_getViewModel:function(){var n={},f=this._dataPool.AppointmentBuilder.ReasonForVisit,r=this._getSlotsViewModel(),t=this._getHeaderComponentsViewModel(),e=this._getLocationsViewModel(),o=this._getProvidersViewModel(),s=this._getSpecialtyViewModel(),h=1===r.length&&r[0].IsRequest,u;if(n={ShouldShow:t.length>0&&this._displayMode!==i.NoSubway,Steps:t,Locations:e,ReasonForVisit:f,Providers:o,Specialty:s,Slots:r,numSteps:t.length,Title:this._workflow.Title,TicketInfo:this._workflow.TicketInfo,TelehealthSelectedPlatformString:this._dataPool.TelehealthData.TelehealthSelectedPlatformString,IsAnonymous:this._workflow.IsAnonymous,IsRequestWorkflow:h,IsCondensed:this._displayMode===i.Condensed,UseInsuranceForVisit:"0"!==this._dataPool.AppointmentBuilder.UseInsuranceForVisit,SchedulingWorkflowProgress:this.getProgressEstimate(t)},u=this._dataPool.TelehealthData.SelectedWorkflow,this._dataPool.TelehealthLocations&&this._dataPool.TelehealthLocations.Models&&this._dataPool.TelehealthLocations.Models.length>0){var c=this._dataPool.TelehealthLocations.getFirstInIndex("State",$$WP.Scheduling.TelehealthLocation.StatesEnum.Selected),l=this._dataPool.TelehealthOrganizations.getFirstInIndex("State",$$WP.Scheduling.TelehealthOrganization.StatesEnum.Selected),a=u===$$WP.Scheduling.TelehealthData.TelehealthWorkflow.Queueing;n.TelehealthLocation=c;n.TelehealthOrganization=l;a?n.ProviderName=$$WP.Strings.get("NextProvider","ondemandtelehealth"):this._dataPool.TelehealthData.SelectedProviderName&&(n.ProviderName=this._dataPool.TelehealthData.SelectedProviderName)}return n},_getHeaderComponentsViewModel:function(){var f,e=[],i=0,r=null,t=null,u=0;for(u=-1,reasonForVisit=this._dataPool.AppointmentBuilder.ReasonForVisit,f=this._dataPool.AppointmentBuilder.getFirstAppointment().Slot,i=0;i<this._steps.length;i++)r=this._dataPool.SchedulingSteps.getFromIndex("ID",this._steps[i].Id),(t=this._steps[i]).IsActive=!1,t.Animate=!1,t.AnimateBack=!1,t.CanBeSelected=!1,this.__isStepIncludedInHeaderEvaluation(r,t,f)&&(u>-1?t.Status=n.Inactive:this._isStepOrChildActive(r)||r.CompleteStatus===$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete?(u=i,t.Status=n.Incomplete,r.IsReadOnly||(t.CanBeSelected=!0)):(t.Status=n.Complete,r.IsReadOnly||(t.CanBeSelected=!0)),this._isStepOrChildActive(r)&&(t.IsActive=!0,this._previouslyActiveStepIndex>i?t.AnimateBack=!0:(this._previouslyActiveStepIndex<i||null===this._previouslyActiveStepIndex)&&(t.Animate=!0)),this.__isStepIncludedInHeaderDisplay(t)&&e.push(t));return e},__isStepIncludedInHeaderEvaluation:function(n,i,r){var u=!0;return(n.CompleteStatus===$$WP.Scheduling.SchedulingStep.CompleteEnum.NotRequired&&!n.ForceShowOnce||i.summaryType===t.Confirmation&&r&&!0===r.IsRequest||i.summaryType===t.Provider&&!this.__showProviderStepInSubway())&&(u=!1),u},__showProviderStepInSubway:function(){return this._allowProviderSelectForAnyAppointment()&&this.__canVisitTypeShowProvStep()},__canVisitTypeShowProvStep:function(){var n=0,t=null,i=this._dataPool.AppointmentBuilder,r=!1;if(this._workflow.Type!==$$WP.Scheduling.Workflow.WorkflowTypesEnum.Procedure)return!0;for(n=0;n<i.numAppointments();n++)(t=i.getAppointment(n).VisitType)&&t.AllowProviderStepInDirectSched&&(r=!0);return r},__isStepIncludedInHeaderDisplay:function(n){var u=!1,r=this._dataPool.SchedulingSteps.getFromIndex("ID",n.Id);return(n.summaryType&&n.summaryType!==t.None||n.IsActive&&this._displayMode===i.Condensed)&&(u=!0),n.IsActive||$$WPUtil.IsNullOrEmpty(r)||!r.IsHiddenUntilActive||r.CompleteStatus!==$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete||(u=!1),n.IsActive||$$WPUtil.IsNullOrEmpty(r)||!r.IsHiddenAfterCompletion||r.CompleteStatus!==$$WP.Scheduling.SchedulingStep.CompleteEnum.Complete||(u=!1),u},_allowProviderSelectForAnyAppointment:function(){for(var n=0,r=null,t=!1,i=this._dataPool.AppointmentBuilder,n=0;n<i.numAppointments();n++)r=i.getAppointment(n),t=t||$$WP.Scheduling.Workflow.allowProviderSelectForAppointment(i,r);return t},_getLocationsViewModel:function(){return $$WPSchedulingUtil.GetLocationsSummaryArray(this._dataPool)},_getProvidersViewModel:function(){return $$WPSchedulingUtil.GetProvidersSummaryArray(this._dataPool)},_getSpecialtyViewModel:function(){return this._dataPool.AppointmentBuilder.Specialty},_getFirstActiveStep:function(n){for(var i=null,t=0,t=0;t<n.length;t++)if((i=n[t]).IsActive)return i.Index=t,i;return null},_getSlotsViewModel:function(){for(var t=[],n=0,i=null,n=0;n<this._dataPool.AppointmentBuilder.numAppointments();n++)(i=this._dataPool.AppointmentBuilder.getAppointment(n)).Slot&&t.push(i.Slot);return $$WPSchedulingUtil.TrimViewModelArray(t,1)},_isStepOrChildActive:function(n){var t;return n.ActiveStatus===$$WP.Scheduling.SchedulingStep.ActiveEnum.Active||(t=this._dataPool.SchedulingSteps.getFirstInIndex("ActiveStatus",$$WP.Scheduling.SchedulingStep.ActiveEnum.Active),!($$WPUtil.IsNullOrEmpty(t)||t.StackId!==n.ID&&t.HostId!==n.ID))},_matchHeights:function(){var n,t;(n=$afe.select(".summaryInfo")).css("minHeight");t=0;n.css("minHeight","");n.each(function(){$afe.jq(this).outerHeight()>t&&(t=$afe.jq(this).outerHeight())});n.css("minHeight",t)},_onSummaryClick:function(n){var t,i=0;WP.Events.preventDefault(n);this._dataPool.IsSchedulingCompleting||(t=parseInt($afe.jq(n.target).closest("[data-model-id]").safeAttr("data-model-id")),this.__isStepSelectable(t)&&(t!==this._previouslyActiveStepId&&(this._dataPool.BlockDemographicInsuranceVerification=!0),i=this.__getRequiredStepIdBetweenActiveAndClicked(t),this._dataPool.SchedulingSteps.getFromIndex("ID",i).setProperty("ActiveStatus",$$WP.Scheduling.SchedulingStep.ActiveEnum.Active)))},__getRequiredStepIdBetweenActiveAndClicked:function(n){for(var r=0,u=0,t=0,i=0,t=0;t<this._steps.length;t++)(i=this._steps[t].Id)===this._previouslyActiveStepId&&(r=t),i===n&&(u=t);for(t=r;t<u;t++)if(i=this._steps[t].Id,this._dataPool.SchedulingSteps.getFromIndex("ID",i).CompleteStatus===$$WP.Scheduling.SchedulingStep.CompleteEnum.Incomplete)return i;return n},__isStepSelectable:function(n){for(var t=0,r=null,i=this._getHeaderComponentsViewModel(),t=0;t<i.length;t++)if((r=i[t]).Id===n)return r.CanBeSelected;return!1},getProgressEstimate:function(t){var i=0,r=0,u=0;for($$WPUtil.IsNullOrEmpty(t)&&(t=this._getHeaderComponentsViewModel()),r=t.length,i=0;i<t.length;i++)t[i].Status===n.Complete&&u++;return this._workflow.isTypeOpenScheduling()&&this._workflow.IsAnonymous&&(u++,r++),$$WPSchedulingUtil.GetRoughProgressThroughWorkflow(u,r)}};$$WP.Scheduling.SummaryHeader=r;$$WP.Scheduling.SummaryHeader.SummaryComponentEnum=t;$$WP.Scheduling.SummaryHeader.StatusEnum=n;$$WP.Scheduling.SummaryHeader.DisplayModeEnum=i;r.extend($$WP.Controllers.Controller,"WP$Scheduling$SummaryHeader")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(n){!function(n){!function(n){var i=function(){},t;n.AnonymousSchedulingControllerParameters=i;t=function(){};n.AnonymousSchedulingSettings=t}(n.Scheduling||(n.Scheduling={}))}(n.PatientEngagement||(n.PatientEngagement={}))}(Epic||(Epic={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();!function(n){!function(t){!function(t){var i=function(t){function i(n,i){var r=t.call(this)||this;return r.__$root=n,r.__schedulingControllerParameters=i,r}return __extends(i,t),i.prototype.Render=function(){if($afe.select(i.schedulingWorkflowContainerSelector).hide(),!$$WPUtil.canWriteCookies())return this.__$root.hide(),self===top?$afe.select("#noCookiesError").show():$afe.select("#noCookies").show(),void $afe.select("#splashPage").hide();"OnDemandTelehealth"===this.__schedulingControllerParameters.workflow&&(this.__splashPageImplementation=new n.PatientEngagement.Scheduling.OnDemandTelehealth.SplashPageController(this.__$root,this.__schedulingControllerParameters));this.__splashPageImplementation&&(this.proxify("__SettingsLoaded"),$.post({url:makeLink("Scheduling/Anonymous/GetAnonymousSchedulingSettings"),cache:!1,success:this.__SettingsLoaded}))},i.prototype.__SettingsLoaded=function(n){this.__splashPageImplementation.Render($afe.select("#splashText"),n,$.proxy(this.__ContinueCallback,this))},i.prototype.__ContinueCallback=function(n){n&&(this.__schedulingControllerParameters=n);this.__schedulingControllerParameters.embedded=!0;this.__schedulingControllerParameters.isAnonymous=!0;$.post({url:makeLink("Scheduling/Anonymous/LogAnonymousUsage"),data:{workflow:this.__schedulingControllerParameters.workflow},cache:!1});this.__$root.hide();var t=$afe.select(".back");t&&t.hide();$afe.select("#anonymous-scheduling-startover").removeClass("hidden");$afe.select("#startOverMobile").removeClass("hidden");$afe.select(i.schedulingWorkflowContainerSelector).show();new $$WP.Scheduling.SchedulingController($afe.select(i.schedulingWorkflowContainerSelector),this.__schedulingControllerParameters)},i.schedulingWorkflowContainerSelector="#scheduling-workflow-container",i}($$WP.Controllers.Controller);t.AnonymousSchedulingController=i}(t.Scheduling||(t.Scheduling={}))}(n.PatientEngagement||(n.PatientEngagement={}))}(Epic||(Epic={}));!function(){var l=$$WP.Controllers.Controller,n=$$WP.Scheduling.Workflow,i=$$WP.Scheduling.SchedulingStep.StepTypeEnum,a=$$WP.Scheduling.SchedulingWorkflowController,t=$$WP.Scheduling.SummaryHeader.SummaryComponentEnum,u=$$WP.Analytics.ViewEvent,v=$$WP.Analytics.ThirdPartyViewEvent,r=function(n,t,i,r,u){var e="Scheduling/GetSchedulingWorkflowData",f;if(this.WP$Controllers$Controller(),this.__addQueryStringParamsData(t),this.__parseInputParams(t),this.__isAnonymous){if(!$$WPUtil.canWriteCookies()&&!$$WP.WidgetMode)return void this.__showCookieErrorToUser();e="Scheduling/Anonymous/GetSchedulingWorkflowData";this.__parseAnonymousSettings(t);this.__removePreloginSpinnerForWorkflowsThatBringTheirOwnFromHome(t)}(this.$schedulingContainer=n,this.$schedulingContainer.safeAppend(this.__createAnnouncementContainer()),this.$root=this.__createContainer(),this.$schedulingContainer.safeAppend(this.$root),this.$root.show(),this.$root.safeAttr("id","scheduling-workflow"),this.$root.addClass("section"),this.$root.empty(),this.proxify("__onWorkflowSelected","__onRequestCompleted","__onTicketWaitListPreferencesUpdated","__onStopScheduling","__onDataLoaded","__onSchedulingComplete","__onStartOver","__onError","__onWorkflowStepError","__onReturn","__onViewEventTriggered","__getSchedulingCompleteParams"),this.__externalWorkflowEventCallbacks=u||{},this.__externalWorkflowEventCallbacks.onSchedulingComplete=this.__externalWorkflowEventCallbacks.onSchedulingComplete||i,this.__workflowEventCallbacks=this.__buildWorkflowEventCallbacks(this.__externalWorkflowEventCallbacks),this.__setSpinnerMember(),this.__isEmbedded)?$$WP.Utilities.UI.IsMobile||this.$root.addClass("scheduling-embedded"):(f=document.getElementsByClassName("previousstep")[0],f&&f.classList.add("hidden"),$$WP.Utilities.UI.IsMobile&&$$WP.Utilities.Mobile.Optimization.SetMobileBG());"OnDemandTelehealth"===t.workflow&&this.__hasDenyJoiningVideoVisitSecPoint?this.__showLackOfVideoVisitSecurityError():r?this.__onDataLoaded(r):($$WPSchedulingUtil.HideBackButton(),$$WPUtil.ShowAjaxSpinner(this.$workflowAjaxSpinner),this.__getSchedulingWorkflowDataLoader=$.post({url:makeLink(e),data:{schedulingParameters:t,disableUTF8:t.disableUTF8,nonce:$$WPUtil.GetPageNonce()},cache:!1,error:this.__onError,success:this.__onDataLoaded}))},f={VisitScheduled:0,VisitRequested:1,NotScheduled:2},s={HasNoLicensedTelehealthProviders:0,DoesNotMeetMinSignupAge:1},y={$schedulingContainer:null,$root:null,__getSchedulingWorkflowDataLoader:null,__schedulingControllerParams:null,__workflowSettings:null,__workflows:null,__workflowSelectionListenerId:null,__landingPageController:null,$workflowsContainer:null,$schedulingStoppedContainer:null,$workflowAjaxSpinner:null,__schedulingWorkflowController:null,__sidebarController:null,__linksSidebarWidget:null,__preventAppendingErrorMessageOnStop:!1,__isEmbedded:!1,__isAnonymous:!1,__isGuest:!1,__hasDenyJoiningVideoVisitSecPoint:!1,__anonymousSettings:null,__mobileCloseURL:"Home/LogOut",__workflowEventCallbacks:{},__externalWorkflowEventCallbacks:{},Destroy:function(){this.__getSchedulingWorkflowDataLoader&&this.__getSchedulingWorkflowDataLoader.abort();this.__schedulingWorkflowController&&(this.__schedulingWorkflowController.destroy(),this.__schedulingWorkflowController=null);this.$schedulingContainer.empty();this.__closeAllPopups()},__closeAllPopups:function(){for(var t=[],n=0,i=null,t=document.querySelectorAll(".Popup.component"),n=0;n<t.length;n++)null!==(i=$$WPComp.getInstance(t[n].getAttribute("data-component-id")))&&$$WPComp.isComponent(i)&&i.dispose(!1)},__setSpinnerMember:function(){this.$workflowAjaxSpinner=$afe.select(".ajaxspinner.defaultajaxoverlay");0===this.$workflowAjaxSpinner.length&&(this.$workflowAjaxSpinner=$afe.select(".ajaxspinner"));this.$workflowAjaxSpinner.length>1&&(this.$workflowAjaxSpinner=this.$workflowAjaxSpinner.first())},__onDataLoaded:function(t){if($$WPUtil.IsNullOrEmpty(t)&&"OnDemandTelehealth"===this.__schedulingControllerParams.workflowType&&this.__onError(),this.__workflowSettings=t.WorkflowSettings,this.__workflowSettings.IsEmbedded=this.__isEmbedded,this.__getSchedulingWorkflowDataLoader=null,$$WPUtil.IsNullOrEmpty(t))this.__onStopScheduling();else if(t.LoadError)this.__handleLoadError(t.LoadError.ErrorCode);else if(this.__workflowSettings.WorkflowType===$$WP.Scheduling.Workflow.WorkflowTypesEnum.NewProvider&&0===t.Specialties.length)this.__onError();else{if($$WPUtil.HideAjaxSpinner(this.$workflowAjaxSpinner),this.__setUpMobileCloseUrl(),this.__workflowSettings.WorkflowType===n.WorkflowTypesEnum.OnDemandTelehealth&&(!$$WPUtil.IsNullOrEmpty(t.OnDemandTelehealthData.OnDemandVideoVisitCSN)||t.OnDemandTelehealthData.InXOrgQueue||t.OnDemandTelehealthData.OnDemandVideoVisitError))return void this.__launchScheduledTelemedicine(t);this.__workflowSettings.WorkflowType!==n.WorkflowTypesEnum.OnDemandTelehealth||$$WPUtil.IsNullOrEmpty(t.OnDemandTelehealthData.ExistingVideoVisitCSN)||this.__schedulingControllerParams.isFromSelfTriageLandingPage||this.__showExistingVideoVisitPopup(t);this.__launchSchedulingWorkflow(t)}},__showExistingVideoVisitPopup:function(n){var t,r,i;this.__trackNumOfPatientsInODVVWithSchVideoVisits();t=n.OnDemandTelehealthData.ExistingVideoVisitProviders||[];r=t.length;switch(r){case 1:$$WP.Strings.addMnemonic("@MYCHART@EXISTINGVVPROVIDER1@",t[0],!1,"Scheduling");i=$$WP.Strings.get("PatientHasExistingVideoVisitContentOneProv","Scheduling");$$WP.Strings.removeMnemonic("@MYCHART@EXISTINGVVPROVIDER1@","Scheduling");break;case 2:$$WP.Strings.addMnemonic("@MYCHART@EXISTINGVVPROVIDER1@",t[0],!1,"Scheduling");$$WP.Strings.addMnemonic("@MYCHART@EXISTINGVVPROVIDER2@",t[1],!1,"Scheduling");i=$$WP.Strings.get("PatientHasExistingVideoVisitContentTwoProv","Scheduling");$$WP.Strings.removeMnemonic("@MYCHART@EXISTINGVVPROVIDER1@","Scheduling");$$WP.Strings.removeMnemonic("@MYCHART@EXISTINGVVPROVIDER2@","Scheduling");break;case 0:i=$$WP.Strings.get("PatientHasExistingVideoVisitContentNoInfo","Scheduling");break;default:$$WP.Strings.addMnemonic("@MYCHART@EXISTINGVVPROVIDER1@",t[0],!1,"Scheduling");$$WP.Strings.addMnemonic("@MYCHART@EXISTINGVVPROVIDERCOUNT@",r-1,!1,"Scheduling");i=$$WP.Strings.get("PatientHasExistingVideoVisitContentMultipleProv","Scheduling");$$WP.Strings.removeMnemonic("@MYCHART@EXISTINGVVPROVIDER1@","Scheduling");$$WP.Strings.removeMnemonic("@MYCHART@EXISTINGVVPROVIDERCOUNT@","Scheduling")}var u=$$WP.Strings.get("PatientHasExistingVideoVisitTitle","Scheduling"),f=$$WP.Strings.get("ExistingVideoVisitJumpButton","Scheduling"),e=$$WP.Strings.get("ExistingVideoVisitDismissButton","Scheduling"),o=[new $$WPComp.ComplexObjects.Button(f,null,"completeworkflow","redirect"),new $$WPComp.ComplexObjects.Button(e,null,"previousstep","continue")],s=$.proxy(function(t){var i,r;t.indexOf("redirect")>0&&((this.__trackPatientsRedirectedToSchVideoVisits(),$$WPUtil.ShowAjaxSpinner($afe.select(".telehealthLoadingOverlay .ajaxspinner.defaultajaxoverlay")),$afe.select(".quickschedule.hardwaretest.cardlist").addClass("hidden"),$afe.select(".header.stepHeader").addClass("hidden"),$$WP.Utilities.UI.IsMobile)?(i=this.__mobileCloseURL+"?mode=OnDemandTelehealth&workflowcomplete=1&skipCommunityLogout=1&eCSN="+n.OnDemandTelehealthData.ExistingVideoVisitCSN,$$WP.Utilities.TryRedirect(makeLink(i))):(r="Visits/VisitDetails?csn="+n.OnDemandTelehealthData.ExistingVideoVisitCSN,$$WP.Utilities.TryRedirect(makeLink(r))))},this);new $$WPUtil.quickMessageBox(i,u,o,s)},__handleLoadError:function(n){n===e.ThrottleError?this.__showGraphicalError("HighDemandFirstLoadDescription","HighDemandFirstLoadInstructions",!0):n===e.AccessCodeRequeued?this.__showGraphicalError("ExpiredAccessCodeError"):n===e.AccessCodeInvalid?this.__showGraphicalError("InvalidAccessCodeError"):this.__onError()},__showGraphicalError:function(n,t,i){var r={};$$WPUtil.HideAjaxSpinner(this.$workflowAjaxSpinner);r.HasRetryButton=i;$$WPUtil.IsNullOrEmpty(n)||(r.VerboseErrorDescription=$$WP.Strings.get(n,"Scheduling"));$$WPUtil.IsNullOrEmpty(t)||(r.VerboseErrorInstructions=$$WP.Strings.get(t,"Scheduling"));this.$root.safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.VerboseErrorMessage,r));i&&this.$root.find(".retryButton").click(this.__onStartOver)},__launchSchedulingWorkflow:function(t){var r,u,f,i=null,e=!1;this.$workflowsContainer=this.__createContainer();this.$root.safeAppend(this.$workflowsContainer);this.$workflowsContainer.show();this.$schedulingStoppedContainer=this.__createContainer();this.$root.safeAppend(this.$schedulingStoppedContainer);r=t;u=t.FavoriteAppointments;f=t.OriginalAppointmentInfo;this.__workflows=$$WP.Scheduling.Workflow.createWorkflowCollection(this.__workflowSettings.WorkflowType,r,u,f,this.__workflowSettings.ShowOtherProviderOption,this.__workflowSettings.ShowOtherRfvOption,this.__workflowSettings.RootDecisionTreeId,this.__workflowSettings.DecisionTreeNodeId,this.__workflowSettings.DecisionTreeNodeCsn,this.__isAnonymous,this.__isGuest,this.__workflowSettings.IsFromPrelogin,this.__anonymousSettings,this.__schedulingControllerParams,this.__workflowSettings.IsFromShopperState,this.__workflowSettings.ServiceAreas);this.__shouldUsePredeterminedWorkflow(this.__schedulingControllerParams.isFromVisitDetails)&&((i=$$WP.Scheduling.Workflow.getWorkflowFromType(this.__workflows,this.__workflowSettings.WorkflowType,this.__workflowSettings.TicketId))||this.__addDeepLinkFailureBanner(this.__workflowSettings));this.__preventAppendingErrorMessageOnStop=!1;!i||this.__workflowSettings.WorkflowType===n.WorkflowTypesEnum.NewProvider&&this.__isAnonymous&&null===i.SchedulingDataPool.Specialties.getFromIndex("Id",this.__workflowSettings.PreselectedSpecialtyId)?this.__runWorkflowSelectionStep():(e=!!this.__externalWorkflowEventCallbacks.onNavigateBack,this.__runWorkflow(i,e))},__shouldUsePredeterminedWorkflow:function(t){var i=this.__workflowSettings.WorkflowType,r=!1;return i!==n.WorkflowTypesEnum.DecisionTreeNode&&i!==n.WorkflowTypesEnum.Ticket||(r=!$$WPUtil.IsNullOrEmpty(this.__schedulingControllerParams.decisionTreeNodeCSN)&&!$$WPUtil.IsNullOrEmpty(this.__schedulingControllerParams.decisionTreeNodeID)&&!$$WPUtil.IsNullOrEmpty(this.__schedulingControllerParams.rootDecisionTreeID)),!(!i||i===n.WorkflowTypesEnum.Standard||!t&&!r&&i===n.WorkflowTypesEnum.Ticket)&&(i!==n.WorkflowTypesEnum.NewProvider||!this.__isAnonymous||!(!this.__workflowSettings.PreselectedSpecialtyId&&!this.__canPreselectOnlyAvailableSpecialty()))},__addDeepLinkFailureBanner:function(t){t.WorkflowType===n.WorkflowTypesEnum.ExistingProvider&&t.PreselectedProviderIds&&1===t.PreselectedProviderIds.length&&t.Banners.push({bannerTypeReact:"warning",headerText:$$WP.Strings.get("SelectedProviderNotAvailableTitle","Scheduling.Fixed"),detailText:$$WP.Strings.get("SelectedProviderNotAvailableLandingPage","Scheduling")})},__parseInputParams:function(n){this.__isAnonymous=!!n.isAnonymous&&!0===n.isAnonymous;this.__isGuest=!!n.isGuest&&"1"===n.isGuest.toString();this.__hasDenyJoiningVideoVisitSecPoint=!!n.hasDenyJoiningVideoVisitSecPoint&&"1"===n.hasDenyJoiningVideoVisitSecPoint.toString();this.__isEmbedded=!!n.embedded;this.__schedulingControllerParams=n},__addQueryStringParamsData:function(n){var t,i=this.__getQueryStringParams();for(t in i)n.hasOwnProperty(t)||(n[t]=i[t])},__getQueryStringParams:function(){var n={};return new URLSearchParams(window.location.search).forEach(function(t,i){n[i]=t}),n},__parseAnonymousSettings:function(n){this.__anonymousSettings=new $$WP.Scheduling.AnonymousSettings;this.__anonymousSettings.AdultWorkflowEnabled=n.adultWorkflowEnabled;this.__anonymousSettings.ProxyWorkflowEnabled=n.proxyWorkflowEnabled;this.__anonymousSettings.SchedulingForSomeoneElse=n.anonymousWorkflowForProxy;this.__anonymousSettings.DisableScheduleAsGuest=n.disableScheduleAsGuest},__removePreloginSpinnerForWorkflowsThatBringTheirOwnFromHome:function(n){"OnDemandTelehealth"!==n.workflow&&"ProviderFinder"!==n.workflow&&$afe.select("#main > .ajaxspinner").remove()},__showCookieErrorToUser:function(){$root.hide();self===top?$afe.select("#noCookiesError").show():$afe.select("#noCookies").show()},__setUpMobileCloseUrl:function(){(this.__workflowSettings.SkipMobileLogout||this.__schedulingControllerParams.skipmobilelogout&&"1"===this.__schedulingControllerParams.skipmobilelogout.toString())&&(this.__mobileCloseURL="inside.asp")},__canPreselectOnlyAvailableSpecialty:function(){return this.__workflowSettings.SpecialtyStepSettings.HideIfOne&&this.__workflowSettings.AllowedSpecialtyIds&&this.__workflowSettings.AllowedSpecialtyIds.length<2},__launchScheduledTelemedicine:function(n){n.OnDemandTelehealthData.OnDemandVideoVisitError?$$WP.Utilities.TryRedirect(makeLink("Scheduling/AnonymousTelehealth")):n.OnDemandTelehealthData.InXOrgQueue?$$WP.Utilities.UI.IsMobile?$.post({url:makeLink("TelemedicineHome/GetOrganizationAndVerifyVisit"),data:{orgId:n.OnDemandTelehealthData.XOrgId,csn:n.OnDemandTelehealthData.XOrgCSN},cache:!1,async:!0,success:$.proxy(this.__handleXOrgMobileRedirect,this)}):$$WP.Utilities.TryRedirect(makeLink("Visits/visitslist?xorgcsn="+encodeURIComponent(n.OnDemandTelehealthData.XOrgCSN)+"&xorgid="+encodeURIComponent(n.OnDemandTelehealthData.XOrgId))):$$WP.Utilities.UI.IsMobile?$$WP.Utilities.TryRedirect(makeLink(this.__mobileCloseURL+"?mode=OnDemandTelehealth&skipCommunityLogout=1&workflowcomplete=1&eCSN="+encodeURIComponent(n.OnDemandTelehealthData.OnDemandVideoVisitCSN))):this.__redirectToWebDetails("csn="+encodeURIComponent(n.OnDemandTelehealthData.OnDemandVideoVisitCSN))},__handleXOrgMobileRedirect:function(n){var t,i,r,u;if(n.MissingLink||n.Failure)this.__showError($$WP.Strings.getForTemplate("ErrorWebRequestFailed","Visits"));else if(n.DeadLink)n.SuccessfullyRemovedDeadLink?this.__showError($$WP.Strings.getForTemplate("ErrorLinkIsDeadSuccess","Visits")):this.__showError($$WP.Strings.getForTemplate("ErrorLinkIsDeadFailure","Visits"));else if(n.SchedulingFailure)this.__showInfoPopup($$WP.Strings.getForTemplate("CrossOrgProxySchedulingUnavailable","Visits"),$$WP.Strings.getForTemplate("CrossOrgProxySchedulingUnavailableHeader","Visits"));else if(n.VisitExpired)this.__showInfoPopup($$WP.Strings.getForTemplate("CrossOrgProxyVisitExpired","Visits"),$$WP.Strings.getForTemplate("CrossOrgProxyVisitExpiredHeader","Visits"));else if(n.MissingURL)this.__showInfoPopup($$WP.Strings.getForTemplate("CrossOrgProxyMissingURL","Visits"),$$WP.Strings.getForTemplate("CrossOrgProxyMissingURLHeader","Visits"));else{if(n.URL)return i=$$WP.Strings.getForTemplate("SubjectHasExistingXOrgVideoVisitUnverifiedProxy","Scheduling"),t=$afe.renderTemplate($$WP.Templates.Core.Banner,{BannerType:"informationalType",DetailText:i}),$afe.select("#scheduling-workflow-container").safeReplaceWith(t),void(window.location=n.URL+"&mobile=0");r=encodeURIComponent(n.CSN);u=encodeURIComponent(n.Organization.OrganizationId);$$WP.Utilities.TryRedirect(makeLink(this.__mobileCloseURL+"?mode=OnDemandTelehealth&workflowcomplete=1&skipCommunityLogout=1&eCSN="+r+"&xorgid="+u))}},__showError:function(n){var t,i,r,u;$$WP.Strings.setDefaultNamespace("Visits");t=$$WP.Strings.getForTemplate("ErrorTitle");i=$$WP.Strings.getForTemplate("ErrorClose");$$WP.Strings.clearDefaultNamespace();r=[new $$WPComp.ComplexObjects.Button(i,null,"cancelworkflow","")];u=$.proxy(function(){$$WP.Utilities.TryRedirect(makeLink("inside.asp?moworkflow=completeandclose"))},this);new $$WPUtil.quickMessageBox(n,t,r,u)},__showInfoPopup:function(n,t){var i=$$WP.Strings.getForTemplate("MessageBoxOK","global"),r=[new $$WPComp.ComplexObjects.Button(i,null,"otherbutton","continue")],u=$.proxy(function(){$$WP.Utilities.TryRedirect(makeLink("inside.asp?moworkflow=completeandclose"))},this);new $$WPUtil.quickMessageBox(n,t,r,u)},__getWorkflowStepDefinitions:function(i,r){var u=[];switch(i){case n.WorkflowTypesEnum.ExistingProvider:u=[this.__createProviderStepDefinition(),this.__createReasonForVisitStepDefinition(),this.__createStandardLqfStepDefinition(),this.__createMultiAppointmentStepDefinition(this.__createLocationStepDefinition(),t.Location),this.__createDepartmentLqfStepDefinition(),this.__createCustomWorkflowStepDefinition(),this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition(),this.__createReservationStepDefinition(),this.__createRequestStepDefinition()],t.Time),this.__createTelehealthLocationStepDefinition(),this.__createVerificationStepDefinition()];break;case n.WorkflowTypesEnum.NewProvider:u=this.__getNewProviderSteps(r);break;case n.WorkflowTypesEnum.Procedure:u=[this.__createReasonForVisitStepDefinition(),this.__createStandardLqfStepDefinition(),this.__createOnboardingStepDefinition(),this.__createMultiAppointmentStepDefinition(this.__createLocationStepDefinition(),t.Location),this.__createDepartmentLqfStepDefinition(),this.__createMultiAppointmentStepDefinition(this.__createProviderStepDefinition(),t.Provider),this.__createCustomWorkflowStepDefinition(),this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition(),this.__createReservationStepDefinition(),this.__createRequestStepDefinition()],t.Time),this.__createTelehealthLocationStepDefinition(),this.__createVerificationStepDefinition()];break;case n.WorkflowTypesEnum.Ticket:u=this.__getTicketSteps();break;case n.WorkflowTypesEnum.Request:u=[this.__createReasonForVisitStepDefinition(),this.__createProviderStepDefinition(),this.__createMultiAppointmentStepDefinition(this.__createLocationStepDefinition(),t.Location),this.__createCustomWorkflowStepDefinition(),this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition(),this.__createRequestStepDefinition()],t.Request)];break;case n.WorkflowTypesEnum.Reschedule:u=[this.__createOnboardingStepDefinition(),this.__createStandardLqfStepDefinition(),this.__createMultiAppointmentStepDefinition(this.__createLocationStepDefinition(),t.Location),this.__createMultiAppointmentStepDefinition(this.__createProviderStepDefinition()),this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition(),this.__createReservationStepDefinition()],t.Time),this.__createTelehealthLocationStepDefinition(),this.__createConfirmationStepDefinition()];break;case n.WorkflowTypesEnum.DecisionTreeNode:u=this.__getDecisionTreeSteps();break;case n.WorkflowTypesEnum.ProviderFinder:case n.WorkflowTypesEnum.Widget:u=[this.__createCustomLandingStepDefinition(),this.__createStackedWorkflowStepDefinition([this.__createReasonForVisitStepDefinition()],t.ReasonForVisit),this.__createStandardLqfStepDefinition(),this.__createMultiAppointmentStepDefinition(this.__createLocationStepDefinition(),t.Location),this.__createMultiAppointmentStepDefinition(this.__createProviderStepDefinition()),this.__createCustomWorkflowStepDefinition(),this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition(),this.__createReservationStepDefinition(),this.__createRequestStepDefinition()],t.Time),this.__createTelehealthLocationStepDefinition()];$$WP.Utilities.UI.IsLoggedIn&&!$$WP.Utilities.UI.IsWorkflowRestricted?u.push(this.__createVerificationStepDefinition()):u.push(this.__createConfirmationStepDefinition());break;case n.WorkflowTypesEnum.OnDemandTelehealth:u=this.__getOnDemandTelehealthSteps();break;default:u=[this.__createHeaderlessProviderStepDefinition(),this.__createHeaderlessStackedWorkflowStepDefinition([this.__createReasonForVisitStepDefinition()]),this.__createHeaderlessSlotStepDefinition(),this.__createHeaderlessStackedWorkflowStepDefinition([this.__createDemographicsVerificationStepDefinition(),this.__createInsuranceVerificationStepDefinition(),this.__createConfirmationStepDefinition()])]}return u},__getNewProviderSteps:function(n){var i=[];return!$$WP.Utilities.UI.IsLoggedIn&&n||i.push(this.__createSpecialtyStepDefinition()),i.push(this.__createReasonForVisitStepDefinition()),i.push(this.__createStandardLqfStepDefinition()),i.push(this.__createOnboardingStepDefinition()),i.push(this.__createLocationStepDefinition()),i.push(this.__createMultiAppointmentStepDefinition(this.__createProviderStepDefinition(),null)),i.push(this.__createCustomWorkflowStepDefinition()),i.push(this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition(),this.__createReservationStepDefinition()],t.Time)),i.push(this.__createTelehealthLocationStepDefinition()),$$WP.Utilities.UI.IsLoggedIn&&!$$WP.Utilities.UI.IsWorkflowRestricted?i.push(this.__createVerificationStepDefinition()):i.push(this.__createConfirmationStepDefinition()),i},__getTicketSteps:function(){var n=[];return n.push(this.__createTicketStepDefinition()),n.push(this.__createStandardLqfStepDefinition()),n.push(this.__createOnboardingStepDefinition()),n.push(this.__createMultiAppointmentStepDefinition(this.__createLocationStepDefinition(),t.Location)),n.push(this.__createMultiAppointmentStepDefinition(this.__createProviderStepDefinition(),null)),n.push(this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition(),this.__createReservationStepDefinition()],t.Time)),n.push(this.__createTelehealthLocationStepDefinition()),$$WP.Utilities.UI.IsLoggedIn&&!$$WP.Utilities.UI.IsWorkflowRestricted?n.push(this.__createVerificationStepDefinition()):$$WPUtil.IsNullOrEmpty(this.__workflowSettings.DecisionTreeNodeId)?n.push(this.__createConfirmationStepDefinition()):n.push(this.__createVerificationStepDefinition()),n},__getDecisionTreeSteps:function(){var n=[];return n.push(this.__createStandardLqfStepDefinition()),n.push(this.__createMultiAppointmentStepDefinition(this.__createLocationStepDefinition(),t.Location)),n.push(this.__createDepartmentLqfStepDefinition()),n.push(this.__createMultiAppointmentStepDefinition(this.__createProviderStepDefinition(),null)),n.push(this.__createCustomWorkflowStepDefinition()),n.push(this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition(),this.__createReservationStepDefinition(),this.__createRequestStepDefinition()],t.Time)),n.push(this.__createTelehealthLocationStepDefinition()),n.push(this.__createVerificationStepDefinition()),n},__getOnDemandTelehealthSteps:function(){var n=[this.__createStackedWorkflowStepDefinition([this.__createTelehealthLocationStepDefinition()],t.TelehealthLocation),this.__createStackedWorkflowStepDefinition([this.__createReasonForVisitStepDefinition()],t.ReasonForVisit)];return this.__isAnonymous||this.__isGuest||n.push(this.__createStackedWorkflowStepDefinition([this.__createTelehealthPlatformStepDefinition()],t.TelehealthPlatform)),this.__workflowSettings.QuickScheduleStepSettings&&!0===this.__workflowSettings.QuickScheduleStepSettings.Hide||(n.push(this.__createStackedWorkflowStepDefinition([this.__createTelehealthQuickScheduleStepDefinition()],t.QuickSchedule)),n.push(this.__createStackedWorkflowStepDefinition([this.__createSlotStepDefinition()],t.Time))),this.__isAnonymous||this.__isGuest?this.__isGuest&&this.__schedulingControllerParams.rootDecisionTreeID?n.push(this.__createTelehealthVerificationStepDefinition()):n.push(this.__createStackedWorkflowStepDefinition([this.__createTelehealthSummaryStepDefinition()],t.TelehealthSummary)):(this.__workflowSettings.ShowInsuranceVerificationStep&&n.push(this.__createStackedWorkflowStepDefinition([this.__createInsuranceVerificationStepDefinition()],t.InsuranceVerification)),n.push(this.__createStackedWorkflowStepDefinition([this.__createTelehealthOrganizationStepDefinition(),this.__createTelehealthAuthorizationStepDefinition()],t.TelehealthOrganization)),n.push(this.__createTelehealthVerificationStepDefinition())),n},__runWorkflowSelectionStep:function(){var n;n=this.__createContainer();this.$workflowsContainer.safeAppend(n);n.show();this.__workflowSelectionListenerId=this.__workflows.addPropertyListener("State",this.__onWorkflowSelected);this.__landingPageController=new $$WP.Scheduling.LandingPageController(n,this.__workflows,this.__workflowSettings,this.__isGuest,this.__workflowEventCallbacks);this.__landingPageController.addViewEventListener(this.__onViewEventTriggered);this.__landingPageController.show();$(document).find(".title:has(h1)").addClass("hidden")},__onViewEventTriggered:function(n,t,i){$$WP.Scheduling.SchedulingController.logSchedulingViewEvent(n,t,i)},__runWorkflow:function(n,t){var i;n.setProperty("State",$$WP.Scheduling.Workflow.StatesEnum.Selected);$(document).find(".title:has(h1)").removeClass("hidden");this.$workflowsContainer.hide();this.__linksSidebarWidget&&this.__linksSidebarWidget.remove();n.IsFavorite&&(this.__setFavoritePreselections(n),this.__auditFavoriteAppointmentUse(n.FavoriteAppointmentInfo.Csn));this.__isWorkflowEmpty(n)&&!this.__canWorkflowRunWhenEmpty(n)?this.__onStopScheduling({HideButton:!t}):!n.SchedulingControllerParams||$$WPUtil.IsNullOrEmpty(n.SchedulingControllerParams.rfvId)||this.__isAnyTargetRfvSchedulable(n.SchedulingControllerParams.workflow,n.SchedulingControllerParams.rfvId,n.SchedulingDataPool.ReasonsForVisit)?(i=this.__getWorkflowStepDefinitions(n.Type,t),this.__schedulingWorkflowController=new a(this.$root,i,n,this.__workflowSettings,this.__workflowEventCallbacks,this.__schedulingControllerParams.disableUTF8,t),this.__schedulingWorkflowController.render(),this.__loadBrowserIdIntoWorkflow(n),n.start(this.__workflowSettings)):this.__onStopScheduling({HideButton:!0})},__isWorkflowEmpty:function(n){return 0===n.SchedulingDataPool.ProviderDepartmentPairs.Models.length},__canWorkflowRunWhenEmpty:function(t){var i=t.Type;return i===n.WorkflowTypesEnum.OnDemandTelehealth||i===n.WorkflowTypesEnum.Procedure||i===n.WorkflowTypesEnum.Ticket||i===n.WorkflowTypesEnum.NewProvider||i===n.WorkflowTypesEnum.Widget||i===n.WorkflowTypesEnum.ProviderFinder},__isAnyTargetRfvSchedulable:function(n,t,i){var u=[],f=0,r=0;if(this.__isWorkflowWithRfvsInDataPool(n)){if(!i||0===i.length)return!1;for(u=t.split(","),r=0;r<u.length;r++)if(f=u[r],this.__isRfvCatSchedulable(f,i))return!0;return!1}return!0},__isRfvCatSchedulable:function(n,t){var i;return!!(i=t.getFirstInIndex("CategoryValue",n))&&(!(!i.DefaultVisitType||!i.DefaultVisitType.IsPlaceholder)||$$WP.Scheduling.Workflow.doesRfvHaveMatchingProviderDepartmentPair(i,!0,!0))},__isWorkflowWithRfvsInDataPool:function(n){return"OnDemandTelehealth"!==n&&"NewProvider"!==n},__setFavoritePreselections:function(n){var i,r,t,u;i=n.FavoriteAppointmentInfo.ReasonForVisitCategoryValue;r=n.SchedulingDataPool.ReasonsForVisit.getFirstInIndex("CategoryValue",i).Id;this.__workflowSettings.PreselectedReasonForVisitId=[r];t=n.FavoriteAppointmentInfo.ProviderId;$$WPUtil.IsNullOrEmpty(t)||(this.__workflowSettings.PreselectedProviderIds=[t]);u=n.FavoriteAppointmentInfo.DepartmentId;this.__workflowSettings.PreselectedDepartmentIds=[u]},__auditFavoriteAppointmentUse:function(n){$.post({url:makeLink("Scheduling/AuditFavoriteAppointmentUse"),data:{csn:n}})},__trackNumOfPatientsInODVVWithSchVideoVisits:function(){$.post({url:makeLink("Scheduling/AuditODVVPatientsWithExistingVisit")})},__trackPatientsRedirectedToSchVideoVisits:function(){$.post({url:makeLink("Scheduling/AuditODVVReroutedToExistingVisit")})},__buildWorkflowEventCallbacks:function(n){var t={};return t.onBeforeUnloadChanged=n.onBeforeUnloadChanged,t.onPromoted=n.onPromoted,t.onRecordMatched=n.onRecordMatched,t.storeSelfTriageSessionSuccessCallback=n.storeSelfTriageSessionSuccessCallback,t.onSchedulingComplete=this.__onSchedulingComplete,t.onRequestComplete=this.__onRequestCompleted,t.onTicketWaitListPreferencesUpdated=this.__onTicketWaitListPreferencesUpdated,t.onStopScheduling=this.__onStopScheduling,t.onNavigateBack=this.__onStartOver,t.onError=this.__onWorkflowStepError,t},__onWorkflowSelected:function(){var t=this.__workflows.getFirstInIndex("State",n.StatesEnum.Selected);this.__runWorkflow(t,!0)},__onRequestCompleted:function(n){this.__externalWorkflowEventCallbacks.onSchedulingComplete?this.__externalWorkflowEventCallbacks.onSchedulingComplete(f.VisitRequested,null,null,[]):($$WPUtil.IsNullOrEmpty(this.__schedulingWorkflowController)||(this.__schedulingWorkflowController.destroy(),this.__schedulingWorkflowController=null),n?$$WP.Utilities.TryRedirect(makeLink(this.__mobileCloseURL+"?mode=apptsched&workflowcomplete=1")):$$WP.Utilities.TryRedirect(makeLink("/scheduling/requestconfirmation")))},__onTicketWaitListPreferencesUpdated:function(n){n&&(WP.Events.cancelBeforeUnload(),$$WP.Utilities.TryRedirect(makeLink("Scheduling/WaitListConfirmation")))},__onSchedulingComplete:function(n,t,i){var r=[];$$WPUtil.IsNullOrEmpty(this.__schedulingWorkflowController)||(this.__schedulingWorkflowController.destroy(!0),this.__schedulingWorkflowController=null);this.__externalWorkflowEventCallbacks.onSchedulingComplete?(r=this.__getSchedulingCompleteParams(),this.__externalWorkflowEventCallbacks.onSchedulingComplete(f.VisitScheduled,n,null,r)):i?this.__redirectToMobileDetails(n,t):this.__redirectToWebDetailsForScheduledAppointments(n,t)},__redirectToMobileDetails:function(n,t){var r="",i="";1!==n.length&&t?i=this.__mobileCloseURL+"?mode=apptmake&workflowcomplete=1&apptcount="+n.length.toString():(r=n[0].CSN,i=this.__mobileCloseURL+"?mode=apptmake&workflowcomplete=1&eCSN="+encodeURIComponent(r)+"&apptcount="+n.length.toString());WP.Events.cancelBeforeUnload();$$WP.Utilities.TryRedirect(makeLink(i))},__redirectToWebDetailsForScheduledAppointments:function(t,i){var r="",u=this.__getSelectedWorkflow(),f=n.isWorkflowTypeOpenScheduling(u.Type);r=this.__getVisitDetailsPageParamsForAppointments(t,i);$$WPUtil.IsNullOrEmpty(r)||(r+="&");r+="scheduled=1";f&&u.IsFromPrelogin&&(r+="&fromOpenScheduling=1");this.__redirectToWebDetails(r)},__getVisitDetailsPageParamsForAppointments:function(n,t){var f=[],r=[],u=0,i=null;if(1===n.length||!t)return(i=n[0]).WasScheduledOnRemoteDeployment?"uci="+encodeURIComponent(i.UCI):"csn="+encodeURIComponent(i.CSN);for(u=0;u<n.length;u++)(i=n[u]).WasScheduledOnRemoteDeployment?r.push(i.UCI):r.push(i.CSN);return r.length>0?"ucilist="+encodeURI(r.join(",")):f.length>0?"csnlist="+encodeURIComponent(f.join(",")):""},__redirectToWebDetails:function(n){var t="";t="Visits/VisitDetails";$$WPUtil.IsNullOrEmpty(n)||(t=t+"?"+n);WP.Events.cancelBeforeUnload();$$WP.Utilities.TryRedirect(makeLink(t))},__onStopScheduling:function(t,i){var r=null,e=null,o=[];$$WPUtil.IsNullOrEmpty(this.__schedulingWorkflowController)||(this.__schedulingWorkflowController.destroy(),this.__schedulingWorkflowController=null);t=$$WPUtil.IsNullOrEmpty(t)?{}:t;this.__externalWorkflowEventCallbacks.onSchedulingComplete?(t.HasNoLicensedTelehealthProviders&&(i=s.HasNoLicensedTelehealthProviders),o=this.__getSchedulingCompleteParams(),this.__externalWorkflowEventCallbacks.onSchedulingComplete(f.NotScheduled,null,i,o)):this.__preventAppendingErrorMessageOnStop||(r=this.__getSelectedWorkflow(),t.IsOnDemandTelehealth?t=this.__setTelehealthStopSchedulingMessage(t):$$WPUtil.IsNullOrEmpty(r)||r.Type!==n.WorkflowTypesEnum.Ticket||(t.SchedulingStoppedPretext=$$WP.Strings.get("SchedulingTicketStoppedPretext","Scheduling")),$$WPUtil.IsNullOrEmpty(t.SchedulingStoppedTitle)&&(t.SchedulingStoppedTitle=$$WP.Strings.get("SchedulingStoppedTitle","Scheduling")),$$WPUtil.IsNullOrEmpty(t.SchedulingStoppedPretext)&&(t.SchedulingStoppedPretext=$$WP.Strings.get("SchedulingStoppedPretext","Scheduling")),$$WPUtil.IsNullOrEmpty(t.SchedulingStoppedButtontext)&&(t.SchedulingStoppedButtontext=$$WP.Strings.get("StartOverButton","Scheduling")),this.$root.safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.SchedulingStopped,t)),this.$root.find("#schedulingstop-button").click(this.__onStartOver),this.__canStartOverFromStopScheduling(r.Type)||($afe.select("#scheduling-startover").off("click").addClass("hidden"),$afe.select("#schedulingstop-button").off("click").addClass("hidden")),this.$schedulingStoppedContainer.fadeIn(),$$WPSchedulingUtil.FocusElement(this.$root.find("h2")),this.__preventAppendingErrorMessageOnStop=!0,e=(new Date).toISOString(),h(u.SubmodulesEnum.StopScheduling,e,null,r.SchedulingDataPool,r))},__getSchedulingCompleteParams:function(){var i=this.__getSelectedWorkflow(),n=null,t=[];return $$WPUtil.IsNullOrEmpty(i)||(t={isPersonalInfoCollectionComplete:!!(n=this.__getSelectedWorkflow().SchedulingDataPool.AppointmentBuilder).IsPersonalInfoCollectionComplete,isInsuranceCollectionComplete:!!n.IsInsuranceCollectionComplete,hasMatchingRecord:!!n.hasMatchingRecord,isPromoted:!!n.isPromoted}),t},__canStartOverFromStopScheduling:function(t){return!(t===n.WorkflowTypesEnum.Reschedule||t===n.WorkflowTypesEnum.Ticket&&$$WP.Utilities.UI.IsWorkflowRestricted)},__getSelectedWorkflow:function(){var i,t;return t=1===(i=this.__workflows.size())?this.__workflows.Models[0]:this.__workflows.getFirstInIndex("State",n.StatesEnum.Selected),$$WPUtil.IsNullOrEmpty(t)&&i>1&&(t=this.__getDeeplinkedTicketWorkflow(i)),t},__getDeeplinkedTicketWorkflow:function(n){var r,i,u,t;if(this.__workflows.Models[0].SchedulingControllerParams&&(this.__workflows.Models[0].SchedulingControllerParams.tktId?i=this.__workflows.Models[0].SchedulingControllerParams.tktId:this.__workflows.Models[0].SchedulingControllerParams.ticketId&&(i=this.__workflows.Models[0].SchedulingControllerParams.ticketId)),!$$WPUtil.IsNullOrEmpty(i))for(t=0;t<=n;t++)if(this.__workflows.Models[t].TicketInfo&&this.__workflows.Models[t].TicketInfo.AppointmentRequests&&this.__workflows.Models[t].TicketInfo.AppointmentRequests[0].ID&&(u=this.__workflows.Models[t].TicketInfo.AppointmentRequests[0].ID),u===i){r=this.__workflows.Models[t];break}return r},__setTelehealthStopSchedulingMessage:function(n){return(n=$$WPUtil.IsNullOrEmpty(n)?{}:n).HasNoLicensedTelehealthProviders?(n.SchedulingStoppedTitle=$$WP.Strings.get("VideoVisitStoppedTitle","Scheduling"),n.SchedulingStoppedPretext=$$WP.Strings.get("VideoVisitNoLicensureStoppedPretext","Scheduling"),n.SchedulingStoppedButtontext=$$WP.Strings.get("StartOverButton","Scheduling")):(n.SchedulingStoppedTitle=$$WP.Strings.get("VideoVisitStoppedTitle","Scheduling"),n.SchedulingStoppedPretext=$$WP.Strings.get("VideoVisitStoppedPretext","Scheduling"),n.SchedulingStoppedButtontext=$$WP.Strings.get("StartOverButton","Scheduling")),n},__onError:function(){var t,n=null;t={SchedulingStoppedTitle:$$WP.Strings.get("LandingPageErrorTitle","Scheduling"),SchedulingStoppedPretext:$$WP.Strings.get("LandingPageErrorMessage","Scheduling"),SchedulingStoppedButtontext:$$WP.Strings.get("LandingPageErrorButtonLabel","Scheduling")};this.$root.safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.SchedulingStopped,t));n=this.$root.find("#schedulingstop-button");this.__isGuest?n.click(this.__onGuestBackButtonClicked):n.click(this.__onReturn);$$WPUtil.HideAjaxSpinner(this.$workflowAjaxSpinner)},__onWorkflowStepError:function(n){n||(n={SchedulingStoppedTitle:$$WP.Strings.get("WorkflowStepErrorTitle","Scheduling"),SchedulingStoppedPretext:$$WP.Strings.get("WorkflowStepErrorMessage","Scheduling"),SchedulingStoppedButtontext:$$WP.Strings.get("WorkflowStepErrorButtonLabel","Scheduling")});this.__onStopScheduling(n)},__onStartOver:function(){if($$WPUtil.IsNullOrEmpty(this.__schedulingWorkflowController)||this.__schedulingWorkflowController.clearBeforeUnload(),this.__externalWorkflowEventCallbacks.onNavigateBack)this.__externalWorkflowEventCallbacks.onNavigateBack();else if(this.__workflows){var t=this.__workflows.getFirstInIndex("State",n.StatesEnum.Selected);$$WPSchedulingUtil.Reload(t.IsAuthenticatedWidget)}else location.reload()},__onReturn:function(){window.history.back()},__onGuestBackButtonClicked:function(){$$WP.Utilities.TryRedirect(makeLink("/Home/Logout?postlogoutmode=openscheduling"))},__createContainer:function(){return $$WP.SimpleTemplates.Div({"class":"jqHidden stepcontainer"})},__createAnnouncementContainer:function(){return $$WP.SimpleTemplates.Div({id:"announcementcontainer","class":"offscreen"})},__createTicketStepDefinition:function(){return this.__createReadOnlyWorkflowStepDefinition(t.Ticket)},__createSpecialtyStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Specialty,t.Specialty)},__createProviderStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Provider,t.Provider)},__createLocationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Location,t.Location)},__createVerificationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Verification,t.Confirmation)},__createConfirmationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Confirmation,t.Confirmation)},__createStandardLqfStepDefinition:function(){return this.__createWorkflowStepDefinition(i.StandardLqf,t.Questionnaire)},__createDepartmentLqfStepDefinition:function(){return this.__createWorkflowStepDefinition(i.DepartmentLqf,t.Questionnaire)},__createSlotStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Slot,t.Time)},__createReservationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Reservation,null)},__createRequestStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Request,null)},__createReasonForVisitStepDefinition:function(){return this.__createWorkflowStepDefinition(i.ReasonForVisit,t.ReasonForVisit)},__createHeaderlessProviderStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Provider,null)},__createHeaderlessSlotStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Slot,null)},__createTelehealthLocationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.TelehealthLocation,null)},__createTelehealthPlatformStepDefinition:function(){return this.__createWorkflowStepDefinition(i.PlatformStep,null)},__createTelehealthQuickScheduleStepDefinition:function(){return this.__createWorkflowStepDefinition(i.QuickSchedule,null)},__createTelehealthOrganizationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.TelehealthOrganization,null)},__createTelehealthAuthorizationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.TelehealthAuth,null)},__createTelehealthSummaryStepDefinition:function(){return this.__createWorkflowStepDefinition(i.TelehealthSummary,null)},__createTelehealthVerificationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Verification,t.TelehealthSummary)},__createInsuranceVerificationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Insurance,null)},__createDemographicsVerificationStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Demographics,null)},__createMultiAppointmentStepDefinition:function(n,t){return{type:i.MultiAppointment,stackedSteps:[n],summaryType:t}},__createOnboardingStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Onboarding,null)},__createStackedWorkflowStepDefinition:function(n,t){return{type:i.Stacked,stackedSteps:n,summaryType:t}},__createHeaderlessStackedWorkflowStepDefinition:function(n){return this.__createStackedWorkflowStepDefinition(n,null)},__createCustomWorkflowStepDefinition:function(){return this.__createWorkflowStepDefinition(i.Custom)},__createCustomLandingStepDefinition:function(){return this.__createWorkflowStepDefinition(i.CustomLanding)},__createWorkflowStepDefinition:function(n,t){return this.__createRawWorkflowStepDefinition(n,t,!1)},__createReadOnlyWorkflowStepDefinition:function(n){return this.__createRawWorkflowStepDefinition("",n,!0)},__createRawWorkflowStepDefinition:function(n,t,i){return{type:n,summaryType:t,isReadOnly:i}},__showLackOfVideoVisitSecurityError:function(){var n={SchedulingStoppedTitle:$$WP.Strings.get("LandingPageErrorTitle","Scheduling"),SchedulingStoppedPretext:$$WP.Strings.get("LandingPageVideoVisitSecurityErrorMessage","Scheduling"),SchedulingStoppedButtontext:$$WP.Strings.get("LandingPageErrorButtonLabel","Scheduling")};this.$root.safeAppend($afe.renderTemplate($$WP.Templates.Scheduling.SchedulingStopped,n));this.$root.find("#schedulingstop-button").click(this.__onReturn)},__loadBrowserIdIntoWorkflow:function(n){$$WP.WidgetMode?this.__loadBrowserIdIntoWorkflowForEmbedded(n):this.__loadBrowserIdIntoWorkflowForStandalone(n)},__loadBrowserIdIntoWorkflowForStandalone:function(n){var t=null,i="BrowserId",r=$$WPUtil.isLocalStorageAvailable()&&void 0!==window.localStorage;r&&(t=localStorage.getItem(i));null===t&&(t=$$WPSchedulingUtil.CreateBrowserId(),r&&localStorage.setItem(i,t));n.BrowserId=t},__loadBrowserIdIntoWorkflowForEmbedded:function(n){$$WPUtil.GetCrossDomainData("BrowserId").then(function(n,t){if(null===t){t=$$WPSchedulingUtil.CreateBrowserId();var i={};i.BrowserId=t;$$WPUtil.SetCrossDomainData(i)}n.BrowserId=t}.bind(this,n))}},h=function(n,t,i,r,u,f){var e,o;n&&(p(n)||(o=ut(n,u),$$WP.Analytics.UsageTrackingController.logThirdPartyViewEvent(o),u&&!u.IsAnonymous&&(e=w(n,t,i,r,u),$$WP.Analytics.UsageTrackingController.logViewEvent(e,f)),c.Submodule=n))},p=function(n){return n!==$$WP.Analytics.ViewEvent.SubmodulesEnum.MyChartLinkStep&&n===c.Submodule},c={},w=function(t,i,r,f,e){var o,s,h,ut,ft,c=[],l=[],a=[],v=[],y=null,p=null,w=null;for(s=new u(u.ModulesEnum.Scheduling,t,i),e&&(h=e.Type,s.addEntryToExtraInfo(0,"Workflow",h,!1)),o=0;o<f.AppointmentBuilder.Appointments.Models.length;o++)h!==n.WorkflowTypesEnum.OnDemandTelehealth&&f&&f.AppointmentBuilder&&(y=null,p=null,w=null,c=[],l=[],a=[],v=[],ut=b(f.AppointmentBuilder),c=g(o,f.AppointmentBuilder),l=nt(o,f.AppointmentBuilder),a=it(o,f.AppointmentBuilder),v=tt(o,f.AppointmentBuilder),ft="-1"===c[0],s.addEntryToExtraInfo(o,"SelectedProviders",c,!ft),s.addEntryToExtraInfo(o,"SelectedLocations",l,!0),s.addEntryToExtraInfo(o,"SelectedSlots",a,!1),s.addEntryToExtraInfo(o,"ProviderLqfAction",$$WP.Scheduling.ProvidersUpdatedViewModel.getAppointmentProviderLqfAction(f),!1),n.isWorkflowTypeOpenScheduling(h)?(p=d(f.AppointmentBuilder),y=k(f.AppointmentBuilder),s.addEntryToExtraInfo(o,"SelectedSpecialty",y,!0),s.addEntryToExtraInfo(o,"SelectedVisitType",p,!0)):(s.addEntryToExtraInfo(o,"SelectedRFV",ut,!1),s.addEntryToExtraInfo(o,"SelectedLqfIds",v,!0)),h===n.WorkflowTypesEnum.Ticket&&(w=rt(o,f.AppointmentBuilder),s.addEntryToExtraInfo(o,"BundleId",w,!0))),r&&s.addEntryToExtraInfo(o,r.Key,r.Values,r.AreValuesEncrypted);return s},e={ThrottleError:"ConnectionThrottled",AccessCodeRequeued:"AccessCodeRequeued",AccessCodeInvalid:"AccessCodeInvalid"},b=function(n){var t,i;return(t=n.getReasonForVisit())&&(i=t.CategoryValue),i},k=function(n){var t,i=null;return(t=n.getSpecialty())&&(i=t.Id),i},d=function(n){var t,i;return null===(t=n.getFirstAppointment())||null===(i=t.VisitType)?null:i.ID},g=function(n,t){for(var u={},r=t.getAppointmentProviders(n),i=0;i<r.length;i++)u[r[i].ID]=!0;return o(u)},nt=function(n,t){for(var r,e,u,s,f={},h=t.getAppointmentLocations(n),c=t.AvailableLocations,l=$$WPUtil.IsNullOrEmpty(c)?[]:c[n],i=0;i<h.length;i++)if(u=(e=h[i]).getNonprefixedId(),e.IsSingleDepartment)for(r=0;r<l.length;r++)(s=l[r]).Id===e.Id?f[u]=!0:s.DepartmentIds.includes(u)&&(f[s.Id]=!0);else f[u]=!0;return o(f)},tt=function(n,t){for(var u={},r=t.getAppointmentLqfs(n),i=0;i<r.length;i++)u[r[i].Id]=!0;return o(u)},it=function(n,t){for(var u=[],r=t.getAppointmentSlots(n),i=0;i<r.length;i++)null!==r[i].DateTimeUtc&&u.push(r[i].DateTimeUtc.toISOString());return u},rt=function(n,t){return t.getBundleId(n)},o=function(n){var t=[],i;for(i in n)t.push(i);return t},ut=function(t,i){var r,f,e,o;return f="/Scheduling/"+(r=u.getNameFromSubmodule(t)),e="Scheduling - "+r,i&&(o={Workflow:n.getThirdPartyWorkflowNameFromWorkflowType(i.Type)}),new v(f,e,o)};r.prototype=y;r.SchedulingStatusEnum=f;r.NotScheduledReasonEnum=s;r.logSchedulingViewEvent=h;$$WP.Scheduling.SchedulingController=r;r.extend(l,"WP$Scheduling$SchedulingController")}();$$WP.Debug.UnitTest=$$WP.Debug.UnitTest||{};$$WP.Debug.UnitTest.tests=$$WP.Debug.UnitTest.tests||[];$$WP.Debug.UnitTest.tests.push(function(){$$WP.Debug.UnitTest.assert});!function(){var n=function(n){this.WP$Controllers$Controller();this.proxify("__animateCarouselScrolling");this.template=n};n.prototype={$container:null,$carousel:null,template:null,__isFirstRender:!0,__lastScrollPosition:0,render:function(n,t){this.$container=n;this.__updateCarousel(t)},__updateCarousel:function(n){this.__renderCarousel(n);this.$carousel.on("scroll",$.proxy(this.__onCarouselScrolled,this));this.$carousel.find("input").on("focus",this.__onChipInputFocused);this.$carousel.find("input").on("blur",this.__onChipInputBlurred);this.__setCurrentScrollPosition(this.__lastScrollPosition);this.__animateCarouselIntoView()},selectChip:function(n){n.prop("checked",!0);var t=n.closest(".chip");this.deselectAllChips();t.addClass("selected");this.scrollChipIntoView(t)},deselectAllChips:function(){this.$carousel.find(".chip").removeClass("selected")},scrollChipIntoView:function(n){null!==n&&n.length&&(this.__isFirstRender||setTimeout(this.__animateCarouselScrolling,0,n))},__animateCarouselScrolling:function(n){this.__setCurrentScrollPosition(this.__lastScrollPosition);var t=n.offset().left,i=n.outerWidth(),r=this.$carousel.innerWidth(),u=this.__getCurrentScrollPosition(),f=(r-i)/2;this.$carousel.animate({scrollLeft:u+t-f},500)},__setCurrentScrollPosition:function(n){this.$carousel.scrollLeft(n)},__getCurrentScrollPosition:function(){return this.$carousel.scrollLeft()},__animateCarouselIntoView:function(){var n,t=this.$carousel.find(".chip").last();this.__isFirstRender?(t.offset().left+t.width()-(n=$afe.jq(window).width())>n?this.$carousel.addClass("easeCarousel"):this.$carousel.addClass("defaultMargin"),this.__onCarouselScrolled(),setTimeout($.proxy(function(){this.__isFirstRender=!1},this),750)):this.$carousel.addClass("defaultMargin")},__renderCarousel:function(n){this.$container.empty();this.$container.safeAppend($afe.renderTemplate(this.template,n));this.$carousel=this.$container.find(".chipContainer")},__getCurrentlySelectedChip:function(){return this.$carousel.find(".chip.selected")},__onCarouselScrolled:function(){var n=this.$carousel.find(".hasInput :text"),t=n.val();this.__lastScrollPosition=this.__getCurrentScrollPosition();n.val(" ").val(t)},__onChipInputFocused:function(){$afe.jq(this).closest(".chip").addClass("childHasFocus")},__onChipInputBlurred:function(){$afe.jq(this).closest(".chip").removeClass("childHasFocus")}};$$WP.UI=$$WP.UI||{};$$WP.UI.ChipCarouselController=n;n.extend($$WP.Controllers.Controller,"WP$UI$ChipCarouselController")}();!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).leaflet={})}(this,function(n){"use strict";function l(n){for(var t,r,i=1,u=arguments.length;i<u;i++)for(t in r=arguments[i])n[t]=r[t];return n}function ro(){}function v(n,t){var i,r=Array.prototype.slice;return n.bind?n.bind.apply(n,r.call(arguments,1)):(i=r.call(arguments,2),function(){return n.apply(t,i.length?i.concat(r.call(arguments)):arguments)})}function s(n){return"_leaflet_id"in n||(n._leaflet_id=++uo),n._leaflet_id}function fo(n,t,i){var u,r,e=function(){u=!1;r&&(f.apply(i,r),r=!1)},f=function(){u?r=arguments:(n.apply(i,arguments),setTimeout(e,t),u=!0)};return f}function or(n,t,i){var u=t[1],t=t[0],r=u-t;return n===u&&i?n:((n-t)%r+r)%r+t}function b(){return!1}function vt(n,t){return!1===t?n:(t=Math.pow(10,void 0===t?6:t),Math.round(n*t)/t)}function vf(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function oi(n){return vf(n).split(/\s+/)}function y(n,t){for(var i in Object.prototype.hasOwnProperty.call(n,"options")||(n.options=n.options?ru(n.options):{}),t)n.options[i]=t[i];return n.options}function eo(n,t,i){var r,u=[];for(r in n)u.push(encodeURIComponent(i?r.toUpperCase():r)+"="+encodeURIComponent(n[r]));return(t&&-1!==t.indexOf("?")?"&":"?")+u.join("&")}function oo(n,t){return n.replace(ah,function(n,i){if(i=t[i],void 0===i)throw new Error("No value provided for variable "+n);return"function"==typeof i?i(t):i})}function yf(n,t){for(var i=0;i<n.length;i++)if(n[i]===t)return i;return-1}function pf(n){return window["webkit"+n]||window["moz"+n]||window["ms"+n]}function ho(n){var t=+new Date,i=Math.max(0,16-(t-so));return so=t+i,window.setTimeout(n,i)}function tt(n,t,i){if(!i||wf!==ho)return wf.call(window,v(n,t));n.call(t)}function ot(n){n&&co.call(window,n)}function dt(){}function r(n,t,i){this.x=i?Math.round(n):n;this.y=i?Math.round(t):t}function i(n,t,i){return n instanceof r?n:ct(n)?new r(n[0],n[1]):null==n?n:"object"==typeof n&&"x"in n&&"y"in n?new r(n.x,n.y):new r(n,t,i)}function p(n,t){if(n)for(var r=t?[n,t]:n,i=0,u=r.length;i<u;i++)this.extend(r[i])}function rt(n,t){return!n||n instanceof p?n:new p(n,t)}function ut(n,t){if(n)for(var r=t?[n,t]:n,i=0,u=r.length;i<u;i++)this.extend(r[i])}function d(n,t){return n instanceof ut?n:new ut(n,t)}function c(n,t,i){if(isNaN(n)||isNaN(t))throw new Error("Invalid LatLng object: ("+n+", "+t+")");this.lat=+n;this.lng=+t;void 0!==i&&(this.alt=+i)}function e(n,t,i){return n instanceof c?n:ct(n)&&"object"!=typeof n[0]?3===n.length?new c(n[0],n[1],n[2]):2===n.length?new c(n[0],n[1]):null:null==n?n:"object"==typeof n&&"lat"in n?new c(n.lat,"lng"in n?n.lng:n.lon,n.alt):void 0===t?null:new c(n,t,i)}function kf(n,t,i,r){ct(n)?(this._a=n[0],this._b=n[1],this._c=n[2],this._d=n[3]):(this._a=n,this._b=t,this._c=i,this._d=r)}function sr(n,t,i,r){return new kf(n,t,i,r)}function ao(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function vo(n,i){for(var r,e,o,s,u="",f=0,h=n.length;f<h;f++){for(r=0,e=(o=n[f]).length;r<e;r++)u+=(r?"L":"M")+(s=o[r]).x+" "+s.y;u+=i?t.svg?"z":"x":""}return u||"M0 0"}function pt(n){return 0<=navigator.userAgent.toLowerCase().indexOf(n)}function gh(n,t,i){return"touchstart"!==t||ns||(document.addEventListener(po,nc,!0),document.addEventListener(wo,tc,!0),document.addEventListener(bo,ts,!0),document.addEventListener(ko,ts,!0),ns=!0),go[t]?(i=go[t].bind(this,i),n.addEventListener(te[t],i,!1),i):(console.warn("wrong event specified:",t),b)}function nc(n){gi[n.pointerId]=n}function tc(n){gi[n.pointerId]&&(gi[n.pointerId]=n)}function ts(n){delete gi[n.pointerId]}function yu(n,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||"mouse")){for(var i in t.touches=[],gi)t.touches.push(gi[i]);t.changedTouches=[t];n(t)}}function ic(n,t){function u(n){var u;1!==n.detail?i=n.detail:"mouse"===n.pointerType||n.sourceCapabilities&&!n.sourceCapabilities.firesTouchEvents||(u=os(n)).some(function(n){return n instanceof HTMLLabelElement&&n.attributes.for})&&!u.some(function(n){return n instanceof HTMLInputElement||n instanceof HTMLSelectElement})||((u=Date.now())-r<=is?2==++i&&t(function(n){var i,r,t={};for(r in n)i=n[r],t[r]=i&&i.bind?i.bind(n):i;return(n=t).type="dblclick",t.detail=2,t.isTrusted=!1,t._simulated=!0,t}(n)):i=1,r=u)}n.addEventListener("dblclick",t);var i,r=0;return n.addEventListener("click",u),{dblclick:t,simDblclick:u}}function us(n){return"string"==typeof n?document.getElementById(n):n}function br(n,t){var i=n.style[t]||n.currentStyle&&n.currentStyle[t];return"auto"===(i=i&&"auto"!==i||!document.defaultView?i:(n=document.defaultView.getComputedStyle(n,null))?n[t]:null)?null:i}function h(n,t,i){return n=document.createElement(n),n.className=t||"",i&&i.appendChild(n),n}function w(n){var t=n.parentNode;t&&t.removeChild(n)}function bu(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function tr(n){var t=n.parentNode;t&&t.lastChild!==n&&t.appendChild(n)}function ir(n){var t=n.parentNode;t&&t.firstChild!==n&&t.insertBefore(n,t.firstChild)}function fe(n,t){return void 0!==n.classList?n.classList.contains(t):0<(n=ku(n)).length&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(n)}function f(n,t){var r;if(void 0!==n.classList)for(var u=oi(t),i=0,f=u.length;i<f;i++)n.classList.add(u[i]);else fe(n,t)||ee(n,((r=ku(n))?r+" ":"")+t)}function k(n,t){void 0!==n.classList?n.classList.remove(t):ee(n,vf((" "+ku(n)+" ").replace(" "+t+" "," ")))}function ee(n,t){void 0===n.className.baseVal?n.className=t:n.className.baseVal=t}function ku(n){return void 0===(n=n.correspondingElement?n.correspondingElement:n).className.baseVal?n.className:n.className.baseVal}function st(n,t){if("opacity"in n.style)n.style.opacity=t;else if("filter"in n.style){var i=!1,r="DXImageTransform.Microsoft.Alpha";try{i=n.filters.item(r)}catch(n){if(1===t)return}t=Math.round(100*t);i?(i.Enabled=100!==t,i.Opacity=t):n.style.filter+=" progid:"+r+"(opacity="+t+")"}}function du(n){for(var i=document.documentElement.style,t=0;t<n.length;t++)if(n[t]in i)return n[t];return!1}function ci(n,i,u){i=i||new r(0,0);n.style[ue]=(t.ie3d?"translate("+i.x+"px,"+i.y+"px)":"translate3d("+i.x+"px,"+i.y+"px,0)")+(u?" scale("+u+")":"")}function g(n,i){n._leaflet_pos=i;t.any3d?ci(n,i):(n.style.left=i.x+"px",n.style.top=i.y+"px")}function li(n){return n._leaflet_pos||new r(0,0)}function oe(){u(window,"dragstart",nt)}function se(){a(window,"dragstart",nt)}function he(n){for(;-1===n.tabIndex;)n=n.parentNode;n.style&&(gu(),re=(wu=n).style.outlineStyle,n.style.outlineStyle="none",u(window,"keydown",gu))}function gu(){wu&&(wu.style.outlineStyle=re,re=wu=void 0,a(window,"keydown",gu))}function fs(n){for(;!((n=n.parentNode).offsetWidth&&n.offsetHeight||n===document.body););return n}function ce(n){var t=n.getBoundingClientRect();return{x:t.width/n.offsetWidth||1,y:t.height/n.offsetHeight||1,boundingClientRect:t}}function u(n,t,i,r){var f,u,e;if(t&&"object"==typeof t)for(f in t)le(n,f,t[f],i);else for(u=0,e=(t=oi(t)).length;u<e;u++)le(n,t[u],i,r);return this}function a(n,t,i,r){var f,u,e;if(1===arguments.length)es(n),delete n[lt];else if(t&&"object"==typeof t)for(f in t)ae(n,f,t[f],i);else if(t=oi(t),2===arguments.length)es(n,function(n){return-1!==yf(t,n)});else for(u=0,e=t.length;u<e;u++)ae(n,t[u],i,r);return this}function es(n,t){var i,r;for(i in n[lt])r=i.split(/\d/)[0],t&&!t(r)||ae(n,r,null,null,i)}function le(n,i,r,u){var f,e,o=i+s(r)+(u?"_"+s(u):"");n[lt]&&n[lt][o]||(e=f=function(t){return r.call(u||n,t||window.event)},!t.touchNative&&t.pointer&&0===i.indexOf("touch")?f=gh(n,i,f):t.touch&&"dblclick"===i?f=ic(n,f):"addEventListener"in n?"touchstart"===i||"touchmove"===i||"wheel"===i||"mousewheel"===i?n.addEventListener(nf[i]||i,f,!!t.passiveEvents&&{passive:!1}):"mouseenter"===i||"mouseleave"===i?n.addEventListener(nf[i],f=function(t){t=t||window.event;ye(n,t)&&e(t)},!1):n.addEventListener(i,e,!1):n.attachEvent("on"+i,f),n[lt]=n[lt]||{},n[lt][o]=f)}function ae(n,i,r,u,f){f=f||i+s(r)+(u?"_"+s(u):"");var o,e,r=n[lt]&&n[lt][f];r&&(!t.touchNative&&t.pointer&&0===i.indexOf("touch")?(u=n,e=r,te[o=i]?u.removeEventListener(te[o],e,!1):console.warn("wrong event specified:",o)):t.touch&&"dblclick"===i?(u=r,(e=n).removeEventListener("dblclick",u.dblclick),e.removeEventListener("click",u.simDblclick)):"removeEventListener"in n?n.removeEventListener(nf[i]||i,r,!1):n.detachEvent("on"+i,r),n[lt][f]=null)}function ai(n){return n.stopPropagation?n.stopPropagation():n.originalEvent?n.originalEvent._stopped=!0:n.cancelBubble=!0,this}function ve(n){return le(n,"wheel",ai),this}function kr(n){return u(n,"mousedown touchstart dblclick contextmenu",ai),n._leaflet_disable_click=!0,this}function nt(n){return n.preventDefault?n.preventDefault():n.returnValue=!1,this}function vi(n){return nt(n),ai(n),this}function os(n){if(n.composedPath)return n.composedPath();for(var i=[],t=n.target;t;)i.push(t),t=t.parentNode;return i}function ss(n,t){var i,u;return t?(u=(i=ce(t)).boundingClientRect,new r((n.clientX-u.left)/i.x-t.clientLeft,(n.clientY-u.top)/i.y-t.clientTop)):new r(n.clientX,n.clientY)}function cs(n){return t.edge?n.wheelDeltaY/2:n.deltaY&&0===n.deltaMode?-n.deltaY/hs:n.deltaY&&1===n.deltaMode?20*-n.deltaY:n.deltaY&&2===n.deltaMode?60*-n.deltaY:n.deltaX||n.deltaZ?0:n.wheelDelta?(n.wheelDeltaY||n.wheelDelta)/2:n.detail&&Math.abs(n.detail)<32765?20*-n.detail:n.detail?n.detail/-32765*60:0}function ye(n,t){var i=t.relatedTarget;if(!i)return!0;try{for(;i&&i!==n;)i=i.parentNode}catch(n){return!1}return i!==n}function dr(n){return new at(n)}function ps(n,t,i){for(var e,c,h,o,s,u,f,a=[1,4,2,8],r=0,l=n.length;r<l;r++)n[r]._code=yi(n[r],t);for(h=0;h<4;h++){for(u=a[h],e=[],r=0,c=(l=n.length)-1;r<l;c=r++)o=n[r],s=n[c],o._code&u?s._code&u||((f=tf(s,o,u,t,i))._code=yi(f,t),e.push(f)):(s._code&u&&((f=tf(s,o,u,t,i))._code=yi(f,t),e.push(f)),e.push(o));n=e}return n}function ws(n,t){var a,f,o,c,s,v,y,w;if(!n||0===n.length)throw new Error("latlngs not passed");ht(n)||(console.warn("latlngs are not flat! Only the first ring will be used"),n=n[0]);for(var h=e([0,0]),r=d(n),p=(r.getNorthWest().distanceTo(r.getSouthWest())*r.getNorthEast().distanceTo(r.getNorthWest())<1700&&(h=be(n)),n.length),l=[],u=0;u<p;u++)w=e(n[u]),l.push(t.project(e([w.lat-h.lat,w.lng-h.lng])));for(u=s=v=y=0,a=p-1;u<p;a=u++)f=l[u],o=l[a],c=f.y*o.x-o.y*f.x,v+=(f.x+o.x)*c,y+=(f.y+o.y)*c,s+=3*c;return r=0===s?l[0]:[v/s,y/s],r=t.unproject(i(r)),e([r.lat+h.lat,r.lng+h.lng])}function be(n){for(var r,u=0,f=0,t=0,i=0;i<n.length;i++)r=e(n[i]),u+=r.lat,f+=r.lng,t++;return e([u/t,f/t])}function ks(n,t){var i,e;if(t&&n.length){var f=n=function(n,t){for(var r=[n[0]],i=1,u=0,f=n.length;i<f;i++)(function(n,t){var i=t.x-n.x,t=t.y-n.y;return i*i+t*t})(n[i],n[u])>t&&(r.push(n[i]),u=i);return u<f-1&&r.push(n[f-1]),r}(n,t=t*t),r=f.length,u=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(r);for(u[0]=u[r-1]=1,function n(t,i,r,u,f){for(var o,s,h=0,e=u+1;e<=f-1;e++)s=gr(t[e],t[u],t[f],!0),h<s&&(o=e,h=s);r<h&&(i[o]=1,n(t,i,r,u,o),n(t,i,r,o,f))}(f,u,t,0,r-1),e=[],i=0;i<r;i++)u[i]&&e.push(f[i]);return e}return n.slice()}function ds(n,t,i){return Math.sqrt(gr(n,t,i,!0))}function gs(n,t,i,r,u){var h,o,s,f=r?bs:yi(n,i),e=yi(t,i);for(bs=e;;){if(!(f|e))return[n,t];if(f&e)return!1;s=yi(o=tf(n,t,h=f||e,i,u),i);h===f?(n=o,f=s):(t=o,e=s)}}function tf(n,t,i,u,f){var e,o,s=t.x-n.x,t=t.y-n.y,h=u.min,u=u.max;return 8&i?(e=n.x+s*(u.y-n.y)/t,o=u.y):4&i?(e=n.x+s*(h.y-n.y)/t,o=h.y):2&i?(e=u.x,o=n.y+t*(u.x-n.x)/s):1&i&&(e=h.x,o=n.y+t*(h.x-n.x)/s),new r(e,o,f)}function yi(n,t){var i=0;return n.x<t.min.x?i|=1:n.x>t.max.x&&(i|=2),n.y<t.min.y?i|=4:n.y>t.max.y&&(i|=8),i}function gr(n,t,i,u){var o=t.x,t=t.y,f=i.x-o,e=i.y-t,s=f*f+e*e;return 0<s&&(1<(s=((n.x-o)*f+(n.y-t)*e)/s)?(o=i.x,t=i.y):0<s&&(o+=f*s,t+=e*s)),f=n.x-o,e=n.y-t,u?f*f+e*e:new r(o,t)}function ht(n){return!ct(n[0])||"object"!=typeof n[0][0]&&void 0!==n[0][0]}function nh(n){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),ht(n)}function th(n,t){var s,a,c,f,l,v,p;if(!n||0===n.length)throw new Error("latlngs not passed");ht(n)||(console.warn("latlngs are not flat! Only the first ring will be used"),n=n[0]);for(var h=e([0,0]),u=d(n),y=(u.getNorthWest().distanceTo(u.getSouthWest())*u.getNorthEast().distanceTo(u.getNorthWest())<1700&&(h=be(n)),n.length),o=[],r=0;r<y;r++)p=e(n[r]),o.push(t.project(e([p.lat-h.lat,p.lng-h.lng])));for(s=r=0;r<y-1;r++)s+=o[r].distanceTo(o[r+1])/2;if(0===s)v=o[0];else for(a=r=0;r<y-1;r++)if(c=o[r],f=o[r+1],s<(a+=l=c.distanceTo(f))){v=[f.x-(l=(a-s)/l)*(f.x-c.x),f.y-l*(f.y-c.y)];break}return u=t.unproject(i(v)),e([u.lat+h.lat,u.lng+h.lng])}function ff(n,t){var h,o,i,u,r="Feature"===n.type?n.geometry:n,f=r?r.coordinates:null,e=[],a=t&&t.pointToLayer,s=t&&t.coordsToLatLng||de,c,l;if(!f&&!r)return null;switch(r.type){case"Point":return uh(a,n,h=s(f),t);case"MultiPoint":for(i=0,u=f.length;i<u;i++)h=s(f[i]),e.push(uh(a,n,h,t));return new ti(e);case"LineString":case"MultiLineString":return o=ef(f,"LineString"===r.type?0:1,s),new ii(o,t);case"Polygon":case"MultiPolygon":return o=ef(f,"Polygon"===r.type?1:2,s),new pi(o,t);case"GeometryCollection":for(i=0,u=r.geometries.length;i<u;i++)c=ff({geometry:r.geometries[i],type:"Feature",properties:n.properties},t),c&&e.push(c);return new ti(e);case"FeatureCollection":for(i=0,u=r.features.length;i<u;i++)l=ff(r.features[i],t),l&&e.push(l);return new ti(e);default:throw new Error("Invalid GeoJSON object.");}}function uh(n,t,i,r){return n?n(t,i):new rf(i,r&&r.markersInheritOptions&&r)}function de(n){return new c(n[1],n[0],n[2])}function ef(n,t,i){for(var u,f=[],r=0,e=n.length;r<e;r++)u=t?ef(n[r],t-1,i):(i||de)(n[r]),f.push(u);return f}function ge(n,t){return void 0!==(n=e(n)).alt?[vt(n.lng,t),vt(n.lat,t),vt(n.alt,t)]:[vt(n.lng,t),vt(n.lat,t)]}function of(n,t,i,r){for(var u=[],f=0,e=n.length;f<e;f++)u.push(t?of(n[f],ht(n[f])?0:t-1,i,r):ge(n[f],r));return!t&&i&&0<u.length&&u.push(u[0].slice()),u}function fr(n,t){return n.feature?l({},n.feature,{geometry:t}):sf(t)}function sf(n){return"Feature"===n.type||"FeatureCollection"===n.type?n:{type:"Feature",properties:{},geometry:n}}function fh(n,t){return new wt(n,t)}function hh(n,t){return new wi(n,t)}function ch(n){return t.canvas?new to(n):null}function lh(n){return t.svg||t.vml?new iu(n):null}var ru=Object.create||function(n){return ro.prototype=n,new ro},uo=0,ah=/\{ *([\w_ -]+) *\}/g,ct=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)},uu="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",so=0,wf=window.requestAnimationFrame||pf("RequestAnimationFrame")||ho,co=window.cancelAnimationFrame||pf("CancelAnimationFrame")||pf("CancelRequestAnimationFrame")||function(n){window.clearTimeout(n)},vh={__proto__:null,extend:l,create:ru,bind:v,get lastId(){return uo},stamp:s,throttle:fo,wrapNum:or,falseFn:b,formatNum:vt,trim:vf,splitWords:oi,setOptions:y,getParamString:eo,template:oo,isArray:ct,indexOf:yf,emptyImageUrl:uu,requestFn:wf,cancelFn:co,requestAnimFrame:tt,cancelAnimFrame:ot},it,bi,bf,ki,lo,is,lt,nf,hs,bs,cr,pi,wt,er,wi,no,kt,to,io;dt.extend=function(n){function u(){y(this);this.initialize&&this.initialize.apply(this,arguments);this.callInitHooks()}var r,f=u.__super__=this.prototype,t=ru(f),i,e;for(r in(t.constructor=u).prototype=t,this)Object.prototype.hasOwnProperty.call(this,r)&&"prototype"!==r&&"__super__"!==r&&(u[r]=this[r]);if(n.statics&&l(u,n.statics),n.includes){if(i=n.includes,"undefined"!=typeof L&&L&&L.Mixin)for(i=ct(i)?i:[i],e=0;e<i.length;e++)i[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack);l.apply(null,[t].concat(n.includes))}return l(t,n),delete t.statics,delete t.includes,t.options&&(t.options=f.options?ru(f.options):{},l(t.options,n.options)),t._initHooks=[],t.callInitHooks=function(){if(!this._initHooksCalled){f.callInitHooks&&f.callInitHooks.call(this);this._initHooksCalled=!0;for(var n=0,i=t._initHooks.length;n<i;n++)t._initHooks[n].call(this)}},u};dt.include=function(n){var t=this.prototype.options;return l(this.prototype,n),n.options&&(this.prototype.options=t,this.mergeOptions(n.options)),this};dt.mergeOptions=function(n){return l(this.prototype.options,n),this};dt.addInitHook=function(n){var t=Array.prototype.slice.call(arguments,1),i="function"==typeof n?n:function(){this[n].apply(this,t)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};it={on:function(n,t,i){var u,r,f;if("object"==typeof n)for(u in n)this._on(u,n[u],t);else for(r=0,f=(n=oi(n)).length;r<f;r++)this._on(n[r],t,i);return this},off:function(n,t,i){var u;if(arguments.length)if("object"==typeof n)for(u in n)this._off(u,n[u],t);else{n=oi(n);for(var f=1===arguments.length,r=0,e=n.length;r<e;r++)f?this._off(n[r]):this._off(n[r],t,i)}else delete this._events;return this},_on:function(n,t,i,r){"function"!=typeof t?console.warn("wrong listener type: "+typeof t):!1===this._listens(n,t,i)&&(t={fn:t,ctx:i=i===this?void 0:i},r&&(t.once=!0),this._events=this._events||{},this._events[n]=this._events[n]||[],this._events[n].push(t))},_off:function(n,t,i){var r,u,f;if(this._events&&(r=this._events[n]))if(1===arguments.length){if(this._firingCount)for(u=0,f=r.length;u<f;u++)r[u].fn=b;delete this._events[n]}else"function"!=typeof t?console.warn("wrong listener type: "+typeof t):!1!==(t=this._listens(n,t,i))&&(i=r[t],this._firingCount&&(i.fn=b,this._events[n]=r=r.slice()),r.splice(t,1))},fire:function(n,t,i){var e,u,f,s,r,o;if(this.listens(n,i)){if(e=l({},t,{type:n,target:this,sourceTarget:t&&t.sourceTarget||this}),this._events&&(u=this._events[n],u)){for(this._firingCount=this._firingCount+1||1,f=0,s=u.length;f<s;f++)r=u[f],o=r.fn,r.once&&this.off(n,o,r.ctx),o.call(r.ctx||this,e);this._firingCount--}i&&this._propagateEvent(e)}return this},listens:function(n,t,i,r){var u,f,e;if("string"!=typeof n&&console.warn('"string" type argument expected'),u=t,f=("function"!=typeof t&&(r=!!t,i=u=void 0),this._events&&this._events[n]),f&&f.length&&!1!==this._listens(n,u,i))return!0;if(r)for(e in this._eventParents)if(this._eventParents[e].listens(n,t,i,r))return!0;return!1},_listens:function(n,t,i){var u,r,f;if(this._events){if(u=this._events[n]||[],!t)return!!u.length;for(i===this&&(i=void 0),r=0,f=u.length;r<f;r++)if(u[r].fn===t&&u[r].ctx===i)return r}return!1},once:function(n,t,i){var u,r,f;if("object"==typeof n)for(u in n)this._on(u,n[u],t,!0);else for(r=0,f=(n=oi(n)).length;r<f;r++)this._on(n[r],t,i,!0);return this},addEventParent:function(n){return this._eventParents=this._eventParents||{},this._eventParents[s(n)]=n,this},removeEventParent:function(n){return this._eventParents&&delete this._eventParents[s(n)],this},_propagateEvent:function(n){for(var t in this._eventParents)this._eventParents[t].fire(n.type,l({layer:n.target,propagatedFrom:n.target},n),!0)}};bi=(it.addEventListener=it.on,it.removeEventListener=it.clearAllEventListeners=it.off,it.addOneTimeEventListener=it.once,it.fireEvent=it.fire,it.hasEventListeners=it.listens,dt.extend(it));bf=Math.trunc||function(n){return 0<n?Math.floor(n):Math.ceil(n)};r.prototype={clone:function(){return new r(this.x,this.y)},add:function(n){return this.clone()._add(i(n))},_add:function(n){return this.x+=n.x,this.y+=n.y,this},subtract:function(n){return this.clone()._subtract(i(n))},_subtract:function(n){return this.x-=n.x,this.y-=n.y,this},divideBy:function(n){return this.clone()._divideBy(n)},_divideBy:function(n){return this.x/=n,this.y/=n,this},multiplyBy:function(n){return this.clone()._multiplyBy(n)},_multiplyBy:function(n){return this.x*=n,this.y*=n,this},scaleBy:function(n){return new r(this.x*n.x,this.y*n.y)},unscaleBy:function(n){return new r(this.x/n.x,this.y/n.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=bf(this.x),this.y=bf(this.y),this},distanceTo:function(n){var t=(n=i(n)).x-this.x,n=n.y-this.y;return Math.sqrt(t*t+n*n)},equals:function(n){return(n=i(n)).x===this.x&&n.y===this.y},contains:function(n){return n=i(n),Math.abs(n.x)<=Math.abs(this.x)&&Math.abs(n.y)<=Math.abs(this.y)},toString:function(){return"Point("+vt(this.x)+", "+vt(this.y)+")"}};p.prototype={extend:function(n){var t,u;if(n){if(n instanceof r||"number"==typeof n[0]||"x"in n)t=u=i(n);else if(t=(n=rt(n)).min,u=n.max,!t||!u)return this;this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(u.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(u.y,this.max.y)):(this.min=t.clone(),this.max=u.clone())}return this},getCenter:function(n){return i((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,n)},getBottomLeft:function(){return i(this.min.x,this.max.y)},getTopRight:function(){return i(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(n){var t,u;return(n=("number"==typeof n[0]||n instanceof r?i:rt)(n))instanceof p?(t=n.min,u=n.max):t=u=n,t.x>=this.min.x&&u.x<=this.max.x&&t.y>=this.min.y&&u.y<=this.max.y},intersects:function(n){n=rt(n);var t=this.min,i=this.max,r=n.min,n=n.max,u=n.x>=t.x&&r.x<=i.x,n=n.y>=t.y&&r.y<=i.y;return u&&n},overlaps:function(n){n=rt(n);var t=this.min,i=this.max,r=n.min,n=n.max,u=n.x>t.x&&r.x<i.x,n=n.y>t.y&&r.y<i.y;return u&&n},isValid:function(){return!(!this.min||!this.max)},pad:function(n){var t=this.min,r=this.max,u=Math.abs(t.x-r.x)*n,n=Math.abs(t.y-r.y)*n;return rt(i(t.x-u,t.y-n),i(r.x+u,r.y+n))},equals:function(n){return!!n&&(n=rt(n),this.min.equals(n.getTopLeft())&&this.max.equals(n.getBottomRight()))}};ut.prototype={extend:function(n){var t,i,r=this._southWest,u=this._northEast;if(n instanceof c)i=t=n;else{if(!(n instanceof ut))return n?this.extend(e(n)||d(n)):this;if(t=n._southWest,i=n._northEast,!t||!i)return this}return r||u?(r.lat=Math.min(t.lat,r.lat),r.lng=Math.min(t.lng,r.lng),u.lat=Math.max(i.lat,u.lat),u.lng=Math.max(i.lng,u.lng)):(this._southWest=new c(t.lat,t.lng),this._northEast=new c(i.lat,i.lng)),this},pad:function(n){var t=this._southWest,i=this._northEast,r=Math.abs(t.lat-i.lat)*n,n=Math.abs(t.lng-i.lng)*n;return new ut(new c(t.lat-r,t.lng-n),new c(i.lat+r,i.lng+n))},getCenter:function(){return new c((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new c(this.getNorth(),this.getWest())},getSouthEast:function(){return new c(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(n){n=("number"==typeof n[0]||n instanceof c||"lat"in n?e:d)(n);var t,i,r=this._southWest,u=this._northEast;return n instanceof ut?(t=n.getSouthWest(),i=n.getNorthEast()):t=i=n,t.lat>=r.lat&&i.lat<=u.lat&&t.lng>=r.lng&&i.lng<=u.lng},intersects:function(n){n=d(n);var t=this._southWest,i=this._northEast,r=n.getSouthWest(),n=n.getNorthEast(),u=n.lat>=t.lat&&r.lat<=i.lat,n=n.lng>=t.lng&&r.lng<=i.lng;return u&&n},overlaps:function(n){n=d(n);var t=this._southWest,i=this._northEast,r=n.getSouthWest(),n=n.getNorthEast(),u=n.lat>t.lat&&r.lat<i.lat,n=n.lng>t.lng&&r.lng<i.lng;return u&&n},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(n,t){return!!n&&(n=d(n),this._southWest.equals(n.getSouthWest(),t)&&this._northEast.equals(n.getNorthEast(),t))},isValid:function(){return!(!this._southWest||!this._northEast)}};var gt={latLngToPoint:function(n,t){return n=this.projection.project(n),t=this.scale(t),this.transformation._transform(n,t)},pointToLatLng:function(n,t){return t=this.scale(t),n=this.transformation.untransform(n,t),this.projection.unproject(n)},project:function(n){return this.projection.project(n)},unproject:function(n){return this.projection.unproject(n)},scale:function(n){return 256*Math.pow(2,n)},zoom:function(n){return Math.log(n/256)/Math.LN2},getProjectedBounds:function(n){var t;return this.infinite?null:(t=this.projection.bounds,n=this.scale(n),new p(this.transformation.transform(t.min,n),this.transformation.transform(t.max,n)))},infinite:!(c.prototype={equals:function(n,t){return!!n&&(n=e(n),Math.max(Math.abs(this.lat-n.lat),Math.abs(this.lng-n.lng))<=(void 0===t?1e-9:t))},toString:function(n){return"LatLng("+vt(this.lat,n)+", "+vt(this.lng,n)+")"},distanceTo:function(n){return ri.distance(this,e(n))},wrap:function(){return ri.wrapLatLng(this)},toBounds:function(n){var n=180*n/40075017,t=n/Math.cos(Math.PI/180*this.lat);return d([this.lat-n,this.lng-t],[this.lat+n,this.lng+t])},clone:function(){return new c(this.lat,this.lng,this.alt)}}),wrapLatLng:function(n){var t=this.wrapLng?or(n.lng,this.wrapLng,!0):n.lng;return new c(this.wrapLat?or(n.lat,this.wrapLat,!0):n.lat,t,n.alt)},wrapLatLngBounds:function(n){var t=n.getCenter(),i=this.wrapLatLng(t),r=t.lat-i.lat,t=t.lng-i.lng;return 0==r&&0==t?n:(i=n.getSouthWest(),n=n.getNorthEast(),new ut(new c(i.lat-r,i.lng-t),new c(n.lat-r,n.lng-t)))}},ri=l({},gt,{wrapLng:[-180,180],R:6371e3,distance:function(n,t){var i=Math.PI/180,u=n.lat*i,f=t.lat*i,r=Math.sin((t.lat-n.lat)*i/2),t=Math.sin((t.lng-n.lng)*i/2),n=r*r+Math.cos(u)*Math.cos(f)*t*t,i=2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n));return this.R*i}}),yt=6378137,yt={R:yt,MAX_LATITUDE:85.0511287798,project:function(n){var i=Math.PI/180,t=this.MAX_LATITUDE,t=Math.max(Math.min(t,n.lat),-t),t=Math.sin(t*i);return new r(this.R*n.lng*i,this.R*Math.log((1+t)/(1-t))/2)},unproject:function(n){var t=180/Math.PI;return new c((2*Math.atan(Math.exp(n.y/this.R))-Math.PI/2)*t,n.x*t/this.R)},bounds:new p([-(yt=yt*Math.PI),-yt],[yt,yt])};kf.prototype={transform:function(n,t){return this._transform(n.clone(),t)},_transform:function(n,t){return n.x=(t=t||1)*(this._a*n.x+this._b),n.y=t*(this._c*n.y+this._d),n},untransform:function(n,t){return new r((n.x/(t=t||1)-this._b)/this._a,(n.y/t-this._d)/this._c)}};ki=l({},ri,{code:"EPSG:3857",projection:yt,transformation:sr(ki=.5/(Math.PI*yt.R),.5,-ki,.5)});lo=l({},ki,{code:"EPSG:900913"});var ni=document.documentElement.style,di="ActiveXObject"in window,df=di&&!document.addEventListener,et="msLaunchUri"in navigator&&!("documentMode"in document),hr=pt("webkit"),cr=pt("android"),fu=pt("android 2")||pt("android 3"),si=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),si=cr&&pt("Google")&&si<537&&!("AudioNode"in window),hi=!!window.opera,eu=!et&&pt("chrome"),ou=pt("gecko")&&!hr&&!hi&&!di,gf=!eu&&pt("safari"),su=pt("phantom"),ft="OTransition"in ni,lr=0===navigator.platform.indexOf("Win"),hu=di&&"transition"in ni,ar="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!fu,ni="MozPerspective"in ni,cu=!window.L_DISABLE_3D&&(hu||ar||ni)&&!ft&&!su,ui="undefined"!=typeof orientation||pt("mobile"),lu=ui&&hr,au=ui&&ar,vr=!window.PointerEvent&&window.MSPointerEvent,yr=!(!window.PointerEvent&&!vr),yo="ontouchstart"in window||!!window.TouchEvent,yh=!window.L_NO_TOUCH&&(yo||yr),ph=ui&&hi,wh=ui&&ou,bh=1<(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI),kh=function(){var t=!1,n;try{n=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",b,n);window.removeEventListener("testPassiveEventSupport",b,n)}catch(t){}return t}(),dh=!!document.createElement("canvas").getContext,ne=!(!document.createElementNS||!ao("svg").createSVGRect),vu=!!ne&&((vu=document.createElement("div")).innerHTML="<svg/>","http://www.w3.org/2000/svg"===(vu.firstChild&&vu.firstChild.namespaceURI));var t={ie:di,ielt9:df,edge:et,webkit:hr,android:cr,android23:fu,androidStock:si,opera:hi,chrome:eu,gecko:ou,safari:gf,phantom:su,opera12:ft,win:lr,ie3d:hu,webkit3d:ar,gecko3d:ni,any3d:cu,mobile:ui,mobileWebkit:lu,mobileWebkit3d:au,msPointer:vr,pointer:yr,touch:yh,touchNative:yo,mobileOpera:ph,mobileGecko:wh,retina:bh,passiveEvents:kh,canvas:dh,svg:ne,vml:!ne&&function(){try{var t=document.createElement("div"),n=(t.innerHTML='<v:shape adj="1"/>',t.firstChild);return n.style.behavior="url(#default#VML)",n&&"object"==typeof n.adj}catch(t){return!1}}(),inlineSvg:vu,mac:0===navigator.platform.indexOf("Mac"),linux:0===navigator.platform.indexOf("Linux")},po=t.msPointer?"MSPointerDown":"pointerdown",wo=t.msPointer?"MSPointerMove":"pointermove",bo=t.msPointer?"MSPointerUp":"pointerup",ko=t.msPointer?"MSPointerCancel":"pointercancel",te={touchstart:po,touchmove:wo,touchend:bo,touchcancel:ko},go={touchstart:function(n,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&nt(t);yu(n,t)},touchmove:yu,touchend:yu,touchcancel:yu},gi={},ns=!1;is=200;var ie,nr,pr,pu,wu,re,ue=du(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),wr=du(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),rs="webkitTransition"===wr||"OTransition"===wr?wr+"End":"transitionend";pu="onselectstart"in document?(pr=function(){u(window,"selectstart",nt)},function(){a(window,"selectstart",nt)}):(nr=du(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]),pr=function(){var n;nr&&(n=document.documentElement.style,ie=n[nr],n[nr]="none")},function(){nr&&(document.documentElement.style[nr]=ie,ie=void 0)});di={__proto__:null,TRANSFORM:ue,TRANSITION:wr,TRANSITION_END:rs,get:us,getStyle:br,create:h,remove:w,empty:bu,toFront:tr,toBack:ir,hasClass:fe,addClass:f,removeClass:k,setClass:ee,getClass:ku,setOpacity:st,testProp:du,setTransform:ci,setPosition:g,getPosition:li,get disableTextSelection(){return pr},get enableTextSelection(){return pu},disableImageDrag:oe,enableImageDrag:se,preventOutline:he,restoreOutline:gu,getSizedParentNode:fs,getScale:ce};lt="_leaflet_events";nf={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};hs=t.linux&&t.chrome?window.devicePixelRatio:t.mac?3*window.devicePixelRatio:0<window.devicePixelRatio?2*window.devicePixelRatio:1;var df={__proto__:null,on:u,off:a,stopPropagation:ai,disableScrollPropagation:ve,disableClickPropagation:kr,preventDefault:nt,stop:vi,getPropagationPath:os,getMousePosition:ss,getWheelDelta:cs,isExternalTarget:ye,addListener:u,removeListener:a},ls=bi.extend({run:function(n,t,i,r){this.stop();this._el=n;this._inProgress=!0;this._duration=i||.25;this._easeOutPower=1/Math.max(r||.5,.2);this._startPos=li(n);this._offset=t.subtract(this._startPos);this._startTime=+new Date;this.fire("start");this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=tt(this._animate,this);this._step()},_step:function(n){var t=+new Date-this._startTime,i=1e3*this._duration;t<i?this._runFrame(this._easeOut(t/i),n):(this._runFrame(1),this._complete())},_runFrame:function(n,t){n=this._startPos.add(this._offset.multiplyBy(n));t&&n._round();g(this._el,n);this.fire("step")},_complete:function(){ot(this._animId);this._inProgress=!1;this.fire("end")},_easeOut:function(n){return 1-Math.pow(1-n,this._easeOutPower)}}),o=bi.extend({options:{crs:ki,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(n,i){i=y(this,i);this._handlers=[];this._layers={};this._zoomBoundLayers={};this._sizeChanged=!0;this._initContainer(n);this._initLayout();this._onResize=v(this._onResize,this);this._initEvents();i.maxBounds&&this.setMaxBounds(i.maxBounds);void 0!==i.zoom&&(this._zoom=this._limitZoom(i.zoom));i.center&&void 0!==i.zoom&&this.setView(e(i.center),i.zoom,{reset:!0});this.callInitHooks();this._zoomAnimated=wr&&t.any3d&&!t.mobileOpera&&this.options.zoomAnimation;this._zoomAnimated&&(this._createAnimProxy(),u(this._proxy,rs,this._catchTransitionEnd,this));this._addLayers(this.options.layers)},setView:function(n,t,i){return(t=void 0===t?this._zoom:this._limitZoom(t),n=this._limitCenter(e(n),t,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i)&&(void 0!==i.animate&&(i.zoom=l({animate:i.animate},i.zoom),i.pan=l({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==t?this._tryAnimatedZoom&&this._tryAnimatedZoom(n,t,i.zoom):this._tryAnimatedPan(n,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(n,t,i.pan&&i.pan.noMoveStart),this)},setZoom:function(n,t){return this._loaded?this.setView(this.getCenter(),n,{zoom:t}):(this._zoom=n,this)},zoomIn:function(n,i){return n=n||(t.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+n,i)},zoomOut:function(n,i){return n=n||(t.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-n,i)},setZoomAround:function(n,t,i){var u=this.getZoomScale(t),f=this.getSize().divideBy(2),n=(n instanceof r?n:this.latLngToContainerPoint(n)).subtract(f).multiplyBy(1-1/u),u=this.containerPointToLatLng(f.add(n));return this.setView(u,t,{zoom:i})},_getBoundsCenterZoom:function(n,t){t=t||{};n=n.getBounds?n.getBounds():d(n);var u=i(t.paddingTopLeft||t.padding||[0,0]),f=i(t.paddingBottomRight||t.padding||[0,0]),r=this.getBoundsZoom(n,!1,u.add(f));return(r="number"==typeof t.maxZoom?Math.min(t.maxZoom,r):r)===1/0?{center:n.getCenter(),zoom:r}:(t=f.subtract(u).divideBy(2),f=this.project(n.getSouthWest(),r),u=this.project(n.getNorthEast(),r),{center:this.unproject(f.add(u).divideBy(2).add(t),r),zoom:r})},fitBounds:function(n,t){if((n=d(n)).isValid())return n=this._getBoundsCenterZoom(n,t),this.setView(n.center,n.zoom,t);throw new Error("Bounds are not valid.");},fitWorld:function(n){return this.fitBounds([[-90,-180],[90,180]],n)},panTo:function(n,t){return this.setView(n,this._zoom,{pan:t})},panBy:function(n,t){var r;return t=t||{},(n=i(n).round()).x||n.y?(!0===t.animate||this.getSize().contains(n)?(this._panAnim||(this._panAnim=new ls,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),t.noMoveStart||this.fire("movestart"),!1!==t.animate?(f(this._mapPane,"leaflet-pan-anim"),r=this._getMapPanePos().subtract(n).round(),this._panAnim.run(this._mapPane,r,t.duration||.25,t.easeLinearity)):(this._rawPanBy(n),this.fire("move").fire("moveend"))):this._resetView(this.unproject(this.project(this.getCenter()).add(n)),this.getZoom()),this):this.fire("moveend")},flyTo:function(n,i,r){function w(n){return n=(v*v-u*u+(n?-1:1)*c*c*h*h)/(2*(n?v:u)*c*h),n=Math.sqrt(n*n+1)-n,n<1e-9?-18:Math.log(n)}function b(n){return(Math.exp(n)-Math.exp(-n))/2}function l(n){return(Math.exp(n)+Math.exp(-n))/2}function d(n){return u*(l(f)*(b(n=f+o*n)/l(n))-b(f))/c}var f;if(!1===(r=r||{}).animate||!t.any3d)return this.setView(n,i,r);this._stop();var a=this.project(this.getCenter()),y=this.project(n),p=this.getSize(),s=this._zoom,u=(n=e(n),i=void 0===i?s:i,Math.max(p.x,p.y)),v=u*this.getZoomScale(s,i),h=y.distanceTo(a)||1,o=1.42,c=o*o;f=w(0);var g=Date.now(),k=(w(1)-f)/o,nt=r.duration?1e3*r.duration:1e3*k*.8;return this._moveStart(!0,r.noMoveStart),function r(){var t=(Date.now()-g)/nt,e=(1-Math.pow(1-t,1.5))*k;t<=1?(this._flyToFrame=tt(r,this),this._move(this.unproject(a.add(y.subtract(a).multiplyBy(d(e)/h)),s),this.getScaleZoom(u/(t=e,u*(l(f)/l(f+o*t))),s),{flyTo:!0})):this._move(n,i)._moveEnd(!0)}.call(this),this},flyToBounds:function(n,t){return n=this._getBoundsCenterZoom(n,t),this.flyTo(n.center,n.zoom,t)},setMaxBounds:function(n){return n=d(n),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),n.isValid()?(this.options.maxBounds=n,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(n){var t=this.options.minZoom;return this.options.minZoom=n,this._loaded&&t!==n&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(n):this},setMaxZoom:function(n){var t=this.options.maxZoom;return this.options.maxZoom=n,this._loaded&&t!==n&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(n):this},panInsideBounds:function(n,t){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,d(n));return i.equals(n)||this.panTo(n,t),this._enforcingBounds=!1,this},panInside:function(n,t){var r=i((t=t||{}).paddingTopLeft||t.padding||[0,0]),u=i(t.paddingBottomRight||t.padding||[0,0]),e=this.project(this.getCenter()),n=this.project(n),f=this.getPixelBounds(),r=rt([f.min.add(r),f.max.subtract(u)]),f=r.getSize();return r.contains(n)||(this._enforcingBounds=!0,u=n.subtract(r.getCenter()),r=r.extend(n).getSize().subtract(f),e.x+=u.x<0?-r.x:r.x,e.y+=u.y<0?-r.y:r.y,this.panTo(this.unproject(e),t),this._enforcingBounds=!1),this},invalidateSize:function(n){if(!this._loaded)return this;n=l({animate:!1,pan:!0},!0===n?{animate:!0}:n);var i=this.getSize(),r=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),t=i.divideBy(2).round(),u=r.divideBy(2).round(),t=t.subtract(u);return t.x||t.y?(n.animate&&n.pan?this.panBy(t):(n.pan&&this._rawPanBy(t),this.fire("move"),n.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(v(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:r})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(n){var t,i;return n=this._locateOptions=l({timeout:1e4,watch:!1},n),"geolocation"in navigator?(t=v(this._handleGeolocationResponse,this),i=v(this._handleGeolocationError,this),n.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,i,n):navigator.geolocation.getCurrentPosition(t,i,n)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(n){var t;this._container._leaflet_id&&(t=n.code,n=n.message||(1===t?"permission denied":2===t?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:t,message:"Geolocation error: "+n+"."}))},_handleGeolocationResponse:function(n){if(this._container._leaflet_id){var i,t,r=new c(n.coords.latitude,n.coords.longitude),f=r.toBounds(2*n.coords.accuracy),u=this._locateOptions,e=(u.setView&&(i=this.getBoundsZoom(f),this.setView(r,u.maxZoom?Math.min(i,u.maxZoom):i)),{latlng:r,bounds:f,timestamp:n.timestamp});for(t in n.coords)"number"==typeof n.coords[t]&&(e[t]=n.coords[t]);this.fire("locationfound",e)}},addHandler:function(n,t){return t&&(t=this[n]=new t(this),this._handlers.push(t),this.options[n]&&t.enable()),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id;delete this._containerId}catch(n){this._container._leaflet_id=void 0;this._containerId=void 0}for(var n in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),w(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(ot(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[n].remove();for(n in this._panes)w(this._panes[n]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(n,t){return t=h("div","leaflet-pane"+(n?" leaflet-"+n.replace("Pane","")+"-pane":""),t||this._mapPane),n&&(this._panes[n]=t),t},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var n=this.getPixelBounds();return new ut(this.unproject(n.getBottomLeft()),this.unproject(n.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(n,r,u){n=d(n);u=i(u||[0,0]);var f=this.getZoom()||0,s=this.getMinZoom(),h=this.getMaxZoom(),e=n.getNorthWest(),n=n.getSouthEast(),u=this.getSize().subtract(u),n=rt(this.project(n,f),this.project(e,f)).getSize(),e=t.any3d?this.options.zoomSnap:1,o=u.x/n.x,u=u.y/n.y,n=r?Math.max(o,u):Math.min(o,u),f=this.getScaleZoom(n,f);return e&&(f=Math.round(f/(e/100))*(e/100),f=r?Math.ceil(f/e)*e:Math.floor(f/e)*e),Math.max(s,Math.min(h,f))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new r(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(n,t){return n=this._getTopLeftPoint(n,t),new p(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(n){return this.options.crs.getProjectedBounds(void 0===n?this.getZoom():n)},getPane:function(n){return"string"==typeof n?this._panes[n]:n},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(n,t){var i=this.options.crs;return t=void 0===t?this._zoom:t,i.scale(n)/i.scale(t)},getScaleZoom:function(n,t){var i=this.options.crs,n=(t=void 0===t?this._zoom:t,i.zoom(n*i.scale(t)));return isNaN(n)?1/0:n},project:function(n,t){return t=void 0===t?this._zoom:t,this.options.crs.latLngToPoint(e(n),t)},unproject:function(n,t){return t=void 0===t?this._zoom:t,this.options.crs.pointToLatLng(i(n),t)},layerPointToLatLng:function(n){return n=i(n).add(this.getPixelOrigin()),this.unproject(n)},latLngToLayerPoint:function(n){return this.project(e(n))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(n){return this.options.crs.wrapLatLng(e(n))},wrapLatLngBounds:function(n){return this.options.crs.wrapLatLngBounds(d(n))},distance:function(n,t){return this.options.crs.distance(e(n),e(t))},containerPointToLayerPoint:function(n){return i(n).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(n){return i(n).add(this._getMapPanePos())},containerPointToLatLng:function(n){return n=this.containerPointToLayerPoint(i(n)),this.layerPointToLatLng(n)},latLngToContainerPoint:function(n){return this.layerPointToContainerPoint(this.latLngToLayerPoint(e(n)))},mouseEventToContainerPoint:function(n){return ss(n,this._container)},mouseEventToLayerPoint:function(n){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(n))},mouseEventToLatLng:function(n){return this.layerPointToLatLng(this.mouseEventToLayerPoint(n))},_initContainer:function(n){if(n=this._container=us(n),!n)throw new Error("Map container not found.");if(n._leaflet_id)throw new Error("Map container is already initialized.");u(n,"scroll",this._onScroll,this);this._containerId=s(n)},_initLayout:function(){var i=this._container,n=(this._fadeAnimated=this.options.fadeAnimation&&t.any3d,f(i,"leaflet-container"+(t.touch?" leaflet-touch":"")+(t.retina?" leaflet-retina":"")+(t.ielt9?" leaflet-oldie":"")+(t.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),br(i,"position"));"absolute"!==n&&"relative"!==n&&"fixed"!==n&&"sticky"!==n&&(i.style.position="relative");this._initPanes();this._initControlPos&&this._initControlPos()},_initPanes:function(){var n=this._panes={};this._paneRenderers={};this._mapPane=this.createPane("mapPane",this._container);g(this._mapPane,new r(0,0));this.createPane("tilePane");this.createPane("overlayPane");this.createPane("shadowPane");this.createPane("markerPane");this.createPane("tooltipPane");this.createPane("popupPane");this.options.markerZoomAnimation||(f(n.markerPane,"leaflet-zoom-hide"),f(n.shadowPane,"leaflet-zoom-hide"))},_resetView:function(n,t,i){g(this._mapPane,new r(0,0));var f=!this._loaded,u=(this._loaded=!0,t=this._limitZoom(t),this.fire("viewprereset"),this._zoom!==t);this._moveStart(u,i)._move(n,t)._moveEnd(u);this.fire("viewreset");f&&this.fire("load")},_moveStart:function(n,t){return n&&this.fire("zoomstart"),t||this.fire("movestart"),this},_move:function(n,t,i,r){void 0===t&&(t=this._zoom);var u=this._zoom!==t;return this._zoom=t,this._lastCenter=n,this._pixelOrigin=this._getNewPixelOrigin(n),r?i&&i.pinch&&this.fire("zoom",i):((u||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(n){return n&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return ot(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(n){g(this._mapPane,this._getMapPanePos().subtract(n))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.");},_initEvents:function(n){this._targets={};var i=n?a:u;i((this._targets[s(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this);this.options.trackResize&&i(window,"resize",this._onResize,this);t.any3d&&this.options.transform3DLimit&&(n?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){ot(this._resizeRequest);this._resizeRequest=tt(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0;this._container.scrollLeft=0},_onMoveEnd:function(){var n=this._getMapPanePos();Math.max(Math.abs(n.x),Math.abs(n.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(n,t){for(var r,u=[],f="mouseout"===t||"mouseover"===t,i=n.target||n.srcElement,e=!1;i;){if((r=this._targets[s(i)])&&("click"===t||"preclick"===t)&&this._draggableMoved(r)){e=!0;break}if(r&&r.listens(t,!0)){if(f&&!ye(i,n))break;if(u.push(r),f)break}if(i===this._container)break;i=i.parentNode}return u.length||e||f||!this.listens(t,!0)?u:[this]},_isClickDisabled:function(n){for(;n&&n!==this._container;){if(n._leaflet_disable_click)return!0;n=n.parentNode}},_handleDOMEvent:function(n){var i,t=n.target||n.srcElement;!this._loaded||t._leaflet_disable_events||"click"===n.type&&this._isClickDisabled(t)||("mousedown"===(i=n.type)&&he(t),this._fireDOMEvent(n,i))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(n,t,i){var f,o,r,s,u,e;if("click"===n.type&&((u=l({},n)).type="preclick",this._fireDOMEvent(u,u.type,i)),f=this._findEventTargets(n,t),i){for(o=[],r=0;r<i.length;r++)i[r].listens(t,!0)&&o.push(i[r]);f=o.concat(f)}if(f.length)for("contextmenu"===t&&nt(n),u=f[0],e={originalEvent:n},"keypress"!==n.type&&"keydown"!==n.type&&"keyup"!==n.type&&(s=u.getLatLng&&(!u._radius||u._radius<=10),e.containerPoint=s?this.latLngToContainerPoint(u.getLatLng()):this.mouseEventToContainerPoint(n),e.layerPoint=this.containerPointToLayerPoint(e.containerPoint),e.latlng=s?u.getLatLng():this.layerPointToLatLng(e.layerPoint)),r=0;r<f.length;r++)if(f[r].fire(t,e,!0),e.originalEvent._stopped||!1===f[r].options.bubblingMouseEvents&&-1!==yf(this._mouseEvents,t))return},_draggableMoved:function(n){return(n=n.dragging&&n.dragging.enabled()?n:this).dragging&&n.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var n=0,t=this._handlers.length;n<t;n++)this._handlers[n].disable()},whenReady:function(n,t){return this._loaded?n.call(t||this,{target:this}):this.on("load",n,t),this},_getMapPanePos:function(){return li(this._mapPane)||new r(0,0)},_moved:function(){var n=this._getMapPanePos();return n&&!n.equals([0,0])},_getTopLeftPoint:function(n,t){return(n&&void 0!==t?this._getNewPixelOrigin(n,t):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(n,t){var i=this.getSize()._divideBy(2);return this.project(n,t)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(n,t,i){return i=this._getNewPixelOrigin(i,t),this.project(n,t)._subtract(i)},_latLngBoundsToNewLayerBounds:function(n,t,i){return i=this._getNewPixelOrigin(i,t),rt([this.project(n.getSouthWest(),t)._subtract(i),this.project(n.getNorthWest(),t)._subtract(i),this.project(n.getSouthEast(),t)._subtract(i),this.project(n.getNorthEast(),t)._subtract(i)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(n){return this.latLngToLayerPoint(n).subtract(this._getCenterLayerPoint())},_limitCenter:function(n,t,i){var u,r;return!i||(u=this.project(n,t),r=this.getSize().divideBy(2),r=new p(u.subtract(r),u.add(r)),r=this._getBoundsOffset(r,i,t),Math.abs(r.x)<=1&&Math.abs(r.y)<=1)?n:this.unproject(u.add(r),t)},_limitOffset:function(n,t){var i;return t?(i=new p((i=this.getPixelBounds()).min.add(n),i.max.add(n)),n.add(this._getBoundsOffset(i,t))):n},_getBoundsOffset:function(n,t,i){return t=rt(this.project(t.getNorthEast(),i),this.project(t.getSouthWest(),i)),i=t.min.subtract(n.min),t=t.max.subtract(n.max),new r(this._rebound(i.x,-t.x),this._rebound(i.y,-t.y))},_rebound:function(n,t){return 0<n+t?Math.round(n-t)/2:Math.max(0,Math.ceil(n))-Math.max(0,Math.floor(t))},_limitZoom:function(n){var r=this.getMinZoom(),u=this.getMaxZoom(),i=t.any3d?this.options.zoomSnap:1;return i&&(n=Math.round(n/i)*i),Math.max(r,Math.min(u,n))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){k(this._mapPane,"leaflet-pan-anim");this.fire("moveend")},_tryAnimatedPan:function(n,t){return n=this._getCenterOffset(n)._trunc(),!(!0!==(t&&t.animate)&&!this.getSize().contains(n))&&(this.panBy(n,t),!0)},_createAnimProxy:function(){var n=this._proxy=h("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(n);this.on("zoomanim",function(n){var t=ue,i=this._proxy.style[t];ci(this._proxy,this.project(n.center,n.zoom),this.getZoomScale(n.zoom,1));i===this._proxy.style[t]&&this._animatingZoom&&this._onZoomTransitionEnd()},this);this.on("load moveend",this._animMoveEnd,this);this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){w(this._proxy);this.off("load moveend",this._animMoveEnd,this);delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),n=this.getZoom();ci(this._proxy,this.project(t,n),this.getZoomScale(n,1))},_catchTransitionEnd:function(n){this._animatingZoom&&0<=n.propertyName.indexOf("transform")&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(n,t,i){if(!this._animatingZoom){if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(t),r=this._getCenterOffset(n)._divideBy(1-1/r);if(!0!==i.animate&&!this.getSize().contains(r))return!1;tt(function(){this._moveStart(!0,i.noMoveStart||!1)._animateZoom(n,t,!0)},this)}return!0},_animateZoom:function(n,t,i,r){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=n,this._animateToZoom=t,f(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:n,zoom:t,noUpdate:r}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(v(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&k(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});var at=dt.extend({options:{position:"topright"},initialize:function(n){y(this,n)},getPosition:function(){return this.options.position},setPosition:function(n){var t=this._map;return t&&t.removeControl(this),this.options.position=n,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(n){this.remove();this._map=n;var t=this._container=this.onAdd(n),i=this.getPosition(),n=n._controlCorners[i];return f(t,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(t,n.firstChild):n.appendChild(t),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(w(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(n){this._map&&n&&0<n.screenX&&0<n.screenY&&this._map.getContainer().focus()}}),as=(o.include({addControl:function(n){return n.addTo(this),this},removeControl:function(n){return n.remove(),this},_initControlPos:function(){function n(n,u){i[n+u]=h("div",t+n+" "+t+u,r)}var i=this._controlCorners={},t="leaflet-",r=this._controlContainer=h("div",t+"control-container",this._container);n("top","left");n("top","right");n("bottom","left");n("bottom","right")},_clearControlPos:function(){for(var n in this._controlCorners)w(this._controlCorners[n]);w(this._controlContainer);delete this._controlCorners;delete this._controlContainer}}),at.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(n,t,i,r){return i<r?-1:r<i?1:0}},initialize:function(n,t,i){for(var r in y(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,n)this._addLayer(n[r],r);for(r in t)this._addLayer(t[r],r,!0)},onAdd:function(n){this._initLayout();this._update();(this._map=n).on("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(n){return at.prototype.addTo.call(this,n),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var n=0;n<this._layers.length;n++)this._layers[n].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(n,t){return this._addLayer(n,t),this._map?this._update():this},addOverlay:function(n,t){return this._addLayer(n,t,!0),this._map?this._update():this},removeLayer:function(n){return n.off("add remove",this._onLayerChange,this),n=this._getLayer(s(n)),n&&this._layers.splice(this._layers.indexOf(n),1),this._map?this._update():this},expand:function(){f(this._container,"leaflet-control-layers-expanded");this._section.style.height=null;var n=this._map.getSize().y-(this._container.offsetTop+50);return n<this._section.clientHeight?(f(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=n+"px"):k(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return k(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var n="leaflet-control-layers",t=this._container=h("div",n),f=this.options.collapsed,i=(t.setAttribute("aria-haspopup",!0),kr(t),ve(t),this._section=h("section",n+"-list")),r=(f&&(this._map.on("click",this.collapse,this),u(t,{mouseenter:this._expandSafely,mouseleave:this.collapse},this)),this._layersLink=h("a",n+"-toggle",t));r.href="#";r.title="Layers";r.setAttribute("role","button");u(r,{keydown:function(n){13===n.keyCode&&this._expandSafely()},click:function(n){nt(n);this._expandSafely()}},this);f||this.expand();this._baseLayersList=h("div",n+"-base",i);this._separator=h("div",n+"-separator",i);this._overlaysList=h("div",n+"-overlays",i);t.appendChild(i)},_getLayer:function(n){for(var t=0;t<this._layers.length;t++)if(this._layers[t]&&s(this._layers[t].layer)===n)return this._layers[t]},_addLayer:function(n,t,i){this._map&&n.on("add remove",this._onLayerChange,this);this._layers.push({layer:n,name:t,overlay:i});this.options.sortLayers&&this._layers.sort(v(function(n,t){return this.options.sortFunction(n.layer,t.layer,n.name,t.name)},this));this.options.autoZIndex&&n.setZIndex&&(this._lastZIndex++,n.setZIndex(this._lastZIndex));this._expandIfNotCollapsed()},_update:function(){if(this._container){bu(this._baseLayersList);bu(this._overlaysList);this._layerControlInputs=[];for(var n,i,t,u=0,r=0;r<this._layers.length;r++)t=this._layers[r],this._addItem(t),i=i||t.overlay,n=n||!t.overlay,u+=t.overlay?0:1;this.options.hideSingleBase&&(this._baseLayersList.style.display=(n=n&&1<u)?"":"none");this._separator.style.display=i&&n?"":"none"}return this},_onLayerChange:function(n){this._handlingClick||this._update();var t=this._getLayer(s(n.target)),n=t.overlay?"add"===n.type?"overlayadd":"overlayremove":"add"===n.type?"baselayerchange":null;n&&this._map.fire(n,t)},_createRadioElement:function(n,t){return n='<input type="radio" class="leaflet-control-layers-selector" name="'+n+'"'+(t?' checked="checked"':"")+"/>",t=document.createElement("div"),t.innerHTML=n,t.firstChild},_addItem:function(n){var t,r=document.createElement("label"),i=this._map.hasLayer(n.layer),i=(n.overlay?((t=document.createElement("input")).type="checkbox",t.className="leaflet-control-layers-selector",t.defaultChecked=i):t=this._createRadioElement("leaflet-base-layers_"+s(this),i),this._layerControlInputs.push(t),t.layerId=s(n.layer),u(t,"click",this._onInputClick,this),document.createElement("span")),f=(i.innerHTML=" "+n.name,document.createElement("span"));return r.appendChild(f),f.appendChild(t),f.appendChild(i),(n.overlay?this._overlaysList:this._baseLayersList).appendChild(r),this._checkDisabledLayers(),r},_onInputClick:function(){var n;if(!this._preventClick){var t,u,f=this._layerControlInputs,i=[],r=[];for(this._handlingClick=!0,n=f.length-1;0<=n;n--)t=f[n],u=this._getLayer(t.layerId).layer,t.checked?i.push(u):t.checked||r.push(u);for(n=0;n<r.length;n++)this._map.hasLayer(r[n])&&this._map.removeLayer(r[n]);for(n=0;n<i.length;n++)this._map.hasLayer(i[n])||this._map.addLayer(i[n]);this._handlingClick=!1;this._refocusOnMap()}},_checkDisabledLayers:function(){for(var t,n,r=this._layerControlInputs,u=this._map.getZoom(),i=r.length-1;0<=i;i--)t=r[i],n=this._getLayer(t.layerId).layer,t.disabled=void 0!==n.options.minZoom&&u<n.options.minZoom||void 0!==n.options.maxZoom&&u>n.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var n=this._section,t=(this._preventClick=!0,u(n,"click",nt),this.expand(),this);setTimeout(function(){a(n,"click",nt);t._preventClick=!1})}})),pe=at.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+<\/span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;<\/span>',zoomOutTitle:"Zoom out"},onAdd:function(n){var i="leaflet-control-zoom",r=h("div",i+" leaflet-bar"),t=this.options;return this._zoomInButton=this._createButton(t.zoomInText,t.zoomInTitle,i+"-in",r,this._zoomIn),this._zoomOutButton=this._createButton(t.zoomOutText,t.zoomOutTitle,i+"-out",r,this._zoomOut),this._updateDisabled(),n.on("zoomend zoomlevelschange",this._updateDisabled,this),r},onRemove:function(n){n.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(n){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(n.shiftKey?3:1))},_zoomOut:function(n){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(n.shiftKey?3:1))},_createButton:function(n,t,i,r,f){return i=h("a",i,r),i.innerHTML=n,i.href="#",i.title=t,i.setAttribute("role","button"),i.setAttribute("aria-label",t),kr(i),u(i,"click",vi),u(i,"click",f,this),u(i,"click",this._refocusOnMap,this),i},_updateDisabled:function(){var n=this._map,t="leaflet-disabled";k(this._zoomInButton,t);k(this._zoomOutButton,t);this._zoomInButton.setAttribute("aria-disabled","false");this._zoomOutButton.setAttribute("aria-disabled","false");!this._disabled&&n._zoom!==n.getMinZoom()||(f(this._zoomOutButton,t),this._zoomOutButton.setAttribute("aria-disabled","true"));!this._disabled&&n._zoom!==n.getMaxZoom()||(f(this._zoomInButton,t),this._zoomInButton.setAttribute("aria-disabled","true"))}}),vs=(o.mergeOptions({zoomControl:!0}),o.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new pe,this.addControl(this.zoomControl))}),at.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(n){var t="leaflet-control-scale",i=h("div",t),r=this.options;return this._addScales(r,t+"-line",i),n.on(r.updateWhenIdle?"moveend":"move",this._update,this),n.whenReady(this._update,this),i},onRemove:function(n){n.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(n,t,i){n.metric&&(this._mScale=h("div",t,i));n.imperial&&(this._iScale=h("div",t,i))},_update:function(){var n=this._map,t=n.getSize().y/2,n=n.distance(n.containerPointToLatLng([0,t]),n.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(n)},_updateScales:function(n){this.options.metric&&n&&this._updateMetric(n);this.options.imperial&&n&&this._updateImperial(n)},_updateMetric:function(n){var t=this._getRoundNum(n);this._updateScale(this._mScale,t<1e3?t+" m":t/1e3+" km",t/n)},_updateImperial:function(n){var i,t,n=3.2808399*n;5280<n?(t=this._getRoundNum(i=n/5280),this._updateScale(this._iScale,t+" mi",t/i)):(t=this._getRoundNum(n),this._updateScale(this._iScale,t+" ft",t/n))},_updateScale:function(n,t,i){n.style.width=Math.round(this.options.maxWidth*i)+"px";n.innerHTML=t},_getRoundNum:function(n){var t=Math.pow(10,(Math.floor(n)+"").length-1),n=n/t;return t*(n=10<=n?10:5<=n?5:3<=n?3:2<=n?2:1)}})),we=at.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(t.inlineSvg?'<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/><\/svg> ':"")+"Leaflet<\/a>"},initialize:function(n){y(this,n);this._attributions={}},onAdd:function(n){for(var t in(n.attributionControl=this)._container=h("div","leaflet-control-attribution"),kr(this._container),n._layers)n._layers[t].getAttribution&&this.addAttribution(n._layers[t].getAttribution());return this._update(),n.on("layeradd",this._addAttribution,this),this._container},onRemove:function(n){n.off("layeradd",this._addAttribution,this)},_addAttribution:function(n){n.layer.getAttribution&&(this.addAttribution(n.layer.getAttribution()),n.layer.once("remove",function(){this.removeAttribution(n.layer.getAttribution())},this))},setPrefix:function(n){return this.options.prefix=n,this._update(),this},addAttribution:function(n){return n&&(this._attributions[n]||(this._attributions[n]=0),this._attributions[n]++,this._update()),this},removeAttribution:function(n){return n&&this._attributions[n]&&(this._attributions[n]--,this._update()),this},_update:function(){var i,n,t;if(this._map){n=[];for(i in this._attributions)this._attributions[i]&&n.push(i);t=[];this.options.prefix&&t.push(this.options.prefix);n.length&&t.push(n.join(", "));this._container.innerHTML=t.join(' <span aria-hidden="true">|<\/span> ')}}}),et=(o.mergeOptions({attributionControl:!0}),o.addInitHook(function(){this.options.attributionControl&&(new we).addTo(this)}),at.Layers=as,at.Zoom=pe,at.Scale=vs,at.Attribution=we,dr.layers=function(n,t,i){return new as(n,t,i)},dr.zoom=function(n){return new pe(n)},dr.scale=function(n){return new vs(n)},dr.attribution=function(n){return new we(n)},dt.extend({initialize:function(n){this._map=n},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}})),hr=(et.addTo=function(n,t){return n.addHandler(t,this),this},{Events:it}),ys=t.touch?"touchstart mousedown":"mousedown",fi=bi.extend({options:{clickTolerance:3},initialize:function(n,t,i,r){y(this,r);this._element=n;this._dragStartTarget=t||n;this._preventOutline=i},enable:function(){this._enabled||(u(this._dragStartTarget,ys,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(fi._dragging===this&&this.finishDrag(!0),a(this._dragStartTarget,ys,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(n){var i,t;this._enabled&&!this._moving&&(this._moved=!1,fe(this._element,"leaflet-zoom-anim")||(n.touches&&1!==n.touches.length?fi._dragging===this&&this.finishDrag():fi._dragging||n.shiftKey||1!==n.which&&1!==n.button&&!n.touches||((fi._dragging=this)._preventOutline&&he(this._element),oe(),pr(),this._moving||(this.fire("down"),t=n.touches?n.touches[0]:n,i=fs(this._element),this._startPoint=new r(t.clientX,t.clientY),this._startPos=li(this._element),this._parentScale=ce(i),t="mousedown"===n.type,u(document,t?"mousemove":"touchmove",this._onMove,this),u(document,t?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(n){var t;this._enabled&&(n.touches&&1<n.touches.length?this._moved=!0:!(t=new r((t=n.touches&&1===n.touches.length?n.touches[0]:n).clientX,t.clientY)._subtract(this._startPoint)).x&&!t.y||Math.abs(t.x)+Math.abs(t.y)<this.options.clickTolerance||(t.x/=this._parentScale.x,t.y/=this._parentScale.y,nt(n),this._moved||(this.fire("dragstart"),this._moved=!0,f(document.body,"leaflet-dragging"),this._lastTarget=n.target||n.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),f(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(t),this._moving=!0,this._lastEvent=n,this._updatePosition()))},_updatePosition:function(){var n={originalEvent:this._lastEvent};this.fire("predrag",n);g(this._element,this._newPos);this.fire("drag",n)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(n){k(document.body,"leaflet-dragging");this._lastTarget&&(k(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null);a(document,"mousemove touchmove",this._onMove,this);a(document,"mouseup touchend touchcancel",this._onUp,this);se();pu();var t=this._moved&&this._moving;this._moving=!1;fi._dragging=!1;t&&this.fire("dragend",{noInertia:n,distance:this._newPos.distanceTo(this._startPos)})}});cr={__proto__:null,clipPolygon:ps,polygonCenter:ws,centroid:be};var fu={__proto__:null,simplify:ks,pointToSegmentDistance:ds,closestPointOnSegment:function(n,t,i){return gr(n,t,i)},clipSegment:gs,_getEdgeIntersection:tf,_getBitCode:yi,_sqClosestPointOnSegment:gr,isFlat:ht,_flat:nh,polylineCenter:th},si={project:function(n){return new r(n.lng,n.lat)},unproject:function(n){return new c(n.y,n.x)},bounds:new p([-180,-90],[180,90])},hi={R:6378137,R_MINOR:6356752.3142451793,bounds:new p([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(n){var e=Math.PI/180,f=this.R,i=n.lat*e,t=this.R_MINOR/f,t=Math.sqrt(1-t*t),u=t*Math.sin(i),u=Math.tan(Math.PI/4-i/2)/Math.pow((1-u)/(1+u),t/2),i=-f*Math.log(Math.max(u,1e-10));return new r(n.lng*e*f,i)},unproject:function(n){for(var t,u=180/Math.PI,r=this.R,f=this.R_MINOR/r,e=Math.sqrt(1-f*f),o=Math.exp(-n.y/r),i=Math.PI/2-2*Math.atan(o),s=0,h=.1;s<15&&1e-7<Math.abs(h);s++)t=e*Math.sin(i),t=Math.pow((1-t)/(1+t),e/2),i+=h=Math.PI/2-2*Math.atan(o*t)-i;return new c(i*u,n.x*u/r)}},eu={__proto__:null,LonLat:si,Mercator:hi,SphericalMercator:yt},gf=l({},ri,{code:"EPSG:3395",projection:hi,transformation:sr(ou=.5/(Math.PI*hi.R),.5,-ou,.5)}),ih=l({},ri,{code:"EPSG:4326",projection:si,transformation:sr(1/180,1,-1/180,.5)}),su=l({},gt,{projection:si,transformation:sr(1,0,-1,0),scale:function(n){return Math.pow(2,n)},zoom:function(n){return Math.log(n)/Math.LN2},distance:function(n,t){var i=t.lng-n.lng,t=t.lat-n.lat;return Math.sqrt(i*i+t*t)},infinite:!0}),ft=(gt.Earth=ri,gt.EPSG3395=gf,gt.EPSG3857=ki,gt.EPSG900913=lo,gt.EPSG4326=ih,gt.Simple=su,bi.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(n){return n.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(n){return n&&n.removeLayer(this),this},getPane:function(n){return this._map.getPane(n?this.options[n]||n:this.options.pane)},addInteractiveTarget:function(n){return this._map._targets[s(n)]=this},removeInteractiveTarget:function(n){return delete this._map._targets[s(n)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(n){var i,t=n.target;t.hasLayer(this)&&(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents&&(i=this.getEvents(),t.on(i,this),this.once("remove",function(){t.off(i,this)},this)),this.onAdd(t),this.fire("add"),t.fire("layeradd",{layer:this}))}})),rr=(o.include({addLayer:function(n){var t;if(n._layerAdd)return t=s(n),this._layers[t]||((this._layers[t]=n)._mapToAdd=this,n.beforeAdd&&n.beforeAdd(this),this.whenReady(n._layerAdd,n)),this;throw new Error("The provided object is not a Layer.");},removeLayer:function(n){var t=s(n);return this._layers[t]&&(this._loaded&&n.onRemove(this),delete this._layers[t],this._loaded&&(this.fire("layerremove",{layer:n}),n.fire("remove")),n._map=n._mapToAdd=null),this},hasLayer:function(n){return s(n)in this._layers},eachLayer:function(n,t){for(var i in this._layers)n.call(t,this._layers[i]);return this},_addLayers:function(n){for(var t=0,i=(n=n?ct(n)?n:[n]:[]).length;t<i;t++)this.addLayer(n[t])},_addZoomLimit:function(n){isNaN(n.options.maxZoom)&&isNaN(n.options.minZoom)||(this._zoomBoundLayers[s(n)]=n,this._updateZoomLevels())},_removeZoomLimit:function(n){n=s(n);this._zoomBoundLayers[n]&&(delete this._zoomBoundLayers[n],this._updateZoomLevels())},_updateZoomLevels:function(){var r,n=1/0,t=-1/0,u=this._getZoomSpan();for(r in this._zoomBoundLayers)var i=this._zoomBoundLayers[r].options,n=void 0===i.minZoom?n:Math.min(n,i.minZoom),t=void 0===i.maxZoom?t:Math.max(t,i.maxZoom);this._layersMaxZoom=t===-1/0?void 0:t;this._layersMinZoom=n===1/0?void 0:n;u!==this._getZoomSpan()&&this.fire("zoomlevelschange");void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom);void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}}),ft.extend({initialize:function(n,t){var i,r;if(y(this,t),this._layers={},n)for(i=0,r=n.length;i<r;i++)this.addLayer(n[i])},addLayer:function(n){var t=this.getLayerId(n);return this._layers[t]=n,this._map&&this._map.addLayer(n),this},removeLayer:function(n){return n=n in this._layers?n:this.getLayerId(n),this._map&&this._layers[n]&&this._map.removeLayer(this._layers[n]),delete this._layers[n],this},hasLayer:function(n){return("number"==typeof n?n:this.getLayerId(n))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(n){var i,t,r=Array.prototype.slice.call(arguments,1);for(i in this._layers)(t=this._layers[i])[n]&&t[n].apply(t,r);return this},onAdd:function(n){this.eachLayer(n.addLayer,n)},onRemove:function(n){this.eachLayer(n.removeLayer,n)},eachLayer:function(n,t){for(var i in this._layers)n.call(t,this._layers[i]);return this},getLayer:function(n){return this._layers[n]},getLayers:function(){var n=[];return this.eachLayer(n.push,n),n},setZIndex:function(n){return this.invoke("setZIndex",n)},getLayerId:s})),ti=rr.extend({addLayer:function(n){return this.hasLayer(n)?this:(n.addEventParent(this),rr.prototype.addLayer.call(this,n),this.fire("layeradd",{layer:n}))},removeLayer:function(n){return this.hasLayer(n)?((n=n in this._layers?this._layers[n]:n).removeEventParent(this),rr.prototype.removeLayer.call(this,n),this.fire("layerremove",{layer:n})):this},setStyle:function(n){return this.invoke("setStyle",n)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t,i=new ut,n;for(t in this._layers)n=this._layers[t],i.extend(n.getBounds?n.getBounds():n.getLatLng());return i}}),ur=dt.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(n){y(this,n)},createIcon:function(n){return this._createIcon("icon",n)},createShadow:function(n){return this._createIcon("shadow",n)},_createIcon:function(n,t){var i=this._getIconUrl(n);if(i)return i=this._createImg(i,t&&"IMG"===t.tagName?t:null),this._setIconStyles(i,n),!this.options.crossOrigin&&""!==this.options.crossOrigin||(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i;if("icon"===n)throw new Error("iconUrl not set in Icon options (see the docs).");return null},_setIconStyles:function(n,t){var u=this.options,r=u[t+"Size"],r=i(r="number"==typeof r?[r,r]:r),f=i("shadow"===t&&u.shadowAnchor||u.iconAnchor||r&&r.divideBy(2,!0));n.className="leaflet-marker-"+t+" "+(u.className||"");f&&(n.style.marginLeft=-f.x+"px",n.style.marginTop=-f.y+"px");r&&(n.style.width=r.x+"px",n.style.height=r.y+"px")},_createImg:function(n,t){return(t=t||document.createElement("img")).src=n,t},_getIconUrl:function(n){return t.retina&&this.options[n+"RetinaUrl"]||this.options[n+"Url"]}}),nu=ur.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(n){return"string"!=typeof nu.imagePath&&(nu.imagePath=this._detectIconPath()),(this.options.imagePath||nu.imagePath)+ur.prototype._getIconUrl.call(this,n)},_stripUrl:function(n){function t(n,t,i){return(t=t.exec(n))&&t[i]}return(n=t(n,/^url\((['"])?(.+)\1\)$/,2))&&t(n,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var n=h("div","leaflet-default-icon-path",document.body),t=br(n,"background-image")||br(n,"backgroundImage");return document.body.removeChild(n),(t=this._stripUrl(t))?t:(n=document.querySelector('link[href$="leaflet.css"]'))?n.href.substring(0,n.href.length-12):""}}),rh=et.extend({initialize:function(n){this._marker=n},addHooks:function(){var n=this._marker._icon;this._draggable||(this._draggable=new fi(n,n,!0));this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable();f(n,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable();this._marker._icon&&k(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(n){var e=this._marker,o=e._map,s=this._marker.options.autoPanSpeed,r=this._marker.options.autoPanPadding,f=li(e._icon),u=o.getPixelBounds(),t=o.getPixelOrigin(),t=rt(u.min._subtract(t).add(r),u.max._subtract(t).subtract(r));t.contains(f)||(r=i((Math.max(t.max.x,f.x)-t.max.x)/(u.max.x-t.max.x)-(Math.min(t.min.x,f.x)-t.min.x)/(u.min.x-t.min.x),(Math.max(t.max.y,f.y)-t.max.y)/(u.max.y-t.max.y)-(Math.min(t.min.y,f.y)-t.min.y)/(u.min.y-t.min.y)).multiplyBy(s),o.panBy(r,{animate:!1}),this._draggable._newPos._add(r),this._draggable._startPos._add(r),g(e._icon,this._draggable._newPos),this._onDrag(n),this._panRequest=tt(this._adjustPan.bind(this,n)))},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng();this._marker.closePopup&&this._marker.closePopup();this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(n){this._marker.options.autoPan&&(ot(this._panRequest),this._panRequest=tt(this._adjustPan.bind(this,n)))},_onDrag:function(n){var t=this._marker,i=t._shadow,r=li(t._icon),u=t._map.layerPointToLatLng(r);i&&g(i,r);t._latlng=u;n.latlng=u;n.oldLatLng=this._oldLatLng;t.fire("move",n).fire("drag",n)},_onDragEnd:function(n){ot(this._panRequest);delete this._oldLatLng;this._marker.fire("moveend").fire("dragend",n)}}),rf=ft.extend({options:{icon:new nu,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(n,t){y(this,t);this._latlng=e(n)},onAdd:function(n){this._zoomAnimated=this._zoomAnimated&&n.options.markerZoomAnimation;this._zoomAnimated&&n.on("zoomanim",this._animateZoom,this);this._initIcon();this.update()},onRemove:function(n){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks());delete this.dragging;this._zoomAnimated&&n.off("zoomanim",this._animateZoom,this);this._removeIcon();this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(n){var t=this._latlng;return this._latlng=e(n),this.update(),this.fire("move",{oldLatLng:t,latlng:this._latlng})},setZIndexOffset:function(n){return this.options.zIndexOffset=n,this.update()},getIcon:function(){return this.options.icon},setIcon:function(n){return this.options.icon=n,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){var n;return this._icon&&this._map&&(n=this._map.latLngToLayerPoint(this._latlng).round(),this._setPos(n)),this},_initIcon:function(){var t=this.options,i="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),n=t.icon.createIcon(this._icon),r=!1,n=(n!==this._icon&&(this._icon&&this._removeIcon(),r=!0,t.title&&(n.title=t.title),"IMG"===n.tagName&&(n.alt=t.alt||"")),f(n,i),t.keyboard&&(n.tabIndex="0",n.setAttribute("role","button")),this._icon=n,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&u(n,"focus",this._panOnFocus,this),t.icon.createShadow(this._shadow)),e=!1;n!==this._shadow&&(this._removeShadow(),e=!0);n&&(f(n,i),n.alt="");this._shadow=n;t.opacity<1&&this._updateOpacity();r&&this.getPane().appendChild(this._icon);this._initInteraction();n&&e&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex});this.options.autoPanOnFocus&&a(this._icon,"focus",this._panOnFocus,this);w(this._icon);this.removeInteractiveTarget(this._icon);this._icon=null},_removeShadow:function(){this._shadow&&w(this._shadow);this._shadow=null},_setPos:function(n){this._icon&&g(this._icon,n);this._shadow&&g(this._shadow,n);this._zIndex=n.y+this.options.zIndexOffset;this._resetZIndex()},_updateZIndex:function(n){this._icon&&(this._icon.style.zIndex=this._zIndex+n)},_animateZoom:function(n){n=this._map._latLngToNewLayerPoint(this._latlng,n.zoom,n.center).round();this._setPos(n)},_initInteraction:function(){var n;this.options.interactive&&(f(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),rh&&(n=this.options.draggable,this.dragging&&(n=this.dragging.enabled(),this.dragging.disable()),this.dragging=new rh(this),n&&this.dragging.enable()))},setOpacity:function(n){return this.options.opacity=n,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var n=this.options.opacity;this._icon&&st(this._icon,n);this._shadow&&st(this._shadow,n)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var t,n,r=this._map;r&&(t=(n=this.options.icon.options).iconSize?i(n.iconSize):i(0,0),n=n.iconAnchor?i(n.iconAnchor):i(0,0),r.panInside(this._latlng,{paddingTopLeft:n,paddingBottomRight:t.subtract(n)}))},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}}),ei=ft.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(n){this._renderer=n.getRenderer(this)},onAdd:function(){this._renderer._initPath(this);this._reset();this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(n){return y(this,n),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&n&&Object.prototype.hasOwnProperty.call(n,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project();this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),uf=ei.extend({options:{fill:!0,radius:10},initialize:function(n,t){y(this,t);this._latlng=e(n);this._radius=this.options.radius},setLatLng:function(n){var t=this._latlng;return this._latlng=e(n),this.redraw(),this.fire("move",{oldLatLng:t,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(n){return this.options.radius=this._radius=n,this.redraw()},getRadius:function(){return this._radius},setStyle:function(n){var t=n&&n.radius||this._radius;return ei.prototype.setStyle.call(this,n),this.setRadius(t),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng);this._updateBounds()},_updateBounds:function(){var n=this._radius,i=this._radiusY||n,t=this._clickTolerance(),n=[n+t,i+t];this._pxBounds=new p(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(n){return n.distanceTo(this._point)<=this._radius+this._clickTolerance()}}),ke=uf.extend({initialize:function(n,t,i){if(y(this,t="number"==typeof t?l({},i,{radius:t}):t),this._latlng=e(n),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(n){return this._mRadius=n,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var n=[this._radius,this._radiusY||this._radius];return new ut(this._map.layerPointToLatLng(this._point.subtract(n)),this._map.layerPointToLatLng(this._point.add(n)))},setStyle:ei.prototype.setStyle,_project:function(){var e,i,f,n,r,o=this._latlng.lng,u=this._latlng.lat,t=this._map,s=t.options.crs;s.distance===ri.distance?(n=Math.PI/180,r=this._mRadius/ri.R/n,e=t.project([u+r,o]),i=t.project([u-r,o]),i=e.add(i).divideBy(2),f=t.unproject(i).lat,n=Math.acos((Math.cos(r*n)-Math.sin(u*n)*Math.sin(f*n))/(Math.cos(u*n)*Math.cos(f*n)))/n,!isNaN(n)&&0!==n||(n=r/Math.cos(Math.PI/180*u)),this._point=i.subtract(t.getPixelOrigin()),this._radius=isNaN(n)?0:i.x-t.project([f,o-n]).x,this._radiusY=i.y-e.y):(r=s.unproject(s.project(this._latlng).subtract([this._mRadius,0])),this._point=t.latLngToLayerPoint(this._latlng),this._radius=this._point.x-t.latLngToLayerPoint(r).x);this._updateBounds()}}),ii=ei.extend({options:{smoothFactor:1,noClip:!1},initialize:function(n,t){y(this,t);this._setLatLngs(n)},getLatLngs:function(){return this._latlngs},setLatLngs:function(n){return this._setLatLngs(n),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(n){for(var s,h,e,r=1/0,t=null,o=gr,u=0,c=this._parts.length;u<c;u++)for(var f=this._parts[u],i=1,l=f.length;i<l;i++)e=o(n,s=f[i-1],h=f[i],!0),e<r&&(r=e,t=o(n,s,h));return t&&(t.distance=Math.sqrt(r)),t},getCenter:function(){if(this._map)return th(this._defaultShape(),this._map.options.crs);throw new Error("Must add layer to map before using getCenter()");},getBounds:function(){return this._bounds},addLatLng:function(n,t){return t=t||this._defaultShape(),n=e(n),t.push(n),this._bounds.extend(n),this.redraw()},_setLatLngs:function(n){this._bounds=new ut;this._latlngs=this._convertLatLngs(n)},_defaultShape:function(){return ht(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(n){for(var i=[],r=ht(n),t=0,u=n.length;t<u;t++)r?(i[t]=e(n[t]),this._bounds.extend(i[t])):i[t]=this._convertLatLngs(n[t]);return i},_project:function(){var n=new p;this._rings=[];this._projectLatlngs(this._latlngs,this._rings,n);this._bounds.isValid()&&n.isValid()&&(this._rawPxBounds=n,this._updateBounds())},_updateBounds:function(){var n=this._clickTolerance(),n=new r(n,n);this._rawPxBounds&&(this._pxBounds=new p([this._rawPxBounds.min.subtract(n),this._rawPxBounds.max.add(n)]))},_projectLatlngs:function(n,t,i){var r,u,e=n[0]instanceof c,f=n.length;if(e){for(u=[],r=0;r<f;r++)u[r]=this._map.latLngToLayerPoint(n[r]),i.extend(u[r]);t.push(u)}else for(r=0;r<f;r++)this._projectLatlngs(n[r],t,i)},_clipPoints:function(){var o=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(o))if(this.options.noClip)this._parts=this._rings;else for(var n,f,i,r,u=this._parts,e=0,t=0,s=this._rings.length;e<s;e++)for(n=0,f=(r=this._rings[e]).length;n<f-1;n++)(i=gs(r[n],r[n+1],o,n,!0))&&(u[t]=u[t]||[],u[t].push(i[0]),i[1]===r[n+1]&&n!==f-2||(u[t].push(i[1]),t++))},_simplifyPoints:function(){for(var t=this._parts,i=this.options.smoothFactor,n=0,r=t.length;n<r;n++)t[n]=ks(t[n],i)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(n,t){var r,i,u,e,o,f,s=this._clickTolerance();if(this._pxBounds&&this._pxBounds.contains(n))for(r=0,e=this._parts.length;r<e;r++)for(i=0,u=(o=(f=this._parts[r]).length)-1;i<o;u=i++)if((t||0!==i)&&ds(n,f[u],f[i])<=s)return!0;return!1}});ii._flat=nh;pi=ii.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(this._map)return ws(this._defaultShape(),this._map.options.crs);throw new Error("Must add layer to map before using getCenter()");},_convertLatLngs:function(n){var n=ii.prototype._convertLatLngs.call(this,n),t=n.length;return 2<=t&&n[0]instanceof c&&n[0].equals(n[t-1])&&n.pop(),n},_setLatLngs:function(n){ii.prototype._setLatLngs.call(this,n);ht(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return(ht(this._latlngs[0])?this._latlngs:this._latlngs[0])[0]},_clipPoints:function(){var n=this._renderer._bounds,t=this.options.weight,t=new r(t,t),n=new p(n.min.subtract(t),n.max.add(t)),u,i,f;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(n))if(this.options.noClip)this._parts=this._rings;else for(i=0,f=this._rings.length;i<f;i++)(u=ps(this._rings[i],n,!0)).length&&this._parts.push(u)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(n){var f,t,i,r,u,e,s,h,o=!1;if(!this._pxBounds||!this._pxBounds.contains(n))return!1;for(r=0,s=this._parts.length;r<s;r++)for(u=0,e=(h=(f=this._parts[r]).length)-1;u<h;e=u++)t=f[u],i=f[e],t.y>n.y!=i.y>n.y&&n.x<(i.x-t.x)*(n.y-t.y)/(i.y-t.y)+t.x&&(o=!o);return o||ii.prototype._containsPoint.call(this,n,!0)}});wt=ti.extend({initialize:function(n,t){y(this,t);this._layers={};n&&this.addData(n)},addData:function(n){var u,e,r,f=ct(n)?n:n.features,t,i;if(f){for(u=0,e=f.length;u<e;u++)((r=f[u]).geometries||r.geometry||r.features||r.coordinates)&&this.addData(r);return this}return i=this.options,(!i.filter||i.filter(n))&&(t=ff(n,i))?(t.feature=sf(n),t.defaultOptions=t.options,this.resetStyle(t),i.onEachFeature&&i.onEachFeature(n,t),this.addLayer(t)):this},resetStyle:function(n){return void 0===n?this.eachLayer(this.resetStyle,this):(n.options=l({},n.defaultOptions),this._setLayerStyle(n,this.options.style),this)},setStyle:function(n){return this.eachLayer(function(t){this._setLayerStyle(t,n)},this)},_setLayerStyle:function(n,t){n.setStyle&&("function"==typeof t&&(t=t(n.feature)),n.setStyle(t))}});lr={toGeoJSON:function(n){return fr(this,{type:"Point",coordinates:ge(this.getLatLng(),n)})}};rf.include(lr);ke.include(lr);uf.include(lr);ii.include({toGeoJSON:function(n){var t=!ht(this._latlngs);return fr(this,{type:(t?"Multi":"")+"LineString",coordinates:of(this._latlngs,t?1:0,!1,n)})}});pi.include({toGeoJSON:function(n){var t=!ht(this._latlngs),i=t&&!ht(this._latlngs[0]),n=of(this._latlngs,i?2:t?1:0,!0,n);return fr(this,{type:(i?"Multi":"")+"Polygon",coordinates:n=t?n:[n]})}});rr.include({toMultiPoint:function(n){var t=[];return this.eachLayer(function(i){t.push(i.toGeoJSON(n).geometry.coordinates)}),fr(this,{type:"MultiPoint",coordinates:t})},toGeoJSON:function(n){var i,t,r=this.feature&&this.feature.geometry&&this.feature.geometry.type;return"MultiPoint"===r?this.toMultiPoint(n):(i="GeometryCollection"===r,t=[],this.eachLayer(function(r){r.toGeoJSON&&(r=r.toGeoJSON(n),i?t.push(r.geometry):"FeatureCollection"===(r=sf(r)).type?t.push.apply(t,r.features):t.push(r))}),i?fr(this,{geometries:t,type:"GeometryCollection"}):{type:"FeatureCollection",features:t})}});var hu=fh,hf=ft.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(n,t,i){this._url=n;this._bounds=d(t);y(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity());this.options.interactive&&(f(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image));this.getPane().appendChild(this._image);this._reset()},onRemove:function(){w(this._image);this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(n){return this.options.opacity=n,this._image&&this._updateOpacity(),this},setStyle:function(n){return n.opacity&&this.setOpacity(n.opacity),this},bringToFront:function(){return this._map&&tr(this._image),this},bringToBack:function(){return this._map&&ir(this._image),this},setUrl:function(n){return this._url=n,this._image&&(this._image.src=n),this},setBounds:function(n){return this._bounds=d(n),this._map&&this._reset(),this},getEvents:function(){var n={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(n.zoomanim=this._animateZoom),n},setZIndex:function(n){return this.options.zIndex=n,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,n=this._image=t?this._url:h("img");f(n,"leaflet-image-layer");this._zoomAnimated&&f(n,"leaflet-zoom-animated");this.options.className&&f(n,this.options.className);n.onselectstart=b;n.onmousemove=b;n.onload=v(this.fire,this,"load");n.onerror=v(this._overlayOnError,this,"error");!this.options.crossOrigin&&""!==this.options.crossOrigin||(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin);this.options.zIndex&&this._updateZIndex();t?this._url=n.src:(n.src=this._url,n.alt=this.options.alt)},_animateZoom:function(n){var t=this._map.getZoomScale(n.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,n.zoom,n.center).min;ci(this._image,n,t)},_reset:function(){var n=this._image,t=new p(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=t.getSize();g(n,t.min);n.style.width=i.x+"px";n.style.height=i.y+"px"},_updateOpacity:function(){st(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var n=this.options.errorOverlayUrl;n&&this._url!==n&&(this._url=n,this._image.src=n)},getCenter:function(){return this._bounds.getCenter()}}),eh=hf.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e="VIDEO"===this._url.tagName,n=this._image=e?this._url:h("video"),t,u;if(f(n,"leaflet-image-layer"),this._zoomAnimated&&f(n,"leaflet-zoom-animated"),this.options.className&&f(n,this.options.className),n.onselectstart=b,n.onmousemove=b,n.onloadeddata=v(this.fire,this,"load"),e){for(var i=n.getElementsByTagName("source"),o=[],r=0;r<i.length;r++)o.push(i[r].src);this._url=0<i.length?o:[n.src]}else for(ct(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(n.style,"objectFit")&&(n.style.objectFit="fill"),n.autoplay=!!this.options.autoplay,n.loop=!!this.options.loop,n.muted=!!this.options.muted,n.playsInline=!!this.options.playsInline,t=0;t<this._url.length;t++)u=h("source"),u.src=this._url[t],n.appendChild(u)}}),oh=hf.extend({_initImage:function(){var n=this._image=this._url;f(n,"leaflet-image-layer");this._zoomAnimated&&f(n,"leaflet-zoom-animated");this.options.className&&f(n,this.options.className);n.onselectstart=b;n.onmousemove=b}}),bt=ft.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(n,t){n&&(n instanceof c||ct(n))?(this._latlng=e(n),y(this,t)):(y(this,n),this._source=t);this.options.content&&(this._content=this.options.content)},openOn:function(n){return(n=arguments.length?n:this._source._map).hasLayer(this)||n.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(n){return this._map?this.close():(arguments.length?this._source=n:n=this._source,this._prepareOpen(),this.openOn(n._map)),this},onAdd:function(n){this._zoomAnimated=n._zoomAnimated;this._container||this._initLayout();n._fadeAnimated&&st(this._container,0);clearTimeout(this._removeTimeout);this.getPane().appendChild(this._container);this.update();n._fadeAnimated&&st(this._container,1);this.bringToFront();this.options.interactive&&(f(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(n){n._fadeAnimated?(st(this._container,0),this._removeTimeout=setTimeout(v(w,void 0,this._container),200)):w(this._container);this.options.interactive&&(k(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(n){return this._latlng=e(n),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(n){return this._content=n,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var n={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(n.zoomanim=this._animateZoom),n},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&tr(this._container),this},bringToBack:function(){return this._map&&ir(this._container),this},_prepareOpen:function(n){if(!(t=this._source)._map)return!1;if(t instanceof ti){var i,t=null,r=this._source._layers;for(i in r)if(r[i]._map){t=r[i];break}if(!t)return!1;this._source=t}if(!n)if(t.getCenter)n=t.getCenter();else if(t.getLatLng)n=t.getLatLng();else{if(!t.getBounds)throw new Error("Unable to get source layer LatLng.");n=t.getBounds().getCenter()}return this.setLatLng(n),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var n=this._contentNode,t="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof t)n.innerHTML=t;else{for(;n.hasChildNodes();)n.removeChild(n.firstChild);n.appendChild(t)}this.fire("contentupdate")}},_updatePosition:function(){var n,t,r;this._map&&(t=this._map.latLngToLayerPoint(this._latlng),n=i(this.options.offset),r=this._getAnchor(),this._zoomAnimated?g(this._container,t.add(r)):n=n.add(t).add(r),t=this._containerBottom=-n.y,r=this._containerLeft=-Math.round(this._containerWidth/2)+n.x,this._container.style.bottom=t+"px",this._container.style.left=r+"px")},_getAnchor:function(){return[0,0]}}),cf=(o.include({_initOverlay:function(n,t,i,r){var u=t;return u instanceof n||(u=new n(r).setContent(t)),i&&u.setLatLng(i),u}}),ft.include({_initOverlay:function(n,t,i,r){var u=i;return u instanceof n?(y(u,r),u._source=this):(u=t&&!r?t:new n(r,this)).setContent(i),u}}),bt.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(n){return!(n=arguments.length?n:this._source._map).hasLayer(this)&&n._popup&&n._popup.options.autoClose&&n.removeLayer(n._popup),n._popup=this,bt.prototype.openOn.call(this,n)},onAdd:function(n){bt.prototype.onAdd.call(this,n);n.fire("popupopen",{popup:this});this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof ei||this._source.on("preclick",ai))},onRemove:function(n){bt.prototype.onRemove.call(this,n);n.fire("popupclose",{popup:this});this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof ei||this._source.off("preclick",ai))},getEvents:function(){var n=bt.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(n.preclick=this.close),this.options.keepInView&&(n.moveend=this._adjustPan),n},_initLayout:function(){var n="leaflet-popup",i=this._container=h("div",n+" "+(this.options.className||"")+" leaflet-zoom-animated"),t=this._wrapper=h("div",n+"-content-wrapper",i);this._contentNode=h("div",n+"-content",t);kr(i);ve(this._contentNode);u(i,"contextmenu",ai);this._tipContainer=h("div",n+"-tip-container",i);this._tip=h("div",n+"-tip",this._tipContainer);this.options.closeButton&&((t=this._closeButton=h("a",n+"-close-button",i)).setAttribute("role","button"),t.setAttribute("aria-label","Close popup"),t.href="#close",t.innerHTML='<span aria-hidden="true">&#215;<\/span>',u(t,"click",function(n){nt(n);this.close()},this))},_updateLayout:function(){var i=this._contentNode,t=i.style,n=(t.width="",t.whiteSpace="nowrap",i.offsetWidth),n=Math.min(n,this.options.maxWidth),n=(n=Math.max(n,this.options.minWidth),t.width=n+1+"px",t.whiteSpace="",t.height="",i.offsetHeight),r=this.options.maxHeight;(r&&r<n?(t.height=r+"px",f):k)(i,"leaflet-popup-scrolled");this._containerWidth=this._container.offsetWidth},_animateZoom:function(n){var n=this._map._latLngToNewLayerPoint(this._latlng,n.zoom,n.center),t=this._getAnchor();g(this._container,n.add(t))},_adjustPan:function(){var h,f,n,o,u,s,e,t;this.options.autoPan&&(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning?this._autopanning=!1:(h=this._map,f=parseInt(br(this._container,"marginBottom"),10)||0,f=this._container.offsetHeight+f,t=this._containerWidth,(n=new r(this._containerLeft,-f-this._containerBottom))._add(li(this._container)),n=h.layerPointToContainerPoint(n),u=i(this.options.autoPanPadding),o=i(this.options.autoPanPaddingTopLeft||u),u=i(this.options.autoPanPaddingBottomRight||u),s=h.getSize(),e=0,n.x+t+u.x>s.x&&(e=n.x+t-s.x+u.x),n.x-e-o.x<(t=0)&&(e=n.x-o.x),n.y+f+u.y>s.y&&(t=n.y+f-s.y+u.y),n.y-t-o.y<0&&(t=n.y-o.y),(e||t)&&(this.options.keepInView&&(this._autopanning=!0),h.fire("autopanstart").panBy([e,t]))))},_getAnchor:function(){return i(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),lf=(o.mergeOptions({closePopupOnClick:!0}),o.include({openPopup:function(n,t,i){return this._initOverlay(cf,n,t,i).openOn(this),this},closePopup:function(n){return(n=arguments.length?n:this._popup)&&n.close(),this}}),ft.include({bindPopup:function(n,t){return this._popup=this._initOverlay(cf,this._popup,n,t),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(n){return this._popup&&(this instanceof ti||(this._popup._source=this),this._popup._prepareOpen(n||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(n){return this._popup&&this._popup.setContent(n),this},getPopup:function(){return this._popup},_openPopup:function(n){var t;this._popup&&this._map&&(vi(n),t=n.layer||n.target,this._popup._source!==t||t instanceof ei?(this._popup._source=t,this.openPopup(n.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(n.latlng))},_movePopup:function(n){this._popup.setLatLng(n.latlng)},_onKeyPress:function(n){13===n.originalEvent.keyCode&&this._openPopup(n)}}),bt.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(n){bt.prototype.onAdd.call(this,n);this.setOpacity(this.options.opacity);n.fire("tooltipopen",{tooltip:this});this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(n){bt.prototype.onRemove.call(this,n);n.fire("tooltipclose",{tooltip:this});this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var n=bt.prototype.getEvents.call(this);return this.options.permanent||(n.preclick=this.close),n},_initLayout:function(){var n="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=h("div",n);this._container.setAttribute("role","tooltip");this._container.setAttribute("id","leaflet-tooltip-"+s(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(n){var o,u=this._map,t=this._container,l=u.latLngToContainerPoint(u.getCenter()),u=u.layerPointToContainerPoint(n),r=this.options.direction,e=t.offsetWidth,s=t.offsetHeight,h=i(this.options.offset),c=this._getAnchor(),u="top"===r?(o=e/2,s):"bottom"===r?(o=e/2,0):(o="center"===r?e/2:"right"===r?0:"left"===r?e:u.x<l.x?(r="right",0):(r="left",e+2*(h.x+c.x)),s/2);n=n.subtract(i(o,u,!0)).add(h).add(c);k(t,"leaflet-tooltip-right");k(t,"leaflet-tooltip-left");k(t,"leaflet-tooltip-top");k(t,"leaflet-tooltip-bottom");f(t,"leaflet-tooltip-"+r);g(t,n)},_updatePosition:function(){var n=this._map.latLngToLayerPoint(this._latlng);this._setPosition(n)},setOpacity:function(n){this.options.opacity=n;this._container&&st(this._container,n)},_animateZoom:function(n){n=this._map._latLngToNewLayerPoint(this._latlng,n.zoom,n.center);this._setPosition(n)},_getAnchor:function(){return i(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}})),sh=(o.include({openTooltip:function(n,t,i){return this._initOverlay(lf,n,t,i).openOn(this),this},closeTooltip:function(n){return n.close(),this}}),ft.include({bindTooltip:function(n,t){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(lf,this._tooltip,n,t),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(n){var i,t;!n&&this._tooltipHandlersAdded||(i=n?"off":"on",t={remove:this.closeTooltip,move:this._moveTooltip},this._tooltip.options.permanent?t.add=this._openTooltip:(t.mouseover=this._openTooltip,t.mouseout=this.closeTooltip,t.click=this._openTooltip,this._map?this._addFocusListeners():t.add=this._addFocusListeners),this._tooltip.options.sticky&&(t.mousemove=this._moveTooltip),this[i](t),this._tooltipHandlersAdded=!n)},openTooltip:function(n){return this._tooltip&&(this instanceof ti||(this._tooltip._source=this),this._tooltip._prepareOpen(n)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(n){return this._tooltip&&this._tooltip.setContent(n),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(n){var t="function"==typeof n.getElement&&n.getElement();t&&(u(t,"focus",function(){this._tooltip._source=n;this.openTooltip()},this),u(t,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(n){n="function"==typeof n.getElement&&n.getElement();n&&n.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(n){var t;this._tooltip&&this._map&&(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag?(this._openOnceFlag=!0,(t=this)._map.once("moveend",function(){t._openOnceFlag=!1;t._openTooltip(n)})):(this._tooltip._source=n.layer||n.target,this.openTooltip(this._tooltip.options.sticky?n.latlng:void 0)))},_moveTooltip:function(n){var t=n.latlng;this._tooltip.options.sticky&&n.originalEvent&&(n=this._map.mouseEventToContainerPoint(n.originalEvent),n=this._map.containerPointToLayerPoint(n),t=this._map.layerPointToLatLng(n));this._tooltip.setLatLng(t)}}),ur.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(n){var n=n&&"DIV"===n.tagName?n:document.createElement("div"),t=this.options;return t.html instanceof Element?(bu(n),n.appendChild(t.html)):n.innerHTML=!1!==t.html?t.html:"",t.bgPos&&(t=i(t.bgPos),n.style.backgroundPosition=-t.x+"px "+-t.y+"px"),this._setIconStyles(n,"icon"),n},createShadow:function(){return null}}));ur.Default=nu;er=ft.extend({options:{tileSize:256,opacity:1,updateWhenIdle:t.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(n){y(this,n)},onAdd:function(){this._initContainer();this._levels={};this._tiles={};this._resetView()},beforeAdd:function(n){n._addZoomLimit(this)},onRemove:function(n){this._removeAllTiles();w(this._container);n._removeZoomLimit(this);this._container=null;this._tileZoom=void 0},bringToFront:function(){return this._map&&(tr(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ir(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(n){return this.options.opacity=n,this._updateOpacity(),this},setZIndex:function(n){return this.options.zIndex=n,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){var n;return this._map&&(this._removeAllTiles(),(n=this._clampZoom(this._map.getZoom()))!==this._tileZoom&&(this._tileZoom=n,this._updateLevels()),this._update()),this},getEvents:function(){var n={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=fo(this._onMoveEnd,this.options.updateInterval,this)),n.move=this._onMove),this._zoomAnimated&&(n.zoomanim=this._animateZoom),n},createTile:function(){return document.createElement("div")},getTileSize:function(){var n=this.options.tileSize;return n instanceof r?n:new r(n,n)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(n){for(var r,u=this.getPane().children,t=-n(-1/0,1/0),i=0,f=u.length;i<f;i++)r=u[i].style.zIndex,u[i]!==this._container&&r&&(t=n(t,+r));isFinite(t)&&(this.options.zIndex=t+n(-1,1),this._updateZIndex())},_updateOpacity:function(){var i,n;if(this._map&&!t.ielt9){st(this._container,this.options.opacity);var r,e=+new Date,u=!1,f=!1;for(r in this._tiles)n=this._tiles[r],n.current&&n.loaded&&(i=Math.min(1,(e-n.loaded)/200),st(n.el,i),i<1?u=!0:(n.active?f=!0:this._onOpaqueTile(n),n.active=!0));f&&!this._noPrune&&this._pruneTiles();u&&(ot(this._fadeFrame),this._fadeFrame=tt(this._updateOpacity,this))}},_onOpaqueTile:b,_initContainer:function(){this._container||(this._container=h("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var i=this._tileZoom,u=this.options.maxZoom,n,t,r;if(void 0!==i){for(n in this._levels)n=Number(n),this._levels[n].el.children.length||n===i?(this._levels[n].el.style.zIndex=u-Math.abs(i-n),this._onUpdateLevel(n)):(w(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);return t=this._levels[i],r=this._map,t||((t=this._levels[i]={}).el=h("div","leaflet-tile-container leaflet-zoom-animated",this._container),t.el.style.zIndex=u,t.origin=r.project(r.unproject(r.getPixelOrigin()),i).round(),t.zoom=i,this._setZoomTransform(t,r.getCenter(),r.getZoom()),b(t.el.offsetWidth),this._onCreateLevel(t)),this._level=t}},_onUpdateLevel:b,_onRemoveLevel:b,_onCreateLevel:b,_pruneTiles:function(){if(this._map){var t,n,i,r=this._map.getZoom();if(r>this.options.maxZoom||r<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(i=this._tiles[t]).retain=i.current;for(t in this._tiles)(i=this._tiles[t]).current&&!i.active&&(n=i.coords,this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2));for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(n){for(var t in this._tiles)this._tiles[t].coords.z===n&&this._removeTile(t)},_removeAllTiles:function(){for(var n in this._tiles)this._removeTile(n)},_invalidateAll:function(){for(var n in this._levels)w(this._levels[n].el),this._onRemoveLevel(Number(n)),delete this._levels[n];this._removeAllTiles();this._tileZoom=void 0},_retainParent:function(n,t,i,u){var n=Math.floor(n/2),t=Math.floor(t/2),i=i-1,f=new r(+n,+t),f=(f.z=i,this._tileCoordsToKey(f)),f=this._tiles[f];return f&&f.active?f.retain=!0:(f&&f.loaded&&(f.retain=!0),u<i&&this._retainParent(n,t,i,u))},_retainChildren:function(n,t,i,u){for(var o,e=2*n;e<2*n+2;e++)for(o=2*t;o<2*t+2;o++){var f=new r(e,o),f=(f.z=i+1,this._tileCoordsToKey(f)),f=this._tiles[f];f&&f.active?f.retain=!0:(f&&f.loaded&&(f.retain=!0),i+1<u&&this._retainChildren(e,o,i+1,u))}},_resetView:function(n){n=n&&(n.pinch||n.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),n,n)},_animateZoom:function(n){this._setView(n.center,n.zoom,!0,n.noUpdate)},_clampZoom:function(n){var t=this.options;return void 0!==t.minNativeZoom&&n<t.minNativeZoom?t.minNativeZoom:void 0!==t.maxNativeZoom&&t.maxNativeZoom<n?t.maxNativeZoom:n},_setView:function(n,t,i,r){var u=Math.round(t),u=void 0!==this.options.maxZoom&&u>this.options.maxZoom||void 0!==this.options.minZoom&&u<this.options.minZoom?void 0:this._clampZoom(u),f=this.options.updateWhenZooming&&u!==this._tileZoom;r&&!f||(this._tileZoom=u,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==u&&this._update(n),i||this._pruneTiles(),this._noPrune=!!i);this._setZoomTransforms(n,t)},_setZoomTransforms:function(n,t){for(var i in this._levels)this._setZoomTransform(this._levels[i],n,t)},_setZoomTransform:function(n,i,r){var u=this._map.getZoomScale(r,n.zoom),i=n.origin.multiplyBy(u).subtract(this._map._getNewPixelOrigin(i,r)).round();t.any3d?ci(n.el,i,u):g(n.el,i)},_resetGrid:function(){var t=this._map,n=t.options.crs,i=this._tileSize=this.getTileSize(),r=this._tileZoom,u=this._map.getPixelWorldBounds(this._tileZoom);u&&(this._globalTileRange=this._pxBoundsToTileRange(u));this._wrapX=n.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,n.wrapLng[0]],r).x/i.x),Math.ceil(t.project([0,n.wrapLng[1]],r).x/i.y)];this._wrapY=n.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([n.wrapLat[0],0],r).y/i.x),Math.ceil(t.project([n.wrapLat[1],0],r).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(n){var t=this._map,i=t._animatingZoom?Math.max(t._animateToZoom,t.getZoom()):t.getZoom(),i=t.getZoomScale(i,this._tileZoom),n=t.project(n,this._tileZoom).floor(),t=t.getSize().divideBy(2*i);return new p(n.subtract(t),n.add(t))},_update:function(n){var i=this._map,h,o,s,v,e,l,u;if(i&&(h=this._clampZoom(i.getZoom()),void 0===n&&(n=i.getCenter()),void 0!==this._tileZoom)){var c,i=this._getTiledPixelBounds(n),t=this._pxBoundsToTileRange(i),a=t.getCenter(),f=[],i=this.options.keepBuffer,y=new p(t.getBottomLeft().subtract([i,-i]),t.getTopRight().add([i,-i]));if(!(isFinite(t.min.x)&&isFinite(t.min.y)&&isFinite(t.max.x)&&isFinite(t.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(c in this._tiles)o=this._tiles[c].coords,o.z===this._tileZoom&&y.contains(new r(o.x,o.y))||(this._tiles[c].current=!1);if(1<Math.abs(h-this._tileZoom))this._setView(n,h);else{for(s=t.min.y;s<=t.max.y;s++)for(u=t.min.x;u<=t.max.x;u++)e=new r(u,s),e.z=this._tileZoom,this._isValidTile(e)&&((v=this._tiles[this._tileCoordsToKey(e)])?v.current=!0:f.push(e));if(f.sort(function(n,t){return n.distanceTo(a)-t.distanceTo(a)}),0!==f.length){for(this._loading||(this._loading=!0,this.fire("loading")),l=document.createDocumentFragment(),u=0;u<f.length;u++)this._addTile(f[u],l);this._level.el.appendChild(l)}}}},_isValidTile:function(n){var t=this._map.options.crs,i;return!t.infinite&&(i=this._globalTileRange,!t.wrapLng&&(n.x<i.min.x||n.x>i.max.x)||!t.wrapLat&&(n.y<i.min.y||n.y>i.max.y))?!1:!this.options.bounds||(t=this._tileCoordsToBounds(n),d(this.options.bounds).overlaps(t))},_keyToBounds:function(n){return this._tileCoordsToBounds(this._keyToTileCoords(n))},_tileCoordsToNwSe:function(n){var i=this._map,t=this.getTileSize(),r=n.scaleBy(t),t=r.add(t);return[i.unproject(r,n.z),i.unproject(t,n.z)]},_tileCoordsToBounds:function(n){return n=this._tileCoordsToNwSe(n),n=new ut(n[0],n[1]),this.options.noWrap?n:this._map.wrapLatLngBounds(n)},_tileCoordsToKey:function(n){return n.x+":"+n.y+":"+n.z},_keyToTileCoords:function(n){var n=n.split(":"),t=new r(+n[0],+n[1]);return t.z=+n[2],t},_removeTile:function(n){var t=this._tiles[n];t&&(w(t.el),delete this._tiles[n],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(n)}))},_initTile:function(n){f(n,"leaflet-tile");var i=this.getTileSize();n.style.width=i.x+"px";n.style.height=i.y+"px";n.onselectstart=b;n.onmousemove=b;t.ielt9&&this.options.opacity<1&&st(n,this.options.opacity)},_addTile:function(n,t){var r=this._getTilePos(n),u=this._tileCoordsToKey(n),i=this.createTile(this._wrapCoords(n),v(this._tileReady,this,n));this._initTile(i);this.createTile.length<2&&tt(v(this._tileReady,this,n,null,i));g(i,r);this._tiles[u]={el:i,coords:n,current:!0};t.appendChild(i);this.fire("tileloadstart",{tile:i,coords:n})},_tileReady:function(n,i,r){i&&this.fire("tileerror",{error:i,tile:r,coords:n});var u=this._tileCoordsToKey(n);(r=this._tiles[u])&&(r.loaded=+new Date,this._map._fadeAnimated?(st(r.el,0),ot(this._fadeFrame),this._fadeFrame=tt(this._updateOpacity,this)):(r.active=!0,this._pruneTiles()),i||(f(r.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:r.el,coords:n})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),t.ielt9||!this._map._fadeAnimated?tt(this._pruneTiles,this):setTimeout(v(this._pruneTiles,this),250)))},_getTilePos:function(n){return n.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(n){var t=new r(this._wrapX?or(n.x,this._wrapX):n.x,this._wrapY?or(n.y,this._wrapY):n.y);return t.z=n.z,t},_pxBoundsToTileRange:function(n){var t=this.getTileSize();return new p(n.min.unscaleBy(t).floor(),n.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var n in this._tiles)if(!this._tiles[n].loaded)return!1;return!0}});wi=er.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(n,i){this._url=n;(i=y(this,i)).detectRetina&&t.retina&&0<i.maxZoom?(i.tileSize=Math.floor(i.tileSize/2),i.zoomReverse?(i.zoomOffset--,i.minZoom=Math.min(i.maxZoom,i.minZoom+1)):(i.zoomOffset++,i.maxZoom=Math.max(i.minZoom,i.maxZoom-1)),i.minZoom=Math.max(0,i.minZoom)):i.zoomReverse?i.minZoom=Math.min(i.maxZoom,i.minZoom):i.maxZoom=Math.max(i.minZoom,i.maxZoom);"string"==typeof i.subdomains&&(i.subdomains=i.subdomains.split(""));this.on("tileunload",this._onTileRemove)},setUrl:function(n,t){return this._url===n&&void 0===t&&(t=!0),this._url=n,t||this.redraw(),this},createTile:function(n,t){var i=document.createElement("img");return u(i,"load",v(this._tileOnLoad,this,t,i)),u(i,"error",v(this._tileOnError,this,t,i)),!this.options.crossOrigin&&""!==this.options.crossOrigin||(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),"string"==typeof this.options.referrerPolicy&&(i.referrerPolicy=this.options.referrerPolicy),i.alt="",i.src=this.getTileUrl(n),i},getTileUrl:function(n){var i={r:t.retina?"@2x":"",s:this._getSubdomain(n),x:n.x,y:n.y,z:this._getZoomForUrl()};return this._map&&!this._map.options.crs.infinite&&(n=this._globalTileRange.max.y-n.y,this.options.tms&&(i.y=n),i["-y"]=n),oo(this._url,l(i,this.options))},_tileOnLoad:function(n,i){t.ielt9?setTimeout(v(n,this,null,i),0):n(null,i)},_tileOnError:function(n,t,i){var r=this.options.errorTileUrl;r&&t.getAttribute("src")!==r&&(t.src=r);n(i,t)},_onTileRemove:function(n){n.tile.onload=null},_getZoomForUrl:function(){var n=this._tileZoom,t=this.options.maxZoom;return(n=this.options.zoomReverse?t-n:n)+this.options.zoomOffset},_getSubdomain:function(n){return n=Math.abs(n.x+n.y)%this.options.subdomains.length,this.options.subdomains[n]},_abortLoading:function(){var t,i,n;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((n=this._tiles[t].el).onload=b,n.onerror=b,n.complete||(n.src=uu,i=this._tiles[t].coords,w(n),delete this._tiles[t],this.fire("tileabort",{tile:n,coords:i})))},_removeTile:function(n){var t=this._tiles[n];if(t)return t.el.setAttribute("src",uu),er.prototype._removeTile.call(this,n)},_tileReady:function(n,t,i){if(this._map&&(!i||i.getAttribute("src")!==uu))return er.prototype._tileReady.call(this,n,t,i)}});no=wi.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(n,i){var u,r,n,f;this._url=n;r=l({},this.defaultWmsParams);for(u in i)u in this.options||(r[u]=i[u]);n=(i=y(this,i)).detectRetina&&t.retina?2:1;f=this.getTileSize();r.width=f.x*n;r.height=f.y*n;this.wmsParams=r},onAdd:function(n){this._crs=this.options.crs||n.options.crs;this._wmsVersion=parseFloat(this.wmsParams.version);var t=1.3<=this._wmsVersion?"crs":"srs";this.wmsParams[t]=this._crs.code;wi.prototype.onAdd.call(this,n)},getTileUrl:function(n){var i=this._tileCoordsToNwSe(n),t=this._crs,t=rt(t.project(i[0]),t.project(i[1])),i=t.min,t=t.max,i=(1.3<=this._wmsVersion&&this._crs===ih?[i.y,i.x,t.y,t.x]:[i.x,i.y,t.x,t.y]).join(","),t=wi.prototype.getTileUrl.call(this,n);return t+eo(this.wmsParams,t,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+i},setParams:function(n,t){return l(this.wmsParams,n),t||this.redraw(),this}});wi.WMS=no;hh.wms=function(n,t){return new no(n,t)};kt=ft.extend({options:{padding:.1},initialize:function(n){y(this,n);s(this);this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),f(this._container,"leaflet-zoom-animated"));this.getPane().appendChild(this._container);this._update();this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this);this._destroyContainer()},getEvents:function(){var n={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(n.zoomanim=this._onAnimZoom),n},_onAnimZoom:function(n){this._updateTransform(n.center,n.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(n,i){var u=this._map.getZoomScale(i,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),f=this._map.project(this._center,i),r=r.multiplyBy(-u).add(f).subtract(this._map._getNewPixelOrigin(n,i));t.any3d?ci(this._container,r,u):g(this._container,r)},_reset:function(){for(var n in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[n]._reset()},_onZoomEnd:function(){for(var n in this._layers)this._layers[n]._project()},_updatePaths:function(){for(var n in this._layers)this._layers[n]._update()},_update:function(){var n=this.options.padding,t=this._map.getSize(),i=this._map.containerPointToLayerPoint(t.multiplyBy(-n)).round();this._bounds=new p(i,i.add(t.multiplyBy(1+2*n)).round());this._center=this._map.getCenter();this._zoom=this._map.getZoom()}});to=kt.extend({options:{tolerance:0},getEvents:function(){var n=kt.prototype.getEvents.call(this);return n.viewprereset=this._onViewPreReset,n},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){kt.prototype.onAdd.call(this);this._draw()},_initContainer:function(){var n=this._container=document.createElement("canvas");u(n,"mousemove",this._onMouseMove,this);u(n,"click dblclick mousedown mouseup contextmenu",this._onClick,this);u(n,"mouseout",this._handleMouseOut,this);n._leaflet_disable_events=!0;this._ctx=n.getContext("2d")},_destroyContainer:function(){ot(this._redrawRequest);delete this._ctx;w(this._container);a(this._container);delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var n in this._redrawBounds=null,this._layers)this._layers[n]._update();this._redraw()}},_update:function(){var i,n,r,u;this._map._animatingZoom&&this._bounds||(kt.prototype._update.call(this),i=this._bounds,n=this._container,r=i.getSize(),u=t.retina?2:1,g(n,i.min),n.width=u*r.x,n.height=u*r.y,n.style.width=r.x+"px",n.style.height=r.y+"px",t.retina&&this._ctx.scale(2,2),this._ctx.translate(-i.min.x,-i.min.y),this.fire("update"))},_reset:function(){kt.prototype._reset.call(this);this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(n){this._updateDashArray(n);n=(this._layers[s(n)]=n)._order={layer:n,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=n);this._drawLast=n;this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(n){this._requestRedraw(n)},_removePath:function(n){var t=n._order,i=t.next,t=t.prev;i?i.prev=t:this._drawLast=t;t?t.next=i:this._drawFirst=i;delete n._order;delete this._layers[s(n)];this._requestRedraw(n)},_updatePath:function(n){this._extendRedrawBounds(n);n._project();n._update();this._requestRedraw(n)},_updateStyle:function(n){this._updateDashArray(n);this._requestRedraw(n)},_updateDashArray:function(n){if("string"==typeof n.options.dashArray){for(var t,r=n.options.dashArray.split(/[, ]+/),u=[],i=0;i<r.length;i++){if(t=Number(r[i]),isNaN(t))return;u.push(t)}n.options._dashArray=u}else n.options._dashArray=n.options.dashArray},_requestRedraw:function(n){this._map&&(this._extendRedrawBounds(n),this._redrawRequest=this._redrawRequest||tt(this._redraw,this))},_extendRedrawBounds:function(n){var t;n._pxBounds&&(t=(n.options.weight||0)+1,this._redrawBounds=this._redrawBounds||new p,this._redrawBounds.extend(n._pxBounds.min.subtract([t,t])),this._redrawBounds.extend(n._pxBounds.max.add([t,t])))},_redraw:function(){this._redrawRequest=null;this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil());this._clear();this._draw();this._redrawBounds=null},_clear:function(){var t,n=this._redrawBounds;n?(t=n.getSize(),this._ctx.clearRect(n.min.x,n.min.y,t.x,t.y)):(this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore())},_draw:function(){var i,r,n=this._redrawBounds,t;for(this._ctx.save(),n&&(r=n.getSize(),this._ctx.beginPath(),this._ctx.rect(n.min.x,n.min.y,r.x,r.y),this._ctx.clip()),this._drawing=!0,t=this._drawFirst;t;t=t.next)i=t.layer,(!n||i._pxBounds&&i._pxBounds.intersects(n))&&i._updatePath();this._drawing=!1;this._ctx.restore()},_updatePoly:function(n,t){if(this._drawing){var i,r,o,f,e=n._parts,s=e.length,u=this._ctx;if(s){for(u.beginPath(),i=0;i<s;i++){for(r=0,o=e[i].length;r<o;r++)f=e[i][r],u[r?"lineTo":"moveTo"](f.x,f.y);t&&u.closePath()}this._fillStroke(u,n)}}},_updateCircle:function(n){var u,t,i,r;this._drawing&&!n._empty()&&(u=n._point,t=this._ctx,i=Math.max(Math.round(n._radius),1),1!=(r=(Math.max(Math.round(n._radiusY),1)||i)/i)&&(t.save(),t.scale(1,r)),t.beginPath(),t.arc(u.x,u.y/r,i,0,2*Math.PI,!1),1!=r&&t.restore(),this._fillStroke(t,n))},_fillStroke:function(n,t){var i=t.options;i.fill&&(n.globalAlpha=i.fillOpacity,n.fillStyle=i.fillColor||i.color,n.fill(i.fillRule||"evenodd"));i.stroke&&0!==i.weight&&(n.setLineDash&&n.setLineDash(t.options&&t.options._dashArray||[]),n.globalAlpha=i.opacity,n.lineWidth=i.weight,n.strokeStyle=i.color,n.lineCap=i.lineCap,n.lineJoin=i.lineJoin,n.stroke())},_onClick:function(n){for(var t,r,u=this._map.mouseEventToLayerPoint(n),i=this._drawFirst;i;i=i.next)(t=i.layer).options.interactive&&t._containsPoint(u)&&(("click"===n.type||"preclick"===n.type)&&this._map._draggableMoved(t)||(r=t));this._fireEvent(!!r&&[r],n)},_onMouseMove:function(n){var t;!this._map||this._map.dragging.moving()||this._map._animatingZoom||(t=this._map.mouseEventToLayerPoint(n),this._handleMouseHover(n,t))},_handleMouseOut:function(n){var t=this._hoveredLayer;t&&(k(this._container,"leaflet-interactive"),this._fireEvent([t],n,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(n,t){if(!this._mouseHoverThrottled){for(var u,i,r=this._drawFirst;r;r=r.next)(u=r.layer).options.interactive&&u._containsPoint(t)&&(i=u);i!==this._hoveredLayer&&(this._handleMouseOut(n),i&&(f(this._container,"leaflet-interactive"),this._fireEvent([i],n,"mouseover"),this._hoveredLayer=i));this._fireEvent(!!this._hoveredLayer&&[this._hoveredLayer],n);this._mouseHoverThrottled=!0;setTimeout(v(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(n,t,i){this._map._fireDOMEvent(t,i||t.type,n)},_bringToFront:function(n){var t,r,i=n._order;i&&(t=i.next,r=i.prev,t&&((t.prev=r)?r.next=t:t&&(this._drawFirst=t),i.prev=this._drawLast,(this._drawLast.next=i).next=null,this._drawLast=i,this._requestRedraw(n)))},_bringToBack:function(n){var r,i,t=n._order;t&&(r=t.next,(i=t.prev)&&((i.next=r)?r.prev=i:i&&(this._drawLast=i),t.prev=null,t.next=this._drawFirst,this._drawFirst.prev=t,this._drawFirst=t,this._requestRedraw(n)))}});var tu=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(n){return document.createElement("<lvml:"+n+' class="lvml">')}}catch(n){}return function(n){return document.createElement("<"+n+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),ar={_initContainer:function(){this._container=h("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(kt.prototype._update.call(this),this.fire("update"))},_initPath:function(n){var t=n._container=tu("shape");f(t,"leaflet-vml-shape "+(this.options.className||""));t.coordsize="1 1";n._path=tu("path");t.appendChild(n._path);this._updateStyle(n);this._layers[s(n)]=n},_addPath:function(n){var t=n._container;this._container.appendChild(t);n.options.interactive&&n.addInteractiveTarget(t)},_removePath:function(n){var t=n._container;w(t);n.removeInteractiveTarget(t);delete this._layers[s(n)]},_updateStyle:function(n){var i=n._stroke,r=n._fill,t=n.options,u=n._container;u.stroked=!!t.stroke;u.filled=!!t.fill;t.stroke?(i=i||(n._stroke=tu("stroke")),u.appendChild(i),i.weight=t.weight+"px",i.color=t.color,i.opacity=t.opacity,i.dashStyle=t.dashArray?ct(t.dashArray)?t.dashArray.join(" "):t.dashArray.replace(/( *, *)/g," "):"",i.endcap=t.lineCap.replace("butt","flat"),i.joinstyle=t.lineJoin):i&&(u.removeChild(i),n._stroke=null);t.fill?(r=r||(n._fill=tu("fill")),u.appendChild(r),r.color=t.fillColor||t.color,r.opacity=t.fillOpacity):r&&(u.removeChild(r),n._fill=null)},_updateCircle:function(n){var t=n._point.round(),i=Math.round(n._radius),r=Math.round(n._radiusY||i);this._setPath(n,n._empty()?"M0 0":"AL "+t.x+","+t.y+" "+i+","+r+" 0,23592600")},_setPath:function(n,t){n._path.v=t},_bringToFront:function(n){tr(n._container)},_bringToBack:function(n){ir(n._container)}},af=t.vml?tu:ao,iu=kt.extend({_initContainer:function(){this._container=af("svg");this._container.setAttribute("pointer-events","none");this._rootGroup=af("g");this._container.appendChild(this._rootGroup)},_destroyContainer:function(){w(this._container);a(this._container);delete this._container;delete this._rootGroup;delete this._svgSize},_update:function(){var i,n,t;this._map._animatingZoom&&this._bounds||(kt.prototype._update.call(this),n=(i=this._bounds).getSize(),t=this._container,this._svgSize&&this._svgSize.equals(n)||(this._svgSize=n,t.setAttribute("width",n.x),t.setAttribute("height",n.y)),g(t,i.min),t.setAttribute("viewBox",[i.min.x,i.min.y,n.x,n.y].join(" ")),this.fire("update"))},_initPath:function(n){var t=n._path=af("path");n.options.className&&f(t,n.options.className);n.options.interactive&&f(t,"leaflet-interactive");this._updateStyle(n);this._layers[s(n)]=n},_addPath:function(n){this._rootGroup||this._initContainer();this._rootGroup.appendChild(n._path);n.addInteractiveTarget(n._path)},_removePath:function(n){w(n._path);n.removeInteractiveTarget(n._path);delete this._layers[s(n)]},_updatePath:function(n){n._project();n._update()},_updateStyle:function(n){var t=n._path,n=n.options;t&&(n.stroke?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset")):t.setAttribute("stroke","none"),n.fill?(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none"))},_updatePoly:function(n,t){this._setPath(n,vo(n._parts,t))},_updateCircle:function(n){var i=n._point,t=Math.max(Math.round(n._radius),1),r="a"+t+","+(Math.max(Math.round(n._radiusY),1)||t)+" 0 1,0 ",i=n._empty()?"M0 0":"M"+(i.x-t)+","+i.y+r+2*t+",0 "+r+2*-t+",0 ";this._setPath(n,i)},_setPath:function(n,t){n._path.setAttribute("d",t)},_bringToFront:function(n){tr(n._path)},_bringToBack:function(n){ir(n._path)}});t.vml&&iu.include(ar);o.include({getRenderer:function(n){return n=(n=n.options.renderer||this._getPaneRenderer(n.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer()),this.hasLayer(n)||this.addLayer(n),n},_getPaneRenderer:function(n){var t;return"overlayPane"!==n&&void 0!==n&&(void 0===(t=this._paneRenderers[n])&&(t=this._createRenderer({pane:n}),this._paneRenderers[n]=t),t)},_createRenderer:function(n){return this.options.preferCanvas&&ch(n)||lh(n)}});io=pi.extend({initialize:function(n,t){pi.prototype.initialize.call(this,this._boundsToLatLngs(n),t)},setBounds:function(n){return this.setLatLngs(this._boundsToLatLngs(n))},_boundsToLatLngs:function(n){return[(n=d(n)).getSouthWest(),n.getNorthWest(),n.getNorthEast(),n.getSouthEast()]}});iu.create=af;iu.pointsToPath=vo;wt.geometryToLayer=ff;wt.coordsToLatLng=de;wt.coordsToLatLngs=ef;wt.latLngToCoords=ge;wt.latLngsToCoords=of;wt.getFeature=fr;wt.asFeature=sf;o.mergeOptions({boxZoom:!0});var ni=et.extend({initialize:function(n){this._map=n;this._container=n._container;this._pane=n._panes.overlayPane;this._resetStateTimeout=0;n.on("unload",this._destroy,this)},addHooks:function(){u(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){a(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){w(this._pane);delete this._pane},_resetState:function(){this._resetStateTimeout=0;this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(n){if(!n.shiftKey||1!==n.which&&1!==n.button)return!1;this._clearDeferredResetState();this._resetState();pr();oe();this._startPoint=this._map.mouseEventToContainerPoint(n);u(document,{contextmenu:vi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(n){this._moved||(this._moved=!0,this._box=h("div","leaflet-zoom-box",this._container),f(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart"));this._point=this._map.mouseEventToContainerPoint(n);var n=new p(this._point,this._startPoint),t=n.getSize();g(this._box,n.min);this._box.style.width=t.x+"px";this._box.style.height=t.y+"px"},_finish:function(){this._moved&&(w(this._box),k(this._container,"leaflet-crosshair"));pu();se();a(document,{contextmenu:vi,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(n){1!==n.which&&1!==n.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(v(this._resetState,this),0),n=new ut(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(n).fire("boxzoomend",{boxZoomBounds:n})))},_onKeyDown:function(n){27===n.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),cu=(o.addInitHook("addHandler","boxZoom",ni),o.mergeOptions({doubleClickZoom:!0}),et.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(n){var t=this._map,i=t.getZoom(),r=t.options.zoomDelta,i=n.originalEvent.shiftKey?i-r:i+r;"center"===t.options.doubleClickZoom?t.setZoom(i):t.setZoomAround(n.containerPoint,i)}})),ui=(o.addInitHook("addHandler","doubleClickZoom",cu),o.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),et.extend({addHooks:function(){var n;this._draggable||(n=this._map,this._draggable=new fi(n._mapPane,n._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),n.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),n.on("zoomend",this._onZoomEnd,this),n.whenReady(this._onZoomEnd,this)));f(this._map._container,"leaflet-grab leaflet-touch-drag");this._draggable.enable();this._positions=[];this._times=[]},removeHooks:function(){k(this._map._container,"leaflet-grab");k(this._map._container,"leaflet-touch-drag");this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var n,t=this._map;t._stop();this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(n=d(this._map.options.maxBounds),this._offsetLimit=rt(this._map.latLngToContainerPoint(n.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(n.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null;t.fire("movestart").fire("dragstart");t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(n){var t,i;this._map.options.inertia&&(t=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(i),this._times.push(t),this._prunePositions(t));this._map.fire("move",n).fire("drag",n)},_prunePositions:function(n){for(;1<this._positions.length&&50<n-this._times[0];)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var n=this._map.getSize().divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(n).x;this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(n,t){return n-(n-t)*this._viscosity},_onPreDragLimit:function(){var n,t;this._viscosity&&this._offsetLimit&&(n=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit,n.x<t.min.x&&(n.x=this._viscousLimit(n.x,t.min.x)),n.y<t.min.y&&(n.y=this._viscousLimit(n.y,t.min.y)),n.x>t.max.x&&(n.x=this._viscousLimit(n.x,t.max.x)),n.y>t.max.y&&(n.y=this._viscousLimit(n.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(n))},_onPreDragWrap:function(){var t=this._worldWidth,r=Math.round(t/2),n=this._initialWorldOffset,i=this._draggable._newPos.x,u=(i-r+n)%t+r-n,i=(i+r+n)%t-r-n,t=Math.abs(u+n)<Math.abs(i+n)?u:i;this._draggable._absPos=this._draggable._newPos.clone();this._draggable._newPos.x=t},_onDragEnd:function(n){var u,e,o,r,t=this._map,f=t.options,i=!f.inertia||n.noInertia||this._times.length<2;t.fire("dragend",n);!i&&(this._prunePositions(+new Date),n=this._lastPos.subtract(this._positions[0]),i=(this._lastTime-this._times[0])/1e3,u=f.easeLinearity,i=(n=n.multiplyBy(u/i)).distanceTo([0,0]),e=Math.min(f.inertiaMaxSpeed,i),n=n.multiplyBy(e/i),o=e/(f.inertiaDeceleration*u),(r=n.multiplyBy(-o/2).round()).x||r.y)?(r=t._limitOffset(r,t.options.maxBounds),tt(function(){t.panBy(r,{duration:o,easeLinearity:u,noMoveStart:!0,animate:!0})})):t.fire("moveend")}})),lu=(o.addInitHook("addHandler","dragging",ui),o.mergeOptions({keyboard:!0,keyboardPanDelta:80}),et.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(n){this._map=n;this._setPanDelta(n.options.keyboardPanDelta);this._setZoomDelta(n.options.zoomDelta)},addHooks:function(){var n=this._map._container;n.tabIndex<=0&&(n.tabIndex="0");u(n,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this);this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks();a(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this);this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){var t,i,n;this._focused||(n=document.body,t=document.documentElement,i=n.scrollTop||t.scrollTop,n=n.scrollLeft||t.scrollLeft,this._map._container.focus(),window.scrollTo(n,i))},_onFocus:function(){this._focused=!0;this._map.fire("focus")},_onBlur:function(){this._focused=!1;this._map.fire("blur")},_setPanDelta:function(n){for(var u=this._panKeys={},i=this.keyCodes,t=0,r=i.left.length;t<r;t++)u[i.left[t]]=[-1*n,0];for(t=0,r=i.right.length;t<r;t++)u[i.right[t]]=[n,0];for(t=0,r=i.down.length;t<r;t++)u[i.down[t]]=[0,n];for(t=0,r=i.up.length;t<r;t++)u[i.up[t]]=[0,-1*n]},_setZoomDelta:function(n){for(var u=this._zoomKeys={},i=this.keyCodes,t=0,r=i.zoomIn.length;t<r;t++)u[i.zoomIn[t]]=n;for(t=0,r=i.zoomOut.length;t<r;t++)u[i.zoomOut[t]]=-n},_addHooks:function(){u(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){a(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(n){if(!(n.altKey||n.ctrlKey||n.metaKey)){var f,r,u=n.keyCode,t=this._map;if(u in this._panKeys)t._panAnim&&t._panAnim._inProgress||(r=this._panKeys[u],n.shiftKey&&(r=i(r).multiplyBy(3)),t.options.maxBounds&&(r=t._limitOffset(i(r),t.options.maxBounds)),t.options.worldCopyJump?(f=t.wrapLatLng(t.unproject(t.project(t.getCenter()).add(r))),t.panTo(f)):t.panBy(r));else if(u in this._zoomKeys)t.setZoom(t.getZoom()+(n.shiftKey?3:1)*this._zoomKeys[u]);else{if(27!==u||!t._popup||!t._popup.options.closeOnEscapeKey)return;t.closePopup()}vi(n)}}})),au=(o.addInitHook("addHandler","keyboard",lu),o.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60}),et.extend({addHooks:function(){u(this._map._container,"wheel",this._onWheelScroll,this);this._delta=0},removeHooks:function(){a(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(n){var t=cs(n),i=this._map.options.wheelDebounceTime,t=(this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(n),this._startTime||(this._startTime=+new Date),Math.max(i-(+new Date-this._startTime),0));clearTimeout(this._timer);this._timer=setTimeout(v(this._performZoom,this),t);vi(n)},_performZoom:function(){var t=this._map,r=t.getZoom(),i=this._map.options.zoomSnap||0,n=(t._stop(),this._delta/(4*this._map.options.wheelPxPerZoomLevel)),n=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,i=i?Math.ceil(n/i)*i:n,n=t._limitZoom(r+(0<this._delta?i:-i))-r;this._delta=0;this._startTime=null;n&&("center"===t.options.scrollWheelZoom?t.setZoom(r+n):t.setZoomAround(this._lastMousePos,r+n))}})),vr=(o.addInitHook("addHandler","scrollWheelZoom",au),o.mergeOptions({tapHold:t.touchNative&&t.safari&&t.mobile,tapTolerance:15}),et.extend({addHooks:function(){u(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){a(this._map._container,"touchstart",this._onDown,this)},_onDown:function(n){var t;clearTimeout(this._holdTimeout);1===n.touches.length&&(t=n.touches[0],this._startPos=this._newPos=new r(t.clientX,t.clientY),this._holdTimeout=setTimeout(v(function(){this._cancel();this._isTapValid()&&(u(document,"touchend",nt),u(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",t))},this),600),u(document,"touchend touchcancel contextmenu",this._cancel,this),u(document,"touchmove",this._onMove,this))},_cancelClickPrevent:function n(){a(document,"touchend",nt);a(document,"touchend touchcancel",n)},_cancel:function(){clearTimeout(this._holdTimeout);a(document,"touchend touchcancel contextmenu",this._cancel,this);a(document,"touchmove",this._onMove,this)},_onMove:function(n){n=n.touches[0];this._newPos=new r(n.clientX,n.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(n,t){n=new MouseEvent(n,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});n._simulated=!0;t.target.dispatchEvent(n)}})),yr=(o.addInitHook("addHandler","tapHold",vr),o.mergeOptions({touchZoom:t.touch,bounceAtZoomLimits:!0}),et.extend({addHooks:function(){f(this._map._container,"leaflet-touch-zoom");u(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){k(this._map._container,"leaflet-touch-zoom");a(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(n){var i,r,t=this._map;!n.touches||2!==n.touches.length||t._animatingZoom||this._zooming||(i=t.mouseEventToContainerPoint(n.touches[0]),r=t.mouseEventToContainerPoint(n.touches[1]),this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),"center"!==t.options.touchZoom&&(this._pinchStartLatLng=t.containerPointToLatLng(i.add(r)._divideBy(2))),this._startDist=i.distanceTo(r),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),u(document,"touchmove",this._onTouchMove,this),u(document,"touchend touchcancel",this._onTouchEnd,this),nt(n))},_onTouchMove:function(n){if(n.touches&&2===n.touches.length&&this._zooming){var t=this._map,i=t.mouseEventToContainerPoint(n.touches[0]),u=t.mouseEventToContainerPoint(n.touches[1]),r=i.distanceTo(u)/this._startDist;if(this._zoom=t.getScaleZoom(r,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoom<t.getMinZoom()&&r<1||this._zoom>t.getMaxZoom()&&1<r)&&(this._zoom=t._limitZoom(this._zoom)),"center"===t.options.touchZoom){if(this._center=this._startLatLng,1==r)return}else{if(i=i._add(u)._divideBy(2)._subtract(this._centerPoint),1==r&&0===i.x&&0===i.y)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(i),this._zoom)}this._moved||(t._moveStart(!0,!1),this._moved=!0);ot(this._animRequest);u=v(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=tt(u,this,!0);nt(n)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,ot(this._animRequest),a(document,"touchmove",this._onTouchMove,this),a(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}})),rc=(o.addInitHook("addHandler","touchZoom",yr),o.BoxZoom=ni,o.DoubleClickZoom=cu,o.Drag=ui,o.Keyboard=lu,o.ScrollWheelZoom=au,o.TapHold=vr,o.TouchZoom=yr,n.Bounds=p,n.Browser=t,n.CRS=gt,n.Canvas=to,n.Circle=ke,n.CircleMarker=uf,n.Class=dt,n.Control=at,n.DivIcon=sh,n.DivOverlay=bt,n.DomEvent=df,n.DomUtil=di,n.Draggable=fi,n.Evented=bi,n.FeatureGroup=ti,n.GeoJSON=wt,n.GridLayer=er,n.Handler=et,n.Icon=ur,n.ImageOverlay=hf,n.LatLng=c,n.LatLngBounds=ut,n.Layer=ft,n.LayerGroup=rr,n.LineUtil=fu,n.Map=o,n.Marker=rf,n.Mixin=hr,n.Path=ei,n.Point=r,n.PolyUtil=cr,n.Polygon=pi,n.Polyline=ii,n.Popup=cf,n.PosAnimation=ls,n.Projection=eu,n.Rectangle=io,n.Renderer=kt,n.SVG=iu,n.SVGOverlay=oh,n.TileLayer=wi,n.Tooltip=lf,n.Transformation=kf,n.Util=vh,n.VideoOverlay=eh,n.bind=v,n.bounds=rt,n.canvas=ch,n.circle=function(n,t,i){return new ke(n,t,i)},n.circleMarker=function(n,t){return new uf(n,t)},n.control=dr,n.divIcon=function(n){return new sh(n)},n.extend=l,n.featureGroup=function(n,t){return new ti(n,t)},n.geoJSON=fh,n.geoJson=hu,n.gridLayer=function(n){return new er(n)},n.icon=function(n){return new ur(n)},n.imageOverlay=function(n,t,i){return new hf(n,t,i)},n.latLng=e,n.latLngBounds=d,n.layerGroup=function(n,t){return new rr(n,t)},n.map=function(n,t){return new o(n,t)},n.marker=function(n,t){return new rf(n,t)},n.point=i,n.polygon=function(n,t){return new pi(n,t)},n.polyline=function(n,t){return new ii(n,t)},n.popup=function(n,t){return new cf(n,t)},n.rectangle=function(n,t){return new io(n,t)},n.setOptions=y,n.stamp=s,n.svg=lh,n.svgOverlay=function(n,t,i){return new oh(n,t,i)},n.tileLayer=hh,n.tooltip=function(n,t){return new lf(n,t)},n.transformation=sr,n.version="1.9.4",n.videoOverlay=function(n,t,i){return new eh(n,t,i)},window.L);n.noConflict=function(){return window.L=rc,this};window.L=n});!function(){var t=function(n,t,i,r){this.WP$Controllers$Controller();this.proxify("_openVideo","_finishOpenVideo","_expandCollapseOnClick","_setCardHandled");this.$root=n;this.template=$$WP.Templates.Core.video;this.videosViewModel={};$.extend(!0,this.videosViewModel,t);this.videosViewModel.isPageHeader=i;this.videosViewModel.hideMobileSidebar=r;this._render()},i={$root:null,template:null,videosViewModel:null,_render:function(){var n,t=$afe.jq(window).width();this.videosViewModel.videoWidth=t*(5/12);this.videosViewModel.videoHeight=.28*t;(n={}).category=this.videosViewModel.VideoCard;this.videosViewModel.AutoExpand?(this.$root.safeAppend($afe.renderTemplate(this.template,this.videosViewModel,{})),this._setUpEventHandlers()):$.ajax({url:makeLink("Video/GetVideoCard"),type:"POST",cache:!1,data:n,dataType:"json",success:function(n){this.videosViewModel.collapsed=n.Handled;this.videosViewModel.showLinkToFeatureLibrary=n.ShowLinkToFeatureLibrary;this.$root.safeAppend($afe.renderTemplate(this.template,this.videosViewModel,{}));this._setUpEventHandlers()}.bind(this)})},_setUpEventHandlers:function(){$afe.select(".videoCard .individualVideo .mediaType").on("click",this._openVideo);$afe.select(".collapse_expand_button").off("click").on("click",this._expandCollapseOnClick);$afe.select(".collapse_label").on("click",this._setCardHandled)},_openVideo:function(t){var i,f,u,e,o;t.preventDefault();t.stopImmediatePropagation();$afe.select(".mediaType").addClass("disabled");(i=r(t,this.videosViewModel))&&""!==i?(f=i.VideoID,$.ajax({url:makeLink("Video/LogVideoView"),type:"POST",cache:!1,data:{videoID:f},error:function(){}}),this._setCardHandled(),u=i.Url,o=i.Title,e=i.Horizontal,u&&""!==u?this._finishOpenVideo(f,u,e,o):n()):n()},_finishOpenVideo:function(t,i,r,u){var h,c,o,s,f,e,l;i&&""!==i&&t&&""!==t?(headerHeight=$afe.select("#header").outerHeight(),o=$afe.jq(window).width()-2*headerHeight-20,s=$afe.jq(window).height()-2*headerHeight-20,r?(e=Math.min(.8*s,.8*o*(9/16)),f=(e=Math.max(e,180))*(16/9)):(f=Math.min(.8*o,.8*s*(9/16)),e=(f=Math.max(f,180))*(16/9)),h='<iframe class="'+(r&&!headerHeight&&f>o?"videoContainer smallMobileScreen":"videoContainer")+'" referrerpolicy="same-origin" width="'+f+'" height="'+e+'" src="'+(i.includes("?")?i+"&":i+"?")+"w="+f+"&h="+e+'&autoplay=1&cc_load_policy=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen><\/iframe>',l=$$WP.Strings.getNamespace("Core.Video"),popupTitle=u,c=[new $$WPComp.ComplexObjects.Button(l.getString("ClosePopup"),null,null,"close")],classes=r?"videoPopup Popup horizontal":"videoPopup Popup",new $$WPUtil.quickMessageBox(h,popupTitle,c,null,[],classes),$afe.select(".mediaType").removeClass("disabled")):n()},_expandCollapseOnClick:function(n){var t;n.stopImmediatePropagation();"true"===(t=$afe.jq(n.currentTarget)).safeAttr("aria-expanded")?(t.safeAttr("aria-expanded","false"),this._hideVideos()):(t.safeAttr("aria-expanded","true"),this._showVideos())},_hideVideos:function(){$afe.select(".collapse_label").addClass("expand_label").removeClass("collapse_label");$afe.select(".videos").addClass("hidden")},_showVideos:function(){$afe.select(".expand_label").addClass("collapse_label").removeClass("expand_label");$afe.select(".videos").removeClass("hidden")},_setCardHandled:function(){var n={};n.category=$afe.select(".videoCard")[0].id;$.ajax({url:makeLink("Video/SetVideoCard"),type:"POST",cache:!1,data:n})}},n=function(){var t,i,r,n=$$WP.Strings.getNamespace("Core.Video");i=n.getString("ErrorPopupTitle");r=n.getString("ErrorPopupText");t=[new $$WPComp.ComplexObjects.Button(n.getString("ClosePopup"),null,null,"close")];new $$WPUtil.quickMessageBox(r,i,t)},r=function(t,i){var u,f,r="";if(u=i.Videos,t&&t.currentTarget&&t.currentTarget.parentElement&&((r=t.currentTarget.parentElement.id)&&""!==r||(r=t.currentTarget.id)),""===r)return n(),"";for(f in u)if(u[f].VideoID===r)return u[f];return""};t.prototype=i;t.handleFailure=n;$$WP.UI=$$WP.UI||{};$$WP.UI.VideoController=t;t.extend($$WP.Controllers.Controller,"WP$UI$VideoController")}();!function(){var n={Info:1,Emergency:2},t=function(n,t,i,r,u){this.WP$Controllers$Controller();this.$container=n;this._viewModel=this.buildViewModel(t,i,r,u);this.render(this._viewModel)};t.prototype={$container:null,_viewModel:null,_template:null,buildViewModel:function(t,i,r,u){var e,o=!0,f="";if(t=$$WPUtil.GetRawString(t),i=$$WPUtil.GetRawString(i),!$$WPUtil.IsNullOrEmpty(t)){switch(t.length>120&&(t=t.substring(0,120)+$$WP.Strings.getForTemplate("Ellipsis","Global")),$$WPUtil.IsNullOrEmpty(i)&&(o=!1),r){case n.Info:f="_flat_circlewithioutline";this._template=$$WP.Templates.UI.ProgressiveDisclosureText;break;case n.Emergency:f="";this._template=$$WP.Templates.UI.EmergencyDisclaimer;break;default:this._template=$$WP.Templates.UI.ProgressiveDisclosureText;f=""}return e=f?"library.svg#"+f:"",{MainText:new Handlebars.SafeString(Handlebars.escapeExpression(t)),ExpandedText:new Handlebars.SafeString(i),CanExpand:o,IconPath:e,Classes:u}}},render:function(){this.$container.safeAppend($afe.renderTemplate(this._template,this._viewModel));this.addListeners()},addListeners:function(){this.$container.find(".expandableMainText").on("click",$.proxy(this._onMainTexToggled,this))},_onMainTexToggled:function(){var n=this.$container.find(".progressiveDisclosureText"),t=n.find(".expandableMainText"),i=n.find(".expandedText");n.hasClass("expanded")?(n.removeClass("expanded"),t.safeAttr("aria-expanded","false")):(n.addClass("expanded"),t.safeAttr("aria-expanded","true"));i.slideToggle(300)}};$$WP.UI=$$WP.UI||{};$$WP.UI.ProgressiveDisclosureController=t;$$WP.UI.ProgressiveDisclosureTypeEnum=n;t.extend($$WP.Controllers.Controller,"WP$UI$ProgressiveDisclosureController")}();$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.SpecialtiesCore=$$WP.Scheduling.SpecialtiesCore||{};$$WPSchedulingSpecialtiesCore=$$WP.Scheduling.SpecialtiesCore;Specialty=$$WP.Scheduling.Specialty;$$WPSchedulingSpecialtiesCore.LoadSpecialtyData=function(n,t,i){var r=$$WPSchedulingUtil.GetEndpointUrl("GetSpecialtyData",n);$.post({url:makeLink(r),data:$$WPUtil.postify({SpecialtyId:t,ServiceAreas:n.ServiceAreas}),cache:!1,success:i})};$$WPSchedulingSpecialtiesCore.UpdateDataPoolSpecialties=function(n,t,i){var r=n.Specialties.getFromIndex("Id",i);n.populateWithRawSchedulingData(t);r&&(r.IsDataLoaded=!0)};$$WPSchedulingSpecialtiesCore.SetUpPretext=function(n){var i=$afe.select(".specialtyPretext"),r=$$WP.Strings.get("StepPretextHeader","Scheduling.Fixed"),t=$$WP.Strings.get("SpecialtyStepPretextExpanded","Scheduling");$$WPUtil.IsNullOrEmpty(t)||new $$WP.UI.ProgressiveDisclosureController(i,r,t,$$WP.UI.ProgressiveDisclosureTypeEnum.Info,n)};$$WPSchedulingSpecialtiesCore.SetSpecialtiesViewModel=function(n,t,i,r){n.Specialties=t;n.Specialties.sort(this.__sortSpecialtiesAlphabetically);r&&this.__setPromotedSpecialtiesViewModel(n,i)};$$WPSchedulingSpecialtiesCore.__sortSpecialtiesAlphabetically=function(n,t){return n.Name.localeCompare(t.Name)};$$WPSchedulingSpecialtiesCore.__setPromotedSpecialtiesViewModel=function(n,t){if(t&&0!==t.length){n.PromotedSpecialties=[];for(var i=n.Specialties.length-1;i>=0;i--)-1!==t.indexOf(n.Specialties[i].Id)&&n.PromotedSpecialties.unshift(n.Specialties.splice(i,1)[0]);n.PromotedSpecialties&&0!==n.PromotedSpecialties.length||this.__setDefaultPromotedSpecialties(n)}else this.__setDefaultPromotedSpecialties(n);for(i=0;i<n.PromotedSpecialties.length;i++)this.__setPromotedProps(n,n.PromotedSpecialties[i])};$$WPSchedulingSpecialtiesCore.__setDefaultPromotedSpecialties=function(n){var t;t=n.Specialties.length<7?n.Specialties.length:3;n.PromotedSpecialties=n.Specialties.splice(0,t)};$$WPSchedulingSpecialtiesCore.__setPromotedProps=function(n,t){t.DataType="specialty";t.DataWorkflowModelId=n.NewProviderWorkflow.ModelId;t.ViewBinderId=n.ViewBinderId;t.PhotoUrl||(t.SvgIcon="library.svg#_flat_stethoscope")};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.LqfCore=$$WP.Scheduling.LqfCore||{};$$WPSchedulingLqfCore=$$WP.Scheduling.LqfCore;VisitType=$$WP.Scheduling.VisitType;Appointment=$$WP.Scheduling.Appointment;Lqf=$$WP.Scheduling.Lqf;Workflow=$$WP.Scheduling.Workflow;$$WPSchedulingLqfCore.HasUnansweredQuestions=function(n,t){var r,i,u=null,f=n.AppointmentBuilder.getFirstAppointment(),e=n.AppointmentBuilder.getFirstAppointmentIndex();return r=this.GetVisitTypeFromAppointment(f,n.VisitTypes),!!this.__visitTypeHasUnansweredLqf(n,r,e,t)||!!((i=this.GetDepartmentLqfData(n))&&i.Department&&(u=VisitType.getVisitTypeForDepartment(n,f,i.Department),this.__visitTypeHasUnansweredLqf(n,u)))};$$WPSchedulingLqfCore.GetVisitTypeFromAppointment=function(n,t){return $$WPUtil.IsNullOrEmpty(n.PanelId)?n.VisitType:t.getFromIndex("ID",n.PanelId)};$$WPSchedulingLqfCore.GetDepartmentLqfData=function(n){for(var r,f,u,i=n.AppointmentBuilder.getFirstAppointment(),e=i.getSelectedDepartmentsCollection().toArray(),t=0;t<e.length;t++)if(r=e[t],((f=VisitType.getVisitTypeForDepartment(n,i,r))!==i.VisitType||i.VisitTypeSource===Appointment.VisitTypeSourceEnum.DepartmentOverrideLqf)&&(u=this.GetCurrentLqfFromVisitType(n,f,r),!$$WPUtil.IsNullOrEmpty(u.LqfId)))return u;return{}};$$WPSchedulingLqfCore.GetCurrentLqfFromVisitType=function(n,t,i,r,u){var f=null;return t&&(u&&$$WPSchedulingLqfCore.__canShowAnonymousDecisionTree(u)?f=$$WPSchedulingLqfCore.__tryBuildLqfObject(n,r,t.AnonymousSchedulingDecisionTreeId,Lqf.LqfTypeEnum.DecisionTree):(f=$$WPSchedulingLqfCore.__tryBuildLqfObject(n,r,t.QuestionnaireId,Lqf.LqfTypeEnum.Questionnaire))||(f=$$WPSchedulingLqfCore.__tryBuildLqfObject(n,r,t.DecisionTreeId,Lqf.LqfTypeEnum.DecisionTree))),f||(f={}),f.Department=i,f};$$WPSchedulingLqfCore.__canShowAnonymousDecisionTree=function(n){return!n.IsAuthenticatedWidget&&((n.IsAnonymous||n.IsFromPrelogin)&&n.isTypeOpenScheduling()||n.isTypeUnIdentifiedSelfTriageForAll())};$$WPSchedulingLqfCore.__tryBuildLqfObject=function(n,t,i,r){var u=null;return $$WPUtil.IsNullOrEmpty(i)||$$WPSchedulingLqfCore.__wasAlreadyAnswered(n,i,t)||(u={LqfId:i,LqfType:r}),u};$$WPSchedulingLqfCore.__visitTypeHasUnansweredLqf=function(n,t,i,r){if(t)if(r&&$$WPSchedulingLqfCore.__canShowAnonymousDecisionTree(r)){if(!$$WPUtil.IsNullOrEmpty(t.AnonymousSchedulingDecisionTreeId)&&!this.__wasAlreadyAnswered(n,t.AnonymousSchedulingDecisionTreeId,i))return!0}else if(!$$WPUtil.IsNullOrEmpty(t.QuestionnaireId)&&!this.__wasAlreadyAnswered(n,t.QuestionnaireId,i)||!$$WPUtil.IsNullOrEmpty(t.DecisionTreeId)&&!this.__wasAlreadyAnswered(n,t.DecisionTreeId,i))return!0;return!1};$$WPSchedulingLqfCore.__wasAlreadyAnswered=function(n,t,i){var r,u=null;return $$WPUtil.IsNullOrEmpty(i)&&(i=0),r=n.Lqfs.getFromIndex(["Id","AppointmentIndex"],[t,i]),!!(u=$$WPUtil.IsNullOrEmpty(i)?n.AppointmentBuilder.getFirstAppointment():n.AppointmentBuilder.getAppointment(i)).IsLqfChainStopped||!$$WPUtil.IsNullOrEmpty(r)&&u.Lqfs.contains(r)};$$WPSchedulingLqfCore.CanWorkflowSupportLqf=function(n){return n!==Workflow.WorkflowTypesEnum.NewProvider&&n!==Workflow.WorkflowTypesEnum.Request&&n!==Workflow.WorkflowTypesEnum.Reschedule&&n!==Workflow.WorkflowTypesEnum.OnDemandTelehealth};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.ReasonsForVisitCore=$$WP.Scheduling.ReasonsForVisitCore||{};$$WPSchedulingRfvsCore=$$WP.Scheduling.ReasonsForVisitCore;ReasonForVisit=$$WP.Scheduling.ReasonForVisit;$$WPSchedulingRfvsCore.LoadReasonForVisitData=function(n,t,i,r){var u=$$WPSchedulingUtil.GetEndpointUrl("GetReasonForVisitSchedulingData",t),f={reasonForVisitLineId:n,workflow:t.toRawRequestObject(),specialtyId:i};$.post({url:makeLink(u),data:$$WPUtil.postify(f),success:r})};$$WPSchedulingRfvsCore.UpdateDataPoolReasonsForVisit=function(n,t){n.populateWithRawSchedulingData(t)};$$WPSchedulingRfvsCore.ShowAjaxSpinner=function(n){$$WPUtil.ShowAjaxSpinner(this.__getAjaxSpinner(n))};$$WPSchedulingRfvsCore.HideAjaxSpinner=function(n){$$WPUtil.HideAjaxSpinner(this.__getAjaxSpinner(n))};$$WPSchedulingRfvsCore.__getAjaxSpinner=function(n){return n.find(".rfvLoadingHeart .ajaxspinner")};$$WP.Scheduling=$$WP.Scheduling||{};$$WP.Scheduling.ProvidersCore=$$WP.Scheduling.ProvidersCore||{};$$WPSchedulingProvidersCore=$$WP.Scheduling.ProvidersCore;VisitType=$$WP.Scheduling.VisitType;Workflow=$$WP.Scheduling.Workflow;$$WPSchedulingProvidersCore.IsSingleAllowedProviderStillElligibleForScheduling=function(n,t){if(null==t||1!==t.length)return!1;for(var i=0;i<n.length;i++)if(n[i]===t[0])return!0;return!1};$$WPSchedulingProvidersCore.AreAllProvidersSelected=function(n){var r=n.Providers,i=$$WPSchedulingUtil.BuildProvidersFiltered(!0,!0,!1,n.ReasonForVisit,n.getSelectedDepartmentsCollection().toArray(),!1),t;if(r.size()!==i.length)return!1;for(t=0;t<i.length;t++)if(!r.contains(i[t]))return!1;return!0};$$WPSchedulingProvidersCore.GetProviderContextViewModel=function(n){var t={},i=[];return n?(i=n.Specialties.map(function(n){return n.Title}),t.Name=n.Name,t.PhotoUrl=n.PhotoUrl,t.PhotoClass=n.PhotoClass,t.SpecialtiesText=i.join($$WP.Strings.get("SpecialtiesListDelimiter","Scheduling")),t):null};$$WPSchedulingProvidersCore.IsProviderSpecifiedInQueryString=function(n){var t=n.SchedulingControllerParams;return!$$WPUtil.IsNullOrEmpty(t.id)||!$$WPUtil.IsNullOrEmpty(t.provId)||!$$WPUtil.IsNullOrEmpty(t.prov)}