!function(){var t,e,n,a,i,o;!function(){function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function n(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}var a=function(){function e(n){t(this,e),this.configs=n,$(".news-feed-single-post").length?this.setUpForSingleView():this.setUpForArticleList()}return n(e,[{key:"setUpForSingleView",value:function(){var t=this;return new i(this.configs),$(window).on("tagChange",(function(e){return new d(t.configs)}))}},{key:"setUpForArticleList",value:function(){var t=this;return new s(this.configs),window.addEventListener("popstate",(function(e){return new s(t.configs)})),$(window).on("tagChange",(function(e){return new s(t.configs)}))}}]),e}(),i=function(){function e(n){var a=this;t(this,e),this.configs=n;var i=this.buildFeedURL(),s=new p(i);$(s).bind("feedReady",(function(t){var e=s.feed;return new o(a.configs,e)})),s.getFeed(),new g(this.configs)}return n(e,[{key:"buildFeedURL",value:function(){var t="".concat(this.configs.newsServiceDomain,"/locations/").concat(this.configs.locationURN,"/posts/").concat(this.article(),".json"),e=sessionStorage.getItem("currentTag"),n=(new l).buildTagParam(this.configs),a=e||n;return"".concat(t,"/?").concat(a)}},{key:"article",value:function(){return window.location.href.split("/").pop()}}]),e}(),o=function(){function e(n,a){t(this,e),this.configs=n,this.feed=a,this.widget=$("#".concat(this.configs.widgetId)),this.checkSession(),this.setBackLinkHref(),this.setBackLinkText(),this.setTagHrefs(),this.buildBottomLinks(),this.backLinkListener()}return n(e,[{key:"backLinkListener",value:function(){return this.widget.find(".article-top a").click((function(t){sessionStorage.setItem("fromMiniFeed","")}))}},{key:"setBackLinkHref",value:function(){var t=this.widget.find(".article-top a"),e=sessionStorage.getItem("currentTag"),n=null!=e?e.replace(/\[\]/g,""):{tag:"tag[]=all"},a=sessionStorage.getItem("currentArticlesPage"),i=null!=a?a:{page:"1"},o="".concat(this.parentUrl(),"/?").concat(n,"&page=").concat(i);if(t)return t.attr("href",o)}},{key:"setBackLinkText",value:function(){var t=this.widget.find(".article-top a"),e=""===this.configs.returnToListText?"Return To Blog":this.configs.returnToListText;if("Return To Blog"!=e){var n=t.html().replace("Return To Blog",e);t.html(n)}return t.addClass("show")}},{key:"setTagHrefs",value:function(){var t=this.widget.find(".article-tag"),e=this;return t.each((function(t,n){var a=$(this).data("tag");return $(this).attr("href","".concat(e.parentUrl(),"/?tag=").concat(a))}))}},{key:"buildBottomLinks",value:function(){var t=""===this.configs.seeMoreNewsText?"See More News":this.configs.seeMoreNewsText,e=" ".concat(this.addToAnyCode(),"     <div class='posts-nav'>     ").concat(this.previousButton(),"     <a href='").concat(this.parentUrl(),"/' class='all-posts'>").concat(t,"</a>     ").concat(this.nextButton(),"     </div> ");return this.widget.find(".news-feed-single-post").append(e)}},{key:"previousButton",value:function(){var t=this.feed.post.previous;return t?" <a href='".concat(this.pathForPost(t),"' data-post-slug='").concat(t.title_slug,"' class='post-toggle previous-post'>                <div class='post-nav-top'>                <i class='fa fa-chevron-left'></i> <span>Previous</span>                </div>                <div>                ").concat(this.navImageMarkup(t),"                <div class='post-title'>").concat(t.title,"</div>                <div class='post-date'>").concat(t.pretty_date,"</div>                ").concat(this.authorMarkup(t),"                </div>                </a> "):""}},{key:"nextButton",value:function(){var t=this.feed.post.next;return t?" <a href='".concat(this.pathForPost(t),"' data-post-slug='").concat(t.title_slug,"' class='post-toggle next-post'>                <div class='post-nav-top'>                <span>Next</span> <i class='fa fa-chevron-right'></i>                </div>                <div>                ").concat(this.navImageMarkup(t),"                <div class='post-title'>").concat(t.title,"</div>                <div class='post-date'>").concat(t.pretty_date,"</div>                ").concat(this.authorMarkup(t),"                </div>                </a> "):""}},{key:"navImageMarkup",value:function(t){var e="";if("true"===this.configs.displayPhotos){var n,a=t.image;""===a&&(a=this.configs.defaultImage),""!==a&&(n="<img src='".concat(a,"' loading='lazy' ").concat(CloudinaryHelper.responsiveImage(a,{minWidth:300})," alt='").concat(t.image_alt,"' />")),n&&(e="<div class='post-image-wrapper'><div>".concat(n,"</div></div>"))}return e}},{key:"authorMarkup",value:function(t){return""!==t.author?"<span class='author-divider'>|</span><span class='post-author'>by ".concat(t.author,"</span>"):""}},{key:"addToAnyCode",value:function(){return"true"===this.configs.shareButtons?" <div class='a2a_kit a2a_kit_size_32 a2a_default_style'>                <a class='a2a_dd' href='https://www.addtoany.com/share'></a>                <a class='a2a_button_facebook'></a>                <a class='a2a_button_x'></a>                </div>                <script type='text/javascript' src='//static.addtoany.com/menu/page.js'><\/script>\n               <script>\n                 var a2a_config = a2a_config || {};\n                 a2a_config.exclude_services = [\"google_plus\"];\n               <\/script> ":""}},{key:"pathForPost",value:function(t){var e=window.location.href.split("/");return e.pop(),"".concat(e.join("/"),"/").concat(t.title_slug)}},{key:"parentUrl",value:function(){var t=window.location.href.split("/"),e=sessionStorage.getItem("isCurated"),n=sessionStorage.getItem("fromMiniFeed");if(e||n){var a=e||n;return t.splice(-2,2),"".concat(t.join("/"),"/").concat(a)}return t.pop(),t.join("/")}},{key:"checkSession",value:function(){if(sessionStorage.getItem("currentTag")||sessionStorage.setItem("currentTag","tag[]=all"),!sessionStorage.getItem("currentArticlesPage"))return sessionStorage.setItem("currentArticlesPage","1")}}]),e}(),s=function(){function e(n){var a=this;t(this,e),this.configs=n;var i=this.buildFeedURL(),o=new p(i);$(o).bind("feedReady",(function(t){var e=o.feed;return new r(a.configs,e),new c(a.configs,e).paginationListener()})),o.getFeed(),new g(this.configs)}return n(e,[{key:"buildFeedURL",value:function(){var t=u.getTag();t&&(window.currentTag=t);var e=u.getPage(),n=(new l).isCurated(this.configs),a="".concat(this.configs.newsServiceDomain,"/locations/").concat(this.configs.locationURN,"/blog_feed.json"),i=parseInt(this.configs.numberOfPosts);isNaN(i)&&(i=20);var o=(new l).buildTagParam(this.configs),s=t||o,r=e||"1";return sessionStorage.setItem("currentTag",s),sessionStorage.setItem("currentArticlesPage",r),sessionStorage.setItem("isCurated",n),"".concat(a,"/?").concat(s,"&page=").concat(r,"&per_page=").concat(i)}}]),e}(),r=function(){function e(n,a){t(this,e),this.configs=n,this.widget=$("#".concat(this.configs.widgetId)),this.feed=a.posts,(new l).clearAllPosts(),this.populateFeed(),this.buildPaginationLinks(a.meta)}return n(e,[{key:"populateFeed",value:function(){for(var t=[],e=0;e<this.feed.length;e++){var n=this.feed[e],a="<div class='news-feed-post'>                             ".concat(this.toggleMarkup(n,e),"                             ").concat(this.detailsMarkup(n),"                             ").concat(this.bottomToggles(n,e),"                           </div>");t.push(a)}return this.widget.append(t.join(""))}},{key:"pathForPost",value:function(t){return(new l).pathForPost(this.configs,t)}},{key:"toggleMarkup",value:function(t,e){var n="<a class='post-toggle' href='".concat(this.pathForPost(t),"' aria-label='Read ").concat(t.title,"' >");return"true"===this.configs.displayPhotos&&(""!==t.image?n+="  <img src='".concat(t.image,"' loading='lazy' ").concat(CloudinaryHelper.responsiveImage(t.image,{minWidth:300})," alt='").concat(t.image_alt,"' />"):n+="  <img src='".concat(this.configs.defaultImage,"' loading='lazy' ").concat(CloudinaryHelper.responsiveImage(this.configs.defaultImage,{minWidth:300})," alt='").concat(t.image_alt,"' />")),t.pinned&&(n+="<div class='post-pinned-container'><i class=\"fa fa-star-icon\"></i><span class='post-pinned-text'>Featured Post</span></div>"),n+="</a>",""!==t.title&&(n+="<h1 class='post-title'>".concat(t.title,"</h1>")),n}},{key:"detailsMarkup",value:function(t){var e;return""!==t.title&&(e="<span class='post-date'>".concat(t.pretty_date,"</span>")),""!==t.author&&(e+="<span>|</span><span class='post-author'>by ".concat(t.author,"</span>")),e+="<div class='post-description'>".concat(t.description,"</div>")}},{key:"bottomToggles",value:function(t,e){return"<a class='post-toggle toggle-button' href='".concat(this.pathForPost(t),"' aria-label='Read ").concat(t.title,"' >Read More</a>")}},{key:"validPagesForPagination",value:function(t){return[1,t.total_pages,t.page,t.page-2,t.page-1,t.page+1,t.page+2]}},{key:"buildPageLinkOrElipsis",value:function(t,e){for(var n=1,a=t.total_pages,i=1<=a;i?n<=a:n>=a;i?n++:n--){var o=n===t.page?"active-page":"",s=n===t.total_pages?"last":"";this.validPagesForPagination(t).includes(n)?e.push("<a href='#' class='pagination-button page-button ".concat(o," ").concat(s,"' data-page-number='").concat(n,"' data-tag='").concat(t.tag,"'>").concat(n,"</a>")):" ... "!==e[e.length-1]&&e.push(" ... ")}return e}},{key:"buildNextOrPreviousLinks",value:function(t,e){var n;return n="next"===e?["next",t.page+1,"next page","fa-chevron-right","Next Page"]:["prev",t.page-1,"previous page","fa-chevron-left","Previous Page"],"<a href='#' class='page-button pagination-button pagination-text ".concat(n[0],"' data-page-number='").concat(n[1],"' data-tag='").concat(t.tag,"' aria-label='").concat(n[2],"'><i class='fa ").concat(n[3],"'></i> <span class='previous-next'>").concat(n[4],"</span></a>")}},{key:"buildPaginationLinks",value:function(t){var e=[];if(t.total_pages>1){1!==t.page&&e.push(this.buildNextOrPreviousLinks(t,"prev")),e=this.buildPageLinkOrElipsis(t,e),t.page!==t.total_pages&&e.push(this.buildNextOrPreviousLinks(t,"next"));var n="<div class='blog-pagination'> ".concat(e.join("")," </div>");return $(".blog-feed-v2").append(n),$(n).insertAfter("#news-feed-top")}}}]),e}(),c=function(){function e(n,a){t(this,e),this.configs=n,this.feed=a,this.widget=$("#".concat(this.configs.widgetId)),this.paginationListener}return n(e,[{key:"paginationListener",value:function(){var t=this;return this.widget.find(".pagination-button").click((function(e){var n=$(e.currentTarget),a=n.data("page-number"),i=n.data("tag"),o=t.formatMetaTag(i);return t.updateUrl(o,["page",a]),t.scrollAction(),new s(t.configs),window.noEvent(e)}))}},{key:"formatMetaTag",value:function(t){return t.split(",").map((function(t){return"tag=".concat(t)})).join("&")}},{key:"updateUrl",value:function(t,e){var n=window.location.pathname,a=[];a.push("".concat(e[0],"=").concat(e[1])),a.push(t);var i=a.length?"/?".concat(a.join("&")):"";return window.history.pushState({},"","".concat(n).concat(i))}},{key:"scrollAction",value:function(){var t=$(this.widget).offset().top;return window.scrollTo(0,t)}}]),e}(),l=function(){function e(){t(this,e)}return n(e,[{key:"pathForPost",value:function(t,e){var n=window.location.pathname,a=t.canonicalBlogPage.split("/").pop(),i=""!=a?"".concat(a,"/").concat(e.title_slug):e.title_slug;if(""!=a){var o=n.split("/");o.pop(),n=o.join("/")}return"/"!==n.substr(n.length-1)&&(n+="/"),n+=i}},{key:"clearAllPosts",value:function(){return $(".blog-loading, .news-feed-post, .blog-pagination").remove()}},{key:"buildTagParam",value:function(t){var e=t.tagFilters,n=t.tagFilters.split(",");return e.length<1?"tag[]=all":n.map((function(t){return"tag[]=".concat(t)})).join("&")}},{key:"isCurated",value:function(t){var e=window.location.pathname;return""!=t.canonicalBlogPage?e.split("/").pop():""}}]),e}(),u={getPage:function(){var t=/[\\?&]page=([^&#]*)/.exec(location.search);return null!==t&&decodeURIComponent(t[1].replace(/\+/g," "))},getTag:function(){var t=location.search.match(/[\\?&]tag=([^&#]*)/g);return null!==t&&(t=t.map((function(t){return t.slice(5)}))).reduce((function(e,n,a){var i=decodeURIComponent(n.replace(/\+/g," "));return e+="tag[]=".concat(i),a<t.length-1?e+"&":e}),"")}},d=function(){function e(n){t(this,e),this.configs=n,this.setTagInSession(),this.backToParent()}return n(e,[{key:"setTagInSession",value:function(){return this.newTag=u.getTag(),sessionStorage.setItem("currentTag",this.newTag),sessionStorage.setItem("currentArticlesPage","1")}},{key:"backToParent",value:function(){var t=window.location.href.split("/");return t.pop(),window.location="".concat(t.join("/"),"/?tag=").concat(this.newTag,"&page=1")}}]),e}(),g=function(){function e(n){var a=this;t(this,e),this.configs=n,this.widget=$("#".concat(this.configs.widgetId)),this.applyWidthClasses(),$(window).resize((function(){return a.applyWidthClasses()}))}return n(e,[{key:"applyWidthClasses",value:function(){return this.widget.width()<=460?this.widget.removeClass("wide").addClass("narrow"):this.widget.removeClass("narrow").addClass("wide")}}]),e}(),p=function(){function e(n){t(this,e),this.url=n}return n(e,[{key:"getFeed",value:function(){return this.feedFromStorage()?$(this).trigger("feedReady"):this.fetch()}},{key:"fetch",value:function(){var t=this;return $.ajax({url:this.url,dataType:"json",success:function(e,n,a){return t.feed=e,t.storeFeed(),$(t).trigger("feedReady")},error:function(t,e,n){}})}},{key:"feedFromStorage",value:function(){try{return this.feed=JSON.parse(sessionStorage.getItem(this.url))}catch(t){return null}}},{key:"storeFeed",value:function(){try{return sessionStorage.setItem(this.url,JSON.stringify(this.feed))}catch(t){return null}}}]),e}();G5.loadWidgetConfigs(".blog-feed-v2 .config",a)}(),i=class{constructor(e){this.configs=e,this.widget=$(`#${this.configs.widgetId}`),new a(this.configs,this.widget),window.addEventListener("popstate",(t=>new a(this.configs,this.widget))),$(window).on("tagChange",(e=>new t(this.widget)))}},a=class{constructor(t,a){var i,o;this.configs=t,this.widget=a,o=`${this.configs.newsServiceDomain}/locations/${this.configs.locationURN}/tags.json`,i=new e(o),$(i).bind("feedReady",(t=>{var e;return e=i.feed.tags,new n(e,this.widget)})),i.getFeed()}},n=class{constructor(t,e){this.tags=t,this.widget=e,this.buildMarkup(),this.clickListeners()}buildMarkup(){var e,n,a,i,o,s;for(this.widget.find(".tag-link").remove(),(i=[]).push("<a href='#' class='tag-link' data-tag='all'>All</a>"),n=e=0,a=(o=this.tags).length;e<a;n=++e)s=o[n],i.push(`<a href='#' class='tag-link' data-tag='${s.name}'>${this.titleize(s.name)}</a>`);return this.widget.append(i.join("")),new t(this.widget)}clickListeners(){var t;return t=this,this.widget.on("click",".tag-link",(function(){var e;return e=$(this).data("tag"),t.updateUrl("tag",e),$(window).trigger("tagChange"),!1}))}updateUrl(t,e){var n,a;return n=window.location.pathname,a=t&&e?`?${t}=${e}`:"",window.history.pushState({},"",`${n}${a}`)}titleize(t){var e,n,a,i,o,s;for(e=[],a=n=0,i=(s=t.split("-")).length;n<i;a=++n)o=s[a],e.push(o.charAt(0).toUpperCase()+o.toLowerCase().slice(1));return e.join(" ")}},e=class{constructor(t){this.url=t}getFeed(){return this.feedFromStorage()?$(this).trigger("feedReady"):this.fetch()}fetch(){return $.ajax({url:this.url,dataType:"json",success:(t,e,n)=>(this.feed=t,this.storeFeed(),$(this).trigger("feedReady")),error:(t,e,n)=>{}})}feedFromStorage(){try{return this.feed=JSON.parse(sessionStorage.getItem(this.url))}catch(t){return null}}storeFeed(){try{return sessionStorage.setItem(this.url,JSON.stringify(this.feed))}catch(t){return null}}},t=class{constructor(t){var e,n,a;this.widget=t,this.widget.find(".tag-link").removeClass("active-tag"),a=new o("tag").value(),n=sessionStorage.getItem("currentTag"),(e=a||n)?this.widget.find(`.tag-link[data-tag='${e}']`).addClass("active-tag"):this.widget.find(".tag-link[data-tag='all']").addClass("active-tag")}},o=class{constructor(t){this.param=t}value(){var t,e;return t=this.param.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),null!==(e=new RegExp(`[\\?&]${t}=([^&#]*)`).exec(location.search))&&decodeURIComponent(e[1].replace(/\+/g," "))}},G5.loadWidgetConfigs(".blog-tags .config",i),function(){function t(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,n){if(!t)return;if("string"==typeof t)return e(t,n);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return e(t,n)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var i=function(){function e(t){var n=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.configs=t,null!=this.configs){var a=Array.from(Array(parseInt(this.configs.amountOfOptions)).keys()).map((function(t){return t+1}));this.formsToAppendLocation=a.map((function(t){return n.configs["form_to_append_location_select_".concat(t)]})),this.widget=$("#".concat(this.configs.widgetId)),this.userSelectOptions=this.configs.userSelectForms,this.clsUrl=this.configs.secureClsUrl,this.locationUrn=this.configs.locationUrn,this.locationsJson=this.configs.locationsJson,this.form=this.widget.find("form"),this.formSelectDropdown=this.widget.find(".user-form-options"),this.leadSlugForLocSelect="".concat(this.formsToAppendLocation.find((function(t){return!!t}))),this.locationDropdown=this.widget.find(".location-select"),this.runLocSelectOnce=!1,this.index=1,this.userSelect(),this.triggerEnhancer(),this.hideLocationSelect(),this.appendLocationDropdown(),this.changeFormId()}}var i,o,s;return i=e,(o=[{key:"submitHackUrn",get:function(){return"true"===this.configs["hack_urn_".concat(this.index)]}},{key:"showPendingLocations",get:function(){return"true"===this.configs["show_pending_".concat(this.index)]}},{key:"showCorporateLocations",get:function(){return"true"===this.configs["show_corporate_".concat(this.index)]}},{key:"isOrderedBy",get:function(){switch(this.configs["select_ordering_".concat(this.index)]){case"order_by_state_city_address":return{displayBy:this.displayByStateCityAddress,orderBy:["state","city","street_address"]};case"order_by_city_brandedName":return{displayBy:this.displayByCityBrandedName,orderBy:["city","name","state"]};case"order_by_brandedName_city_state":return{displayBy:this.displayByBrandedNameCityState,orderBy:["name","state","city"]};case"order_by_city_state_brandedName":return{displayBy:this.displayByCityStateBrandedName,orderBy:["state","city","name"]};case"order_by_displayName_city_state":return{displayBy:this.displayByDisplayNameCityState,orderBy:["display_name","state","city"]};case"order_by_city_state_displayName":return{displayBy:this.displayByCityStateDisplayName,orderBy:["state","city","display_name"]};case"order_by_state_city_brandedName":return{displayBy:this.displayByStateCityBrandedName,orderBy:["state","city","name"]};case"order_by_state_city_displayName":return{displayBy:this.displayByStateCityDisplayName,orderBy:["state","city","display_name"]}}}},{key:"userSelect",value:function(){var t=this;if(this.userSelectOptions){this.widget.prepend('\n        <div class="user-form-select" style="margin-bottom:15px;">\n          <p id="user-form-label" class="paragraph-title">Please select the type of form you would like to submit</p>\n          <select id="user-form-options" class="user-form-options" aria-labelledby="user-form-label"></select>\n        </div>'),$.each(this.userSelectOptions,(function(e,n){var a='<option value="'.concat(e,'">').concat(n,"</option>");t.widget.find(".user-form-options").append(a)}));var e=!("object"===n(this.userSelectOptions)),a=Object.keys(this.userSelectOptions).length<=1;(e||a)&&this.widget.find(".user-form-select").hide()}}},{key:"orderLocations",value:function(t){return function(e,n){return e[t[0]].toLowerCase()===n[t[0]].toLowerCase()?e[t[1]].toLowerCase()===n[t[1]].toLowerCase()?e[t[2]].toLowerCase()>n[t[2]].toLowerCase()?1:-1:e[t[1]].toLowerCase()>n[t[1]].toLowerCase()?1:-1:e[t[0]].toLowerCase()>n[t[0]].toLowerCase()?1:-1}}},{key:"displayByStateCityAddress",value:function(t){return"".concat(t.state,", ").concat(t.city," - ").concat(t.street_address)}},{key:"displayByCityBrandedName",value:function(t){return"".concat(t.city," - ").concat(t.name)}},{key:"displayByBrandedNameCityState",value:function(t){return"".concat(t.name," - ").concat(t.city,", ").concat(t.state)}},{key:"displayByCityStateBrandedName",value:function(t){return"".concat(t.city,", ").concat(t.state," - ").concat(t.name)}},{key:"displayByDisplayNameCityState",value:function(t){return"".concat(t.display_name," - ").concat(t.city,", ").concat(t.state)}},{key:"displayByCityStateDisplayName",value:function(t){return"".concat(t.city,", ").concat(t.state," - ").concat(t.display_name)}},{key:"displayByStateCityBrandedName",value:function(t){return"".concat(t.state,", ").concat(t.city," - ").concat(t.name)}},{key:"displayByStateCityDisplayName",value:function(t){return"".concat(t.state,", ").concat(t.city," - ").concat(t.display_name)}},{key:"changeIndex",value:function(t){this.index=this.formsToAppendLocation.findIndex((function(e){return e===t}))+1}},{key:"updateLocationDropdownLabel",value:function(){$(".select_dropdown").text(this.configs["select_dropdown_label_".concat(this.index)])}},{key:"removeLocationDropdownOptions",value:function(){this.widget.find(".location-list-urn option").remove()}},{key:"appendDefaultLocationDropdownOption",value:function(){this.widget.find(".location-list-urn").append($('<option class="disabled-option-label" disabled selected="true" value=""></option>').text(this.configs["disabled_option_label_".concat(this.index)]))}},{key:"appendCorporateLocationAtTheTopOfTheList",value:function(e){var n=e.filter((function(t){return!t.corporate})),a=e.filter((function(t){return t.corporate}));return this.showCorporateLocations?[].concat(t(a),t(n)):n}},{key:"appendLocationDropdownOptions",value:function(){var t=this,e=this.showPendingLocations?this.locationsJson:this.locationsJson.filter((function(t){return!t.pending})),n=this.isOrderedBy,a=n.displayBy,i=n.orderBy,o=e.sort(this.orderLocations(i)),s=this.appendCorporateLocationAtTheTopOfTheList(o);$.each(s,(function(e,n){t.widget.find(".location-list-urn").append($("<option></option>").val(n.urn).text(a(n)))}))}},{key:"triggerEnhancer",value:function(){var t=this;this.widget.find(".user-form-options").change((function(){var e=$(this).attr("value");t.runLocSelectOnce=!1,t.leadSlugForLocSelect="".concat(e,"_form"),t.changeIndex(t.leadSlugForLocSelect);var n="".concat(t.clsUrl,"/api/v1/locations/").concat(t.locationUrn,"/html_forms/").concat(e);window.G5Leads.g5FormEnhancer({formUrl:n,enhanceClass:"".concat(t.configs.widgetId,".lead-form .g5-enhanced-form")})}))}},{key:"resetPriorSelections",value:function(){this.widget.find(".g5-enhanced-form .location-list-urn option:selected").prop("selected",!1)}},{key:"resetToFirstEmptyOption",value:function(){this.widget.find(".g5-enhanced-form .location-list-urn option:first").attr("selected","selected")}},{key:"triggerUrnSwap",value:function(){this.submitHackUrn?(this.resetPriorSelections(),this.resetToFirstEmptyOption(),this.widget.find(".location-list-urn").change((function(){$("input[type='hidden'][name='location-list-select']").remove();var t=$(this).attr("value"),e=$(this).parent().parent(),n=e.attr("action").split("/");n.splice(6,1,t),e.attr("action",n.join("/"))}))):this.widget.find(".location-select").remove()}},{key:"hideLocationSelect",value:function(){var t=this;$(window).on("G5FormResponseComplete",(function(){t.locationDropdown.hide(),t.widget.find(".user-form-select").hide()}))}},{key:"appendLocationDropdown",value:function(){var t=this;""!==this.leadSlugForLocSelect&&$(window).on("G5FormRendered",(function(){if(t.widget.find(".g5-enhanced-form .".concat(t.leadSlugForLocSelect)).length&&!t.runLocSelectOnce){var e=t.widget.find(".".concat(t.leadSlugForLocSelect," div:first"));t.locationDropdown.clone().insertBefore(e).fadeIn(),t.triggerUrnSwap(),t.runLocSelectOnce=!0,t.locationDropdown.remove(),t.updateLocationDropdownLabel(),t.removeLocationDropdownOptions(),t.appendDefaultLocationDropdownOption(),t.appendLocationDropdownOptions()}}))}},{key:"changeFormId",value:function(){var t=this;$(window).on("G5FormRendered",(function(){var e=setInterval(function(){var t=this;this.widget.find(".g5-enhanced-form form").length&&(this.changedFormId||(this.widget.find("input, textarea, select, label[for]").not(":input[type=submit], :input[type=radio], :input[name=lead_comments], textarea[name=g-recaptcha-response]").each((function(e,n){return"LABEL"==n.nodeName?n.setAttribute("for","".concat(n.getAttribute("for"),"-").concat(t.configs.widgetId)):n.id="".concat(n.id,"-").concat(t.configs.widgetId)})),this.changedFormId=!0),clearInterval(e))}.bind(t),100)}))}}])&&a(i.prototype,o),s&&a(i,s),e}();G5.loadWidgetConfigs(".lead-configs",i)}()}();