var Form=[];class LlForm{constructor(){this.anuraId="",this.anuraCId="",this.iDom="https://docs.emailagency.com",this.aKey="dd66202d-6b53-11ed-bdfa-fa163eff53f0",this.code="CCPA",this.completedMessage="",this.copy=[],this.curStep=1,this.dupeFlds=[],this.required=[],this.spprssnFlds=[],this.id=0,this.params=new Object,this.real=1,this.s="",this.s2="",this.source="",this.showPrev=1,this.submitStep=0,this.vehicles=[],this.wFId="",this.update=0,this.toastMixin=null}async iniate(){Form.toastMixin=Swal.mixin({customClass:{container:"toast-color",popup:"danger-toast-color",timerProgressBar:"danger-toast-color"},toast:!0,icon:"success",title:"",showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},position:"top",showConfirmButton:!1,target:"body",timer:5e3,timerProgressBar:!0,didOpen:e=>{e.addEventListener("mouseenter",Swal.stopTimer),e.addEventListener("mouseleave",Swal.resumeTimer)}});const e=new Promise(e=>{localStorage.getItem("ll_completed_msg")?(Form.completedMessage=localStorage.getItem("ll_completed_msg"),e(!0)):(localStorage.getItem("params")&&(Form.params=JSON.parse(localStorage.getItem("params"))),localStorage.getItem("s")&&(Form.s=localStorage.getItem("s")),localStorage.getItem("s2")&&(Form.s2=localStorage.getItem("s2")),localStorage.getItem("curStep")?Form.curStep=localStorage.getItem("curStep"):localStorage.setItem("curStep",Form.curStep),localStorage.getItem("gSource")&&(Form.source=localStorage.getItem("gSource")),localStorage.getItem("real")?Form.real=localStorage.getItem("real"):localStorage.setItem("real",Form.real),localStorage.getItem("update")?Form.update=localStorage.getItem("update"):localStorage.setItem("update",Form.update),localStorage.getItem("id")?Form.id=localStorage.getItem("id"):Form.id&&localStorage.setItem("id",Form.id),localStorage.getItem("wFId")?Form.wFId=localStorage.getItem("wFId"):Form.wFId&&localStorage.setItem("wFId",Form.wFId),localStorage.setItem("aKey",Form.aKey),localStorage.setItem("code",Form.code),e(!0))}).then(async()=>{Form.show(),$(document).keypress(e=>{"13"==e.which&&e.preventDefault()})});await e}async submit(){$("#submit").prop("disabled",!0),Swal.close(),JsLoadingOverlay.show({containerID:"form-container"}),grecaptcha.ready(function(){grecaptcha.execute("6LfmfLUiAAAAAFOchKgENZgfCq6qnS3MdPiTeY44",{action:"submit"}).then(function(e){var s=new FormData(document.getElementById("lead_form"));if(s.append("recaptcha_response",e),"undefined"!=typeof Anura){const e=Anura.getAnura().getId();s.append("aRId",e)}else Form.sleep(500).then(()=>{if("undefined"!=typeof Anura){const e=Anura.getAnura().getId();s.append("aRId",e)}});Form.wKey?s.append("wKey",Form.wKey):""!=Form.aKey&&""!=Form.code&&(s.append("aKey",Form.aKey),s.append("code",Form.code)),""!=Form.id&&s.append("id",Form.id),0!=Form.update&&s.append("update",Form.update),localStorage.getItem("params")&&s.append("params",localStorage.getItem("params")),s.append("s",Form.s),s.append("s2",Form.s2),$.ajax({type:"POST",url:Form.iDom+"/form/embed/s/"+Form.curStep,processData:!1,contentType:!1,enctype:"multipart/form-data",data:s,success:e=>{var s=JSON.parse(e);const t=s.vehicles;if($("#back-button").html(s.backBtn),s.progress&&($("#progress-bar_status").prop("style","width: "+s.progress+"%"),$("#progress-bar_status").attr("aria-valuenow",s.progress),$("#progress-bar_status").html(s.progress+"%")),t&&(Form.vehicles=t),s.req)for(const[e,t]of Object.entries(s.req)){if(1==t[1])$("#"+e).addClass("is-invalid").removeClass("is-valid");else{if(4==t[1])$("#"+e+"Input").length?$("#"+e+"Input").addClass("is-invalid").removeClass("is-valid"):$("#"+e).closest("span").addClass("is-invalid").removeClass("is-valid");else if(7==t[1]||12==t[1])$("#"+e+"_label").closest("div").find(".drop-down").removeClass("btn-outline-filter").addClass("btn-outline-danger");else if(8==t[1])$("#"+e).addClass("is-invalid").removeClass("is-valid");else if(15==t[1])for(var o=1;o<=t[2];o++)$("#"+e+o).addClass("is-invalid").removeClass("is-valid");$("#validation_"+e).removeClass("invalid-feedback").addClass("invalid-field")}$("#validation_"+e).html(t[0])}if(s.good)for(const[e,t]of Object.entries(s.good))1==t[1]?$("#"+e).removeClass("is-invalid").addClass("is-valid"):4==t[1]?$("#"+e+"Input").length?$("#"+e+"Input").removeClass("is-invalid").addClass("is-valid"):$("#"+e).closest("span").removeClass("is-invalid").addClass("is-valid"):7==t[1]||12==t[1]?$("#"+e+"_label").closest("div").find(".drop-down").removeClass("btn-outline-filter").addClass("btn-outline-success"):8==t[1]?$("#"+e).addClass("is-valid").removeClass("is-invalid"):15==t[1]&&$("#"+e+t[2]).addClass("is-valid").removeClass("is-invalid"),$("#validation_"+e).removeClass("invalid-field").addClass("invalid-feedback");if(1==s.isValid)if(1==s.complete)$("#submit").hide(),$("#progress-bar").hide(),$(".shown").html(""),$(".shown").hide(),$(".shown").addClass("not-shown"),$(".shown").removeClass("shown"),$("#final_step").removeClass("not-shown"),$("#final_step").addClass("shown"),$("#tcpa").html(""),$("#final_step").html(s.msg),localStorage.getItem("id")&&localStorage.removeItem("id"),localStorage.getItem("curStep")&&localStorage.removeItem("curStep"),localStorage.getItem("params")&&localStorage.removeItem("params"),localStorage.getItem("s")&&localStorage.removeItem("s"),localStorage.getItem("s2")&&localStorage.removeItem("s2"),localStorage.getItem("wKey")&&localStorage.removeItem("wKey"),localStorage.getItem("wFId")&&localStorage.removeItem("wFId"),localStorage.getItem("update")&&localStorage.removeItem("update"),localStorage.getItem("real")&&localStorage.removeItem("real"),localStorage.getItem("aKey")&&localStorage.removeItem("aKey"),localStorage.getItem("code")&&localStorage.removeItem("code"),1===s.completedMessage&&localStorage.setItem("ll_completed_msg",s.msg),Form.sleep(100).then(()=>{Form.hide(),Form.aKey="",Form.code="",Form.curStep=1,Form.dupeFlds=[],Form.spprssnFlds=[],Form.id="",Form.params=new Object,Form.real=1,Form.realZip=0,Form.s="",Form.s2="",Form.showPrev=1,Form.wKey="",Form.update=0,Form=[]}),s.redirect&&window.location.replace(s.redirect);else{Form.id=s.id,s.sync&&s.sync>0&&$.post(Form.iDom+"/form/embed/deliver/i/"+Form.id+"/dm/"+s.sync,{csrf:$("#csrf").val()}),s.copy&&(Form.copy=s.copy),localStorage.setItem("id",Form.id),Form.showPrev=s.show;const e=s.req;Object.keys(e).length?Form.required=e:Form.required=[];const t=s.good;Object.keys(t).length?Form.good=t:Form.good=[];const o=s.dupeFlds;Object.keys(o).length&&(Form.dupeFlds=o);const a=s.spprssnFlds;if(Object.keys(a).length&&(Form.spprssnFlds=a),Form.curStep=s.curStep,localStorage.setItem("curStep",Form.curStep),$("#sendfile").length&&($("#sendfile").attr("disabled",!0),$("#sendfile").attr("title","Unable to upload file now. Please proceed to the next step.")),s.btnColor&&s.btnText?($("#submit").show(),$("#submit").removeClass().addClass("btn btn-"+s.btnColor),$("#submit").attr("title",s.btnText),$("#submit").text(s.btnText)):$("#submit").hide(),1==s.hide&&($(".shown").addClass("d-none"),$(".shown").addClass("not-shown"),$(".shown").removeClass("shown")),$("#step_"+Form.curStep).html(s.msg),$("#step_"+Form.curStep).removeClass("not-shown"),$("#step_"+Form.curStep).addClass("shown"),1==Form.showPrev&&s.first)for(;;)if($("#section_"+s.first).length){document.getElementById("section_"+s.first).scrollIntoView({behavior:"smooth"}),setTimeout(()=>{window.scrollBy(0,-10)},450),$("#section_"+s.first).css("background","yellow"),setTimeout(()=>{$("#section_"+s.first).removeAttr("style")},4e3);break}}else s.dupeMsg?($("#theModal").find(".modal-content").html(s.dupeMsg),$("#theModal").modal({backdrop:"static"}),$("#theModal").modal("show"),$("html, body").css("overflowY","hidden"),localStorage.clear(),s.completedMessage&&localStorage.setItem("ll_completed_msg",s.completedMessage)):s.spprssnMsg?($("#theModal").find(".modal-content").html(s.spprssnMsg),$("#theModal").modal({backdrop:"static"}),$("#theModal").modal("show"),$("html, body").css("overflowY","hidden"),localStorage.clear(),s.completedMessage&&localStorage.setItem("ll_completed_msg",s.completedMessage)):(Form.toastMixin.fire({icon:"error",html:'

Missing required fields. Please answer all required questions.

'}),$("#submit").attr("disabled",!1))}}).done(()=>{if(Form){if($("#submit").attr("disabled",!1),0==Form.showPrev){for(let e=1;e{$.post(`${Form.iDom}/form/embed/k/${this.aKey}/c/${this.code}`,s=>{var t=JSON.parse(s);1==t.isValid&&($("#ll-form").html(t.msg),e(!0))})});if(s){$("#submit").prop("disabled",!0),JsLoadingOverlay.show({containerID:"form-container"});var t={};Form.wKey?t.wKey=Form.wKey:""!=Form.aKey&&""!=Form.code&&(t.aKey=Form.aKey,t.code=Form.code),""!=Form.id&&(t.id=Form.id),localStorage.getItem("params")&&(Form.params=JSON.parse(localStorage.getItem("params")),t.params=JSON.stringify(Form.params)),t.s=Form.s,t.s2=Form.s2,t.update=Form.update,t.complete=Form.complete,e>0&&(t.page=e);const s=Form.iDom+"/form/embed/s/"+Form.curStep+"/show";$.post(s,t,e=>{var s=JSON.parse(e);if(1==s.isValid){if(Form.completedMessage)return $("#submit").hide(),$("#progress-bar").hide(),$(".shown").html(""),$(".shown").hide(),$(".shown").addClass("not-shown"),$(".shown").removeClass("shown"),$("#final_step").removeClass("not-shown"),$("#final_step").addClass("shown"),$("#tcpa").html(""),$("#final_step").html(Form.completedMessage),!0;{Form.id=s.id,s.copy&&(Form.copy=s.copy),localStorage.setItem("id",Form.id),Form.showPrev=s.show,Form.curStep=s.curStep,Form.curStep>1&&localStorage.setItem("curStep",Form.curStep);const e=s.dupeFlds;Object.keys(e).length&&(Form.dupeFlds=e);const r=s.spprssnFlds;Object.keys(r).length&&(Form.spprssnFlds=r);const i=s.required;Object.keys(i).length&&(Form.required=i);const d=s.vehicles;d&&(Form.vehicles=d),$("#back-button").html(s.backBtn),s.progress&&($("#progress-bar_status").prop("style","width: "+s.progress+"%"),$("#progress-bar_status").attr("aria-valuenow",s.progress),$("#progress-bar_status").html(s.progress+"%")),s.submit?Form.submitStep=1:Form.submitStep=0,s.btnColor&&s.btnText?($("#submit").show(),$("#submit").removeClass().addClass("btn btn-"+s.btnColor),$("#submit").attr("title",s.btnText),$("#submit").text(s.btnText)):$("#submit").hide(),1==s.hide&&($(".shown").addClass("d-none"),$(".shown").addClass("not-shown"),$(".shown").removeClass("shown"));var t=1,o=0;for(const[e,r]of Object.entries(s.msg)){t==Object.keys(s.msg).length&&(o=1);var a=1,l="";for(const[e,s]of Object.entries(r))for(const[e,r]of Object.entries(s))l+=r,1!=t&&1==o&&1==a&&(1!=Form.complete&&1==Form.showPrev&&setTimeout(()=>{document.getElementById("section_"+e).scrollIntoView({behavior:"smooth"}),$("#section_"+e).css("background","yellow"),setTimeout(()=>{$("#section_"+e).removeAttr("style")},2e3)},450),a=0);$("#step_"+e).html(l),$("#step_"+e).removeClass("not-shown"),$("#step_"+e).addClass("shown"),t++}}}else $("#alert_message").addClass("alert alert-danger alert-dismissible fade show"),$("#message").html(s.msg),$("#submit").attr("disabled",!1)}).done(()=>($("#submit").attr("disabled",!1),Form.hide(),1==Form.submitStep&&(Form.submitStep=0,Form.sleep(200).then(()=>{Form.submit()})),!0))}}hide(){var e=document.getElementById("loading-overlay-stylesheet");null!=document.getElementById("overlay")&&null!=document.getElementById("spinner")&&(document.getElementById("overlay").remove(),document.getElementById("spinner").remove()),e&&(e.disabled=!0,e.parentNode.removeChild(e))}check(e=0){if(1==Form.real&&1!=Form.complete&&""!=Form.aKey&&""!=Form.code){var s={};const o=new Promise(e=>{if(Form.dupeFlds){var t={};const o=new Promise(e=>{for(const[e,s]of Object.entries(Form.dupeFlds))""!=$("#"+s).val()&&(t[s]={val:$("#"+s).val()});e(!0)});o&&(Object.keys(t).length>0?(s.dupeFlds=t,e(!0)):e(!0))}else e(!0)}),a=o;if(a){const o=new Promise(e=>{if(Form.spprssnFlds){var t={};const o=new Promise(e=>{for(const[e,s]of Object.entries(Form.spprssnFlds))$("#"+e).val()&&(t[e]={val:$("#"+e).val(),type:s.type});e(!0)});o&&(Object.keys(t).length>0?(s.spprssnFlds=t,e(!0)):e(!0))}else e(!0)});if(o){s.csrf=$('input[name="csrf"]').val();var t=0;""!=Form.id&&(t=Form.id);const o=Form.iDom+"/form/embed/k/"+Form.aKey+"/c/"+Form.code+"/check/i/"+t;$.post(o,s,s=>{var t=JSON.parse(s);0==t.isValid?($("#submit").attr("disabled",!0),$("#theModal").find(".modal-content").html(t.msg),$("#theModal").modal({backdrop:"static"}),$("#theModal").modal("show"),$("html, body").css("overflowY","hidden"),localStorage.clear(),t.completedMessage&&localStorage.setItem("ll_completed_msg",t.completedMessage)):1==e&&Form.submit()})}}}}hide(){var e=document.getElementById("loading-overlay-stylesheet");null!=document.getElementById("overlay")&&null!=document.getElementById("spinner")&&(document.getElementById("overlay").remove(),document.getElementById("spinner").remove()),e&&(e.disabled=!0,e.parentNode.removeChild(e))}highlight(e){document.addEventListener("DOMContentLoaded",()=>{document.getElementById("section_"+e).scrollIntoView({behavior:"instant"}),$("#section_+webformStepSectionId").css("background","yellow"),setTimeout(()=>{$("#section_"+e).removeAttr("style")},2e3)},!1)}closeModal(){$("#theModal").modal("hide"),$("#modal_content").html(),$("html, body").css("overflowY","auto")}sectionCopy(e){if(e&&Form.copy){const t=["1","3","5","9","10","11","12","13","14","16"],o=["7","12"],a="15",l="2",r="4";var s="";new Promise(i=>{Object.keys(Form.copy).forEach(i=>{if(i==e){const e=Form.copy[i];Object.keys(e).forEach(i=>{s=i,new Promise(i=>{if(e[s].type==a){const t=e[s].option;new Promise(o=>{var a=0,l=0;Object.values(t).forEach(t=>{a++,$(e[s].copy+t).is(":checked")?(l=1,$(s+t).prop("checked",!0),$(s+t).addClass("is-valid").removeClass("is-invalid")):$(s+t).removeClass("is-invalid").removeClass("is-valid")}),!l&&a&&$.each(Array.from(Array(a).keys()),function(e){const t=e+1;$(s+t).addClass("is-invalid").removeClass("is-valid")}),o(!0)})}else if(e[s].type==r)if($(s+"Input").length){$(s+"Input").val($(e[s].copy+"Input").val()),$(s+"Input").addClass("is-valid").removeClass("is-invalid");const t=s.replace("#","");document.forms.lead_form.elements[t+"Input"].value=$(e[s].copy+"Input").val()}else $(e[s].copy).val()?($(s).datetextentry("set_date",$(e[s].copy).val()),s=s.replace("#",""),$("#validation_"+s).addClass("invalid-feedback").removeClass("invalid-field")):($(s).closest("span").addClass("is-invalid").removeClass("is-valid"),s=s.replace("#",""),$("#validation_"+s).removeClass("invalid-feedback").addClass("invalid-field"));else if($(e[s].copy).val())if(t.includes(e[s].type)){$(s).val($(e[s].copy).val()),$(s).addClass("is-valid").removeClass("is-invalid");const t=s.replace("#","");document.forms.lead_form.elements[t].value=$(e[s].copy).val()}else o.includes(e[s].type)?($(s).bsSelect("val",$(e[s].copy).val()),$(s).closest("div").find("button").removeClass("btn-outline-filter").addClass("btn-outline-success"),$(s).closest("div").find("button").addClass("btn-outline-success"),s=s.replace("#",""),$("#validation_"+s).addClass("invalid-feedback").removeClass("invalid-field")):e[s].type==l&&($(s).text($(e[s].copy).html()),$(s).addClass("is-valid").removeClass("is-invalid"));else t.includes(e[s].type)||e[s].type==l?$(s).addClass("is-invalid").removeClass("is-valid"):o.includes(e[s].type)&&($(s).closest("div").find("button").removeClass("btn-outline-filter"),$(s).closest("div").find("button").addClass("btn-outline-danger"),s=s.replace("#",""),$("#validation_"+s).removeClass("invalid-feedback").addClass("invalid-field"));i(!0)})})}}),i(!0)}).then(()=>{Form.sleep(5e3).then(()=>{$("#mappings_"+e).prop("checked",!1)})})}}sleep(e){return new Promise(s=>setTimeout(s,e))}beforeChange(){return $(this).removeAttr("btn.outline-danger"),$(this).removeAttr("btn.outline-success"),$(this).find(".invalid-feedback").removeClass("d-block"),!0}phoneValidation(e,s=0,t=0){var o=$("#"+e).val();if(o){var a=/^[2-9][0-9]{2}[2-9][0-9]{6}$|^[2-9][0-9]{2}-[2-9]{1}[0-9]{2}-[0-9]{4}$|^\([2-9][0-9]{2}\) [2-9]{1}[0-9]{2}-[0-9]{4}?$/;a.test(o)?($("#"+e).removeClass("is-invalid").addClass("is-valid"),1==t?Form.check(s):1==s&&Form.submit()):$("#"+e).removeClass("is-valid").addClass("is-invalid")}else $("#"+e).removeClass("is-valid").removeClass("is-invalid")}maskPhoneNo(e){let s=document.getElementById(e),t=s.value.replace(/\D*/g,"");var o=s.selectionStart,a=s.selectionEnd;t.length>=4&&(4==t.length&&(o+=3,a+=3),t="("+t.slice(0,3)+") "+t.slice(3)),t.length>=10&&(10==t.length&&(o+=1,a+=1),t=t.slice(0,9)+"-"+t.slice(9)),s.value=t,s.setSelectionRange(o,a)}emailValidation(e,s=0,t=0){var o=$("#"+e).val();if(o){var a=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;a.test(o)?($("#"+e).removeClass("is-invalid").addClass("is-valid"),1==t?Form.check(s):1==s&&Form.submit()):$("#"+e).removeClass("is-valid").addClass("is-invalid")}else $("#"+e).removeClass("is-valid").removeClass("is-invalid")}socialValidation(e,s=0,t=0){var o=$("#"+e).val();if(o){var a=/^[0-9]{3}-[0-9]{2}-[0-9]{4}$|^\d{4}$|^\d{9}$/;a.test(o)?($("#"+e).removeClass("is-invalid").addClass("is-valid"),1==t?Form.check(s):1==s&&Form.submit()):$("#"+e).removeClass("is-valid").addClass("is-invalid")}else $("#"+e).removeClass("is-valid").removeClass("is-invalid")}maskSocial(e){let s=document.getElementById(e);var t=s.selectionStart,o=s.selectionEnd;let a=s.value.replace(/\D*/g,"");a.length>=5&&(5==a.length&&(t+=1,o+=1),a=a.slice(0,3)+"-"+a.slice(3)),a.length>=7&&(7==a.length&&(t+=1,o+=1),a=a.slice(0,6)+"-"+a.slice(6)),s.value=a,s.setSelectionRange(t,o)}fieldValidation(e,s=0,t=0){var o=$("#"+e).val();o?($("#"+e).removeClass("is-invalid").addClass("is-valid"),1==t?Form.check(s):1==s&&Form.submit()):$("#"+e).removeClass("is-valid").removeClass("is-invalid")}dateValidation(e,s=1,t=0,o=0){if(e.includes("Input")){const a=$("#"+e).val();if(1==s){const s=e.replace("Input","");a&&!isNaN(Date.parse(a))?($("#"+e).addClass("is-valid").removeClass("is-invalid"),$("#validation_"+s).removeClass("invalid-field").addClass("invalid-feedback"),1==o?Form.check(t):1==t&&Form.submit()):($("#"+e).removeClass("is-valid").addClass("is-invalid"),$("#validation_"+s).addClass("invalid-field").removeClass("invalid-feedback"))}else $("#"+e).removeClass("is-invalid").removeClass("is-valid")}else 1==s?($("#"+e).parent().addClass("is-valid").removeClass("is-invalid"),1==t&&Form.submit()):$("#"+e).parent().removeClass("is-invalid").removeClass("is-valid")}dateMask(e){let s=document.getElementById(e),t=s.value.replace(/\D*/g,"");t.length>=3&&(t=t.slice(0,2)+"/"+t.slice(2)),t.length>=6&&(t=t.slice(0,5)+"/"+t.slice(5)),s.value=t}resetRadioList(e,s=0){$("#validation_"+e).removeClass("invalid-field").addClass("invalid-feedback"),Array.from(document.getElementsByName(e)).forEach(function(e){e.classList.remove("is-invalid"),e.checked&&e.classList.add("is-valid")}),1==s&&Form.submit()}vehicleYear(e,s,t=0){if(1==t)return void Form.submit();const o=$("#"+e).val(),a=new Promise(e=>{for(const[t,o]of Object.entries(Form.vehicles))if(t==s){for(const[e,s]of Object.entries(o))"make"==e?($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide()):"model"==e?($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide()):"trim"==e?($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide()):"description"==e&&($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide());e(!0)}});if(a&&o){const e=Form.id;$.post(Form.iDom+"/form/embed/vehicle/id/"+e+"/section/"+s+"/year/"+o,{csrf:$("#csrf").val()},e=>{const t=JSON.parse(e);if(t.isValid&&t.makes){const e=t.makes;for(const[t,o]of Object.entries(Form.vehicles))if(t==s)for(const[s,t]of Object.entries(o))if("make"==s){for(const[s,o]of Object.entries(e))$("#"+t).append('");$("#"+t).bsSelect({btnEmptyText:"Please select make",itemName:"makes",search:!0,showSelectionAsList:!1,btnClass:"btn-outline-filter"})}}})}}vehicleMake(e,s,t=0){if(1==t)return void Form.submit();const o=$("#"+e).val();var a=0;const l=new Promise(e=>{for(const[t,o]of Object.entries(Form.vehicles))if(t==s){for(const[e,s]of Object.entries(o))"model"==e?($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide()):"trim"==e?($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide()):"description"==e&&($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide());e(!0)}});if(l&&o)for(const[e,t]of Object.entries(Form.vehicles))if(e==s)for(const[e,l]of Object.entries(t))if("year"==e){const e=Form.id;a=$("#"+l).val(),$.post(Form.iDom+"/form/embed/vehicle/id/"+e+"/section/"+s+"/year/"+a+"/make/"+o,{csrf:$("#csrf").val()},e=>{const t=JSON.parse(e);if(t.isValid&&t.models){const e=t.models;for(const[t,o]of Object.entries(Form.vehicles))if(t==s)for(const[s,t]of Object.entries(o))if("model"==s){for(const[s,o]of Object.entries(e))$("#"+t).append('");$("#"+t).bsSelect({btnEmptyText:"Please select model",itemName:"model",search:!0,showSelectionAsList:!1,btnClass:"btn-outline-filter"})}}})}}vehicleModel(e,s,t=0){if(1==t)return void Form.submit();const o=$("#"+e).val();var a=0,l="";const r=new Promise(e=>{for(const[t,o]of Object.entries(Form.vehicles))if(t==s){for(const[e,s]of Object.entries(o))"trim"==e?($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide()):"description"==e&&($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide());e(!0)}});if(r&&o){for(const[e,t]of Object.entries(Form.vehicles))if(e==s)for(const[e,s]of Object.entries(t))"year"==e&&(a=$("#"+s).val()),"make"==e&&(l=$("#"+s).val());const e=Form.id;$.post(Form.iDom+"/form/embed/vehicle/id/"+e+"/section/"+s+"/year/"+a+"/make/"+l+"/model/"+o,{csrf:$("#csrf").val()},e=>{const t=JSON.parse(e);if(t.isValid&&t.trims){const e=t.trims;for(const[t,o]of Object.entries(Form.vehicles))if(t==s)for(const[s,t]of Object.entries(o))if("trim"==s){for(const[s,o]of Object.entries(e))$("#"+t).append('");$("#"+t).bsSelect({btnEmptyText:"Please select trim",itemName:"trim",search:!0,showSelectionAsList:!1,btnClass:"btn-outline-filter"})}}})}}vehicleTrim(e,s,t=0){if(1==t)return void Form.submit();const o=$("#"+e).val();var a=0,l="",r="";const i=new Promise(e=>{for(const[t,o]of Object.entries(Form.vehicles))if(t==s){for(const[e,s]of Object.entries(o))"description"==e&&($("#"+s).empty(),$("#"+s).bsSelect("destroy"),$("#"+s).hide());e(!0)}});if(i&&o){for(const[e,t]of Object.entries(Form.vehicles))if(e==s)for(const[e,s]of Object.entries(t))"year"==e&&(a=$("#"+s).val()),"make"==e&&(l=$("#"+s).val()),"model"==e&&(r=$("#"+s).val());const e=Form.id;$.post(Form.iDom+"/form/embed/vehicle/id/"+e+"/section/"+s+"/year/"+a+"/make/"+l+"/model/"+r+"/trim/"+o,{csrf:$("#csrf").val()},e=>{const t=JSON.parse(e);if(t.isValid&&t.description){const e=t.description;for(const[t,o]of Object.entries(Form.vehicles))if(t==s)for(const[s,t]of Object.entries(o))if("description"==s){for(const[s,o]of Object.entries(e))$("#"+t).append('");$("#"+t).bsSelect({btnEmptyText:"Please select style",itemName:"style",search:!0,showSelectionAsList:!1,btnClass:"btn-outline-filter"})}}})}}back(){Form.curStep>1&&($("#step_"+Form.curStep).html(""),$("#step_"+Form.curStep).removeClass("shown").removeClass("d-none").addClass("not-shown"),Form.curStep--,localStorage.setItem("curStep",Form.curStep),1==Form.curStep&&$("#back-button").html(""),Form.show(Form.curStep),$("#step_"+Form.curStep).removeClass("d-none"))}zip(e="",s=0,t=0){const o=$(`#${e}`).val();if(o){let a=/^\d{5}$|^\d{5}-\d{4}$/;if(a.test(o))if(Form.realZip){const a=Form.wFId;$.post(Form.iDom+"/form/embed/zip/id/"+a+"/zip/"+o+"/field/"+e,{csrf:$("#csrf").val()},o=>{const a=JSON.parse(o);if(a.isValid){if(a.city){const e=a.city,s=e.field,t=e.value,o=$("#"+s).val();t&&($("#"+s).val()?o!=t&&Swal.fire({buttonsStyling:!1,customClass:{confirmButton:"btn btn-success me-1",cancelButton:"btn btn-danger"},title:"City does not match zip code",html:"

Current city: "+o+"
Suggested city: "+t+'

Update city to '+t+"?

",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, update city",cancelButtonText:"No, keep current city",allowOutsideClick:!1}).then(e=>{e.isConfirmed&&($("#"+s).val(t),$("#"+s).addClass("is-valid").removeClass("is-invalid"))}):($("#"+s).val(t),$("#"+s).addClass("is-valid").removeClass("is-invalid")))}if(a.state){const e=a.state,s=e.field,t=e.value;t&&s&&($("#"+s).bsSelect("val",t),$("#"+s+"_label").closest("div").find(".drop-down").removeClass("btn-outline-filter").addClass("btn-outline-success"))}if($("#"+e).addClass("is-valid").removeClass("is-invalid"),Form.real&&1==t)return void Form.check();if(1==s)return void Form.sleep(200).then(()=>{Form.submit()})}else a.msg&&(Form.toastMixin.fire({icon:"error",html:'

'+a.msg+"

"}),$("#"+e).addClass("is-invalid").removeClass("is-valid"))})}else{if(Form.real&&1==t)return void Form.check();if(1==s)return void Form.sleep(200).then(()=>{Form.submit()})}else $("#"+e).addClass("is-invalid").removeClass("is-valid")}else $("#"+e).removeClass("is-valid").removeClass("is-invalid")}zipMask(e){let s=document.getElementById(e),t=s.value.replace(/\D*/g,"");t.length>=6&&(t=t.slice(0,5)+"-"+t.slice(5)),s.value=t}checkExt(e,s=0){const t=["jpeg","jpg","png","gif","pdf"];-1==$.inArray($("#"+e).val().split(".").pop().toLowerCase(),t)?($("#validation_"+e).html("Only formats are allowed : "+t.join(", ")),$("#"+e).removeClass("is-valid").addClass("is-invalid")):($("#"+e).removeClass("is-invalid").addClass("is-valid"),1==s&&Form.submit())}}Form=new LlForm,window.onload=(()=>{Form.iniate()});