1"use strict";(self.webpackChunksite_client_side=self.webpackChunksite_client_side||[]).push([[16],{8360:(e,t,i)=>{function r(e,t){return"Price"===t?s(e):null==e?void 0:e.toString()}function s(e){return"$"+(e||"").toLocaleString().split(".")[0]}function n(e,t){return(e||"").toString().toLowerCase()===(t||"").toString().toLowerCase()}function o(e,t){if(!e||!t)return!1;const i=(e||"").toString().toLowerCase(),r=(t||"").toString().toLowerCase();return i.includes(r)}function l(e){return e.sort(((e,t)=>{const i=a(e).toLowerCase(),r=a(t).toLowerCase();return i.localeCompare(r)}))}i.r(t),i.d(t,{default:()=>S});const a=e=>{const t=e.innerFilter.value;return"string"==typeof t?t:"number"!=typeof t||Number.isNaN(t)?"":`${t}`};class c{constructor(e,t,i){this.field=e,this.value=t,this.searchParam=i}apply(e){return n(this.field,"type")&&n(this.value,"A")||n(e[this.field],this.value)}equals(e){return e instanceof c&&e.field==this.field&&e.value===this.value}toString(){return this.searchParam?`${this.searchParam}=${encodeURIComponent(this.value)}`:`${this.field}=${encodeURIComponent(this.value)}`}}class u{constructor(e,t){this.field=e,this.value=t}apply(e){return o(e[this.field],this.value)}equals(e){return e instanceof u&&e.field==this.field&&e.value===this.value}toString(){return`${this.field}=~${encodeURIComponent(this.value)}`}}class h{constructor(e){this.field="StockVin",this.value=e}apply(e){return o(e.StockNum,this.value)||o(e.Vin,this.value)}equals(e){return e instanceof h&&e.value===this.value}toString(){return`StockVin=~${encodeURIComponent(this.value)}`}}class d{constructor(e,t){this.field=e,this.value=t}apply(e){return[...e[this.field]].find((e=>n(e,this.value)))}equals(e){return e instanceof d&&e.field===this.field&&e.value===this.value}toString(){return`${this.field}=${encodeURIComponent(this.value)}`}}class f{constructor(e,t,i){this.field=e,this.low=t||null,this.high=i||null}apply(e){const t=e[this.field],i=this.low,r=this.high;return(null===i||t>=i)&&(null===r||t<=r)}equals(e){return e instanceof f&&e.field===this.field&&e.low===this.low&&e.high===this.high}toString(){const e=null!==this.low,t=null!==this.high;return e&&t?`${this.field}range=${this.low}-${this.high}`:e?`${this.field}1=${this.low}`:t?`${this.field}2=${this.high}`:""}}var v,p=i(3641);!function(e){e.NEW="N",e.USED="U",e.VIRTUAL="V",e.UNKNOWN="UNK"}(v||(v={}));class m{constructor(e){this.photoPath="/",this.Vin=e.Vin||e.vin||"",this.Type=e.Type||e.type||v.UNKNOWN,this.Year=e.Year||e.year||0,this.Make=e.Make||e.make||"",this.Model=e.Model||e.model||"",this.Trim=e.Trim||e.trim||"",this.StockNum=e.StockNum||e.stockNum||"",this.Bodystyle=e.Bodystyle||e.bodystyle||e.bodyStyle||"",this.Bodytype=e.BodyType||e.bodyType||e.Bodytype||e.bodytype||"",this.Photo=e.Photo||e.photo||"",this.Cpo=e.Cpo||e.cpo||!1,this.CarBravo=e.CarBravo||e.Carbravo||e.carbravo||e.carBravo||!1,this.Location=e.Location||e.location||"",this.Dealership=e.Dealership||e.dealership||"",this.Features=e.Features||e.features||[],this.Price=e.Price||e.price||0,this.Tags=e.Tags||e.tags||"",this.Manufacturer=e.Manufacturer||e.manufacturer||"",this.RvType=e.RvType||e.rvType||""}isNew(){return this.Type.toUpperCase()===v.NEW}isUsed(){return this.Type.toUpperCase()===v.USED}isVirtual(){return this.Type.toUpperCase()===v.VIRTUAL}getPhotoUrl(){return`${this.photoPath}${this.Photo}`}get name(){return`${this.Year} ${this.Make} ${this.Model} ${this.Trim}`}getDetailsPageUrl(){const e=/[^/a-zA-Z0-9\-+\s]/gi,t=this.Year,i=this.Make.replace(e,""),r=this.Model.replace(e,""),s=this.Trim.replace(e,""),n=this.Vin,o=this.Location.split(",")[0].trim().replace(e,"");if(this.isNew())return`/new-${o}-${t}-${i}-${r}-${s}-${n}`.replace(/\s+/g,"+");if(this.isUsed())return`/used-${o}-${t}-${i}-${r}-${s}-${n}`.replace(/\s+/g,"+");if(this.isVirtual())throw new Error("Cannot construct details URL for Virtual Inventory")}getRouteVinDetailsPageUrl(){return`/routevin.aspx?vin=${this.Vin}`}}var g=function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{a(r.next(e))}catch(e){n(e)}}function l(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,l)}a((r=r.apply(e,t||[])).next())}))};function _(e,t){t||(t=window.location.href),e=e.replace(/[[\]]/g,"\\$&");const i=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);
1return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}class y{constructor(e,t){e=e||{},this._rootTag=t||document.body,this._limitMakesTo=null==e?void 0:e.limitMakesTo,this._limitYearsTo=null==e?void 0:e.limitYearsTo,this._limitModelTo=null==e?void 0:e.limitModelTo,this._vehicleLists={},this._vehicleMakeDealers={},this._newInventoryOnly=null==e?void 0:e.newInventoryOnly;const i=document.getElementById("do-release-toggles");if(null!==i){const e=JSON.parse(i.textContent);this._enableGoVirtualDropdownFix=e.EnableGoVirtualDropdownFix}}_buildInventory(e){const t=[];return e.Makes.filter((e=>0===this._limitMakesTo.length||this._limitMakesTo.includes(e.Name.toLowerCase()))).forEach((e=>{const i=e.Name;e.Models.filter((e=>0===this._limitModelTo.length||this._limitModelTo.includes(e.Name.toLowerCase()))).forEach((e=>{const r=e.Name;e.Years.filter((e=>0===this._limitYearsTo.length||this._limitYearsTo.includes(e))).forEach((e=>t.push(new m({Type:"V",Year:e,Make:i,Model:r}))))}))})),this._allVehicles=t,t}_buildMakeSpecificInventory(e){var t;let i=[];const r=e.Name;if(this._vehicleMakeDealers[r.toLowerCase()]=e.Dealers,e.Models.filter((e=>0===this._limitModelTo.length||this._limitModelTo.includes(e.Name.toLowerCase()))).forEach((e=>{const t=e.Name;e.Trims.forEach((e=>{const s=e.Name,n=e.BodyType,o=e.Bodystyle;e.Years.filter((e=>0===this._limitYearsTo.length||this._limitYearsTo.includes(e))).forEach((e=>{i.push(new m({Type:"V",Year:e,Make:r,Model:t,Trim:s,Bodystyle:o,BodyType:n}))}))}))})),(null===(t=this._allVehicles)||void 0===t?void 0:t.length)>0){const e=[];i.forEach((t=>{this._allVehicles.forEach((i=>{t.Model===i.Model&&t.Year===i.Year&&e.push(t)}))})),i=e}return i}_fetchRefData(e){return g(this,void 0,void 0,(function*(){let t,i="all";null!=this._newInventoryOnly&&""!=this._newInventoryOnly&&(i=this._newInventoryOnly);const r=`${_("header")||""}/api/virtual/inventory/${i}/${(e||"").replace(/\s/g,"_")}`;try{const i=yield fetch(r,{method:"GET"});if(!i.ok)throw new Error(`Network responded with status ${i.status}: ${i.statusText}`);return t=yield i.json(),e?this._buildMakeSpecificInventory(t):this._buildInventory(t)}catch(e){console.error(e)}}))}search(e){var t,i,r,s;return g(this,void 0,void 0,(function*(){const n=e.find((e=>"Make"===e.field));let o=n&&null!==(i=null===(t=n.value)||void 0===t?void 0:t.toString().toLowerCase())&&void 0!==i?i:null;1===(null===(r=this._limitMakesTo)||void 0===r?void 0:r.length)&&(o=this._limitMakesTo[0]),this._vehicleLists[o||"all"]=this._vehicleLists[o||"all"]?this._vehicleLists[o||"all"]:yield this._fetchRefData(o);const l=this._vehicleLists[o||"all"],a=null!==(s=this._rootTag.querySelector("[id^='selDealer']"))&&void 0!==s?s:document.querySelector("[id^='selDealer']");if(this._enableGoVirtualDropdownFix&&"User Selected Make"===(null==a?void 0:a.dataset.grouplocation)){null!=o&&void 0!==this._vehicleMakeDealers[o]?Array.from(a.options).slice(1).forEach((e=>{this._vehicleMakeDealers[o].includes(e.text)?(e.hidden=!1,e.disabled=!1):(e.hidden=!0,e.disabled=!0)})):Array.from(a.options).slice(1).forEach((e=>{e.hidden=!1,e.disabled=!1}));const e=this._vehicleMakeDealers[o]||[],t=new CustomEvent("do.groupdealerlistupdate",{detail:{dealers:e}}),i=a.options.selectedIndex;a.dispatchEvent(t),e.includes(a.options[i].textContent)||(a.options[0].selected=!0)}const c=n?e:e.filter((e=>"Trim"!=(null==e?void 0:e.field)));return l.filter((e=>c.filter((e=>null!==e)).every((t=>null==t?void 0:t.apply(e)))))}))}}class w{constructor(e){this._isFirstSearch=!0,this._baseFilter=e||"",this._vehicles=[]}getVehicles(){return g(this,void 0,void 0,(function*(){const e=this._baseFilter||"";let t=_("header")||"";t=t&&(t.startsWith("//")&&"//"+t||t)||"";try{if("function"!=typeof fetch)return void console.log("fetch() is not available; hopefully because this is a unit test. Inventory widget will be empty.");const i=yield fetch(`${t}/api/inventory/query/?filter=${window.btoa(e)}&encoded=true`,{method:"GET"});if(!i.ok)throw new Error(`Inventory API failed with status ${i.status}: ${i.statusText}`);console.log("Retrieved vehicles from inventory API");const r=yield i.json();if(0===r.length)return void console.error(`Inventory API returned zero results! Wi
1dget will be empty. Check for invalid or inaccurate filter: '${e}'`);for(const e of r)this._vehicles.push(new m(e))}catch(e){console.error(e)}}))}search(e){var t,i;if(this._isFirstSearch){let i=!1,r=!1;null===(t=this._vehicles)||void 0===t||t.forEach((e=>{"N"==e.Type?i=!0:"U"==e.Type&&(r=!0)}));const s=document.getElementById("searchByFilterType");if(s&&!i){const t=s.querySelector('option[value="Type:N"]');t&&(t.remove(),e=e.filter((e=>!("Type"==e.field&&"N"==e.value))))}if(s&&!r){const t=s.querySelector('option[value="Type:U"]');t&&(t.remove(),e=e.filter((e=>!("Type"==e.field&&"U"==e.value))))}this._isFirstSearch=!1}const r=[];return null===(i=this._vehicles)||void 0===i||i.forEach((t=>{let i=!0;for(const r of e){if(!r)return;if(!r.apply(t)){i=!1;break}}i&&r.push(t)})),r}}class b{constructor(){this._collections={}}createCollection(e){return this._collections[e]||(this._collections[e]=new w(e))}createVirtualCollection(e,t){return new y(e,t||document.body)}buildQuerystring(e){return e.map((e=>null==e?void 0:e.toString())).join("&").replace("+","%2B")}}class T{constructor(e,t,i=null){this.innerFilter=e,this.count=t,this.outerFilter=i}apply(e){return this.innerFilter.apply(e)}equals(e){return e.innerFilter.equals(this.innerFilter)&&e.count===this.count}toString(){return`${this.innerFilter} (${this.count})`}}class M{constructor(e,t,i,r,s,n){this._rootElement=e,this.element=t,this.property=i,this.availableFilters=r,this._isFirstUpdate=s,this._resources=n}toString(){return`${this.property}`}updateElement(e,t,i){var s;this._isFirstUpdate=i;let n=!1;const[,o,l]=this._resources.filterPattern.exec(this.element.getAttribute(this._resources.filterAttribute));if(!(this.element instanceof HTMLSelectElement)||o===this._resources.staticFilter)return n;const a=document.getElementById("searchByFilterToggle");if(null!=a){const e=a.classList.contains("less-filters"),t=this._rootElement.querySelector("#searchByFilterMore"),i=null!=t&&t.innerHTML.includes(o);if(!e&&i)return n}let v=null===(s=this.element[this.element.selectedIndex])||void 0===s?void 0:s.value;this.element.options.length=0;const p=[];let m=null;const g=this._createPlaceholder();if(g&&p.push(g),this.element.disabled)return this._addOptionToSelect(p,m,this.element),n;const _=1===this.availableFilters.length,y=""===v||v&&this.availableFilters.some((e=>{var t;return e.innerFilter instanceof f?v.includes(e.innerFilter.low.toString())||v.includes(e.innerFilter.high.toString()):(null===(t=e.innerFilter.value)||void 0===t?void 0:t.toString())===v}));if("low"===l&&!y){const e=this.availableFilters[0];v=e?e.innerFilter.value.toString():v,n=!0}if("high"===l&&!y){const e=this.availableFilters[-1];v=e?e.innerFilter.value.toString():v,n=!0}let w=null;const b=document.querySelector('select[inventory-filter="condition"]');return b&&(w=b.value),this.availableFilters.forEach((t=>{var i,s;const l=new Option;if((t.innerFilter instanceof c||t.innerFilter instanceof u||t.innerFilter instanceof h||t.innerFilter instanceof d)&&(l.value=t.innerFilter.value.toString(),l.text=t.innerFilter.value.toString(),"Make"===o&&e.showMakeBeforeAll&&l.text===e.showMakeFirst&&this._isFirstUpdate&&"Type:A"==w||_&&!e.selectPlaceholder&&(this._isFirstUpdate||!y)?(m=l,n=!0):(null==t?void 0:t.innerFilter)&&v&&t.innerFilter.value.toString()===v&&(m=l)),t.innerFilter instanceof f){l.value=`${t.innerFilter.low}-${t.innerFilter.high}`;const e=t.innerFilter.low!==this._resources.minPrice,n=t.innerFilter.high!==this._resources.maxPrice;if(e&&n?l.text=`${r(t.innerFilter.low,this.property)} - ${r(t.innerFilter.high,this.property)}`:!e&&n?l.text=`${r(t.innerFilter.high,this.property)} ${this._resources.orLess}`:e&&!n&&(l.text=`${r(t.innerFilter.low,this.property)} ${this._resources.orMore}`),v){const e=v.split("-"),r=Number.parseInt(e[0]),n=Number.parseInt(e[1]);m||(m=r===(null===(i=null==t?void 0:t.innerFilter)||void 0===i?void 0:i.low)&&n===(null===(s=null==t?void 0:t.innerFilter)||void 0===s?void 0:s.high)?l:null)}}"Make"===o&&e.showMakeBeforeAll&&l.text===e.showMakeFirst&&"Type:A"==w?p.unshift(l):p.push(l)})),this._addOptionToSelect(p,m,this.element),n}_createPlaceholder(){const e=this.element.getAttribute(this._resources.placeholderAttribute);return e?new Option(e,""):null}_addOptionToSelect(e,t,i){const r=e.map((e=>e.outerHTML)).join("");this.element.innerHTML=r;let s=null;return t&&(s=Array.from(i.options).find((e=>e.value===t.value))),s?(s.selected=!0,s):null}}class F{constructor(e,t,i){this._element=e,this._duration=t,this._target=i}animate(){var e,t;const i=null===(t=null===(e=this._element)||void 0===e?void 0:e.dataset)||void 0===t?void 0:t.previousCount;let r=0;i&&!Number.isNaN(Number(i))&&(r=Number(i));const s=this._target-r;if(0===s)return;const n=Math.abs(this._duration/s),o=n<10?10:Math.ceil(n),l=s/(this._duration/o);let a=r;const c=setInterval((()=>{const e=a+=Math.ceil(l);a=Math.abs(e-this._target)<Math.abs(l)?this._target:e,this._element.innerHTML=a.toLocaleStr
1ing(),a===this._target&&(r=a,this._element.dataset.previousCount=r.toString(),clearInterval(c))}),o)}}var E=function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{a(r.next(e))}catch(e){n(e)}}function l(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,l)}a((r=r.apply(e,t||[])).next())}))};const A=e=>{var t;return"TAGS"===(null===(t=null==e?void 0:e.field)||void 0===t?void 0:t.toUpperCase())&&"string"==typeof(null==e?void 0:e.value)&&"DEMO"===e.value.toUpperCase()};class S{constructor(e){this._searchEndpoints={},this._invWindow=window,this._rootTag=e,this._resources=p.g,$||console.warn("jQuery is not detected on this page. The widget will work, but animated count will not and hidden active tabs may display funny."),this._config={},this._filterElements=Array.from(this._rootTag.querySelectorAll(`[${this._resources.filterAttribute}]`)),this._actionElements=Array.from(this._rootTag.querySelectorAll(`[${this._resources.actionAttribute}]`)),this._infoElements=Array.from(this._rootTag.querySelectorAll(`[${this._resources.infoAttribute}]`)),this._infoElements.push(document.getElementById("homepageSearchWidgetVehicleCount")),Array.from(this._filterElements[0].children).forEach((e=>{const t=e.getAttribute("value"),i=e.getAttribute(`inventory-search-route-${e.innerHTML.trim().toLowerCase()}`);this._searchEndpoints[t]=i})),console.log("inventory search widget loaded"),this.buildConfig(),this._config.useVirtual&&console.debug("Inventory widget will use virtual inventory."),this._isFirstUpdate=!0,this._invManager=new b,this._collection=this._config.useVirtual?this._invManager.createVirtualCollection({limitYearsTo:this._config.virtualYears,limitMakesTo:this._config.virtualMakes,newInventoryOnly:this._config.newInventoryOnly,limitModelTo:this._config.virtualModel},this._rootTag):this._invManager.createCollection(this._config.baseFilter),this.start()}getConfigValueOrDefault(e,t){const i=this._rootTag.getAttribute(e);let r;if(!i)return t;try{const e=JSON.parse(i);r=null!=e?e:t}catch(s){if(s instanceof SyntaxError&&s.message.toLowerCase().includes("json"))return i;console.error(`An error occurred when parsing inventory widget attribute "${e}", reverting to default value.`),console.error(s),r=t}return r}buildConfig(){[{key:"useVirtual",attribute:"use-virtual",defaultValue:!1},{key:"priceRanges",attribute:"price-ranges",defaultValue:this._resources.defaultPriceRanges},{key:"animationDuration",attribute:"animation-duration",defaultValue:this._resources.defaultAnimationDuration},{key:"rescanOnEvent",attribute:"rescan-on-event",defaultValue:""},{key:"showMakeFirst",attribute:"show-make-first",defaultValue:""},{key:"showMakeModelsFirst",attribute:"show-make-models-first",defaultValue:""},{key:"showMakeBeforeAll",attribute:"show-make-before-all",defaultValue:""},{key:"selector",attribute:"selector",defaultValue:""},{key:"virtualYears",attribute:"virtual-years",defaultValue:[]},{key:"virtualMakes",attribute:"virtual-makes",defaultValue:[]},{key:"newInventoryOnly",attribute:"new-inventory-only",defaultValue:""},{key:"virtualModel",attribute:"virtual-model",defaultValue:[]},{key:"baseFilter",attribute:"base-filter",defaultValue:""},{key:"newSearchPage",attribute:"new-search-page",defaultValue:""},{key:"usedSearchPage",attribute:"used-search-page",defaultValue:""},{key:"allSearchPage",attribute:"all-search-page",defaultValue:""}].forEach((e=>{this._config[e.key]=this.getConfigValueOrDefault(e.attribute,e.defaultValue)}))}start(){return E(this,void 0,void 0,(function*(){this._collection instanceof w&&(yield this._collection.getVehicles()),yield this._readForm(),this._configureForDevice(),this._filterElements.forEach((e=>this._initializeFilterElement(e))),this._actionElements.forEach((e=>this._activateActionElement(e))),this._rootTag.addEventListener("keypress",(e=>{"Enter"===e.key&&this._search(e)})),this._config.rescanOnEvent&&$&&$(this._rootTag).on(this._config.rescanOnEvent,(e=>E(this,void 0,void 0,(function*(){return yield this._readForm(e)}))));let e=null;this._rootTag.matches("#homepageSearchWidgetCosmos :scope")&&new ResizeObserver((()=>{null!=e&&window.clearTimeout(e),e=window.setTimeout((()=>E(this,void 0,void 0,(function*(){this._configureForDevice(),yield this._formUpdate(this.getCurrentFilters())}))),200)})).observe(document.documentElement)}))}_configureForDevice(){const e=document.getElementById("shopByVehicleSearchNav");if(!e)return;const t=Array.from(e.getElementsByClassName("search-nav__item")).filter((e=>null===e.offsetParent));if(t.length>0&&(e.style.justifyContent="center",$&&t.some((e=>e.classList.contains("active"))))){const t=Array.from(e.getElementsByClassName("search-nav__btn")).find((e=>null!==e.offsetParent));t&&$("#"+t.id).tab("show")}}getCurrentFilters(){var e;const t=(null===(e=this._config.selector)||void 0===e?void 0:e.replace("{filterAttribute}",this._resources.filterAttribute))||`[${this._resources.filterAttribute}]`;return Array.from(this._rootTag.querySelectorAll(t)).map((e=>(e instanceof HTMLInputElement||e instanceof HTMLSelectElement)&&!e.disabled?this._getSingleFilterOrNull(e):null)).filter((e=>!!e))}_initializeFilterElement(e){e.addEventListener("change",(e=>E(this,void 0,void 0,(function*(){return yield this._readForm(e)})))),e instanceof HTMLInputElement&&"text"===e.type&&e.addEventListener("keyup",(e=>E(this,void 0,void 0,(function*(){return yield this._readForm(e)})))),e.getAttribute(this._resources.filterAttribute),e instanceof HTMLSelectElement&&this._resources.staticFilter}_readForm(e){return E(this,void 0,void 0,(function*(){const t=null==e?void 0:e.target,i=!!e&&!!t,r=i&&"text"!==t.getAttribute("type"),s=i&&("SELECT"!==t.tagName||t.getAttribute(this._resources.filterAttribute)===this._resources.staticFilter),n=i&&t.getAttribute(this._resources.actionAttribute)!==this._resources.updateFilters;if(i){const e=t.closest("inventory-tab");e&&(this._activeTab=e)}r&&s&&n?yield this._reset(e):(this._config.selectPlaceholder=null!=e&&null!=t&&t instanceof HTMLSelectElement&&!t.value,yield this._formUpdate(this.getCurrentFilters()))}))}_activateActionElement(e){switch(e.getAttribute(this._resources.actionAttribute).toLowerCase()){case"search":e.addEventListener("click",(e=>E(this,void 0,void 0,(function*(){return this._search(e)}))));break;case"reset":e.addEventListener("click",(e=>E(this,void 0,void 0,(function*(){return yield this._reset(e)}))));break;case"first":e.addEventListener("click",(e=>E(this,void 0,void 0,(function*(){return yield this._first(e)}))));break;case"update-filters":e.addEventListener("click",(e=>E(this,void 0,void 0,(function*(){return yield this._readForm(e)}))))}}parseValue(e){try{return JSON.parse(e)}catch(t){return e}}_getSingleFilterOrNull(e){const t=e.getAttribute(this._resources.filterAttribute);let i;const r=e.getAttribute(this._resources.searchParamAttribute);if(e instanceof HTMLInputElement)i=this.parseValue(e.value);else if(e instanceof HTMLSelectElement){const t=e.selectedIndex>=0?e.options[e.selectedIndex]:null;i=t?this.parseValue(t.value):null}else i=e.innerHTML;const s=e instanceof HTMLInputElement?e.type:"",n=e instanceof HTMLInputElement&&"radio"===s&&!e.checked;if(!t||!i||n)return null;const[,o,l]=this._resources.filterPattern.exec(t);if("low"===l)try{return new f(o,i,null)}catch(e){return console.error(e),null}if("high"===l)try{return new f(o,null,i)}catch(e){return console.error(e),null}switch(o){case this._resources.staticFilter:{const[,e,t]=/(\w+):(.+)
1/.exec(i);return new c(e,this.parseValue(t))}case"Features":return i=i.toString().replace("½","½"),new d(o,i);case"Price":{const e=i.split("-"),t=Number.parseInt(e[0])||this._resources.minPrice,r=Number.parseInt(e[1])||this._resources.maxPrice;return new f(o,t,r)}case"Vin":case"StockNum":return new u(o,i);case"StockVin":return new h(i);default:return new c(o,i,r)}}_removeAFilter(e){return e.some((e=>"A"===(null==e?void 0:e.value)))?e.filter((e=>"A"!==(null==e?void 0:e.value))):e}_removeTypeFilters(e){return e.some((e=>"Type"===(null==e?void 0:e.field)))?e.filter((e=>"Type"!==(null==e?void 0:e.field))):e}_formUpdate(e){var t,i;return E(this,void 0,void 0,(function*(){const r=yield this._collection.search(this._removeAFilter(e));this._filterElements.forEach((t=>this._processDependencies(t,e)));const s=[];for(const e of this._filterElements){const t=yield this._getRefinement(e,this._getSingleFilterOrNull(e),this.getCurrentFilters());t&&s.push(t)}let n=!1;for(const t of s){const i=t.updateElement(this._config,e,this._isFirstUpdate);i&&(n=i)}if(null===(t=this._infoElements)||void 0===t||t.forEach((e=>this._updateDataElement(e,r))),null===(i=this._actionElements)||void 0===i||i.forEach((t=>this._checkActionElement(t,e,r))),this._isFirstUpdate){const e=new CustomEvent("do.inventorywidgetloadend");document.dispatchEvent(e)}this._isFirstUpdate=!1,n&&(yield this._formUpdate(this.getCurrentFilters()))}))}_processDependencies(e,t){const i=(e.getAttribute(this._resources.dependAttribute)||"").split(","),r=this.validateDependencies(i,t);(e instanceof HTMLInputElement||e instanceof HTMLSelectElement)&&(e.disabled=!r)}_getRefinement(e,t,i){return E(this,void 0,void 0,(function*(){let r=[],s=[];const n=e.getAttribute(this._resources.filterAttribute);if(!(e instanceof HTMLSelectElement)||n===this._resources.staticFilter)return null;const o=this._resources.filterPattern.exec(n)[1],a=[];if(this._config.useVirtual&&"Make"===o)for(const e of i)!e.equals(t)&&["Year","Make","Model"].includes(e.field)&&a.push(e);else for(const e of i)e.equals(t)||a.push(e);let u=null;const h=this._rootTag.querySelector('select[inventory-filter="condition"]');switch(h&&(u=h.value),o){case"Price":{r=yield this._collection.search(a);const t=this._config.priceRanges,i=[];for(const e of r)e.Price>0&&i.push(e.Price);const n=[];return null==i||i.forEach((e=>{const i=t.find((t=>{const i=!t.low||e>=t.low,r=!t.high||e<=t.high;return i&&r})),r=n.find((e=>{const t=e.item.low===i.low,r=e.item.high===i.high;return t&&r}));r?r.count++:n.push({item:i,count:1})})),s=(n?Array.from(n):[]).map((e=>new T(new f(o,e.item.low||this._resources.minPrice,e.item.high||this._resources.maxPrice),e.count))),s.sort(((e,t)=>e.innerFilter.low-t.innerFilter.low)),new M(this._rootTag,e,o,s,this._isFirstUpdate,this._resources)}case"Features":{r=yield this._collection.search(a);const t=[];for(const e of r)for(const i of e.Features){let e=null;for(const r of t)if(r.item===i){e=r;break}e?e.count++:t.push({item:i,count:1})}for(const e of t)e.item&&(e.item=e.item.toString().replace("½","½"));return s=t.map((e=>new T(new d(o,e.item),e.count))),s.sort(((e,t)=>{const i=e.innerFilter.value,r=t.innerFilter.value;return i<r?-1:i>r?1:0})),new M(this._rootTag,e,o,s,this._isFirstUpdate,this._resources)}default:{let t;if(r=yield this._collection.search(this._removeAFilter(a)),"Model"===o&&"Type:A"==u){const e=[];for(const t of r){let i=null;for(const r of e)if(r.item===t.Model){i=r;break}i?i.count++:e.push({item:t.Model,count:1,group:t.Make})}s=e.map((e=>new T(new c(o,e.item),e.count,e.group)));const i=[],n=[];null==s||s.forEach((e=>{(e.outerFilter===this._config.showMakeModelsFirst?i:n).push(e)})),l(i),l(n),t=[...i,...n]}else{const e=[];for(const t of r){if(""===t[o])continue;let i=null;for(const r of e)if(r.item===t[o]){i=r;break}i?i.count++:e.push({item:t[o],count:1})}if(s=e.map((e=>new T(new c(o,e.item),e.count))),null==s?void 0:s.every((e=>"Make"===e.innerFilter.field))){const e=[],i=[];null==s||s.forEach((t=>{(t.outerFilter===this._config.showMakeFirst?e:i).push(t)})),l(e),l(i),t=[...e,...i]}else(null==s?void 0:s.every((e=>"Year"===e.innerFilter.field)))?(t=[...s],l(t),t.reverse()):(t=[...s],l(t))}return new M(this._rootTag,e,o,t,this._isFirstUpdate,this._resources)}}}))}_updateDataElement(e,t){if(null!=e){const i=e.getAttribute(this._resources.infoAttribute)||"",r=this.getCurrentFilters().filter((e=>null!==e)),n=t.map((e=>e.Price));switch(i.toLowerCase()){case"animatedcount":return void new F(e,this._config.animationDuration,t.length).animate();
1case"count":{const i=t.length.toLocaleString().split(".")[0];e.innerHTML=i;const r=new CustomEvent("inventorywidget-update-inventory-count",{detail:i});return void document.dispatchEvent(r)}case"minprice":{const t=n.filter((e=>e>0));return void(e.innerHTML=s(Math.min(...t)))}case"maxprice":return void(e.innerHTML=s(Math.max(...n)));case"avgprice":{const t=n.reduce(((e,t)=>e+t),0)/n.length;return void(e.innerHTML=s(t))}case"modelphoto":{const i=r.find((e=>"Model"===(null==e?void 0:e.field))),s=t?t[0]:null;if(!i||!s)return e.setAttribute("src",e.getAttribute("default-src")),void e.setAttribute("alt",e.getAttribute("default-alt"));e.setAttribute("src",s.getPhotoUrl());const n=`for a ${s.Year} ${s.Make} ${s.Model}`;let o=e.getAttribute("default-alt").replace("drive at ","drive "+n+" at ");return o=o.replace("quote from ","quote "+n+" from "),e.setAttribute("alt",o),void(e.onerror=()=>{e.setAttribute("src",e.getAttribute("default-src")),e.setAttribute("alt",e.getAttribute("default-alt"))})}}}}_checkActionElement(e,t,i){return E(this,void 0,void 0,(function*(){if(null!=e){const r=(e.getAttribute(this._resources.dependAttribute)||"").split(","),s=this.validateDependencies(r,t);if((e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLButtonElement)&&(e.disabled=!s),s?e.removeAttribute("disabled"):e.setAttribute("disabled","true"),"search"===e.getAttribute(this._resources.actionAttribute).toLowerCase()){const r=t.find((e=>"CPO"===(null==e?void 0:e.field.toUpperCase())||"CARBRAVO"===(null==e?void 0:e.field.toUpperCase())||A(e)||(null==e?void 0:e.value)&&"string"==typeof(null==e?void 0:e.value)&&("N"===(null==e?void 0:e.value.toUpperCase())||"U"===(null==e?void 0:e.value.toUpperCase())||"V"===(null==e?void 0:e.value.toUpperCase())||"C"===(null==e?void 0:e.value.toUpperCase())||"A"===(null==e?void 0:e.value.toUpperCase())))),s=i?i[0]:null;let n="default";r?n=A(r)?"D":"CPO"===r.field.toUpperCase()||"CARBRAVO"===r.field.toUpperCase()?"C":r.value.toString():s&&(n=s.Type);let o=yield this._getSearchUrl(n,t);const l=o.split("?");if(l[1]){const e=this.replaceModelWithModelAndTrim(l[1]);o=l[0].concat("?",e)}if(e.classList.contains("search-by-filter__search-button")){const t="data-inventory-search-query-url";e.hasAttribute(t)||e.addEventListener("click",(e=>{setTimeout((()=>{const i=e.target.getAttribute(t);window.location.href=i}),0)})),e.setAttribute(t,o)}else e.setAttribute("href",o)}}}))}_getSearchUrl(e,t){var i,r,s;return E(this,void 0,void 0,(function*(){let n=this._invManager.buildQuerystring(this._removeTypeFilters(t));switch(e){case"A":return(this._config.allSearchPage||(null!==(i=this._searchEndpoints["Type:A"])&&void 0!==i?i:"/searchall.aspx"))+this.formatQueryString(n);case"N":return(this._config.newSearchPage||(null!==(r=this._searchEndpoints["Type:N"])&&void 0!==r?r:"/searchne
1w.aspx"))+this.formatQueryString(n);case"U":return(this._config.usedSearchPage||(null!==(s=this._searchEndpoints["Type:U"])&&void 0!==s?s:"/searchused.aspx"))+this.formatQueryString(n);case"V":return"/searchnewv.aspx?"+n;case"D":return(this._searchEndpoints["Tags:Demo"]||"/searchall.aspx")+this.formatQueryString(n);case"C":return null!=this._searchEndpoints["Cpo:true"]&&"searchused.aspx"!=this._searchEndpoints["Cpo:true"].replace("/","")?(n=n.replace(/Cpo=true&?/g,""),this._searchEndpoints["Cpo:true"]+this.formatQueryString(n)):(this._config.usedSearchPage||"/searchused.aspx")+this.formatQueryString(n);default:return(this._config.newSearchPage||"/searchnew.aspx")+this.formatQueryString(n)}}))}_search(e){let t="Vertical Search Widget Inv. Searches";e.target.closest(".horizontalInventorySearch")}_first(e){return E(this,void 0,void 0,(function*(){e.preventDefault();const t=this.getCurrentFilters(),i=yield this._collection.search(t),r=i?i[0]:null;if(null===r)return void console.error("No vehicles");if(r.isVirtual())return void console.error("Cannot go directly to virtual VDP. Vehicle ID is not known.");const s=r.getDetailsPageUrl();console.info("Navigating to vehicle {0}",s),window.location.href=s}))}_reset(e){return E(this,void 0,void 0,(function*(){console.debug("Resetting Filters"),Array.from(this._rootTag.querySelectorAll(`select[${this._resources.filterAttribute}]`)).map((e=>e)).filter((e=>e.getAttribute(this._resources.filterAttribute)!==this._resources.staticFilter)).forEach((e=>{e&&(e.selectedIndex=0)})),this._isFirstUpdate=!0,yield this._formUpdate(this.getCurrentFilters()).then((()=>console.debug("Form reset")))}))}formatQueryString(e){return e.length>0?"?"+e:""}
1validateDependencies(e,t){const i=e.filter((e=>e>""&&!n(e,"vehicletype")));if(0===i.length)return!0;const r=i.filter((e=>!t.some((t=>(null==t?void 0:t.field)===e))));if(0===r.length)return!0;const s=Array.from(this._rootTag.querySelectorAll(".search-by-filter .vehicle-filter select")).filter((e=>null===e.offsetParent));if(s.length>0){const e=new Set(s.map((e=>e.attributes["inventory-filter"])).map((e=>e.value)));return r.every((t=>e.has(t)))}return!1}replaceModelWithModelAndTrim(e){const t=new Map;if(e.includes("&"))e.split("&").forEach((e=>{const[i,r]=e.split("=");t.set(i,r)}));else{const[i,r]=e.split("=");t.set(i,r)}const i=new Map;return t.forEach(((e,r)=>{"Model"===r&&t.has("Trim")?(i.set("ModelAndTrim",`${e}:${t.get("Trim")}`),t.delete("Trim")):"Model"===r?i.set("ModelAndTrim",e):i.set(r,e)})),Array.from(i.entries()).map((([e,t])=>`${e}=${t}`)).join("&")}}}}]); 2//# sourceMappingURL=inventoryWidgetControllerChunk.js.map?v=23.112.0+20260921.8.902c3c569d05491846eef63357f686bcd4112010&h=753f1fd13f8fc3b1641b
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.