@luizleon/sf.prefeiturasp.vuecomponents 0.0.36 → 0.0.37
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/dist/lib.es.js +655 -665
- package/dist/lib.es.js.map +1 -1
- package/dist/lib.umd.js +2 -2
- package/dist/lib.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -22
- package/src/services/authService.ts +11 -1
- package/src/style/tema.scss +4 -2
package/dist/lib.umd.js
CHANGED
|
@@ -76,9 +76,9 @@ If you think this parameter should be updatable, request it here: https://github
|
|
|
76
76
|
- It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).
|
|
77
77
|
- It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).
|
|
78
78
|
|
|
79
|
-
For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`),s.enable=!1,e.silentCheckSsoFallback&&(e.silentCheckSsoRedirectUri=!1)),document.body.removeChild(u),window.removeEventListener("message",m),i.setSuccess()))};window.addEventListener("message",m,!1)}else i.setSuccess();return x(i.promise,e.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function ie(i){if(!i||i=="default")return{login:function(k){return window.location.assign(e.createLoginUrl(k)),_().promise},logout:function(k){return window.location.replace(e.createLogoutUrl(k)),_().promise},register:function(k){return window.location.assign(e.createRegisterUrl(k)),_().promise},accountManagement:function(){var k=e.createAccountUrl();if(typeof k<"u")window.location.href=k;else throw"Not supported by the OIDC server";return _().promise},redirectUri:function(k,v){return k&&k.redirectUri?k.redirectUri:e.redirectUri?e.redirectUri:location.href}};if(i=="cordova"){s.enable=!1;var u=function(k,v,O){return window.cordova&&window.cordova.InAppBrowser?window.cordova.InAppBrowser.open(k,v,O):window.open(k,v,O)},m=function(k){return k&&k.cordovaOptions?Object.keys(k.cordovaOptions).reduce(function(v,O){return v[O]=k.cordovaOptions[O],v},{}):{}},A=function(k){return Object.keys(k).reduce(function(v,O){return v.push(O+"="+k[O]),v},[]).join(",")},y=function(k){var v=m(k);return v.location="no",k&&k.prompt=="none"&&(v.hidden="yes"),A(v)},R=function(){return e.redirectUri||"http://localhost"};return{login:function(k){var v=_(),O=y(k),L=e.createLoginUrl(k),M=u(L,"_blank",O),K=!1,ve=!1,we=function(){ve=!0,M.close()};return M.addEventListener("loadstart",function(ue){if(ue.url.indexOf(R())==0){var $e=T(ue.url);ne($e,v),we(),K=!0}}),M.addEventListener("loaderror",function(ue){if(!K)if(ue.url.indexOf(R())==0){var $e=T(ue.url);ne($e,v),we(),K=!0}else v.setError(),we()}),M.addEventListener("exit",function(ue){ve||v.setError({reason:"closed_by_user"})}),v.promise},logout:function(k){var v=_(),O=e.createLogoutUrl(k),L=u(O,"_blank","location=no,hidden=yes,clearcache=yes"),M;return L.addEventListener("loadstart",function(K){K.url.indexOf(R())==0&&L.close()}),L.addEventListener("loaderror",function(K){K.url.indexOf(R())==0||(M=!0),L.close()}),L.addEventListener("exit",function(K){M?v.setError():(e.clearToken(),v.setSuccess())}),v.promise},register:function(k){var v=_(),O=e.createRegisterUrl(),L=y(k),M=u(O,"_blank",L);return M.addEventListener("loadstart",function(K){if(K.url.indexOf(R())==0){M.close();var ve=T(K.url);ne(ve,v)}}),v.promise},accountManagement:function(){var k=e.createAccountUrl();if(typeof k<"u"){var v=u(k,"_blank","location=no");v.addEventListener("loadstart",function(O){O.url.indexOf(R())==0&&v.close()})}else throw"Not supported by the OIDC server"},redirectUri:function(k){return R()}}}if(i=="cordova-native")return s.enable=!1,{login:function(k){var v=_(),O=e.createLoginUrl(k);return universalLinks.subscribe("keycloak",function(L){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var M=T(L.url);ne(M,v)}),window.cordova.plugins.browsertab.openUrl(O),v.promise},logout:function(k){var v=_(),O=e.createLogoutUrl(k);return universalLinks.subscribe("keycloak",function(L){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close(),e.clearToken(),v.setSuccess()}),window.cordova.plugins.browsertab.openUrl(O),v.promise},register:function(k){var v=_(),O=e.createRegisterUrl(k);return universalLinks.subscribe("keycloak",function(L){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var M=T(L.url);ne(M,v)}),window.cordova.plugins.browsertab.openUrl(O),v.promise},accountManagement:function(){var k=e.createAccountUrl();if(typeof k<"u")window.cordova.plugins.browsertab.openUrl(k);else throw"Not supported by the OIDC server"},redirectUri:function(k){return k&&k.redirectUri?k.redirectUri:e.redirectUri?e.redirectUri:"http://localhost"}};throw"invalid adapter type: "+i}var se=function(){if(!(this instanceof se))return new se;localStorage.setItem("kc-test","test"),localStorage.removeItem("kc-test");var i=this;function u(){for(var m=new Date().getTime(),A=0;A<localStorage.length;A++){var y=localStorage.key(A);if(y&&y.indexOf("kc-callback-")==0){var R=localStorage.getItem(y);if(R)try{var k=JSON.parse(R).expires;(!k||k<m)&&localStorage.removeItem(y)}catch{localStorage.removeItem(y)}}}}i.get=function(m){if(m){var A="kc-callback-"+m,y=localStorage.getItem(A);return y&&(localStorage.removeItem(A),y=JSON.parse(y)),u(),y}},i.add=function(m){u();var A="kc-callback-"+m.state;m.expires=new Date().getTime()+60*60*1e3,localStorage.setItem(A,JSON.stringify(m))}},be=function(){if(!(this instanceof be))return new be;var i=this;i.get=function(y){if(y){var R=m("kc-callback-"+y);if(A("kc-callback-"+y,"",u(-100)),R)return JSON.parse(R)}},i.add=function(y){A("kc-callback-"+y.state,JSON.stringify(y),u(60))},i.removeItem=function(y){A(y,"",u(-100))};var u=function(y){var R=new Date;return R.setTime(R.getTime()+y*60*1e3),R},m=function(y){for(var R=y+"=",k=document.cookie.split(";"),v=0;v<k.length;v++){for(var O=k[v];O.charAt(0)==" ";)O=O.substring(1);if(O.indexOf(R)==0)return O.substring(R.length,O.length)}return""},A=function(y,R,k){var v=y+"="+R+"; expires="+k.toUTCString()+"; ";document.cookie=v}};function D(){try{return new se}catch{}return new be}function Ae(i){return function(){e.enableLogging&&i.apply(console,Array.prototype.slice.call(arguments))}}}async function Rl(){const t="silent-login.html",e=await fetch(location.origin+"/"+t).then(async n=>n.status!==200?!1:(await n.text()).includes("silent-login-iframe-result")).catch(()=>!1);return e||(console.warn(`Arquivo ${t} não localizado no projeto ou não possui o conteúdo correto!`),document.body.innerHTML=`<div style="padding: 3rem; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; font-size: 1.5rem;">O arquivo '${t}' não foi encontrado.</div>`),e}function Ll(t){const e=new Ar(t),n={},o=async(a={},f)=>{if(await Rl())return e.init(a).then(async w=>{w&&await r(),f&&typeof f=="function"&&f()}).catch(w=>{console.error(w),document.body.innerHTML='<div style="padding: 3rem; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; font-size: 1.5rem;">Não foi possível conectar no servidor de autenticação.</div>'})},r=async()=>{const a=await e.loadUserInfo();n.email=a.email??"",n.emailVerified=a.email_verified===!0,n.firstName=a.given_name??"",n.lastName=a.family_name??"",n.name=a.name??"",n.sub=a.sub??"",n.username=a.preferred_username??"",n.roles=[...a.role??[]],n.groups=[...a.group??[]],n.IsInRole=f=>n.roles.includes(f),sessionStorage.setItem("name",n.name)};return{Instance:e,User:n,Init:o,Logout:()=>{e.logout({redirectUri:location.origin}).then(()=>{sessionStorage.removeItem("name")})}}}const Ol=t=>Ll(t);class zn{constructor(e=null){We(this,"errors",[]);We(this,"_value",null);We(this,"_httpStatusCode");this._value=e,this._httpStatusCode=200}get value(){return this._value}set value(e){this._value=e}get hasSuccess(){return!this.hasError}get hasError(){return this.errors.length>0}get httpStatusCode(){return this._httpStatusCode}set httpStatusCode(e){this._httpStatusCode=e}WithError(e){this.errors.push(e),this._httpStatusCode===200&&(this._httpStatusCode=400)}WithErrors(e){e.forEach(n=>this.WithError(n))}}const ld="",ud="";function vr(t,e){return function(){return t.apply(e,arguments)}}const{toString:Il}=Object.prototype,{getPrototypeOf:Wn}=Object,en=(t=>e=>{const n=Il.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),De=t=>(t=t.toLowerCase(),e=>en(e)===t),tn=t=>e=>typeof e===t,{isArray:pt}=Array,Ft=tn("undefined");function Bl(t){return t!==null&&!Ft(t)&&t.constructor!==null&&!Ft(t.constructor)&&Ie(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Sr=De("ArrayBuffer");function Fl(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Sr(t.buffer),e}const Nl=tn("string"),Ie=tn("function"),Cr=tn("number"),nn=t=>t!==null&&typeof t=="object",Ul=t=>t===!0||t===!1,on=t=>{if(en(t)!=="object")return!1;const e=Wn(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Dl=De("Date"),Ml=De("File"),$l=De("Blob"),Hl=De("FileList"),jl=t=>nn(t)&&Ie(t.pipe),Vl=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ie(t.append)&&((e=en(t))==="formdata"||e==="object"&&Ie(t.toString)&&t.toString()==="[object FormData]"))},zl=De("URLSearchParams"),Wl=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Nt(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let o,r;if(typeof t!="object"&&(t=[t]),pt(t))for(o=0,r=t.length;o<r;o++)e.call(null,t[o],o,t);else{const s=n?Object.getOwnPropertyNames(t):Object.keys(t),a=s.length;let f;for(o=0;o<a;o++)f=s[o],e.call(null,t[f],f,t)}}function xr(t,e){e=e.toLowerCase();const n=Object.keys(t);let o=n.length,r;for(;o-- >0;)if(r=n[o],e===r.toLowerCase())return r;return null}const _r=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Tr=t=>!Ft(t)&&t!==_r;function qn(){const{caseless:t}=Tr(this)&&this||{},e={},n=(o,r)=>{const s=t&&xr(e,r)||r;on(e[s])&&on(o)?e[s]=qn(e[s],o):on(o)?e[s]=qn({},o):pt(o)?e[s]=o.slice():e[s]=o};for(let o=0,r=arguments.length;o<r;o++)arguments[o]&&Nt(arguments[o],n);return e}const ql=(t,e,n,{allOwnKeys:o}={})=>(Nt(e,(r,s)=>{n&&Ie(r)?t[s]=vr(r,n):t[s]=r},{allOwnKeys:o}),t),Kl=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Gl=(t,e,n,o)=>{t.prototype=Object.create(e.prototype,o),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Jl=(t,e,n,o)=>{let r,s,a;const f={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),s=r.length;s-- >0;)a=r[s],(!o||o(a,t,e))&&!f[a]&&(e[a]=t[a],f[a]=!0);t=n!==!1&&Wn(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Yl=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const o=t.indexOf(e,n);return o!==-1&&o===n},Xl=t=>{if(!t)return null;if(pt(t))return t;let e=t.length;if(!Cr(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Zl=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Wn(Uint8Array)),Ql=(t,e)=>{const o=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=o.next())&&!r.done;){const s=r.value;e.call(t,s[0],s[1])}},eu=(t,e)=>{let n;const o=[];for(;(n=t.exec(e))!==null;)o.push(n);return o},tu=De("HTMLFormElement"),nu=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,o,r){return o.toUpperCase()+r}),Pr=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),ou=De("RegExp"),Rr=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),o={};Nt(n,(r,s)=>{let a;(a=e(r,s,t))!==!1&&(o[s]=a||r)}),Object.defineProperties(t,o)},ru=t=>{Rr(t,(e,n)=>{if(Ie(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const o=t[n];if(Ie(o)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},su=(t,e)=>{const n={},o=r=>{r.forEach(s=>{n[s]=!0})};return pt(t)?o(t):o(String(t).split(e)),n},iu=()=>{},au=(t,e)=>(t=+t,Number.isFinite(t)?t:e),Kn="abcdefghijklmnopqrstuvwxyz",Lr="0123456789",Or={DIGIT:Lr,ALPHA:Kn,ALPHA_DIGIT:Kn+Kn.toUpperCase()+Lr},cu=(t=16,e=Or.ALPHA_DIGIT)=>{let n="";const{length:o}=e;for(;t--;)n+=e[Math.random()*o|0];return n};function lu(t){return!!(t&&Ie(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const uu=t=>{const e=new Array(10),n=(o,r)=>{if(nn(o)){if(e.indexOf(o)>=0)return;if(!("toJSON"in o)){e[r]=o;const s=pt(o)?[]:{};return Nt(o,(a,f)=>{const l=n(a,r+1);!Ft(l)&&(s[f]=l)}),e[r]=void 0,s}}return o};return n(t,0)},du=De("AsyncFunction"),p={isArray:pt,isArrayBuffer:Sr,isBuffer:Bl,isFormData:Vl,isArrayBufferView:Fl,isString:Nl,isNumber:Cr,isBoolean:Ul,isObject:nn,isPlainObject:on,isUndefined:Ft,isDate:Dl,isFile:Ml,isBlob:$l,isRegExp:ou,isFunction:Ie,isStream:jl,isURLSearchParams:zl,isTypedArray:Zl,isFileList:Hl,forEach:Nt,merge:qn,extend:ql,trim:Wl,stripBOM:Kl,inherits:Gl,toFlatObject:Jl,kindOf:en,kindOfTest:De,endsWith:Yl,toArray:Xl,forEachEntry:Ql,matchAll:eu,isHTMLForm:tu,hasOwnProperty:Pr,hasOwnProp:Pr,reduceDescriptors:Rr,freezeMethods:ru,toObjectSet:su,toCamelCase:nu,noop:iu,toFiniteNumber:au,findKey:xr,global:_r,isContextDefined:Tr,ALPHABET:Or,generateString:cu,isSpecCompliantForm:lu,toJSONObject:uu,isAsyncFn:du,isThenable:t=>t&&(nn(t)||Ie(t))&&Ie(t.then)&&Ie(t.catch)};function J(t,e,n,o,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),o&&(this.request=o),r&&(this.response=r)}p.inherits(J,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:p.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Ir=J.prototype,Br={};["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=>{Br[t]={value:t}}),Object.defineProperties(J,Br),Object.defineProperty(Ir,"isAxiosError",{value:!0}),J.from=(t,e,n,o,r,s)=>{const a=Object.create(Ir);return p.toFlatObject(t,a,function(l){return l!==Error.prototype},f=>f!=="isAxiosError"),J.call(a,t.message,e,n,o,r),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const fu=null;function Gn(t){return p.isPlainObject(t)||p.isArray(t)}function Fr(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function Nr(t,e,n){return t?t.concat(e).map(function(r,s){return r=Fr(r),!n&&s?"["+r+"]":r}).join(n?".":""):e}function hu(t){return p.isArray(t)&&!t.some(Gn)}const pu=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function rn(t,e,n){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=p.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,X){return!p.isUndefined(X[N])});const o=n.metaTokens,r=n.visitor||C,s=n.dots,a=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(e);if(!p.isFunction(r))throw new TypeError("visitor must be a function");function w(B){if(B===null)return"";if(p.isDate(B))return B.toISOString();if(!l&&p.isBlob(B))throw new J("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(B)||p.isTypedArray(B)?l&&typeof Blob=="function"?new Blob([B]):Buffer.from(B):B}function C(B,N,X){let oe=B;if(B&&!X&&typeof B=="object"){if(p.endsWith(N,"{}"))N=o?N:N.slice(0,-2),B=JSON.stringify(B);else if(p.isArray(B)&&hu(B)||(p.isFileList(B)||p.endsWith(N,"[]"))&&(oe=p.toArray(B)))return N=Fr(N),oe.forEach(function($,ye){!(p.isUndefined($)||$===null)&&e.append(a===!0?Nr([N],ye,s):a===null?N:N+"[]",w($))}),!1}return Gn(B)?!0:(e.append(Nr(X,N,s),w(B)),!1)}const b=[],Y=Object.assign(pu,{defaultVisitor:C,convertValue:w,isVisitable:Gn});function H(B,N){if(!p.isUndefined(B)){if(b.indexOf(B)!==-1)throw Error("Circular reference detected in "+N.join("."));b.push(B),p.forEach(B,function(oe,ne){(!(p.isUndefined(oe)||oe===null)&&r.call(e,oe,p.isString(ne)?ne.trim():ne,N,Y))===!0&&H(oe,N?N.concat(ne):[ne])}),b.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return H(t),e}function Ur(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(o){return e[o]})}function Jn(t,e){this._pairs=[],t&&rn(t,this,e)}const Dr=Jn.prototype;Dr.append=function(e,n){this._pairs.push([e,n])},Dr.toString=function(e){const n=e?function(o){return e.call(this,o,Ur)}:Ur;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function mu(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Mr(t,e,n){if(!e)return t;const o=n&&n.encode||mu,r=n&&n.serialize;let s;if(r?s=r(e,n):s=p.isURLSearchParams(e)?e.toString():new Jn(e,n).toString(o),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class gu{constructor(){this.handlers=[]}use(e,n,o){return this.handlers.push({fulfilled:e,rejected:n,synchronous:o?o.synchronous:!1,runWhen:o?o.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){p.forEach(this.handlers,function(o){o!==null&&e(o)})}}const $r=gu,Hr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},yu={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Jn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},jr=typeof window<"u"&&typeof document<"u",bu=(t=>jr&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),wu=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Me={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jr,hasStandardBrowserEnv:bu,hasStandardBrowserWebWorkerEnv:wu},Symbol.toStringTag,{value:"Module"})),...yu};function Eu(t,e){return rn(t,new Me.classes.URLSearchParams,Object.assign({visitor:function(n,o,r,s){return Me.isNode&&p.isBuffer(n)?(this.append(o,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function ku(t){return p.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Au(t){const e={},n=Object.keys(t);let o;const r=n.length;let s;for(o=0;o<r;o++)s=n[o],e[s]=t[s];return e}function Vr(t){function e(n,o,r,s){let a=n[s++];if(a==="__proto__")return!0;const f=Number.isFinite(+a),l=s>=n.length;return a=!a&&p.isArray(r)?r.length:a,l?(p.hasOwnProp(r,a)?r[a]=[r[a],o]:r[a]=o,!f):((!r[a]||!p.isObject(r[a]))&&(r[a]=[]),e(n,o,r[a],s)&&p.isArray(r[a])&&(r[a]=Au(r[a])),!f)}if(p.isFormData(t)&&p.isFunction(t.entries)){const n={};return p.forEachEntry(t,(o,r)=>{e(ku(o),r,n,0)}),n}return null}function vu(t,e,n){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(o){if(o.name!=="SyntaxError")throw o}return(n||JSON.stringify)(t)}const Yn={transitional:Hr,adapter:["xhr","http"],transformRequest:[function(e,n){const o=n.getContentType()||"",r=o.indexOf("application/json")>-1,s=p.isObject(e);if(s&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return r&&r?JSON.stringify(Vr(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let f;if(s){if(o.indexOf("application/x-www-form-urlencoded")>-1)return Eu(e,this.formSerializer).toString();if((f=p.isFileList(e))||o.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return rn(f?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||r?(n.setContentType("application/json",!1),vu(e)):e}],transformResponse:[function(e){const n=this.transitional||Yn.transitional,o=n&&n.forcedJSONParsing,r=this.responseType==="json";if(e&&p.isString(e)&&(o&&!this.responseType||r)){const a=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(f){if(a)throw f.name==="SyntaxError"?J.from(f,J.ERR_BAD_RESPONSE,this,null,this.response):f}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Me.classes.FormData,Blob:Me.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],t=>{Yn.headers[t]={}});const Xn=Yn,Su=p.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"]),Cu=t=>{const e={};let n,o,r;return t&&t.split(`
|
|
79
|
+
For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`),s.enable=!1,e.silentCheckSsoFallback&&(e.silentCheckSsoRedirectUri=!1)),document.body.removeChild(u),window.removeEventListener("message",m),i.setSuccess()))};window.addEventListener("message",m,!1)}else i.setSuccess();return x(i.promise,e.messageReceiveTimeout,"Timeout when waiting for 3rd party check iframe message.")}function ie(i){if(!i||i=="default")return{login:function(k){return window.location.assign(e.createLoginUrl(k)),_().promise},logout:function(k){return window.location.replace(e.createLogoutUrl(k)),_().promise},register:function(k){return window.location.assign(e.createRegisterUrl(k)),_().promise},accountManagement:function(){var k=e.createAccountUrl();if(typeof k<"u")window.location.href=k;else throw"Not supported by the OIDC server";return _().promise},redirectUri:function(k,v){return k&&k.redirectUri?k.redirectUri:e.redirectUri?e.redirectUri:location.href}};if(i=="cordova"){s.enable=!1;var u=function(k,v,O){return window.cordova&&window.cordova.InAppBrowser?window.cordova.InAppBrowser.open(k,v,O):window.open(k,v,O)},m=function(k){return k&&k.cordovaOptions?Object.keys(k.cordovaOptions).reduce(function(v,O){return v[O]=k.cordovaOptions[O],v},{}):{}},A=function(k){return Object.keys(k).reduce(function(v,O){return v.push(O+"="+k[O]),v},[]).join(",")},y=function(k){var v=m(k);return v.location="no",k&&k.prompt=="none"&&(v.hidden="yes"),A(v)},R=function(){return e.redirectUri||"http://localhost"};return{login:function(k){var v=_(),O=y(k),L=e.createLoginUrl(k),M=u(L,"_blank",O),K=!1,ve=!1,we=function(){ve=!0,M.close()};return M.addEventListener("loadstart",function(ue){if(ue.url.indexOf(R())==0){var $e=T(ue.url);ne($e,v),we(),K=!0}}),M.addEventListener("loaderror",function(ue){if(!K)if(ue.url.indexOf(R())==0){var $e=T(ue.url);ne($e,v),we(),K=!0}else v.setError(),we()}),M.addEventListener("exit",function(ue){ve||v.setError({reason:"closed_by_user"})}),v.promise},logout:function(k){var v=_(),O=e.createLogoutUrl(k),L=u(O,"_blank","location=no,hidden=yes,clearcache=yes"),M;return L.addEventListener("loadstart",function(K){K.url.indexOf(R())==0&&L.close()}),L.addEventListener("loaderror",function(K){K.url.indexOf(R())==0||(M=!0),L.close()}),L.addEventListener("exit",function(K){M?v.setError():(e.clearToken(),v.setSuccess())}),v.promise},register:function(k){var v=_(),O=e.createRegisterUrl(),L=y(k),M=u(O,"_blank",L);return M.addEventListener("loadstart",function(K){if(K.url.indexOf(R())==0){M.close();var ve=T(K.url);ne(ve,v)}}),v.promise},accountManagement:function(){var k=e.createAccountUrl();if(typeof k<"u"){var v=u(k,"_blank","location=no");v.addEventListener("loadstart",function(O){O.url.indexOf(R())==0&&v.close()})}else throw"Not supported by the OIDC server"},redirectUri:function(k){return R()}}}if(i=="cordova-native")return s.enable=!1,{login:function(k){var v=_(),O=e.createLoginUrl(k);return universalLinks.subscribe("keycloak",function(L){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var M=T(L.url);ne(M,v)}),window.cordova.plugins.browsertab.openUrl(O),v.promise},logout:function(k){var v=_(),O=e.createLogoutUrl(k);return universalLinks.subscribe("keycloak",function(L){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close(),e.clearToken(),v.setSuccess()}),window.cordova.plugins.browsertab.openUrl(O),v.promise},register:function(k){var v=_(),O=e.createRegisterUrl(k);return universalLinks.subscribe("keycloak",function(L){universalLinks.unsubscribe("keycloak"),window.cordova.plugins.browsertab.close();var M=T(L.url);ne(M,v)}),window.cordova.plugins.browsertab.openUrl(O),v.promise},accountManagement:function(){var k=e.createAccountUrl();if(typeof k<"u")window.cordova.plugins.browsertab.openUrl(k);else throw"Not supported by the OIDC server"},redirectUri:function(k){return k&&k.redirectUri?k.redirectUri:e.redirectUri?e.redirectUri:"http://localhost"}};throw"invalid adapter type: "+i}var se=function(){if(!(this instanceof se))return new se;localStorage.setItem("kc-test","test"),localStorage.removeItem("kc-test");var i=this;function u(){for(var m=new Date().getTime(),A=0;A<localStorage.length;A++){var y=localStorage.key(A);if(y&&y.indexOf("kc-callback-")==0){var R=localStorage.getItem(y);if(R)try{var k=JSON.parse(R).expires;(!k||k<m)&&localStorage.removeItem(y)}catch{localStorage.removeItem(y)}}}}i.get=function(m){if(m){var A="kc-callback-"+m,y=localStorage.getItem(A);return y&&(localStorage.removeItem(A),y=JSON.parse(y)),u(),y}},i.add=function(m){u();var A="kc-callback-"+m.state;m.expires=new Date().getTime()+60*60*1e3,localStorage.setItem(A,JSON.stringify(m))}},be=function(){if(!(this instanceof be))return new be;var i=this;i.get=function(y){if(y){var R=m("kc-callback-"+y);if(A("kc-callback-"+y,"",u(-100)),R)return JSON.parse(R)}},i.add=function(y){A("kc-callback-"+y.state,JSON.stringify(y),u(60))},i.removeItem=function(y){A(y,"",u(-100))};var u=function(y){var R=new Date;return R.setTime(R.getTime()+y*60*1e3),R},m=function(y){for(var R=y+"=",k=document.cookie.split(";"),v=0;v<k.length;v++){for(var O=k[v];O.charAt(0)==" ";)O=O.substring(1);if(O.indexOf(R)==0)return O.substring(R.length,O.length)}return""},A=function(y,R,k){var v=y+"="+R+"; expires="+k.toUTCString()+"; ";document.cookie=v}};function D(){try{return new se}catch{}return new be}function Ae(i){return function(){e.enableLogging&&i.apply(console,Array.prototype.slice.call(arguments))}}}async function Rl(){const t="silent-login.html",e=await fetch(location.origin+"/"+t).then(async n=>n.status!==200?!1:(await n.text()).includes("silent-login-iframe-result")).catch(()=>!1);return e||(console.warn(`Arquivo ${t} não localizado no projeto ou não possui o conteúdo correto!`),document.body.innerHTML=`<div style="padding: 3rem; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; font-size: 1.5rem;">O arquivo '${t}' não foi encontrado.</div>`),e}function Ll(t){const e=new Ar(t),n={},o=async(a={},f)=>{if(await Rl())return a.onLoad==="login-required"&&document.documentElement.setAttribute("data-app-message","Autorizando..."),e.init(a).then(async w=>{w&&await r(),f&&typeof f=="function"&&f(),document.documentElement.classList.add("app-mounted")}).catch(w=>{console.error(w),document.documentElement.setAttribute("data-app-message","Não foi possível conectar no servidor de autenticação.")})},r=async()=>{const a=await e.loadUserInfo();n.email=a.email??"",n.emailVerified=a.email_verified===!0,n.firstName=a.given_name??"",n.lastName=a.family_name??"",n.name=a.name??"",n.sub=a.sub??"",n.username=a.preferred_username??"",n.roles=[...a.role??[]],n.groups=[...a.group??[]],n.IsInRole=f=>n.roles.includes(f),sessionStorage.setItem("name",n.name)};return{Instance:e,User:n,Init:o,Logout:()=>{e.logout({redirectUri:location.origin}).then(()=>{sessionStorage.removeItem("name")})}}}const Ol=t=>Ll(t);class zn{constructor(e=null){We(this,"errors",[]);We(this,"_value",null);We(this,"_httpStatusCode");this._value=e,this._httpStatusCode=200}get value(){return this._value}set value(e){this._value=e}get hasSuccess(){return!this.hasError}get hasError(){return this.errors.length>0}get httpStatusCode(){return this._httpStatusCode}set httpStatusCode(e){this._httpStatusCode=e}WithError(e){this.errors.push(e),this._httpStatusCode===200&&(this._httpStatusCode=400)}WithErrors(e){e.forEach(n=>this.WithError(n))}}const ld="",ud="";function vr(t,e){return function(){return t.apply(e,arguments)}}const{toString:Il}=Object.prototype,{getPrototypeOf:Wn}=Object,en=(t=>e=>{const n=Il.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),De=t=>(t=t.toLowerCase(),e=>en(e)===t),tn=t=>e=>typeof e===t,{isArray:pt}=Array,Ft=tn("undefined");function Bl(t){return t!==null&&!Ft(t)&&t.constructor!==null&&!Ft(t.constructor)&&Ie(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Sr=De("ArrayBuffer");function Fl(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Sr(t.buffer),e}const Nl=tn("string"),Ie=tn("function"),Cr=tn("number"),nn=t=>t!==null&&typeof t=="object",Ul=t=>t===!0||t===!1,on=t=>{if(en(t)!=="object")return!1;const e=Wn(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Dl=De("Date"),Ml=De("File"),$l=De("Blob"),Hl=De("FileList"),jl=t=>nn(t)&&Ie(t.pipe),Vl=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ie(t.append)&&((e=en(t))==="formdata"||e==="object"&&Ie(t.toString)&&t.toString()==="[object FormData]"))},zl=De("URLSearchParams"),Wl=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Nt(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let o,r;if(typeof t!="object"&&(t=[t]),pt(t))for(o=0,r=t.length;o<r;o++)e.call(null,t[o],o,t);else{const s=n?Object.getOwnPropertyNames(t):Object.keys(t),a=s.length;let f;for(o=0;o<a;o++)f=s[o],e.call(null,t[f],f,t)}}function xr(t,e){e=e.toLowerCase();const n=Object.keys(t);let o=n.length,r;for(;o-- >0;)if(r=n[o],e===r.toLowerCase())return r;return null}const _r=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Tr=t=>!Ft(t)&&t!==_r;function qn(){const{caseless:t}=Tr(this)&&this||{},e={},n=(o,r)=>{const s=t&&xr(e,r)||r;on(e[s])&&on(o)?e[s]=qn(e[s],o):on(o)?e[s]=qn({},o):pt(o)?e[s]=o.slice():e[s]=o};for(let o=0,r=arguments.length;o<r;o++)arguments[o]&&Nt(arguments[o],n);return e}const ql=(t,e,n,{allOwnKeys:o}={})=>(Nt(e,(r,s)=>{n&&Ie(r)?t[s]=vr(r,n):t[s]=r},{allOwnKeys:o}),t),Kl=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Gl=(t,e,n,o)=>{t.prototype=Object.create(e.prototype,o),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Jl=(t,e,n,o)=>{let r,s,a;const f={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),s=r.length;s-- >0;)a=r[s],(!o||o(a,t,e))&&!f[a]&&(e[a]=t[a],f[a]=!0);t=n!==!1&&Wn(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Yl=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const o=t.indexOf(e,n);return o!==-1&&o===n},Xl=t=>{if(!t)return null;if(pt(t))return t;let e=t.length;if(!Cr(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Zl=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Wn(Uint8Array)),Ql=(t,e)=>{const o=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=o.next())&&!r.done;){const s=r.value;e.call(t,s[0],s[1])}},eu=(t,e)=>{let n;const o=[];for(;(n=t.exec(e))!==null;)o.push(n);return o},tu=De("HTMLFormElement"),nu=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,o,r){return o.toUpperCase()+r}),Pr=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),ou=De("RegExp"),Rr=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),o={};Nt(n,(r,s)=>{let a;(a=e(r,s,t))!==!1&&(o[s]=a||r)}),Object.defineProperties(t,o)},ru=t=>{Rr(t,(e,n)=>{if(Ie(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const o=t[n];if(Ie(o)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},su=(t,e)=>{const n={},o=r=>{r.forEach(s=>{n[s]=!0})};return pt(t)?o(t):o(String(t).split(e)),n},iu=()=>{},au=(t,e)=>(t=+t,Number.isFinite(t)?t:e),Kn="abcdefghijklmnopqrstuvwxyz",Lr="0123456789",Or={DIGIT:Lr,ALPHA:Kn,ALPHA_DIGIT:Kn+Kn.toUpperCase()+Lr},cu=(t=16,e=Or.ALPHA_DIGIT)=>{let n="";const{length:o}=e;for(;t--;)n+=e[Math.random()*o|0];return n};function lu(t){return!!(t&&Ie(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const uu=t=>{const e=new Array(10),n=(o,r)=>{if(nn(o)){if(e.indexOf(o)>=0)return;if(!("toJSON"in o)){e[r]=o;const s=pt(o)?[]:{};return Nt(o,(a,f)=>{const l=n(a,r+1);!Ft(l)&&(s[f]=l)}),e[r]=void 0,s}}return o};return n(t,0)},du=De("AsyncFunction"),p={isArray:pt,isArrayBuffer:Sr,isBuffer:Bl,isFormData:Vl,isArrayBufferView:Fl,isString:Nl,isNumber:Cr,isBoolean:Ul,isObject:nn,isPlainObject:on,isUndefined:Ft,isDate:Dl,isFile:Ml,isBlob:$l,isRegExp:ou,isFunction:Ie,isStream:jl,isURLSearchParams:zl,isTypedArray:Zl,isFileList:Hl,forEach:Nt,merge:qn,extend:ql,trim:Wl,stripBOM:Kl,inherits:Gl,toFlatObject:Jl,kindOf:en,kindOfTest:De,endsWith:Yl,toArray:Xl,forEachEntry:Ql,matchAll:eu,isHTMLForm:tu,hasOwnProperty:Pr,hasOwnProp:Pr,reduceDescriptors:Rr,freezeMethods:ru,toObjectSet:su,toCamelCase:nu,noop:iu,toFiniteNumber:au,findKey:xr,global:_r,isContextDefined:Tr,ALPHABET:Or,generateString:cu,isSpecCompliantForm:lu,toJSONObject:uu,isAsyncFn:du,isThenable:t=>t&&(nn(t)||Ie(t))&&Ie(t.then)&&Ie(t.catch)};function J(t,e,n,o,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),o&&(this.request=o),r&&(this.response=r)}p.inherits(J,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:p.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Ir=J.prototype,Br={};["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=>{Br[t]={value:t}}),Object.defineProperties(J,Br),Object.defineProperty(Ir,"isAxiosError",{value:!0}),J.from=(t,e,n,o,r,s)=>{const a=Object.create(Ir);return p.toFlatObject(t,a,function(l){return l!==Error.prototype},f=>f!=="isAxiosError"),J.call(a,t.message,e,n,o,r),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const fu=null;function Gn(t){return p.isPlainObject(t)||p.isArray(t)}function Fr(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function Nr(t,e,n){return t?t.concat(e).map(function(r,s){return r=Fr(r),!n&&s?"["+r+"]":r}).join(n?".":""):e}function hu(t){return p.isArray(t)&&!t.some(Gn)}const pu=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function rn(t,e,n){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=p.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(N,X){return!p.isUndefined(X[N])});const o=n.metaTokens,r=n.visitor||C,s=n.dots,a=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(e);if(!p.isFunction(r))throw new TypeError("visitor must be a function");function w(B){if(B===null)return"";if(p.isDate(B))return B.toISOString();if(!l&&p.isBlob(B))throw new J("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(B)||p.isTypedArray(B)?l&&typeof Blob=="function"?new Blob([B]):Buffer.from(B):B}function C(B,N,X){let oe=B;if(B&&!X&&typeof B=="object"){if(p.endsWith(N,"{}"))N=o?N:N.slice(0,-2),B=JSON.stringify(B);else if(p.isArray(B)&&hu(B)||(p.isFileList(B)||p.endsWith(N,"[]"))&&(oe=p.toArray(B)))return N=Fr(N),oe.forEach(function($,ye){!(p.isUndefined($)||$===null)&&e.append(a===!0?Nr([N],ye,s):a===null?N:N+"[]",w($))}),!1}return Gn(B)?!0:(e.append(Nr(X,N,s),w(B)),!1)}const b=[],Y=Object.assign(pu,{defaultVisitor:C,convertValue:w,isVisitable:Gn});function H(B,N){if(!p.isUndefined(B)){if(b.indexOf(B)!==-1)throw Error("Circular reference detected in "+N.join("."));b.push(B),p.forEach(B,function(oe,ne){(!(p.isUndefined(oe)||oe===null)&&r.call(e,oe,p.isString(ne)?ne.trim():ne,N,Y))===!0&&H(oe,N?N.concat(ne):[ne])}),b.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return H(t),e}function Ur(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(o){return e[o]})}function Jn(t,e){this._pairs=[],t&&rn(t,this,e)}const Dr=Jn.prototype;Dr.append=function(e,n){this._pairs.push([e,n])},Dr.toString=function(e){const n=e?function(o){return e.call(this,o,Ur)}:Ur;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function mu(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Mr(t,e,n){if(!e)return t;const o=n&&n.encode||mu,r=n&&n.serialize;let s;if(r?s=r(e,n):s=p.isURLSearchParams(e)?e.toString():new Jn(e,n).toString(o),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class gu{constructor(){this.handlers=[]}use(e,n,o){return this.handlers.push({fulfilled:e,rejected:n,synchronous:o?o.synchronous:!1,runWhen:o?o.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){p.forEach(this.handlers,function(o){o!==null&&e(o)})}}const $r=gu,Hr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},yu={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Jn,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},jr=typeof window<"u"&&typeof document<"u",bu=(t=>jr&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),wu=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Me={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:jr,hasStandardBrowserEnv:bu,hasStandardBrowserWebWorkerEnv:wu},Symbol.toStringTag,{value:"Module"})),...yu};function Eu(t,e){return rn(t,new Me.classes.URLSearchParams,Object.assign({visitor:function(n,o,r,s){return Me.isNode&&p.isBuffer(n)?(this.append(o,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function ku(t){return p.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Au(t){const e={},n=Object.keys(t);let o;const r=n.length;let s;for(o=0;o<r;o++)s=n[o],e[s]=t[s];return e}function Vr(t){function e(n,o,r,s){let a=n[s++];if(a==="__proto__")return!0;const f=Number.isFinite(+a),l=s>=n.length;return a=!a&&p.isArray(r)?r.length:a,l?(p.hasOwnProp(r,a)?r[a]=[r[a],o]:r[a]=o,!f):((!r[a]||!p.isObject(r[a]))&&(r[a]=[]),e(n,o,r[a],s)&&p.isArray(r[a])&&(r[a]=Au(r[a])),!f)}if(p.isFormData(t)&&p.isFunction(t.entries)){const n={};return p.forEachEntry(t,(o,r)=>{e(ku(o),r,n,0)}),n}return null}function vu(t,e,n){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(o){if(o.name!=="SyntaxError")throw o}return(n||JSON.stringify)(t)}const Yn={transitional:Hr,adapter:["xhr","http"],transformRequest:[function(e,n){const o=n.getContentType()||"",r=o.indexOf("application/json")>-1,s=p.isObject(e);if(s&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return r&&r?JSON.stringify(Vr(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let f;if(s){if(o.indexOf("application/x-www-form-urlencoded")>-1)return Eu(e,this.formSerializer).toString();if((f=p.isFileList(e))||o.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return rn(f?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||r?(n.setContentType("application/json",!1),vu(e)):e}],transformResponse:[function(e){const n=this.transitional||Yn.transitional,o=n&&n.forcedJSONParsing,r=this.responseType==="json";if(e&&p.isString(e)&&(o&&!this.responseType||r)){const a=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(f){if(a)throw f.name==="SyntaxError"?J.from(f,J.ERR_BAD_RESPONSE,this,null,this.response):f}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Me.classes.FormData,Blob:Me.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],t=>{Yn.headers[t]={}});const Xn=Yn,Su=p.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"]),Cu=t=>{const e={};let n,o,r;return t&&t.split(`
|
|
80
80
|
`).forEach(function(a){r=a.indexOf(":"),n=a.substring(0,r).trim().toLowerCase(),o=a.substring(r+1).trim(),!(!n||e[n]&&Su[n])&&(n==="set-cookie"?e[n]?e[n].push(o):e[n]=[o]:e[n]=e[n]?e[n]+", "+o:o)}),e},zr=Symbol("internals");function Ut(t){return t&&String(t).trim().toLowerCase()}function sn(t){return t===!1||t==null?t:p.isArray(t)?t.map(sn):String(t)}function xu(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let o;for(;o=n.exec(t);)e[o[1]]=o[2];return e}const _u=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Zn(t,e,n,o,r){if(p.isFunction(o))return o.call(this,e,n);if(r&&(e=n),!!p.isString(e)){if(p.isString(o))return e.indexOf(o)!==-1;if(p.isRegExp(o))return o.test(e)}}function Tu(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,o)=>n.toUpperCase()+o)}function Pu(t,e){const n=p.toCamelCase(" "+e);["get","set","has"].forEach(o=>{Object.defineProperty(t,o+n,{value:function(r,s,a){return this[o].call(this,e,r,s,a)},configurable:!0})})}class an{constructor(e){e&&this.set(e)}set(e,n,o){const r=this;function s(f,l,w){const C=Ut(l);if(!C)throw new Error("header name must be a non-empty string");const b=p.findKey(r,C);(!b||r[b]===void 0||w===!0||w===void 0&&r[b]!==!1)&&(r[b||l]=sn(f))}const a=(f,l)=>p.forEach(f,(w,C)=>s(w,C,l));return p.isPlainObject(e)||e instanceof this.constructor?a(e,n):p.isString(e)&&(e=e.trim())&&!_u(e)?a(Cu(e),n):e!=null&&s(n,e,o),this}get(e,n){if(e=Ut(e),e){const o=p.findKey(this,e);if(o){const r=this[o];if(!n)return r;if(n===!0)return xu(r);if(p.isFunction(n))return n.call(this,r,o);if(p.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ut(e),e){const o=p.findKey(this,e);return!!(o&&this[o]!==void 0&&(!n||Zn(this,this[o],o,n)))}return!1}delete(e,n){const o=this;let r=!1;function s(a){if(a=Ut(a),a){const f=p.findKey(o,a);f&&(!n||Zn(o,o[f],f,n))&&(delete o[f],r=!0)}}return p.isArray(e)?e.forEach(s):s(e),r}clear(e){const n=Object.keys(this);let o=n.length,r=!1;for(;o--;){const s=n[o];(!e||Zn(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const n=this,o={};return p.forEach(this,(r,s)=>{const a=p.findKey(o,s);if(a){n[a]=sn(r),delete n[s];return}const f=e?Tu(s):String(s).trim();f!==s&&delete n[s],n[f]=sn(r),o[f]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return p.forEach(this,(o,r)=>{o!=null&&o!==!1&&(n[r]=e&&p.isArray(o)?o.join(", "):o)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
81
81
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const o=new this(e);return n.forEach(r=>o.set(r)),o}static accessor(e){const o=(this[zr]=this[zr]={accessors:{}}).accessors,r=this.prototype;function s(a){const f=Ut(a);o[f]||(Pu(r,a),o[f]=!0)}return p.isArray(e)?e.forEach(s):s(e),this}}an.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(an.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(o){this[n]=o}}}),p.freezeMethods(an);const je=an;function Qn(t,e){const n=this||Xn,o=e||n,r=je.from(o.headers);let s=o.data;return p.forEach(t,function(f){s=f.call(n,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function Wr(t){return!!(t&&t.__CANCEL__)}function Dt(t,e,n){J.call(this,t??"canceled",J.ERR_CANCELED,e,n),this.name="CanceledError"}p.inherits(Dt,J,{__CANCEL__:!0});function Ru(t,e,n){const o=n.config.validateStatus;!n.status||!o||o(n.status)?t(n):e(new J("Request failed with status code "+n.status,[J.ERR_BAD_REQUEST,J.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const Lu=Me.hasStandardBrowserEnv?{write(t,e,n,o,r,s){const a=[t+"="+encodeURIComponent(e)];p.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),p.isString(o)&&a.push("path="+o),p.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Ou(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Iu(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function qr(t,e){return t&&!Ou(e)?Iu(t,e):e}const Bu=Me.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let o;function r(s){let a=s;return e&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{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 o=r(window.location.href),function(a){const f=p.isString(a)?r(a):a;return f.protocol===o.protocol&&f.host===o.host}}():function(){return function(){return!0}}();function Fu(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Nu(t,e){t=t||10;const n=new Array(t),o=new Array(t);let r=0,s=0,a;return e=e!==void 0?e:1e3,function(l){const w=Date.now(),C=o[s];a||(a=w),n[r]=l,o[r]=w;let b=s,Y=0;for(;b!==r;)Y+=n[b++],b=b%t;if(r=(r+1)%t,r===s&&(s=(s+1)%t),w-a<e)return;const H=C&&w-C;return H?Math.round(Y*1e3/H):void 0}}function Kr(t,e){let n=0;const o=Nu(50,250);return r=>{const s=r.loaded,a=r.lengthComputable?r.total:void 0,f=s-n,l=o(f),w=s<=a;n=s;const C={loaded:s,total:a,progress:a?s/a:void 0,bytes:f,rate:l||void 0,estimated:l&&a&&w?(a-s)/l:void 0,event:r};C[e?"download":"upload"]=!0,t(C)}}const eo={http:fu,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,o){let r=t.data;const s=je.from(t.headers).normalize();let{responseType:a,withXSRFToken:f}=t,l;function w(){t.cancelToken&&t.cancelToken.unsubscribe(l),t.signal&&t.signal.removeEventListener("abort",l)}let C;if(p.isFormData(r)){if(Me.hasStandardBrowserEnv||Me.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((C=s.getContentType())!==!1){const[N,...X]=C?C.split(";").map(oe=>oe.trim()).filter(Boolean):[];s.setContentType([N||"multipart/form-data",...X].join("; "))}}let b=new XMLHttpRequest;if(t.auth){const N=t.auth.username||"",X=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(N+":"+X))}const Y=qr(t.baseURL,t.url);b.open(t.method.toUpperCase(),Mr(Y,t.params,t.paramsSerializer),!0),b.timeout=t.timeout;function H(){if(!b)return;const N=je.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),oe={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:N,config:t,request:b};Ru(function($){n($),w()},function($){o($),w()},oe),b=null}if("onloadend"in b?b.onloadend=H:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(H)},b.onabort=function(){b&&(o(new J("Request aborted",J.ECONNABORTED,t,b)),b=null)},b.onerror=function(){o(new J("Network Error",J.ERR_NETWORK,t,b)),b=null},b.ontimeout=function(){let X=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const oe=t.transitional||Hr;t.timeoutErrorMessage&&(X=t.timeoutErrorMessage),o(new J(X,oe.clarifyTimeoutError?J.ETIMEDOUT:J.ECONNABORTED,t,b)),b=null},Me.hasStandardBrowserEnv&&(f&&p.isFunction(f)&&(f=f(t)),f||f!==!1&&Bu(Y))){const N=t.xsrfHeaderName&&t.xsrfCookieName&&Lu.read(t.xsrfCookieName);N&&s.set(t.xsrfHeaderName,N)}r===void 0&&s.setContentType(null),"setRequestHeader"in b&&p.forEach(s.toJSON(),function(X,oe){b.setRequestHeader(oe,X)}),p.isUndefined(t.withCredentials)||(b.withCredentials=!!t.withCredentials),a&&a!=="json"&&(b.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&b.addEventListener("progress",Kr(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&b.upload&&b.upload.addEventListener("progress",Kr(t.onUploadProgress)),(t.cancelToken||t.signal)&&(l=N=>{b&&(o(!N||N.type?new Dt(null,t,b):N),b.abort(),b=null)},t.cancelToken&&t.cancelToken.subscribe(l),t.signal&&(t.signal.aborted?l():t.signal.addEventListener("abort",l)));const B=Fu(Y);if(B&&Me.protocols.indexOf(B)===-1){o(new J("Unsupported protocol "+B+":",J.ERR_BAD_REQUEST,t));return}b.send(r||null)})}};p.forEach(eo,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Gr=t=>`- ${t}`,Uu=t=>p.isFunction(t)||t===null||t===!1,Jr={getAdapter:t=>{t=p.isArray(t)?t:[t];const{length:e}=t;let n,o;const r={};for(let s=0;s<e;s++){n=t[s];let a;if(o=n,!Uu(n)&&(o=eo[(a=String(n)).toLowerCase()],o===void 0))throw new J(`Unknown adapter '${a}'`);if(o)break;r[a||"#"+s]=o}if(!o){const s=Object.entries(r).map(([f,l])=>`adapter ${f} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since :
|
|
82
82
|
`+s.map(Gr).join(`
|
|
83
|
-
`):" "+Gr(s[0]):"as no adapter specified";throw new J("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o},adapters:eo};function to(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Dt(null,t)}function Yr(t){return to(t),t.headers=je.from(t.headers),t.data=Qn.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Jr.getAdapter(t.adapter||Xn.adapter)(t).then(function(o){return to(t),o.data=Qn.call(t,t.transformResponse,o),o.headers=je.from(o.headers),o},function(o){return Wr(o)||(to(t),o&&o.response&&(o.response.data=Qn.call(t,t.transformResponse,o.response),o.response.headers=je.from(o.response.headers))),Promise.reject(o)})}const Xr=t=>t instanceof je?t.toJSON():t;function mt(t,e){e=e||{};const n={};function o(w,C,b){return p.isPlainObject(w)&&p.isPlainObject(C)?p.merge.call({caseless:b},w,C):p.isPlainObject(C)?p.merge({},C):p.isArray(C)?C.slice():C}function r(w,C,b){if(p.isUndefined(C)){if(!p.isUndefined(w))return o(void 0,w,b)}else return o(w,C,b)}function s(w,C){if(!p.isUndefined(C))return o(void 0,C)}function a(w,C){if(p.isUndefined(C)){if(!p.isUndefined(w))return o(void 0,w)}else return o(void 0,C)}function f(w,C,b){if(b in e)return o(w,C);if(b in t)return o(void 0,w)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:f,headers:(w,C)=>r(Xr(w),Xr(C),!0)};return p.forEach(Object.keys(Object.assign({},t,e)),function(C){const b=l[C]||r,Y=b(t[C],e[C],C);p.isUndefined(Y)&&b!==f||(n[C]=Y)}),n}const Zr="1.6.5",no={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{no[t]=function(o){return typeof o===t||"a"+(e<1?"n ":" ")+t}});const Qr={};no.transitional=function(e,n,o){function r(s,a){return"[Axios v"+Zr+"] Transitional option '"+s+"'"+a+(o?". "+o:"")}return(s,a,f)=>{if(e===!1)throw new J(r(a," has been removed"+(n?" in "+n:"")),J.ERR_DEPRECATED);return n&&!Qr[a]&&(Qr[a]=!0,console.warn(r(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,a,f):!0}};function Du(t,e,n){if(typeof t!="object")throw new J("options must be an object",J.ERR_BAD_OPTION_VALUE);const o=Object.keys(t);let r=o.length;for(;r-- >0;){const s=o[r],a=e[s];if(a){const f=t[s],l=f===void 0||a(f,s,t);if(l!==!0)throw new J("option "+s+" must be "+l,J.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new J("Unknown option "+s,J.ERR_BAD_OPTION)}}const oo={assertOptions:Du,validators:no},Ge=oo.validators;class cn{constructor(e){this.defaults=e,this.interceptors={request:new $r,response:new $r}}request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=mt(this.defaults,n);const{transitional:o,paramsSerializer:r,headers:s}=n;o!==void 0&&oo.assertOptions(o,{silentJSONParsing:Ge.transitional(Ge.boolean),forcedJSONParsing:Ge.transitional(Ge.boolean),clarifyTimeoutError:Ge.transitional(Ge.boolean)},!1),r!=null&&(p.isFunction(r)?n.paramsSerializer={serialize:r}:oo.assertOptions(r,{encode:Ge.function,serialize:Ge.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&p.merge(s.common,s[n.method]);s&&p.forEach(["delete","get","head","post","put","patch","common"],B=>{delete s[B]}),n.headers=je.concat(a,s);const f=[];let l=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(n)===!1||(l=l&&N.synchronous,f.unshift(N.fulfilled,N.rejected))});const w=[];this.interceptors.response.forEach(function(N){w.push(N.fulfilled,N.rejected)});let C,b=0,Y;if(!l){const B=[Yr.bind(this),void 0];for(B.unshift.apply(B,f),B.push.apply(B,w),Y=B.length,C=Promise.resolve(n);b<Y;)C=C.then(B[b++],B[b++]);return C}Y=f.length;let H=n;for(b=0;b<Y;){const B=f[b++],N=f[b++];try{H=B(H)}catch(X){N.call(this,X);break}}try{C=Yr.call(this,H)}catch(B){return Promise.reject(B)}for(b=0,Y=w.length;b<Y;)C=C.then(w[b++],w[b++]);return C}getUri(e){e=mt(this.defaults,e);const n=qr(e.baseURL,e.url);return Mr(n,e.params,e.paramsSerializer)}}p.forEach(["delete","get","head","options"],function(e){cn.prototype[e]=function(n,o){return this.request(mt(o||{},{method:e,url:n,data:(o||{}).data}))}}),p.forEach(["post","put","patch"],function(e){function n(o){return function(s,a,f){return this.request(mt(f||{},{method:e,headers:o?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}cn.prototype[e]=n(),cn.prototype[e+"Form"]=n(!0)});const ln=cn;class ro{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const o=this;this.promise.then(r=>{if(!o._listeners)return;let s=o._listeners.length;for(;s-- >0;)o._listeners[s](r);o._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(f=>{o.subscribe(f),s=f}).then(r);return a.cancel=function(){o.unsubscribe(s)},a},e(function(s,a,f){o.reason||(o.reason=new Dt(s,a,f),n(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new ro(function(r){e=r}),cancel:e}}}const Mu=ro;function $u(t){return function(n){return t.apply(null,n)}}function Hu(t){return p.isObject(t)&&t.isAxiosError===!0}const so={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(so).forEach(([t,e])=>{so[e]=t});const ju=so;function es(t){const e=new ln(t),n=vr(ln.prototype.request,e);return p.extend(n,ln.prototype,e,{allOwnKeys:!0}),p.extend(n,e,null,{allOwnKeys:!0}),n.create=function(r){return es(mt(t,r))},n}const re=es(Xn);re.Axios=ln,re.CanceledError=Dt,re.CancelToken=Mu,re.isCancel=Wr,re.VERSION=Zr,re.toFormData=rn,re.AxiosError=J,re.Cancel=re.CanceledError,re.all=function(e){return Promise.all(e)},re.spread=$u,re.isAxiosError=Hu,re.mergeConfig=mt,re.AxiosHeaders=je,re.formToJSON=t=>Vr(p.isHTMLForm(t)?new FormData(t):t),re.getAdapter=Jr.getAdapter,re.HttpStatusCode=ju,re.default=re;const Vu=re;class ts{constructor(e){We(this,"keycloak");We(this,"axios");We(this,"fileName","silent-login.html");this.keycloak=e,this.axios=Vu.create(),this.axios.defaults.baseURL="https://localhost:5001/api",this.axios.defaults.headers.common["content-type"]="application/json",this.axios.defaults.timeout=1e3*60*5,this.axios.interceptors.request.use(async n=>{await this.SilentLogin();const o=this.keycloak.token;return n.headers.Authorization=`Bearer ${o}`,n})}ParseAppResult(e){try{const n=typeof e.hasSuccess=="boolean",o=typeof e.hasError=="boolean",r=typeof e.httpStatusCode=="number",s=Array.isArray(e.errors);return n&&o&&r&&s?e:null}catch{return null}}HandleThen(e){const n=new zn,o=this.ParseAppResult(e.data);return o===null?(n.value=e.data,n):o.hasError?(o.errors.forEach(r=>n.WithError(r)),n.httpStatusCode=o.httpStatusCode,n):(n.value=e.data.value,n)}HandleCatch(e){var r;const n=new zn,o=this.ParseAppResult((r=e.response)==null?void 0:r.data);return o===null?n.WithError(e.message):(n.WithErrors(o.errors),n.httpStatusCode=o.httpStatusCode),n}async SilentLogin(){return new Promise(async e=>{if(!this.isTokenExpired){e(!0);return}const n=this.GenerateIframe(),o=r=>{if(document.body.removeChild(n),window.removeEventListener("message",o),r.origin!==location.origin){e(!1);return}const s=r.data.action,a=r.data.code,f=r.data.state,l=r.data.error;if(s!=="silent-login-iframe-result"||l==="login_required"||!a){e(!1);return}const w=new XMLHttpRequest;w.open("POST",this.tokenExchangeUrl,!0),w.setRequestHeader("Content-type","application/x-www-form-urlencoded"),w.onreadystatechange=()=>{if(w.readyState===4){if(w.status===200){const C=JSON.parse(w.responseText);this.keycloak.setToken(C.access_token,null,C.id_token,new Date().getTime()),e(!0);return}e(!1)}},w.send(this.TokenExchangeParams(a,f))};window.addEventListener("message",o)}).then(e=>(e||(this.keycloak.clearToken(),this.keycloak.login()),e))}GetCodeVerifierFromState(e){const n=`kc-callback-${e}`,o=localStorage.getItem(n);if(o)return localStorage.removeItem(n),JSON.parse(o).pkceCodeVerifier}TokenExchangeParams(e,n){let o=`code=${e}&grant_type=authorization_code`;return o+=`&client_id=${encodeURIComponent(this.keycloak.clientId)}`,o+=`&redirect_uri=${this.silentLoginRedirectUrl}`,o+=`&code_verifier=${this.GetCodeVerifierFromState(n)}`,o}GenerateIframe(){const e=document.createElement("iframe");return e.src=this.keycloak.createLoginUrl({prompt:"none",redirectUri:this.silentLoginRedirectUrl})??"",document.body.appendChild(e),e}get silentLoginRedirectUrl(){return`${location.origin}/${this.fileName}`}get tokenExchangeUrl(){return`${this.keycloak.authServerUrl}/realms/${this.keycloak.realm}/protocol/openid-connect/token`}get isTokenExpired(){const e=this.keycloak.tokenParsed,n=e?e.exp:null;return!e||!n?!0:n-Math.ceil(new Date().getTime()/1e3)+(this.keycloak.timeSkew??0)<10}}const zu=t=>new ts(t);(()=>{function t(){d.nextTick(()=>{setTimeout(()=>{var n;const e=document.querySelector(":root");e&&e.style.setProperty("--window-height",`${((n=window.visualViewport)==null?void 0:n.height)??window.innerHeight}px`)},1)})}t(),window.addEventListener("resize",t)})(),Hn.SetInitialTheme(),Q.AppResult=zn,Q.AxiosClient=ts,Q.Cor=pn,Q.SfButton=pl,Q.SfContent=sl,Q.SfIcon=Et,Q.SfLayout=el,Q.SfNavMenuLink=ol,Q.SfTabNavigation=dl,Q.Tamanho=ot,Q.UseAuthService=Ol,Q.UseAxiosClient=zu,Q.UseDialogService=br,Q.UseNavMenuService=hn,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
|
|
83
|
+
`):" "+Gr(s[0]):"as no adapter specified";throw new J("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o},adapters:eo};function to(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Dt(null,t)}function Yr(t){return to(t),t.headers=je.from(t.headers),t.data=Qn.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Jr.getAdapter(t.adapter||Xn.adapter)(t).then(function(o){return to(t),o.data=Qn.call(t,t.transformResponse,o),o.headers=je.from(o.headers),o},function(o){return Wr(o)||(to(t),o&&o.response&&(o.response.data=Qn.call(t,t.transformResponse,o.response),o.response.headers=je.from(o.response.headers))),Promise.reject(o)})}const Xr=t=>t instanceof je?t.toJSON():t;function mt(t,e){e=e||{};const n={};function o(w,C,b){return p.isPlainObject(w)&&p.isPlainObject(C)?p.merge.call({caseless:b},w,C):p.isPlainObject(C)?p.merge({},C):p.isArray(C)?C.slice():C}function r(w,C,b){if(p.isUndefined(C)){if(!p.isUndefined(w))return o(void 0,w,b)}else return o(w,C,b)}function s(w,C){if(!p.isUndefined(C))return o(void 0,C)}function a(w,C){if(p.isUndefined(C)){if(!p.isUndefined(w))return o(void 0,w)}else return o(void 0,C)}function f(w,C,b){if(b in e)return o(w,C);if(b in t)return o(void 0,w)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:f,headers:(w,C)=>r(Xr(w),Xr(C),!0)};return p.forEach(Object.keys(Object.assign({},t,e)),function(C){const b=l[C]||r,Y=b(t[C],e[C],C);p.isUndefined(Y)&&b!==f||(n[C]=Y)}),n}const Zr="1.6.5",no={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{no[t]=function(o){return typeof o===t||"a"+(e<1?"n ":" ")+t}});const Qr={};no.transitional=function(e,n,o){function r(s,a){return"[Axios v"+Zr+"] Transitional option '"+s+"'"+a+(o?". "+o:"")}return(s,a,f)=>{if(e===!1)throw new J(r(a," has been removed"+(n?" in "+n:"")),J.ERR_DEPRECATED);return n&&!Qr[a]&&(Qr[a]=!0,console.warn(r(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,a,f):!0}};function Du(t,e,n){if(typeof t!="object")throw new J("options must be an object",J.ERR_BAD_OPTION_VALUE);const o=Object.keys(t);let r=o.length;for(;r-- >0;){const s=o[r],a=e[s];if(a){const f=t[s],l=f===void 0||a(f,s,t);if(l!==!0)throw new J("option "+s+" must be "+l,J.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new J("Unknown option "+s,J.ERR_BAD_OPTION)}}const oo={assertOptions:Du,validators:no},Ge=oo.validators;class cn{constructor(e){this.defaults=e,this.interceptors={request:new $r,response:new $r}}request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=mt(this.defaults,n);const{transitional:o,paramsSerializer:r,headers:s}=n;o!==void 0&&oo.assertOptions(o,{silentJSONParsing:Ge.transitional(Ge.boolean),forcedJSONParsing:Ge.transitional(Ge.boolean),clarifyTimeoutError:Ge.transitional(Ge.boolean)},!1),r!=null&&(p.isFunction(r)?n.paramsSerializer={serialize:r}:oo.assertOptions(r,{encode:Ge.function,serialize:Ge.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&p.merge(s.common,s[n.method]);s&&p.forEach(["delete","get","head","post","put","patch","common"],B=>{delete s[B]}),n.headers=je.concat(a,s);const f=[];let l=!0;this.interceptors.request.forEach(function(N){typeof N.runWhen=="function"&&N.runWhen(n)===!1||(l=l&&N.synchronous,f.unshift(N.fulfilled,N.rejected))});const w=[];this.interceptors.response.forEach(function(N){w.push(N.fulfilled,N.rejected)});let C,b=0,Y;if(!l){const B=[Yr.bind(this),void 0];for(B.unshift.apply(B,f),B.push.apply(B,w),Y=B.length,C=Promise.resolve(n);b<Y;)C=C.then(B[b++],B[b++]);return C}Y=f.length;let H=n;for(b=0;b<Y;){const B=f[b++],N=f[b++];try{H=B(H)}catch(X){N.call(this,X);break}}try{C=Yr.call(this,H)}catch(B){return Promise.reject(B)}for(b=0,Y=w.length;b<Y;)C=C.then(w[b++],w[b++]);return C}getUri(e){e=mt(this.defaults,e);const n=qr(e.baseURL,e.url);return Mr(n,e.params,e.paramsSerializer)}}p.forEach(["delete","get","head","options"],function(e){cn.prototype[e]=function(n,o){return this.request(mt(o||{},{method:e,url:n,data:(o||{}).data}))}}),p.forEach(["post","put","patch"],function(e){function n(o){return function(s,a,f){return this.request(mt(f||{},{method:e,headers:o?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}cn.prototype[e]=n(),cn.prototype[e+"Form"]=n(!0)});const ln=cn;class ro{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const o=this;this.promise.then(r=>{if(!o._listeners)return;let s=o._listeners.length;for(;s-- >0;)o._listeners[s](r);o._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(f=>{o.subscribe(f),s=f}).then(r);return a.cancel=function(){o.unsubscribe(s)},a},e(function(s,a,f){o.reason||(o.reason=new Dt(s,a,f),n(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new ro(function(r){e=r}),cancel:e}}}const Mu=ro;function $u(t){return function(n){return t.apply(null,n)}}function Hu(t){return p.isObject(t)&&t.isAxiosError===!0}const so={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(so).forEach(([t,e])=>{so[e]=t});const ju=so;function es(t){const e=new ln(t),n=vr(ln.prototype.request,e);return p.extend(n,ln.prototype,e,{allOwnKeys:!0}),p.extend(n,e,null,{allOwnKeys:!0}),n.create=function(r){return es(mt(t,r))},n}const re=es(Xn);re.Axios=ln,re.CanceledError=Dt,re.CancelToken=Mu,re.isCancel=Wr,re.VERSION=Zr,re.toFormData=rn,re.AxiosError=J,re.Cancel=re.CanceledError,re.all=function(e){return Promise.all(e)},re.spread=$u,re.isAxiosError=Hu,re.mergeConfig=mt,re.AxiosHeaders=je,re.formToJSON=t=>Vr(p.isHTMLForm(t)?new FormData(t):t),re.getAdapter=Jr.getAdapter,re.HttpStatusCode=ju,re.default=re;const Vu=re;class ts{constructor(e){We(this,"keycloak");We(this,"axios");We(this,"fileName","silent-login.html");this.keycloak=e,this.axios=Vu.create(),this.axios.defaults.baseURL="https://localhost:5001/api",this.axios.defaults.headers.common["content-type"]="application/json",this.axios.defaults.timeout=1e3*60*5,this.axios.interceptors.request.use(async n=>{await this.SilentLogin();const o=this.keycloak.token;return n.headers.Authorization=`Bearer ${o}`,n})}ParseAppResult(e){try{const n=typeof e.hasSuccess=="boolean",o=typeof e.hasError=="boolean",r=typeof e.httpStatusCode=="number",s=Array.isArray(e.errors);return n&&o&&r&&s?e:null}catch{return null}}HandleThen(e){const n=new zn,o=this.ParseAppResult(e.data);return o===null?(n.value=e.data,n):o.hasError?(o.errors.forEach(r=>n.WithError(r)),n.httpStatusCode=o.httpStatusCode,n):(n.value=e.data.value,n)}HandleCatch(e){var r;const n=new zn,o=this.ParseAppResult((r=e.response)==null?void 0:r.data);return o===null?n.WithError(e.message):(n.WithErrors(o.errors),n.httpStatusCode=o.httpStatusCode),n}async SilentLogin(){return new Promise(async e=>{if(!this.isTokenExpired){e(!0);return}const n=this.GenerateIframe(),o=r=>{if(document.body.removeChild(n),window.removeEventListener("message",o),r.origin!==location.origin){e(!1);return}const s=r.data.action,a=r.data.code,f=r.data.state,l=r.data.error;if(s!=="silent-login-iframe-result"||l==="login_required"||!a){e(!1);return}const w=new XMLHttpRequest;w.open("POST",this.tokenExchangeUrl,!0),w.setRequestHeader("Content-type","application/x-www-form-urlencoded"),w.onreadystatechange=()=>{if(w.readyState===4){if(w.status===200){const C=JSON.parse(w.responseText);this.keycloak.setToken(C.access_token,null,C.id_token,new Date().getTime()),e(!0);return}e(!1)}},w.send(this.TokenExchangeParams(a,f))};window.addEventListener("message",o)}).then(e=>(e||(this.keycloak.clearToken(),this.keycloak.login()),e))}GetCodeVerifierFromState(e){const n=`kc-callback-${e}`,o=localStorage.getItem(n);if(o)return localStorage.removeItem(n),JSON.parse(o).pkceCodeVerifier}TokenExchangeParams(e,n){let o=`code=${e}&grant_type=authorization_code`;return o+=`&client_id=${encodeURIComponent(this.keycloak.clientId)}`,o+=`&redirect_uri=${this.silentLoginRedirectUrl}`,o+=`&code_verifier=${this.GetCodeVerifierFromState(n)}`,o}GenerateIframe(){const e=document.createElement("iframe");return e.src=this.keycloak.createLoginUrl({prompt:"none",redirectUri:this.silentLoginRedirectUrl})??"",document.body.appendChild(e),e}get silentLoginRedirectUrl(){return`${location.origin}/${this.fileName}`}get tokenExchangeUrl(){return`${this.keycloak.authServerUrl}/realms/${this.keycloak.realm}/protocol/openid-connect/token`}get isTokenExpired(){const e=this.keycloak.tokenParsed,n=e?e.exp:null;return!e||!n?!0:n-Math.ceil(new Date().getTime()/1e3)+(this.keycloak.timeSkew??0)<10}}const zu=t=>new ts(t);Hn.SetInitialTheme(),Q.AppResult=zn,Q.AxiosClient=ts,Q.Cor=pn,Q.SfButton=pl,Q.SfContent=sl,Q.SfIcon=Et,Q.SfLayout=el,Q.SfNavMenuLink=ol,Q.SfTabNavigation=dl,Q.Tamanho=ot,Q.UseAuthService=Ol,Q.UseAxiosClient=zu,Q.UseDialogService=br,Q.UseNavMenuService=hn,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
|
|
84
84
|
//# sourceMappingURL=lib.umd.js.map
|