UNPKG

@ideal-postcodes/address-finder-bundled

Version:
9 lines 77.9 kB
/** * @license * Ideal Postcodes <https://ideal-postcodes.co.uk> * Copyright IDDQD Limited * Address Finder Bundled 5.0.3 * Built on Address Finder ~5.2.4 * AGPL-3.0 Licence */ !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 u=function(t){for(var e=t.length;e--&&c.test(t.charAt(e)););return e},l=/^\s+/;var d=function(t){return t?t.slice(0,u(t)+1).replace(l,""):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 w=b,E=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)?w(t):E(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,k=a,j=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,u=0,l=!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,u=e,s=t.apply(r,n)}function f(t){var n=t-c;return void 0===c||n>=e||n<0||d&&t-u>=r}function m(){var t=k();if(f(t))return g(t);a=setTimeout(m,function(t){var n=e-(t-c);return d?F(n,r-(t-u)):n}(t))}function g(t){return a=void 0,h&&o?p(t):(o=i=void 0,s)}function y(){var t=k(),n=f(t);if(o=arguments,i=this,c=t,n){if(void 0===a)return function(t){return u=t,a=setTimeout(m,e),l?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=j(e)||0,U(n)&&(l=!!n.leading,r=(d="maxWait"in n)?P(j(n.maxWait)||0,e):r,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==a&&clearTimeout(a),u=0,o=c=i=a=void 0},y.flush=function(){return void 0===a?s:g(k())},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 ut=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 lt=(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:lt(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,bt=(vt=Object.create(null),t=>{const e=gt.call(t);return vt[e]||(vt[e]=e.slice(8,-1).toLowerCase())});var vt;const wt=t=>(t=t.toLowerCase(),e=>bt(e)===t),Et=t=>e=>typeof e===t,{isArray:St}=Array,xt=Et("undefined");const Ct=wt("ArrayBuffer");const Tt=Et("string"),Ot=Et("function"),At=Et("number"),_t=t=>null!==t&&"object"==typeof t,Rt=t=>{if("object"!==bt(t))return!1;const e=yt(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},Nt=wt("Date"),Lt=wt("File"),Ut=wt("Blob"),kt=wt("FileList"),jt=wt("URLSearchParams"),[Pt,Ft,Dt,It]=["ReadableStream","Request","Response","Headers"].map(wt);function Bt(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let o,i;if("object"!=typeof t&&(t=[t]),St(t))for(o=0,i=t.length;o<i;o++)e.call(null,t[o],o,t);else{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 qt(t,e){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 Mt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ht=t=>!xt(t)&&t!==Mt;const $t=(zt="undefined"!=typeof Uint8Array&&yt(Uint8Array),t=>zt&&t instanceof zt);var zt;const Gt=wt("HTMLFormElement"),Kt=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Wt=wt("RegExp"),Vt=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),o={};Bt(n,((n,i)=>{let r;!1!==(r=e(n,i,t))&&(o[i]=r||n)})),Object.defineProperties(t,o)};const Jt=wt("AsyncFunction"),Yt=(Xt="function"==typeof setImmediate,Qt=Ot(Mt.postMessage),Xt?setImmediate:Qt?(Zt=`axios@${Math.random()}`,te=[],Mt.addEventListener("message",(({source:t,data:e})=>{t===Mt&&e===Zt&&te.length&&te.shift()()}),!1),t=>{te.push(t),Mt.postMessage(Zt,"*")}):t=>setTimeout(t));var Xt,Qt,Zt,te;const ee="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Mt):"undefined"!=typeof process&&process.nextTick||Yt;var ne={isArray:St,isArrayBuffer:Ct,isBuffer:function(t){return null!==t&&!xt(t)&&null!==t.constructor&&!xt(t.constructor)&&Ot(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||Ot(t.append)&&("formdata"===(e=bt(t))||"object"===e&&Ot(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Ct(t.buffer),e},isString:Tt,isNumber:At,isBoolean:t=>!0===t||!1===t,isObject:_t,isPlainObject:Rt,isReadableStream:Pt,isRequest:Ft,isResponse:Dt,isHeaders:It,isUndefined:xt,isDate:Nt,isFile:Lt,isBlob:Ut,isRegExp:Wt,isFunction:Ot,isStream:t=>_t(t)&&Ot(t.pipe),isURLSearchParams:jt,isTypedArray:$t,isFileList:kt,forEach:Bt,merge:function t(){const{caseless:e}=Ht(this)&&this||{},n={},o=(o,i)=>{const r=e&&qt(n,i)||i;Rt(n[r])&&Rt(o)?n[r]=t(n[r],o):Rt(o)?n[r]=t({},o):St(o)?n[r]=o.slice():n[r]=o};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&Bt(arguments[t],o);return n},extend:(t,e,n,{allOwnKeys:o}={})=>(Bt(e,((e,o)=>{n&&Ot(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:bt,kindOfTest:wt,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(St(t))return t;let e=t.length;if(!At(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[Symbol.iterator]).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:Gt,hasOwnProperty:Kt,hasOwnProp:Kt,reduceDescriptors:Vt,freezeMethods:t=>{Vt(t,((e,n)=>{if(Ot(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const o=t[n];Ot(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 St(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:qt,global:Mt,isContextDefined:Ht,isSpecCompliantForm:function(t){return!!(t&&Ot(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),n=(t,o)=>{if(_t(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[o]=t;const i=St(t)?[]:{};return Bt(t,((t,e)=>{const r=n(t,o+1);!xt(r)&&(i[e]=r)})),e[o]=void 0,i}}return t};return n(t,0)},isAsyncFn:Jt,isThenable:t=>t&&(_t(t)||Ot(t))&&Ot(t.then)&&Ot(t.catch),setImmediate:Yt,asap:ee};function oe(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)}ne.inherits(oe,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:ne.toJSONObject(this.config),code:this.code,status:this.status}}});const ie=oe.prototype,re={};["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=>{re[t]={value:t}})),Object.defineProperties(oe,re),Object.defineProperty(ie,"isAxiosError",{value:!0}),oe.from=(t,e,n,o,i,r)=>{const s=Object.create(ie);return ne.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),oe.call(s,t.message,e,n,o,i),s.cause=t,s.name=t.name,r&&Object.assign(s,r),s};function se(t){return ne.isPlainObject(t)||ne.isArray(t)}function ae(t){return ne.endsWith(t,"[]")?t.slice(0,-2):t}function ce(t,e,n){return t?t.concat(e).map((function(t,e){return t=ae(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const ue=ne.toFlatObject(ne,{},null,(function(t){return/^is[A-Z]/.test(t)}));function le(t,e,n){if(!ne.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const o=(n=ne.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!ne.isUndefined(e[t])}))).metaTokens,i=n.visitor||u,r=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ne.isSpecCompliantForm(e);if(!ne.isFunction(i))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(ne.isDate(t))return t.toISOString();if(!a&&ne.isBlob(t))throw new oe("Blob is not supported. Use a Buffer instead.");return ne.isArrayBuffer(t)||ne.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function u(t,n,i){let a=t;if(t&&!i&&"object"==typeof t)if(ne.endsWith(n,"{}"))n=o?n:n.slice(0,-2),t=JSON.stringify(t);else if(ne.isArray(t)&&function(t){return ne.isArray(t)&&!t.some(se)}(t)||(ne.isFileList(t)||ne.endsWith(n,"[]"))&&(a=ne.toArray(t)))return n=ae(n),a.forEach((function(t,o){!ne.isUndefined(t)&&null!==t&&e.append(!0===s?ce([n],o,r):null===s?n:n+"[]",c(t))})),!1;return!!se(t)||(e.append(ce(i,n,r),c(t)),!1)}const l=[],d=Object.assign(ue,{defaultVisitor:u,convertValue:c,isVisitable:se});if(!ne.isObject(t))throw new TypeError("data must be an object");return function t(n,o){if(!ne.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+o.join("."));l.push(n),ne.forEach(n,(function(n,r){!0===(!(ne.isUndefined(n)||null===n)&&i.call(e,n,ne.isString(r)?r.trim():r,o,d))&&t(n,o?o.concat(r):[r])})),l.pop()}}(t),e}function de(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function he(t,e){this._pairs=[],t&&le(t,this,e)}const pe=he.prototype;function fe(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function me(t,e,n){if(!e)return t;const o=n&&n.encode||fe;ne.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let r;if(r=i?i(e,n):ne.isURLSearchParams(e)?e.toString():new he(e,n).toString(o),r){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t}pe.append=function(t,e){this._pairs.push([t,e])},pe.toString=function(t){const e=t?function(e){return t.call(this,e,de)}:de;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};var ge=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){ne.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},ye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},be={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:he,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ve="undefined"!=typeof window&&"undefined"!=typeof document,we="object"==typeof navigator&&navigator||void 0,Ee=ve&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),Se="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,xe=ve&&window.location.href||"http://localhost";var Ce={...Object.freeze({__proto__:null,hasBrowserEnv:ve,hasStandardBrowserWebWorkerEnv:Se,hasStandardBrowserEnv:Ee,navigator:we,origin:xe}),...be};function Te(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&&ne.isArray(o)?o.length:r,a)return ne.hasOwnProp(o,r)?o[r]=[o[r],n]:o[r]=n,!s;o[r]&&ne.isObject(o[r])||(o[r]=[]);return e(t,n,o[r],i)&&ne.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(ne.isFormData(t)&&ne.isFunction(t.entries)){const n={};return ne.forEachEntry(t,((t,o)=>{e(function(t){return ne.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),o,n,0)})),n}return null}const Oe={transitional:ye,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",o=n.indexOf("application/json")>-1,i=ne.isObject(t);i&&ne.isHTMLForm(t)&&(t=new FormData(t));if(ne.isFormData(t))return o?JSON.stringify(Te(t)):t;if(ne.isArrayBuffer(t)||ne.isBuffer(t)||ne.isStream(t)||ne.isFile(t)||ne.isBlob(t)||ne.isReadableStream(t))return t;if(ne.isArrayBufferView(t))return t.buffer;if(ne.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 le(t,new Ce.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,o){return Ce.isNode&&ne.isBuffer(t)?(this.append(e,t.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((r=ne.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return le(r?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||o?(e.setContentType("application/json",!1),function(t,e,n){if(ne.isString(t))try{return(e||JSON.parse)(t),ne.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||Oe.transitional,n=e&&e.forcedJSONParsing,o="json"===this.responseType;if(ne.isResponse(t)||ne.isReadableStream(t))return t;if(t&&ne.isString(t)&&(n&&!this.responseType||o)){const n=!(e&&e.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw oe.from(t,oe.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:Ce.classes.FormData,Blob:Ce.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ne.forEach(["delete","get","head","post","put","patch"],(t=>{Oe.headers[t]={}}));var Ae=Oe;const _e=ne.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 Re=Symbol("internals");function Ne(t){return t&&String(t).trim().toLowerCase()}function Le(t){return!1===t||null==t?t:ne.isArray(t)?t.map(Le):String(t)}function Ue(t,e,n,o,i){return ne.isFunction(o)?o.call(this,e,n):(i&&(e=n),ne.isString(e)?ne.isString(o)?-1!==e.indexOf(o):ne.isRegExp(o)?o.test(e):void 0:void 0)}class ke{constructor(t){t&&this.set(t)}set(t,e,n){const o=this;function i(t,e,n){const i=Ne(e);if(!i)throw new Error("header name must be a non-empty string");const r=ne.findKey(o,i);(!r||void 0===o[r]||!0===n||void 0===n&&!1!==o[r])&&(o[r||e]=Le(t))}const r=(t,e)=>ne.forEach(t,((t,n)=>i(t,n,e)));if(ne.isPlainObject(t)||t instanceof this.constructor)r(t,e);else if(ne.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]&&_e[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(ne.isHeaders(t))for(const[e,o]of t.entries())i(o,e,n);else null!=t&&i(e,t,n);return this}get(t,e){if(t=Ne(t)){const n=ne.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(ne.isFunction(e))return e.call(this,t,n);if(ne.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Ne(t)){const n=ne.findKey(this,t);return!(!n||void 0===this[n]||e&&!Ue(0,this[n],n,e))}return!1}delete(t,e){const n=this;let o=!1;function i(t){if(t=Ne(t)){const i=ne.findKey(n,t);!i||e&&!Ue(0,n[i],i,e)||(delete n[i],o=!0)}}return ne.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&&!Ue(0,this[i],i,t,!0)||(delete this[i],o=!0)}return o}normalize(t){const e=this,n={};return ne.forEach(this,((o,i)=>{const r=ne.findKey(n,i);if(r)return e[r]=Le(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]=Le(o),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return ne.forEach(this,((n,o)=>{null!=n&&!1!==n&&(e[o]=t&&ne.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")}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[Re]=this[Re]={accessors:{}}).accessors,n=this.prototype;function o(t){const o=Ne(t);e[o]||(!function(t,e){const n=ne.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 ne.isArray(t)?t.forEach(o):o(t),this}}ke.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ne.reduceDescriptors(ke.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),ne.freezeMethods(ke);var je=ke;function Pe(t,e){const n=this||Ae,o=e||n,i=je.from(o.headers);let r=o.data;return ne.forEach(t,(function(t){r=t.call(n,r,i.normalize(),e?e.status:void 0)})),i.normalize(),r}function Fe(t){return!(!t||!t.__CANCEL__)}function De(t,e,n){oe.call(this,null==t?"canceled":t,oe.ERR_CANCELED,e,n),this.name="CanceledError"}function Ie(t,e,n){const o=n.config.validateStatus;n.status&&o&&!o(n.status)?e(new oe("Request failed with status code "+n.status,[oe.ERR_BAD_REQUEST,oe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}ne.inherits(De,oe,{__CANCEL__:!0});const Be=(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(),u=o[s];i||(i=c),n[r]=a,o[r]=c;let l=s,d=0;for(;l!==r;)d+=n[l++],l%=t;if(r=(r+1)%t,r===s&&(s=(s+1)%t),c-i<e)return;const h=u&&c-u;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.apply(null,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)},qe=(t,e)=>{const n=null!=t;return[o=>e[0]({lengthComputable:n,total:t,loaded:o}),e[1]]},Me=t=>(...e)=>ne.asap((()=>t(...e)));var He=Ce.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Ce.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Ce.origin),Ce.navigator&&/(msie|trident)/i.test(Ce.navigator.userAgent)):()=>!0,$e=Ce.hasStandardBrowserEnv?{write(t,e,n,o,i,r){const s=[t+"="+encodeURIComponent(e)];ne.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ne.isString(o)&&s.push("path="+o),ne.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 ze(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 Ge=t=>t instanceof je?{...t}:t;function Ke(t,e){e=e||{};const n={};function o(t,e,n,o){return ne.isPlainObject(t)&&ne.isPlainObject(e)?ne.merge.call({caseless:o},t,e):ne.isPlainObject(e)?ne.merge({},e):ne.isArray(e)?e.slice():e}function i(t,e,n,i){return ne.isUndefined(e)?ne.isUndefined(t)?void 0:o(void 0,t,0,i):o(t,e,0,i)}function r(t,e){if(!ne.isUndefined(e))return o(void 0,e)}function s(t,e){return ne.isUndefined(e)?ne.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(Ge(t),Ge(e),0,!0)};return ne.forEach(Object.keys(Object.assign({},t,e)),(function(o){const r=c[o]||i,s=r(t[o],e[o],o);ne.isUndefined(s)&&r!==a||(n[o]=s)})),n}var We=t=>{const e=Ke({},t);let n,{data:o,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:s,headers:a,auth:c}=e;if(e.headers=a=je.from(a),e.url=me(ze(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),ne.isFormData(o))if(Ce.hasStandardBrowserEnv||Ce.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[t,...e]=n?n.split(";").map((t=>t.trim())).filter(Boolean):[];a.setContentType([t||"multipart/form-data",...e].join("; "))}if(Ce.hasStandardBrowserEnv&&(i&&ne.isFunction(i)&&(i=i(e)),i||!1!==i&&He(e.url))){const t=r&&s&&$e.read(s);t&&a.set(r,t)}return e};var Ve="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){const o=We(t);let i=o.data;const r=je.from(o.headers).normalize();let s,a,c,u,l,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=o;function f(){u&&u(),l&&l(),o.cancelToken&&o.cancelToken.unsubscribe(s),o.signal&&o.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const o=je.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ie((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 oe("Request aborted",oe.ECONNABORTED,t,m)),m=null)},m.onerror=function(){n(new oe("Network Error",oe.ERR_NETWORK,t,m)),m=null},m.ontimeout=function(){let e=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const i=o.transitional||ye;o.timeoutErrorMessage&&(e=o.timeoutErrorMessage),n(new oe(e,i.clarifyTimeoutError?oe.ETIMEDOUT:oe.ECONNABORTED,t,m)),m=null},void 0===i&&r.setContentType(null),"setRequestHeader"in m&&ne.forEach(r.toJSON(),(function(t,e){m.setRequestHeader(e,t)})),ne.isUndefined(o.withCredentials)||(m.withCredentials=!!o.withCredentials),d&&"json"!==d&&(m.responseType=o.responseType),p&&([c,l]=Be(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,u]=Be(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(o.cancelToken||o.signal)&&(s=e=>{m&&(n(!e||e.type?new De(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===Ce.protocols.indexOf(y)?n(new oe("Unsupported protocol "+y+":",oe.ERR_BAD_REQUEST,t)):m.send(i||null)}))};var Je=(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 oe?e:new De(e instanceof Error?e.message:e))}};let r=e&&setTimeout((()=>{r=null,i(new oe(`timeout ${e} of ms exceeded`,oe.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=()=>ne.asap(s),a}};const Ye=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},Xe=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()}},Qe=(t,e,n,o)=>{const i=async function*(t,e){for await(const n of Xe(t))yield*Ye(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})},Ze="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,tn=Ze&&"function"==typeof ReadableStream,en=Ze&&("function"==typeof TextEncoder?(nn=new TextEncoder,t=>nn.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var nn;const on=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},rn=tn&&on((()=>{let t=!1;const e=new Request(Ce.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})),sn=tn&&on((()=>ne.isReadableStream(new Response("").body))),an={stream:sn&&(t=>t.body)};var cn;Ze&&(cn=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!an[t]&&(an[t]=ne.isFunction(cn[t])?e=>e[t]():(e,n)=>{throw new oe(`Response type '${t}' is not supported`,oe.ERR_NOT_SUPPORT,n)})})));const un=async(t,e)=>{const n=ne.toFiniteNumber(t.getContentLength());return null==n?(async t=>{if(null==t)return 0;if(ne.isBlob(t))return t.size;if(ne.isSpecCompliantForm(t)){const e=new Request(Ce.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return ne.isArrayBufferView(t)||ne.isArrayBuffer(t)?t.byteLength:(ne.isURLSearchParams(t)&&(t+=""),ne.isString(t)?(await en(t)).byteLength:void 0)})(e):n};const ln={http:null,xhr:Ve,fetch:Ze&&(async t=>{let{url:e,method:n,data:o,signal:i,cancelToken:r,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:h}=We(t);u=u?(u+"").toLowerCase():"text";let p,f=Je([i,r&&r.toAbortSignal()],s);const m=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let g;try{if(c&&rn&&"get"!==n&&"head"!==n&&0!==(g=await un(l,o))){let t,n=new Request(e,{method:"POST",body:o,duplex:"half"});if(ne.isFormData(o)&&(t=n.headers.get("content-type"))&&l.setContentType(t),n.body){const[t,e]=qe(g,Be(Me(c)));o=Qe(n.body,65536,t,e)}}ne.isString(d)||(d=d?"include":"omit");const i="credentials"in Request.prototype;p=new Request(e,{...h,signal:f,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:o,duplex:"half",credentials:i?d:void 0});let r=await fetch(p);const s=sn&&("stream"===u||"response"===u);if(sn&&(a||s&&m)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=r[e]}));const e=ne.toFiniteNumber(r.headers.get("content-length")),[n,o]=a&&qe(e,Be(Me(a),!0))||[];r=new Response(Qe(r.body,65536,n,(()=>{o&&o(),m&&m()})),t)}u=u||"text";let y=await an[ne.findKey(an,u)||"text"](r,t);return!s&&m&&m(),await new Promise(((e,n)=>{Ie(e,n,{data:y,headers:je.from(r.headers),status:r.status,statusText:r.statusText,config:t,request:p})}))}catch(e){if(m&&m(),e&&"TypeError"===e.name&&/fetch/i.test(e.message))throw Object.assign(new oe("Network Error",oe.ERR_NETWORK,t,p),{cause:e.cause||e});throw oe.from(e,e&&e.code,t,p)}})};ne.forEach(ln,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const dn=t=>`- ${t}`,hn=t=>ne.isFunction(t)||null===t||!1===t;var pn=t=>{t=ne.isArray(t)?t:[t];const{length:e}=t;let n,o;const i={};for(let r=0;r<e;r++){let e;if(n=t[r],o=n,!hn(n)&&(o=ln[(e=String(n)).toLowerCase()],void 0===o))throw new oe(`Unknown adapter '${e}'`);if(o)break;i[e||"#"+r]=o}if(!o){const t=Object.entries(i).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));throw new oe("There is no suitable adapter to dispatch the request "+(e?t.length>1?"since :\n"+t.map(dn).join("\n"):" "+dn(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o};function fn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new De(null,t)}function mn(t){fn(t),t.headers=je.from(t.headers),t.data=Pe.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return pn(t.adapter||Ae.adapter)(t).then((function(e){return fn(t),e.data=Pe.call(t,t.transformResponse,e),e.headers=je.from(e.headers),e}),(function(e){return Fe(e)||(fn(t),e&&e.response&&(e.response.data=Pe.call(t,t.transformResponse,e.response),e.response.headers=je.from(e.response.headers))),Promise.reject(e)}))}const gn="1.8.4",yn={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{yn[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const bn={};yn.transitional=function(t,e,n){function o(t,e){return"[Axios v1.8.4] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,i,r)=>{if(!1===t)throw new oe(o(i," has been removed"+(e?" in "+e:"")),oe.ERR_DEPRECATED);return e&&!bn[i]&&(bn[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)}},yn.spelling=function(t){return(e,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};var vn={assertOptions:function(t,e,n){if("object"!=typeof t)throw new oe("options must be an object",oe.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 oe("option "+r+" must be "+n,oe.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new oe("Unknown option "+r,oe.ERR_BAD_OPTION)}},validators:yn};const wn=vn.validators;class En{constructor(t){this.defaults=t,this.interceptors={request:new ge,response:new ge}}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=Ke(this.defaults,e);const{transitional:n,paramsSerializer:o,headers:i}=e;void 0!==n&&vn.assertOptions(n,{silentJSONParsing:wn.transitional(wn.boolean),forcedJSONParsing:wn.transitional(wn.boolean),clarifyTimeoutError:wn.transitional(wn.boolean)},!1),null!=o&&(ne.isFunction(o)?e.paramsSerializer={serialize:o}:vn.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),vn.assertOptions(e,{baseUrl:wn.spelling("baseURL"),withXsrfToken:wn.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let r=i&&ne.merge(i.common,i[e.method]);i&&ne.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=je.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 u;this.interceptors.response.forEach((function(t){c.push(t.fulfilled,t.rejected)}));let l,d=0;if(!a){const t=[mn.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,c),l=t.length,u=Promise.resolve(e);d<l;)u=u.then(t[d++],t[d++]);return u}l=s.length;let h=e;for(d=0;d<l;){const t=s[d++],e=s[d++];try{h=t(h)}catch(t){e.call(this,t);break}}try{u=mn.call(this,h)}catch(t){return Promise.reject(t)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(t){return me(ze((t=Ke(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}ne.forEach(["delete","get","head","options"],(function(t){En.prototype[t]=function(e,n){return this.request(Ke(n||{},{method:t,url:e,data:(n||{}).data}))}})),ne.forEach(["post","put","patch"],(function(t){function e(e){return function(n,o,i){return this.request(Ke(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:o}))}}En.prototype[t]=e(),En.prototype[t+"Form"]=e(!0)}));var Sn=En;class xn{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 De(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 xn((function(e){t=e}));return{token:e,cancel:t}}}var Cn=xn;const Tn={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(Tn).forEach((([t,e])=>{Tn[e]=t}));var On=Tn;const An=function t(e){const n=new Sn(e),o=mt(Sn.prototype.request,n);return ne.extend(o,Sn.prototype,n,{allOwnKeys:!0}),ne.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return t(Ke(e,n))},o}(Ae);An.Axios=Sn,An.CanceledError=De,An.CancelToken=Cn,An.isCancel=Fe,An.VERSION=gn,An.toFormData=le,An.AxiosError=oe,An.Cancel=An.CanceledError,An.all=function(t){return Promise.all(t)},An.spread=function(t){return function(e){return t.apply(null,e)}},An.isAxiosError=function(t){return ne.isObject(t)&&!0===t.isAxiosError},An.mergeConfig=Ke,An.AxiosHeaders=je,An.formToJSON=t=>Te(ne.isHTMLForm(t)?new FormData(t):t),An.getAdapter=pn,An.HttpStatusCode=On,An.default=An;var _n=An;const{IdealPostcodesError:Rn}=ut,Nn=(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},Ln=t=>{const e=new Rn({message:`[${t.name}] ${t.message}`,httpStatus:0,metadata:{axios:t}});return Promise.reject(e)},Un=()=>!0;class kn{constructor(){this.Axios=_n.create({validateStatus:Un})}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=>Nn(t,e))).catch(Ln)}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=>Nn(t,e))).catch(Ln)}http(t){return void 0!==t.body?this.requestWithBody(t):this.request(t)}}class jn extends M{constructor(t){super({agent:new kn,...t})}}class Pn{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 Fn=t=>"string"==typeof t,Dn=()=>!0,In=(t,e)=>Fn(t)?e.querySelector(t):t,Bn=()=>window.document,qn=t=>Fn(t)?Bn().querySelector(t):null===t?Bn():t,Mn=(t,e)=>{const n=t.getAttribute("style");return Object.keys(e).forEach((n=>t.style[n]=e[n])),n},Hn=t=>(t.style.display="none",t),$n=t=>(t.style.display="",t),zn=(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},Gn=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},Kn=t=>void 0!==t.post_town,Wn=(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})),Vn=t=>null!==t&&(t instanceof HTMLSelectElement||"HTMLSelectElement"===t.constructor.name),Jn=t=>null!==t&&(t instanceof HTMLInputElement||"HTMLInputElement"===t.constructor.name),Yn=t=>null!==t&&(t instanceof HTMLTextAreaElement||"HTMLTextAreaElement"===t.constructor.name),Xn=t=>Jn(t)||Yn(t)||Vn(t),Qn=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t&&(Jn(t)||Yn(t))&&no({e:t,value:e,skipTrigger:n})},Zn=(t,e)=>null!==e&&null!==t.querySelector(`[value="${e}"]`),to=(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))},eo=(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)},no=t=>{null!==t.value&&((t=>{let{e:e,value:n,skipTrigger:o}=t;null!==n&&Vn(e)&&(eo(e,n),o||Wn(e,"select"),Wn(e,"change"))})(t),(t=>{let{e:e,value:n,skipTrigger:o}=t;null!==n&&(Jn(e)||Yn(e))&&(eo(e,n),o||Wn(e,"input"),Wn(e,"change"))})(t))},oo="United Kingdom",io="Isle of Man",ro=t=>{const e=t.country;if("England"===e)return oo;if("Scotland"===e)return oo;if("Wales"===e)return oo;if("Northern Ireland"===e)return oo;if(e===io)return io;if(Kn(t)&&"Channel Islands"===e){if(/^GY/.test(t.postcode))return"Guernsey";if(/^JE/.test(t.postcode))return"Jersey"}return e};let so={};"undefined"!=typeof window&&(window.idpcGlobal?so=window.idpcGlobal:window.idpcGlobal=so);const ao=()=>so,co=t=>t.filter((t=>Fn(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()]},lo=(t,e)=>0===e.length?t:`${t}, ${e}`,ho=(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]=lo(e,a[1])),1===n)return s}else if(s[0]=a[0],1===n)return[co(a),"",""];if(i){const[t,e]=uo(a[1],i);if(s[1]=t,e&&(a[2]=lo(e,a[2])),2===n)return s}else if(s[1]=a[1],2===n)return[s[0],co(a.slice(1)),""];if(r){const[t,e]=uo(a[2],r);s[2]=t,e&&(a[3]=lo(e,a[3]))}else s[2]=a[2];return s})([o,i,r],{lineCount:t,...n}):3===t?[o,i,r]:2===t?[o,co([i,r]),""]:[co([o,i,r]),"",""]},po=(t,e)=>{const n=t[e];return"number"==typeof n?n.toString():void 0===n?"":n},fo=(t,e)=>{const n={};let o;for(o in t){const i=t[o];if(void 0===i)continue;const r=In(i,e);Xn(r)&&(n[o]=r)}return n},mo=(t,e)=>{const n={};let o;for(o in t){if(!t.hasOwnProperty(o))continue;const i=t[o],r=In(`[name="${i}"]`,e);if(r){n[o]=r;continue}const s=In(`[aria-name="${i}"]`,e);s&&(n[o]=s)}return n},go=(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=zn(e,"label",i),s=In(r,e);if(!s)continue;const a=s.getAttribute("for");if(a){const t=e.querySelector(`#${Gn(a)}`);if(t){n[o]=t;continue}}const c=s.querySelector("input");c&&(n[o]=c)}return n},yo=["country","country_iso_2","country_iso"],bo=t=>{const{config:e}=t,n={...fo((o=t).outputFields||{},o.config.scope),...mo(o.names||{},o.config.scope),...go(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)=>{Kn(t)&&e.removeOrganisation&&wo(t);const[n,o,i]=ho(e.lines||3,t,e);return t.line_1=n,t.line_2=o,Kn(t)&&(t.line_3=i),t})({...t.address},e),{scope:r,populateCounty:s}=e,a=[...yo];Kn(i)&&(e.removeOrganisation&&wo(i),!1===s&&a.push("county")),((t,e)=>{if(t){if(Vn(t)){const n=ro(e);if(Zn(t,n))return void no({e:t,value:n});if(Zn(t,e.country_iso_2))return void no({e:t,value:e.country_iso_2});if(Zn(t,e.country_iso))return void no({e:t,value:e.country_iso});let o=to(t,n);if(o.length>0)return void no({e:t,value:o[0].value||""});if(o=to(t,e.country_iso_2),o.length>0)return void no({e:t,value:o[0].value||""});if(o=to(t,e.country_iso),o.length>0)return void no({e:t,value:o[0].value||""})}if(Jn(t)){const n=ro(e);no({e:t,value:n})}}})(In(n.country||null,r),i);const c=In(n.country_iso_2||null,r);if(Vn(c))if(Zn(c,i.country_iso_2))no({e:c,value:i.country_iso_2});else{let t=to(c,i.country_iso_2);t.length>0?no({e:c,value:t[0].value||""}):(t=to(c,ro(i)),t.length>0&&no({e:c,value:t[0].value||""}))}Jn(c)&&Qn(c,i.country_iso_2||"");const u=In(n.country_iso||null,r);if(Vn(u))if(Zn(u,i.country_iso))no({e:u,value:i.country_iso});else{let t=to(u,i.country_iso);t.length>0?no({e:u,value:t[0].value||""}):(t=to(u,ro(i)),t.length>0&&no({e:u,value:t[0].value||""}))}Jn(u)&&Qn(u,i.country_iso||"");const l=In(Eo(n),r),d=So(i),h=xo(i);if(Vn(l))if(Zn(l,d))no({e:l,value:d});else if(Zn(l,h||""))no({e:l,value:h||""});else{let t=to(l,h);t.length>0?no({e:l,value:t[0].value||""}):(t=to(l,d),t&&no({e:l,value:t[0].value||""}))}let p;for(p in Jn(l)&&Qn(l,d),n)if(!a.includes(p))if(p.startsWith("native."))vo(p,n,i,r);else if(void 0!==i[p]&&n.hasOwnProperty(p)){const t=n[p];if(!t)continue;Qn(In(t,r),po(i,p))}},vo=(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;Qn(In(n,o),po(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),Eo=t=>(t=>t.hasOwnProperty("state_abbreviation"))(t)?t.state_abbreviation||null:t.county_code||null,So=t=>Kn(t)?t.county_code:t.state_abbreviation,xo=t=>Kn(t)?t.county:t.state,Co={13:"Enter",38:"ArrowUp",40:"ArrowDown",36:"Home",35:"End",27:"Escape",8:"Backspace"},To=["Enter","ArrowUp","ArrowDown","Home","End","Escape","Backspace"],Oo=t=>{return t