nana800-analytics 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ "use strict";var BekenderAnalytics=(()=>{var se=Object.defineProperty,Xt=Object.defineProperties,Yt=Object.getOwnPropertyDescriptor,Zt=Object.getOwnPropertyDescriptors,er=Object.getOwnPropertyNames,it=Object.getOwnPropertySymbols;var at=Object.prototype.hasOwnProperty,tr=Object.prototype.propertyIsEnumerable;var V=(t,e)=>{if(e=Symbol[t])return e;throw Error("Symbol."+t+" is not defined")};var ve=(t,e,r)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,U=(t,e)=>{for(var r in e||(e={}))at.call(e,r)&&ve(t,r,e[r]);if(it)for(var r of it(e))tr.call(e,r)&&ve(t,r,e[r]);return t},oe=(t,e)=>Xt(t,Zt(e));var lt=(t,e)=>{for(var r in e)se(t,r,{get:e[r],enumerable:!0})},rr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of er(e))!at.call(t,s)&&s!==r&&se(t,s,{get:()=>e[s],enumerable:!(n=Yt(e,s))||n.enumerable});return t};var nr=t=>rr(se({},"__esModule",{value:!0}),t);var O=(t,e,r)=>(ve(t,typeof e!="symbol"?e+"":e,r),r);var S=(t,e,r)=>new Promise((n,s)=>{var o=f=>{try{l(r.next(f))}catch(u){s(u)}},i=f=>{try{l(r.throw(f))}catch(u){s(u)}},l=f=>f.done?n(f.value):Promise.resolve(f.value).then(o,i);l((r=r.apply(t,e)).next())}),L=function(t,e){this[0]=t,this[1]=e},Pe=(t,e,r)=>{var n=(i,l,f,u)=>{try{var c=r[i](l),d=(l=c.value)instanceof L,E=c.done;Promise.resolve(d?l[0]:l).then(y=>d?n(i==="return"?i:"next",l[1]?{done:y.done,value:y.value}:y,f,u):f({value:y,done:E})).catch(y=>n("throw",y,f,u))}catch(y){u(y)}},s=i=>o[i]=l=>new Promise((f,u)=>n(i,l,f,u)),o={};return r=r.apply(t,e),o[Symbol.asyncIterator]=()=>o,s("next"),s("throw"),s("return"),o},_e=t=>{var e=t[V("asyncIterator")],r=!1,n,s={};return e==null?(e=t[V("iterator")](),n=o=>s[o]=i=>e[o](i)):(e=e.call(t),n=o=>s[o]=i=>{if(r){if(r=!1,o==="throw")throw i;return i}return r=!0,{done:!1,value:new L(new Promise(l=>{var f=e[o](i);if(!(f instanceof Object))throw TypeError("Object expected");l(f)}),1)}}),s[V("iterator")]=()=>s,n("next"),"throw"in e?n("throw"):s.throw=o=>{throw o},"return"in e&&n("return"),s},ut=(t,e,r)=>(e=t[V("asyncIterator")])?e.call(t):(t=t[V("iterator")](),e={},r=(n,s)=>(s=t[n])&&(e[n]=o=>new Promise((i,l,f)=>(o=s.call(t,o),f=o.done,Promise.resolve(o.value).then(u=>i({value:u,done:f}),l)))),r("next"),r("return"),e);var wn={};lt(wn,{PlatformType:()=>ie,createBekenderAnalytics:()=>Sn});var ie=(o=>(o.BROWSER="BROWSER",o.REACT_NATIVE="REACT_NATIVE",o.NODE="NODE",o.ELECTRON="ELECTRON",o.UNKNOWN="UNKNOWN",o))(ie||{}),ct=()=>typeof window!="undefined"&&typeof document!="undefined"?typeof window.require=="function"&&typeof window.process=="object"?"ELECTRON":"BROWSER":typeof navigator!="undefined"&&navigator.product==="ReactNative"?"REACT_NATIVE":typeof process!="undefined"&&process.versions&&process.versions.node?"NODE":"UNKNOWN";var Ce="bekender_analytics_events",Be="bekender_analytics_user_props";var Ie="https://api.analytics.bekender.ru";var ae=class{constructor(e,r,n){O(this,"storageAdapter",null);if(n){this.storageAdapter=null;return}if(r){this.storageAdapter=r;return}this.storageAdapter=this.initializeDefaultStorage(e)}initializeDefaultStorage(e){return(e==="BROWSER"||e==="ELECTRON")&&typeof localStorage!="undefined"?{setItem:(r,n)=>{localStorage.setItem(r,n)},getItem:r=>localStorage.getItem(r),removeItem:r=>{localStorage.removeItem(r)}}:null}isAvailable(){return this.storageAdapter!==null}saveEvents(e){if(this.storageAdapter)try{let r=JSON.stringify(e),n=this.storageAdapter.setItem(Ce,r);n instanceof Promise&&n.catch(s=>{console.error("BekenderAnalytics: Failed to save events to storage:",s)})}catch(r){console.error("BekenderAnalytics: Failed to save events to storage:",r)}}saveUserProps(e){if(this.storageAdapter)try{let r=JSON.stringify(e),n=this.storageAdapter.setItem(Be,r);n instanceof Promise&&n.catch(s=>{console.error("BekenderAnalytics: Failed to save user props to storage:",s)})}catch(r){console.error("BekenderAnalytics: Failed to save user props to storage:",r)}}loadEvents(){return S(this,null,function*(){if(!this.storageAdapter)return[];try{let e=yield Promise.resolve(this.storageAdapter.getItem(Ce));if(e){let r=JSON.parse(e);if(Array.isArray(r))return r.map(n=>oe(U({},n),{event_time:new Date(n.event_time)}))}}catch(e){console.error("BekenderAnalytics: Failed to load events from storage:",e)}return[]})}loadUserProps(){return S(this,null,function*(){if(!this.storageAdapter)return[];try{let e=yield Promise.resolve(this.storageAdapter.getItem(Be));if(e){let r=JSON.parse(e);if(Array.isArray(r))return r}}catch(e){console.error("BekenderAnalytics: Failed to load user props from storage:",e)}return[]})}};function W(t,e){return function(){return t.apply(e,arguments)}}var{toString:sr}=Object.prototype,{getPrototypeOf:ke}=Object,ue=(t=>e=>{let r=sr.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_=t=>(t=t.toLowerCase(),e=>ue(e)===t),ce=t=>e=>typeof e===t,{isArray:q}=Array,Q=ce("undefined");function or(t){return t!==null&&!Q(t)&&t.constructor!==null&&!Q(t.constructor)&&P(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var pt=_("ArrayBuffer");function ir(t){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&pt(t.buffer),e}var ar=ce("string"),P=ce("function"),mt=ce("number"),fe=t=>t!==null&&typeof t=="object",lr=t=>t===!0||t===!1,le=t=>{if(ue(t)!=="object")return!1;let e=ke(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},ur=_("Date"),cr=_("File"),fr=_("Blob"),dr=_("FileList"),pr=t=>fe(t)&&P(t.pipe),mr=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||P(t.append)&&((e=ue(t))==="formdata"||e==="object"&&P(t.toString)&&t.toString()==="[object FormData]"))},hr=_("URLSearchParams"),[gr,yr,Er,Ar]=["ReadableStream","Request","Response","Headers"].map(_),br=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t=="undefined")return;let n,s;if(typeof t!="object"&&(t=[t]),q(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{let o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length,l;for(n=0;n<i;n++)l=o[n],e.call(null,t[l],l,t)}}function ht(t,e){e=e.toLowerCase();let r=Object.keys(t),n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}var j=(()=>typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global)(),gt=t=>!Q(t)&&t!==j;function Fe(){let{caseless:t}=gt(this)&&this||{},e={},r=(n,s)=>{let o=t&&ht(e,s)||s;le(e[o])&&le(n)?e[o]=Fe(e[o],n):le(n)?e[o]=Fe({},n):q(n)?e[o]=n.slice():e[o]=n};for(let n=0,s=arguments.length;n<s;n++)arguments[n]&&$(arguments[n],r);return e}var Sr=(t,e,r,{allOwnKeys:n}={})=>($(e,(s,o)=>{r&&P(s)?t[o]=W(s,r):t[o]=s},{allOwnKeys:n}),t),wr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Rr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},xr=(t,e,r,n)=>{let s,o,i,l={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!l[i]&&(e[i]=t[i],l[i]=!0);t=r!==!1&&ke(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Tr=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},Or=t=>{if(!t)return null;if(q(t))return t;let e=t.length;if(!mt(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},vr=(t=>e=>t&&e instanceof t)(typeof Uint8Array!="undefined"&&ke(Uint8Array)),Pr=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),s;for(;(s=n.next())&&!s.done;){let o=s.value;e.call(t,o[0],o[1])}},_r=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Cr=_("HTMLFormElement"),Br=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),ft=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ir=_("RegExp"),yt=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};$(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},Ur=t=>{yt(t,(e,r)=>{if(P(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(P(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Fr=(t,e)=>{let r={},n=s=>{s.forEach(o=>{r[o]=!0})};return q(t)?n(t):n(String(t).split(e)),r},kr=()=>{},Nr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,Ue="abcdefghijklmnopqrstuvwxyz",dt="0123456789",Et={DIGIT:dt,ALPHA:Ue,ALPHA_DIGIT:Ue+Ue.toUpperCase()+dt},Dr=(t=16,e=Et.ALPHA_DIGIT)=>{let r="",{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r};function Lr(t){return!!(t&&P(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var jr=t=>{let e=new Array(10),r=(n,s)=>{if(fe(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[s]=n;let o=q(n)?[]:{};return $(n,(i,l)=>{let f=r(i,s+1);!Q(f)&&(o[l]=f)}),e[s]=void 0,o}}return n};return r(t,0)},qr=_("AsyncFunction"),Mr=t=>t&&(fe(t)||P(t))&&P(t.then)&&P(t.catch),At=((t,e)=>t?setImmediate:e?((r,n)=>(j.addEventListener("message",({source:s,data:o})=>{s===j&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),j.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",P(j.postMessage)),Hr=typeof queueMicrotask!="undefined"?queueMicrotask.bind(j):typeof process!="undefined"&&process.nextTick||At,a={isArray:q,isArrayBuffer:pt,isBuffer:or,isFormData:mr,isArrayBufferView:ir,isString:ar,isNumber:mt,isBoolean:lr,isObject:fe,isPlainObject:le,isReadableStream:gr,isRequest:yr,isResponse:Er,isHeaders:Ar,isUndefined:Q,isDate:ur,isFile:cr,isBlob:fr,isRegExp:Ir,isFunction:P,isStream:pr,isURLSearchParams:hr,isTypedArray:vr,isFileList:dr,forEach:$,merge:Fe,extend:Sr,trim:br,stripBOM:wr,inherits:Rr,toFlatObject:xr,kindOf:ue,kindOfTest:_,endsWith:Tr,toArray:Or,forEachEntry:Pr,matchAll:_r,isHTMLForm:Cr,hasOwnProperty:ft,hasOwnProp:ft,reduceDescriptors:yt,freezeMethods:Ur,toObjectSet:Fr,toCamelCase:Br,noop:kr,toFiniteNumber:Nr,findKey:ht,global:j,isContextDefined:gt,ALPHABET:Et,generateString:Dr,isSpecCompliantForm:Lr,toJSONObject:jr,isAsyncFn:qr,isThenable:Mr,setImmediate:At,asap:Hr};function M(t,e,r,n,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),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}a.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:a.toJSONObject(this.config),code:this.code,status:this.status}}});var bt=M.prototype,St={};["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=>{St[t]={value:t}});Object.defineProperties(M,St);Object.defineProperty(bt,"isAxiosError",{value:!0});M.from=(t,e,r,n,s,o)=>{let i=Object.create(bt);return a.toFlatObject(t,i,function(f){return f!==Error.prototype},l=>l!=="isAxiosError"),M.call(i,t.message,e,r,n,s),i.cause=t,i.name=t.name,o&&Object.assign(i,o),i};var h=M;var de=null;function Ne(t){return a.isPlainObject(t)||a.isArray(t)}function Rt(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function wt(t,e,r){return t?t.concat(e).map(function(s,o){return s=Rt(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function zr(t){return a.isArray(t)&&!t.some(Ne)}var Kr=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function Jr(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new(de||FormData),r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,m){return!a.isUndefined(m[g])});let n=r.metaTokens,s=r.visitor||c,o=r.dots,i=r.indexes,f=(r.Blob||typeof Blob!="undefined"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(a.isDate(p))return p.toISOString();if(!f&&a.isBlob(p))throw new h("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(p)||a.isTypedArray(p)?f&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,g,m){let A=p;if(p&&!m&&typeof p=="object"){if(a.endsWith(g,"{}"))g=n?g:g.slice(0,-2),p=JSON.stringify(p);else if(a.isArray(p)&&zr(p)||(a.isFileList(p)||a.endsWith(g,"[]"))&&(A=a.toArray(p)))return g=Rt(g),A.forEach(function(T,I){!(a.isUndefined(T)||T===null)&&e.append(i===!0?wt([g],I,o):i===null?g:g+"[]",u(T))}),!1}return Ne(p)?!0:(e.append(wt(m,g,o),u(p)),!1)}let d=[],E=Object.assign(Kr,{defaultVisitor:c,convertValue:u,isVisitable:Ne});function y(p,g){if(!a.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(p),a.forEach(p,function(A,R){(!(a.isUndefined(A)||A===null)&&s.call(e,A,a.isString(R)?R.trim():R,g,E))===!0&&y(A,g?g.concat(R):[R])}),d.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return y(t),e}var k=Jr;function xt(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Tt(t,e){this._pairs=[],t&&k(t,this,e)}var Ot=Tt.prototype;Ot.append=function(e,r){this._pairs.push([e,r])};Ot.toString=function(e){let r=e?function(n){return e.call(this,n,xt)}:xt;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};var pe=Tt;function Vr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function G(t,e,r){if(!e)return t;let n=r&&r.encode||Vr,s=r&&r.serialize,o;if(s?o=s(e,r):o=a.isURLSearchParams(e)?e.toString():new pe(e,r).toString(n),o){let i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}var De=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}},Le=De;var me={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var vt=typeof URLSearchParams!="undefined"?URLSearchParams:pe;var Pt=typeof FormData!="undefined"?FormData:null;var _t=typeof Blob!="undefined"?Blob:null;var Ct={isBrowser:!0,classes:{URLSearchParams:vt,FormData:Pt,Blob:_t},protocols:["http","https","file","blob","url","data"]};var Me={};lt(Me,{hasBrowserEnv:()=>qe,hasStandardBrowserEnv:()=>Wr,hasStandardBrowserWebWorkerEnv:()=>Qr,navigator:()=>je,origin:()=>$r});var qe=typeof window!="undefined"&&typeof document!="undefined",je=typeof navigator=="object"&&navigator||void 0,Wr=qe&&(!je||["ReactNative","NativeScript","NS"].indexOf(je.product)<0),Qr=(()=>typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),$r=qe&&window.location.href||"http://localhost";var b=U(U({},Me),Ct);function He(t,e){return k(t,new b.classes.URLSearchParams,Object.assign({visitor:function(r,n,s,o){return b.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function Gr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Xr(t){let e={},r=Object.keys(t),n,s=r.length,o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function Yr(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;let l=Number.isFinite(+i),f=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,f?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!l):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=Xr(s[i])),!l)}if(a.isFormData(t)&&a.isFunction(t.entries)){let r={};return a.forEachEntry(t,(n,s)=>{e(Gr(n),s,r,0)}),r}return null}var he=Yr;function Zr(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var ze={transitional:me,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(he(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return He(e,this.formSerializer).toString();if((l=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return k(l?{"files[]":e}:e,f&&new f,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Zr(e)):e}],transformResponse:[function(e){let r=this.transitional||ze.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){let i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(l){if(i)throw l.name==="SyntaxError"?h.from(l,h.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:b.classes.FormData,Blob:b.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{ze.headers[t]={}});var H=ze;var en=a.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"]),Bt=t=>{let e={},r,n,s;return t&&t.split(`
2
+ `).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&en[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e};var It=Symbol("internals");function X(t){return t&&String(t).trim().toLowerCase()}function ge(t){return t===!1||t==null?t:a.isArray(t)?t.map(ge):String(t)}function tn(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var rn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ke(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function nn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function sn(t,e){let r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,o,i){return this[n].call(this,e,s,o,i)},configurable:!0})})}var z=class{constructor(e){e&&this.set(e)}set(e,r,n){let s=this;function o(l,f,u){let c=X(f);if(!c)throw new Error("header name must be a non-empty string");let d=a.findKey(s,c);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||f]=ge(l))}let i=(l,f)=>a.forEach(l,(u,c)=>o(u,c,f));if(a.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(a.isString(e)&&(e=e.trim())&&!rn(e))i(Bt(e),r);else if(a.isHeaders(e))for(let[l,f]of e.entries())o(f,l,n);else e!=null&&o(r,e,n);return this}get(e,r){if(e=X(e),e){let n=a.findKey(this,e);if(n){let s=this[n];if(!r)return s;if(r===!0)return tn(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=X(e),e){let n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Ke(this,this[n],n,r)))}return!1}delete(e,r){let n=this,s=!1;function o(i){if(i=X(i),i){let l=a.findKey(n,i);l&&(!r||Ke(n,n[l],l,r))&&(delete n[l],s=!0)}}return a.isArray(e)?e.forEach(o):o(e),s}clear(e){let r=Object.keys(this),n=r.length,s=!1;for(;n--;){let o=r[n];(!e||Ke(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){let r=this,n={};return a.forEach(this,(s,o)=>{let i=a.findKey(n,o);if(i){r[i]=ge(s),delete r[o];return}let l=e?nn(o):String(o).trim();l!==o&&delete r[o],r[l]=ge(s),n[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
3
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){let n=(this[It]=this[It]={accessors:{}}).accessors,s=this.prototype;function o(i){let l=X(i);n[l]||(sn(s,i),n[l]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};z.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(z.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});a.freezeMethods(z);var x=z;function Y(t,e){let r=this||H,n=e||r,s=x.from(n.headers),o=n.data;return a.forEach(t,function(l){o=l.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function Z(t){return!!(t&&t.__CANCEL__)}function Ut(t,e,r){h.call(this,t==null?"canceled":t,h.ERR_CANCELED,e,r),this.name="CanceledError"}a.inherits(Ut,h,{__CANCEL__:!0});var B=Ut;function ee(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new h("Request failed with status code "+r.status,[h.ERR_BAD_REQUEST,h.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Je(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function on(t,e){t=t||10;let r=new Array(t),n=new Array(t),s=0,o=0,i;return e=e!==void 0?e:1e3,function(f){let u=Date.now(),c=n[o];i||(i=u),r[s]=f,n[s]=u;let d=o,E=0;for(;d!==s;)E+=r[d++],d=d%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),u-i<e)return;let y=c&&u-c;return y?Math.round(E*1e3/y):void 0}}var Ft=on;function an(t,e){let r=0,n=1e3/e,s,o,i=(u,c=Date.now())=>{r=c,s=null,o&&(clearTimeout(o),o=null),t.apply(null,u)};return[(...u)=>{let c=Date.now(),d=c-r;d>=n?i(u,c):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},n-d)))},()=>s&&i(s)]}var kt=an;var K=(t,e,r=3)=>{let n=0,s=Ft(50,250);return kt(o=>{let i=o.loaded,l=o.lengthComputable?o.total:void 0,f=i-n,u=s(f),c=i<=l;n=i;let d={loaded:i,total:l,progress:l?i/l:void 0,bytes:f,rate:u||void 0,estimated:u&&l&&c?(l-i)/u:void 0,event:o,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(d)},r)},Ve=(t,e)=>{let r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},We=t=>(...e)=>a.asap(()=>t(...e));var Nt=b.hasStandardBrowserEnv?function(){let e=b.navigator&&/(msie|trident)/i.test(b.navigator.userAgent),r=document.createElement("a"),n;function s(o){let i=o;return e&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(i){let l=a.isString(i)?s(i):i;return l.protocol===n.protocol&&l.host===n.host}}():function(){return function(){return!0}}();var Dt=b.hasStandardBrowserEnv?{write(t,e,r,n,s,o){let i=[t+"="+encodeURIComponent(e)];a.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),a.isString(n)&&i.push("path="+n),a.isString(s)&&i.push("domain="+s),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(t){let 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 Qe(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $e(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function te(t,e){return t&&!Qe(e)?$e(t,e):e}var Lt=t=>t instanceof x?U({},t):t;function C(t,e){e=e||{};let r={};function n(u,c,d){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:d},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,d){if(a.isUndefined(c)){if(!a.isUndefined(u))return n(void 0,u,d)}else return n(u,c,d)}function o(u,c){if(!a.isUndefined(c))return n(void 0,c)}function i(u,c){if(a.isUndefined(c)){if(!a.isUndefined(u))return n(void 0,u)}else return n(void 0,c)}function l(u,c,d){if(d in e)return n(u,c);if(d in t)return n(void 0,u)}let f={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(u,c)=>s(Lt(u),Lt(c),!0)};return a.forEach(Object.keys(Object.assign({},t,e)),function(c){let d=f[c]||s,E=d(t[c],e[c],c);a.isUndefined(E)&&d!==l||(r[c]=E)}),r}var ye=t=>{let e=C({},t),{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:l}=e;e.headers=i=x.from(i),e.url=G(te(e.baseURL,e.url),t.params,t.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let f;if(a.isFormData(r)){if(b.hasStandardBrowserEnv||b.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){let[u,...c]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...c].join("; "))}}if(b.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Nt(e.url))){let u=s&&o&&Dt.read(o);u&&i.set(s,u)}return e};var ln=typeof XMLHttpRequest!="undefined",jt=ln&&function(t){return new Promise(function(r,n){let s=ye(t),o=s.data,i=x.from(s.headers).normalize(),{responseType:l,onUploadProgress:f,onDownloadProgress:u}=s,c,d,E,y,p;function g(){y&&y(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function A(){if(!m)return;let T=x.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),v={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:T,config:t,request:m};ee(function(D){r(D),g()},function(D){n(D),g()},v),m=null}"onloadend"in m?m.onloadend=A:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(A)},m.onabort=function(){m&&(n(new h("Request aborted",h.ECONNABORTED,t,m)),m=null)},m.onerror=function(){n(new h("Network Error",h.ERR_NETWORK,t,m)),m=null},m.ontimeout=function(){let I=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",v=s.transitional||me;s.timeoutErrorMessage&&(I=s.timeoutErrorMessage),n(new h(I,v.clarifyTimeoutError?h.ETIMEDOUT:h.ECONNABORTED,t,m)),m=null},o===void 0&&i.setContentType(null),"setRequestHeader"in m&&a.forEach(i.toJSON(),function(I,v){m.setRequestHeader(v,I)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),u&&([E,p]=K(u,!0),m.addEventListener("progress",E)),f&&m.upload&&([d,y]=K(f),m.upload.addEventListener("progress",d),m.upload.addEventListener("loadend",y)),(s.cancelToken||s.signal)&&(c=T=>{m&&(n(!T||T.type?new B(null,t,m):T),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));let R=Je(s.url);if(R&&b.protocols.indexOf(R)===-1){n(new h("Unsupported protocol "+R+":",h.ERR_BAD_REQUEST,t));return}m.send(o||null)})};var un=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s,o=function(u){if(!s){s=!0,l();let c=u instanceof Error?u:this.reason;n.abort(c instanceof h?c:new B(c instanceof Error?c.message:c))}},i=e&&setTimeout(()=>{i=null,o(new h(`timeout ${e} of ms exceeded`,h.ETIMEDOUT))},e),l=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));let{signal:f}=n;return f.unsubscribe=()=>a.asap(l),f}},qt=un;var cn=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},fn=function(t,e){return Pe(this,null,function*(){try{for(var r=ut(dn(t)),n,s,o;n=!(s=yield new L(r.next())).done;n=!1){let i=s.value;yield*_e(cn(i,e))}}catch(s){o=[s]}finally{try{n&&(s=r.return)&&(yield new L(s.call(r)))}finally{if(o)throw o[0]}}})},dn=function(t){return Pe(this,null,function*(){if(t[Symbol.asyncIterator]){yield*_e(t);return}let e=t.getReader();try{for(;;){let{done:r,value:n}=yield new L(e.read());if(r)break;yield n}}finally{yield new L(e.cancel())}})},Ge=(t,e,r,n)=>{let s=fn(t,e),o=0,i,l=u=>{i||(i=!0,n&&n(u))};return new ReadableStream({pull(u){return S(this,null,function*(){try{let{done:c,value:d}=yield s.next();if(c){l(),u.close();return}let E=d.byteLength;if(r){let y=o+=E;r(y)}u.enqueue(new Uint8Array(d))}catch(c){throw l(c),c}})},cancel(u){return l(u),s.return()}},{highWaterMark:2})};var Ae=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ht=Ae&&typeof ReadableStream=="function",pn=Ae&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):t=>S(void 0,null,function*(){return new Uint8Array(yield new Response(t).arrayBuffer())})),zt=(t,...e)=>{try{return!!t(...e)}catch(r){return!1}},mn=Ht&&zt(()=>{let t=!1,e=new Request(b.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Mt=64*1024,Xe=Ht&&zt(()=>a.isReadableStream(new Response("").body)),Ee={stream:Xe&&(t=>t.body)};Ae&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ee[e]&&(Ee[e]=a.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new h(`Response type '${e}' is not supported`,h.ERR_NOT_SUPPORT,n)})})})(new Response);var hn=t=>S(void 0,null,function*(){if(t==null)return 0;if(a.isBlob(t))return t.size;if(a.isSpecCompliantForm(t))return(yield new Request(b.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(a.isArrayBufferView(t)||a.isArrayBuffer(t))return t.byteLength;if(a.isURLSearchParams(t)&&(t=t+""),a.isString(t))return(yield pn(t)).byteLength}),gn=(t,e)=>S(void 0,null,function*(){let r=a.toFiniteNumber(t.getContentLength());return r==null?hn(e):r}),Kt=Ae&&(t=>S(void 0,null,function*(){let{url:e,method:r,data:n,signal:s,cancelToken:o,timeout:i,onDownloadProgress:l,onUploadProgress:f,responseType:u,headers:c,withCredentials:d="same-origin",fetchOptions:E}=ye(t);u=u?(u+"").toLowerCase():"text";let y=qt([s,o&&o.toAbortSignal()],i),p,g=y&&y.unsubscribe&&(()=>{y.unsubscribe()}),m;try{if(f&&mn&&r!=="get"&&r!=="head"&&(m=yield gn(c,n))!==0){let v=new Request(e,{method:"POST",body:n,duplex:"half"}),F;if(a.isFormData(n)&&(F=v.headers.get("content-type"))&&c.setContentType(F),v.body){let[D,ne]=Ve(m,K(We(f)));n=Ge(v.body,Mt,D,ne)}}a.isString(d)||(d=d?"include":"omit");let A="credentials"in Request.prototype;p=new Request(e,oe(U({},E),{signal:y,method:r.toUpperCase(),headers:c.normalize().toJSON(),body:n,duplex:"half",credentials:A?d:void 0}));let R=yield fetch(p),T=Xe&&(u==="stream"||u==="response");if(Xe&&(l||T&&g)){let v={};["status","statusText","headers"].forEach(ot=>{v[ot]=R[ot]});let F=a.toFiniteNumber(R.headers.get("content-length")),[D,ne]=l&&Ve(F,K(We(l),!0))||[];R=new Response(Ge(R.body,Mt,D,()=>{ne&&ne(),g&&g()}),v)}u=u||"text";let I=yield Ee[a.findKey(Ee,u)||"text"](R,t);return!T&&g&&g(),yield new Promise((v,F)=>{ee(v,F,{data:I,headers:x.from(R.headers),status:R.status,statusText:R.statusText,config:t,request:p})})}catch(A){throw g&&g(),A&&A.name==="TypeError"&&/fetch/i.test(A.message)?Object.assign(new h("Network Error",h.ERR_NETWORK,t,p),{cause:A.cause||A}):h.from(A,A&&A.code,t,p)}}));var Ye={http:de,xhr:jt,fetch:Kt};a.forEach(Ye,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var Jt=t=>`- ${t}`,yn=t=>a.isFunction(t)||t===null||t===!1,be={getAdapter:t=>{t=a.isArray(t)?t:[t];let{length:e}=t,r,n,s={};for(let o=0;o<e;o++){r=t[o];let i;if(n=r,!yn(r)&&(n=Ye[(i=String(r)).toLowerCase()],n===void 0))throw new h(`Unknown adapter '${i}'`);if(n)break;s[i||"#"+o]=n}if(!n){let o=Object.entries(s).map(([l,f])=>`adapter ${l} `+(f===!1?"is not supported by the environment":"is not available in the build")),i=e?o.length>1?`since :
4
+ `+o.map(Jt).join(`
5
+ `):" "+Jt(o[0]):"as no adapter specified";throw new h("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return n},adapters:Ye};function Ze(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new B(null,t)}function Se(t){return Ze(t),t.headers=x.from(t.headers),t.data=Y.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),be.getAdapter(t.adapter||H.adapter)(t).then(function(n){return Ze(t),n.data=Y.call(t,t.transformResponse,n),n.headers=x.from(n.headers),n},function(n){return Z(n)||(Ze(t),n&&n.response&&(n.response.data=Y.call(t,t.transformResponse,n.response),n.response.headers=x.from(n.response.headers))),Promise.reject(n)})}var we="1.7.7";var et={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{et[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Vt={};et.transitional=function(e,r,n){function s(o,i){return"[Axios v"+we+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,l)=>{if(e===!1)throw new h(s(i," has been removed"+(r?" in "+r:"")),h.ERR_DEPRECATED);return r&&!Vt[i]&&(Vt[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,i,l):!0}};function En(t,e,r){if(typeof t!="object")throw new h("options must be an object",h.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),s=n.length;for(;s-- >0;){let o=n[s],i=e[o];if(i){let l=t[o],f=l===void 0||i(l,o,t);if(f!==!0)throw new h("option "+o+" must be "+f,h.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new h("Unknown option "+o,h.ERR_BAD_OPTION)}}var Re={assertOptions:En,validators:et};var N=Re.validators,J=class{constructor(e){this.defaults=e,this.interceptors={request:new Le,response:new Le}}request(e,r){return S(this,null,function*(){try{return yield this._request(e,r)}catch(n){if(n instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;let o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
6
+ `+o):n.stack=o}catch(i){}}throw n}})}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=C(this.defaults,r);let{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&Re.assertOptions(n,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:Re.assertOptions(s,{encode:N.function,serialize:N.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),r.headers=x.concat(i,o);let l=[],f=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(f=f&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});let u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let c,d=0,E;if(!f){let p=[Se.bind(this),void 0];for(p.unshift.apply(p,l),p.push.apply(p,u),E=p.length,c=Promise.resolve(r);d<E;)c=c.then(p[d++],p[d++]);return c}E=l.length;let y=r;for(d=0;d<E;){let p=l[d++],g=l[d++];try{y=p(y)}catch(m){g.call(this,m);break}}try{c=Se.call(this,y)}catch(p){return Promise.reject(p)}for(d=0,E=u.length;d<E;)c=c.then(u[d++],u[d++]);return c}getUri(e){e=C(this.defaults,e);let r=te(e.baseURL,e.url);return G(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){J.prototype[e]=function(r,n){return this.request(C(n||{},{method:e,url:r,data:(n||{}).data}))}});a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,l){return this.request(C(l||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}J.prototype[e]=r(),J.prototype[e+"Form"]=r(!0)});var re=J;var tt=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o,i=new Promise(l=>{n.subscribe(l),o=l}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,l){n.reason||(n.reason=new B(o,i,l),r(n.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;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(s){e=s}),cancel:e}}},Wt=tt;function rt(t){return function(r){return t.apply(null,r)}}function nt(t){return a.isObject(t)&&t.isAxiosError===!0}var st={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(st).forEach(([t,e])=>{st[e]=t});var Qt=st;function $t(t){let e=new re(t),r=W(re.prototype.request,e);return a.extend(r,re.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return $t(C(t,s))},r}var w=$t(H);w.Axios=re;w.CanceledError=B;w.CancelToken=Wt;w.isCancel=Z;w.VERSION=we;w.toFormData=k;w.AxiosError=h;w.Cancel=w.CanceledError;w.all=function(e){return Promise.all(e)};w.spread=rt;w.isAxiosError=nt;w.mergeConfig=C;w.AxiosHeaders=x;w.formToJSON=t=>he(a.isHTMLForm(t)?new FormData(t):t);w.getAdapter=be.getAdapter;w.HttpStatusCode=Qt;w.default=w;var xe=w;var{Axios:Li,AxiosError:ji,CanceledError:qi,isCancel:Mi,CancelToken:Hi,VERSION:zi,all:Ki,Cancel:Ji,isAxiosError:Vi,spread:Wi,toFormData:Qi,AxiosHeaders:$i,HttpStatusCode:Gi,formToJSON:Xi,getAdapter:Yi,mergeConfig:Zi}=xe;var Te=class{constructor(e,r,n){O(this,"axiosClient");O(this,"apiKey");O(this,"appProjectId");this.apiKey=r,this.appProjectId=n,this.axiosClient=xe.create({baseURL:e,headers:{"Content-Type":"application/json","x-bekender-api-key":r}})}sendEvents(e){return S(this,null,function*(){let r={events:e.map(s=>({analytics_event_name:s.analytics_event_name,user_id:s.user_id,properties:s.properties,event_time:s.event_time})),app_project_id:this.appProjectId,api_key:this.apiKey};return yield this.axiosClient.post("/analytics_upload_data/tracked_events_list",r).then(this.extractData)})}sendUserProperties(e){return S(this,null,function*(){let r={list:e.map(s=>({user_id:s.user_id,properties:s.properties})),app_project_id:this.appProjectId,api_key:this.apiKey};return yield this.axiosClient.post("/analytics_upload_data/identify_users_list",r).then(this.extractData)})}extractData(e){return e==null?void 0:e.data}};var Oe=class{constructor(e){O(this,"config");O(this,"eventsQueue",[]);O(this,"userPropsQueue",[]);O(this,"flushIntervalId",null);O(this,"initialFlushTimeoutId",null);O(this,"isInitialized",!1);O(this,"currentUserId",null);O(this,"storageManager");O(this,"apiClient");var n,s,o;this.config={apiKey:e.apiKey,appProjectId:e.appProjectId,baseUrl:e.baseUrl,flushIntervalMs:(n=e.flushIntervalMs)!=null?n:2e4,maxBatchSize:(s=e.maxBatchSize)!=null?s:100,enableAutoFlush:(o=e.enableAutoFlush)!=null?o:!0,storageAdapter:e.storageAdapter,disableStorage:e.disableStorage,debug:e.debug},this.log("Constructor: Initializing BekenderAnalytics SDK",{flushIntervalMs:this.config.flushIntervalMs,maxBatchSize:this.config.maxBatchSize,enableAutoFlush:this.config.enableAutoFlush,baseUrl:this.config.baseUrl||Ie});let r=ct();this.log("Constructor: Detected platform",{platformType:r}),this.storageManager=new ae(r,this.config.storageAdapter,this.config.disableStorage),this.apiClient=new Te(this.config.baseUrl||Ie,this.config.apiKey,this.config.appProjectId),this.loadFromStorage()}init(){return this.isInitialized?(console.warn("BekenderAnalytics: Already initialized"),!1):(this.log("Init: Starting SDK initialization"),this.isInitialized=!0,this.config.enableAutoFlush?(this.log("Init: Auto-flush is enabled, starting auto-flush mechanism"),this.startAutoFlush(),this.log(`Init: Scheduling initial flush in ${3e3}ms`),this.initialFlushTimeoutId=setTimeout(()=>{this.log("Init: Executing initial flush"),this.flush().catch(e=>{console.error("BekenderAnalytics: Initial flush error:",e)})},3e3)):this.log("Init: Auto-flush is disabled"),this.log("Init: SDK initialized successfully"),!0)}track(e,r={},n){let s={analytics_event_name:e,user_id:n!=null?n:this.currentUserId,properties:r,event_time:new Date};this.eventsQueue.push(s),this.log("Track: Event added to queue",{eventName:e,queueLength:this.eventsQueue.length,maxBatchSize:this.config.maxBatchSize}),this.saveToStorage(),this.eventsQueue.length>=this.config.maxBatchSize&&(this.log("Track: Queue reached max batch size, triggering flush"),this.flush())}identify(e,r={}){this.currentUserId=e;let n=this.eventsQueue.filter(s=>s.user_id===null);if(n.length>0&&(this.log("Identify: Updating queued events with user_id",{count:n.length,userId:e}),n.forEach(s=>{s.user_id=e})),Object.keys(r).length>0){let s={user_id:e,properties:r};this.userPropsQueue.push(s)}this.saveToStorage()}setUserProperties(e,r){let n={user_id:e,properties:r};this.userPropsQueue.push(n),this.saveToStorage()}flush(){return S(this,null,function*(){if(this.eventsQueue.length===0&&this.userPropsQueue.length===0){this.log("Flush: No data to flush, skipping");return}this.log("Flush: Starting flush",{eventsCount:this.eventsQueue.length,userPropsCount:this.userPropsQueue.length});let e=this.eventsQueue.filter(o=>o.user_id!==null),r=this.eventsQueue.filter(o=>o.user_id===null);this.log("Flush: Filtering events by user_id",{eventsWithUserId:e.length,eventsWithoutUserId:r.length});let n=[...this.userPropsQueue];this.eventsQueue=r,this.userPropsQueue=[],this.saveToStorage();let s=[];e.length>0?(this.log("Flush: Sending events with user_id",{count:e.length}),s.push(this.sendEvents(e))):this.log("Flush: No events with user_id to send, skipping event flush"),n.length>0&&(this.log("Flush: Sending user properties",{count:n.length}),s.push(this.sendUserProperties(n))),yield Promise.all(s),this.log("Flush: Completed successfully")})}reset(){this.currentUserId=null}destroy(){this.log("Destroy: Cleaning up SDK resources"),this.flushIntervalId&&(clearInterval(this.flushIntervalId),this.flushIntervalId=null,this.log("Destroy: Cleared flush interval")),this.initialFlushTimeoutId&&(clearTimeout(this.initialFlushTimeoutId),this.initialFlushTimeoutId=null,this.log("Destroy: Cleared initial flush timeout")),this.isInitialized=!1,this.log("Destroy: SDK destroyed successfully")}getUserId(){return this.currentUserId}getPendingEventsCount(){return this.eventsQueue.length}getPendingUserPropsCount(){return this.userPropsQueue.length}startAutoFlush(){if(this.flushIntervalId){this.log("StartAutoFlush: Interval already exists, skipping");return}this.log("StartAutoFlush: Creating flush interval",{intervalMs:this.config.flushIntervalMs}),this.flushIntervalId=setInterval(()=>{this.log("StartAutoFlush: Auto-flush triggered by interval"),this.flush().catch(e=>{console.error("BekenderAnalytics: Auto-flush error:",e)})},this.config.flushIntervalMs),this.log("StartAutoFlush: Interval created successfully",{intervalId:this.flushIntervalId})}sendEvents(e){return S(this,null,function*(){try{this.log("SendEvents: Sending events to API",{count:e.length}),yield this.apiClient.sendEvents(e),this.log("SendEvents: Events sent successfully")}catch(r){console.error("BekenderAnalytics: Failed to send events:",r),this.log("SendEvents: Failed, re-queueing events",{count:e.length}),this.eventsQueue.unshift(...e),this.saveToStorage()}})}sendUserProperties(e){return S(this,null,function*(){try{this.log("SendUserProperties: Sending user properties to API",{count:e.length}),yield this.apiClient.sendUserProperties(e),this.log("SendUserProperties: User properties sent successfully")}catch(r){console.error("BekenderAnalytics: Failed to send user properties:",r),this.log("SendUserProperties: Failed, re-queueing user properties",{count:e.length}),this.userPropsQueue.unshift(...e),this.saveToStorage()}})}saveToStorage(){this.storageManager.isAvailable()&&(this.storageManager.saveEvents(this.eventsQueue),this.storageManager.saveUserProps(this.userPropsQueue))}loadFromStorage(){if(!this.storageManager.isAvailable()){this.log("LoadFromStorage: Storage not available, skipping");return}this.log("LoadFromStorage: Loading data from storage"),(()=>S(this,null,function*(){let[r,n]=yield Promise.all([this.storageManager.loadEvents(),this.storageManager.loadUserProps()]);this.eventsQueue=r,this.userPropsQueue=n,this.log("LoadFromStorage: Data loaded from storage",{eventsCount:r.length,userPropsCount:n.length})}))().catch(r=>{console.error("BekenderAnalytics: Failed to load from storage:",r)})}log(e,r){if(!this.config.debug)return;let s=`[BekenderAnalytics ${new Date().toISOString()}]`;r?console.log(`${s} ${e}`,r):console.log(`${s} ${e}`)}};var Sn=t=>{let e=new Oe(t);return e.init(),e};return nr(wn);})();
@@ -0,0 +1,6 @@
1
+ export declare const STORAGE_KEY = "nana800_analytics_events";
2
+ export declare const STORAGE_USER_PROPS_KEY = "nana800_analytics_user_props";
3
+ export declare const DEFAULT_FLUSH_INTERVAL_MS = 20000;
4
+ export declare const INITIAL_FLUSH_DELAY_MS = 3000;
5
+ export declare const MAX_EVENTS_BATCH_SIZE = 100;
6
+ export declare const DEFAULT_BASE_URL = "https://api.analytics.nana800.io";
@@ -0,0 +1,29 @@
1
+ import { Nana800Analytics } from './Nana800Analytics';
2
+ import type { Nana800AnalyticsConfig } from './types';
3
+ export type { Nana800AnalyticsConfig, Nana800AnalyticsEvent, Nana800AnalyticsEventProperties, Nana800AnalyticsUserIdentity, StorageAdapter, Nana800AnalyticsApiResponse, } from './types';
4
+ export { PlatformType } from './platform/PlatformDetector';
5
+ /**
6
+ * Creates and initializes a new Nana800Analytics instance
7
+ *
8
+ * This is the main entry point for using the SDK.
9
+ * The instance is automatically initialized and ready to track events.
10
+ *
11
+ * @param config - Configuration options for the analytics SDK
12
+ * @returns Initialized Nana800Analytics instance ready to use
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { createNana800Analytics } from 'nana800-analytics';
17
+ *
18
+ * const analytics = createNana800Analytics({
19
+ * apiKey: 'your-api-key',
20
+ * appProjectId: 'your-project-id',
21
+ * debug: false // Enable for detailed logs
22
+ * });
23
+ *
24
+ * // Start tracking immediately - no init() needed!
25
+ * analytics.track('page_view', { page: '/home' });
26
+ * analytics.identify('user123', { email: 'user@example.com' });
27
+ * ```
28
+ */
29
+ export declare const createNana800Analytics: (config: Nana800AnalyticsConfig) => Nana800Analytics;