/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@ideal-postcodes/address-finder-bundled@5.0.4/dist/address-finder.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
/**
 * @license
 * Ideal Postcodes <https://ideal-postcodes.co.uk>
 * Copyright IDDQD Limited
 * Address Finder Bundled 5.0.4
 * Built on Address Finder ~5.2.6
 * AGPL-3.0 Licence
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IdealPostcodes=t.IdealPostcodes||{})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},o="object"==typeof e&&e&&e.Object===Object&&e,i="object"==typeof self&&self&&self.Object===Object&&self,r=o||i||Function("return this")(),s=r,a=function(){return s.Date.now()},c=/\s/;var l=function(t){for(var e=t.length;e--&&c.test(t.charAt(e)););return e},u=/^\s+/;var d=function(t){return t?t.slice(0,l(t)+1).replace(u,""):t},h=r.Symbol,p=h,f=Object.prototype,m=f.hasOwnProperty,g=f.toString,y=p?p.toStringTag:void 0;var b=function(t){var e=m.call(t,y),n=t[y];try{t[y]=void 0;var o=!0}catch(t){}var i=g.call(t);return o&&(e?t[y]=n:delete t[y]),i},v=Object.prototype.toString;var E=b,w=function(t){return v.call(t)},S=h?h.toStringTag:void 0;var x=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":S&&S in Object(t)?E(t):w(t)},C=function(t){return null!=t&&"object"==typeof t};var T=d,O=n,A=function(t){return"symbol"==typeof t||C(t)&&"[object Symbol]"==x(t)},_=/^[-+]0x[0-9a-f]+$/i,R=/^0b[01]+$/i,N=/^0o[0-7]+$/i,L=parseInt;var U=n,j=a,k=function(t){if("number"==typeof t)return t;if(A(t))return NaN;if(O(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=O(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=T(t);var n=R.test(t);return n||N.test(t)?L(t.slice(2),n?2:8):_.test(t)?NaN:+t},P=Math.max,F=Math.min;var D=function(t,e,n){var o,i,r,s,a,c,l=0,u=!1,d=!1,h=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){var n=o,r=i;return o=i=void 0,l=e,s=t.apply(r,n)}function f(t){var n=t-c;return void 0===c||n>=e||n<0||d&&t-l>=r}function m(){var t=j();if(f(t))return g(t);a=setTimeout(m,function(t){var n=e-(t-c);return d?F(n,r-(t-l)):n}(t))}function g(t){return a=void 0,h&&o?p(t):(o=i=void 0,s)}function y(){var t=j(),n=f(t);if(o=arguments,i=this,c=t,n){if(void 0===a)return function(t){return l=t,a=setTimeout(m,e),u?p(t):s}(c);if(d)return clearTimeout(a),a=setTimeout(m,e),p(c)}return void 0===a&&(a=setTimeout(m,e)),s}return e=k(e)||0,U(n)&&(u=!!n.leading,r=(d="maxWait"in n)?P(k(n.maxWait)||0,e):r,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==a&&clearTimeout(a),l=0,o=c=i=a=void 0},y.flush=function(){return void 0===a?s:g(j())},y};const I=(t,e)=>(t.id=e,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t),B=t=>{const e={};for(const n of t)e[n.iso_3]=n;return e},q={tls:!0,api_key:"",baseUrl:"api.ideal-postcodes.co.uk",version:"v1",strictAuthorisation:!1,timeout:1e4,header:{Accept:"application/json","Content-Type":"application/json"},tags:[],agent:{}};class M{constructor(t){this.config={...q,...t},this.config.header={...q.header,...t.header&&t.header}}url(){const{baseUrl:t,version:e}=this.config;return`${this.protocol()}://${t}/${e}`}protocol(){return this.config.tls?"https":"http"}}const H=t=>void 0===t?{}:Object.keys(t).reduce(((e,n)=>{const o=t[n],i=z(o);return i.length>0&&(e[n]=i),e}),{}),$=t=>"string"==typeof t,z=t=>{const e=[];return(t=>Array.isArray(t))(t)?(t.forEach((t=>{G(t)&&e.push(t.toString()),$(t)&&e.push(t)})),e.join(",")):G(t)?t.toString():$(t)?t:""},G=t=>"number"==typeof t,K=(t,e)=>{let{timeout:n}=t;return G(n)?n:e.config.timeout},W=(t,e)=>{let{header:n={}}=t;return{...e.config.header,...H(n)}};class V extends Error{constructor(t){const e=new.target.prototype;super(),this.__proto__=e;const{message:n,httpStatus:o,metadata:i={}}=t;this.message=n,this.name="Ideal Postcodes Error",this.httpStatus=o,this.metadata=i,Error.captureStackTrace&&Error.captureStackTrace(this,V)}}class J extends V{constructor(t){super({httpStatus:t.httpStatus,message:t.body.message}),this.response=t}}class Y extends J{}class X extends J{}class Q extends X{}class Z extends J{}class tt extends Z{}class et extends Z{}class nt extends J{}class ot extends nt{}class it extends nt{}class rt extends nt{}class st extends nt{}class at extends J{}const ct=t=>{const{httpStatus:e,body:n}=t;if((o=e)<200||o>=300){var o;if((t=>{return null!==(e=t)&&"object"==typeof e&&"string"==typeof t.message&&"number"==typeof t.code;var e})(n)){const{code:o}=n;if(4010===o)return new Q(t);if(4040===o)return new ot(t);if(4042===o)return new it(t);if(4044===o)return new rt(t);if(4046===o)return new st(t);if(4020===o)return new tt(t);if(4021===o)return new et(t);if(404===e)return new nt(t);if(400===e)return new Y(t);if(402===e)return new Z(t);if(401===e)return new X(t);if(500===e)return new at(t)}return new V({httpStatus:e,message:JSON.stringify(n)})}};var lt=Object.freeze({__proto__:null,IdealPostcodesError:V,IdpcApiError:J,IdpcBadRequestError:Y,IdpcUnauthorisedError:X,IdpcInvalidKeyError:Q,IdpcRequestFailedError:Z,IdpcBalanceDepletedError:tt,IdpcLimitReachedError:et,IdpcResourceNotFoundError:nt,IdpcPostcodeNotFoundError:ot,IdpcKeyNotFoundError:it,IdpcUdprnNotFoundError:rt,IdpcUmprnNotFoundError:st,IdpcServerError:at,parse:ct});const ut=(t,e)=>[t.client.url(),t.resource,encodeURIComponent(e),t.action].filter((t=>void 0!==t)).join("/"),dt=t=>{const{client:e}=t;return(n,o)=>e.config.agent.http({method:"GET",url:ut(t,n),query:H(o.query),header:W(o,e),timeout:K(o,e)}).then((t=>{const e=ct(t);if(e)throw e;return t}))},ht=t=>{const{client:e,timeout:n}=t,o=t.api_key||t.client.config.api_key,{licensee:i}=t;let r;r=void 0===i?{}:{licensee:i};const s={query:r,header:{}};return void 0!==n&&(s.timeout=n),((t,e,n)=>dt({resource:"keys",client:t})(e,n))(e,o,s).then((t=>t.body.result))},pt="autocomplete/addresses",ft=(t,e)=>(t=>{const{client:e,resource:n}=t;return t=>e.config.agent.http({method:"GET",url:`${e.url()}/${n}`,query:H(t.query),header:W(t,e),timeout:K(t,e)}).then((t=>{const e=ct(t);if(e)throw e;return t}))})({resource:pt,client:t})(e);function mt(t,e){return function(){return t.apply(e,arguments)}}const{toString:gt}=Object.prototype,{getPrototypeOf:yt}=Object,{iterator:bt,toStringTag:vt}=Symbol,Et=(wt=Object.create(null),t=>{const e=gt.call(t);return wt[e]||(wt[e]=e.slice(8,-1).toLowerCase())});var wt;const St=t=>(t=t.toLowerCase(),e=>Et(e)===t),xt=t=>e=>typeof e===t,{isArray:Ct}=Array,Tt=xt("undefined");function Ot(t){return null!==t&&!Tt(t)&&null!==t.constructor&&!Tt(t.constructor)&&Rt(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const At=St("ArrayBuffer");const _t=xt("string"),Rt=xt("function"),Nt=xt("number"),Lt=t=>null!==t&&"object"==typeof t,Ut=t=>{if("object"!==Et(t))return!1;const e=yt(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||vt in t||bt in t)},jt=St("Date"),kt=St("File"),Pt=St("Blob"),Ft=St("FileList"),Dt=St("URLSearchParams"),[It,Bt,qt,Mt]=["ReadableStream","Request","Response","Headers"].map(St);function Ht(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let o,i;if("object"!=typeof t&&(t=[t]),Ct(t))for(o=0,i=t.length;o<i;o++)e.call(null,t[o],o,t);else{if(Ot(t))return;const i=n?Object.getOwnPropertyNames(t):Object.keys(t),r=i.length;let s;for(o=0;o<r;o++)s=i[o],e.call(null,t[s],s,t)}}function $t(t,e){if(Ot(t))return null;e=e.toLowerCase();const n=Object.keys(t);let o,i=n.length;for(;i-- >0;)if(o=n[i],e===o.toLowerCase())return o;return null}const zt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Gt=t=>!Tt(t)&&t!==zt;const Kt=(Wt="undefined"!=typeof Uint8Array&&yt(Uint8Array),t=>Wt&&t instanceof Wt);var Wt;const Vt=St("HTMLFormElement"),Jt=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Yt=St("RegExp"),Xt=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),o={};Ht(n,((n,i)=>{let r;!1!==(r=e(n,i,t))&&(o[i]=r||n)})),Object.defineProperties(t,o)};const Qt=St("AsyncFunction"),Zt=(te="function"==typeof setImmediate,ee=Rt(zt.postMessage),te?setImmediate:ee?(ne=`axios@${Math.random()}`,oe=[],zt.addEventListener("message",(({source:t,data:e})=>{t===zt&&e===ne&&oe.length&&oe.shift()()}),!1),t=>{oe.push(t),zt.postMessage(ne,"*")}):t=>setTimeout(t));var te,ee,ne,oe;const ie="undefined"!=typeof queueMicrotask?queueMicrotask.bind(zt):"undefined"!=typeof process&&process.nextTick||Zt;var re={isArray:Ct,isArrayBuffer:At,isBuffer:Ot,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||Rt(t.append)&&("formdata"===(e=Et(t))||"object"===e&&Rt(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&At(t.buffer),e},isString:_t,isNumber:Nt,isBoolean:t=>!0===t||!1===t,isObject:Lt,isPlainObject:Ut,isEmptyObject:t=>{if(!Lt(t)||Ot(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:It,isRequest:Bt,isResponse:qt,isHeaders:Mt,isUndefined:Tt,isDate:jt,isFile:kt,isBlob:Pt,isRegExp:Yt,isFunction:Rt,isStream:t=>Lt(t)&&Rt(t.pipe),isURLSearchParams:Dt,isTypedArray:Kt,isFileList:Ft,forEach:Ht,merge:function t(){const{caseless:e,skipUndefined:n}=Gt(this)&&this||{},o={},i=(i,r)=>{const s=e&&$t(o,r)||r;Ut(o[s])&&Ut(i)?o[s]=t(o[s],i):Ut(i)?o[s]=t({},i):Ct(i)?o[s]=i.slice():n&&Tt(i)||(o[s]=i)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&Ht(arguments[t],i);return o},extend:(t,e,n,{allOwnKeys:o}={})=>(Ht(e,((e,o)=>{n&&Rt(e)?t[o]=mt(e,n):t[o]=e}),{allOwnKeys:o}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,o)=>{t.prototype=Object.create(e.prototype,o),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,o)=>{let i,r,s;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),r=i.length;r-- >0;)s=i[r],o&&!o(s,t,e)||a[s]||(e[s]=t[s],a[s]=!0);t=!1!==n&&yt(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:Et,kindOfTest:St,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const o=t.indexOf(e,n);return-1!==o&&o===n},toArray:t=>{if(!t)return null;if(Ct(t))return t;let e=t.length;if(!Nt(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[bt]).call(t);let o;for(;(o=n.next())&&!o.done;){const n=o.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const o=[];for(;null!==(n=t.exec(e));)o.push(n);return o},isHTMLForm:Vt,hasOwnProperty:Jt,hasOwnProp:Jt,reduceDescriptors:Xt,freezeMethods:t=>{Xt(t,((e,n)=>{if(Rt(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const o=t[n];Rt(o)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},o=t=>{t.forEach((t=>{n[t]=!0}))};return Ct(t)?o(t):o(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:$t,global:zt,isContextDefined:Gt,isSpecCompliantForm:function(t){return!!(t&&Rt(t.append)&&"FormData"===t[vt]&&t[bt])},toJSONObject:t=>{const e=new Array(10),n=(t,o)=>{if(Lt(t)){if(e.indexOf(t)>=0)return;if(Ot(t))return t;if(!("toJSON"in t)){e[o]=t;const i=Ct(t)?[]:{};return Ht(t,((t,e)=>{const r=n(t,o+1);!Tt(r)&&(i[e]=r)})),e[o]=void 0,i}}return t};return n(t,0)},isAsyncFn:Qt,isThenable:t=>t&&(Lt(t)||Rt(t))&&Rt(t.then)&&Rt(t.catch),setImmediate:Zt,asap:ie,isIterable:t=>null!=t&&Rt(t[bt])};function se(t,e,n,o,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),o&&(this.request=o),i&&(this.response=i,this.status=i.status?i.status:null)}re.inherits(se,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}});const ae=se.prototype,ce={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{ce[t]={value:t}})),Object.defineProperties(se,ce),Object.defineProperty(ae,"isAxiosError",{value:!0}),se.from=(t,e,n,o,i,r)=>{const s=Object.create(ae);re.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t));const a=t&&t.message?t.message:"Error",c=null==e&&t?t.code:e;return se.call(s,a,c,n,o,i),t&&null==s.cause&&Object.defineProperty(s,"cause",{value:t,configurable:!0}),s.name=t&&t.name||"Error",r&&Object.assign(s,r),s};function le(t){return re.isPlainObject(t)||re.isArray(t)}function ue(t){return re.endsWith(t,"[]")?t.slice(0,-2):t}function de(t,e,n){return t?t.concat(e).map((function(t,e){return t=ue(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const he=re.toFlatObject(re,{},null,(function(t){return/^is[A-Z]/.test(t)}));function pe(t,e,n){if(!re.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const o=(n=re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!re.isUndefined(e[t])}))).metaTokens,i=n.visitor||l,r=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(re.isDate(t))return t.toISOString();if(re.isBoolean(t))return t.toString();if(!a&&re.isBlob(t))throw new se("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(t)||re.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function l(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(re.endsWith(n,"{}"))n=o?n:n.slice(0,-2),t=JSON.stringify(t);else if(re.isArray(t)&&function(t){return re.isArray(t)&&!t.some(le)}(t)||(re.isFileList(t)||re.endsWith(n,"[]"))&&(a=re.toArray(t)))return n=ue(n),a.forEach((function(t,o){!re.isUndefined(t)&&null!==t&&e.append(!0===s?de([n],o,r):null===s?n:n+"[]",c(t))})),!1;return!!le(t)||(e.append(de(i,n,r),c(t)),!1)}const u=[],d=Object.assign(he,{defaultVisitor:l,convertValue:c,isVisitable:le});if(!re.isObject(t))throw new TypeError("data must be an object");return function t(n,o){if(!re.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+o.join("."));u.push(n),re.forEach(n,(function(n,r){!0===(!(re.isUndefined(n)||null===n)&&i.call(e,n,re.isString(r)?r.trim():r,o,d))&&t(n,o?o.concat(r):[r])})),u.pop()}}(t),e}function fe(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function me(t,e){this._pairs=[],t&&pe(t,this,e)}const ge=me.prototype;function ye(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function be(t,e,n){if(!e)return t;const o=n&&n.encode||ye;re.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let r;if(r=i?i(e,n):re.isURLSearchParams(e)?e.toString():new me(e,n).toString(o),r){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t}ge.append=function(t,e){this._pairs.push([t,e])},ge.toString=function(t){const e=t?function(e){return t.call(this,e,fe)}:fe;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};var ve=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){re.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},Ee={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},we={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:me,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Se="undefined"!=typeof window&&"undefined"!=typeof document,xe="object"==typeof navigator&&navigator||void 0,Ce=Se&&(!xe||["ReactNative","NativeScript","NS"].indexOf(xe.product)<0),Te="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Oe=Se&&window.location.href||"http://localhost";var Ae={...Object.freeze({__proto__:null,hasBrowserEnv:Se,hasStandardBrowserWebWorkerEnv:Te,hasStandardBrowserEnv:Ce,navigator:xe,origin:Oe}),...we};function _e(t){function e(t,n,o,i){let r=t[i++];if("__proto__"===r)return!0;const s=Number.isFinite(+r),a=i>=t.length;if(r=!r&&re.isArray(o)?o.length:r,a)return re.hasOwnProp(o,r)?o[r]=[o[r],n]:o[r]=n,!s;o[r]&&re.isObject(o[r])||(o[r]=[]);return e(t,n,o[r],i)&&re.isArray(o[r])&&(o[r]=function(t){const e={},n=Object.keys(t);let o;const i=n.length;let r;for(o=0;o<i;o++)r=n[o],e[r]=t[r];return e}(o[r])),!s}if(re.isFormData(t)&&re.isFunction(t.entries)){const n={};return re.forEachEntry(t,((t,o)=>{e(function(t){return re.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),o,n,0)})),n}return null}const Re={transitional:Ee,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",o=n.indexOf("application/json")>-1,i=re.isObject(t);i&&re.isHTMLForm(t)&&(t=new FormData(t));if(re.isFormData(t))return o?JSON.stringify(_e(t)):t;if(re.isArrayBuffer(t)||re.isBuffer(t)||re.isStream(t)||re.isFile(t)||re.isBlob(t)||re.isReadableStream(t))return t;if(re.isArrayBufferView(t))return t.buffer;if(re.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let r;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return pe(t,new Ae.classes.URLSearchParams,{visitor:function(t,e,n,o){return Ae.isNode&&re.isBuffer(t)?(this.append(e,t.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((r=re.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return pe(r?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||o?(e.setContentType("application/json",!1),function(t,e,n){if(re.isString(t))try{return(e||JSON.parse)(t),re.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||Re.transitional,n=e&&e.forcedJSONParsing,o="json"===this.responseType;if(re.isResponse(t)||re.isReadableStream(t))return t;if(t&&re.isString(t)&&(n&&!this.responseType||o)){const n=!(e&&e.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(t){if(n){if("SyntaxError"===t.name)throw se.from(t,se.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ae.classes.FormData,Blob:Ae.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],(t=>{Re.headers[t]={}}));var Ne=Re;const Le=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Ue=Symbol("internals");function je(t){return t&&String(t).trim().toLowerCase()}function ke(t){return!1===t||null==t?t:re.isArray(t)?t.map(ke):String(t)}function Pe(t,e,n,o,i){return re.isFunction(o)?o.call(this,e,n):(i&&(e=n),re.isString(e)?re.isString(o)?-1!==e.indexOf(o):re.isRegExp(o)?o.test(e):void 0:void 0)}class Fe{constructor(t){t&&this.set(t)}set(t,e,n){const o=this;function i(t,e,n){const i=je(e);if(!i)throw new Error("header name must be a non-empty string");const r=re.findKey(o,i);(!r||void 0===o[r]||!0===n||void 0===n&&!1!==o[r])&&(o[r||e]=ke(t))}const r=(t,e)=>re.forEach(t,((t,n)=>i(t,n,e)));if(re.isPlainObject(t)||t instanceof this.constructor)r(t,e);else if(re.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))r((t=>{const e={};let n,o,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),n=t.substring(0,i).trim().toLowerCase(),o=t.substring(i+1).trim(),!n||e[n]&&Le[n]||("set-cookie"===n?e[n]?e[n].push(o):e[n]=[o]:e[n]=e[n]?e[n]+", "+o:o)})),e})(t),e);else if(re.isObject(t)&&re.isIterable(t)){let n,o,i={};for(const e of t){if(!re.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[o=e[0]]=(n=i[o])?re.isArray(n)?[...n,e[1]]:[n,e[1]]:e[1]}r(i,e)}else null!=t&&i(e,t,n);return this}get(t,e){if(t=je(t)){const n=re.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let o;for(;o=n.exec(t);)e[o[1]]=o[2];return e}(t);if(re.isFunction(e))return e.call(this,t,n);if(re.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=je(t)){const n=re.findKey(this,t);return!(!n||void 0===this[n]||e&&!Pe(0,this[n],n,e))}return!1}delete(t,e){const n=this;let o=!1;function i(t){if(t=je(t)){const i=re.findKey(n,t);!i||e&&!Pe(0,n[i],i,e)||(delete n[i],o=!0)}}return re.isArray(t)?t.forEach(i):i(t),o}clear(t){const e=Object.keys(this);let n=e.length,o=!1;for(;n--;){const i=e[n];t&&!Pe(0,this[i],i,t,!0)||(delete this[i],o=!0)}return o}normalize(t){const e=this,n={};return re.forEach(this,((o,i)=>{const r=re.findKey(n,i);if(r)return e[r]=ke(o),void delete e[i];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(i):String(i).trim();s!==i&&delete e[i],e[s]=ke(o),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return re.forEach(this,((n,o)=>{null!=n&&!1!==n&&(e[o]=t&&re.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach((t=>n.set(t))),n}static accessor(t){const e=(this[Ue]=this[Ue]={accessors:{}}).accessors,n=this.prototype;function o(t){const o=je(t);e[o]||(!function(t,e){const n=re.toCamelCase(" "+e);["get","set","has"].forEach((o=>{Object.defineProperty(t,o+n,{value:function(t,n,i){return this[o].call(this,e,t,n,i)},configurable:!0})}))}(n,t),e[o]=!0)}return re.isArray(t)?t.forEach(o):o(t),this}}Fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(Fe.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),re.freezeMethods(Fe);var De=Fe;function Ie(t,e){const n=this||Ne,o=e||n,i=De.from(o.headers);let r=o.data;return re.forEach(t,(function(t){r=t.call(n,r,i.normalize(),e?e.status:void 0)})),i.normalize(),r}function Be(t){return!(!t||!t.__CANCEL__)}function qe(t,e,n){se.call(this,null==t?"canceled":t,se.ERR_CANCELED,e,n),this.name="CanceledError"}function Me(t,e,n){const o=n.config.validateStatus;n.status&&o&&!o(n.status)?e(new se("Request failed with status code "+n.status,[se.ERR_BAD_REQUEST,se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}re.inherits(qe,se,{__CANCEL__:!0});const He=(t,e,n=3)=>{let o=0;const i=function(t,e){t=t||10;const n=new Array(t),o=new Array(t);let i,r=0,s=0;return e=void 0!==e?e:1e3,function(a){const c=Date.now(),l=o[s];i||(i=c),n[r]=a,o[r]=c;let u=s,d=0;for(;u!==r;)d+=n[u++],u%=t;if(r=(r+1)%t,r===s&&(s=(s+1)%t),c-i<e)return;const h=l&&c-l;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(t,e){let n,o,i=0,r=1e3/e;const s=(e,r=Date.now())=>{i=r,n=null,o&&(clearTimeout(o),o=null),t(...e)};return[(...t)=>{const e=Date.now(),a=e-i;a>=r?s(t,e):(n=t,o||(o=setTimeout((()=>{o=null,s(n)}),r-a)))},()=>n&&s(n)]}((n=>{const r=n.loaded,s=n.lengthComputable?n.total:void 0,a=r-o,c=i(a);o=r;t({loaded:r,total:s,progress:s?r/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&r<=s?(s-r)/c:void 0,event:n,lengthComputable:null!=s,[e?"download":"upload"]:!0})}),n)},$e=(t,e)=>{const n=null!=t;return[o=>e[0]({lengthComputable:n,total:t,loaded:o}),e[1]]},ze=t=>(...e)=>re.asap((()=>t(...e)));var Ge=Ae.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Ae.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Ae.origin),Ae.navigator&&/(msie|trident)/i.test(Ae.navigator.userAgent)):()=>!0,Ke=Ae.hasStandardBrowserEnv?{write(t,e,n,o,i,r){const s=[t+"="+encodeURIComponent(e)];re.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),re.isString(o)&&s.push("path="+o),re.isString(i)&&s.push("domain="+i),!0===r&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function We(t,e,n){let o=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(o||0==n)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Ve=t=>t instanceof De?{...t}:t;function Je(t,e){e=e||{};const n={};function o(t,e,n,o){return re.isPlainObject(t)&&re.isPlainObject(e)?re.merge.call({caseless:o},t,e):re.isPlainObject(e)?re.merge({},e):re.isArray(e)?e.slice():e}function i(t,e,n,i){return re.isUndefined(e)?re.isUndefined(t)?void 0:o(void 0,t,0,i):o(t,e,0,i)}function r(t,e){if(!re.isUndefined(e))return o(void 0,e)}function s(t,e){return re.isUndefined(e)?re.isUndefined(t)?void 0:o(void 0,t):o(void 0,e)}function a(n,i,r){return r in e?o(n,i):r in t?o(void 0,n):void 0}const c={url:r,method:r,data:r,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e,n)=>i(Ve(t),Ve(e),0,!0)};return re.forEach(Object.keys({...t,...e}),(function(o){const r=c[o]||i,s=r(t[o],e[o],o);re.isUndefined(s)&&r!==a||(n[o]=s)})),n}var Ye=t=>{const e=Je({},t);let{data:n,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:r,headers:s,auth:a}=e;if(e.headers=s=De.from(s),e.url=be(We(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),re.isFormData(n))if(Ae.hasStandardBrowserEnv||Ae.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(re.isFunction(n.getHeaders)){const t=n.getHeaders(),e=["content-type","content-length"];Object.entries(t).forEach((([t,n])=>{e.includes(t.toLowerCase())&&s.set(t,n)}))}if(Ae.hasStandardBrowserEnv&&(o&&re.isFunction(o)&&(o=o(e)),o||!1!==o&&Ge(e.url))){const t=i&&r&&Ke.read(r);t&&s.set(i,t)}return e};var Xe="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){const o=Ye(t);let i=o.data;const r=De.from(o.headers).normalize();let s,a,c,l,u,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=o;function f(){l&&l(),u&&u(),o.cancelToken&&o.cancelToken.unsubscribe(s),o.signal&&o.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const o=De.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Me((function(t){e(t),f()}),(function(t){n(t),f()}),{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:o,config:t,request:m}),m=null}m.open(o.method.toUpperCase(),o.url,!0),m.timeout=o.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new se("Request aborted",se.ECONNABORTED,t,m)),m=null)},m.onerror=function(e){const o=new se(e&&e.message?e.message:"Network Error",se.ERR_NETWORK,t,m);o.event=e||null,n(o),m=null},m.ontimeout=function(){let e=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const i=o.transitional||Ee;o.timeoutErrorMessage&&(e=o.timeoutErrorMessage),n(new se(e,i.clarifyTimeoutError?se.ETIMEDOUT:se.ECONNABORTED,t,m)),m=null},void 0===i&&r.setContentType(null),"setRequestHeader"in m&&re.forEach(r.toJSON(),(function(t,e){m.setRequestHeader(e,t)})),re.isUndefined(o.withCredentials)||(m.withCredentials=!!o.withCredentials),d&&"json"!==d&&(m.responseType=o.responseType),p&&([c,u]=He(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,l]=He(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(o.cancelToken||o.signal)&&(s=e=>{m&&(n(!e||e.type?new qe(null,t,m):e),m.abort(),m=null)},o.cancelToken&&o.cancelToken.subscribe(s),o.signal&&(o.signal.aborted?s():o.signal.addEventListener("abort",s)));const y=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(o.url);y&&-1===Ae.protocols.indexOf(y)?n(new se("Unsupported protocol "+y+":",se.ERR_BAD_REQUEST,t)):m.send(i||null)}))};var Qe=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n,o=new AbortController;const i=function(t){if(!n){n=!0,s();const e=t instanceof Error?t:this.reason;o.abort(e instanceof se?e:new qe(e instanceof Error?e.message:e))}};let r=e&&setTimeout((()=>{r=null,i(new se(`timeout ${e} of ms exceeded`,se.ETIMEDOUT))}),e);const s=()=>{t&&(r&&clearTimeout(r),r=null,t.forEach((t=>{t.unsubscribe?t.unsubscribe(i):t.removeEventListener("abort",i)})),t=null)};t.forEach((t=>t.addEventListener("abort",i)));const{signal:a}=o;return a.unsubscribe=()=>re.asap(s),a}};const Ze=function*(t,e){let n=t.byteLength;if(!e||n<e)return void(yield t);let o,i=0;for(;i<n;)o=i+e,yield t.slice(i,o),i=o},tn=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},en=(t,e,n,o)=>{const i=async function*(t,e){for await(const n of tn(t))yield*Ze(n,e)}(t,e);let r,s=0,a=t=>{r||(r=!0,o&&o(t))};return new ReadableStream({async pull(t){try{const{done:e,value:o}=await i.next();if(e)return a(),void t.close();let r=o.byteLength;if(n){let t=s+=r;n(t)}t.enqueue(new Uint8Array(o))}catch(t){throw a(t),t}},cancel:t=>(a(t),i.return())},{highWaterMark:2})},{isFunction:nn}=re,on=(({Request:t,Response:e})=>({Request:t,Response:e}))(re.global),{ReadableStream:rn,TextEncoder:sn}=re.global,an=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},cn=t=>{t=re.merge.call({skipUndefined:!0},on,t);const{fetch:e,Request:n,Response:o}=t,i=e?nn(e):"function"==typeof fetch,r=nn(n),s=nn(o);if(!i)return!1;const a=i&&nn(rn),c=i&&("function"==typeof sn?(l=new sn,t=>l.encode(t)):async t=>new Uint8Array(await new n(t).arrayBuffer()));var l;const u=r&&a&&an((()=>{let t=!1;const e=new n(Ae.origin,{body:new rn,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})),d=s&&a&&an((()=>re.isReadableStream(new o("").body))),h={stream:d&&(t=>t.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!h[t]&&(h[t]=(e,n)=>{let o=e&&e[t];if(o)return o.call(e);throw new se(`Response type '${t}' is not supported`,se.ERR_NOT_SUPPORT,n)})}));const p=async(t,e)=>{const o=re.toFiniteNumber(t.getContentLength());return null==o?(async t=>{if(null==t)return 0;if(re.isBlob(t))return t.size;if(re.isSpecCompliantForm(t)){const e=new n(Ae.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return re.isArrayBufferView(t)||re.isArrayBuffer(t)?t.byteLength:(re.isURLSearchParams(t)&&(t+=""),re.isString(t)?(await c(t)).byteLength:void 0)})(e):o};return async t=>{let{url:i,method:s,data:a,signal:c,cancelToken:l,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:E}=Ye(t),w=e||fetch;y=y?(y+"").toLowerCase():"text";let S=Qe([c,l&&l.toAbortSignal()],f),x=null;const C=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let T;try{if(g&&u&&"get"!==s&&"head"!==s&&0!==(T=await p(b,a))){let t,e=new n(i,{method:"POST",body:a,duplex:"half"});if(re.isFormData(a)&&(t=e.headers.get("content-type"))&&b.setContentType(t),e.body){const[t,n]=$e(T,He(ze(g)));a=en(e.body,65536,t,n)}}re.isString(v)||(v=v?"include":"omit");const e=r&&"credentials"in n.prototype,c={...E,signal:S,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:e?v:void 0};x=r&&new n(i,c);let l=await(r?w(x,E):w(i,c));const f=d&&("stream"===y||"response"===y);if(d&&(m||f&&C)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=l[e]}));const e=re.toFiniteNumber(l.headers.get("content-length")),[n,i]=m&&$e(e,He(ze(m),!0))||[];l=new o(en(l.body,65536,n,(()=>{i&&i(),C&&C()})),t)}y=y||"text";let O=await h[re.findKey(h,y)||"text"](l,t);return!f&&C&&C(),await new Promise(((e,n)=>{Me(e,n,{data:O,headers:De.from(l.headers),status:l.status,statusText:l.statusText,config:t,request:x})}))}catch(e){if(C&&C(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new se("Network Error",se.ERR_NETWORK,t,x),{cause:e.cause||e});throw se.from(e,e&&e.code,t,x)}}},ln=new Map,un=t=>{let e=t?t.env:{};const{fetch:n,Request:o,Response:i}=e,r=[o,i,n];let s,a,c=r.length,l=ln;for(;c--;)s=r[c],a=l.get(s),void 0===a&&l.set(s,a=c?new Map:cn(e)),l=a;return a};un();const dn={http:null,xhr:Xe,fetch:{get:un}};re.forEach(dn,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const hn=t=>`- ${t}`,pn=t=>re.isFunction(t)||null===t||!1===t;var fn=(t,e)=>{t=re.isArray(t)?t:[t];const{length:n}=t;let o,i;const r={};for(let s=0;s<n;s++){let n;if(o=t[s],i=o,!pn(o)&&(i=dn[(n=String(o)).toLowerCase()],void 0===i))throw new se(`Unknown adapter '${n}'`);if(i&&(re.isFunction(i)||(i=i.get(e))))break;r[n||"#"+s]=i}if(!i){const t=Object.entries(r).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));throw new se("There is no suitable adapter to dispatch the request "+(n?t.length>1?"since :\n"+t.map(hn).join("\n"):" "+hn(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i};function mn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new qe(null,t)}function gn(t){mn(t),t.headers=De.from(t.headers),t.data=Ie.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return fn(t.adapter||Ne.adapter,t)(t).then((function(e){return mn(t),e.data=Ie.call(t,t.transformResponse,e),e.headers=De.from(e.headers),e}),(function(e){return Be(e)||(mn(t),e&&e.response&&(e.response.data=Ie.call(t,t.transformResponse,e.response),e.response.headers=De.from(e.response.headers))),Promise.reject(e)}))}const yn="1.12.2",bn={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{bn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const vn={};bn.transitional=function(t,e,n){function o(t,e){return"[Axios v"+yn+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,i,r)=>{if(!1===t)throw new se(o(i," has been removed"+(e?" in "+e:"")),se.ERR_DEPRECATED);return e&&!vn[i]&&(vn[i]=!0,console.warn(o(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,i,r)}},bn.spelling=function(t){return(e,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};var En={assertOptions:function(t,e,n){if("object"!=typeof t)throw new se("options must be an object",se.ERR_BAD_OPTION_VALUE);const o=Object.keys(t);let i=o.length;for(;i-- >0;){const r=o[i],s=e[r];if(s){const e=t[r],n=void 0===e||s(e,r,t);if(!0!==n)throw new se("option "+r+" must be "+n,se.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new se("Unknown option "+r,se.ERR_BAD_OPTION)}},validators:bn};const wn=En.validators;class Sn{constructor(t){this.defaults=t||{},this.interceptors={request:new ve,response:new ve}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+n):t.stack=n}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Je(this.defaults,e);const{transitional:n,paramsSerializer:o,headers:i}=e;void 0!==n&&En.assertOptions(n,{silentJSONParsing:wn.transitional(wn.boolean),forcedJSONParsing:wn.transitional(wn.boolean),clarifyTimeoutError:wn.transitional(wn.boolean)},!1),null!=o&&(re.isFunction(o)?e.paramsSerializer={serialize:o}:En.assertOptions(o,{encode:wn.function,serialize:wn.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),En.assertOptions(e,{baseUrl:wn.spelling("baseURL"),withXsrfToken:wn.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let r=i&&re.merge(i.common,i[e.method]);i&&re.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=De.concat(r,i);const s=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let u,d=0;if(!a){const t=[gn.bind(this),void 0];for(t.unshift(...s),t.push(...c),u=t.length,l=Promise.resolve(e);d<u;)l=l.then(t[d++],t[d++]);return l}u=s.length;let h=e;for(;d<u;){const t=s[d++],e=s[d++];try{h=t(h)}catch(t){e.call(this,t);break}}try{l=gn.call(this,h)}catch(t){return Promise.reject(t)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(t){return be(We((t=Je(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}re.forEach(["delete","get","head","options"],(function(t){Sn.prototype[t]=function(e,n){return this.request(Je(n||{},{method:t,url:e,data:(n||{}).data}))}})),re.forEach(["post","put","patch"],(function(t){function e(e){return function(n,o,i){return this.request(Je(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:o}))}}Sn.prototype[t]=e(),Sn.prototype[t+"Form"]=e(!0)}));var xn=Sn;class Cn{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null})),this.promise.then=t=>{let e;const o=new Promise((t=>{n.subscribe(t),e=t})).then(t);return o.cancel=function(){n.unsubscribe(e)},o},t((function(t,o,i){n.reason||(n.reason=new qe(t,o,i),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;const e=new Cn((function(e){t=e}));return{token:e,cancel:t}}}var Tn=Cn;const On={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(On).forEach((([t,e])=>{On[e]=t}));var An=On;const _n=function t(e){const n=new xn(e),o=mt(xn.prototype.request,n);return re.extend(o,xn.prototype,n,{allOwnKeys:!0}),re.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return t(Je(e,n))},o}(Ne);_n.Axios=xn,_n.CanceledError=qe,_n.CancelToken=Tn,_n.isCancel=Be,_n.VERSION=yn,_n.toFormData=pe,_n.AxiosError=se,_n.Cancel=_n.CanceledError,_n.all=function(t){return Promise.all(t)},_n.spread=function(t){return function(e){return t.apply(null,e)}},_n.isAxiosError=function(t){return re.isObject(t)&&!0===t.isAxiosError},_n.mergeConfig=Je,_n.AxiosHeaders=De,_n.formToJSON=t=>_e(re.isHTMLForm(t)?new FormData(t):t),_n.getAdapter=fn,_n.HttpStatusCode=An,_n.default=_n;var Rn=_n;const{IdealPostcodesError:Nn}=lt,Ln=(t,e)=>{return{httpRequest:t,body:e.data,httpStatus:e.status||0,header:(n=e.headers,Object.keys(n).reduce(((t,e)=>{const o=n[e];return"string"==typeof o?t[e]=o:Array.isArray(o)&&(t[e]=o.join(",")),t}),{})),metadata:{response:e}};var n},Un=t=>{const e=new Nn({message:`[${t.name}] ${t.message}`,httpStatus:0,metadata:{axios:t}});return Promise.reject(e)},jn=()=>!0;class kn{constructor(){this.Axios=Rn.create({validateStatus:jn})}requestWithBody(t){const{body:e,method:n,timeout:o,url:i,header:r,query:s}=t;return this.Axios.request({url:i,method:n,headers:r,params:s,data:e,timeout:o}).then((e=>Ln(t,e))).catch(Un)}request(t){const{method:e,timeout:n,url:o,header:i,query:r}=t;return this.Axios.request({url:o,method:e,headers:i,params:r,timeout:n}).then((e=>Ln(t,e))).catch(Un)}http(t){return void 0!==t.body?this.requestWithBody(t):this.request(t)}}class Pn extends M{constructor(t){super({agent:new kn,...t})}}class Fn{constructor(t){this.prefix="!",this.client=t,this.cache={}}key(t){return`${this.prefix}${t.toLowerCase()}`}retrieve(t){return this.cache[this.key(t)]}store(t,e){return this.cache[this.key(t)]=e,e}clear(){this.cache={}}query(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.retrieve(t);if(n)return Promise.resolve(n);const o=ft(this.client,{query:{query:t,api_key:this.client.config.api_key,...e}}).then((e=>{const n=e.body.result.hits;return this.store(t,n),n}));return this.store(t,o),o}resolve(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"usa"===e?this.usaResolve(t,n):this.gbrResolve(t,n)}usaResolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(n=this.client,o=t.id,i={query:{api_key:this.client.config.api_key,...e}},dt({resource:pt,client:n,action:"usa"})(o,i)).then((t=>t.body.result));var n,o,i}gbrResolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(n=this.client,o=t.id,i={query:{api_key:this.client.config.api_key,...e}},dt({resource:pt,client:n,action:"gbr"})(o,i)).then((t=>t.body.result));var n,o,i}}const Dn=t=>"string"==typeof t,In=()=>!0,Bn=(t,e)=>Dn(t)?e.querySelector(t):t,qn=()=>window.document,Mn=t=>Dn(t)?qn().querySelector(t):null===t?qn():t,Hn=(t,e)=>{const n=t.getAttribute("style");return Object.keys(e).forEach((n=>t.style[n]=e[n])),n},$n=t=>(t.style.display="none",t),zn=t=>(t.style.display="",t),Gn=(t,e,n)=>{const o=t.querySelectorAll(e);for(let t=0;t<o.length;t++){const e=o[t],i=e.innerText;if(i&&i.trim()===n)return e}return null},Kn=t=>{const e=(t=String(t)).length;let n,o=-1,i="";const r=t.charCodeAt(0);for(;++o<e;)n=t.charCodeAt(o),i+=0!=n?n>=1&&n<=31||127==n||0==o&&n>=48&&n<=57||1==o&&n>=48&&n<=57&&45==r?"\\"+n.toString(16)+" ":(0!=o||1!=e||45!=n)&&(n>=128||45==n||95==n||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122)?t.charAt(o):"\\"+t.charAt(o):"�";return i},Wn=t=>void 0!==t.post_town,Vn=(t,e)=>t.dispatchEvent((t=>{let{event:e,bubbles:n=!0,cancelable:o=!0}=t;if("function"==typeof window.Event)return new window.Event(e,{bubbles:n,cancelable:o});const i=document.createEvent("Event");return i.initEvent(e,n,o),i})({event:e})),Jn=t=>null!==t&&(t instanceof HTMLSelectElement||"HTMLSelectElement"===t.constructor.name),Yn=t=>null!==t&&(t instanceof HTMLInputElement||"HTMLInputElement"===t.constructor.name),Xn=t=>null!==t&&(t instanceof HTMLTextAreaElement||"HTMLTextAreaElement"===t.constructor.name),Qn=t=>Yn(t)||Xn(t)||Jn(t),Zn=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t&&(Yn(t)||Xn(t))&&oo({e:t,value:e,skipTrigger:n})},to=(t,e)=>null!==e&&null!==t.querySelector(`[value="${e}"]`),eo=(t,e)=>{if(null===e)return[];const n=t.querySelectorAll("option");return Array.from(n).filter((t=>(t.textContent?t.textContent.replace(/[\n\r]/g,"").replace(/\s+/g," ").trim():"")===e))},no=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t.constructor.prototype,"value");if(void 0===n)return;if(void 0===n.set)return;n.set.call(t,e)},oo=t=>{null!==t.value&&((t=>{let{e:e,value:n,skipTrigger:o}=t;null!==n&&Jn(e)&&(no(e,n),o||Vn(e,"select"),Vn(e,"change"))})(t),(t=>{let{e:e,value:n,skipTrigger:o}=t;null!==n&&(Yn(e)||Xn(e))&&(no(e,n),o||Vn(e,"input"),Vn(e,"change"))})(t))},io="United Kingdom",ro="Isle of Man",so=t=>{const e=t.country;if("England"===e)return io;if("Scotland"===e)return io;if("Wales"===e)return io;if("Northern Ireland"===e)return io;if(e===ro)return ro;if(Wn(t)&&"Channel Islands"===e){if(/^GY/.test(t.postcode))return"Guernsey";if(/^JE/.test(t.postcode))return"Jersey"}return e};let ao={};"undefined"!=typeof window&&(window.idpcGlobal?ao=window.idpcGlobal:window.idpcGlobal=ao);const co=()=>ao,lo=t=>t.filter((t=>Dn(t)?!!t.trim():!!t)).join(", "),uo=(t,e)=>{if(t.length<=e)return[t,""];const n=t.split(" ");let o="",i="";for(let t=0;t<n.length;t++){const r=n[t];if(o.length+r.length>e){i=n.slice(t).join(" ");break}o+=`${r} `}return[o.trim(),i.trim()]},ho=(t,e)=>0===e.length?t:`${t}, ${e}`,po=(t,e,n)=>{const{line_1:o,line_2:i}=e,r="line_3"in e?e.line_3:"";return n.maxLineOne||n.maxLineTwo||n.maxLineThree?((t,e)=>{const{lineCount:n,maxLineOne:o,maxLineTwo:i,maxLineThree:r}=e,s=["","",""],a=[...t];if(o){const[t,e]=uo(a[0],o);if(s[0]=t,e&&(a[1]=ho(e,a[1])),1===n)return s}else if(s[0]=a[0],1===n)return[lo(a),"",""];if(i){const[t,e]=uo(a[1],i);if(s[1]=t,e&&(a[2]=ho(e,a[2])),2===n)return s}else if(s[1]=a[1],2===n)return[s[0],lo(a.slice(1)),""];if(r){const[t,e]=uo(a[2],r);s[2]=t,e&&(a[3]=ho(e,a[3]))}else s[2]=a[2];return s})([o,i,r],{lineCount:t,...n}):3===t?[o,i,r]:2===t?[o,lo([i,r]),""]:[lo([o,i,r]),"",""]},fo=(t,e)=>{const n=t[e];return"number"==typeof n?n.toString():void 0===n?"":n},mo=(t,e)=>{const n={};let o;for(o in t){const i=t[o];if(void 0===i)continue;const r=Bn(i,e);Qn(r)&&(n[o]=r)}return n},go=(t,e)=>{const n={};let o;for(o in t){if(!t.hasOwnProperty(o))continue;const i=t[o],r=Bn(`[name="${i}"]`,e);if(r){n[o]=r;continue}const s=Bn(`[aria-name="${i}"]`,e);s&&(n[o]=s)}return n},yo=(t,e)=>{const n={};if(void 0===t)return t;let o;for(o in t){if(!t.hasOwnProperty(o))continue;const i=t[o];if(!i)continue;const r=Gn(e,"label",i),s=Bn(r,e);if(!s)continue;const a=s.getAttribute("for");if(a){const t=e.querySelector(`#${Kn(a)}`);if(t){n[o]=t;continue}}const c=s.querySelector("input");c&&(n[o]=c)}return n},bo=["country","country_iso_2","country_iso"],vo=t=>{const{config:e}=t,n={...mo((o=t).outputFields||{},o.config.scope),...go(o.names||{},o.config.scope),...yo(o.labels||{},o.config.scope)};var o;void 0===e.lines&&(e.lines=(t=>{const{line_2:e,line_3:n}=t;return e?n?3:2:1})(n));const i=((t,e)=>{Wn(t)&&e.removeOrganisation&&wo(t);const[n,o,i]=po(e.lines||3,t,e);return t.line_1=n,t.line_2=o,Wn(t)&&(t.line_3=i),t})({...t.address},e),{scope:r,populateCounty:s}=e,a=[...bo];Wn(i)&&(e.removeOrganisation&&wo(i),!1===s&&a.push("county")),((t,e)=>{if(t){if(Jn(t)){const n=so(e);if(to(t,n))return void oo({e:t,value:n});if(to(t,e.country_iso_2))return void oo({e:t,value:e.country_iso_2});if(to(t,e.country_iso))return void oo({e:t,value:e.country_iso});let o=eo(t,n);if(o.length>0)return void oo({e:t,value:o[0].value||""});if(o=eo(t,e.country_iso_2),o.length>0)return void oo({e:t,value:o[0].value||""});if(o=eo(t,e.country_iso),o.length>0)return void oo({e:t,value:o[0].value||""})}if(Yn(t)){const n=so(e);oo({e:t,value:n})}}})(Bn(n.country||null,r),i);const c=Bn(n.country_iso_2||null,r);if(Jn(c))if(to(c,i.country_iso_2))oo({e:c,value:i.country_iso_2});else{let t=eo(c,i.country_iso_2);t.length>0?oo({e:c,value:t[0].value||""}):(t=eo(c,so(i)),t.length>0&&oo({e:c,value:t[0].value||""}))}Yn(c)&&Zn(c,i.country_iso_2||"");const l=Bn(n.country_iso||null,r);if(Jn(l))if(to(l,i.country_iso))oo({e:l,value:i.country_iso});else{let t=eo(l,i.country_iso);t.length>0?oo({e:l,value:t[0].value||""}):(t=eo(l,so(i)),t.length>0&&oo({e:l,value:t[0].value||""}))}Yn(l)&&Zn(l,i.country_iso||"");const u=Bn(So(n),r),d=xo(i),h=Co(i);if(Jn(u))if(to(u,d))oo({e:u,value:d});else if(to(u,h||""))oo({e:u,value:h||""});else{let t=eo(u,h);t.length>0?oo({e:u,value:t[0].value||""}):(t=eo(u,d),t&&oo({e:u,value:t[0].value||""}))}let p;for(p in Yn(u)&&Zn(u,d),n)if(!a.includes(p))if(p.startsWith("native."))Eo(p,n,i,r);else if(void 0!==i[p]&&n.hasOwnProperty(p)){const t=n[p];if(!t)continue;Zn(Bn(t,r),fo(i,p))}},Eo=(t,e,n,o)=>{const i=t.replace("native.",""),r=n.native;if(void 0===r)return;if(void 0!==r[i]&&e.hasOwnProperty(t)){const n=e[t];if(!n)return;Zn(Bn(n,o),fo(r,i))}},wo=t=>(0===t.organisation_name.length||0===t.line_2.length&&0===t.line_3.length||t.line_1===t.organisation_name&&(t.line_1=t.line_2,t.line_2=t.line_3,t.line_3=""),t),So=t=>(t=>t.hasOwnProperty("state_abbreviation"))(t)?t.state_abbreviation||null:t.county_code||null,xo=t=>Wn(t)?t.county_code:t.state_abbreviation,Co=t=>Wn(t)?t.county:t.state,To={13:"Enter",38:"ArrowUp",40:"ArrowDown",36:"Home",35:"End",27:"Escape",8:"Backspace"},Oo=["Enter","ArrowUp","ArrowDown","Home","End","Escape","Backspace"],Ao=t=>{return t.keyCode?To[t.keyCode]||null:(e=t.key,-1!==Oo.indexOf(e)?t.key:null);var e};function _o(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}var Ro;!function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"}(Ro||(Ro={}));var No={type:"xstate.init"};function Lo(t){return void 0===t?[]:[].concat(t)}function Uo(t,e){return"string"==typeof(t="string"==typeof t&&e&&e[t]?e[t]:t)?{type:t}:"function"==typeof t?{type:t.name,exec:t}:t}function jo(t){return function(e){return t===e}}function ko(t){return"string"==typeof t?{type:t}:t}function Po(t,e){return{value:t,context:e,actions:[],changed:!1,matches:jo(t)}}function Fo(t,e,n){var o=e,i=!1;return[t.filter((function(t){if("xstate.assign"===t.type){i=!0;var e=Object.assign({},o);return"function"==typeof t.assignment?e=t.assignment(o,n):Object.keys(t.assignment).forEach((function(i){e[i]="function"==typeof t.assignment[i]?t.assignment[i](o,n):t.assignment[i]})),o=e,!1}return!0})),o,i]}function Do(t,e){void 0===e&&(e={});var n=_o(Fo(Lo(t.states[t.initial].entry).map((function(t){return Uo(t,e.actions)})),t.context,No),2),o=n[0],i=n[1],r={config:t,_options:e,initialState:{value:t.initial,actions:o,context:i,matches:jo(t.initial)},transition:function(e,n){var o,i,s="string"==typeof e?{value:e,context:t.context}:e,a=s.value,c=s.context,l=ko(n),u=t.states[a];if(u.on){var d=Lo(u.on[l.type]);"*"in u.on&&d.push.apply(d,function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))}([],_o(Lo(u.on["*"])),!1));try{for(var h=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(d),p=h.next();!p.done;p=h.next()){var f=p.value;if(void 0===f)return Po(a,c);var m="string"==typeof f?{target:f}:f,g=m.target,y=m.actions,b=void 0===y?[]:y,v=m.cond,E=void 0===v?function(){return!0}:v,w=void 0===g,S=null!=g?g:a,x=t.states[S];if(E(c,l)){var C=_o(Fo((w?Lo(b):[].concat(u.exit,b,x.entry).filter((function(t){return t}))).map((function(t){return Uo(t,r._options.actions)})),c,l),3),T=C[0],O=C[1],A=C[2],_=null!=g?g:a;return{value:_,context:O,actions:T,changed:g!==a||T.length>0||A,matches:jo(_)}}}}catch(t){o={error:t}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(o)throw o.error}}}return Po(a,c)}};return r}var Io=function(t,e){return t.actions.forEach((function(n){var o=n.exec;return o&&o(t.context,e)}))};const Bo=t=>{let{c:e}=t;const n=Do({initial:"closed",states:{closed:{entry:["close"],exit:["open"],on:{COUNTRY_CHANGE_EVENT:{actions:["updateContextWithCountry"]},AWAKE:[{target:"suggesting",cond:()=>e.suggestions.length>0},{target:"notifying"}]}},notifying:{entry:["renderNotice"],exit:["clearAnnouncement"],on:{CLOSE:"closed",SUGGEST:{target:"suggesting",actions:["updateSuggestions"]},NOTIFY:{target:"notifying",actions:["updateMessage"]},INPUT:{actions:"input"},CHANGE_COUNTRY:{target:"suggesting_country"}}},suggesting_country:{entry:["clearInput","renderContexts","gotoCurrent","expand","addCountryHint"],exit:["resetCurrent","gotoCurrent","contract","clearHint","clearInput"],on:{CLOSE:"closed",NOTIFY:{target:"notifying",actions:["updateMessage"]},NEXT:{actions:["next","gotoCurrent"]},PREVIOUS:{actions:["previous","gotoCurrent"]},RESET:{actions:["resetCurrent","gotoCurrent"]},INPUT:{actions:["countryInput"]},SELECT_COUNTRY:{target:"notifying",actions:["selectCountry"]}}},suggesting:{entry:["renderSuggestions","gotoCurrent","expand","addHint"],exit:["resetCurrent","gotoCurrent","contract","clearHint"],on:{CLOSE:"closed",SUGGEST:{target:"suggesting",actions:["updateSuggestions"]},NOTIFY:{target:"notifying",actions:["updateMessage"]},INPUT:{actions:"input"},CHANGE_COUNTRY:{target:"suggesting_country"},NEXT:{actions:["next","gotoCurrent"]},PREVIOUS:{actions:["previous","gotoCurrent"]},RESET:{actions:["resetCurrent","gotoCurrent"]},SELECT_ADDRESS:{target:"closed",actions:["selectAddress"]}}}}},{actions:{updateContextWithCountry:(t,n)=>{"COUNTRY_CHANGE_EVENT"===n.type&&n.contextDetails&&(e.applyContext(n.contextDetails),e.suggestions=[],e.cache.clear())},addHint:()=>{e.setPlaceholder(e.options.msgPlaceholder)},addCountryHint:()=>{e.setPlaceholder(e.options.msgPlaceholderCountry)},clearHint:()=>{e.unsetPlaceholder()},clearInput:()=>{e.clearInput()},gotoCurrent:()=>{e.goToCurrent()},resetCurrent:()=>{e.current=-1},input:(t,n)=>{"INPUT"===n.type&&e.retrieveSuggestions(n.event)},countryInput:()=>{e.renderContexts()},clearAnnouncement:()=>{e.announce("")},renderContexts:(t,n)=>{"CHANGE_COUNTRY"===n.type&&e.renderContexts()},renderSuggestions:(t,n)=>{"SUGGEST"===n.type&&e.renderSuggestions()},updateSuggestions:(t,n)=>{"SUGGEST"===n.type&&e.updateSuggestions(n.suggestions)},close:(t,n)=>{if("CLOSE"===n.type)return e.close(n.reason);e.close()},open:()=>{e.open()},expand:()=>{e.ariaExpand()},contract:()=>{e.ariaContract()},updateMessage:(t,n)=>{"NOTIFY"===n.type&&(e.notification=n.notification)},renderNotice:()=>{e.renderNotice()},next:()=>{e.next()},previous:()=>{e.previous()},selectCountry:(t,n)=>{if("SELECT_COUNTRY"!==n.type)return;const o=n.contextDetails;o&&(e.applyContext(o),e.notification=`Country switched to ${o.description} ${o.emoji}`)},selectAddress:(t,n)=>{if("SELECT_ADDRESS"!==n.type)return;const o=n.suggestion;o&&e.applySuggestion(o)}}});return function(t){var e=t.initialState,n=Ro.NotStarted,o=new Set,i={_machine:t,send:function(i){n===Ro.Running&&(e=t.transition(e,i),Io(e,ko(i)),o.forEach((function(t){return t(e)})))},subscribe:function(t){return o.add(t),t(e),{unsubscribe:function(){return o.delete(t)}}},start:function(o){if(o){var r="object"==typeof o?o:{context:t.config.context,value:o};e={value:r.value,actions:[],context:r.context,matches:jo(r.value)}}else e=t.initialState;return n=Ro.Running,Io(e,No),i},stop:function(){return n=Ro.Stopped,o.clear(),i},get state(){return e},get status(){return n}};return i}(n)},qo=()=>{},Mo={outputScope:null,apiKey:"",checkKey:!0,aria:"1.0",titleizePostTown:!0,format:"gbr",outputFields:{},names:{},labels:{},removeOrganisation:!1,injectStyle:!0,inputField:"",autocomplete:"none",populateCounty:!0,populateOrganisation:!0,queryOptions:{},resolveOptions:{},alignToInput:!0,offset:2,hideToolbar:!1,detectCountry:!0,defaultCountry:"GBR",restrictCountries:[],contexts:{GBR:{iso_2:"GB",iso_3:"GBR",emoji:"🇬🇧",rgeo:!0,description:"United Kingdom"},USA:{iso_2:"US",iso_3:"USA",emoji:"🇺🇸",rgeo:!1,description:"United States"}},msgFallback:"Please enter your address manually",msgInitial:"Start typing to find address",msgNoMatch:"No matches found",msgList:"Select your address",msgCountryToggle:"Change Country",msgPlaceholder:"Type the first line or postal code of your address",msgPlaceholderCountry:"Select your country",messageClass:"idpc_error",containerClass:"idpc_autocomplete",mainClass:"idpc_af",listClass:"idpc_ul",toolbarClass:"idpc_toolbar",countryToggleClass:"idpc_country",mainStyle:{},inputStyle:{},listStyle:{},liStyle:{},containerStyle:{},unhide:null,unhideClass:"idpc-unhide",msgUnhide:"Enter address manually",hide:[],fixed:!1,onOpen:qo,onSelect:qo,onBlur:qo,onClose:qo,onFocus:qo,onInput:qo,onLoaded:qo,onSearchError:qo,onSuggestionError:qo,onMounted:qo,onRemove:qo,onSuggestionsRetrieved:qo,onAddressSelected:qo,onAddressRetrieved:qo,onAddressPopulated:qo,onFailedCheck:qo,onMouseDown:qo,onKeyDown:qo,onUnhide:qo,onCountrySelected:qo,onContextChange:qo};class Ho{constructor(t){var e;let n;if(this.options={scope:window.document,document:window.document,...Mo,...t},t.inputField||(this.options.inputField=this.options.outputFields.line_1||""),!0===this.options.autocomplete&&(this.options.autocomplete=Mo.autocomplete),this.scope=Mn(this.options.scope),this.document=(e=this.scope)instanceof Document||"HTMLDocument"===e.constructor.name?e:e.ownerDocument?e.ownerDocument:qn(),this.outputScope=Jo(this.scope,this.options.outputScope,(()=>this.scope)),this.context=this.options.defaultCountry,this.notification=this.options.msgInitial,this.current=-1,this.suggestions=[],this.contextSuggestions=[],this.updateContexts(this.options.contexts),this.client=new Pn({...this.options,api_key:this.options.apiKey}),this.cache=new Fn(this.client),this.retrieveSuggestions=D((t=>{this.options.onInput.call(this,t);const e=this.query();return 0===e.trim().length?(this.setMessage(this.options.msgInitial),Promise.resolve(this)):this.cache.query(e,{...this.options.queryOptions,context:this.context}).then((t=>(this.options.onSuggestionsRetrieved.call(this,t),this.setSuggestions(t,e)))).catch((t=>(this.query()===e&&this.setMessage(this.options.msgFallback),this.options.onSuggestionError.call(this,t),this)))}),100,{leading:!0,trailing:!0,maxWait:100}),this.ids=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"idpc_";return()=>{const e=co();return e.idGen||(e.idGen={}),void 0===e.idGen[t]&&(e.idGen[t]=0),e.idGen[t]+=1,`${t}${e.idGen[t]}`}}("idpcaf"),this.container=this.options.document.createElement("div"),this.container.className=this.options.containerClass,this.container.id=this.ids(),this.container.setAttribute("aria-haspopup","listbox"),this.message=this.options.document.createElement("li"),this.message.textContent=this.options.msgInitial,this.message.className=this.options.messageClass,this.countryToggle=this.options.document.createElement("span"),this.countryToggle.className=this.options.countryToggleClass,this.countryToggle.addEventListener("mousedown",Ko(this)),this.countryIcon=this.options.document.createElement("span"),this.countryIcon.className="idpc_icon",this.countryIcon.innerText=this.currentContext().emoji,this.countryMessage=this.options.document.createElement("span"),this.countryMessage.innerText="Select Country",this.countryMessage.className="idpc_country",this.countryToggle.appendChild(this.countryMessage),this.countryToggle.appendChild(this.countryIcon),this.toolbar=this.options.document.createElement("div"),this.toolbar.className=this.options.toolbarClass,this.toolbar.appendChild(this.countryToggle),this.options.hideToolbar&&$n(this.toolbar),this.list=this.options.document.createElement("ul"),this.list.className=this.options.listClass,this.list.id=this.ids(),this.list.setAttribute("aria-label",this.options.msgList),this.list.setAttribute("role","listbox"),this.mainComponent=this.options.document.createElement("div"),this.mainComponent.appendChild(this.list),this.mainComponent.appendChild(this.toolbar),this.mainComponent.className=this.options.mainClass,$n(this.mainComponent),this.unhideEvent=this.unhideFields.bind(this),this.unhide=this.createUnhide(),n=Dn(this.options.inputField)?this.scope.querySelector(this.options.inputField):this.options.inputField,!n)throw new Error("Address Finder: Unable to find valid input field");this.input=n,this.input.setAttribute("autocomplete",this.options.autocomplete),this.input.setAttribute("aria-autocomplete","list"),this.input.setAttribute("aria-controls",this.list.id),this.input.setAttribute("aria-autocomplete","list"),this.input.setAttribute("aria-activedescendant",""),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.input.id||(this.input.id=this.ids());const o=this.scope.querySelector(this.options.outputFields.country);this.countryInput=o,this.ariaAnchor().setAttribute("role","combobox"),this.ariaAnchor().setAttribute("aria-expanded","false"),this.ariaAnchor().setAttribute("aria-owns",this.list.id),this.placeholderCache=this.input.placeholder,this.inputListener=Go(this),this.blurListener=$o(this),this.focusListener=zo(this),this.keydownListener=Wo(this),this.countryListener=Vo(this);const{container:i,announce:r}=(t=>{let{document:e,idA:n,idB:o}=t;const i=e.createElement("div");(t=>{t.style.border="0px",t.style.padding="0px",t.style.clipPath="rect(0px,0px,0px,0px)",t.style.height="1px",t.style.marginBottom="-1px",t.style.marginRight="-1px",t.style.overflow="hidden",t.style.position="absolute",t.style.whiteSpace="nowrap",t.style.width="1px"})(i);const r=I(e.createElement("div"),n),s=I(e.createElement("div"),o);i.appendChild(r),i.appendChild(s);let a=!0;const c=D((t=>{const e=a?r:s,n=a?s:r;a=!a,e.textContent=t,n.textContent=""}),1500,{});return{container:i,announce:c}})({idA:this.ids(),idB:this.ids(),document:this.options.document});this.announce=r,this.alerts=i,this.inputStyle=Hn(this.input,this.options.inputStyle),Hn(this.container,this.options.containerStyle),Hn(this.list,this.options.listStyle);const s=(t=>{let e;const n=t.input;if(!1===t.options.alignToInput)return{};try{const o=t.options.document.defaultView;if(!o)return{};e=o.getComputedStyle(n).marginBottom}catch(t){return{}}if(!e)return{};const o=parseInt(e.replace("px",""),10);return isNaN(o)||0===o?{}:{marginTop:-1*o+t.options.offset+"px"}})(this);Hn(this.mainComponent,{...s,...this.options.mainStyle}),this.fsm=Bo({c:this}),this.init()}setPlaceholder(t){this.input.placeholder=t}unsetPlaceholder(){if(void 0===this.placeholderCache)return this.input.removeAttribute("placeholder");this.input.placeholder=this.placeholderCache}currentContext(){const t=this.options.contexts[this.context];if(t)return t;const e=Object.keys(this.options.contexts)[0];return this.options.contexts[e]}load(){this.attach(),(t=>{const e=t.options.injectStyle;if(!e)return;const n=co();if(n.afstyle||(n.afstyle={}),Dn(e)&&!n.afstyle[e]){n.afstyle[e]=!0;const o=((t,e)=>{const n=e.createElement("link");return n.type="text/css",n.rel="stylesheet",n.href=t,n})(e,t.document);return t.document.head.appendChild(o),o}!0!==e||n.afstyle[""]||(n.afstyle[""]=!0,((t,e)=>{const n=e.createElement("style");n.appendChild(e.createTextNode(t)),e.head.appendChild(n)})(".idpc_af.hidden{display:none}div.idpc_autocomplete{position:relative;margin:0!important;padding:0;border:0;color:#28282b;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}div.idpc_autocomplete>input{display:block}div.idpc_af{position:absolute;left:0;z-index:2000;min-width:100%;box-sizing:border-box;border-radius:3px;background:#fff;border:1px solid rgba(0,0,0,.3);box-shadow:.05em .2em .6em rgba(0,0,0,.2);text-shadow:none;padding:0;margin-top:2px}div.idpc_af>ul{list-style:none;padding:0;max-height:250px;overflow-y:scroll;margin:0!important}div.idpc_af>ul>li{position:relative;padding:.2em .5em;cursor:pointer;margin:0!important}div.idpc_toolbar{padding:.3em .5em;border-top:1px solid rgba(0,0,0,.3);text-align:right}div.idpc_af>ul>li:hover{background-color:#e5e4e2}div.idpc_af>ul>li.idpc_error{padding:.5em;text-align:center;cursor:default!important}div.idpc_af>ul>li.idpc_error:hover{background:#fff;cursor:default!important}div.idpc_af>ul>li[aria-selected=true]{background-color:#e5e4e2;z-index:3000}div.idpc_autocomplete>.idpc-unhide{font-size:.9em;text-decoration:underline;cursor:pointer}div.idpc_af>div>span{padding:.2em .5em;border-radius:3px;cursor:pointer;font-size:110%}span.idpc_icon{font-size:1.2em;line-height:1em;vertical-align:middle}div.idpc_toolbar>span span.idpc_country{margin-right:.3em;max-width:0;font-size:.9em;-webkit-transition:max-width .5s ease-out;transition:max-width .5s ease-out;display:inline-block;vertical-align:middle;white-space:nowrap;overflow:hidden}div.idpc_autocomplete>div>div>span:hover span.idpc_country{max-width:7em}div.idpc_autocomplete>div>div>span:hover{background-color:#e5e4e2;-webkit-transition:background-color .5s ease;-ms-transition:background-color .5s ease;transition:background-color .5s ease}",t.document))})(this),this.options.fixed&&Yo(this.mainComponent,this.container,this.document),this.options.onLoaded.call(this),this.list.parentNode?.addEventListener("mousedown",(t=>t.preventDefault()))}init(){return new Promise((t=>{if(!this.options.checkKey)return this.load(),void t();ht({client:this.client,api_key:this.options.apiKey}).then((e=>{if(!e.available)throw new Error("Key currently not usable");this.updateContexts(B(e.contexts));const n=this.options.contexts[e.context];this.options.detectCountry&&n?this.applyContext(n,!1):this.applyContext(this.currentContext(),!1),this.load(),t()})).catch((e=>{this.options.onFailedCheck.call(this,e),t()}))}))}updateContexts(t){this.contextSuggestions=((t,e)=>{const n=[],o=Object.keys(t);for(const i of o)e.length>0&&!e.some((t=>t===i))||n.push(t[i]);return n.sort(((t,e)=>t.description.localeCompare(e.description))),n})(t,this.options.restrictCountries),this.options.contexts=t}filteredContexts(){const t=this.query();if(0===t.trim().length)return this.contextSuggestions;const e=t.toLowerCase().trim().replace(/\s+/g," "),n=new RegExp("^"+e);return this.contextSuggestions.filter((t=>!!n.test(t.description.toLowerCase())||(t.iso_2.toLowerCase()===e||t.iso_3.toLowerCase()===e)))}renderContexts(){this.list.innerHTML="",this.filteredContexts().forEach(((t,e)=>{const{description:n}=t,o=this.options.document.createElement("li");o.textContent=n,o.setAttribute("aria-selected","false"),o.setAttribute("tabindex","-1"),o.setAttribute("aria-posinset",`${e+1}`),o.setAttribute("aria-setsize",this.contextSuggestions.length.toString()),o.setAttribute("role","option"),Hn(o,this.options.liStyle),o.addEventListener("mousedown",(e=>{e.preventDefault(),this.options.onMouseDown.call(this,e),this.fsm.send({type:"SELECT_COUNTRY",contextDetails:t})})),o.id=`${this.list.id}_${e}`,this.list.appendChild(o)})),this.announce(`${this.contextSuggestions.length} countries available`)}renderSuggestions(){this.list.innerHTML="";const t=this.suggestions;t.forEach(((e,n)=>{const o=this.options.document.createElement("li");o.textContent=e.suggestion,o.setAttribute("aria-selected","false"),o.setAttribute("tabindex","-1"),o.setAttribute("title",e.suggestion),o.setAttribute("aria-posinset",`${n+1}`),o.setAttribute("aria-setsize",t.length.toString()),o.setAttribute("role","option"),Hn(o,this.options.liStyle),o.addEventListener("mousedown",(t=>{t.preventDefault(),this.options.onMouseDown.call(this,t),this.fsm.send({type:"SELECT_ADDRESS",suggestion:e})})),o.id=`${this.list.id}_${n}`,this.list.appendChild(o)})),this.announce(`${t.length} addresses available`)}goToCurrent(){const t=this.list.children;this.input.setAttribute("aria-activedescendant","");for(let e=0;e<t.length;e+=1)e===this.current?(this.input.setAttribute("aria-activedescendant",t[e].id),t[e].setAttribute("aria-selected","true"),this.goto(e)):t[e].setAttribute("aria-selected","false")}ariaExpand(){this.ariaAnchor().setAttribute("aria-expanded","true")}ariaContract(){this.ariaAnchor().setAttribute("aria-expanded","false")}applySuggestion(t){return this.options.onSelect.call(this,t),this.options.onAddressSelected.call(this,t),this.announce(`The address ${t.suggestion} has been applied to this form`),this.cache.resolve(t,this.options.format,this.options.resolveOptions).then((t=>{if(null===t)throw"Unable to retrieve address";return this.options.onAddressRetrieved.call(this,t),this.populateAddress(t),this})).catch((t=>(this.open(),this.setMessage(this.options.msgFallback),this.options.onSearchError.call(this,t),t)))}populateAddress(t){this.unhideFields(),vo({address:t,config:{...this.options,scope:this.outputScope},outputFields:this.options.outputFields,names:this.options.names,labels:this.options.labels}),this.options.onAddressPopulated.call(this,t)}setQueryOptions(t){this.cache.clear(),this.options.queryOptions=t}setResolveOptions(t){this.cache.clear(),this.options.resolveOptions=t}attach(){if(this.fsm.status===Ro.Running)return this;this.input.addEventListener("input",this.inputListener),this.input.addEventListener("blur",this.blurListener),this.input.addEventListener("focus",this.focusListener),this.input.addEventListener("keydown",this.keydownListener),this.countryInput&&this.countryInput.addEventListener("change",this.countryListener);const t=this.input.parentNode;return t&&(t.insertBefore(this.container,this.input),this.container.appendChild(this.input),this.container.appendChild(this.mainComponent),this.container.appendChild(this.alerts),this.options.hide.length>0&&null==this.options.unhide&&this.container.appendChild(this.unhide)),this.fsm.start(),this.options.onMounted.call(this),this.hideFields(),this}detach(){if(this.fsm.status!==Ro.Running)return this;this.input.removeEventListener("input",this.inputListener),this.input.removeEventListener("blur",this.blurListener),this.input.removeEventListener("focus",this.focusListener),this.input.removeEventListener("keydown",this.keydownListener),this.countryInput&&this.countryInput.removeEventListener("change",this.countryListener),this.container.removeChild(this.mainComponent),this.container.removeChild(this.alerts);const t=this.container.parentNode;var e,n;return t&&(t.insertBefore(this.input,this.container),t.removeChild(this.container)),this.unmountUnhide(),this.unhideFields(),this.fsm.stop(),e=this.input,n=this.inputStyle,e.setAttribute("style",n||""),this.options.onRemove.call(this),this.unsetPlaceholder(),this}setMessage(t){return this.fsm.send({type:"NOTIFY",notification:t}),this}ariaAnchor(){return"1.0"===this.options.aria?this.input:this.container}query(){return this.input.value}clearInput(){Zn(this.input,"")}setSuggestions(t,e){return e!==this.query()?this:0===t.length?this.setMessage(this.options.msgNoMatch):(this.fsm.send({type:"SUGGEST",suggestions:t}),this)}close(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"blur";$n(this.mainComponent),"esc"===t&&Zn(this.input,""),this.options.onClose.call(this,t)}updateSuggestions(t){this.suggestions=t,this.current=-1}applyContext(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=t.iso_3;this.context=n,this.cache.clear(),this.countryIcon.innerText=t.emoji,e&&this.announce(`Country switched to ${t.description}`),this.options.onContextChange.call(this,n)}renderNotice(){this.list.innerHTML="",this.input.setAttribute("aria-activedescendant",""),this.message.textContent=this.notification,this.announce(this.notification),this.list.appendChild(this.message)}open(){zn(this.mainComponent),this.options.onOpen.call(this)}next(){return this.current+1>this.list.children.length-1?this.current=0:this.current+=1,this}previous(){return this.current-1<0?this.current=this.list.children.length-1:this.current+=-1,this}scrollToView(t){const e=t.offsetTop,n=this.list.scrollTop;e<n&&(this.list.scrollTop=e);const o=this.list.clientHeight,i=t.clientHeight;return e+i>n+o&&(this.list.scrollTop=e-o+i),this}goto(t){const e=this.list.children,n=e[t];return t>-1&&e.length>0?this.scrollToView(n):this.scrollToView(e[0]),this}opened(){return!this.closed()}closed(){return this.fsm.state.matches("closed")}createUnhide(){const t=Jo(this.scope,this.options.unhide,(()=>{const t=this.options.document.createElement("p");return t.innerText=this.options.msgUnhide,t.setAttribute("role","button"),t.setAttribute("tabindex","0"),this.options.unhideClass&&(t.className=this.options.unhideClass),t}));return t.addEventListener("click",this.unhideEvent),t}unmountUnhide(){var t;this.unhide.removeEventListener("click",this.unhideEvent),null==this.options.unhide&&this.options.hide.length&&(null!==(t=this.unhide)&&null!==t.parentNode&&t.parentNode.removeChild(t))}hiddenFields(){return this.options.hide.map((t=>{return Dn(t)?(e=this.options.scope,(n=t)?e.querySelector(n):null):t;var e,n})).filter((t=>null!==t))}hideFields(){this.hiddenFields().forEach($n)}unhideFields(){this.hiddenFields().forEach(zn),this.options.onUnhide.call(this)}}const $o=t=>function(){t.options.onBlur.call(t),t.fsm.send({type:"CLOSE",reason:"blur"})},zo=t=>function(e){t.options.onFocus.call(t),t.fsm.send("AWAKE")},Go=t=>function(e){if(":c"===t.query().toLowerCase())return Zn(t.input,""),t.fsm.send({type:"CHANGE_COUNTRY"});t.fsm.send({type:"INPUT",event:e})},Ko=t=>function(e){e.preventDefault(),t.fsm.send({type:"CHANGE_COUNTRY"})},Wo=t=>function(e){const n=Ao(e);if("Enter"===n&&e.preventDefault(),t.options.onKeyDown.call(t,e),t.closed())return t.fsm.send("AWAKE");if(t.fsm.state.matches("suggesting_country")){if("Enter"===n){const e=t.filteredContexts()[t.current];e&&t.fsm.send({type:"SELECT_COUNTRY",contextDetails:e})}"Backspace"===n&&t.fsm.send({type:"INPUT",event:e}),"ArrowUp"===n&&(e.preventDefault(),t.fsm.send("PREVIOUS")),"ArrowDown"===n&&(e.preventDefault(),t.fsm.send("NEXT"))}if(t.fsm.state.matches("suggesting")){if("Enter"===n){const e=t.suggestions[t.current];e&&t.fsm.send({type:"SELECT_ADDRESS",suggestion:e})}"Backspace"===n&&t.fsm.send({type:"INPUT",event:e}),"ArrowUp"===n&&(e.preventDefault(),t.fsm.send("PREVIOUS")),"ArrowDown"===n&&(e.preventDefault(),t.fsm.send("NEXT"))}"Escape"===n&&t.fsm.send({type:"CLOSE",reason:"esc"}),"Home"===n&&t.fsm.send({type:"RESET"}),"End"===n&&t.fsm.send({type:"RESET"})},Vo=t=>function(e){if(null===e.target)return;const n=e.target;if(!n)return;let o=Xo(n.value,t.options.contexts);t.fsm.send({type:"COUNTRY_CHANGE_EVENT",contextDetails:o})},Jo=(t,e,n)=>Dn(e)?t.querySelector(e):n&&null===e?n():e,Yo=(t,e,n)=>{const o=(t,e)=>{if(null===t)return;const n=t.getBoundingClientRect();e.style.minWidth=`${Math.round(n.width)}px`},i=e.parentElement;t.style.position="fixed",t.style.left="auto",o(i,t),null!==n.defaultView&&n.defaultView.addEventListener("resize",(()=>{o(i,t)}))},Xo=(t,e)=>{const n=t.toUpperCase();for(const t of Object.values(e)){if(t.iso_3===n)return t;if(t.iso_2===n)return t;if(t.description.toUpperCase()===n)return t}},Qo=t=>{const e=new Ho(t);return Zo.push(e),e},Zo=[],ti=()=>!0,ei=(t,e)=>{const n=Mn(t.scope||null).querySelectorAll(t.anchor||t.inputField||(t.outputFields||{}).line_1);return(o=n,Array.prototype.slice.call(o)).filter((t=>!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"idpc";return"true"===t.getAttribute(e)}(t,e)));var o},ni=1e3,oi=t=>function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:In,o=t;const i=e.toUpperCase();for(;"HTML"!==o.tagName;){if(o.tagName===i&&n(o))return o;if(null===o.parentNode)return null;o=o.parentNode}return null}(t,"FORM"),ii={setup:Qo,controllers:Zo,Controller:Ho,defaults:Mo,watch:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new Pn({...Mo,...t,api_key:t.apiKey}),{pageTest:o=ti}=e;return o()?ht({client:n}).then((n=>{if(!n.available)return null;const{getScope:i=oi,interval:r=ni,anchor:s,onBind:a=qo,onAnchorFound:c=qo,onBindAttempt:l=qo,immediate:u=!0,marker:d="idpc"}=e,h=()=>{l({config:t,options:e}),ei({anchor:s,...t},d).forEach((e=>{const o=i(e);if(!o)return;const r=B(n.contexts),s={scope:o,...t,checkKey:!1,contexts:r};c({anchor:e,scope:o,config:s});const l=Qo(s),u=l.options.contexts[n.context];l.options.detectCountry&&u?l.applyContext(u,!1):l.applyContext(l.currentContext(),!1),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"idpc";t.setAttribute(e,"true")}(e,d),a(l)}))},{start:p,stop:f}=(t=>{let{pageTest:e,bind:n,interval:o=1e3}=t,i=null;const r=()=>{null!==i&&(window.clearInterval(i),i=null)};return{start:t=>e()?(i=window.setInterval((()=>{try{n(t)}catch(t){r(),console.log(t)}}),o),i):null,stop:r}})({bind:h,pageTest:o,interval:r});return u&&p(),{start:p,stop:f,bind:h}})).catch((t=>(e.onError&&e.onError(t),null))):Promise.resolve(null)},go:(t,e)=>new Promise(((n,o)=>{(e||document).addEventListener("DOMContentLoaded",(e=>{const o=Qo(t);return n(o)}))})).catch((t=>null))};t.AddressFinder=ii,Object.defineProperty(t,"__esModule",{value:!0})}));
