@luizleon/sf.prefeiturasp.vuecomponents 0.0.57 → 0.0.59
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/axios/axiosClient.d.ts +2 -2
- package/dist/sf.prefeiturasp.vuecomponents.es.js +5 -5
- package/dist/sf.prefeiturasp.vuecomponents.es.js.map +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.umd.js +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/axios/axiosClient.ts +4 -4
- package/src/components/drawer/Drawer.d.ts +1 -1
|
@@ -156,5 +156,5 @@ For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_m
|
|
|
156
156
|
`).forEach(function(s){o=s.indexOf(":"),n=s.substring(0,o).trim().toLowerCase(),r=s.substring(o+1).trim(),!(!n||e[n]&&kp[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Gi=Symbol("internals");function Xt(t){return t&&String(t).trim().toLowerCase()}function _n(t){return t===!1||t==null?t:b.isArray(t)?t.map(_n):String(t)}function Ip(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const Pp=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Pr(t,e,n,r,o){if(b.isFunction(r))return r.call(this,e,n);if(o&&(e=n),!!b.isString(e)){if(b.isString(r))return e.indexOf(r)!==-1;if(b.isRegExp(r))return r.test(e)}}function Tp(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Op(t,e){const n=b.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(o,i,s){return this[r].call(this,e,o,i,s)},configurable:!0})})}class An{constructor(e){e&&this.set(e)}set(e,n,r){const o=this;function i(c,l,d){const f=Xt(l);if(!f)throw new Error("header name must be a non-empty string");const p=b.findKey(o,f);(!p||o[p]===void 0||d===!0||d===void 0&&o[p]!==!1)&&(o[p||l]=_n(c))}const s=(c,l)=>b.forEach(c,(d,f)=>i(d,f,l));return b.isPlainObject(e)||e instanceof this.constructor?s(e,n):b.isString(e)&&(e=e.trim())&&!Pp(e)?s(xp(e),n):e!=null&&i(n,e,r),this}get(e,n){if(e=Xt(e),e){const r=b.findKey(this,e);if(r){const o=this[r];if(!n)return o;if(n===!0)return Ip(o);if(b.isFunction(n))return n.call(this,o,r);if(b.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Xt(e),e){const r=b.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Pr(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let o=!1;function i(s){if(s=Xt(s),s){const c=b.findKey(r,s);c&&(!n||Pr(r,r[c],c,n))&&(delete r[c],o=!0)}}return b.isArray(e)?e.forEach(i):i(e),o}clear(e){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const i=n[r];(!e||Pr(this,this[i],i,e,!0))&&(delete this[i],o=!0)}return o}normalize(e){const n=this,r={};return b.forEach(this,(o,i)=>{const s=b.findKey(r,i);if(s){n[s]=_n(o),delete n[i];return}const c=e?Tp(i):String(i).trim();c!==i&&delete n[i],n[c]=_n(o),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return b.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=e&&b.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
157
157
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(o=>r.set(o)),r}static accessor(e){const r=(this[Gi]=this[Gi]={accessors:{}}).accessors,o=this.prototype;function i(s){const c=Xt(s);r[c]||(Op(o,s),r[c]=!0)}return b.isArray(e)?e.forEach(i):i(e),this}}An.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),b.reduceDescriptors(An.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),b.freezeMethods(An);const Je=An;function Tr(t,e){const n=this||Ir,r=e||n,o=Je.from(r.headers);let i=r.data;return b.forEach(t,function(c){i=c.call(n,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function Ji(t){return!!(t&&t.__CANCEL__)}function Zt(t,e,n){ne.call(this,t??"canceled",ne.ERR_CANCELED,e,n),this.name="CanceledError"}b.inherits(Zt,ne,{__CANCEL__:!0});function Lp(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new ne("Request failed with status code "+n.status,[ne.ERR_BAD_REQUEST,ne.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const Bp=We.hasStandardBrowserEnv?{write(t,e,n,r,o,i){const s=[t+"="+encodeURIComponent(e)];b.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),b.isString(r)&&s.push("path="+r),b.isString(o)&&s.push("domain="+o),i===!0&&s.push("secure"),document.cookie=s.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 Fp(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Rp(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Yi(t,e){return t&&!Fp(e)?Rp(t,e):e}const $p=We.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(i){let s=i;return e&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{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=o(window.location.href),function(s){const c=b.isString(s)?o(s):s;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function Np(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Dp(t,e){t=t||10;const n=new Array(t),r=new Array(t);let o=0,i=0,s;return e=e!==void 0?e:1e3,function(l){const d=Date.now(),f=r[i];s||(s=d),n[o]=l,r[o]=d;let p=i,v=0;for(;p!==o;)v+=n[p++],p=p%t;if(o=(o+1)%t,o===i&&(i=(i+1)%t),d-s<e)return;const w=f&&d-f;return w?Math.round(v*1e3/w):void 0}}function Xi(t,e){let n=0;const r=Dp(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,c=i-n,l=r(c),d=i<=s;n=i;const f={loaded:i,total:s,progress:s?i/s:void 0,bytes:c,rate:l||void 0,estimated:l&&s&&d?(s-i)/l:void 0,event:o};f[e?"download":"upload"]=!0,t(f)}}const Or={http:hp,xhr:typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){let o=t.data;const i=Je.from(t.headers).normalize();let{responseType:s,withXSRFToken:c}=t,l;function d(){t.cancelToken&&t.cancelToken.unsubscribe(l),t.signal&&t.signal.removeEventListener("abort",l)}let f;if(b.isFormData(o)){if(We.hasStandardBrowserEnv||We.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if((f=i.getContentType())!==!1){const[x,...C]=f?f.split(";").map($=>$.trim()).filter(Boolean):[];i.setContentType([x||"multipart/form-data",...C].join("; "))}}let p=new XMLHttpRequest;if(t.auth){const x=t.auth.username||"",C=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(x+":"+C))}const v=Yi(t.baseURL,t.url);p.open(t.method.toUpperCase(),Vi(v,t.params,t.paramsSerializer),!0),p.timeout=t.timeout;function w(){if(!p)return;const x=Je.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),$={data:!s||s==="text"||s==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:x,config:t,request:p};Lp(function(V){n(V),d()},function(V){r(V),d()},$),p=null}if("onloadend"in p?p.onloadend=w:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(w)},p.onabort=function(){p&&(r(new ne("Request aborted",ne.ECONNABORTED,t,p)),p=null)},p.onerror=function(){r(new ne("Network Error",ne.ERR_NETWORK,t,p)),p=null},p.ontimeout=function(){let C=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const $=t.transitional||zi;t.timeoutErrorMessage&&(C=t.timeoutErrorMessage),r(new ne(C,$.clarifyTimeoutError?ne.ETIMEDOUT:ne.ECONNABORTED,t,p)),p=null},We.hasStandardBrowserEnv&&(c&&b.isFunction(c)&&(c=c(t)),c||c!==!1&&$p(v))){const x=t.xsrfHeaderName&&t.xsrfCookieName&&Bp.read(t.xsrfCookieName);x&&i.set(t.xsrfHeaderName,x)}o===void 0&&i.setContentType(null),"setRequestHeader"in p&&b.forEach(i.toJSON(),function(C,$){p.setRequestHeader($,C)}),b.isUndefined(t.withCredentials)||(p.withCredentials=!!t.withCredentials),s&&s!=="json"&&(p.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&p.addEventListener("progress",Xi(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&p.upload&&p.upload.addEventListener("progress",Xi(t.onUploadProgress)),(t.cancelToken||t.signal)&&(l=x=>{p&&(r(!x||x.type?new Zt(null,t,p):x),p.abort(),p=null)},t.cancelToken&&t.cancelToken.subscribe(l),t.signal&&(t.signal.aborted?l():t.signal.addEventListener("abort",l)));const _=Np(v);if(_&&We.protocols.indexOf(_)===-1){r(new ne("Unsupported protocol "+_+":",ne.ERR_BAD_REQUEST,t));return}p.send(o||null)})}};b.forEach(Or,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Zi=t=>`- ${t}`,Mp=t=>b.isFunction(t)||t===null||t===!1,Qi={getAdapter:t=>{t=b.isArray(t)?t:[t];const{length:e}=t;let n,r;const o={};for(let i=0;i<e;i++){n=t[i];let s;if(r=n,!Mp(n)&&(r=Or[(s=String(n)).toLowerCase()],r===void 0))throw new ne(`Unknown adapter '${s}'`);if(r)break;o[s||"#"+i]=r}if(!r){const i=Object.entries(o).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let s=e?i.length>1?`since :
|
|
158
158
|
`+i.map(Zi).join(`
|
|
159
|
-
`):" "+Zi(i[0]):"as no adapter specified";throw new ne("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Or};function Lr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Zt(null,t)}function es(t){return Lr(t),t.headers=Je.from(t.headers),t.data=Tr.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Qi.getAdapter(t.adapter||Ir.adapter)(t).then(function(r){return Lr(t),r.data=Tr.call(t,t.transformResponse,r),r.headers=Je.from(r.headers),r},function(r){return Ji(r)||(Lr(t),r&&r.response&&(r.response.data=Tr.call(t,t.transformResponse,r.response),r.response.headers=Je.from(r.response.headers))),Promise.reject(r)})}const ts=t=>t instanceof Je?t.toJSON():t;function Et(t,e){e=e||{};const n={};function r(d,f,p){return b.isPlainObject(d)&&b.isPlainObject(f)?b.merge.call({caseless:p},d,f):b.isPlainObject(f)?b.merge({},f):b.isArray(f)?f.slice():f}function o(d,f,p){if(b.isUndefined(f)){if(!b.isUndefined(d))return r(void 0,d,p)}else return r(d,f,p)}function i(d,f){if(!b.isUndefined(f))return r(void 0,f)}function s(d,f){if(b.isUndefined(f)){if(!b.isUndefined(d))return r(void 0,d)}else return r(void 0,f)}function c(d,f,p){if(p in e)return r(d,f);if(p in t)return r(void 0,d)}const l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c,headers:(d,f)=>o(ts(d),ts(f),!0)};return b.forEach(Object.keys(Object.assign({},t,e)),function(f){const p=l[f]||o,v=p(t[f],e[f],f);b.isUndefined(v)&&p!==c||(n[f]=v)}),n}const ns="1.6.5",Br={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Br[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const rs={};Br.transitional=function(e,n,r){function o(i,s){return"[Axios v"+ns+"] Transitional option '"+i+"'"+s+(r?". "+r:"")}return(i,s,c)=>{if(e===!1)throw new ne(o(s," has been removed"+(n?" in "+n:"")),ne.ERR_DEPRECATED);return n&&!rs[s]&&(rs[s]=!0,console.warn(o(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,s,c):!0}};function Up(t,e,n){if(typeof t!="object")throw new ne("options must be an object",ne.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let o=r.length;for(;o-- >0;){const i=r[o],s=e[i];if(s){const c=t[i],l=c===void 0||s(c,i,t);if(l!==!0)throw new ne("option "+i+" must be "+l,ne.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ne("Unknown option "+i,ne.ERR_BAD_OPTION)}}const Fr={assertOptions:Up,validators:Br},nt=Fr.validators;class kn{constructor(e){this.defaults=e,this.interceptors={request:new Ki,response:new Ki}}request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Et(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Fr.assertOptions(r,{silentJSONParsing:nt.transitional(nt.boolean),forcedJSONParsing:nt.transitional(nt.boolean),clarifyTimeoutError:nt.transitional(nt.boolean)},!1),o!=null&&(b.isFunction(o)?n.paramsSerializer={serialize:o}:Fr.assertOptions(o,{encode:nt.function,serialize:nt.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&b.merge(i.common,i[n.method]);i&&b.forEach(["delete","get","head","post","put","patch","common"],_=>{delete i[_]}),n.headers=Je.concat(s,i);const c=[];let l=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(n)===!1||(l=l&&x.synchronous,c.unshift(x.fulfilled,x.rejected))});const d=[];this.interceptors.response.forEach(function(x){d.push(x.fulfilled,x.rejected)});let f,p=0,v;if(!l){const _=[es.bind(this),void 0];for(_.unshift.apply(_,c),_.push.apply(_,d),v=_.length,f=Promise.resolve(n);p<v;)f=f.then(_[p++],_[p++]);return f}v=c.length;let w=n;for(p=0;p<v;){const _=c[p++],x=c[p++];try{w=_(w)}catch(C){x.call(this,C);break}}try{f=es.call(this,w)}catch(_){return Promise.reject(_)}for(p=0,v=d.length;p<v;)f=f.then(d[p++],d[p++]);return f}getUri(e){e=Et(this.defaults,e);const n=Yi(e.baseURL,e.url);return Vi(n,e.params,e.paramsSerializer)}}b.forEach(["delete","get","head","options"],function(e){kn.prototype[e]=function(n,r){return this.request(Et(r||{},{method:e,url:n,data:(r||{}).data}))}}),b.forEach(["post","put","patch"],function(e){function n(r){return function(i,s,c){return this.request(Et(c||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}kn.prototype[e]=n(),kn.prototype[e+"Form"]=n(!0)});const xn=kn;class Rr{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(c=>{r.subscribe(c),i=c}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},e(function(i,s,c){r.reason||(r.reason=new Zt(i,s,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new Rr(function(o){e=o}),cancel:e}}}const Hp=Rr;function jp(t){return function(n){return t.apply(null,n)}}function Vp(t){return b.isObject(t)&&t.isAxiosError===!0}const $r={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($r).forEach(([t,e])=>{$r[e]=t});const Kp=$r;function os(t){const e=new xn(t),n=xi(xn.prototype.request,e);return b.extend(n,xn.prototype,e,{allOwnKeys:!0}),b.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return os(Et(t,o))},n}const ue=os(Ir);ue.Axios=xn,ue.CanceledError=Zt,ue.CancelToken=Hp,ue.isCancel=Ji,ue.VERSION=ns,ue.toFormData=Cn,ue.AxiosError=ne,ue.Cancel=ue.CanceledError,ue.all=function(e){return Promise.all(e)},ue.spread=jp,ue.isAxiosError=Vp,ue.mergeConfig=Et,ue.AxiosHeaders=Je,ue.formToJSON=t=>qi(b.isHTMLForm(t)?new FormData(t):t),ue.getAdapter=Qi.getAdapter,ue.HttpStatusCode=Kp,ue.default=ue;class is{constructor(e){Me(this,"keycloak");Me(this,"axios");Me(this,"fileName","silent-login.html");this.keycloak=e,this.axios=ue.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 r=this.keycloak.token;return n.headers.Authorization=`Bearer ${r}`,n})}ParseAppResult(e){try{const n=typeof e.hasSuccess=="boolean",r=typeof e.hasError=="boolean",o=typeof e.httpStatusCode=="number",i=Array.isArray(e.errors);return n&&r&&o&&i?e:null}catch{return null}}HandleThen(e){const n=new Er,r=this.ParseAppResult(e.data);return r===null?(n.value=e.data,n):r.hasError?(r.errors.forEach(o=>n.WithError(o)),n.httpStatusCode=r.httpStatusCode,n):(n.value=e.data.value,n)}HandleCatch(e){var o;const n=new Er,r=this.ParseAppResult((o=e.response)==null?void 0:o.data);return r===null?n.WithError(e.message):(n.WithErrors(r.errors),n.httpStatusCode=r.httpStatusCode),n}async SilentLogin(){return new Promise(async e=>{if(!this.isTokenExpired){e(!0);return}const n=this.GenerateIframe(),r=o=>{if(document.body.removeChild(n),window.removeEventListener("message",r),o.origin!==location.origin){e(!1);return}const i=o.data.action,s=o.data.code,c=o.data.state,l=o.data.error;if(i!=="silent-login-iframe-result"||l==="login_required"||!s){e(!1);return}const d=new XMLHttpRequest;d.open("POST",this.tokenExchangeUrl,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.onreadystatechange=()=>{if(d.readyState===4){if(d.status===200){const f=JSON.parse(d.responseText);this.keycloak.setToken(f.access_token,null,f.id_token,new Date().getTime()),e(!0);return}e(!1)}},d.send(this.TokenExchangeParams(s,c))};window.addEventListener("message",r)}).then(e=>(e||(this.keycloak.clearToken(),this.keycloak.login()),e))}GetCodeVerifierFromState(e){const n=`kc-callback-${e}`,r=localStorage.getItem(n);if(r)return localStorage.removeItem(n),JSON.parse(r).pkceCodeVerifier}TokenExchangeParams(e,n){let r=`code=${e}&grant_type=authorization_code`;return r+=`&client_id=${encodeURIComponent(this.keycloak.clientId)}`,r+=`&redirect_uri=${this.silentLoginRedirectUrl}`,r+=`&code_verifier=${this.GetCodeVerifierFromState(n)}`,r}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 zp=t=>new is(t);ir.SetInitialTheme(),ee.AppResult=Er,ee.AxiosClient=is,ee.SfButton=zr,ee.SfContent=Cu,ee.SfDrawer=Kr,ee.SfIcon=Qe,ee.SfLayout=bu,ee.SfMessage=Ou,ee.SfNavMenuLink=Eu,ee.SfPanelMenu=yf,ee.SfTabNavigation=Pu,ee.SfTooltip=Ln,ee.UseAlertService=Qc,ee.UseAuthService=Rf,ee.UseAxiosClient=zp,ee.UseConfirmService=Yo,ee.UseNavMenuService=Tn,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})});
|
|
159
|
+
`):" "+Zi(i[0]):"as no adapter specified";throw new ne("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Or};function Lr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Zt(null,t)}function es(t){return Lr(t),t.headers=Je.from(t.headers),t.data=Tr.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Qi.getAdapter(t.adapter||Ir.adapter)(t).then(function(r){return Lr(t),r.data=Tr.call(t,t.transformResponse,r),r.headers=Je.from(r.headers),r},function(r){return Ji(r)||(Lr(t),r&&r.response&&(r.response.data=Tr.call(t,t.transformResponse,r.response),r.response.headers=Je.from(r.response.headers))),Promise.reject(r)})}const ts=t=>t instanceof Je?t.toJSON():t;function Et(t,e){e=e||{};const n={};function r(d,f,p){return b.isPlainObject(d)&&b.isPlainObject(f)?b.merge.call({caseless:p},d,f):b.isPlainObject(f)?b.merge({},f):b.isArray(f)?f.slice():f}function o(d,f,p){if(b.isUndefined(f)){if(!b.isUndefined(d))return r(void 0,d,p)}else return r(d,f,p)}function i(d,f){if(!b.isUndefined(f))return r(void 0,f)}function s(d,f){if(b.isUndefined(f)){if(!b.isUndefined(d))return r(void 0,d)}else return r(void 0,f)}function c(d,f,p){if(p in e)return r(d,f);if(p in t)return r(void 0,d)}const l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c,headers:(d,f)=>o(ts(d),ts(f),!0)};return b.forEach(Object.keys(Object.assign({},t,e)),function(f){const p=l[f]||o,v=p(t[f],e[f],f);b.isUndefined(v)&&p!==c||(n[f]=v)}),n}const ns="1.6.5",Br={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Br[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const rs={};Br.transitional=function(e,n,r){function o(i,s){return"[Axios v"+ns+"] Transitional option '"+i+"'"+s+(r?". "+r:"")}return(i,s,c)=>{if(e===!1)throw new ne(o(s," has been removed"+(n?" in "+n:"")),ne.ERR_DEPRECATED);return n&&!rs[s]&&(rs[s]=!0,console.warn(o(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,s,c):!0}};function Up(t,e,n){if(typeof t!="object")throw new ne("options must be an object",ne.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let o=r.length;for(;o-- >0;){const i=r[o],s=e[i];if(s){const c=t[i],l=c===void 0||s(c,i,t);if(l!==!0)throw new ne("option "+i+" must be "+l,ne.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ne("Unknown option "+i,ne.ERR_BAD_OPTION)}}const Fr={assertOptions:Up,validators:Br},nt=Fr.validators;class kn{constructor(e){this.defaults=e,this.interceptors={request:new Ki,response:new Ki}}request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Et(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Fr.assertOptions(r,{silentJSONParsing:nt.transitional(nt.boolean),forcedJSONParsing:nt.transitional(nt.boolean),clarifyTimeoutError:nt.transitional(nt.boolean)},!1),o!=null&&(b.isFunction(o)?n.paramsSerializer={serialize:o}:Fr.assertOptions(o,{encode:nt.function,serialize:nt.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&b.merge(i.common,i[n.method]);i&&b.forEach(["delete","get","head","post","put","patch","common"],_=>{delete i[_]}),n.headers=Je.concat(s,i);const c=[];let l=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(n)===!1||(l=l&&x.synchronous,c.unshift(x.fulfilled,x.rejected))});const d=[];this.interceptors.response.forEach(function(x){d.push(x.fulfilled,x.rejected)});let f,p=0,v;if(!l){const _=[es.bind(this),void 0];for(_.unshift.apply(_,c),_.push.apply(_,d),v=_.length,f=Promise.resolve(n);p<v;)f=f.then(_[p++],_[p++]);return f}v=c.length;let w=n;for(p=0;p<v;){const _=c[p++],x=c[p++];try{w=_(w)}catch(C){x.call(this,C);break}}try{f=es.call(this,w)}catch(_){return Promise.reject(_)}for(p=0,v=d.length;p<v;)f=f.then(d[p++],d[p++]);return f}getUri(e){e=Et(this.defaults,e);const n=Yi(e.baseURL,e.url);return Vi(n,e.params,e.paramsSerializer)}}b.forEach(["delete","get","head","options"],function(e){kn.prototype[e]=function(n,r){return this.request(Et(r||{},{method:e,url:n,data:(r||{}).data}))}}),b.forEach(["post","put","patch"],function(e){function n(r){return function(i,s,c){return this.request(Et(c||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}kn.prototype[e]=n(),kn.prototype[e+"Form"]=n(!0)});const xn=kn;class Rr{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(c=>{r.subscribe(c),i=c}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},e(function(i,s,c){r.reason||(r.reason=new Zt(i,s,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}static source(){let e;return{token:new Rr(function(o){e=o}),cancel:e}}}const Hp=Rr;function jp(t){return function(n){return t.apply(null,n)}}function Vp(t){return b.isObject(t)&&t.isAxiosError===!0}const $r={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($r).forEach(([t,e])=>{$r[e]=t});const Kp=$r;function os(t){const e=new xn(t),n=xi(xn.prototype.request,e);return b.extend(n,xn.prototype,e,{allOwnKeys:!0}),b.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return os(Et(t,o))},n}const ue=os(Ir);ue.Axios=xn,ue.CanceledError=Zt,ue.CancelToken=Hp,ue.isCancel=Ji,ue.VERSION=ns,ue.toFormData=Cn,ue.AxiosError=ne,ue.Cancel=ue.CanceledError,ue.all=function(e){return Promise.all(e)},ue.spread=jp,ue.isAxiosError=Vp,ue.mergeConfig=Et,ue.AxiosHeaders=Je,ue.formToJSON=t=>qi(b.isHTMLForm(t)?new FormData(t):t),ue.getAdapter=Qi.getAdapter,ue.HttpStatusCode=Kp,ue.default=ue;class is{constructor(e,n){Me(this,"keycloak");Me(this,"axios");Me(this,"fileName","silent-login.html");this.keycloak=e,this.axios=ue.create(),this.axios.defaults.baseURL=n,this.axios.defaults.headers.common["content-type"]="application/json",this.axios.defaults.timeout=1e3*60*5,this.axios.interceptors.request.use(async r=>{await this.SilentLogin();const o=this.keycloak.token;return r.headers.Authorization=`Bearer ${o}`,r})}ParseAppResult(e){try{const n=typeof e.hasSuccess=="boolean",r=typeof e.hasError=="boolean",o=typeof e.httpStatusCode=="number",i=Array.isArray(e.errors);return n&&r&&o&&i?e:null}catch{return null}}HandleThen(e){const n=new Er,r=this.ParseAppResult(e.data);return r===null?(n.value=e.data,n):r.hasError?(r.errors.forEach(o=>n.WithError(o)),n.httpStatusCode=r.httpStatusCode,n):(n.value=e.data.value,n)}HandleCatch(e){var o;const n=new Er,r=this.ParseAppResult((o=e.response)==null?void 0:o.data);return r===null?n.WithError(e.message):(n.WithErrors(r.errors),n.httpStatusCode=r.httpStatusCode),n}async SilentLogin(){return new Promise(async e=>{if(!this.isTokenExpired){e(!0);return}const n=this.GenerateIframe(),r=o=>{if(document.body.removeChild(n),window.removeEventListener("message",r),o.origin!==location.origin){e(!1);return}const i=o.data.action,s=o.data.code,c=o.data.state,l=o.data.error;if(i!=="silent-login-iframe-result"||l==="login_required"||!s){e(!1);return}const d=new XMLHttpRequest;d.open("POST",this.tokenExchangeUrl,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.onreadystatechange=()=>{if(d.readyState===4){if(d.status===200){const f=JSON.parse(d.responseText);this.keycloak.setToken(f.access_token,null,f.id_token,new Date().getTime()),e(!0);return}e(!1)}},d.send(this.TokenExchangeParams(s,c))};window.addEventListener("message",r)}).then(e=>(e||(this.keycloak.clearToken(),this.keycloak.login()),e))}GetCodeVerifierFromState(e){const n=`kc-callback-${e}`,r=localStorage.getItem(n);if(r)return localStorage.removeItem(n),JSON.parse(r).pkceCodeVerifier}TokenExchangeParams(e,n){let r=`code=${e}&grant_type=authorization_code`;return r+=`&client_id=${encodeURIComponent(this.keycloak.clientId)}`,r+=`&redirect_uri=${this.silentLoginRedirectUrl}`,r+=`&code_verifier=${this.GetCodeVerifierFromState(n)}`,r}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 zp=(t,e)=>new is(t,e);ir.SetInitialTheme(),ee.AppResult=Er,ee.AxiosClient=is,ee.SfButton=zr,ee.SfContent=Cu,ee.SfDrawer=Kr,ee.SfIcon=Qe,ee.SfLayout=bu,ee.SfMessage=Ou,ee.SfNavMenuLink=Eu,ee.SfPanelMenu=yf,ee.SfTabNavigation=Pu,ee.SfTooltip=Ln,ee.UseAlertService=Qc,ee.UseAuthService=Rf,ee.UseAxiosClient=zp,ee.UseConfirmService=Yo,ee.UseNavMenuService=Tn,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})});
|
|
160
160
|
//# sourceMappingURL=sf.prefeiturasp.vuecomponents.umd.js.map
|