!function(){"use strict";class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.$form=t.$form,this.form=this.$form.form,this.$field=t.$field,this.$locationBtn=this.$field.querySelector("[data-fui-address-location-btn]"),this.loadingClass=this.form.getClasses("loading"),this.initLocationBtn()}initLocationBtn(){this.$locationBtn&&this.form.addEventListener(this.$locationBtn,function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e||(e=Math.random().toString(36).substr(2,5)),`${t}.${e}`}("click"),(t=>{t.preventDefault(),this.onStartFetchLocation(),navigator.geolocation?navigator.geolocation.getCurrentPosition((t=>{this.onCurrentLocation(t)}),(t=>{console.log(`Unable to fetch location ${t.code}.`),this.onEndFetchLocation()}),{enableHighAccuracy:!0}):(console.log("Browser does not support geolocation."),this.onEndFetchLocation())}))}onCurrentLocation(t){this.onEndFetchLocation()}onStartFetchLocation(){var t,e;t=this.$locationBtn,e=this.loadingClass,t&&e&&("string"==typeof e&&(e=e.split(" ")),e.forEach((e=>{t.classList.add(e)}))),this.$locationBtn.setAttribute("aria-disabled",!0)}onEndFetchLocation(){var t,e;t=this.$locationBtn,e=this.loadingClass,t&&e&&("string"==typeof e&&(e=e.split(" ")),e.forEach((e=>{t.classList.remove(e)}))),this.$locationBtn.setAttribute("aria-disabled",!1)}}function e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,o)}return i}function i(t,e,i){return e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e),e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}window.FormieAddressProvider=t;window.FormieLoqate=class extends t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),this.$form=t.$form,this.form=this.$form.form,this.$field=t.$field,this.$input=this.$field.querySelector("[data-autocomplete]"),this.scriptId="FORMIE_LOQATE_SCRIPT",this.apiKey=t.apiKey,this.namespace=t.namespace,this.reconfigurableOptions=t.reconfigurableOptions,this.retryTimes=0,this.maxRetryTimes=150,this.waitTimeout=200,this.$input?this.initScript():console.error("Unable to find input `[data-autocomplete]`.")}initScript(){if(document.getElementById(this.scriptId))this.waitForLoad();else{const t=document.createElement("script");t.src="https://services.pcapredict.com/js/address-3.91.min.js?ver=4.7.3",t.defer=!0,t.async=!0,t.id=this.scriptId,t.onload=()=>{this.initAutocomplete()},document.body.appendChild(t);const e=document.createElement("link");e.href="https://services.pcapredict.com/css/address-3.91.min.css",e.rel="stylesheet",e.type="text/css",document.body.appendChild(e)}}waitForLoad(){this.retryTimes>this.maxRetryTimes?console.error(`Unable to load Loqate API after ${this.retryTimes} times.`):"undefined"==typeof pca?(this.retryTimes+=1,setTimeout(this.waitForLoad.bind(this),this.waitTimeout)):this.initAutocomplete()}initAutocomplete(){const t=[{element:`${this.namespace}[autoComplete]`,field:"",mode:pca.fieldMode.SEARCH},{element:`${this.namespace}[address1]`,field:"Line1",mode:pca.fieldMode.POPULATE},{element:`${this.namespace}[address2]`,field:"Line2",mode:pca.fieldMode.POPULATE},{element:`${this.namespace}[address3]`,field:"Line3",mode:pca.fieldMode.POPULATE},{element:`${this.namespace}[city]`,field:"City",mode:pca.fieldMode.POPULATE},{element:`${this.namespace}[state]`,field:"Province",mode:pca.fieldMode.POPULATE},{element:`${this.namespace}[zip]`,field:"PostalCode",mode:pca.fieldMode.POPULATE},{element:`${this.namespace}[country]`,field:"CountryName",mode:pca.fieldMode.COUNTRY}],o=function(t){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?e(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({key:this.apiKey},this.reconfigurableOptions);new pca.Address(t,o)}}}();