UNPKG

vue-dadata

Version:

Vue component for hinting addresses using dadata.ru

5 lines (4 loc) 47.1 kB
(function(R,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],m):(R=typeof globalThis<"u"?globalThis:R||self,m(R.VueDadata={},R.Vue))})(this,function(R,m){"use strict";var pt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},V={};V.remove=Et;for(var ee=[{base:" ",chars:" "},{base:"0",chars:"߀"},{base:"A",chars:"ⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",chars:"Ꜳ"},{base:"AE",chars:"ÆǼǢ"},{base:"AO",chars:"Ꜵ"},{base:"AU",chars:"Ꜷ"},{base:"AV",chars:"ꜸꜺ"},{base:"AY",chars:"Ꜽ"},{base:"B",chars:"ⒷBḂḄḆɃƁ"},{base:"C",chars:"ⒸCꜾḈĆCĈĊČÇƇȻ"},{base:"D",chars:"ⒹDḊĎḌḐḒḎĐƊƉᴅꝹ"},{base:"Dh",chars:"Ð"},{base:"DZ",chars:"DZDŽ"},{base:"Dz",chars:"DzDž"},{base:"E",chars:"ɛⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎᴇ"},{base:"F",chars:"ꝼⒻFḞƑꝻ"},{base:"G",chars:"ⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾɢ"},{base:"H",chars:"ⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",chars:"ⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",chars:"ⒿJĴɈȷ"},{base:"K",chars:"ⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",chars:"ⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",chars:"LJ"},{base:"Lj",chars:"Lj"},{base:"M",chars:"ⓂMḾṀṂⱮƜϻ"},{base:"N",chars:"ꞤȠⓃNǸŃÑṄŇṆŅṊṈƝꞐᴎ"},{base:"NJ",chars:"NJ"},{base:"Nj",chars:"Nj"},{base:"O",chars:"ⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OE",chars:"Œ"},{base:"OI",chars:"Ƣ"},{base:"OO",chars:"Ꝏ"},{base:"OU",chars:"Ȣ"},{base:"P",chars:"ⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",chars:"ⓆQꝖꝘɊ"},{base:"R",chars:"ⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",chars:"ⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",chars:"ⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"Th",chars:"Þ"},{base:"TZ",chars:"Ꜩ"},{base:"U",chars:"ⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",chars:"ⓋVṼṾƲꝞɅ"},{base:"VY",chars:"Ꝡ"},{base:"W",chars:"ⓌWẀẂŴẆẄẈⱲ"},{base:"X",chars:"ⓍXẊẌ"},{base:"Y",chars:"ⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",chars:"ⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",chars:"ⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑ"},{base:"aa",chars:"ꜳ"},{base:"ae",chars:"æǽǣ"},{base:"ao",chars:"ꜵ"},{base:"au",chars:"ꜷ"},{base:"av",chars:"ꜹꜻ"},{base:"ay",chars:"ꜽ"},{base:"b",chars:"ⓑbḃḅḇƀƃɓƂ"},{base:"c",chars:"cⓒćĉċčçḉƈȼꜿↄ"},{base:"d",chars:"ⓓdḋďḍḑḓḏđƌɖɗƋᏧԁꞪ"},{base:"dh",chars:"ð"},{base:"dz",chars:"dzdž"},{base:"e",chars:"ⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇǝ"},{base:"f",chars:"ⓕfḟƒ"},{base:"ff",chars:"ff"},{base:"fi",chars:"fi"},{base:"fl",chars:"fl"},{base:"ffi",chars:"ffi"},{base:"ffl",chars:"ffl"},{base:"g",chars:"ⓖgǵĝḡğġǧģǥɠꞡꝿᵹ"},{base:"h",chars:"ⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",chars:"ƕ"},{base:"i",chars:"ⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",chars:"ⓙjĵǰɉ"},{base:"k",chars:"ⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",chars:"ⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇɭ"},{base:"lj",chars:"lj"},{base:"m",chars:"ⓜmḿṁṃɱɯ"},{base:"n",chars:"ⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥлԉ"},{base:"nj",chars:"nj"},{base:"o",chars:"ⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿꝋꝍɵɔᴑ"},{base:"oe",chars:"œ"},{base:"oi",chars:"ƣ"},{base:"oo",chars:"ꝏ"},{base:"ou",chars:"ȣ"},{base:"p",chars:"ⓟpṕṗƥᵽꝑꝓꝕρ"},{base:"q",chars:"ⓠqɋꝗꝙ"},{base:"r",chars:"ⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",chars:"ⓢsśṥŝṡšṧṣṩșşȿꞩꞅẛʂ"},{base:"ss",chars:"ß"},{base:"t",chars:"ⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"th",chars:"þ"},{base:"tz",chars:"ꜩ"},{base:"u",chars:"ⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",chars:"ⓥvṽṿʋꝟʌ"},{base:"vy",chars:"ꝡ"},{base:"w",chars:"ⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",chars:"ⓧxẋẍ"},{base:"y",chars:"ⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",chars:"ⓩzźẑżžẓẕƶȥɀⱬꝣ"}],he={},te=0;te<ee.length;te+=1)for(var Ue=ee[te].chars,pe=0;pe<Ue.length;pe+=1)he[Ue[pe]]=ee[te].base;function Et(e){return e.replace(/[^\u0000-\u007e]/g,function(t){return he[t]||t})}V.replacementList=ee,V.diacriticsMap=he;const ke=e=>e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),Ee=(e,t,n=!1)=>{if(!t.query||t.query instanceof String&&!t.query.trim())return e;let r=e,u=t.query,s=!1;t.diacriticsSensitive||(r=V.remove(r),u=t.query instanceof RegExp?t.query:V.remove(t.query),s=r!==e);const o=(c=>{let d;if(c.query instanceof RegExp)return new RegExp(String.raw`(${c.query.source})`,"g"+(c.caseSensitive?"":"i"));if(c.splitBySpace){const E=c.query.trim().replace(/\s+/g," ");d=String.raw`(${E.split(/\s/).map(ke).join("|")})`}else d=String.raw`(${ke(c.query)})`;return new RegExp(String.raw`${d}`,"g"+(c.caseSensitive?"":"i"))})({query:u,splitBySpace:t.splitBySpace,caseSensitive:t.caseSensitive}),a=r.split(o),p=s?((c,d)=>{const E=[];return d.forEach(b=>{const h=E.join("").length,l=h+b.length;E.push(c.slice(h,l))}),E})(e,a):a;return n?a.map((c,d)=>{if(o.test(c)){const E=t.highlightClass?` class="${t.highlightClass}"`:"",b=t.highlightStyle?` style="${t.highlightStyle}"`:"";return`<${t.highlightTag}${E}${b}>${p[d]}</${t.highlightTag}>`}return p[d]}).join(""):a.map((c,d)=>o.test(c)?m.h(t.highlightTag,{class:t.highlightClass,style:t.highlightStyle},p[d]):p[d])},Ie=e=>typeof e=="string"?[]:e.filter(t=>typeof t!="string").map(t=>typeof t=="string"?t:t.children);var mt=m.defineComponent({name:"VueWordHighlighter",props:{query:{type:[String,RegExp],required:!0,default:""},caseSensitive:{type:Boolean,default:!1},diacriticsSensitive:{type:Boolean,default:!1},splitBySpace:{type:Boolean,default:!1},highlightClass:{type:[Object,String,Array],default:""},highlightStyle:{type:[Object,String,Array],default:""},highlightTag:{type:String,default:"mark"},wrapperTag:{type:String,default:"span"},wrapperClass:{type:[Object,String,Array],default:""},textToHighlight:{type:String,default:""},htmlToHighlight:{type:String,default:""}},emits:["matches"],setup:(e,t)=>()=>{if(e.htmlToHighlight){const n=`(<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)`,r=e.htmlToHighlight.split(new RegExp(n,"gs")),u=r.map((s,o)=>new RegExp(n).test(s)||o>0&&r[o-1].startsWith("<script")?s:Ee(s,{query:e.query,splitBySpace:e.splitBySpace,caseSensitive:e.caseSensitive,diacriticsSensitive:e.diacriticsSensitive,highlightTag:e.highlightTag,highlightClass:e.highlightClass,highlightStyle:e.highlightStyle},!0)).join("");return m.h(e.wrapperTag,{class:e.wrapperClass,innerHTML:u})}if(e.textToHighlight){const n=Ee(e.textToHighlight,{query:e.query,splitBySpace:e.splitBySpace,caseSensitive:e.caseSensitive,diacriticsSensitive:e.diacriticsSensitive,highlightTag:e.highlightTag,highlightClass:e.highlightClass,highlightStyle:e.highlightStyle});return t.emit("matches",Ie(n)),m.h(e.wrapperTag,{class:e.wrapperClass},n)}if(t.slots&&t.slots.default){const n=u=>{if(typeof u.children=="string"){const s=Ee(u.children,{query:e.query,splitBySpace:e.splitBySpace,caseSensitive:e.caseSensitive,diacriticsSensitive:e.diacriticsSensitive,highlightTag:e.highlightTag,highlightClass:e.highlightClass,highlightStyle:e.highlightStyle}),o=Ie(s);return t.emit("matches",o),o.length===0?u:typeof u.type=="string"?m.h(u.type,{...u.props},[m.h(e.wrapperTag,{class:e.wrapperClass},s)]):m.h(e.wrapperTag,{class:e.wrapperClass},s)}return m.h(u.type,{...u.props},Array.isArray(u.children)?u.children.map(s=>n(s)):[])},r=t.slots.default();return Array.isArray(r)?r.map(u=>n(u)):r}}}),_=(e=>(e.Enter="enter",e.Esc="esc",e.Up="up",e.Down="down",e))(_||{});const yt={COUNTRY:"country",REGION:"region",AREA:"area",CITY:"city",SETTLEMENT:"settlement",STREET:"street",HOUSE:"house",FLAT:"flat"},I={container:"vue-dadata",search:"vue-dadata__search",input:"vue-dadata__input",suggestions:"vue-dadata__suggestions",suggestionItem:"vue-dadata__suggestions-item",suggestionCurrentItem:"vue-dadata__suggestions-item_current"},N={caseSensitive:!1,splitBySpace:!1,highlightTag:"mark",highlightClass:"vue-dadata__suggestion-item-text_highlight",highlightStyle:"",wrapperTag:"span",wrapperClass:""},gt=e=>m.computed(()=>({container:(e==null?void 0:e.container)??I.container,search:(e==null?void 0:e.search)??I.search,input:(e==null?void 0:e.input)??I.input,suggestions:(e==null?void 0:e.suggestions)??I.suggestions,suggestionItem:(e==null?void 0:e.suggestionItem)??I.suggestionItem,suggestionCurrentItem:(e==null?void 0:e.suggestionCurrentItem)??I.suggestionCurrentItem})),At=e=>m.computed(()=>({caseSensitive:(e==null?void 0:e.caseSensitive)??N.caseSensitive,splitBySpace:(e==null?void 0:e.splitBySpace)??N.splitBySpace,highlightTag:(e==null?void 0:e.highlightTag)??N.highlightTag,highlightClass:(e==null?void 0:e.highlightClass)??N.highlightClass,highlightStyle:(e==null?void 0:e.highlightStyle)??N.highlightStyle,wrapperTag:(e==null?void 0:e.wrapperTag)??N.wrapperTag,wrapperClass:(e==null?void 0:e.wrapperClass)??N.wrapperClass}));var ne={},bt={get exports(){return ne},set exports(e){ne=e}};(function(e,t){(function(n,r){r(t)})(pt,function(n){function r(h,l){return function(f){if(Array.isArray(f))return f}(h)||function(f,y){var g=f==null?null:typeof Symbol<"u"&&f[Symbol.iterator]||f["@@iterator"];if(g!=null){var w,B,T=[],F=!0,D=!1;try{for(g=g.call(f);!(F=(w=g.next()).done)&&(T.push(w.value),!y||T.length!==y);F=!0);}catch(x){D=!0,B=x}finally{try{F||g.return==null||g.return()}finally{if(D)throw B}}return T}}(h,l)||function(f,y){if(f){if(typeof f=="string")return u(f,y);var g=Object.prototype.toString.call(f).slice(8,-1);if(g==="Object"&&f.constructor&&(g=f.constructor.name),g==="Map"||g==="Set")return Array.from(f);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return u(f,y)}}(h,l)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function u(h,l){(l==null||l>h.length)&&(l=h.length);for(var f=0,y=new Array(l);f<l;f++)y[f]=h[f];return y}function s(h,l){var f,y,g,w,B=null,T=typeof l=="number"?l:(f=r(String(l).split(/(ms|s)/i),2),y=f[0],g=f[1],w=g===void 0?"ms":g,Number(y)*{ms:1,s:1e3}[w]),F=function(){for(var D=this,x=arguments.length,U=new Array(x),q=0;q<x;q++)U[q]=arguments[q];var X=function(){B=null,h.apply(D,U)};clearTimeout(B),(B=setTimeout(X,T))||h.apply(this,U)};return F.cancel=function(){clearTimeout(B),B=null},F}function o(h){return h.map(function(l){return l.toLowerCase()})}function a(h,l){var f,y=h?h["debounce-events"]:[];return y&&y.length>0?Array.isArray(y)?o(y):o(y.split(",")):o((f=l,Array.isArray(f)?f:f==null?[]:[f]))}function p(h){return h===""}function c(h,l){return h==="Enter"&&(!l.lock||l.unlock)}function d(h,l,f){return p(h)&&f.fireonempty&&(l==="Enter"||l===" ")}function E(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=h.lock,f=l!==void 0&&l,y=h.listenTo,g=y===void 0?"keyup":y,w=h.defaultTime,B=w===void 0?"300ms":w,T=h.fireOnEmpty,F=T!==void 0&&T,D=h.cancelOnEmpty,x=D!==void 0&&D,U=h.trim,q=U!==void 0&&U;return{bind:function(X,H,xe){var Y=H.value,Z=H.arg,Ne=Z===void 0?B:Z,Pe=H.modifiers,k=Object.assign({lock:f,trim:q,fireonempty:F,cancelonempty:x},Pe),ve=a(xe.data.attrs,g),M=s(function(C){Y(C.target.value,C)},Ne);function Le(C){var Q=k.trim?C.target.value.trim():C.target.value;p(Q)&&k.cancelonempty?M.cancel():c(C.key,k)||d(Q,C.key,k)?(M.cancel(),Y(C.target.value,C)):M(C)}ve.forEach(function(C){X.addEventListener(C,Le)})}}}var b={install:function(h){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};h.directive("debounce",E(l))}};n.debounce=s,n.default=b,n.vue3Debounce=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=h.lock,f=l!==void 0&&l,y=h.listenTo,g=y===void 0?"keyup":y,w=h.defaultTime,B=w===void 0?"300ms":w,T=h.fireOnEmpty,F=T!==void 0&&T,D=h.cancelOnEmpty,x=D!==void 0&&D,U=h.trim,q=U!==void 0&&U;return{created:function(X,H,xe){var Y=H.value,Z=H.arg,Ne=Z===void 0?B:Z,Pe=H.modifiers,k=Object.assign({lock:f,trim:q,fireonempty:F,cancelonempty:x},Pe),ve=a(xe.props,g),M=s(function(C){Y(C.target.value,C)},Ne);function Le(C){var Q=k.trim?C.target.value.trim():C.target.value;p(Q)&&k.cancelonempty?M.cancel():c(C.key,k)||d(Q,C.key,k)?(M.cancel(),Y(C.target.value,C)):M(C)}ve.forEach(function(C){X.addEventListener(C,Le)})}}},Object.defineProperty(n,"__esModule",{value:!0})})})(bt,ne);function je(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ft}=Object.prototype,{getPrototypeOf:me}=Object,re=(e=>t=>{const n=Ft.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),P=e=>(e=e.toLowerCase(),t=>re(t)===e),ue=e=>t=>typeof t===e,{isArray:$}=Array,J=ue("undefined");function Ct(e){return e!==null&&!J(e)&&e.constructor!==null&&!J(e.constructor)&&v(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const qe=P("ArrayBuffer");function St(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&qe(e.buffer),t}const wt=ue("string"),v=ue("function"),_e=ue("number"),ye=e=>e!==null&&typeof e=="object",Dt=e=>e===!0||e===!1,se=e=>{if(re(e)!=="object")return!1;const t=me(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Bt=P("Date"),Tt=P("File"),Rt=P("Blob"),Ot=P("FileList"),xt=e=>ye(e)&&v(e.pipe),Nt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||v(e.append)&&((t=re(e))==="formdata"||t==="object"&&v(e.toString)&&e.toString()==="[object FormData]"))},Pt=P("URLSearchParams"),vt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function K(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,u;if(typeof e!="object"&&(e=[e]),$(e))for(r=0,u=e.length;r<u;r++)t.call(null,e[r],r,e);else{const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let a;for(r=0;r<o;r++)a=s[r],t.call(null,e[a],a,e)}}function He(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,u;for(;r-- >0;)if(u=n[r],t===u.toLowerCase())return u;return null}const Me=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),$e=e=>!J(e)&&e!==Me;function ge(){const{caseless:e}=$e(this)&&this||{},t={},n=(r,u)=>{const s=e&&He(t,u)||u;se(t[s])&&se(r)?t[s]=ge(t[s],r):se(r)?t[s]=ge({},r):$(r)?t[s]=r.slice():t[s]=r};for(let r=0,u=arguments.length;r<u;r++)arguments[r]&&K(arguments[r],n);return t}const Lt=(e,t,n,{allOwnKeys:r}={})=>(K(t,(u,s)=>{n&&v(u)?e[s]=je(u,n):e[s]=u},{allOwnKeys:r}),e),Ut=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),kt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},It=(e,t,n,r)=>{let u,s,o;const a={};if(t=t||{},e==null)return t;do{for(u=Object.getOwnPropertyNames(e),s=u.length;s-- >0;)o=u[s],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&me(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},jt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},qt=e=>{if(!e)return null;if($(e))return e;let t=e.length;if(!_e(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},_t=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&me(Uint8Array)),Ht=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let u;for(;(u=r.next())&&!u.done;){const s=u.value;t.call(e,s[0],s[1])}},Mt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},$t=P("HTMLFormElement"),zt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,u){return r.toUpperCase()+u}),ze=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Vt=P("RegExp"),Ve=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};K(n,(u,s)=>{t(u,s,e)!==!1&&(r[s]=u)}),Object.defineProperties(e,r)},Jt=e=>{Ve(e,(t,n)=>{if(v(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(v(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Kt=(e,t)=>{const n={},r=u=>{u.forEach(s=>{n[s]=!0})};return $(e)?r(e):r(String(e).split(t)),n},Wt=()=>{},Gt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),Ae="abcdefghijklmnopqrstuvwxyz",Je="0123456789",Ke={DIGIT:Je,ALPHA:Ae,ALPHA_DIGIT:Ae+Ae.toUpperCase()+Je},Xt=(e=16,t=Ke.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Yt(e){return!!(e&&v(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const i={isArray:$,isArrayBuffer:qe,isBuffer:Ct,isFormData:Nt,isArrayBufferView:St,isString:wt,isNumber:_e,isBoolean:Dt,isObject:ye,isPlainObject:se,isUndefined:J,isDate:Bt,isFile:Tt,isBlob:Rt,isRegExp:Vt,isFunction:v,isStream:xt,isURLSearchParams:Pt,isTypedArray:_t,isFileList:Ot,forEach:K,merge:ge,extend:Lt,trim:vt,stripBOM:Ut,inherits:kt,toFlatObject:It,kindOf:re,kindOfTest:P,endsWith:jt,toArray:qt,forEachEntry:Ht,matchAll:Mt,isHTMLForm:$t,hasOwnProperty:ze,hasOwnProp:ze,reduceDescriptors:Ve,freezeMethods:Jt,toObjectSet:Kt,toCamelCase:zt,noop:Wt,toFiniteNumber:Gt,findKey:He,global:Me,isContextDefined:$e,ALPHABET:Ke,generateString:Xt,isSpecCompliantForm:Yt,toJSONObject:e=>{const t=new Array(10),n=(r,u)=>{if(ye(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[u]=r;const s=$(r)?[]:{};return K(r,(o,a)=>{const p=n(o,u+1);!J(p)&&(s[a]=p)}),t[u]=void 0,s}}return r};return n(e,0)}};function A(e,t,n,r,u){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),u&&(this.response=u)}i.inherits(A,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:i.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const We=A.prototype,Ge={};["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(e=>{Ge[e]={value:e}}),Object.defineProperties(A,Ge),Object.defineProperty(We,"isAxiosError",{value:!0}),A.from=(e,t,n,r,u,s)=>{const o=Object.create(We);return i.toFlatObject(e,o,function(p){return p!==Error.prototype},a=>a!=="isAxiosError"),A.call(o,e.message,t,n,r,u),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};const Zt=null;function be(e){return i.isPlainObject(e)||i.isArray(e)}function Xe(e){return i.endsWith(e,"[]")?e.slice(0,-2):e}function Ye(e,t,n){return e?e.concat(t).map(function(u,s){return u=Xe(u),!n&&s?"["+u+"]":u}).join(n?".":""):t}function Qt(e){return i.isArray(e)&&!e.some(be)}const en=i.toFlatObject(i,{},null,function(t){return/^is[A-Z]/.test(t)});function oe(e,t,n){if(!i.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=i.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,y){return!i.isUndefined(y[f])});const r=n.metaTokens,u=n.visitor||d,s=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&i.isSpecCompliantForm(t);if(!i.isFunction(u))throw new TypeError("visitor must be a function");function c(l){if(l===null)return"";if(i.isDate(l))return l.toISOString();if(!p&&i.isBlob(l))throw new A("Blob is not supported. Use a Buffer instead.");return i.isArrayBuffer(l)||i.isTypedArray(l)?p&&typeof Blob=="function"?new Blob([l]):Buffer.from(l):l}function d(l,f,y){let g=l;if(l&&!y&&typeof l=="object"){if(i.endsWith(f,"{}"))f=r?f:f.slice(0,-2),l=JSON.stringify(l);else if(i.isArray(l)&&Qt(l)||(i.isFileList(l)||i.endsWith(f,"[]"))&&(g=i.toArray(l)))return f=Xe(f),g.forEach(function(B,T){!(i.isUndefined(B)||B===null)&&t.append(o===!0?Ye([f],T,s):o===null?f:f+"[]",c(B))}),!1}return be(l)?!0:(t.append(Ye(y,f,s),c(l)),!1)}const E=[],b=Object.assign(en,{defaultVisitor:d,convertValue:c,isVisitable:be});function h(l,f){if(!i.isUndefined(l)){if(E.indexOf(l)!==-1)throw Error("Circular reference detected in "+f.join("."));E.push(l),i.forEach(l,function(g,w){(!(i.isUndefined(g)||g===null)&&u.call(t,g,i.isString(w)?w.trim():w,f,b))===!0&&h(g,f?f.concat(w):[w])}),E.pop()}}if(!i.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Ze(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Fe(e,t){this._pairs=[],e&&oe(e,this,t)}const Qe=Fe.prototype;Qe.append=function(t,n){this._pairs.push([t,n])},Qe.toString=function(t){const n=t?function(r){return t.call(this,r,Ze)}:Ze;return this._pairs.map(function(u){return n(u[0])+"="+n(u[1])},"").join("&")};function tn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function et(e,t,n){if(!t)return e;const r=n&&n.encode||tn,u=n&&n.serialize;let s;if(u?s=u(t,n):s=i.isURLSearchParams(t)?t.toString():new Fe(t,n).toString(r),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class nn{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){i.forEach(this.handlers,function(r){r!==null&&t(r)})}}const tt=nn,nt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},rn=typeof URLSearchParams<"u"?URLSearchParams:Fe,un=typeof FormData<"u"?FormData:null,sn=typeof Blob<"u"?Blob:null,on=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),an=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),O={isBrowser:!0,classes:{URLSearchParams:rn,FormData:un,Blob:sn},isStandardBrowserEnv:on,isStandardBrowserWebWorkerEnv:an,protocols:["http","https","file","blob","url","data"]};function cn(e,t){return oe(e,new O.classes.URLSearchParams,Object.assign({visitor:function(n,r,u,s){return O.isNode&&i.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function ln(e){return i.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function fn(e){const t={},n=Object.keys(e);let r;const u=n.length;let s;for(r=0;r<u;r++)s=n[r],t[s]=e[s];return t}function rt(e){function t(n,r,u,s){let o=n[s++];const a=Number.isFinite(+o),p=s>=n.length;return o=!o&&i.isArray(u)?u.length:o,p?(i.hasOwnProp(u,o)?u[o]=[u[o],r]:u[o]=r,!a):((!u[o]||!i.isObject(u[o]))&&(u[o]=[]),t(n,r,u[o],s)&&i.isArray(u[o])&&(u[o]=fn(u[o])),!a)}if(i.isFormData(e)&&i.isFunction(e.entries)){const n={};return i.forEachEntry(e,(r,u)=>{t(ln(r),u,n,0)}),n}return null}const dn={"Content-Type":void 0};function hn(e,t,n){if(i.isString(e))try{return(t||JSON.parse)(e),i.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ie={transitional:nt,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",u=r.indexOf("application/json")>-1,s=i.isObject(t);if(s&&i.isHTMLForm(t)&&(t=new FormData(t)),i.isFormData(t))return u&&u?JSON.stringify(rt(t)):t;if(i.isArrayBuffer(t)||i.isBuffer(t)||i.isStream(t)||i.isFile(t)||i.isBlob(t))return t;if(i.isArrayBufferView(t))return t.buffer;if(i.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return cn(t,this.formSerializer).toString();if((a=i.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return oe(a?{"files[]":t}:t,p&&new p,this.formSerializer)}}return s||u?(n.setContentType("application/json",!1),hn(t)):t}],transformResponse:[function(t){const n=this.transitional||ie.transitional,r=n&&n.forcedJSONParsing,u=this.responseType==="json";if(t&&i.isString(t)&&(r&&!this.responseType||u)){const o=!(n&&n.silentJSONParsing)&&u;try{return JSON.parse(t)}catch(a){if(o)throw a.name==="SyntaxError"?A.from(a,A.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:O.classes.FormData,Blob:O.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],function(t){ie.headers[t]={}}),i.forEach(["post","put","patch"],function(t){ie.headers[t]=i.merge(dn)});const Ce=ie,pn=i.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"]),En=e=>{const t={};let n,r,u;return e&&e.split(` `).forEach(function(o){u=o.indexOf(":"),n=o.substring(0,u).trim().toLowerCase(),r=o.substring(u+1).trim(),!(!n||t[n]&&pn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},ut=Symbol("internals");function W(e){return e&&String(e).trim().toLowerCase()}function ae(e){return e===!1||e==null?e:i.isArray(e)?e.map(ae):String(e)}function mn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const yn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Se(e,t,n,r,u){if(i.isFunction(r))return r.call(this,t,n);if(u&&(t=n),!!i.isString(t)){if(i.isString(r))return t.indexOf(r)!==-1;if(i.isRegExp(r))return r.test(t)}}function gn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function An(e,t){const n=i.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(u,s,o){return this[r].call(this,t,u,s,o)},configurable:!0})})}class ce{constructor(t){t&&this.set(t)}set(t,n,r){const u=this;function s(a,p,c){const d=W(p);if(!d)throw new Error("header name must be a non-empty string");const E=i.findKey(u,d);(!E||u[E]===void 0||c===!0||c===void 0&&u[E]!==!1)&&(u[E||p]=ae(a))}const o=(a,p)=>i.forEach(a,(c,d)=>s(c,d,p));return i.isPlainObject(t)||t instanceof this.constructor?o(t,n):i.isString(t)&&(t=t.trim())&&!yn(t)?o(En(t),n):t!=null&&s(n,t,r),this}get(t,n){if(t=W(t),t){const r=i.findKey(this,t);if(r){const u=this[r];if(!n)return u;if(n===!0)return mn(u);if(i.isFunction(n))return n.call(this,u,r);if(i.isRegExp(n))return n.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=W(t),t){const r=i.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Se(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let u=!1;function s(o){if(o=W(o),o){const a=i.findKey(r,o);a&&(!n||Se(r,r[a],a,n))&&(delete r[a],u=!0)}}return i.isArray(t)?t.forEach(s):s(t),u}clear(t){const n=Object.keys(this);let r=n.length,u=!1;for(;r--;){const s=n[r];(!t||Se(this,this[s],s,t,!0))&&(delete this[s],u=!0)}return u}normalize(t){const n=this,r={};return i.forEach(this,(u,s)=>{const o=i.findKey(r,s);if(o){n[o]=ae(u),delete n[s];return}const a=t?gn(s):String(s).trim();a!==s&&delete n[s],n[a]=ae(u),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return i.forEach(this,(r,u)=>{r!=null&&r!==!1&&(n[u]=t&&i.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(u=>r.set(u)),r}static accessor(t){const r=(this[ut]=this[ut]={accessors:{}}).accessors,u=this.prototype;function s(o){const a=W(o);r[a]||(An(u,o),r[a]=!0)}return i.isArray(t)?t.forEach(s):s(t),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),i.freezeMethods(ce.prototype),i.freezeMethods(ce);const L=ce;function we(e,t){const n=this||Ce,r=t||n,u=L.from(r.headers);let s=r.data;return i.forEach(e,function(a){s=a.call(n,s,u.normalize(),t?t.status:void 0)}),u.normalize(),s}function st(e){return!!(e&&e.__CANCEL__)}function G(e,t,n){A.call(this,e??"canceled",A.ERR_CANCELED,t,n),this.name="CanceledError"}i.inherits(G,A,{__CANCEL__:!0});function bn(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new A("Request failed with status code "+n.status,[A.ERR_BAD_REQUEST,A.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const Fn=O.isStandardBrowserEnv?function(){return{write:function(n,r,u,s,o,a){const p=[];p.push(n+"="+encodeURIComponent(r)),i.isNumber(u)&&p.push("expires="+new Date(u).toGMTString()),i.isString(s)&&p.push("path="+s),i.isString(o)&&p.push("domain="+o),a===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Cn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Sn(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function ot(e,t){return e&&!Cn(t)?Sn(e,t):t}const wn=O.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function u(s){let o=s;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=u(window.location.href),function(o){const a=i.isString(o)?u(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function Dn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Bn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let u=0,s=0,o;return t=t!==void 0?t:1e3,function(p){const c=Date.now(),d=r[s];o||(o=c),n[u]=p,r[u]=c;let E=s,b=0;for(;E!==u;)b+=n[E++],E=E%e;if(u=(u+1)%e,u===s&&(s=(s+1)%e),c-o<t)return;const h=d&&c-d;return h?Math.round(b*1e3/h):void 0}}function it(e,t){let n=0;const r=Bn(50,250);return u=>{const s=u.loaded,o=u.lengthComputable?u.total:void 0,a=s-n,p=r(a),c=s<=o;n=s;const d={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:p||void 0,estimated:p&&o&&c?(o-s)/p:void 0,event:u};d[t?"download":"upload"]=!0,e(d)}}const le={http:Zt,xhr:typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){let u=e.data;const s=L.from(e.headers).normalize(),o=e.responseType;let a;function p(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}i.isFormData(u)&&(O.isStandardBrowserEnv||O.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const h=e.auth.username||"",l=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(h+":"+l))}const d=ot(e.baseURL,e.url);c.open(e.method.toUpperCase(),et(d,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function E(){if(!c)return;const h=L.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders()),f={data:!o||o==="text"||o==="json"?c.responseText:c.response,status:c.status,statusText:c.statusText,headers:h,config:e,request:c};bn(function(g){n(g),p()},function(g){r(g),p()},f),c=null}if("onloadend"in c?c.onloadend=E:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(E)},c.onabort=function(){c&&(r(new A("Request aborted",A.ECONNABORTED,e,c)),c=null)},c.onerror=function(){r(new A("Network Error",A.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let l=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const f=e.transitional||nt;e.timeoutErrorMessage&&(l=e.timeoutErrorMessage),r(new A(l,f.clarifyTimeoutError?A.ETIMEDOUT:A.ECONNABORTED,e,c)),c=null},O.isStandardBrowserEnv){const h=(e.withCredentials||wn(d))&&e.xsrfCookieName&&Fn.read(e.xsrfCookieName);h&&s.set(e.xsrfHeaderName,h)}u===void 0&&s.setContentType(null),"setRequestHeader"in c&&i.forEach(s.toJSON(),function(l,f){c.setRequestHeader(f,l)}),i.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),o&&o!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",it(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",it(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=h=>{c&&(r(!h||h.type?new G(null,e,c):h),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const b=Dn(d);if(b&&O.protocols.indexOf(b)===-1){r(new A("Unsupported protocol "+b+":",A.ERR_BAD_REQUEST,e));return}c.send(u||null)})}};i.forEach(le,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Tn={getAdapter:e=>{e=i.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let u=0;u<t&&(n=e[u],!(r=i.isString(n)?le[n.toLowerCase()]:n));u++);if(!r)throw r===!1?new A(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(i.hasOwnProp(le,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`);if(!i.isFunction(r))throw new TypeError("adapter is not a function");return r},adapters:le};function De(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new G(null,e)}function at(e){return De(e),e.headers=L.from(e.headers),e.data=we.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Tn.getAdapter(e.adapter||Ce.adapter)(e).then(function(r){return De(e),r.data=we.call(e,e.transformResponse,r),r.headers=L.from(r.headers),r},function(r){return st(r)||(De(e),r&&r.response&&(r.response.data=we.call(e,e.transformResponse,r.response),r.response.headers=L.from(r.response.headers))),Promise.reject(r)})}const ct=e=>e instanceof L?e.toJSON():e;function z(e,t){t=t||{};const n={};function r(c,d,E){return i.isPlainObject(c)&&i.isPlainObject(d)?i.merge.call({caseless:E},c,d):i.isPlainObject(d)?i.merge({},d):i.isArray(d)?d.slice():d}function u(c,d,E){if(i.isUndefined(d)){if(!i.isUndefined(c))return r(void 0,c,E)}else return r(c,d,E)}function s(c,d){if(!i.isUndefined(d))return r(void 0,d)}function o(c,d){if(i.isUndefined(d)){if(!i.isUndefined(c))return r(void 0,c)}else return r(void 0,d)}function a(c,d,E){if(E in t)return r(c,d);if(E in e)return r(void 0,c)}const p={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,d)=>u(ct(c),ct(d),!0)};return i.forEach(Object.keys(e).concat(Object.keys(t)),function(d){const E=p[d]||u,b=E(e[d],t[d],d);i.isUndefined(b)&&E!==a||(n[d]=b)}),n}const lt="1.3.6",Be={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Be[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ft={};Be.transitional=function(t,n,r){function u(s,o){return"[Axios v"+lt+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(t===!1)throw new A(u(o," has been removed"+(n?" in "+n:"")),A.ERR_DEPRECATED);return n&&!ft[o]&&(ft[o]=!0,console.warn(u(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,a):!0}};function Rn(e,t,n){if(typeof e!="object")throw new A("options must be an object",A.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let u=r.length;for(;u-- >0;){const s=r[u],o=t[s];if(o){const a=e[s],p=a===void 0||o(a,s,e);if(p!==!0)throw new A("option "+s+" must be "+p,A.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new A("Unknown option "+s,A.ERR_BAD_OPTION)}}const Te={assertOptions:Rn,validators:Be},j=Te.validators;class fe{constructor(t){this.defaults=t,this.interceptors={request:new tt,response:new tt}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=z(this.defaults,n);const{transitional:r,paramsSerializer:u,headers:s}=n;r!==void 0&&Te.assertOptions(r,{silentJSONParsing:j.transitional(j.boolean),forcedJSONParsing:j.transitional(j.boolean),clarifyTimeoutError:j.transitional(j.boolean)},!1),u!=null&&(i.isFunction(u)?n.paramsSerializer={serialize:u}:Te.assertOptions(u,{encode:j.function,serialize:j.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o;o=s&&i.merge(s.common,s[n.method]),o&&i.forEach(["delete","get","head","post","put","patch","common"],l=>{delete s[l]}),n.headers=L.concat(o,s);const a=[];let p=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(n)===!1||(p=p&&f.synchronous,a.unshift(f.fulfilled,f.rejected))});const c=[];this.interceptors.response.forEach(function(f){c.push(f.fulfilled,f.rejected)});let d,E=0,b;if(!p){const l=[at.bind(this),void 0];for(l.unshift.apply(l,a),l.push.apply(l,c),b=l.length,d=Promise.resolve(n);E<b;)d=d.then(l[E++],l[E++]);return d}b=a.length;let h=n;for(E=0;E<b;){const l=a[E++],f=a[E++];try{h=l(h)}catch(y){f.call(this,y);break}}try{d=at.call(this,h)}catch(l){return Promise.reject(l)}for(E=0,b=c.length;E<b;)d=d.then(c[E++],c[E++]);return d}getUri(t){t=z(this.defaults,t);const n=ot(t.baseURL,t.url);return et(n,t.params,t.paramsSerializer)}}i.forEach(["delete","get","head","options"],function(t){fe.prototype[t]=function(n,r){return this.request(z(r||{},{method:t,url:n,data:(r||{}).data}))}}),i.forEach(["post","put","patch"],function(t){function n(r){return function(s,o,a){return this.request(z(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}fe.prototype[t]=n(),fe.prototype[t+"Form"]=n(!0)});const de=fe;class Re{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(u=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](u);r._listeners=null}),this.promise.then=u=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(u);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,a){r.reason||(r.reason=new G(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Re(function(u){t=u}),cancel:t}}}const On=Re;function xn(e){return function(n){return e.apply(null,n)}}function Nn(e){return i.isObject(e)&&e.isAxiosError===!0}const Oe={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(Oe).forEach(([e,t])=>{Oe[t]=e});const Pn=Oe;function dt(e){const t=new de(e),n=je(de.prototype.request,t);return i.extend(n,de.prototype,t,{allOwnKeys:!0}),i.extend(n,t,null,{allOwnKeys:!0}),n.create=function(u){return dt(z(e,u))},n}const S=dt(Ce);S.Axios=de,S.CanceledError=G,S.CancelToken=On,S.isCancel=st,S.VERSION=lt,S.toFormData=oe,S.AxiosError=A,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=xn,S.isAxiosError=Nn,S.mergeConfig=z,S.AxiosHeaders=L,S.formToJSON=e=>rt(i.isHTMLForm(e)?new FormData(e):e),S.HttpStatusCode=Pn,S.default=S;const vn=S,Ln="https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address",Un={"Content-Type":"application/json",Accept:"application/json"},ht=async e=>{const t=e.url??Ln,n=e.count??10;let r={query:e.query,count:n};e.toBound&&(r={...r,to_bound:{value:e.toBound}}),e.fromBound&&(r={...r,from_bound:{value:e.fromBound}}),e.locationOptions&&(r={...r,language:e.locationOptions.language,locations:e.locationOptions.locations,locations_boost:e.locationOptions.locationsBoost});const u={headers:{...Un,Authorization:`Token ${e.token}`}},{data:{suggestions:s}}=await vn.post(t,r,u);return s},kn=(e,t)=>{const n=m.computed({get:()=>e.modelValue,set:F=>t("update:modelValue",F)}),r=m.computed({get:()=>e.suggestion,set:F=>t("update:suggestion",F)}),u=m.ref(!1),s=m.ref(!0),o=m.ref(-1),a=m.ref([]),p=m.ref(void 0),c=async F=>{try{const D={token:e.token,query:n.value,url:e.url,toBound:e.toBound,fromBound:e.fromBound,locationOptions:e.locationOptions,count:F};return ht(D)}catch(D){return t("handleError",D),new Promise(x=>{x([])})}},d=ne.debounce(async()=>{a.value=await c()},e.debounceWait);m.watch(n,async()=>{d()});const E=()=>{e.disabled||(s.value=!1,o.value=-1)},b=F=>{e.disabled||a.value.length>=F-1&&(n.value=a.value[F].value,p.value=a.value[F],r.value=a.value[F])},h=()=>{e.disabled||(s.value=!0)},l=m.computed(()=>o.value<a.value.length-1),f=m.computed(()=>o.value>=0),y=m.computed(()=>f.value&&l.value);return{queryProxy:n,suggestionProxy:r,inputFocused:u,suggestionsVisible:s,suggestionIndex:o,suggestionList:a,onInputChange:h,onKeyPress:(F,D)=>{e.disabled||(F.preventDefault(),D===_.Enter&&y.value&&(b(o.value),E()),D===_.Esc&&(s.value=!1),D===_.Up&&f.value&&(o.value-=1),D===_.Down&&l.value&&(o.value+=1))},onInputFocus:()=>{e.disabled||(u.value=!0)},onInputBlur:()=>{var F;e.disabled||(e.autocomplete&&(n.value=p.value?(F=p.value)==null?void 0:F.value:""),u.value=!1)},onSuggestionClick:F=>{e.disabled||(b(F),E())}}},In=m.defineComponent({name:"VueDadata",components:{WordHighlighter:mt},props:{token:{type:String,required:!0},modelValue:{type:String,required:!0},suggestion:{type:Object,default:()=>{}},placeholder:{type:String,default:""},url:{type:String,default:void 0},debounceWait:{type:String||Number,default:"1000ms"},disabled:{type:Boolean,default:!1},fromBound:{type:String,default:void 0},toBound:{type:String,default:void 0},inputName:{type:String,default:"vue-dadata-input"},locationOptions:{type:Object,default:void 0},classes:{type:Object,default:()=>I},highlightOptions:{type:Object,default:()=>N},autocomplete:{type:Boolean,default:!1}},emits:["update:modelValue","update:suggestion","handleError"],setup(e,{emit:t}){const n=gt(e.classes),r=At(e.highlightOptions),{queryProxy:u,suggestionProxy:s,inputFocused:o,suggestionsVisible:a,suggestionIndex:p,suggestionList:c,onInputChange:d,onKeyPress:E,onInputFocus:b,onInputBlur:h,onSuggestionClick:l}=kn(e,t);return{KeyEvent:_,queryProxy:u,suggestionProxy:s,inputFocused:o,suggestionsVisible:a,suggestionList:c,proxyClasses:n,proxyHighlightOptions:r,suggestionIndex:p,onInputChange:d,onKeyPress:E,onInputFocus:b,onInputBlur:h,onSuggestionClick:l}}}),Vn="",jn=(e,t)=>{const n=e.__vccOpts||e;for(const[r,u]of t)n[r]=u;return n},qn=["name","disabled","placeholder"];function _n(e,t,n,r,u,s){const o=m.resolveComponent("word-highlighter");return m.openBlock(),m.createElementBlock("div",{class:m.normalizeClass(e.proxyClasses.container)},[m.createElementVNode("div",{class:m.normalizeClass(e.proxyClasses.search)},[m.withDirectives(m.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>e.queryProxy=a),type:"text",name:e.inputName,class:m.normalizeClass(e.proxyClasses.input),disabled:e.disabled,placeholder:e.placeholder,onInput:t[1]||(t[1]=(...a)=>e.onInputChange&&e.onInputChange(...a)),onKeyup:[t[2]||(t[2]=m.withKeys(a=>e.onKeyPress(a,e.KeyEvent.Enter),["enter"])),t[3]||(t[3]=m.withKeys(a=>e.onKeyPress(a,e.KeyEvent.Esc),["esc"])),t[4]||(t[4]=m.withKeys(a=>e.onKeyPress(a,e.KeyEvent.Up),["up"])),t[5]||(t[5]=m.withKeys(a=>e.onKeyPress(a,e.KeyEvent.Down),["down"]))],onFocus:t[6]||(t[6]=(...a)=>e.onInputFocus&&e.onInputFocus(...a)),onBlur:t[7]||(t[7]=(...a)=>e.onInputBlur&&e.onInputBlur(...a))},null,42,qn),[[m.vModelText,e.queryProxy]])],2),e.inputFocused&&e.suggestionsVisible&&!e.disabled?(m.openBlock(),m.createElementBlock("div",{key:0,class:m.normalizeClass(e.proxyClasses.suggestions)},[m.renderSlot(e.$slots,"suggestions",{suggestionList:e.suggestionList,suggestionIndex:e.suggestionIndex,query:e.queryProxy,suggestion:e.suggestionProxy},()=>[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(e.suggestionList,(a,p)=>(m.openBlock(),m.createBlock(o,m.mergeProps({key:`suggestion_${p}`},e.proxyHighlightOptions,{"wrapper-class":e.proxyClasses.suggestionItem,class:p===e.suggestionIndex?e.proxyClasses.suggestionCurrentItem:"",query:e.queryProxy,"text-to-highlight":a.value,onMousedown:c=>e.onSuggestionClick(p)}),null,16,["wrapper-class","class","query","text-to-highlight","onMousedown"]))),128))])],2)):m.createCommentVNode("",!0)],2)}const Hn=jn(In,[["render",_n]]);R.BOUNDS=yt,R.DEFAULT_CLASSES=I,R.DEFAULT_HIGHLIGHT_OPTIONS=N,R.KeyEvent=_,R.VueDadata=Hn,R.getSuggestions=ht,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});