1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["address-fields.plugin"],{398:(t,e,i)=>{i.r(e),i.d(e,{default:()=>l});var s=i(630);let n=window.PluginBaseClass,r={se:{length:5,splitAt:3}};class l extends n{init(){this.zipInput=this.el,this.form=this.zipInput.closest("form"),this.streetInput=this._findSibling("Street"),this.cityInput=this._findSibling("City"),this.cityManuallyEdited=!1,this._registerZipLookup(),this._registerZipFormatting(),this._registerStreetCheck()}_findSibling(t){var e;let i=this.zipInput.id.replace(/Zipcode$/,t);return i===this.zipInput.id?null:((e=this.form)!==null&&void 0!==e?e:document).querySelector("#".concat(CSS.escape(i)))}_registerZipLookup(){var t;if(!this.options.iso)return;let e=this._debounce(()=>this._lookupCity(),400);this.zipInput.addEventListener("input",e),(t=this.cityInput)===null||void 0===t||t.addEventListener("input",t=>{t.isTrusted&&(this.cityManuallyEdited=!0)})}async _lookupCity(){let t=this._digits(this.zipInput.value),e=this.options.zipLength||4;if(t.length<e)return;let i=await (0,s.Z)(this.options.iso,t);null!==i&&this._digits(this.zipInput.value)===t&&(this.cityInput&&i.city&&(!this.cityManuallyEdited||!this.cityInput.value.trim())&&(this.cityInput.value=i.city,this.cityInput.setCustomValidity(""),this.cityInput.dispatchEvent(new Event("change",{bubbles:!0})),this.cityManuallyEdited=!1),this.zipInput.dispatchEvent(new CustomEvent(s.Y,{bubbles:!0,detail:{zip:t,city:i.city,bounds:i.bounds}})))}_registerZipFormatting(){this.zipInput.addEventListener("blur",()=>this._formatZip())}_formatZip(){let t=this._digits(this.zipInput.value),e=r[this.options.iso],i=e&&t.length===e.length?"".concat(t.slice(0,e.splitAt)," ").concat(t.slice(e.splitAt)):t;i!==this.zipInput.value&&(this.zipInput.value=i,this.zipInput.dispatchEvent(new Event("change",{bubbles:!0})))}_registerStreetCheck(){var t,e,i,s,n;this.streetInput&&this.options.zipInStreetMessage&&(this.streetMessage=(s=(t=this.streetInput.parentElement)===null||void 0===t?void 0:t.querySelector(".js-validation-message"))!==null&&void 0!==s?s:null,this.defaultStreetMessage=(n=(e=this.streetMessage)===null||void 0===e?void 0:e.textContent)!==null&&void 0!==n?n:"",this.streetInput.addEventListener("input",()=>this._clearStreetError()),this.zipInput.addEventListener("input",()=>this._clearStreetError()),this.streetInput.addEventListener("blur",()=>this._checkStreet()),(i=this.form)===null||void 0===i||i.addEventListener("submit",t=>this._onSubmit(t),!0))}_checkStreet(){let t=this._digits(this.zipInput.value),e=this.streetInput.value.trim(),i=this.options.zipLength||0;if(!e||!t||t.length<i||null===this.zipInput.offsetParent)return this._clearStreetError(),!1;let s=t.split("").join("\\s?");return RegExp("(?:^|\\D)".concat(s,"\\s+\\p{L}"),"u").test(e)?(this.streetInput.setCustomValidity(this.options.zipInStreetMessage),this.streetMessage&&(this.streetMessage.textContent=this.options.zipInStreetMessage),!0):(this._clearStreetError(),!1)}_clearStreetError(){this.streetInput.validationMessage===this.options.zipInStreetMessage&&(this.streetInput.setCustomValidity(""),this.streetMessage&&(this.streetMessage.textContent=this.defaultStreetMessage))}_onSubmit(t){var e;this._checkStreet()&&(t.preventDefault(),t.stopPropagation(),(e=this.form)===null||void 0===e||e.classList.add("was-validated"),this.streetInput.reportValidity())}_digits(t){return(null!=t?t:"").replace(/\D/g,"")}_debounce(t,e){let i=null;return()=>{window.clearTimeout(i),i=window.setTimeout(t,e)}}}l.options={iso:"",zipLength:0,zipInStreetMessage:""}},630:(t,e,i)=>{i.d(e,{Y:()=>s,Z:()=>n});let s="wexo-zip-resolved";async function n(t,e){let i=new URLSearchParams({country:t,zip:e});try{var s,n;let t=await fetch("/address/zip-lookup?".concat(i.toString()),{headers:{"X-Requested-With":"XMLHttpRequest"}});if(!t.ok)return null;let e=await t.json();return{city:(s=e.city)!==null&&void 0!==s?s:"",bounds:(n=e.bounds)!==null&&void 0!==n?n:null}}catch(t){return null}}}}]);
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.