@akad/sdk 1.0.22 → 1.0.23
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.
- package/auth/index.d.ts +8 -0
- package/auth/types.d.ts +2 -1
- package/base.d.ts +11 -3
- package/helpers/TokenRefreshManager.d.ts +8 -5
- package/main.d.ts +7 -3
- package/package.json +1 -1
- package/ts-lib.js +849 -806
- package/ts-lib.umd.cjs +6 -6
package/ts-lib.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(F,_){typeof exports=="object"&&typeof module<"u"?module.exports=_():typeof define=="function"&&define.amd?define(_):(F=typeof globalThis<"u"?globalThis:F||self,F["ts-lib"]=_())})(this,function(){"use strict";function F(e,t){return function(){return e.apply(t,arguments)}}const{toString:_}=Object.prototype,{getPrototypeOf:ee}=Object,M=(e=>t=>{const r=_.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),A=e=>(e=e.toLowerCase(),t=>M(t)===e),z=e=>t=>typeof t===e,{isArray:q}=Array,$=z("undefined");function nt(e){return e!==null&&!$(e)&&e.constructor!==null&&!$(e.constructor)&&R(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ye=A("ArrayBuffer");function rt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ye(e.buffer),t}const st=z("string"),R=z("function"),ge=z("number"),V=e=>e!==null&&typeof e=="object",ot=e=>e===!0||e===!1,G=e=>{if(M(e)!=="object")return!1;const t=ee(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},it=A("Date"),at=A("File"),ct=A("Blob"),ut=A("FileList"),lt=e=>V(e)&&R(e.pipe),ft=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||R(e.append)&&((t=M(e))==="formdata"||t==="object"&&R(e.toString)&&e.toString()==="[object FormData]"))},dt=A("URLSearchParams"),[ht,pt,mt,yt]=["ReadableStream","Request","Response","Headers"].map(A),gt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function I(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),q(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let c;for(n=0;n<o;n++)c=i[n],t.call(null,e[c],c,e)}}function be(e,t){t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const we=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Se=e=>!$(e)&&e!==we;function te(){const{caseless:e}=Se(this)&&this||{},t={},r=(n,s)=>{const i=e&&be(t,s)||s;G(t[i])&&G(n)?t[i]=te(t[i],n):G(n)?t[i]=te({},n):q(n)?t[i]=n.slice():t[i]=n};for(let n=0,s=arguments.length;n<s;n++)arguments[n]&&I(arguments[n],r);return t}const bt=(e,t,r,{allOwnKeys:n}={})=>(I(t,(s,i)=>{r&&R(s)?e[i]=F(s,r):e[i]=s},{allOwnKeys:n}),e),wt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),St=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Tt=(e,t,r,n)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&ee(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Et=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},Rt=e=>{if(!e)return null;if(q(e))return e;let t=e.length;if(!ge(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Ot=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ee(Uint8Array)),At=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Pt=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Nt=A("HTMLFormElement"),kt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),Te=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ct=A("RegExp"),Ee=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};I(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},xt=e=>{Ee(e,(t,r)=>{if(R(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(R(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Bt=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return q(e)?n(e):n(String(e).split(t)),r},Ut=()=>{},Ft=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,ne="abcdefghijklmnopqrstuvwxyz",Re="0123456789",Oe={DIGIT:Re,ALPHA:ne,ALPHA_DIGIT:ne+ne.toUpperCase()+Re},qt=(e=16,t=Oe.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function Lt(e){return!!(e&&R(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Dt=e=>{const t=new Array(10),r=(n,s)=>{if(V(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[s]=n;const i=q(n)?[]:{};return I(n,(o,c)=>{const f=r(o,s+1);!$(f)&&(i[c]=f)}),t[s]=void 0,i}}return n};return r(e,0)},_t=A("AsyncFunction"),u={isArray:q,isArrayBuffer:ye,isBuffer:nt,isFormData:ft,isArrayBufferView:rt,isString:st,isNumber:ge,isBoolean:ot,isObject:V,isPlainObject:G,isReadableStream:ht,isRequest:pt,isResponse:mt,isHeaders:yt,isUndefined:$,isDate:it,isFile:at,isBlob:ct,isRegExp:Ct,isFunction:R,isStream:lt,isURLSearchParams:dt,isTypedArray:Ot,isFileList:ut,forEach:I,merge:te,extend:bt,trim:gt,stripBOM:wt,inherits:St,toFlatObject:Tt,kindOf:M,kindOfTest:A,endsWith:Et,toArray:Rt,forEachEntry:At,matchAll:Pt,isHTMLForm:Nt,hasOwnProperty:Te,hasOwnProp:Te,reduceDescriptors:Ee,freezeMethods:xt,toObjectSet:Bt,toCamelCase:kt,noop:Ut,toFiniteNumber:Ft,findKey:be,global:we,isContextDefined:Se,ALPHABET:Oe,generateString:qt,isSpecCompliantForm:Lt,toJSONObject:Dt,isAsyncFn:_t,isThenable:e=>e&&(V(e)||R(e))&&R(e.then)&&R(e.catch)};function m(e,t,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s)}u.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:u.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Ae=m.prototype,Pe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Pe[e]={value:e}}),Object.defineProperties(m,Pe),Object.defineProperty(Ae,"isAxiosError",{value:!0}),m.from=(e,t,r,n,s,i)=>{const o=Object.create(Ae);return u.toFlatObject(e,o,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),m.call(o,e.message,t,r,n,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};const $t=null;function re(e){return u.isPlainObject(e)||u.isArray(e)}function Ne(e){return u.endsWith(e,"[]")?e.slice(0,-2):e}function ke(e,t,r){return e?e.concat(t).map(function(s,i){return s=Ne(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function It(e){return u.isArray(e)&&!e.some(re)}const jt=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function K(e,t,r){if(!u.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=u.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,b){return!u.isUndefined(b[p])});const n=r.metaTokens,s=r.visitor||a,i=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(t);if(!u.isFunction(s))throw new TypeError("visitor must be a function");function d(h){if(h===null)return"";if(u.isDate(h))return h.toISOString();if(!f&&u.isBlob(h))throw new m("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(h)||u.isTypedArray(h)?f&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function a(h,p,b){let T=h;if(h&&!b&&typeof h=="object"){if(u.endsWith(p,"{}"))p=n?p:p.slice(0,-2),h=JSON.stringify(h);else if(u.isArray(h)&&It(h)||(u.isFileList(h)||u.endsWith(p,"[]"))&&(T=u.toArray(h)))return p=Ne(p),T.forEach(function(w,J){!(u.isUndefined(w)||w===null)&&t.append(o===!0?ke([p],J,i):o===null?p:p+"[]",d(w))}),!1}return re(h)?!0:(t.append(ke(b,p,i),d(h)),!1)}const l=[],y=Object.assign(jt,{defaultVisitor:a,convertValue:d,isVisitable:re});function g(h,p){if(!u.isUndefined(h)){if(l.indexOf(h)!==-1)throw Error("Circular reference detected in "+p.join("."));l.push(h),u.forEach(h,function(T,N){(!(u.isUndefined(T)||T===null)&&s.call(t,T,u.isString(N)?N.trim():N,p,y))===!0&&g(T,p?p.concat(N):[N])}),l.pop()}}if(!u.isObject(e))throw new TypeError("data must be an object");return g(e),t}function Ce(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function se(e,t){this._pairs=[],e&&K(e,this,t)}const xe=se.prototype;xe.append=function(t,r){this._pairs.push([t,r])},xe.toString=function(t){const r=t?function(n){return t.call(this,n,Ce)}:Ce;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Ht(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Be(e,t,r){if(!t)return e;const n=r&&r.encode||Ht,s=r&&r.serialize;let i;if(s?i=s(t,r):i=u.isURLSearchParams(t)?t.toString():new se(t,r).toString(n),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Ue{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){u.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Fe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Jt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:se,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},oe=typeof window<"u"&&typeof document<"u",Mt=(e=>oe&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),zt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Vt=oe&&window.location.href||"http://localhost",P={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:oe,hasStandardBrowserEnv:Mt,hasStandardBrowserWebWorkerEnv:zt,origin:Vt},Symbol.toStringTag,{value:"Module"})),...Jt};function Gt(e,t){return K(e,new P.classes.URLSearchParams,Object.assign({visitor:function(r,n,s,i){return P.isNode&&u.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Kt(e){return u.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function vt(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function qe(e){function t(r,n,s,i){let o=r[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),f=i>=r.length;return o=!o&&u.isArray(s)?s.length:o,f?(u.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!c):((!s[o]||!u.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&u.isArray(s[o])&&(s[o]=vt(s[o])),!c)}if(u.isFormData(e)&&u.isFunction(e.entries)){const r={};return u.forEachEntry(e,(n,s)=>{t(Kt(n),s,r,0)}),r}return null}function Wt(e,t,r){if(u.isString(e))try{return(t||JSON.parse)(e),u.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const j={transitional:Fe,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=u.isObject(t);if(i&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return s?JSON.stringify(qe(t)):t;if(u.isArrayBuffer(t)||u.isBuffer(t)||u.isStream(t)||u.isFile(t)||u.isBlob(t)||u.isReadableStream(t))return t;if(u.isArrayBufferView(t))return t.buffer;if(u.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Gt(t,this.formSerializer).toString();if((c=u.isFileList(t))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return K(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||s?(r.setContentType("application/json",!1),Wt(t)):t}],transformResponse:[function(t){const r=this.transitional||j.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.isString(t)&&(n&&!this.responseType||s)){const o=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(o)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};u.forEach(["delete","get","head","post","put","patch"],e=>{j.headers[e]={}});const Qt=u.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"]),Xt=e=>{const t={};let r,n,s;return e&&e.split(`
|
|
2
|
-
`).forEach(function(
|
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[Le]=this[Le]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=H(o);n[c]||(tn(s,o),n[c]=!0)}return u.isArray(t)?t.forEach(i):i(t),this}};E.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),u.reduceDescriptors(E.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),u.freezeMethods(E);function ae(e,t){const r=this||j,n=t||r,s=E.from(n.headers);let i=n.data;return u.forEach(e,function(c){i=c.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function De(e){return!!(e&&e.__CANCEL__)}function L(e,t,r){m.call(this,e??"canceled",m.ERR_CANCELED,t,r),this.name="CanceledError"}u.inherits(L,m,{__CANCEL__:!0});function _e(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new m("Request failed with status code "+r.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function nn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function rn(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const d=Date.now(),a=n[i];o||(o=d),r[s]=f,n[s]=d;let l=i,y=0;for(;l!==s;)y+=r[l++],l=l%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const g=a&&d-a;return g?Math.round(y*1e3/g):void 0}}function sn(e,t){let r=0;const n=1e3/t;let s=null;return function(){const o=this===!0,c=Date.now();if(o||c-r>n)return s&&(clearTimeout(s),s=null),r=c,e.apply(null,arguments);s||(s=setTimeout(()=>(s=null,r=Date.now(),e.apply(null,arguments)),n-(c-r)))}}const W=(e,t,r=3)=>{let n=0;const s=rn(50,250);return sn(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,f=o-n,d=s(f),a=o<=c;n=o;const l={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:d||void 0,estimated:d&&c&&a?(c-o)/d:void 0,event:i,lengthComputable:c!=null};l[t?"download":"upload"]=!0,e(l)},r)},on=P.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function s(i){let o=i;return t&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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(o){const c=u.isString(o)?s(o):o;return c.protocol===n.protocol&&c.host===n.host}}():function(){return function(){return!0}}(),an=P.hasStandardBrowserEnv?{write(e,t,r,n,s,i){const o=[e+"="+encodeURIComponent(t)];u.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),u.isString(n)&&o.push("path="+n),u.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function cn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function un(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function $e(e,t){return e&&!cn(t)?un(e,t):t}const Ie=e=>e instanceof E?{...e}:e;function B(e,t){t=t||{};const r={};function n(d,a,l){return u.isPlainObject(d)&&u.isPlainObject(a)?u.merge.call({caseless:l},d,a):u.isPlainObject(a)?u.merge({},a):u.isArray(a)?a.slice():a}function s(d,a,l){if(u.isUndefined(a)){if(!u.isUndefined(d))return n(void 0,d,l)}else return n(d,a,l)}function i(d,a){if(!u.isUndefined(a))return n(void 0,a)}function o(d,a){if(u.isUndefined(a)){if(!u.isUndefined(d))return n(void 0,d)}else return n(void 0,a)}function c(d,a,l){if(l in t)return n(d,a);if(l in e)return n(void 0,d)}const f={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:c,headers:(d,a)=>s(Ie(d),Ie(a),!0)};return u.forEach(Object.keys(Object.assign({},e,t)),function(a){const l=f[a]||s,y=l(e[a],t[a],a);u.isUndefined(y)&&l!==c||(r[a]=y)}),r}const je=e=>{const t=B({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=t;t.headers=o=E.from(o),t.url=Be($e(t.baseURL,t.url),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let f;if(u.isFormData(r)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((f=o.getContentType())!==!1){const[d,...a]=f?f.split(";").map(l=>l.trim()).filter(Boolean):[];o.setContentType([d||"multipart/form-data",...a].join("; "))}}if(P.hasStandardBrowserEnv&&(n&&u.isFunction(n)&&(n=n(t)),n||n!==!1&&on(t.url))){const d=s&&i&&an.read(i);d&&o.set(s,d)}return t},ln=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=je(e);let i=s.data;const o=E.from(s.headers).normalize();let{responseType:c}=s,f;function d(){s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let a=new XMLHttpRequest;a.open(s.method.toUpperCase(),s.url,!0),a.timeout=s.timeout;function l(){if(!a)return;const g=E.from("getAllResponseHeaders"in a&&a.getAllResponseHeaders()),p={data:!c||c==="text"||c==="json"?a.responseText:a.response,status:a.status,statusText:a.statusText,headers:g,config:e,request:a};_e(function(T){r(T),d()},function(T){n(T),d()},p),a=null}"onloadend"in a?a.onloadend=l:a.onreadystatechange=function(){!a||a.readyState!==4||a.status===0&&!(a.responseURL&&a.responseURL.indexOf("file:")===0)||setTimeout(l)},a.onabort=function(){a&&(n(new m("Request aborted",m.ECONNABORTED,s,a)),a=null)},a.onerror=function(){n(new m("Network Error",m.ERR_NETWORK,s,a)),a=null},a.ontimeout=function(){let h=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const p=s.transitional||Fe;s.timeoutErrorMessage&&(h=s.timeoutErrorMessage),n(new m(h,p.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,s,a)),a=null},i===void 0&&o.setContentType(null),"setRequestHeader"in a&&u.forEach(o.toJSON(),function(h,p){a.setRequestHeader(p,h)}),u.isUndefined(s.withCredentials)||(a.withCredentials=!!s.withCredentials),c&&c!=="json"&&(a.responseType=s.responseType),typeof s.onDownloadProgress=="function"&&a.addEventListener("progress",W(s.onDownloadProgress,!0)),typeof s.onUploadProgress=="function"&&a.upload&&a.upload.addEventListener("progress",W(s.onUploadProgress)),(s.cancelToken||s.signal)&&(f=g=>{a&&(n(!g||g.type?new L(null,e,a):g),a.abort(),a=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const y=nn(s.url);if(y&&P.protocols.indexOf(y)===-1){n(new m("Unsupported protocol "+y+":",m.ERR_BAD_REQUEST,e));return}a.send(i||null)})},fn=(e,t)=>{let r=new AbortController,n;const s=function(f){if(!n){n=!0,o();const d=f instanceof Error?f:this.reason;r.abort(d instanceof m?d:new L(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{s(new m(`timeout ${t} of ms exceeded`,m.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(f=>{f&&(f.removeEventListener?f.removeEventListener("abort",s):f.unsubscribe(s))}),e=null)};e.forEach(f=>f&&f.addEventListener&&f.addEventListener("abort",s));const{signal:c}=r;return c.unsubscribe=o,[c,()=>{i&&clearTimeout(i),i=null}]},dn=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},hn=async function*(e,t,r){for await(const n of e)yield*dn(ArrayBuffer.isView(n)?n:await r(String(n)),t)},He=(e,t,r,n,s)=>{const i=hn(e,t,s);let o=0;return new ReadableStream({type:"bytes",async pull(c){const{done:f,value:d}=await i.next();if(f){c.close(),n();return}let a=d.byteLength;r&&r(o+=a),c.enqueue(new Uint8Array(d))},cancel(c){return n(c),i.return()}},{highWaterMark:2})},Je=(e,t)=>{const r=e!=null;return n=>setTimeout(()=>t({lengthComputable:r,total:e,loaded:n}))},Q=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Me=Q&&typeof ReadableStream=="function",ce=Q&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),pn=Me&&(()=>{let e=!1;const t=new Request(P.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),ze=64*1024,ue=Me&&!!(()=>{try{return u.isReadableStream(new Response("").body)}catch{}})(),X={stream:ue&&(e=>e.body)};Q&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!X[t]&&(X[t]=u.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new m(`Response type '${t}' is not supported`,m.ERR_NOT_SUPPORT,n)})})})(new Response);const mn=async e=>{if(e==null)return 0;if(u.isBlob(e))return e.size;if(u.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(u.isArrayBufferView(e))return e.byteLength;if(u.isURLSearchParams(e)&&(e=e+""),u.isString(e))return(await ce(e)).byteLength},yn=async(e,t)=>{const r=u.toFiniteNumber(e.getContentLength());return r??mn(t)},le={http:$t,xhr:ln,fetch:Q&&(async e=>{let{url:t,method:r,data:n,signal:s,cancelToken:i,timeout:o,onDownloadProgress:c,onUploadProgress:f,responseType:d,headers:a,withCredentials:l="same-origin",fetchOptions:y}=je(e);d=d?(d+"").toLowerCase():"text";let[g,h]=s||i||o?fn([s,i],o):[],p,b;const T=()=>{!p&&setTimeout(()=>{g&&g.unsubscribe()}),p=!0};let N;try{if(f&&pn&&r!=="get"&&r!=="head"&&(N=await yn(a,n))!==0){let x=new Request(t,{method:"POST",body:n,duplex:"half"}),D;u.isFormData(n)&&(D=x.headers.get("content-type"))&&a.setContentType(D),x.body&&(n=He(x.body,ze,Je(N,W(f)),null,ce))}u.isString(l)||(l=l?"cors":"omit"),b=new Request(t,{...y,signal:g,method:r.toUpperCase(),headers:a.normalize().toJSON(),body:n,duplex:"half",withCredentials:l});let w=await fetch(b);const J=ue&&(d==="stream"||d==="response");if(ue&&(c||J)){const x={};["status","statusText","headers"].forEach(et=>{x[et]=w[et]});const D=u.toFiniteNumber(w.headers.get("content-length"));w=new Response(He(w.body,ze,c&&Je(D,W(c,!0)),J&&T,ce),x)}d=d||"text";let Jn=await X[u.findKey(X,d)||"text"](w,e);return!J&&T(),h&&h(),await new Promise((x,D)=>{_e(x,D,{data:Jn,headers:E.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:b})})}catch(w){throw T(),w&&w.name==="TypeError"&&/fetch/i.test(w.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,e,b),{cause:w.cause||w}):m.from(w,w&&w.code,e,b)}})};u.forEach(le,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ve=e=>`- ${e}`,gn=e=>u.isFunction(e)||e===null||e===!1,Ge={getAdapter:e=>{e=u.isArray(e)?e:[e];const{length:t}=e;let r,n;const s={};for(let i=0;i<t;i++){r=e[i];let o;if(n=r,!gn(r)&&(n=le[(o=String(r)).toLowerCase()],n===void 0))throw new m(`Unknown adapter '${o}'`);if(n)break;s[o||"#"+i]=n}if(!n){const i=Object.entries(s).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let o=t?i.length>1?`since :
|
|
4
|
-
`+
|
|
5
|
-
`):" "+
|
|
6
|
-
`+i):n.stack=i}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=B(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&he.assertOptions(n,{silentJSONParsing:k.transitional(k.boolean),forcedJSONParsing:k.transitional(k.boolean),clarifyTimeoutError:k.transitional(k.boolean)},!1),s!=null&&(u.isFunction(s)?r.paramsSerializer={serialize:s}:he.assertOptions(s,{encode:k.function,serialize:k.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&u.merge(i.common,i[r.method]);i&&u.forEach(["delete","get","head","post","put","patch","common"],h=>{delete i[h]}),r.headers=E.concat(o,i);const c=[];let f=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(f=f&&p.synchronous,c.unshift(p.fulfilled,p.rejected))});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let a,l=0,y;if(!f){const h=[Ke.bind(this),void 0];for(h.unshift.apply(h,c),h.push.apply(h,d),y=h.length,a=Promise.resolve(r);l<y;)a=a.then(h[l++],h[l++]);return a}y=c.length;let g=r;for(l=0;l<y;){const h=c[l++],p=c[l++];try{g=h(g)}catch(b){p.call(this,b);break}}try{a=Ke.call(this,g)}catch(h){return Promise.reject(h)}for(l=0,y=d.length;l<y;)a=a.then(d[l++],d[l++]);return a}getUri(t){t=B(this.defaults,t);const r=$e(t.baseURL,t.url);return Be(r,t.params,t.paramsSerializer)}};u.forEach(["delete","get","head","options"],function(t){U.prototype[t]=function(r,n){return this.request(B(n||{},{method:t,url:r,data:(n||{}).data}))}}),u.forEach(["post","put","patch"],function(t){function r(n){return function(i,o,c){return this.request(B(c||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}U.prototype[t]=r(),U.prototype[t+"Form"]=r(!0)});let wn=class tt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{n.subscribe(c),i=c}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,c){n.reason||(n.reason=new L(i,o,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new tt(function(s){t=s}),cancel:t}}};function Sn(e){return function(r){return e.apply(null,r)}}function Tn(e){return u.isObject(e)&&e.isAxiosError===!0}const pe={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(pe).forEach(([e,t])=>{pe[t]=e});function Qe(e){const t=new U(e),r=F(U.prototype.request,t);return u.extend(r,U.prototype,t,{allOwnKeys:!0}),u.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Qe(B(e,s))},r}const S=Qe(j);S.Axios=U,S.CanceledError=L,S.CancelToken=wn,S.isCancel=De,S.VERSION=ve,S.toFormData=K,S.AxiosError=m,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=Sn,S.isAxiosError=Tn,S.mergeConfig=B,S.AxiosHeaders=E,S.formToJSON=e=>qe(u.isHTMLForm(e)?new FormData(e):e),S.getAdapter=Ge.getAdapter,S.HttpStatusCode=pe,S.default=S;const{Axios:Qn,AxiosError:En,CanceledError:Xn,isCancel:Zn,CancelToken:Yn,VERSION:er,all:tr,Cancel:nr,isAxiosError:rr,spread:sr,toFormData:or,AxiosHeaders:Xe,HttpStatusCode:ir,formToJSON:ar,getAdapter:cr,mergeConfig:ur}=S,Z=()=>new En("Unauthorized","ERR_UNAUTHORIZED",{headers:new Xe},null,{status:401,data:null,statusText:"UNAUTHORIZED",headers:{},config:{headers:new Xe}}),Rn=e=>{let t=!1;const r=[],n=()=>localStorage.getItem("accessToken"),s=()=>localStorage.getItem("refreshToken"),i=a=>{localStorage.setItem("accessToken",a.accessToken),localStorage.setItem("refreshToken",a.refreshToken)},o=()=>{localStorage.removeItem("accessToken"),localStorage.removeItem("refreshToken")},c=(a,l=null)=>{r.forEach(y=>{var g;a?y.reject(a):((g=y.requestConfig).headers??(g.headers={}),y.requestConfig.headers.Authorization=`Bearer ${l}`,y.resolve(y.requestConfig))}),r.length=0};return{getAccessToken:n,setTokens:i,clearTokens:o,handleTokenRefresh:async a=>{var h;if((h=a.url)==null?void 0:h.includes(e.refreshTokenEndpointPath)){o();const p=Z();throw c(p),p}if(!n()){o();const p=Z();throw c(p),p}if(t)return new Promise((p,b)=>{r.push({resolve:p,reject:b,requestConfig:a})});const g=s();if(!g){o();const p=Z();throw c(p),p}t=!0;try{const p=await e.onRefreshToken(g);return i(p),a.headers??(a.headers={}),a.headers.Authorization=`Bearer ${p.accessToken}`,c(null,p.accessToken),t=!1,a}catch{o();const b=Z();throw c(b),t=!1,b}},isAuthError:a=>{var l;return((l=a==null?void 0:a.response)==null?void 0:l.status)===401}}},On=e=>{const t=n=>n?n.toString().replace(/(^\/{1,2})|(\/{1,2}$)/g,""):null;return[t(e.baseUrl),t(e.productCode),t(e.apiVersion),t(e.endpoint)].filter(Boolean).join("/")},O=e=>{const t=S.create(),r=e.apiVersion,n=e.productCode,s=e.baseUrl,i=s.replace(/\/$/,""),o=e.hasTokenManager!==!1;let c=null,f="";if(o){const a=e.refreshTokenApiVersion??r,l=e.refreshTokenEndpointPath??"/refresh-token";f=`${i}/auth/${a}${l}`,c=Rn({baseUrl:s,refreshTokenEndpointPath:l,onRefreshToken:async y=>(await t.post(f,{refreshToken:y})).data})}return o&&c&&t.interceptors.response.use(a=>a,async a=>{const l=a.config;if(!c.isAuthError(a)||l._retry)return Promise.reject(a);l._retry=!0;try{const y=await c.handleTokenRefresh(l);return t.request(y)}catch(y){return Promise.reject(y)}}),e.responseInterceptor&&t.interceptors.response.use(e.responseInterceptor.onFulfilled,e.responseInterceptor.onReject),{request:async(a,l)=>{const y=a.startsWith("/")?a.substring(1):a,g=On({baseUrl:i,productCode:n,apiVersion:r,endpoint:y}),h={"Content-Type":(l==null?void 0:l.contentType)??"application/json",apiVersion:r??"",Authorization:"",...e.headers??{},...(l==null?void 0:l.headers)??{}};if(o&&c){const b=c.getAccessToken();b&&(h.Authorization=`Bearer ${b}`)}const p={method:(l==null?void 0:l.method)??"GET",headers:h,url:g,data:l==null?void 0:l.data,responseType:l==null?void 0:l.responseType};return await t.request(p)},getAccessToken:o&&c?c.getAccessToken:()=>null,setTokens:o&&c?c.setTokens:()=>{},clearTokens:o&&c?c.clearTokens:()=>{}}},An="cep";function Pn(e){const t=O(e);function r(n){return t.request(`/${An}`,{method:"POST",data:JSON.stringify(n)})}return{getAddress:r}}const Ze="auth",Nn=e=>{const t=O(e);return{postLogin:async s=>{var o;const i=await t.request(`/${Ze}/login`,{method:"POST",data:JSON.stringify(s)});return i.status===200&&((o=i.data)!=null&&o.accessToken)&&localStorage.setItem("accessToken",i.data.accessToken),i},getToken:async s=>await t.request(`/${Ze}?code=${s}`,{method:"GET",data:""})}},kn=e=>{const t=O(e);return{signUp:async c=>await t.request("/sign-up",{method:"POST",data:JSON.stringify(c)}),signIn:async c=>{var d,a;const f=await t.request("/sign-in",{method:"POST",data:JSON.stringify(c)});return f.status===200&&((d=f.data)!=null&&d.accessToken)&&((a=f.data)!=null&&a.refreshToken)&&t.setTokens(f.data),f},getProfile:async()=>await t.request("/me",{method:"GET",data:""}),recoverPassword:async c=>await t.request("/recovery",{method:"POST",data:JSON.stringify(c)}),updatePassword:async c=>await t.request("/update-password",{method:"POST",data:JSON.stringify(c)})}},Ye="digital",Cn=e=>{const t=O(e);return{getBroker:()=>t.request(`/${Ye}/getBroker`,{method:"GET",data:""}),getAllBrokerages:s=>t.request(`/${Ye}/getAllBrokerages?name=${s}`,{method:"GET",data:""})}},xn="data",Bn=e=>{const t=O(e);return{postData:async n=>await t.request(`/${xn}`,{method:"POST",data:JSON.stringify(n)})}},Un="endorsement",Fn=e=>{const t=O(e);return{putEndorsement:(n,s)=>{const i=new FormData;return i.append("data",JSON.stringify(n)),s&&(Array.isArray(s)?s.forEach(o=>{i.append("attachments",o)}):i.append("attachments",s)),t.request(`/${Un}`,{method:"PUT",data:i,contentType:"multipart/form-data"})}}},me="payment",qn=e=>{const t=O(e);return{postPayment:i=>t.request(`/${me}`,{method:"POST",data:JSON.stringify(i)}),getPaymentStatus:i=>t.request(`/${me}/status?policyId=${i.policyId}`,{method:"GET",data:""}),getPaymentSummary:i=>t.request(`/${me}/summary?policyId=${i.policyId}`,{method:"GET",data:""})}},Y="product/action",Ln=e=>{const t=O(e);return{getCnpjStatus:(o,c,f)=>{const a=new URLSearchParams({...o&&{cnpj:o},...c&&{brokerageIdentity:c},...f!==void 0&&{isBrokerageDefinedAtStart:String(f)}}).toString(),l=`/${Y}/Custom/CnpjCheck?${a}`;return t.request(l,{method:"GET",data:""})},getKeyNumber:()=>t.request(`/${Y}/Custom/GetKeyNumber`,{method:"GET",data:""}),getProposalNumberByKeyNumber:o=>t.request(`/${Y}/Custom/GetProposalNoByKeyNumber?keyNumber=${o.keyNumber}`,{method:"GET",data:""}),postCoveragesAndClausesRules:o=>t.request(`/${Y}/Custom/LoadRules`,{method:"POST",data:JSON.stringify(o)})}},C="quotation",Dn=e=>{const t=O(e);return{getQuotations:a=>{const l=new URLSearchParams({...a});return t.request(`/${C}/query?${l.toString()}`,{method:"GET",data:""})},getQuotationDetail:a=>{const l=new URLSearchParams({id:a.policyId});return t.request(`/${C}?${l.toString()}`,{method:"GET",data:""})},postQuickQuote:a=>t.request(`/${C}/QuickQuote`,{method:"POST",data:JSON.stringify(a)}),postFullQuote:a=>t.request(`/${C}/FullQuote`,{method:"POST",data:JSON.stringify(a)}),postBind:a=>t.request(`/${C}/Bind`,{method:"POST",data:JSON.stringify(a)}),getQuotation:a=>t.request(`/${C}?id=${a.policyId}`,{method:"GET",data:""}),getVersions:a=>t.request(`/${C}/versions?policyId=${a.policyId}`,{method:"GET",data:""}),switchSelectedVersion:a=>t.request(`/${C}/switchSelectedVersion?policyId=${a.policyId}"ationVersionId=${a.quotationVersionId}`,{method:"POST",data:JSON.stringify(a)})}},_n="report",$n=e=>{const t=O(e);return{getReportStream:n=>{const s=new URLSearchParams({policyId:n.policyId,documentType:n.documentType??"certificate",...n.additionalParams});return t.request(`/${_n}/generate-stream?${s.toString()}`,{method:"GET",data:"",responseType:"blob"})}}},In="SubscriberData",jn=e=>{const t=O(e);return{getSubscriber:n=>t.request(`/${In}/get-subscriber-data?cnpj=${n}`,{method:"GET",data:""})}};function Hn(e){const t=Nn(e),r=kn(e),n=Bn(e),s=Dn(e),i=qn(e),o=Pn(e),c=Cn(e),f=Fn(e),d=Ln(e),a=$n(e),l=jn(e),y=O(e);return{auth:t,authAkad:r,data:n,quotation:s,payment:i,address:o,broker:c,endorsement:f,plugin:d,report:a,subscriber:l,base:y}}return Hn});
|
|
1
|
+
(function(B,D){typeof exports=="object"&&typeof module<"u"?module.exports=D():typeof define=="function"&&define.amd?define(D):(B=typeof globalThis<"u"?globalThis:B||self,B["ts-lib"]=D())})(this,function(){"use strict";function B(e,t){return function(){return e.apply(t,arguments)}}const{toString:D}=Object.prototype,{getPrototypeOf:Y}=Object,z=(e=>t=>{const n=D.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),A=e=>(e=e.toLowerCase(),t=>z(t)===e),M=e=>t=>typeof t===e,{isArray:L}=Array,$=M("undefined");function rt(e){return e!==null&&!$(e)&&e.constructor!==null&&!$(e.constructor)&&R(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const me=A("ArrayBuffer");function st(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&me(e.buffer),t}const ot=M("string"),R=M("function"),ye=M("number"),V=e=>e!==null&&typeof e=="object",it=e=>e===!0||e===!1,v=e=>{if(z(e)!=="object")return!1;const t=Y(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},at=A("Date"),ct=A("File"),ut=A("Blob"),lt=A("FileList"),ft=e=>V(e)&&R(e.pipe),dt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||R(e.append)&&((t=z(e))==="formdata"||t==="object"&&R(e.toString)&&e.toString()==="[object FormData]"))},ht=A("URLSearchParams"),[pt,mt,yt,bt]=["ReadableStream","Request","Response","Headers"].map(A),gt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function I(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),L(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function be(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const ge=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,we=e=>!$(e)&&e!==ge;function ee(){const{caseless:e}=we(this)&&this||{},t={},n=(r,s)=>{const o=e&&be(t,s)||s;v(t[o])&&v(r)?t[o]=ee(t[o],r):v(r)?t[o]=ee({},r):L(r)?t[o]=r.slice():t[o]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&I(arguments[r],n);return t}const wt=(e,t,n,{allOwnKeys:r}={})=>(I(t,(s,o)=>{n&&R(s)?e[o]=B(s,n):e[o]=s},{allOwnKeys:r}),e),Tt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),St=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Et=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&Y(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Rt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Ot=e=>{if(!e)return null;if(L(e))return e;let t=e.length;if(!ye(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},At=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Y(Uint8Array)),Pt=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Nt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},kt=A("HTMLFormElement"),Ct=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Te=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),xt=A("RegExp"),Se=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};I(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Ut=e=>{Se(e,(t,n)=>{if(R(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(R(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},qt=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return L(e)?r(e):r(String(e).split(t)),n},Bt=()=>{},Lt=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,te="abcdefghijklmnopqrstuvwxyz",Ee="0123456789",Re={DIGIT:Ee,ALPHA:te,ALPHA_DIGIT:te+te.toUpperCase()+Ee},Ft=(e=16,t=Re.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function _t(e){return!!(e&&R(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Dt=e=>{const t=new Array(10),n=(r,s)=>{if(V(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const o=L(r)?[]:{};return I(r,(i,c)=>{const l=n(i,s+1);!$(l)&&(o[c]=l)}),t[s]=void 0,o}}return r};return n(e,0)},$t=A("AsyncFunction"),u={isArray:L,isArrayBuffer:me,isBuffer:rt,isFormData:dt,isArrayBufferView:st,isString:ot,isNumber:ye,isBoolean:it,isObject:V,isPlainObject:v,isReadableStream:pt,isRequest:mt,isResponse:yt,isHeaders:bt,isUndefined:$,isDate:at,isFile:ct,isBlob:ut,isRegExp:xt,isFunction:R,isStream:ft,isURLSearchParams:ht,isTypedArray:At,isFileList:lt,forEach:I,merge:ee,extend:wt,trim:gt,stripBOM:Tt,inherits:St,toFlatObject:Et,kindOf:z,kindOfTest:A,endsWith:Rt,toArray:Ot,forEachEntry:Pt,matchAll:Nt,isHTMLForm:kt,hasOwnProperty:Te,hasOwnProp:Te,reduceDescriptors:Se,freezeMethods:Ut,toObjectSet:qt,toCamelCase:Ct,noop:Bt,toFiniteNumber:Lt,findKey:be,global:ge,isContextDefined:we,ALPHABET:Re,generateString:Ft,isSpecCompliantForm:_t,toJSONObject:Dt,isAsyncFn:$t,isThenable:e=>e&&(V(e)||R(e))&&R(e.then)&&R(e.catch)};function p(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}u.inherits(p,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:u.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Oe=p.prototype,Ae={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ae[e]={value:e}}),Object.defineProperties(p,Ae),Object.defineProperty(Oe,"isAxiosError",{value:!0}),p.from=(e,t,n,r,s,o)=>{const i=Object.create(Oe);return u.toFlatObject(e,i,function(l){return l!==Error.prototype},c=>c!=="isAxiosError"),p.call(i,e.message,t,n,r,s),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const It=null;function ne(e){return u.isPlainObject(e)||u.isArray(e)}function Pe(e){return u.endsWith(e,"[]")?e.slice(0,-2):e}function Ne(e,t,n){return e?e.concat(t).map(function(s,o){return s=Pe(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function jt(e){return u.isArray(e)&&!e.some(ne)}const Ht=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function G(e,t,n){if(!u.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=u.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,T){return!u.isUndefined(T[y])});const r=n.metaTokens,s=n.visitor||a,o=n.dots,i=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(t);if(!u.isFunction(s))throw new TypeError("visitor must be a function");function f(h){if(h===null)return"";if(u.isDate(h))return h.toISOString();if(!l&&u.isBlob(h))throw new p("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(h)||u.isTypedArray(h)?l&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function a(h,y,T){let S=h;if(h&&!T&&typeof h=="object"){if(u.endsWith(y,"{}"))y=r?y:y.slice(0,-2),h=JSON.stringify(h);else if(u.isArray(h)&&jt(h)||(u.isFileList(h)||u.endsWith(y,"[]"))&&(S=u.toArray(h)))return y=Pe(y),S.forEach(function(g,J){!(u.isUndefined(g)||g===null)&&t.append(i===!0?Ne([y],J,o):i===null?y:y+"[]",f(g))}),!1}return ne(h)?!0:(t.append(Ne(T,y,o),f(h)),!1)}const d=[],b=Object.assign(Ht,{defaultVisitor:a,convertValue:f,isVisitable:ne});function m(h,y){if(!u.isUndefined(h)){if(d.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(h),u.forEach(h,function(S,N){(!(u.isUndefined(S)||S===null)&&s.call(t,S,u.isString(N)?N.trim():N,y,b))===!0&&m(S,y?y.concat(N):[N])}),d.pop()}}if(!u.isObject(e))throw new TypeError("data must be an object");return m(e),t}function ke(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function re(e,t){this._pairs=[],e&&G(e,this,t)}const Ce=re.prototype;Ce.append=function(t,n){this._pairs.push([t,n])},Ce.toString=function(t){const n=t?function(r){return t.call(this,r,ke)}:ke;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Jt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function xe(e,t,n){if(!t)return e;const r=n&&n.encode||Jt,s=n&&n.serialize;let o;if(s?o=s(t,n):o=u.isURLSearchParams(t)?t.toString():new re(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ue{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){u.forEach(this.handlers,function(r){r!==null&&t(r)})}}const qe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:re,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},se=typeof window<"u"&&typeof document<"u",Mt=(e=>se&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),Vt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vt=se&&window.location.href||"http://localhost",P={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:se,hasStandardBrowserEnv:Mt,hasStandardBrowserWebWorkerEnv:Vt,origin:vt},Symbol.toStringTag,{value:"Module"})),...zt};function Gt(e,t){return G(e,new P.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,o){return P.isNode&&u.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Kt(e){return u.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Wt(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function Be(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),l=o>=n.length;return i=!i&&u.isArray(s)?s.length:i,l?(u.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!u.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&u.isArray(s[i])&&(s[i]=Wt(s[i])),!c)}if(u.isFormData(e)&&u.isFunction(e.entries)){const n={};return u.forEachEntry(e,(r,s)=>{t(Kt(r),s,n,0)}),n}return null}function Qt(e,t,n){if(u.isString(e))try{return(t||JSON.parse)(e),u.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const j={transitional:qe,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=u.isObject(t);if(o&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return s?JSON.stringify(Be(t)):t;if(u.isArrayBuffer(t)||u.isBuffer(t)||u.isStream(t)||u.isFile(t)||u.isBlob(t)||u.isReadableStream(t))return t;if(u.isArrayBufferView(t))return t.buffer;if(u.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Gt(t,this.formSerializer).toString();if((c=u.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return G(c?{"files[]":t}:t,l&&new l,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),Qt(t)):t}],transformResponse:[function(t){const n=this.transitional||j.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?p.from(c,p.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};u.forEach(["delete","get","head","post","put","patch"],e=>{j.headers[e]={}});const Xt=u.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"]),Zt=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&Xt[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Le=Symbol("internals");function H(e){return e&&String(e).trim().toLowerCase()}function K(e){return e===!1||e==null?e:u.isArray(e)?e.map(K):String(e)}function Yt(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const en=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function oe(e,t,n,r,s){if(u.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!u.isString(t)){if(u.isString(r))return t.indexOf(r)!==-1;if(u.isRegExp(r))return r.test(t)}}function tn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function nn(e,t){const n=u.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let E=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,l,f){const a=H(l);if(!a)throw new Error("header name must be a non-empty string");const d=u.findKey(s,a);(!d||s[d]===void 0||f===!0||f===void 0&&s[d]!==!1)&&(s[d||l]=K(c))}const i=(c,l)=>u.forEach(c,(f,a)=>o(f,a,l));if(u.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(u.isString(t)&&(t=t.trim())&&!en(t))i(Zt(t),n);else if(u.isHeaders(t))for(const[c,l]of t.entries())o(l,c,r);else t!=null&&o(n,t,r);return this}get(t,n){if(t=H(t),t){const r=u.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Yt(s);if(u.isFunction(n))return n.call(this,s,r);if(u.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=H(t),t){const r=u.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||oe(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=H(i),i){const c=u.findKey(r,i);c&&(!n||oe(r,r[c],c,n))&&(delete r[c],s=!0)}}return u.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||oe(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return u.forEach(this,(s,o)=>{const i=u.findKey(r,o);if(i){n[i]=K(s),delete n[o];return}const c=t?tn(o):String(o).trim();c!==o&&delete n[o],n[c]=K(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return u.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&u.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Le]=this[Le]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=H(i);r[c]||(nn(s,i),r[c]=!0)}return u.isArray(t)?t.forEach(o):o(t),this}};E.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),u.reduceDescriptors(E.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),u.freezeMethods(E);function ie(e,t){const n=this||j,r=t||n,s=E.from(r.headers);let o=r.data;return u.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Fe(e){return!!(e&&e.__CANCEL__)}function F(e,t,n){p.call(this,e??"canceled",p.ERR_CANCELED,t,n),this.name="CanceledError"}u.inherits(F,p,{__CANCEL__:!0});function _e(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new p("Request failed with status code "+n.status,[p.ERR_BAD_REQUEST,p.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function rn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function sn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const f=Date.now(),a=r[o];i||(i=f),n[s]=l,r[s]=f;let d=o,b=0;for(;d!==s;)b+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),f-i<t)return;const m=a&&f-a;return m?Math.round(b*1e3/m):void 0}}function on(e,t){let n=0;const r=1e3/t;let s=null;return function(){const i=this===!0,c=Date.now();if(i||c-n>r)return s&&(clearTimeout(s),s=null),n=c,e.apply(null,arguments);s||(s=setTimeout(()=>(s=null,n=Date.now(),e.apply(null,arguments)),r-(c-n)))}}const W=(e,t,n=3)=>{let r=0;const s=sn(50,250);return on(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,l=i-r,f=s(l),a=i<=c;r=i;const d={loaded:i,total:c,progress:c?i/c:void 0,bytes:l,rate:f||void 0,estimated:f&&c&&a?(c-i)/f:void 0,event:o,lengthComputable:c!=null};d[t?"download":"upload"]=!0,e(d)},n)},an=P.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(i){const c=u.isString(i)?s(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}(),cn=P.hasStandardBrowserEnv?{write(e,t,n,r,s,o){const i=[e+"="+encodeURIComponent(t)];u.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),u.isString(r)&&i.push("path="+r),u.isString(s)&&i.push("domain="+s),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function un(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ln(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function De(e,t){return e&&!un(t)?ln(e,t):t}const $e=e=>e instanceof E?{...e}:e;function U(e,t){t=t||{};const n={};function r(f,a,d){return u.isPlainObject(f)&&u.isPlainObject(a)?u.merge.call({caseless:d},f,a):u.isPlainObject(a)?u.merge({},a):u.isArray(a)?a.slice():a}function s(f,a,d){if(u.isUndefined(a)){if(!u.isUndefined(f))return r(void 0,f,d)}else return r(f,a,d)}function o(f,a){if(!u.isUndefined(a))return r(void 0,a)}function i(f,a){if(u.isUndefined(a)){if(!u.isUndefined(f))return r(void 0,f)}else return r(void 0,a)}function c(f,a,d){if(d in t)return r(f,a);if(d in e)return r(void 0,f)}const l={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:c,headers:(f,a)=>s($e(f),$e(a),!0)};return u.forEach(Object.keys(Object.assign({},e,t)),function(a){const d=l[a]||s,b=d(e[a],t[a],a);u.isUndefined(b)&&d!==c||(n[a]=b)}),n}const Ie=e=>{const t=U({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;t.headers=i=E.from(i),t.url=xe(De(t.baseURL,t.url),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let l;if(u.isFormData(n)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((l=i.getContentType())!==!1){const[f,...a]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([f||"multipart/form-data",...a].join("; "))}}if(P.hasStandardBrowserEnv&&(r&&u.isFunction(r)&&(r=r(t)),r||r!==!1&&an(t.url))){const f=s&&o&&cn.read(o);f&&i.set(s,f)}return t},fn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const s=Ie(e);let o=s.data;const i=E.from(s.headers).normalize();let{responseType:c}=s,l;function f(){s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let a=new XMLHttpRequest;a.open(s.method.toUpperCase(),s.url,!0),a.timeout=s.timeout;function d(){if(!a)return;const m=E.from("getAllResponseHeaders"in a&&a.getAllResponseHeaders()),y={data:!c||c==="text"||c==="json"?a.responseText:a.response,status:a.status,statusText:a.statusText,headers:m,config:e,request:a};_e(function(S){n(S),f()},function(S){r(S),f()},y),a=null}"onloadend"in a?a.onloadend=d:a.onreadystatechange=function(){!a||a.readyState!==4||a.status===0&&!(a.responseURL&&a.responseURL.indexOf("file:")===0)||setTimeout(d)},a.onabort=function(){a&&(r(new p("Request aborted",p.ECONNABORTED,s,a)),a=null)},a.onerror=function(){r(new p("Network Error",p.ERR_NETWORK,s,a)),a=null},a.ontimeout=function(){let h=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const y=s.transitional||qe;s.timeoutErrorMessage&&(h=s.timeoutErrorMessage),r(new p(h,y.clarifyTimeoutError?p.ETIMEDOUT:p.ECONNABORTED,s,a)),a=null},o===void 0&&i.setContentType(null),"setRequestHeader"in a&&u.forEach(i.toJSON(),function(h,y){a.setRequestHeader(y,h)}),u.isUndefined(s.withCredentials)||(a.withCredentials=!!s.withCredentials),c&&c!=="json"&&(a.responseType=s.responseType),typeof s.onDownloadProgress=="function"&&a.addEventListener("progress",W(s.onDownloadProgress,!0)),typeof s.onUploadProgress=="function"&&a.upload&&a.upload.addEventListener("progress",W(s.onUploadProgress)),(s.cancelToken||s.signal)&&(l=m=>{a&&(r(!m||m.type?new F(null,e,a):m),a.abort(),a=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const b=rn(s.url);if(b&&P.protocols.indexOf(b)===-1){r(new p("Unsupported protocol "+b+":",p.ERR_BAD_REQUEST,e));return}a.send(o||null)})},dn=(e,t)=>{let n=new AbortController,r;const s=function(l){if(!r){r=!0,i();const f=l instanceof Error?l:this.reason;n.abort(f instanceof p?f:new F(f instanceof Error?f.message:f))}};let o=t&&setTimeout(()=>{s(new p(`timeout ${t} of ms exceeded`,p.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l&&(l.removeEventListener?l.removeEventListener("abort",s):l.unsubscribe(s))}),e=null)};e.forEach(l=>l&&l.addEventListener&&l.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=i,[c,()=>{o&&clearTimeout(o),o=null}]},hn=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},pn=async function*(e,t,n){for await(const r of e)yield*hn(ArrayBuffer.isView(r)?r:await n(String(r)),t)},je=(e,t,n,r,s)=>{const o=pn(e,t,s);let i=0;return new ReadableStream({type:"bytes",async pull(c){const{done:l,value:f}=await o.next();if(l){c.close(),r();return}let a=f.byteLength;n&&n(i+=a),c.enqueue(new Uint8Array(f))},cancel(c){return r(c),o.return()}},{highWaterMark:2})},He=(e,t)=>{const n=e!=null;return r=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:r}))},Q=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Je=Q&&typeof ReadableStream=="function",ae=Q&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),mn=Je&&(()=>{let e=!1;const t=new Request(P.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),ze=64*1024,ce=Je&&!!(()=>{try{return u.isReadableStream(new Response("").body)}catch{}})(),X={stream:ce&&(e=>e.body)};Q&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!X[t]&&(X[t]=u.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new p(`Response type '${t}' is not supported`,p.ERR_NOT_SUPPORT,r)})})})(new Response);const yn=async e=>{if(e==null)return 0;if(u.isBlob(e))return e.size;if(u.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(u.isArrayBufferView(e))return e.byteLength;if(u.isURLSearchParams(e)&&(e=e+""),u.isString(e))return(await ae(e)).byteLength},bn=async(e,t)=>{const n=u.toFiniteNumber(e.getContentLength());return n??yn(t)},ue={http:It,xhr:fn,fetch:Q&&(async e=>{let{url:t,method:n,data:r,signal:s,cancelToken:o,timeout:i,onDownloadProgress:c,onUploadProgress:l,responseType:f,headers:a,withCredentials:d="same-origin",fetchOptions:b}=Ie(e);f=f?(f+"").toLowerCase():"text";let[m,h]=s||o||i?dn([s,o],i):[],y,T;const S=()=>{!y&&setTimeout(()=>{m&&m.unsubscribe()}),y=!0};let N;try{if(l&&mn&&n!=="get"&&n!=="head"&&(N=await bn(a,r))!==0){let x=new Request(t,{method:"POST",body:r,duplex:"half"}),_;u.isFormData(r)&&(_=x.headers.get("content-type"))&&a.setContentType(_),x.body&&(r=je(x.body,ze,He(N,W(l)),null,ae))}u.isString(d)||(d=d?"cors":"omit"),T=new Request(t,{...b,signal:m,method:n.toUpperCase(),headers:a.normalize().toJSON(),body:r,duplex:"half",withCredentials:d});let g=await fetch(T);const J=ce&&(f==="stream"||f==="response");if(ce&&(c||J)){const x={};["status","statusText","headers"].forEach(tt=>{x[tt]=g[tt]});const _=u.toFiniteNumber(g.headers.get("content-length"));g=new Response(je(g.body,ze,c&&He(_,W(c,!0)),J&&S,ae),x)}f=f||"text";let Kn=await X[u.findKey(X,f)||"text"](g,e);return!J&&S(),h&&h(),await new Promise((x,_)=>{_e(x,_,{data:Kn,headers:E.from(g.headers),status:g.status,statusText:g.statusText,config:e,request:T})})}catch(g){throw S(),g&&g.name==="TypeError"&&/fetch/i.test(g.message)?Object.assign(new p("Network Error",p.ERR_NETWORK,e,T),{cause:g.cause||g}):p.from(g,g&&g.code,e,T)}})};u.forEach(ue,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Me=e=>`- ${e}`,gn=e=>u.isFunction(e)||e===null||e===!1,Ve={getAdapter:e=>{e=u.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let o=0;o<t;o++){n=e[o];let i;if(r=n,!gn(n)&&(r=ue[(i=String(n)).toLowerCase()],r===void 0))throw new p(`Unknown adapter '${i}'`);if(r)break;s[i||"#"+o]=r}if(!r){const o=Object.entries(s).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since :
|
|
4
|
+
`+o.map(Me).join(`
|
|
5
|
+
`):" "+Me(o[0]):"as no adapter specified";throw new p("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:ue};function le(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new F(null,e)}function ve(e){return le(e),e.headers=E.from(e.headers),e.data=ie.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ve.getAdapter(e.adapter||j.adapter)(e).then(function(r){return le(e),r.data=ie.call(e,e.transformResponse,r),r.headers=E.from(r.headers),r},function(r){return Fe(r)||(le(e),r&&r.response&&(r.response.data=ie.call(e,e.transformResponse,r.response),r.response.headers=E.from(r.response.headers))),Promise.reject(r)})}const Ge="1.7.2",fe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{fe[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ke={};fe.transitional=function(t,n,r){function s(o,i){return"[Axios v"+Ge+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new p(s(i," has been removed"+(n?" in "+n:"")),p.ERR_DEPRECATED);return n&&!Ke[i]&&(Ke[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};function wn(e,t,n){if(typeof e!="object")throw new p("options must be an object",p.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],l=c===void 0||i(c,o,e);if(l!==!0)throw new p("option "+o+" must be "+l,p.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new p("Unknown option "+o,p.ERR_BAD_OPTION)}}const de={assertOptions:wn,validators:fe},k=de.validators;let q=class{constructor(t){this.defaults=t,this.interceptors={request:new Ue,response:new Ue}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=U(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&de.assertOptions(r,{silentJSONParsing:k.transitional(k.boolean),forcedJSONParsing:k.transitional(k.boolean),clarifyTimeoutError:k.transitional(k.boolean)},!1),s!=null&&(u.isFunction(s)?n.paramsSerializer={serialize:s}:de.assertOptions(s,{encode:k.function,serialize:k.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&u.merge(o.common,o[n.method]);o&&u.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),n.headers=E.concat(i,o);const c=[];let l=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(l=l&&y.synchronous,c.unshift(y.fulfilled,y.rejected))});const f=[];this.interceptors.response.forEach(function(y){f.push(y.fulfilled,y.rejected)});let a,d=0,b;if(!l){const h=[ve.bind(this),void 0];for(h.unshift.apply(h,c),h.push.apply(h,f),b=h.length,a=Promise.resolve(n);d<b;)a=a.then(h[d++],h[d++]);return a}b=c.length;let m=n;for(d=0;d<b;){const h=c[d++],y=c[d++];try{m=h(m)}catch(T){y.call(this,T);break}}try{a=ve.call(this,m)}catch(h){return Promise.reject(h)}for(d=0,b=f.length;d<b;)a=a.then(f[d++],f[d++]);return a}getUri(t){t=U(this.defaults,t);const n=De(t.baseURL,t.url);return xe(n,t.params,t.paramsSerializer)}};u.forEach(["delete","get","head","options"],function(t){q.prototype[t]=function(n,r){return this.request(U(r||{},{method:t,url:n,data:(r||{}).data}))}}),u.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request(U(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}q.prototype[t]=n(),q.prototype[t+"Form"]=n(!0)});let Tn=class nt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new F(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new nt(function(s){t=s}),cancel:t}}};function Sn(e){return function(n){return e.apply(null,n)}}function En(e){return u.isObject(e)&&e.isAxiosError===!0}const he={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(he).forEach(([e,t])=>{he[t]=e});function We(e){const t=new q(e),n=B(q.prototype.request,t);return u.extend(n,q.prototype,t,{allOwnKeys:!0}),u.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return We(U(e,s))},n}const w=We(j);w.Axios=q,w.CanceledError=F,w.CancelToken=Tn,w.isCancel=Fe,w.VERSION=Ge,w.toFormData=G,w.AxiosError=p,w.Cancel=w.CanceledError,w.all=function(t){return Promise.all(t)},w.spread=Sn,w.isAxiosError=En,w.mergeConfig=U,w.AxiosHeaders=E,w.formToJSON=e=>Be(u.isHTMLForm(e)?new FormData(e):e),w.getAdapter=Ve.getAdapter,w.HttpStatusCode=he,w.default=w;const{Axios:nr,AxiosError:Rn,CanceledError:rr,isCancel:sr,CancelToken:or,VERSION:ir,all:ar,Cancel:cr,isAxiosError:ur,spread:lr,toFormData:fr,AxiosHeaders:Qe,HttpStatusCode:dr,formToJSON:hr,getAdapter:pr,mergeConfig:mr}=w,Xe="auth",Ze=async(e,t,n)=>{const r={client_id:e.clientId,client_secret:e.clientSecret},s=await n.post(`${e.url}/security/connect/token/refresh`,r,{withCredentials:!0,headers:t||{}}),o={...s.data,accessToken:s.data.access_token};return"access_token"in o&&delete o.access_token,s.status===200&&o.accessToken&&localStorage.setItem("accessToken",o.accessToken),o},On=e=>{const t=O(e),n=e.digitalRefresh,r=async c=>{var f;const l=await t.request(`/${Xe}/login`,{method:"POST",data:JSON.stringify(c)});return l.status===200&&((f=l.data)!=null&&f.accessToken)&&localStorage.setItem("accessToken",l.data.accessToken),l},s=async c=>await t.request(`/${Xe}?code=${c}`,{method:"GET",data:""}),o=async()=>{try{await t.request("/security/api/authorization/logout",{method:"POST",data:"",withCredentials:!0})}catch(c){console.error("Error during logout:",c)}finally{t.clearTokens();const c=e.refreshLogoutUrl??"";c&&(globalThis.location.href=`${c}?logout`)}},i=t.axiosClient;return{postLogin:r,getToken:s,postToken:n?()=>Ze(n,e.headers,i):void 0,postLogout:o}},Ye=()=>new Rn("Unauthorized","ERR_UNAUTHORIZED",{headers:new Qe},null,{status:401,data:null,statusText:"UNAUTHORIZED",headers:{},config:{headers:new Qe}}),An=e=>{let t=!1;const n=[],r=()=>localStorage.getItem("accessToken"),s=()=>localStorage.getItem("refreshToken"),o=a=>{const d=a.accessToken,b=a.refreshToken;d&&localStorage.setItem("accessToken",d),b&&localStorage.setItem("refreshToken",b)},i=()=>{localStorage.removeItem("accessToken"),localStorage.removeItem("refreshToken")},c=(a,d=null)=>{var b;for(const m of n)a?m.reject(a):((b=m.requestConfig).headers??(b.headers={}),m.requestConfig.headers.Authorization=`Bearer ${d}`,m.resolve(m.requestConfig));n.length=0};return{getAccessToken:r,setTokens:o,clearTokens:i,handleTokenRefresh:async a=>{var d;if(e.refreshTokenEndpointPath&&((d=a.url)==null?void 0:d.includes(e.refreshTokenEndpointPath))){i();const m=Ye();throw c(m),e.refreshLogoutUrl&&(globalThis.location.href=`${e.refreshLogoutUrl}?logout`),m}if(t)return new Promise((b,m)=>{n.push({resolve:b,reject:m,requestConfig:a})});t=!0;try{const b=s(),m=await e.onRefreshToken(b);return o(m),a.headers??(a.headers={}),a.headers.Authorization=`Bearer ${m.accessToken}`,c(null,m.accessToken),t=!1,a}catch{i();const b=Ye();throw c(b),t=!1,b}},isAuthError:a=>{var d;return((d=a==null?void 0:a.response)==null?void 0:d.status)===401}}},Pn=e=>{const t=r=>r?r.toString().replace(/(^\/{1,2})|(\/{1,2}$)/g,""):null;return[t(e.baseUrl),t(e.productCode),t(e.apiVersion),t(e.endpoint)].filter(Boolean).join("/")},Nn=(e,t,n,r,s)=>{var f;if(!t)return null;const o=!!e.digitalRefresh,i=e.refreshTokenApiVersion??s,c=e.refreshTokenEndpointPath??(o?"/security/connect/token/refresh":"/refresh-token"),l=`${r}/auth/${i}${c}`;return An({baseUrl:e.baseUrl,refreshTokenEndpointPath:c,digitalRefreshUrl:(f=e.digitalRefresh)==null?void 0:f.url,refreshLogoutUrl:e.refreshLogoutUrl??void 0,onRefreshToken:async a=>o?await Ze(e.digitalRefresh,e.headers,n):(await n.post(l,{refreshToken:a})).data})},kn=(e,t)=>{e.interceptors.response.use(n=>n,async n=>{const r=n.config;if(!t.isAuthError(n)||r._retry)throw n;r._retry=!0;const s=await t.handleTokenRefresh(r);return e.request(s)})},Cn=(e,t,n,r,s)=>{const o={"Content-Type":(e==null?void 0:e.contentType)??"application/json",apiVersion:t??"",Authorization:"",...n,...e==null?void 0:e.headers};if(s&&r){const i=r.getAccessToken();i&&(o.Authorization=`Bearer ${i}`)}return o},xn=(e,t,n)=>{const r={method:(e==null?void 0:e.method)??"GET",headers:t,url:n,data:(e==null?void 0:e.data)??{},responseType:e==null?void 0:e.responseType};return(e==null?void 0:e.withCredentials)!==void 0&&(r.withCredentials=e.withCredentials),r},Un=(e,t)=>({getAccessToken:e&&t?t.getAccessToken:()=>null,setTokens:e&&t?t.setTokens:()=>{},clearTokens:e&&t?t.clearTokens:()=>{}}),O=e=>{const t=w.create(),n=e.apiVersion,r=e.productCode,o=e.baseUrl.replace(/\/$/,""),i=e.hasTokenManager!==!1,c=Nn(e,i,t,o,n);i&&c&&kn(t,c),e.responseInterceptor&&t.interceptors.response.use(e.responseInterceptor.onFulfilled,e.responseInterceptor.onReject);const l=async(a,d)=>{const b=a.startsWith("/")?a.substring(1):a,m=Pn({baseUrl:o,productCode:r,apiVersion:n,endpoint:b}),h=Cn(d,n,e.headers,c,i),y=xn(d,h,m);return await t.request(y)},f=Un(i,c);return{request:l,...f,axiosClient:t}},qn="cep";function Bn(e){const t=O(e);function n(r){return t.request(`/${qn}`,{method:"POST",data:JSON.stringify(r)})}return{getAddress:n}}const Ln=e=>{const t=O(e);return{signUp:async c=>await t.request("/sign-up",{method:"POST",data:JSON.stringify(c)}),signIn:async c=>{var f,a;const l=await t.request("/sign-in",{method:"POST",data:JSON.stringify(c)});return l.status===200&&((f=l.data)!=null&&f.accessToken)&&((a=l.data)!=null&&a.refreshToken)&&t.setTokens(l.data),l},getProfile:async()=>await t.request("/me",{method:"GET",data:""}),recoverPassword:async c=>await t.request("/recovery",{method:"POST",data:JSON.stringify(c)}),updatePassword:async c=>await t.request("/update-password",{method:"POST",data:JSON.stringify(c)})}},et="digital",Fn=e=>{const t=O(e);return{getBroker:()=>t.request(`/${et}/getBroker`,{method:"GET",data:""}),getAllBrokerages:s=>t.request(`/${et}/getAllBrokerages?name=${s}`,{method:"GET",data:""})}},_n="data",Dn=e=>{const t=O(e);return{postData:async r=>await t.request(`/${_n}`,{method:"POST",data:JSON.stringify(r)})}},$n="endorsement",In=e=>{const t=O(e);return{putEndorsement:(r,s)=>{const o=new FormData;return o.append("data",JSON.stringify(r)),s&&(Array.isArray(s)?s.forEach(i=>{o.append("attachments",i)}):o.append("attachments",s)),t.request(`/${$n}`,{method:"PUT",data:o,contentType:"multipart/form-data"})}}},pe="payment",jn=e=>{const t=O(e);return{postPayment:o=>t.request(`/${pe}`,{method:"POST",data:JSON.stringify(o)}),getPaymentStatus:o=>t.request(`/${pe}/status?policyId=${o.policyId}`,{method:"GET",data:""}),getPaymentSummary:o=>t.request(`/${pe}/summary?policyId=${o.policyId}`,{method:"GET",data:""})}},Z="product/action",Hn=e=>{const t=O(e);return{getCnpjStatus:(i,c,l)=>{const a=new URLSearchParams({...i&&{cnpj:i},...c&&{brokerageIdentity:c},...l!==void 0&&{isBrokerageDefinedAtStart:String(l)}}).toString(),d=`/${Z}/Custom/CnpjCheck?${a}`;return t.request(d,{method:"GET",data:""})},getKeyNumber:()=>t.request(`/${Z}/Custom/GetKeyNumber`,{method:"GET",data:""}),getProposalNumberByKeyNumber:i=>t.request(`/${Z}/Custom/GetProposalNoByKeyNumber?keyNumber=${i.keyNumber}`,{method:"GET",data:""}),postCoveragesAndClausesRules:i=>t.request(`/${Z}/Custom/LoadRules`,{method:"POST",data:JSON.stringify(i)})}},C="quotation",Jn=e=>{const t=O(e);return{getQuotations:a=>{const d=new URLSearchParams({...a});return t.request(`/${C}/query?${d.toString()}`,{method:"GET",data:""})},getQuotationDetail:a=>{const d=new URLSearchParams({id:a.policyId});return t.request(`/${C}?${d.toString()}`,{method:"GET",data:""})},postQuickQuote:a=>t.request(`/${C}/QuickQuote`,{method:"POST",data:JSON.stringify(a)}),postFullQuote:a=>t.request(`/${C}/FullQuote`,{method:"POST",data:JSON.stringify(a)}),postBind:a=>t.request(`/${C}/Bind`,{method:"POST",data:JSON.stringify(a)}),getQuotation:a=>t.request(`/${C}?id=${a.policyId}`,{method:"GET",data:""}),getVersions:a=>t.request(`/${C}/versions?policyId=${a.policyId}`,{method:"GET",data:""}),switchSelectedVersion:a=>t.request(`/${C}/switchSelectedVersion?policyId=${a.policyId}"ationVersionId=${a.quotationVersionId}`,{method:"POST",data:JSON.stringify(a)})}},zn="report",Mn=e=>{const t=O(e);return{getReportStream:r=>{const s=new URLSearchParams({policyId:r.policyId,documentType:r.documentType??"certificate",...r.additionalParams});return t.request(`/${zn}/generate-stream?${s.toString()}`,{method:"GET",data:"",responseType:"blob"})}}},Vn="SubscriberData",vn=e=>{const t=O(e);return{getSubscriber:r=>t.request(`/${Vn}/get-subscriber-data?cnpj=${r}`,{method:"GET",data:""})}};function Gn(e){const t=On(e),n=Ln(e),r=Dn(e),s=Jn(e),o=jn(e),i=Bn(e),c=Fn(e),l=In(e),f=Hn(e),a=Mn(e),d=vn(e),b=O(e);return{auth:t,authAkad:n,data:r,quotation:s,payment:o,address:i,broker:c,endorsement:l,plugin:f,report:a,subscriber:d,base:b}}return Gn});
|