// Deployed: 2025-07-02T16:59:09.731Z
// Version: 1.0.47
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".village-iframe{width:100%;height:100%;border:none;display:block;position:fixed;top:0;left:0;z-index:2147483647;background:#0000003d;color-scheme:light}.village-iframe.village-loading{display:flex;justify-content:center;align-items:center}.village-iframe>.village-spinner{width:1.5rem;height:1.5rem;border:2px solid #000;border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;animation:spin .45s linear infinite}.village-iframe.village-hidden{display:none}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.village-hidden{display:none}[village-paths-data=facepiles]{display:flex;align-items:center;padding-right:.5rem}[village-paths-data=facepiles] img{width:1.5rem;height:1.5rem;border-radius:50%;margin-right:-.5rem}[village-paths-data=facepiles] img.village-facepiler-avatar-not-found{filter:blur(7px)}[village-paths-data=facepiles] img:last-child{margin-right:0}[village-paths-data=count]{padding-right:.25rem}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
(function(Oe){"use strict";const j="village-data-url",V="village-module",q={SYNC:"sync",SEARCH:"search",PATHS:"paths"};function ce({token:t,partnerKey:e,userReference:n,url:r,module:s,config:i}){const o=new URLSearchParams;t&&o.append("token",t),r&&o.append("url",encodeURIComponent(r)),e&&o.append("partnerKey",e),n&&o.append("userReference",n),s&&o.append("module",s);let a="[]";typeof i<"u"&&typeof i.paths_cta<"u"&&(a=JSON.stringify(i.paths_cta));const u=encodeURIComponent(a);return o.append("paths_cta",u),`https://village.do/widget?${o.toString()}`}function yt(t,e){t.innerHTML="";const n=document.createElement("iframe");return n.src=ce({...e,module:"search"}),n.style.width="100%",n.style.height="100%",n.style.border="none",n.style.display="block",t.appendChild(n),n}class gt{constructor(){this.element=document.createElement("iframe"),this.element.className="village-iframe village-hidden",this.spinner=document.createElement("div"),this.spinner.className="village-iframe village-hidden village-loading",this.spinner.innerHTML='<div class="village-spinner"></div>'}update(e){this.element.src=ce(e);const n=e.url||e.module;this.element.className=n?"village-iframe":"village-iframe village-hidden",this.spinner.className=n?"village-iframe village-loading":"village-iframe village-hidden village-loading"}render(e){this.element.parentNode||(e.appendChild(this.spinner),e.appendChild(this.element))}hideSpinner(){this.spinner.className="village-iframe village-hidden village-loading"}}/*! js-cookie v3.0.5 | MIT */function G(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var Rt={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function ue(t,e){function n(s,i,o){if(!(typeof document>"u")){o=G({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var u in o)o[u]&&(a+="; "+u,o[u]!==!0&&(a+="="+o[u].split(";")[0]));return document.cookie=s+"="+t.write(i,s)+a}}function r(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],o={},a=0;a<i.length;a++){var u=i[a].split("="),c=u.slice(1).join("=");try{var d=decodeURIComponent(u[0]);if(o[d]=t.read(c,d),s===d)break}catch{}}return s?o[s]:o}}return Object.create({set:n,get:r,remove:function(s,i){n(s,"",G({},i,{expires:-1}))},withAttributes:function(s){return ue(this.converter,G({},this.attributes,s))},withConverter:function(s){return ue(G({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var P=ue(Rt,{path:"/"});class bt{constructor(e){this.app=e,this.handlers={VILLAGE_OAUTH_REQUEST:this.handleOAuthRequest.bind(this),VILLAGE_OAUTH_SUCCESS:this.handleOAuthSuccess.bind(this),VILLAGE_OAUTH_ERROR:this.handleOAuthError.bind(this),VILLAGE_REMOVE_IFRAME:this.handleRemoveIframe.bind(this),VILLAGE_IFRAME_LOADED:this.handleIframeLoaded.bind(this),VILLAGE_COPY_TO_CLIPBOARD:this.handleCopyToClipboard.bind(this)},this.app.oauthPopupRef=null}handle(e){if(!e.data.type||!e.data.type.startsWith("VILLAGE_"))return;const n=this.handlers[e.data.type];if(n){if((e.data.type==="VILLAGE_OAUTH_SUCCESS"||e.data.type==="VILLAGE_OAUTH_ERROR")&&e.source!==this.app.oauthPopupRef){this.app.oauthPopupRef&&this.app.oauthPopupRef.closed&&(this.app.oauthPopupRef=null);return}n(e.data,e.source)}}handleOAuthRequest(e){const{isAuthorizationFlow:n}=e,r=`https://village.do/widget/${n?"resolve-auth":"oauth"}`,s=new URLSearchParams;this.app.partnerKey&&s.append("partnerKey",this.app.partnerKey),this.app.userReference&&s.append("userReference",this.app.userReference);const i=s.toString()?`${r}?${s.toString()}`:r;this.app.oauthPopupRef=window.open(i,"paas-oauth","popup=true,width=500,height=600");const o=setInterval(()=>{this.app.oauthPopupRef&&this.app.oauthPopupRef.closed?(clearInterval(o),this.app.oauthPopupRef=null):this.app.oauthPopupRef||clearInterval(o)},1e3)}handleOAuthSuccess(e){P.set("village.token",e.token,{secure:!0,expires:60}),this.app.handleOAuthSuccess(e),this.app.oauthPopupRef&&!this.app.oauthPopupRef.closed?(this.app.oauthPopupRef.postMessage({type:"VILLAGE_OAUTH_ACKNOWLEDGED"},"https://village.do"),this.app.oauthPopupRef=null):this.app.oauthPopupRef=null}handleOAuthError(e){alert(`Sorry, something went wrong during authentication: ${(e==null?void 0:e.error)||"Unknown error"}`),this.app.oauthPopupRef&&(this.app.oauthPopupRef=null)}handleRemoveIframe(){this.app.url=null,this.app.module=null,this.app.renderIframe()}handleIframeLoaded(){this.app.iframe.hideSpinner()}handleCopyToClipboard(e){navigator.clipboard.writeText(e.text)}}const Et=`
background: linear-gradient(90deg, rgba(255, 0, 0, 1) 0%, rgba(255, 165, 0, 1) 100%);
color: white;
font-weight: bold;
padding: 8px 12px;
font-size: 16px;
border-radius: 4px;
display: inline-block;
`,Te=`
font-size: 18px;
color: #ff4500;
margin: 8px 0;
font-weight: bold;
text-align: center;
`;function Ue(t,e={}){console.log("%cVILLAGE-PAAS ERROR",Et),console.log("%c────────────────────────",Te);const n=[{label:"ERROR MESSAGE",value:t.message},{label:"STACK TRACE",value:t.stack},{label:"CONTEXT",value:JSON.stringify(e,null,2)}];for(const{label:r,value:s}of n)console.log("%c"+r,"padding: 4px; font-weight: bold;"),console.log("%c"+s,"padding: 4px;");console.log("%c────────────────────────",Te)}const A=[];for(let t=0;t<256;++t)A.push((t+256).toString(16).slice(1));function wt(t,e=0){return(A[t[e+0]]+A[t[e+1]]+A[t[e+2]]+A[t[e+3]]+"-"+A[t[e+4]]+A[t[e+5]]+"-"+A[t[e+6]]+A[t[e+7]]+"-"+A[t[e+8]]+A[t[e+9]]+"-"+A[t[e+10]]+A[t[e+11]]+A[t[e+12]]+A[t[e+13]]+A[t[e+14]]+A[t[e+15]]).toLowerCase()}let de;const St=new Uint8Array(16);function At(){if(!de){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");de=crypto.getRandomValues.bind(crypto)}return de(St)}const ke={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function _t(t,e,n){var s;if(ke.randomUUID&&!t)return ke.randomUUID();t=t||{};const r=t.random??((s=t.rng)==null?void 0:s.call(t))??At();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,wt(r)}function xe(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ct}=Object.prototype,{getPrototypeOf:fe}=Object,X=(t=>e=>{const n=Ct.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),U=t=>(t=t.toLowerCase(),e=>X(e)===t),Q=t=>e=>typeof e===t,{isArray:B}=Array,$=Q("undefined");function Ot(t){return t!==null&&!$(t)&&t.constructor!==null&&!$(t.constructor)&&T(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Le=U("ArrayBuffer");function Tt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Le(t.buffer),e}const Ut=Q("string"),T=Q("function"),Pe=Q("number"),Y=t=>t!==null&&typeof t=="object",kt=t=>t===!0||t===!1,Z=t=>{if(X(t)!=="object")return!1;const e=fe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},xt=U("Date"),Lt=U("File"),Pt=U("Blob"),It=U("FileList"),vt=t=>Y(t)&&T(t.pipe),Nt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||T(t.append)&&((e=X(t))==="formdata"||e==="object"&&T(t.toString)&&t.toString()==="[object FormData]"))},Dt=U("URLSearchParams"),[qt,Bt,Ft,Mt]=["ReadableStream","Request","Response","Headers"].map(U),Ht=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function K(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),B(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let a;for(r=0;r<o;r++)a=i[r],e.call(null,t[a],a,t)}}function Ie(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const I=typeof globalThis<"u"?globalThis:typeof self<"u"?self:window,ve=t=>!$(t)&&t!==I;function he(){const{caseless:t}=ve(this)&&this||{},e={},n=(r,s)=>{const i=t&&Ie(e,s)||s;Z(e[i])&&Z(r)?e[i]=he(e[i],r):Z(r)?e[i]=he({},r):B(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&K(arguments[r],n);return e}const jt=(t,e,n,{allOwnKeys:r}={})=>(K(e,(s,i)=>{n&&T(s)?t[i]=xe(s,n):t[i]=s},{allOwnKeys:r}),t),Vt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),$t=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Kt=(t,e,n,r)=>{let s,i,o;const a={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!r||r(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=n!==!1&&fe(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},zt=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Wt=t=>{if(!t)return null;if(B(t))return t;let e=t.length;if(!Pe(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Jt=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&fe(Uint8Array)),Gt=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Xt=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Qt=U("HTMLFormElement"),Yt=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ne=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Zt=U("RegExp"),De=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};K(n,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(r[i]=o||s)}),Object.defineProperties(t,r)},en=t=>{De(t,(e,n)=>{if(T(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(T(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},tn=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return B(t)?r(t):r(String(t).split(e)),n},nn=()=>{},rn=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function sn(t){return!!(t&&T(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const on=t=>{const e=new Array(10),n=(r,s)=>{if(Y(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const i=B(r)?[]:{};return K(r,(o,a)=>{const u=n(o,s+1);!$(u)&&(i[a]=u)}),e[s]=void 0,i}}return r};return n(t,0)},an=U("AsyncFunction"),ln=t=>t&&(Y(t)||T(t))&&T(t.then)&&T(t.catch),qe=((t,e)=>t?setImmediate:e?((n,r)=>(I.addEventListener("message",({source:s,data:i})=>{s===I&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),I.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",T(I.postMessage)),cn=typeof queueMicrotask<"u"?queueMicrotask.bind(I):typeof process<"u"&&process.nextTick||qe,l={isArray:B,isArrayBuffer:Le,isBuffer:Ot,isFormData:Nt,isArrayBufferView:Tt,isString:Ut,isNumber:Pe,isBoolean:kt,isObject:Y,isPlainObject:Z,isReadableStream:qt,isRequest:Bt,isResponse:Ft,isHeaders:Mt,isUndefined:$,isDate:xt,isFile:Lt,isBlob:Pt,isRegExp:Zt,isFunction:T,isStream:vt,isURLSearchParams:Dt,isTypedArray:Jt,isFileList:It,forEach:K,merge:he,extend:jt,trim:Ht,stripBOM:Vt,inherits:$t,toFlatObject:Kt,kindOf:X,kindOfTest:U,endsWith:zt,toArray:Wt,forEachEntry:Gt,matchAll:Xt,isHTMLForm:Qt,hasOwnProperty:Ne,hasOwnProp:Ne,reduceDescriptors:De,freezeMethods:en,toObjectSet:tn,toCamelCase:Yt,noop:nn,toFiniteNumber:rn,findKey:Ie,global:I,isContextDefined:ve,isSpecCompliantForm:sn,toJSONObject:on,isAsyncFn:an,isThenable:ln,setImmediate:qe,asap:cn};function m(t,e,n,r,s){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),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}l.inherits(m,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:l.toJSONObject(this.config),code:this.code,status:this.status}}});const Be=m.prototype,Fe={};["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=>{Fe[t]={value:t}}),Object.defineProperties(m,Fe),Object.defineProperty(Be,"isAxiosError",{value:!0}),m.from=(t,e,n,r,s,i)=>{const o=Object.create(Be);return l.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),m.call(o,t.message,e,n,r,s),o.cause=t,o.name=t.name,i&&Object.assign(o,i),o};const un=null;function pe(t){return l.isPlainObject(t)||l.isArray(t)}function Me(t){return l.endsWith(t,"[]")?t.slice(0,-2):t}function He(t,e,n){return t?t.concat(e).map(function(s,i){return s=Me(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function dn(t){return l.isArray(t)&&!t.some(pe)}const fn=l.toFlatObject(l,{},null,function(e){return/^is[A-Z]/.test(e)});function ee(t,e,n){if(!l.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=l.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,p){return!l.isUndefined(p[y])});const r=n.metaTokens,s=n.visitor||d,i=n.dots,o=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&l.isSpecCompliantForm(e);if(!l.isFunction(s))throw new TypeError("visitor must be a function");function c(h){if(h===null)return"";if(l.isDate(h))return h.toISOString();if(!u&&l.isBlob(h))throw new m("Blob is not supported. Use a Buffer instead.");return l.isArrayBuffer(h)||l.isTypedArray(h)?u&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function d(h,y,p){let b=h;if(h&&!p&&typeof h=="object"){if(l.endsWith(y,"{}"))y=r?y:y.slice(0,-2),h=JSON.stringify(h);else if(l.isArray(h)&&dn(h)||(l.isFileList(h)||l.endsWith(y,"[]"))&&(b=l.toArray(h)))return y=Me(y),b.forEach(function(S,x){!(l.isUndefined(S)||S===null)&&e.append(o===!0?He([y],x,i):o===null?y:y+"[]",c(S))}),!1}return pe(h)?!0:(e.append(He(p,y,i),c(h)),!1)}const f=[],g=Object.assign(fn,{defaultVisitor:d,convertValue:c,isVisitable:pe});function E(h,y){if(!l.isUndefined(h)){if(f.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));f.push(h),l.forEach(h,function(b,w){(!(l.isUndefined(b)||b===null)&&s.call(e,b,l.isString(w)?w.trim():w,y,g))===!0&&E(b,y?y.concat(w):[w])}),f.pop()}}if(!l.isObject(t))throw new TypeError("data must be an object");return E(t),e}function je(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function me(t,e){this._pairs=[],t&&ee(t,this,e)}const Ve=me.prototype;Ve.append=function(e,n){this._pairs.push([e,n])},Ve.toString=function(e){const n=e?function(r){return e.call(this,r,je)}:je;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function hn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $e(t,e,n){if(!e)return t;const r=n&&n.encode||hn;l.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=l.isURLSearchParams(e)?e.toString():new me(e,n).toString(r),i){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Ke{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){l.forEach(this.handlers,function(r){r!==null&&e(r)})}}const ze={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},pn={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:me,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ye=typeof window<"u"&&typeof document<"u",ge=typeof navigator=="object"&&navigator||void 0,mn=ye&&(!ge||["ReactNative","NativeScript","NS"].indexOf(ge.product)<0),yn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gn=ye&&window.location.href||"http://localhost",_={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ye,hasStandardBrowserEnv:mn,hasStandardBrowserWebWorkerEnv:yn,navigator:ge,origin:gn},Symbol.toStringTag,{value:"Module"})),...pn};function Rn(t,e){return ee(t,new _.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return _.isNode&&l.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function bn(t){return l.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function En(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function We(t){function e(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),u=i>=n.length;return o=!o&&l.isArray(s)?s.length:o,u?(l.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!l.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],i)&&l.isArray(s[o])&&(s[o]=En(s[o])),!a)}if(l.isFormData(t)&&l.isFunction(t.entries)){const n={};return l.forEachEntry(t,(r,s)=>{e(bn(r),s,n,0)}),n}return null}function wn(t,e,n){if(l.isString(t))try{return(e||JSON.parse)(t),l.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const z={transitional:ze,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=l.isObject(e);if(i&&l.isHTMLForm(e)&&(e=new FormData(e)),l.isFormData(e))return s?JSON.stringify(We(e)):e;if(l.isArrayBuffer(e)||l.isBuffer(e)||l.isStream(e)||l.isFile(e)||l.isBlob(e)||l.isReadableStream(e))return e;if(l.isArrayBufferView(e))return e.buffer;if(l.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Rn(e,this.formSerializer).toString();if((a=l.isFileList(e))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return ee(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),wn(e)):e}],transformResponse:[function(e){const n=this.transitional||z.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(l.isResponse(e)||l.isReadableStream(e))return e;if(e&&l.isString(e)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?m.from(a,m.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_.classes.FormData,Blob:_.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(["delete","get","head","post","put","patch"],t=>{z.headers[t]={}});const Sn=l.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"]),An=t=>{const e={};let n,r,s;return t&&t.split(`
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||e[n]&&Sn[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Je=Symbol("internals");function W(t){return t&&String(t).trim().toLowerCase()}function te(t){return t===!1||t==null?t:l.isArray(t)?t.map(te):String(t)}function _n(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const Cn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Re(t,e,n,r,s){if(l.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!l.isString(e)){if(l.isString(r))return e.indexOf(r)!==-1;if(l.isRegExp(r))return r.test(e)}}function On(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Tn(t,e){const n=l.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}let C=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(a,u,c){const d=W(u);if(!d)throw new Error("header name must be a non-empty string");const f=l.findKey(s,d);(!f||s[f]===void 0||c===!0||c===void 0&&s[f]!==!1)&&(s[f||u]=te(a))}const o=(a,u)=>l.forEach(a,(c,d)=>i(c,d,u));if(l.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(l.isString(e)&&(e=e.trim())&&!Cn(e))o(An(e),n);else if(l.isHeaders(e))for(const[a,u]of e.entries())i(u,a,r);else e!=null&&i(n,e,r);return this}get(e,n){if(e=W(e),e){const r=l.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return _n(s);if(l.isFunction(n))return n.call(this,s,r);if(l.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=W(e),e){const r=l.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Re(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(o){if(o=W(o),o){const a=l.findKey(r,o);a&&(!n||Re(r,r[a],a,n))&&(delete r[a],s=!0)}}return l.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||Re(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return l.forEach(this,(s,i)=>{const o=l.findKey(r,i);if(o){n[o]=te(s),delete n[i];return}const a=e?On(i):String(i).trim();a!==i&&delete n[i],n[a]=te(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return l.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&l.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[Je]=this[Je]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=W(o);r[a]||(Tn(s,o),r[a]=!0)}return l.isArray(e)?e.forEach(i):i(e),this}};C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.reduceDescriptors(C.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),l.freezeMethods(C);function be(t,e){const n=this||z,r=e||n,s=C.from(r.headers);let i=r.data;return l.forEach(t,function(a){i=a.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Ge(t){return!!(t&&t.__CANCEL__)}function F(t,e,n){m.call(this,t??"canceled",m.ERR_CANCELED,e,n),this.name="CanceledError"}l.inherits(F,m,{__CANCEL__:!0});function Xe(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new m("Request failed with status code "+n.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Un(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function kn(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(u){const c=Date.now(),d=r[i];o||(o=c),n[s]=u,r[s]=c;let f=i,g=0;for(;f!==s;)g+=n[f++],f=f%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),c-o<e)return;const E=d&&c-d;return E?Math.round(g*1e3/E):void 0}}function xn(t,e){let n=0,r=1e3/e,s,i;const o=(c,d=Date.now())=>{n=d,s=null,i&&(clearTimeout(i),i=null),t.apply(null,c)};return[(...c)=>{const d=Date.now(),f=d-n;f>=r?o(c,d):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const ne=(t,e,n=3)=>{let r=0;const s=kn(50,250);return xn(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,u=o-r,c=s(u),d=o<=a;r=o;const f={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:c||void 0,estimated:c&&a&&d?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(f)},n)},Qe=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ye=t=>(...e)=>l.asap(()=>t(...e)),Ln=_.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,_.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(_.origin),_.navigator&&/(msie|trident)/i.test(_.navigator.userAgent)):()=>!0,Pn=_.hasStandardBrowserEnv?{write(t,e,n,r,s,i){const o=[t+"="+encodeURIComponent(e)];l.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),l.isString(r)&&o.push("path="+r),l.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.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(){return null},remove(){}};function In(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function vn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ze(t,e,n){let r=!In(e);return t&&(r||n==!1)?vn(t,e):e}const et=t=>t instanceof C?{...t}:t;function v(t,e){e=e||{};const n={};function r(c,d,f,g){return l.isPlainObject(c)&&l.isPlainObject(d)?l.merge.call({caseless:g},c,d):l.isPlainObject(d)?l.merge({},d):l.isArray(d)?d.slice():d}function s(c,d,f,g){if(l.isUndefined(d)){if(!l.isUndefined(c))return r(void 0,c,f,g)}else return r(c,d,f,g)}function i(c,d){if(!l.isUndefined(d))return r(void 0,d)}function o(c,d){if(l.isUndefined(d)){if(!l.isUndefined(c))return r(void 0,c)}else return r(void 0,d)}function a(c,d,f){if(f in e)return r(c,d);if(f in t)return r(void 0,c)}const u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken: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,f)=>s(et(c),et(d),f,!0)};return l.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=u[d]||s,g=f(t[d],e[d],d);l.isUndefined(g)&&f!==a||(n[d]=g)}),n}const tt=t=>{const e=v({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;e.headers=o=C.from(o),e.url=$e(Ze(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(l.isFormData(n)){if(_.hasStandardBrowserEnv||_.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[c,...d]=u?u.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...d].join("; "))}}if(_.hasStandardBrowserEnv&&(r&&l.isFunction(r)&&(r=r(e)),r||r!==!1&&Ln(e.url))){const c=s&&i&&Pn.read(i);c&&o.set(s,c)}return e},Nn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){const s=tt(t);let i=s.data;const o=C.from(s.headers).normalize();let{responseType:a,onUploadProgress:u,onDownloadProgress:c}=s,d,f,g,E,h;function y(){E&&E(),h&&h(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let p=new XMLHttpRequest;p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout;function b(){if(!p)return;const S=C.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:S,config:t,request:p};Xe(function(D){n(D),y()},function(D){r(D),y()},O),p=null}"onloadend"in p?p.onloadend=b:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(b)},p.onabort=function(){p&&(r(new m("Request aborted",m.ECONNABORTED,t,p)),p=null)},p.onerror=function(){r(new m("Network Error",m.ERR_NETWORK,t,p)),p=null},p.ontimeout=function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||ze;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),r(new m(x,O.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,t,p)),p=null},i===void 0&&o.setContentType(null),"setRequestHeader"in p&&l.forEach(o.toJSON(),function(x,O){p.setRequestHeader(O,x)}),l.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),a&&a!=="json"&&(p.responseType=s.responseType),c&&([g,h]=ne(c,!0),p.addEventListener("progress",g)),u&&p.upload&&([f,E]=ne(u),p.upload.addEventListener("progress",f),p.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(d=S=>{p&&(r(!S||S.type?new F(null,t,p):S),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const w=Un(s.url);if(w&&_.protocols.indexOf(w)===-1){r(new m("Unsupported protocol "+w+":",m.ERR_BAD_REQUEST,t));return}p.send(i||null)})},Dn=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(c){if(!s){s=!0,a();const d=c instanceof Error?c:this.reason;r.abort(d instanceof m?d:new F(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,i(new m(`timeout ${e} of ms exceeded`,m.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),t=null)};t.forEach(c=>c.addEventListener("abort",i));const{signal:u}=r;return u.unsubscribe=()=>l.asap(a),u}},qn=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},Bn=async function*(t,e){for await(const n of Fn(t))yield*qn(n,e)},Fn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},nt=(t,e,n,r)=>{const s=Bn(t,e);let i=0,o,a=u=>{o||(o=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:c,value:d}=await s.next();if(c){a(),u.close();return}let f=d.byteLength;if(n){let g=i+=f;n(g)}u.enqueue(new Uint8Array(d))}catch(c){throw a(c),c}},cancel(u){return a(u),s.return()}},{highWaterMark:2})},re=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",rt=re&&typeof ReadableStream=="function",Mn=re&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),st=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Hn=rt&&st(()=>{let t=!1;const e=new Request(_.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),it=64*1024,Ee=rt&&st(()=>l.isReadableStream(new Response("").body)),se={stream:Ee&&(t=>t.body)};re&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!se[e]&&(se[e]=l.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new m(`Response type '${e}' is not supported`,m.ERR_NOT_SUPPORT,r)})})})(new Response);const jn=async t=>{if(t==null)return 0;if(l.isBlob(t))return t.size;if(l.isSpecCompliantForm(t))return(await new Request(_.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(l.isArrayBufferView(t)||l.isArrayBuffer(t))return t.byteLength;if(l.isURLSearchParams(t)&&(t=t+""),l.isString(t))return(await Mn(t)).byteLength},Vn=async(t,e)=>{const n=l.toFiniteNumber(t.getContentLength());return n??jn(e)},we={http:un,xhr:Nn,fetch:re&&(async t=>{let{url:e,method:n,data:r,signal:s,cancelToken:i,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:c,headers:d,withCredentials:f="same-origin",fetchOptions:g}=tt(t);c=c?(c+"").toLowerCase():"text";let E=Dn([s,i&&i.toAbortSignal()],o),h;const y=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let p;try{if(u&&Hn&&n!=="get"&&n!=="head"&&(p=await Vn(d,r))!==0){let O=new Request(e,{method:"POST",body:r,duplex:"half"}),L;if(l.isFormData(r)&&(L=O.headers.get("content-type"))&&d.setContentType(L),O.body){const[D,le]=Qe(p,ne(Ye(u)));r=nt(O.body,it,D,le)}}l.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;h=new Request(e,{...g,signal:E,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let w=await fetch(h);const S=Ee&&(c==="stream"||c==="response");if(Ee&&(a||S&&y)){const O={};["status","statusText","headers"].forEach(pt=>{O[pt]=w[pt]});const L=l.toFiniteNumber(w.headers.get("content-length")),[D,le]=a&&Qe(L,ne(Ye(a),!0))||[];w=new Response(nt(w.body,it,D,()=>{le&&le(),y&&y()}),O)}c=c||"text";let x=await se[l.findKey(se,c)||"text"](w,t);return!S&&y&&y(),await new Promise((O,L)=>{Xe(O,L,{data:x,headers:C.from(w.headers),status:w.status,statusText:w.statusText,config:t,request:h})})}catch(b){throw y&&y(),b&&b.name==="TypeError"&&/fetch/i.test(b.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,t,h),{cause:b.cause||b}):m.from(b,b&&b.code,t,h)}})};l.forEach(we,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ot=t=>`- ${t}`,$n=t=>l.isFunction(t)||t===null||t===!1,at={getAdapter:t=>{t=l.isArray(t)?t:[t];const{length:e}=t;let n,r;const s={};for(let i=0;i<e;i++){n=t[i];let o;if(r=n,!$n(n)&&(r=we[(o=String(n)).toLowerCase()],r===void 0))throw new m(`Unknown adapter '${o}'`);if(r)break;s[o||"#"+i]=r}if(!r){const i=Object.entries(s).map(([a,u])=>`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
`+i.map(ot).join(`
`):" "+ot(i[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:we};function Se(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new F(null,t)}function lt(t){return Se(t),t.headers=C.from(t.headers),t.data=be.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),at.getAdapter(t.adapter||z.adapter)(t).then(function(r){return Se(t),r.data=be.call(t,t.transformResponse,r),r.headers=C.from(r.headers),r},function(r){return Ge(r)||(Se(t),r&&r.response&&(r.response.data=be.call(t,t.transformResponse,r.response),r.response.headers=C.from(r.response.headers))),Promise.reject(r)})}const ct="1.8.4",ie={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ie[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const ut={};ie.transitional=function(e,n,r){function s(i,o){return"[Axios v"+ct+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new m(s(o," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!ut[o]&&(ut[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,o,a):!0}},ie.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Kn(t,e,n){if(typeof t!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],o=e[i];if(o){const a=t[i],u=a===void 0||o(a,i,t);if(u!==!0)throw new m("option "+i+" must be "+u,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+i,m.ERR_BAD_OPTION)}}const oe={assertOptions:Kn,validators:ie},k=oe.validators;let N=class{constructor(e){this.defaults=e,this.interceptors={request:new Ke,response:new Ke}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=v(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&oe.assertOptions(r,{silentJSONParsing:k.transitional(k.boolean),forcedJSONParsing:k.transitional(k.boolean),clarifyTimeoutError:k.transitional(k.boolean)},!1),s!=null&&(l.isFunction(s)?n.paramsSerializer={serialize:s}:oe.assertOptions(s,{encode:k.function,serialize:k.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),oe.assertOptions(n,{baseUrl:k.spelling("baseURL"),withXsrfToken:k.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&l.merge(i.common,i[n.method]);i&&l.forEach(["delete","get","head","post","put","patch","common"],h=>{delete i[h]}),n.headers=C.concat(o,i);const a=[];let u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(u=u&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let d,f=0,g;if(!u){const h=[lt.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,c),g=h.length,d=Promise.resolve(n);f<g;)d=d.then(h[f++],h[f++]);return d}g=a.length;let E=n;for(f=0;f<g;){const h=a[f++],y=a[f++];try{E=h(E)}catch(p){y.call(this,p);break}}try{d=lt.call(this,E)}catch(h){return Promise.reject(h)}for(f=0,g=c.length;f<g;)d=d.then(c[f++],c[f++]);return d}getUri(e){e=v(this.defaults,e);const n=Ze(e.baseURL,e.url,e.allowAbsoluteUrls);return $e(n,e.params,e.paramsSerializer)}};l.forEach(["delete","get","head","options"],function(e){N.prototype[e]=function(n,r){return this.request(v(r||{},{method:e,url:n,data:(r||{}).data}))}}),l.forEach(["post","put","patch"],function(e){function n(r){return function(i,o,a){return this.request(v(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}N.prototype[e]=n(),N.prototype[e+"Form"]=n(!0)});let zn=class mt{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new F(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new mt(function(s){e=s}),cancel:e}}};function Wn(t){return function(n){return t.apply(null,n)}}function Jn(t){return l.isObject(t)&&t.isAxiosError===!0}const Ae={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(Ae).forEach(([t,e])=>{Ae[e]=t});function dt(t){const e=new N(t),n=xe(N.prototype.request,e);return l.extend(n,N.prototype,e,{allOwnKeys:!0}),l.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return dt(v(t,s))},n}const R=dt(z);R.Axios=N,R.CanceledError=F,R.CancelToken=zn,R.isCancel=Ge,R.VERSION=ct,R.toFormData=ee,R.AxiosError=m,R.Cancel=R.CanceledError,R.all=function(e){return Promise.all(e)},R.spread=Wn,R.isAxiosError=Jn,R.mergeConfig=v,R.AxiosHeaders=C,R.formToJSON=t=>We(l.isHTMLForm(t)?new FormData(t):t),R.getAdapter=at.getAdapter,R.HttpStatusCode=Ae,R.default=R;const{Axios:ir,AxiosError:or,CanceledError:ar,isCancel:lr,CancelToken:cr,VERSION:ur,all:dr,Cancel:fr,isAxiosError:hr,spread:pr,toFormData:mr,AxiosHeaders:yr,HttpStatusCode:gr,formToJSON:Rr,getAdapter:br,mergeConfig:Er}=R,_e=R.create({baseURL:"https://app.posthog.com"});_e.interceptors.request.use(t=>(t.data={...t.data,api_key:"phc_cWZiUS6cHGvUDyCMDRK8Cvoayv5m6x6YOT02RW91vOX"},t));const Ce={capture:(t,e)=>_e.post("/capture",{event:t,properties:e}),merge:(t,e)=>_e.post("/capture",{event:"$merge_dangerously",distinct_id:e,properties:{alias:t}})},J="village.distinct_id";class M{static getDistinctId(){let e=localStorage.getItem(J);if(e)return e;const n=_t();return localStorage.setItem(J,n),n}static setUserId(e){const n=localStorage.getItem(J);n&&n!==e&&Ce.merge(n,e),localStorage.setItem(J,e)}static removeUserId(){localStorage.removeItem(J)}static trackButtonClick({type:e,module:n,url:r,partnerKey:s}){Ce.capture("PaaS Button Clicked",{type:e,module:n,url:r,partnerKey:s,distinct_id:this.getDistinctId(),$current_url:window.location.href})}static trackButtonRender({partnerKey:e}){Ce.capture("PaaS Button Rendered",{partnerKey:e,distinct_id:this.getDistinctId(),$current_url:window.location.href})}}class Gn{constructor(e){this.app=e,this.listenerMap=new WeakMap,this.syncUrlElements=new Map,this.elementsWithListeners=new Set}handleDataUrl(e,n){const r=this.isValidUrl(n)?n:"http://invalidURL.com";this.app.elementRequests.delete(e),this.removeListener(e),this.syncUrlElements.set(e,r);const s=()=>{M.trackButtonClick({type:"paths",validURL:r,partnerKey:this.app.partnerKey}),this.app.url=r,this.app.module=null,this.app.renderIframe()};this.listenerMap.set(e,s),e.addEventListener("click",s),this.elementsWithListeners.add(e),n!==""&&this.app.initializeButtonState(e),this.app.token&&this.app.checkPathsAndUpdateButton(e,r)}handleModule(e,n){if(this.app.elementRequests.delete(e),this.syncUrlElements.delete(e),!Object.values(q).includes(n)){console.warn(`Invalid module type: ${n}`);return}this.removeListener(e);const r=()=>{try{M.trackButtonClick({type:"onboarding",module:n,partnerKey:this.app.partnerKey}),this.app.url=null,this.app.module=n,this.app.renderIframe()}catch(s){Ue(s,{additionalInfo:{function:"handleModule (click)",moduleValue:n,element:e}})}};this.listenerMap.set(e,r),e.addEventListener("click",r),this.elementsWithListeners.add(e)}removeListener(e){const n=this.listenerMap.get(e);n&&e.removeEventListener("click",n),this.app.elementRequests.delete(e),this.syncUrlElements.delete(e),this.elementsWithListeners.delete(e)}getSyncUrlElements(){return this.syncUrlElements}getAllElementsWithListeners(){return this.elementsWithListeners}isValidUrl(e){if(!e||typeof e!="string"||e.trim()==="")return!1;const n=e.trim();if(!/^https?:\/\//i.test(n))return!1;try{return new URL(n),!0}catch{return!1}}}class Xn{constructor(e,n){this.partnerKey=e,this.userReference=null,this.token=P.get("village.token"),this.config=n,this.url=null,this.module=null,this.iframe=null,this.observer=null,this.inlineSearchIframes=new Map,this.messageHandlers=new bt(this),this.moduleHandlers=new Gn(this),this.apiUrl="https://api.village.do",this.hasRenderedButton=!1,this.elementRequests=new Map,this.elementRequestIds=new Map,this.globalRequestCounter=0}async init(){this.setupMessageHandlers(),this.setupMutationObserver(),this.scanExistingElements(),this.getUser()}setupMessageHandlers(){window.addEventListener("message",e=>{this.messageHandlers.handle(e)})}setupMutationObserver(){this.observer=new MutationObserver(this.handleMutations.bind(this)),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0,characterDataOldValue:!0})}handleMutations(e){e.forEach(n=>{n.type==="attributes"?this.handleAttributeChange(n):n.type==="childList"&&this.handleNewElements(n)})}handleAttributeChange(e){const n=e.target,r=e.attributeName;(r===j||r===V)&&this.checkAndAddListenerIfValid(n)}handleNewElements(e){e.addedNodes.forEach(n=>{if(n.nodeType!==Node.ELEMENT_NODE)return;if(this.hasVillageAttributes(n)){this.checkAndAddListenerIfValid(n);return}const r=`[${j}], [${V}]`;n.querySelectorAll(r).forEach(s=>{this.checkAndAddListenerIfValid(s)})})}hasVillageAttributes(e){return e.hasAttribute(j)||e.hasAttribute(V)}checkAndAddListenerIfValid(e){this.addListenerToElement(e)}async addListenerToElement(e){this.elementRequests.delete(e),this.elementRequestIds.delete(e);const n=e.getAttribute(j),r=e.getAttribute(V);if(r===q.SEARCH){const s={partnerKey:this.partnerKey,userReference:this.userReference,token:this.token},i=yt(e,s);this.inlineSearchIframes.set(e,i)}else this.inlineSearchIframes.delete(e),n&&r!=q.SYNC&&r!=q.SEARCH?this.moduleHandlers.handleDataUrl(e,n):this.moduleHandlers.handleModule(e,r||q.SYNC),this.hasRenderedButton||(this.hasRenderedButton=!0,M.trackButtonRender({partnerKey:this.partnerKey}))}async getUser(){const e=P.get("village.token");if(e)try{const{data:n}=await R.get(`${this.apiUrl}/user`,{headers:{"x-access-token":e,"app-public-key":this.partnerKey}});if(!(n!=null&&n.id))throw new Error("No user ID");const r=`${n==null?void 0:n.id}`;M.setUserId(r)}catch{this._clearAllRequests(),this.token=null,P.remove("village.token"),M.removeUserId()}}handleOAuthRequest(){const e="https://village.do/widget/oauth",n=new URLSearchParams;this.partnerKey&&n.append("partnerKey",this.partnerKey),this.userReference&&n.append("userReference",this.userReference);const r=n.toString()?`${e}?${n.toString()}`:e;window.open(r,"paas-oauth","popup=true,width=500,height=600")}handleOAuthSuccess(e){this._clearAllRequests(),P.set("village.token",e.token,{secure:!0,expires:60}),this.token=e.token,this._refreshInlineSearchIframes(),this.refreshSyncUrlElements(),this.renderIframe()}_refreshInlineSearchIframes(){this.inlineSearchIframes.forEach((e,n)=>{if(e&&e.contentWindow){const r={partnerKey:this.partnerKey,userReference:this.userReference,token:this.token,module:q.SEARCH};e.src=ce(r)}})}handleOAuthError(e){alert("Sorry, something went wrong with your login")}handleRemoveIframe(){this.url=null,this.module=null,this.renderIframe()}handleIframeLoaded(){this.iframe&&this.iframe.hideSpinner()}scanExistingElements(){const e=`[${j}], [${V}]`;document.querySelectorAll(e).forEach((r,s)=>{this.checkAndAddListenerIfValid(r)})}async checkPaths(e){var n,r;if(!this.token)return null;try{const{data:s}=await R.post(`${this.apiUrl}/paths-check`,{url:e},{headers:{"x-access-token":this.token,"app-public-key":this.partnerKey}});return s}catch(s){return((r=(n=s==null?void 0:s.response)==null?void 0:n.data)==null?void 0:r.auth)===!1&&(this._clearAllRequests(),P.remove("village.token"),this.token=null),null}}getButtonChildren(e){const n=e.querySelector('[village-paths-availability="found"]'),r=e.querySelector('[village-paths-availability="not-found"]'),s=e.querySelector('[village-paths-availability="loading"]'),i=e.querySelector('[village-paths-availability="error"]'),o=e.querySelector('[village-paths-availability="not-activated"]');return{foundElement:n,notFoundElement:r,loadingElement:s,errorElement:i,not_activated:o}}initializeButtonState(e){this.token?this._setElementState(e,"loading"):this._setElementState(e,"not-found")}async checkPathsAndUpdateButton(e,n){const r=this.elementRequests.get(e);if(r)return r;const s=++this.globalRequestCounter,i=this._executePathCheck(e,n,s);this.elementRequests.set(e,i),this.elementRequestIds.set(e,s);try{await i}finally{this.elementRequests.delete(e),this.elementRequestIds.delete(e)}}async _executePathCheck(e,n,r){this._setElementState(e,"loading");try{const s=await this.checkPaths(n);r===this.elementRequestIds.get(e)&&this._setElementState(e,s!=null&&s.relationship?"found":"not-found",s==null?void 0:s.relationship)}catch(s){Ue(s,{additionalInfo:{function:"_executePathCheck",url:n,element:e}}),r===this.elementRequestIds.get(e)&&this._setElementState(e,"not-found")}}_setElementState(e,n,r=null){const{foundElement:s,notFoundElement:i,loadingElement:o,errorElement:a,not_activated:u}=this.getButtonChildren(e);switch([s,i,o,a,u].filter(Boolean).forEach(c=>c.style.display="none"),n){case"loading":o&&(o.style.display="inline-flex");break;case"found":s&&(s.style.display="inline-flex",r&&this.addFacePilesAndCount(s,r));break;case"not-found":i&&(i.style.display="inline-flex");break}}_clearAllRequests(){this.elementRequests.clear(),this.elementRequestIds.clear(),this.globalRequestCounter+=1e3}addFacePilesAndCount(e,n){const r=e.querySelector('[village-paths-data="facepiles"]');r&&(r.innerHTML=`${n.paths.avatars.slice(0,3).map(i=>`<img src="${i}" onerror="this.src='https://randomuser.me/api/portraits/thumb/women/75.jpg';this.classList.add('village-facepiler-avatar-not-found')" />`).join("")}`);const s=e.querySelector('[village-paths-data="count"]');s&&(s.innerHTML=n.paths.count)}updateButtonContent(e,n){this._setElementState(e,n?"found":"not-found",n)}renderIframe(){this.iframe||(this.iframe=new gt),this.iframe.update({partnerKey:this.partnerKey,userReference:this.userReference,token:this.token,url:this.url,module:this.module,config:this.config}),this.iframe.render(document.body)}setUserReference(e,n=null){return new Promise((r,s)=>{try{this.userReference=e,this.renderIframe(),n!=null&&n.team&&this.upsertTeam(n.team),r()}catch(i){s(i)}})}async upsertTeam(e){if(!(!this.token||!e))try{await R.post(`${this.apiUrl}/v1/teams/upsert`,{teamId:e.id,teamName:e.name},{params:{partnerKey:this.partnerKey},headers:{"x-access-token":this.token}})}catch(n){console.error("[VILLAGE-PAAS] Failed to link user to team:",n.message)}}destroy(){this._clearAllRequests(),this.observer&&(this.observer.disconnect(),this.observer=null),this.inlineSearchIframes.forEach((n,r)=>{n.parentNode===r&&r.removeChild(n)}),this.inlineSearchIframes.clear(),this.moduleHandlers.getAllElementsWithListeners().forEach(n=>{this.moduleHandlers.removeListener(n)}),this.iframe&&this.iframe.element&&this.iframe.element.parentNode&&this.iframe.element.parentNode.removeChild(this.iframe.element),this.iframe&&this.iframe.spinner&&this.iframe.spinner.parentNode&&this.iframe.spinner.parentNode.removeChild(this.iframe.spinner),this.iframe=null}refreshSyncUrlElements(){this.moduleHandlers.getSyncUrlElements().forEach((n,r)=>{this.initializeButtonState(r),this.checkPathsAndUpdateButton(r,n)})}async logout(){this._clearAllRequests();try{this.token&&await R.get(`${this.apiUrl}/logout`,{headers:{"x-access-token":this.token,"app-public-key":this.partnerKey}})}catch{}P.remove("village.token"),this.token=null,M.removeUserId(),this.refreshSyncUrlElements(),this._refreshInlineSearchIframes()}}const H={pathCtaClicked:"village.path.cta.clicked",pathsCtaUpdated:"village.paths_cta.updated",userSynced:"village.user.synced",userSyncFailed:"village.user.sync.failed",oauthStarted:"village.oauth.started",oauthSuccess:"village.oauth.success",oauthError:"village.oauth.error",widgetError:"village.widget.error",widgetReady:"village.widget.ready"},ae={};function ft(t,e){(ae[t]??(ae[t]=[])).push(e)}function ht(t,e){if(typeof t!="string"){console.warn(`[Village] Event name must be a string. Received: ${typeof t}`);return}const n=ae[t];n&&n.forEach(s=>{try{s(e)}catch(i){console.error(`[Village] Error in listener for "${t}":`,i)}});const r={source:"VillageSDK",type:t,payload:e};try{window.postMessage(r,"*")}catch{}if(window.parent&&window.parent!==window)try{window.parent.postMessage(r,"*")}catch(s){console.warn(`[Village] Failed to postMessage to parent for event "${t}":`,s)}}(function(t){function e(){const s={},i={q:[],_config:{paths_cta:[]},_partnerKey:null,_userReference:null,_app:null,_initialized:!1,updatePathsCTA(o=[]){var a;return i._config.paths_cta=Array.isArray(o)?o:[],(a=i.broadcast)==null||a.call(i,H.pathsCtaUpdated,i._config.paths_cta),i},addPathCTA(o){var a;return o&&typeof o.label=="string"&&o.callback&&(i._config.paths_cta.push(o),(a=i.broadcast)==null||a.call(i,H.pathsCtaUpdated,i._config.paths_cta)),i},off(o,a){s[o]&&(s[o]=s[o].filter(u=>u!==a))},on:ft,emit:ht,dispatch(o,a){try{t.dispatchEvent(new CustomEvent(o,{detail:a}))}catch{}},broadcast(o,a){var u,c;(u=i.emit)==null||u.call(i,o,a),(c=i.dispatch)==null||c.call(i,o,a)},_processQueue:function(){for(;i.q.length>0;){var o=i.q.shift(),a=o[0],u=o.slice(1);typeof i[a]=="function"&&i[a].apply(i,...u)}},init(o,a){if(i._initialized)return i;if(!o)throw new Error("Village: Partner key is required");return i._partnerKey=o,i._config={...a,paths_cta:[]},i._initialized=!0,i._renderWidget(),Array.isArray(a==null?void 0:a.paths_cta)&&a.paths_cta.length&&i.updatePathsCTA(a.paths_cta),i},identify:function(o,a){return i._initialized?new Promise((u,c)=>{i._userReference=o,i._app.setUserReference(o,a).then(()=>u()).catch(d=>c(d))}):(i.q.push(["identify",o,a]),Promise.resolve())},logout:function(){if(!i._initialized){i.q.push(["logout"]);return}i._app&&i._app.logout()},_renderWidget:function(){return new Promise((o,a)=>{var u;try{i._app||(i._app=new Xn(i._partnerKey,i._config)),i._app.init(),(u=i.broadcast)==null||u.call(i,H.widgetReady,{partnerKey:i._partnerKey,userReference:i._userReference}),o()}catch(c){a(c)}})},getPathsCTA(){var a;const o=Array.isArray((a=i==null?void 0:i._config)==null?void 0:a.paths_cta)&&i._config.paths_cta.length>0?i._config.paths_cta:[];if(!Array.isArray(o)||o.length===0){const u=new URLSearchParams(t.location.search).get("paths_cta");try{const c=JSON.parse(decodeURIComponent(u));Array.isArray(c)?o=c:o=[]}catch{o=[]}}return o||[]},executeCallback(o){const a=i.getPathsCTA();for(let u=0;u<a.length;u++){const c=a[u];if(c.callback&&o.index==u)return c.callback(o),!0}t!==t.parent&&t.parent.postMessage(o,"*")}};return i.authorize=i.identify,i}const n=t.Village,r=(n==null?void 0:n.q)||[];t.Village=e(),t.Village.on=ft,t.Village.emit=ht,t.Village.q=r.concat(t.Village.q),t.Village._processQueue(),t.Village.on(H.widgetReady,({partnerKey:s,userReference:i})=>{}),t.Village.on(H.pathCtaClicked,s=>{t.Village.executeCallback(s)}),t.__village_message_listener_attached__||(t.addEventListener("message",s=>{const i=s.data;!i||!(i.source=="VillageSDK"||i.source=="dynamic-cta")||i.type===H.pathCtaClicked&&t.Village.executeCallback(i.payload||i)}),t.__village_message_listener_attached__=!0)})(window);const Qn=window.Village;Oe.default=Qn,Object.defineProperties(Oe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(this.VillageWidgetSDK=this.VillageWidgetSDK||{});
