@cloudbase/js-sdk 2.0.0-alpha.7 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_oauth",[],t):"object"==typeof exports?exports.cloudbase_oauth=t():e.cloudbase_oauth=t()}("undefined"!=typeof window?window:this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=11)}([function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.jwt=t.helpers=t.utils=t.events=t.cache=t.adapters=t.constants=void 0;var a=i(r(5));t.constants=a;var c=i(r(14));t.adapters=c;var u=i(r(21));t.cache=u;var l=i(r(22));t.events=l;var f=i(r(3));t.utils=f;var h=i(r(23));t.helpers=h;var p={decode:s(r(25)).default};t.jwt=p},function(e,t,r){"use strict";(function(e){r.d(t,"k",(function(){return c})),r.d(t,"g",(function(){return u})),r.d(t,"j",(function(){return l})),r.d(t,"f",(function(){return f})),r.d(t,"a",(function(){return p})),r.d(t,"h",(function(){return v})),r.d(t,"i",(function(){return y})),r.d(t,"e",(function(){return g})),r.d(t,"d",(function(){return m})),r.d(t,"b",(function(){return h})),r.d(t,"c",(function(){return b}));var n=r(0),o=n.constants.setSdkName,i=n.constants.setProtocol,s="",a="@cloudbase/js-sdk";function c(e){s=e}function u(){return s}function l(e){a=e,o(e)}function f(){return a}var h,p="2020-01-10",d="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:",_="//tcb-api.tencentcloudapi.com/web";function v(e,t){_=e,t&&(d=t,i(t))}function y(e,t,r){v(t?"//"+e+"."+t+".tcb-api.tencentcloudapi.com/web":"//"+e+".ap-shanghai.tcb-api.tencentcloudapi.com/web",r)}function g(){return{BASE_URL:_,PROTOCOL:d}}function m(){var e=g(),t=e.PROTOCOL,r=e.BASE_URL;return""+new URL(""+t+r).origin}!function(e){e.NULL="NULL",e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.PHONE="PHONE"}(h||(h={}));var b="OAUTH2"}).call(this,r(8))},function(e,t,r){"use strict";var n;r.r(t),r.d(t,"StorageType",(function(){return n})),r.d(t,"AbstractSDKRequest",(function(){return o})),r.d(t,"AbstractStorage",(function(){return i})),r.d(t,"formatUrl",(function(){return s})),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";for(var i in r)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.transformPhone=t.sleep=t.printGroupLog=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.createSign=t.formatUrl=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var o=n(r(16)),i=n(r(19)),s=n(r(20)),a=r(5);function c(e){var t=i.default.stringify(e);return t=(t=(t=t.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.formatUrl=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";for(var i in r)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t},t.createSign=function(e,t){var r=c(s.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+c(s.default.parse(JSON.stringify(e)));return r+"."+c(o.default(r,t))},t.toQueryString=function(e){void 0===e&&(e={});var t=[];for(var r in e)t.push(r+"="+encodeURIComponent(e[r]));return t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||window.location.search,n=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]"+e+"=([^&#]*)"));return t?t[1]:""},t.removeParam=function(e,t){var r=t.split("?")[0],n=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===e&&n.splice(i,1);r=r+"?"+n.join("&")}return r},t.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var r=new Promise((function(t,r){e=function(e,n){return e?r(e):t(n)}}));return e.promise=r,e},t.execCallback=function(e,t,r){if(void 0===r&&(r=null),e&&"function"==typeof e)return e(t,r);if(t)throw t;return r},t.printWarn=function(e,t){console.warn("["+a.getSdkName()+"]["+e+"]:"+t)},t.printError=function(e,t){console.error({code:e,msg:"["+a.getSdkName()+"]["+e+"]:"+t})},t.printInfo=function(e,t){console.log("["+a.getSdkName()+"]["+e+"]:"+t)},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"["+a.getSdkName()+"]["+e+"]:"+t}))},t.printGroupLog=function(e){var t=e.title,r=e.subtitle,n=void 0===r?"":r,o=e.content,i=void 0===o?[]:o,s=e.printTrace,a=void 0!==s&&s,c=e.collapsed;void 0!==c&&c?console.groupCollapsed(t,n):console.group(t,n);for(var u=0,l=i;u<l.length;u++){var f=l[u],h=f.type,p=f.body;switch(h){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}a&&console.trace("stack trace:"),console.groupEnd()},t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},t.transformPhone=function(e){return"+86"+e}},function(e,t,r){var n;e.exports=(n=n||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},o=n.lib={},i=o.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=o.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=s<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)t[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],o=function(t){t=t;var r=987654321,n=4294967295;return function(){var o=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},i=0;i<t;i+=4){var a=o(4294967296*(r||e.random()));r=987654071*a(),n.push(4294967296*a()|0)}return new s.init(n,t)}}),a=n.enc={},c=a.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new s.init(r,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new s.init(r,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,o=r.sigBytes,i=this.blockSize,a=o/(4*i),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*i,u=e.min(4*c,o);if(c){for(var l=0;l<c;l+=i)this._doProcessBlock(n,l);var f=n.splice(0,c);r.sigBytes-=u}return new s.init(f,u)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),h=(o.Hasher=f.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math),n)},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(r(7),t),o(r(13),t),t.OATUH_LOGINTYPE="constants"},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.OAuth2Client=t.LocalCredentials=t.defaultStorage=t.generateRequestId=t.toResponseError=t.defaultRequest=void 0;var s=r(9),a=r(26),c=r(27);function u(){return a.uuidv4()}t.defaultRequest=function(e,t){return o(void 0,void 0,void 0,(function(){var r,n,o,a,c;return i(this,(function(i){switch(i.label){case 0:r=null,n=null,i.label=1;case 1:return i.trys.push([1,4,,5]),(o=Object.assign({},t)).method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body)),[4,fetch(e,o)];case 2:return[4,i.sent().json()];case 3:return(null==(a=i.sent())?void 0:a.error)?(n=a).error_uri=new URL(e).pathname:r=a,[3,5];case 4:return c=i.sent(),n={error:s.ErrorType.UNREACHABLE,error_description:c.message,error_uri:new URL(e).pathname},[3,5];case 5:if(n)throw n;return[2,r]}}))}))},t.toResponseError=function(e,t){var r,n=t||{};if(e instanceof Error)r={error:n.error||s.ErrorType.LOCAL,error_description:n.error_description||e.message,error_uri:n.error_uri,details:n.details||e.stack};else{var o=e||{};r={error:n.error||o.error||s.ErrorType.LOCAL,error_description:n.error_description||o.error_description,error_uri:n.error_uri||o.error_uri,details:n.details||o.details}}return r},t.generateRequestId=u;var l=function(){function e(){}return e.prototype.getItem=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,window.localStorage.getItem(e)]}))}))},e.prototype.removeItem=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return window.localStorage.removeItem(e),[2]}))}))},e.prototype.setItem=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return window.localStorage.setItem(e,t),[2]}))}))},e.prototype.getItemSync=function(e){return window.localStorage.getItem(e)},e.prototype.removeItemSync=function(e){window.localStorage.removeItem(e)},e.prototype.setItemSync=function(e,t){window.localStorage.setItem(e,t)},e}();function f(e){var t=!0;return(null==e?void 0:e.expires_at)&&(null==e?void 0:e.access_token)&&(t=e.expires_at<new Date),t}t.defaultStorage=new l;var h=function(){function e(e){this._credentials=null,this._singlePromise=new c.SinglePromise,this._tokenSectionName=e.tokenSectionName,this._storage=e.storage}return e.prototype.setCredentials=function(e){return o(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return(null==e?void 0:e.expires_in)?(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30)),this._storage?(t=JSON.stringify(e),[4,this._storage.setItem(this._tokenSectionName,t)]):[3,2]):[3,3];case 1:r.sent(),r.label=2;case 2:return this._credentials=e,[3,6];case 3:return this._storage?[4,this._storage.removeItem(this._tokenSectionName)]:[3,5];case 4:r.sent(),r.label=5;case 5:this._credentials=null,r.label=6;case 6:return[2]}}))}))},e.prototype.getCredentials=function(){return o(this,void 0,void 0,(function(){var e=this;return i(this,(function(t){return[2,this._singlePromise.run("getCredentials",(function(){return o(e,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return f(this._credentials)?(e=this,[4,this._getStorageCredentials()]):[3,2];case 1:e._credentials=t.sent(),t.label=2;case 2:return[2,this._credentials]}}))}))}))]}))}))},e.prototype._getStorageCredentials=function(){return o(this,void 0,void 0,(function(){var e=this;return i(this,(function(t){return[2,this._singlePromise.run("_getStorageCredentials",(function(){return o(e,void 0,void 0,(function(){var e,t;return i(this,(function(r){switch(r.label){case 0:return e=null,[4,this._storage.getItem(this._tokenSectionName)];case 1:if(null==(t=r.sent()))return[3,5];r.label=2;case 2:return r.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),[3,5];case 3:return r.sent(),[4,this._storage.removeItem(this._tokenSectionName)];case 4:return r.sent(),e=null,[3,5];case 5:return[2,e]}}))}))}))]}))}))},e.prototype._getStorageCredentialsSync=function(){var e=null,t=this._storage.getItemSync(this._tokenSectionName);if(null!=t)try{(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at))}catch(t){this._storage.removeItem(this._tokenSectionName),e=null}return e},e}();t.LocalCredentials=h;var p=function(){function e(r){this._singlePromise=new c.SinglePromise,this._apiOrigin=r.apiOrigin,this._clientId=r.clientId,this._retry=this._formatRetry(r.retry,e._defaultRetry),null!=r.baseRequest?this._baseRequest=r.baseRequest:this._baseRequest=t.defaultRequest,this._tokenInURL=r.tokenInURL,this._headers=r.headers,this._storage=r.storage||t.defaultStorage,this._localCredentials=new h({tokenSectionName:"credentials_"+r.clientId,storage:this._storage}),this._clientSecret=r.clientSecret,this._refreshTokenFunc=r.refreshTokenFunc||this._defaultRefreshTokenFunc}return e.prototype.setCredentials=function(e){return this._localCredentials.setCredentials(e)},e.prototype.getAccessToken=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,this._getCredentials()];case 1:return(null==(e=t.sent())?void 0:e.access_token)?[2,Promise.resolve(e.access_token)]:[2,Promise.reject({error:s.ErrorType.UNAUTHENTICATED})]}}))}))},e.prototype.request=function(t,r){return o(this,void 0,void 0,(function(){var o,s,a,c,l,f,h;return i(this,(function(i){switch(i.label){case 0:return r||(r={}),o=this._formatRetry(r.retry,this._retry),r.headers=r.headers||{},this._headers&&(r.headers=n(n({},this._headers),r.headers)),r.headers["x-request-id"]||(r.headers["x-request-id"]=u()),r.headers["x-device-id"]?[3,2]:[4,this._getDeviceId()];case 1:s=i.sent(),r.headers["x-device-id"]=s,i.label=2;case 2:return(null==r?void 0:r.withCredentials)?[4,this._getCredentials()]:[3,4];case 3:return(a=i.sent())&&(this._tokenInURL?(t.indexOf("?")<0&&(t+="?"),t+="access_token="+a.access_token):r.headers.Authorization=a.token_type+" "+a.access_token),[3,5];case 4:this._clientId&&t.indexOf("client_id")<0&&(t+=t.indexOf("?")<0?"?":"&",t+="client_id="+this._clientId),i.label=5;case 5:t.startsWith("/")&&(t=this._apiOrigin+t),c=null,l=o+1,f=0,i.label=6;case 6:if(!(f<l))return[3,13];i.label=7;case 7:return i.trys.push([7,9,,10]),[4,this._baseRequest(t,r)];case 8:return c=i.sent(),[3,13];case 9:return h=i.sent(),f!==o&&h&&"unreachable"===h.error?[3,10]:[2,Promise.reject(h)];case 10:return[4,this._sleep(e._retryInterval)];case 11:i.sent(),i.label=12;case 12:return f++,[3,6];case 13:return[2,c]}}))}))},e.prototype._checkRetry=function(t){var r=null;if(("number"!=typeof t||t<e._minRetry||t>e._maxRetry)&&(r={error:s.ErrorType.UNREACHABLE,error_description:"wrong options param: retry"}),r)throw r;return t},e.prototype._formatRetry=function(e,t){return void 0===e?t:this._checkRetry(e)},e.prototype._sleep=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,new Promise((function(t){setTimeout((function(){t()}),e)}))]}))}))},e.prototype._refreshToken=function(e){return o(this,void 0,void 0,(function(){var t=this;return i(this,(function(r){return[2,this._singlePromise.run("_refreshToken",(function(){return o(t,void 0,void 0,(function(){var t,r;return i(this,(function(n){switch(n.label){case 0:if(!e||!e.refresh_token)return[2,this._unAuthenticatedError("no refresh token found in credentials")];n.label=1;case 1:return n.trys.push([1,4,,7]),[4,this._refreshTokenFunc(e.refresh_token)];case 2:return t=n.sent(),[4,this._localCredentials.setCredentials(t)];case 3:return n.sent(),[2,t];case 4:return(r=n.sent()).error!==s.ErrorType.INVALID_GRANT?[3,6]:[4,this._localCredentials.setCredentials(null)];case 5:return n.sent(),[2,this._unAuthenticatedError(r.error_description)];case 6:return[2,Promise.reject(r)];case 7:return[2]}}))}))}))]}))}))},e.prototype._anonymousSignIn=function(e){return o(this,void 0,void 0,(function(){var t=this;return i(this,(function(r){return[2,this._singlePromise.run("_anonymous",(function(){return o(t,void 0,void 0,(function(){var t,r;return i(this,(function(n){switch(n.label){case 0:if(!e||"anonymous"!==e.scope)return[2,this._unAuthenticatedError("no anonymous in credentials")];n.label=1;case 1:return n.trys.push([1,4,,7]),[4,this.request("/auth/v1/signin/anonymously",{method:"POST",body:{client_id:this._clientId,client_secret:this._clientSecret}})];case 2:return t=n.sent(),[4,this._localCredentials.setCredentials(t)];case 3:return n.sent(),[2,t];case 4:return(r=n.sent()).error!==s.ErrorType.INVALID_GRANT?[3,6]:[4,this._localCredentials.setCredentials(null)];case 5:return n.sent(),[2,this._unAuthenticatedError(r.error_description)];case 6:return[2,Promise.reject(r)];case 7:return[2]}}))}))}))]}))}))},e.prototype._defaultRefreshTokenFunc=function(e){return void 0===e||""===e?this._unAuthenticatedError("refresh token not found"):this.request("/auth/v1/token",{method:"POST",body:{client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:e}})},e.prototype._getCredentials=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,this._localCredentials.getCredentials()];case 1:return f(e=t.sent())?e&&"anonymous"===e.scope?[4,this._anonymousSignIn(e)]:[3,3]:[3,5];case 2:return e=t.sent(),[3,5];case 3:return[4,this._refreshToken(e)];case 4:e=t.sent(),t.label=5;case 5:return[2,e]}}))}))},e.prototype.getCredentialsSync=function(){return this._localCredentials._getStorageCredentialsSync()},e.prototype.getCredentialsAsync=function(){return this._localCredentials.getCredentials()},e.prototype._getDeviceId=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return this._deviceID?[2,this._deviceID]:[4,this._storage.getItem("device_id")];case 1:return"string"==typeof(e=t.sent())&&e.length>=16&&e.length<=48?[3,3]:(e=a.uuidv4(),[4,this._storage.setItem("device_id",e)]);case 2:t.sent(),t.label=3;case 3:return this._deviceID=e,[2,e]}}))}))},e.prototype._unAuthenticatedError=function(e){return Promise.reject({error:s.ErrorType.UNAUTHENTICATED,error_description:e})},e._defaultRetry=2,e._minRetry=0,e._maxRetry=5,e._retryInterval=1e3,e}();t.OAuth2Client=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var n="@cloudbase/js-sdk";t.setSdkName=function(e){n=e},t.getSdkName=function(){return n};var o="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";t.setProtocol=function(e){o=e},t.getProtocol=function(){return o},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var c,u=[],l=!1,f=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&p())}function p(){if(!l){var e=a(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function _(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new d(e,t)),1!==u.length||l||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=_,o.addListener=_,o.once=_,o.off=_,o.removeListener=_,o.removeAllListeners=_,o.emit=_,o.prependListener=_,o.prependOnceListener=_,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorType=t.Syntax=void 0,function(e){e.CLIENT_ID="client_id",e.CLIENT_SECRET="client_secret",e.RESPONSE_TYPE="response_type",e.SCOPE="scope",e.STATE="state",e.REDIRECT_URI="redirect_uri",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ERROR_URI="error_uri",e.GRANT_TYPE="grant_type",e.CODE="code",e.ACCESS_TOKEN="access_token",e.TOKEN_TYPE="token_type",e.EXPIRES_IN="expires_in",e.USERNAME="username",e.PASSWORD="password",e.REFRESH_TOKEN="refresh_token"}(t.Syntax||(t.Syntax={})),function(e){e.UNREACHABLE="unreachable",e.LOCAL="local",e.CANCELLED="cancelled",e.UNKNOWN="unknown",e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.UNAUTHENTICATED="unauthenticated",e.RESOURCE_EXHAUSTED="resource_exhausted",e.FAILED_PRECONDITION="failed_precondition",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid",e.INVALID_PASSWORD="invalid_password",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked",e.INVALID_VERIFICATION_CODE="invalid_verification_code",e.TWO_FACTOR_REQUIRED="two_factor_required",e.INVALID_TWO_FACTOR="invalid_two_factor",e.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",e.UNDER_REVIEW="under_review",e.INVALID_REQUEST="invalid_request",e.UNAUTHORIZED_CLIENT="unauthorized_client",e.ACCESS_DENIED="access_denied",e.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",e.INVALID_SCOPE="invalid_scope",e.INVALID_GRANT="invalid_grant",e.SERVER_ERROR="server_error",e.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",e.INTERACTION_REQUIRED="interaction_required",e.LOGIN_REQUIRED="login_required",e.ACCOUNT_SELECTION_REQUIRED="account_selection_required",e.CONSENT_REQUIRED="consent_required",e.INVALID_REQUEST_URI="invalid_request_uri",e.INVALID_REQUEST_OBJECT="invalid_request_object",e.REQUEST_NOT_SUPPORTED="request_not_supported",e.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",e.REGISTRATION_NOT_SUPPORTED="registration_not_supported"}(t.ErrorType||(t.ErrorType={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Auth=void 0;var i=r(29),s=r(6),a=r(30),c=function(){function e(e){var t=e.request,r=e.credentialsClient;if(!r){var n={apiOrigin:e.apiOrigin,clientId:e.clientId,storage:e.storage};r=new s.OAuth2Client(n)}if(!t){var o=r.request.bind(r),i=new a.Captcha({clientId:e.clientId,request:o,storage:e.storage});t=i.request.bind(i)}this._config={apiOrigin:e.apiOrigin,clientId:e.clientId,request:t,credentialsClient:r,storage:e.storage||s.defaultStorage}}return e.prototype.signIn=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return e.client_id=this._config.clientId,[4,this._config.request(i.ApiUrls.AUTH_SIGN_IN_URL,{method:"POST",body:e})];case 1:return t=r.sent(),[4,this._config.credentialsClient.setCredentials(t)];case 2:return r.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signInAnonymously=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,this._config.request(i.ApiUrls.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:{client_id:this._config.clientId}})];case 1:return e=t.sent(),[4,this._config.credentialsClient.setCredentials(e)];case 2:return t.sent(),[2,Promise.resolve(e)]}}))}))},e.prototype.signUp=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return e.client_id=this._config.clientId,[4,this._config.request(i.ApiUrls.AUTH_SIGN_UP_URL,{method:"POST",body:e})];case 1:return t=r.sent(),[4,this._config.credentialsClient.setCredentials(t)];case 2:return r.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signOut=function(){return n(this,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:return[4,this._config.credentialsClient.getAccessToken()];case 1:return e=r.sent(),[4,this._config.request(i.ApiUrls.AUTH_REVOKE_URL,{method:"POST",body:{client_id:this._config.clientId,token:e}})];case 2:return t=r.sent(),[4,this._config.credentialsClient.setCredentials()];case 3:return r.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.getVerification=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,[2,this._config.request(i.ApiUrls.VERIFICATION_URL,{method:"POST",body:e,withCaptcha:!0})]}))}))},e.prototype.verify=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,[2,this._config.request(i.ApiUrls.VERIFY_URL,{method:"POST",body:e})]}))}))},e.prototype.genProviderRedirectUri=function(e){return n(this,void 0,void 0,(function(){var t,r;return o(this,(function(n){return t=i.ApiUrls.PROVIDER_URI_URL+"?client_id="+this._config.clientId+"&provider_id="+e.provider_id+"&redirect_uri="+encodeURIComponent(e.provider_redirect_uri)+"&state="+e.state,(r=e.other_params)&&"string"==typeof r.sign_out_uri&&r.sign_out_uri.length>0&&(t+="&other_params[sign_out_uri]="+r.sign_out_uri),[2,this._config.request(t,{method:"GET"})]}))}))},e.prototype.grantProviderToken=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,[2,this._config.request(i.ApiUrls.PROVIDER_TOKEN_URL,{method:"POST",body:e})]}))}))},e.prototype.patchProviderToken=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,[2,this._config.request(i.ApiUrls.PROVIDER_TOKEN_URL,{method:"PATCH",body:e})]}))}))},e.prototype.signInWithProvider=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return e.client_id=this._config.clientId,[4,this._config.request(i.ApiUrls.AUTH_SIGN_IN_WITH_PROVIDER_URL,{method:"POST",body:e})];case 1:return t=r.sent(),[4,this._config.credentialsClient.setCredentials(t)];case 2:return r.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.bindWithProvider=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,[2,this._config.request(i.ApiUrls.PROVIDER_BIND_URL,{method:"POST",body:e,withCredentials:!0})]}))}))},e.prototype.getUserProfile=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.getUserInfo()]}))}))},e.prototype.getUserInfo=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,this._config.request(i.ApiUrls.USER_ME_URL,{method:"GET",withCredentials:!0})];case 1:return(e=t.sent()).picture&&(e.avatarUrl=e.picture),e.sub&&(e.uid=e.sub),e.name&&(e.username=e.name),[2,e]}}))}))},e.prototype.hasLoginState=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this._config.credentialsClient.getAccessToken()];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},e.prototype.hasLoginStateSync=function(){return this._config.credentialsClient.getCredentialsSync()},e.prototype.getLoginState=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this._config.credentialsClient.getCredentialsAsync()]}))}))},e.prototype.transByProvider=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this._config.request(i.ApiUrls.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:e,withCredentials:!0})]}))}))},e.prototype.grantToken=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,[2,this._config.request(i.ApiUrls.AUTH_TOKEN_URL,{method:"POST",body:e})]}))}))},e.prototype.getProviders=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this._config.request(i.ApiUrls.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},e.prototype.unbindProvider=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,[2,this._config.request(i.ApiUrls.PROVIDER_UNBIND_URL+"/"+e.provider_id,{method:"DELETE",withCredentials:!0})]}))}))},e.prototype.checkPassword=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this._config.request(""+i.ApiUrls.CHECK_PWD_URL,{method:"POST",withCredentials:!0,body:e})]}))}))},e.prototype.bindPhone=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this._config.request(""+i.ApiUrls.BIND_PHONE_URL,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.setPassword=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this._config.request(""+i.ApiUrls.AUTH_SET_PASSWORD,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.getCurUserVerification=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,e.target="CUR_USER",[2,this._config.request(i.ApiUrls.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})]}))}))},e.prototype.changeBindedProvider=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return e.client_id=this._config.clientId,[2,this._config.request(i.ApiUrls.PROVIDER_LIST+"/"+e.provider_id+"/trans",{method:"POST",body:{provider_trans_token:e.trans_token},withCredentials:!0})]}))}))},e.prototype.setUserProfile=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this._config.request(i.ApiUrls.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})]}))}))},e.prototype.queryUserProfile=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){return t=""+i.ApiUrls.USER_QUERY_URL+e,[2,this._config.request(t,{method:"GET",withCredentials:!0})]}))}))},e}();t.Auth=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerOAuth=void 0;var n=r(12);t.registerOAuth=n.registerOAuth},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t},c=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},u=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},l=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.registerOAuth=t.authModels=void 0;var f=r(32),h=r(0).helpers.stopOAuthLoginWithAuth,p=r(9);Object.defineProperty(t,"Syntax",{enumerable:!0,get:function(){return p.Syntax}}),Object.defineProperty(t,"ErrorType",{enumerable:!0,get:function(){return p.ErrorType}});var d=r(6),_=r(6);Object.defineProperty(t,"defaultStorage",{enumerable:!0,get:function(){return _.defaultStorage}}),Object.defineProperty(t,"defaultRequest",{enumerable:!0,get:function(){return _.defaultRequest}}),Object.defineProperty(t,"toResponseError",{enumerable:!0,get:function(){return _.toResponseError}}),Object.defineProperty(t,"generateRequestId",{enumerable:!0,get:function(){return _.generateRequestId}}),Object.defineProperty(t,"OAuth2Client",{enumerable:!0,get:function(){return _.OAuth2Client}});var v=r(28);Object.defineProperty(t,"AuthClient",{enumerable:!0,get:function(){return v.AuthClient}});var y=r(10),g=r(10);Object.defineProperty(t,"Auth",{enumerable:!0,get:function(){return g.Auth}});var m=a(r(31));t.authModels=m;var b=function(){function e(e){var t=e.apiOrigin,r=e.clientId,o=e._fromApp;this._fromApp=o,this.oauth2client=new d.OAuth2Client({apiOrigin:t,clientId:r}),this.authApi=new y.Auth(n({credentialsClient:this.oauth2client},e))}return e.prototype.checkFromAuthV1OrV2=function(){return u(this,void 0,void 0,(function(){var e,t,r,n,o;return l(this,(function(i){switch(i.label){case 0:return e=this._fromApp,t=e.authInstance,r=e.oauthInstance||e.oauth(),(n=t)?[4,t.getLoginState()]:[3,2];case 1:n=i.sent(),i.label=2;case 2:return n?[2,"auth"]:(o=r)?[4,r.hasLoginState()]:[3,4];case 3:o=i.sent(),i.label=4;case 4:return o?[2,"oauth"]:[2,""]}}))}))},e.prototype.signIn=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this.authApi.signIn(e)]}))}))},e.prototype.signOut=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this.authApi.signOut()]}))}))},e.prototype.hasLoginState=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this.authApi.hasLoginState()]}))}))},e.prototype.getUserInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this.authApi.getUserInfo()]}))}))},e.prototype.getLoginState=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this.authApi.getLoginState()]}))}))},e.prototype.hasLoginStateSync=function(){return this.authApi.hasLoginStateSync()},e.prototype.signInAnonymously=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this.authApi.signInAnonymously()]}))}))},s([h(),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",Promise)],e.prototype,"signIn",null),s([h(),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",Promise)],e.prototype,"signInAnonymously",null),e}(),w={name:"oauth",namespace:"oauth",entity:function(){if(this.oauthInstance)return this.oauthInstance;var e=this.config.env;return this.oauthInstance=new b({clientId:e,apiOrigin:f.getBaseEndPoint(),_fromApp:this}),this.oauthInstance}};try{cloudbase.registerComponent(w)}catch(e){}t.registerOAuth=function(e){try{e.registerComponent(w)}catch(e){console.warn(e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,a=i(r(15)),c=r(3);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e){for(var t=0,r=c.isArray(e)?e:[e];t<r.length;t++){var n=r[t],o=n.isMatch,i=n.genAdapter,s=n.runtime;if(o())return{adapter:i(),runtime:s}}},t.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var c=r(2),u=r(3),l=r(7),f=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return o(t,e),t.prototype.get=function(e){return this._request(i(i({},e),{method:"get"}),this._restrictedMethods.includes("get"))},t.prototype.post=function(e){return this._request(i(i({},e),{method:"post"}),this._restrictedMethods.includes("post"))},t.prototype.put=function(e){return this._request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=new FormData;for(var s in t)o.append(s,t[s]);return o.append("key",n),o.append("file",r),this._request(i(i({},e),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},t.prototype.download=function(e){return s(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=s.sent().data,r=window.URL.createObjectURL(new Blob([t])),n=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return s.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype._request=function(e,t){var r=this;void 0===t&&(t=!1);var n=String(e.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=e.url,c=e.headers,f=void 0===c?{}:c,h=e.data,p=e.responseType,d=e.withCredentials,_=e.body,v=e.onUploadProgress,y=u.formatUrl(l.getProtocol(),a,"get"===n?h:{}),g=new XMLHttpRequest;for(var m in g.open(n,y),p&&(g.responseType=p),f)g.setRequestHeader(m,f[m]);v&&g.upload.addEventListener("progress",v),g.onreadystatechange=function(){var e={};if(4===g.readyState){var t=g.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};t.forEach((function(e){var t=e.split(": "),n=t.shift().toLowerCase(),o=t.join(": ");r[n]=o})),e.header=r,e.statusCode=g.status;try{e.data="blob"===p?g.response:JSON.parse(g.responseText)}catch(t){e.data="blob"===p?g.response:g.responseText}clearTimeout(i),o(e)}},t&&r._timeout&&(i=setTimeout((function(){console.warn(r._timeoutMsg),g.abort()}),r._timeout)),s=u.isFormData(h)?h:"application/x-www-form-urlencoded"===f["content-type"]?u.toQueryString(h):_||(h?JSON.stringify(h):void 0),d&&(g.withCredentials=!0),g.send(s)}))},t}(c.AbstractSDKRequest);t.WebRequest=f,t.genAdapter=function(){return{root:window,reqClass:f,wsClass:WebSocket,localStorage:localStorage,sessionStorage:sessionStorage}}},function(e,t,r){var n;e.exports=(n=r(4),r(17),r(18),n.HmacSHA256)},function(e,t,r){var n;e.exports=(n=r(4),function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,s=t.algo,a=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(a[o]=r(e.pow(n,.5))),c[o]=r(e.pow(n,1/3)),o++),n++}();var u=[],l=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],l=r[5],f=r[6],h=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var d=u[p-15],_=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,v=u[p-2],y=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[p]=_+u[p-7]+y+u[p-16]}var g=n&o^n&i^o&i,m=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+c[p]+u[p];h=f,f=l,l=a,a=s+b|0,s=i,i=o,o=n,n=b+(m+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)},function(e,t,r){var n,o,i,s;e.exports=(n=r(4),i=(o=n).lib.Base,s=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),a=o.words,c=i.words,u=0;u<r;u++)a[u]^=1549556828,c[u]^=909522486;o.sigBytes=i.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))},function(e,t,r){var n,o,i;e.exports=(i=r(4),o=(n=i).lib.WordArray,n.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],i=0;i<r;i+=3)for(var s=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<r;a++)o.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var s=r.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,r){for(var n=[],i=0,s=0;s<t;s++)if(s%4){var a=r[e.charCodeAt(s-1)]<<s%4*2,c=r[e.charCodeAt(s)]>>>6-s%4*2;n[i>>>2]|=(a|c)<<24-i%4*8,i++}return o.create(n,i)}(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(e,t,r){var n;e.exports=(n=r(4),n.enc.Utf8)},function(e,t,r){"use strict";(function(e){var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var a=r(2),c=r(3),u=r(5),l=function(e){function t(t){var r=e.call(this)||this;return r._root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return o(t,e),t.prototype.setItem=function(e,t){this._root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this._root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this._root.tcbCacheObject[e]},t.prototype.clear=function(){delete this._root.tcbCacheObject},t}(a.AbstractStorage);function f(e,t){switch(e){case"local":return t.localStorage?t.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root));case"none":return new l(t.root);case"session":return t.sessionStorage?t.sessionStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"sessionStorage is not supported on current platform"),new l(t.root));default:return t.localStorage?t.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root))}}var h=function(){function t(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o,s=e.alwaysLocalKeys,a=void 0===s?[]:s;this._platformInfo=n,this._alwaysLocalKeys=a,this._storage||(this._persistence=n.adapter.primaryStorage||t,this._storage=f(this._persistence,n.adapter),this.keys=i)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this._storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this._persistence},enumerable:!1,configurable:!0}),t.prototype.updatePersistence=function(e){if("async"!==this.mode){if(e!==this._persistence){var t="local"===this._persistence;this._persistence=e;var r=f(e,this._platformInfo.adapter);for(var n in this.keys){var o=this.keys[n];if(!t||!this._alwaysLocalKeys.includes(n)){var i=this._storage.getItem(o);c.isUndefined(i)||c.isNull(i)||(r.setItem(o,i),this._storage.removeItem(o))}}this._storage=r}}else c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use updatePersistenceAsync insteed")},t.prototype.updatePersistenceAsync=function(e){return i(this,void 0,void 0,(function(){var t,r,n,o,i,a,u,l;return s(this,(function(s){switch(s.label){case 0:if(e===this._persistence)return[2];for(o in t="local"===this._persistence,this._persistence=e,r=f(e,this._platformInfo.adapter),n=[],this.keys)n.push(o);i=0,s.label=1;case 1:return i<n.length?(a=n[i],u=this.keys[a],t&&this._alwaysLocalKeys.includes(a)?[3,4]:[4,this._storage.getItem(u)]):[3,5];case 2:return l=s.sent(),c.isUndefined(l)||c.isNull(l)?[3,4]:(r.setItem(u,l),[4,this._storage.removeItem(u)]);case 3:s.sent(),s.label=4;case 4:return i++,[3,1];case 5:return this._storage=r,[2]}}))}))},t.prototype.setStore=function(e,t,r){if("async"!==this.mode){if(this._storage)try{var n={version:r||"localCachev1",content:t};this._storage.setItem(e,JSON.stringify(n))}catch(e){throw new Error(JSON.stringify({code:u.ERRORS.OPERATION_FAIL,msg:"["+u.getSdkName()+"]["+u.ERRORS.OPERATION_FAIL+"]setStore failed",info:e}))}}else c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(e,t,r){return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:if(!this._storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:t},[4,this._storage.setItem(e,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,r){var n;if("async"!==this.mode){try{if(void 0!==e&&(null===(n=e.env)||void 0===n?void 0:n.tcb_token))return e.env.tcb_token;if(!this._storage)return""}catch(e){return""}r=r||"localCachev1";var o=this._storage.getItem(t);return o&&o.indexOf(r)>=0?JSON.parse(o).content:""}c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,r){var n;return i(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:try{if(void 0!==e&&(null===(n=e.env)||void 0===n?void 0:n.tcb_token))return[2,e.env.tcb_token];if(!this._storage)return[2,""]}catch(e){return[2,""]}return r=r||"localCachev1",[4,this._storage.getItem(t)];case 1:return(o=i.sent())&&o.indexOf(r)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},t.prototype.removeStore=function(e){"async"!==this.mode?this._storage.removeItem(e):c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},t}();t.CloudbaseCache=h}).call(this,r(8))},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var s=r(3);var a=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=a;var c=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return o(t,e),t}(a);t.IErrorEvent=c;var u=function(){function e(){this._listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this._listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this._listeners),this},e.prototype.fire=function(e,t){if(s.isInstanceOf(e,c))return console.error(e.error),this;var r=s.isString(e)?new a(e,t||{}):e,n=r.name;if(this._listens(n)){r.target=this;for(var o=0,u=this._listeners[n]?i(this._listeners[n]):[];o<u.length;o++){u[o].call(this,r)}}return this},e.prototype._listens=function(e){return this._listeners[e]&&this._listeners[e].length>0},e}();t.CloudbaseEventEmitter=u;var l=new u;t.addEventListener=function(e,t){l.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),l.fire(e,t)},t.removeEventListener=function(e,t){l.off(e,t)}},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(24),t)},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.stopAuthLoginWithOAuth=t.stopOAuthLoginWithAuth=t.catchErrorsDecorator=void 0;var i=r(3),s=r(5),a=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(a=-1!==navigator.userAgent.indexOf("Firefox"));var c=a?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?\:\/\/.+\:\d*\/.*\.js\:\d+\:\d+/;function l(e){var t=e.err,r=e.className,n=e.methodName,o=e.sourceLink;if(!o)return null;var i,s=t.stack.split("\n"),c=a?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp(r+"\\.descriptor.value\\s*\\[as\\s"+n+"\\]\\s*\\(.*\\)$"),l=a?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp(r+"\\.descriptor.value\\s*\\[as\\s"+n+"\\]"),f=s.findIndex((function(e){return c.test(e)}));if(-1!==f){var h=s.filter((function(e,t){return t>f}));h.unshift(s[f].replace(l,r+"."+n).replace(u,o)),(i=new Error).stack=(a?"@debugger":"Error")+"\n"+h.join("\n")}return i}t.catchErrorsDecorator=function(e){var t=e.mode,r=void 0===t?"async":t,a=e.customInfo,f=void 0===a?{}:a,h=e.title,p=e.messages,d=void 0===p?[]:p;return function(e,t,a){if(s.IS_DEBUG_MODE){var p=f.className||e.constructor.name,_=f.methodName||t,v=a.value,y=function(e){var t="",r=e.stack.split("\n"),n=r.findIndex((function(e){return c.test(e)}));if(-1!==n){var o=u.exec(r[n+1]||"");t=o?o[0]:""}return t}(new Error);a.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l({err:new Error,className:p,methodName:_,sourceLink:y});try{return v.apply(this,e)}catch(e){var n=e,o=e.message,s={title:h||p+"."+_+" failed",content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var a=JSON.parse(o);s.subtitle=o,a.code&&(r?(r.code=a.code,r.msg=a.msg):(e.code=a.code,e.message=a.msg),n=r||e,s.content=d.map((function(e){return{type:"info",body:e}})))}throw i.printGroupLog(s),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,r,n,s,a,c;return o(this,(function(o){switch(o.label){case 0:t=l({err:new Error,className:p,methodName:_,sourceLink:y}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,v.apply(this,e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,s=r.message,a={title:h||p+"."+_+" failed",content:[{type:"error",body:r}]},s&&/^\{.*\}$/.test(s)&&(c=JSON.parse(s),a.subtitle=c,c.code&&(t?(t.code=c.code,t.message=c.msg):(r.code=c.code,r.message=c.msg),n=t||r,a.content=d.map((function(e){return{type:"info",body:e}})))),i.printGroupLog(a),n;case 4:return[2]}}))}))}}}},t.stopOAuthLoginWithAuth=function(){return function(e,t,r){var i=r.value;r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,r,n;return o(this,(function(o){switch(o.label){case 0:return t=this._fromApp,r=t.authInstance,(n=r)?[4,r.getLoginState()]:[3,2];case 1:n=o.sent(),o.label=2;case 2:if(n)throw Error("当前已使用 auth 登录,请手动退出 auth 登录后再进行 oauth 登录");return[2,i.apply(this,e)]}}))}))}}},t.stopAuthLoginWithOAuth=function(){return function(e,t,r){var i=r.value;r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,r,n;return o(this,(function(o){switch(o.label){case 0:return t=this._fromApp,r=t.oauthInstance||t.oauth(),(n=r)?[4,r.hasLoginState()]:[3,2];case 1:n=o.sent(),o.label=2;case 2:if(n)throw Error("当前已使用 oauth 登录,请手动退出 oauth 登录后再进行 auth 登录");return[2,i.apply(this,e)]}}))}))}}}},function(e,t,r){"use strict";function n(e){this.message=e}r.r(t),r.d(t,"InvalidTokenError",(function(){return s})),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var o="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,i=0,s=0,a="";o=t.charAt(s++);~o&&(r=i%4?64*r+o:o,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return a};function i(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(o(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return o(t)}}function s(e){this.message=e}s.prototype=new Error,s.prototype.name="InvalidTokenError",t.default=function(e,t){if("string"!=typeof e)throw new s("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(i(e.split(".")[r]))}catch(e){throw new s("Invalid token specified: "+e.message)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uuidv4=void 0,t.uuidv4=function(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.SinglePromise=void 0;var i=function(){function e(){this._fnPromiseMap=new Map}return e.prototype.run=function(e,t){return n(this,void 0,void 0,(function(){var r,i=this;return o(this,(function(s){return(r=this._fnPromiseMap.get(e))||(r=new Promise((function(r,s){return n(i,void 0,void 0,(function(){var n,i,a;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,4,5]),[4,this._runIdlePromise()];case 1:return o.sent(),n=t(),i=r,[4,n];case 2:return i.apply(void 0,[o.sent()]),[3,5];case 3:return a=o.sent(),s(a),[3,5];case 4:return this._fnPromiseMap.delete(e),[7];case 5:return[2]}}))}))})),this._fnPromiseMap.set(e,r)),[2,r]}))}))},e.prototype._runIdlePromise=function(){return Promise.resolve()},e}();t.SinglePromise=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthClient=void 0;var n=function(){};t.AuthClient=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VerificationUsages=t.ApiUrls=void 0,function(e){e.AUTH_SIGN_IN_URL="/auth/v1/signin",e.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",e.AUTH_SIGN_UP_URL="/auth/v1/signup",e.AUTH_TOKEN_URL="/auth/v1/token",e.AUTH_REVOKE_URL="/auth/v1/revoke",e.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",e.PROVIDER_TOKEN_URL="/auth/v1/provider/token",e.PROVIDER_URI_URL="/auth/v1/provider/uri",e.USER_ME_URL="/auth/v1/user/me",e.USER_QUERY_URL="/auth/v1/user/query",e.USER_PRIFILE_URL="/auth/v1/user/profile",e.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",e.VERIFICATION_URL="/auth/v1/verification",e.VERIFY_URL="/auth/v1/verification/verify",e.PROVIDER_LIST="/auth/v1/user/provider",e.PROVIDER_UNBIND_URL="/auth/v1/user/provider",e.CHECK_PWD_URL="/auth/v1/user/sudo",e.BIND_PHONE_URL="/auth/v1/user/contact",e.AUTH_SET_PASSWORD="/auth/v1/user/password"}(t.ApiUrls||(t.ApiUrls={})),function(e){e.REGISTER="REGISTER",e.SIGN_IN="SIGN_IN",e.PASSWORD_RESET="PASSWORD_RESET",e.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",e.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(t.VerificationUsages||(t.VerificationUsages={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Captcha=void 0;var i=r(6),s=function(){function e(e){e.openURIWithCallback||(e.openURIWithCallback=this._getDefaultOpenURIWithCallback()),e.storage||(e.storage=i.defaultStorage),this._config=e,this._tokenSectionName="captcha_"+e.clientId}return e.prototype.request=function(e,t){return n(this,void 0,void 0,(function(){var r,n,i;return o(this,(function(o){switch(o.label){case 0:return t||(t={}),t.method||(t.method="GET"),r=t.method+":"+e,n=e,t.withCaptcha?[4,this._appendCaptchaTokenToURL(e,r,!1)]:[3,2];case 1:n=o.sent(),o.label=2;case 2:return o.trys.push([2,3,,7]),[2,this._config.request(n,t)];case 3:return"captcha_required"!==(i=o.sent()).error&&"captcha_invalid"!==i.error?[3,5]:[4,this._appendCaptchaTokenToURL(e,r,"captcha_invalid"===i.error)];case 4:return e=o.sent(),[2,this._config.request(e,t)];case 5:return[2,Promise.reject(i)];case 6:return[3,7];case 7:return[2]}}))}))},e.prototype._getDefaultOpenURIWithCallback=function(){if(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap")){var e=document.createElement("div");e.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",e.setAttribute("id","captcha_panel_wrap"),document.body.appendChild(e)}return this._defaultOpenURIWithCallback},e.prototype._defaultOpenURIWithCallback=function(e){return n(this,void 0,void 0,(function(){var t,r;return o(this,(function(n){return t=document.getElementById("captcha_panel_wrap"),r=document.createElement("iframe"),t.innerHTML="",r.setAttribute("src",e),r.setAttribute("id","review-panel-iframe"),r.style.cssText="min-width:355px;display:block;height:355px;margin:0 auto;background-color: rgb(255, 255, 255);border: none;",t.appendChild(r),t.style.display="block",[2,new Promise((function(e,n){r.onload=function(){try{var o=window.location,i=r.contentWindow.location;if(i.host+i.pathname===o.host+o.pathname){t.style.display="none";var s=new URLSearchParams(i.search),a=s.get("captcha_token");return a?e({captcha_token:a,expires_in:Number(s.get("expires_in"))}):n({error:s.get("error"),error_description:s.get("error_description")})}t.style.display="block"}catch(e){t.style.display="block"}}}))]}))}))},e.prototype._getCaptchaToken=function(e,t){return n(this,void 0,void 0,(function(){var r,n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return e?[3,2]:[4,this._findCaptchaToken()];case 1:if(r=o.sent())return[2,r];o.label=2;case 2:return n=window.location.origin+window.location.pathname+"?__captcha=on",[4,this._config.request("/auth/v1/captcha/init",{method:"POST",body:{client_id:this._config.clientId,redirect_uri:n,state:t},withCredentials:!1})];case 3:return(i=o.sent()).captcha_token?(s={captcha_token:i.captcha_token,expires_in:i.expires_in},this._saveCaptchaToken(s),[2,i.captcha_token]):[4,this._config.openURIWithCallback(i.url)];case 4:return a=o.sent(),this._saveCaptchaToken(a),[2,a.captcha_token]}}))}))},e.prototype._appendCaptchaTokenToURL=function(e,t,r){return n(this,void 0,void 0,(function(){var n;return o(this,(function(o){switch(o.label){case 0:return[4,this._getCaptchaToken(r,t)];case 1:return n=o.sent(),e.indexOf("?")>0?e+="&captcha_token="+n:e+="?captcha_token="+n,[2,e]}}))}))},e.prototype._saveCaptchaToken=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10)),t=JSON.stringify(e),[4,this._config.storage.setItem(this._tokenSectionName,t)];case 1:return r.sent(),[2]}}))}))},e.prototype._findCaptchaToken=function(){return n(this,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:return[4,this._config.storage.getItem(this._tokenSectionName)];case 1:if(null==(e=r.sent()))return[3,5];r.label=2;case 2:return r.trys.push([2,3,,5]),(t=JSON.parse(e))&&t.expires_at&&(t.expires_at=new Date(t.expires_at)),t.expires_at<new Date?[2,null]:[2,t.captcha_token];case 3:return r.sent(),[4,this._config.storage.removeItem(this._tokenSectionName)];case 4:return r.sent(),[2,null];case 5:return[2,null]}}))}))},e}();t.Captcha=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,r){"use strict";r.r(t),r.d(t,"getBaseEndPoint",(function(){return R.d})),r.d(t,"cloudbase",(function(){return Oe}));var n,o=r(0),i=r(2),s=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=function(){return(a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},c=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},u=function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};var l=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return s(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(r,n){var o=e.url,s=e.data,a=e.headers,c=wx.request({url:Object(i.formatUrl)("https:",o),data:s,timeout:t._timeout,method:"POST",header:a,success:function(e){r(e)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&(t._timeout&&-1!==t._restrictedMethods.indexOf("post")&&"request:fail timeout"===e.errMsg)){console.warn(t._timeoutMsg);try{c.abort()}catch(e){}}}})}))},t.prototype.upload=function(e){var t=this,r=this;return new Promise((function(n){return c(t,void 0,void 0,(function(){var t,o,i,s,c,l;return u(this,(function(u){return t=e.url,o=e.file,i=e.data,s=e.headers,c=e.onUploadProgress,l=wx.uploadFile({url:t,filePath:o,name:"file",formData:a({},i),header:s,timeout:this._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&i.success_action_status&&(t.statusCode=parseInt(i.success_action_status,10)),n(t)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&(r._timeout&&-1!==r._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg)){console.warn(r._timeoutMsg);try{l.abort()}catch(e){}}}}),c&&l.onProgressUpdate((function(e){c(e)})),[2]}))}))}))},t.prototype.download=function(e){var t=this,r=this;return new Promise((function(n,o){var s=e.url,a=e.headers,c=wx.downloadFile({url:Object(i.formatUrl)("https:",s),header:a,timeout:t._timeout,success:function(e){200===e.statusCode&&e.tempFilePath?n({statusCode:200,tempFilePath:e.tempFilePath}):n(e)},fail:function(e){o(e)},complete:function(e){if(e&&e.errMsg&&(r._timeout&&-1!==r._restrictedMethods.indexOf("download")&&"request:fail timeout"===e.errMsg)){console.warn(r._timeoutMsg);try{c.abort()}catch(e){}}}})}))},t}(i.AbstractSDKRequest),f={setItem:function(e,t){wx.setStorageSync(e,t)},getItem:function(e){return wx.getStorageSync(e)},removeItem:function(e){wx.removeStorageSync(e)},clear:function(){wx.clearStorageSync()}},h=function(e,t){void 0===t&&(t={});var r=wx.connectSocket(a({url:e},t));return{set onopen(e){r.onOpen(e)},set onmessage(e){r.onMessage(e)},set onclose(e){r.onClose(e)},set onerror(e){r.onError(e)},send:function(e){return r.send({data:e})},close:function(e,t){return r.close({code:e,reason:t})},get readyState(){return r.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}};var p={genAdapter:function(){return{root:{},reqClass:l,wsClass:h,localStorage:f,primaryStorage:i.StorageType.local,getAppSign:function(){var e=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:"":e&&e.plugin?e.plugin.appId:""}}},isMatch:function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(e){return!1}return!0},runtime:"wx_mp"},d=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n},_=o.constants.ERRORS,v={};function y(e,t){var r=t.name,n=t.namespace,o=t.entity,i=t.injectEvents,s=t.IIFE,a=void 0!==s&&s;if(v[r]||n&&e[n])throw new Error(JSON.stringify({code:_.INVALID_OPERATION,msg:"Duplicate component "+r}));if(a){if(!o||"function"!=typeof o)throw new Error(JSON.stringify({code:_.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));o.call(e)}if(v[r]=t,n?e.prototype[n]=o:function e(t,r){if(!(r instanceof Object))return r;switch(r.constructor){case Date:return new Date(r.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return r}for(var n in r)r.hasOwnProperty(n)&&(t[n]=e(t[n],r[n]));return t}(e.prototype,o),i){var c=i.bus,u=i.events;if(!c||!u||0===u.length)return;var l=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[r]?e.prototype.events[r].events=d(e.prototype.events[r].events,u):e.prototype.events[r]={bus:c,events:u},e.prototype.fire=function(e,t){for(var r in l(e,t),this.events){var n=this.events[r],o=n.bus;if(n.events.includes(e)){o.fire(e,t);break}}}}}var g={},m=function(){return(m=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},b=o.cache.CloudbaseCache,w={},S={};function A(e){var t=e.env,r=e.persistence,n=e.platformInfo,o={accessTokenKey:"access_token_"+t,accessTokenExpireKey:"access_token_expire_"+t,refreshTokenKey:"refresh_token_"+t,anonymousUuidKey:"anonymous_uuid_"+t,loginTypeKey:"login_type_"+t,userInfoKey:"user_info_"+t,deviceIdKey:"device_id"};w[t]?w[t].updatePersistence(r):w[t]=new b(m(m({},e),{keys:o,platformInfo:n,alwaysLocalKeys:["anonymousUuidKey"]})),S[t]=S[t]||new b(m(m({},e),{keys:o,platformInfo:n,persistence:"local"}))}function O(e){return w[e]}function I(e){return S[e]}var E,R=r(1),T="loginStateExpire",P="refreshAccessToken",k=new Uint8Array(16);function N(){if(!E&&!(E="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return E(k)}var C=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var U=function(e){return"string"==typeof e&&C.test(e)},x=[],L=0;L<256;++L)x.push((L+256).toString(16).substr(1));var D=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(x[e[t+0]]+x[e[t+1]]+x[e[t+2]]+x[e[t+3]]+"-"+x[e[t+4]]+x[e[t+5]]+"-"+x[e[t+6]]+x[e[t+7]]+"-"+x[e[t+8]]+x[e[t+9]]+"-"+x[e[t+10]]+x[e[t+11]]+x[e[t+12]]+x[e[t+13]]+x[e[t+14]]+x[e[t+15]]).toLowerCase();if(!U(r))throw TypeError("Stringified UUID is invalid");return r};var j=function(e){if(!U(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};var M=function(e,t,r){function n(e,n,o,i){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=j(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var s=new Uint8Array(16+e.length);if(s.set(n),s.set(e,n.length),(s=r(s))[6]=15&s[6]|t,s[8]=63&s[8]|128,o){i=i||0;for(var a=0;a<16;++a)o[i+a]=s[a];return o}return D(s)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n};function q(e){return 14+(e+64>>>9<<4)+1}function V(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function H(e,t,r,n,o,i){return V((s=V(V(t,e),V(n,i)))<<(a=o)|s>>>32-a,r);var s,a}function B(e,t,r,n,o,i,s){return H(t&r|~t&n,e,t,o,i,s)}function W(e,t,r,n,o,i,s){return H(t&n|r&~n,e,t,o,i,s)}function K(e,t,r,n,o,i,s){return H(t^r^n,e,t,o,i,s)}function F(e,t,r,n,o,i,s){return H(r^(t|~n),e,t,o,i,s)}M("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n=0;n<r;n+=8){var o=e[n>>5]>>>n%32&255,i=parseInt("0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[q(t)-1]=t;for(var r=1732584193,n=-271733879,o=-1732584194,i=271733878,s=0;s<e.length;s+=16){var a=r,c=n,u=o,l=i;r=B(r,n,o,i,e[s],7,-680876936),i=B(i,r,n,o,e[s+1],12,-389564586),o=B(o,i,r,n,e[s+2],17,606105819),n=B(n,o,i,r,e[s+3],22,-1044525330),r=B(r,n,o,i,e[s+4],7,-176418897),i=B(i,r,n,o,e[s+5],12,1200080426),o=B(o,i,r,n,e[s+6],17,-1473231341),n=B(n,o,i,r,e[s+7],22,-45705983),r=B(r,n,o,i,e[s+8],7,1770035416),i=B(i,r,n,o,e[s+9],12,-1958414417),o=B(o,i,r,n,e[s+10],17,-42063),n=B(n,o,i,r,e[s+11],22,-1990404162),r=B(r,n,o,i,e[s+12],7,1804603682),i=B(i,r,n,o,e[s+13],12,-40341101),o=B(o,i,r,n,e[s+14],17,-1502002290),n=B(n,o,i,r,e[s+15],22,1236535329),r=W(r,n,o,i,e[s+1],5,-165796510),i=W(i,r,n,o,e[s+6],9,-1069501632),o=W(o,i,r,n,e[s+11],14,643717713),n=W(n,o,i,r,e[s],20,-373897302),r=W(r,n,o,i,e[s+5],5,-701558691),i=W(i,r,n,o,e[s+10],9,38016083),o=W(o,i,r,n,e[s+15],14,-660478335),n=W(n,o,i,r,e[s+4],20,-405537848),r=W(r,n,o,i,e[s+9],5,568446438),i=W(i,r,n,o,e[s+14],9,-1019803690),o=W(o,i,r,n,e[s+3],14,-187363961),n=W(n,o,i,r,e[s+8],20,1163531501),r=W(r,n,o,i,e[s+13],5,-1444681467),i=W(i,r,n,o,e[s+2],9,-51403784),o=W(o,i,r,n,e[s+7],14,1735328473),n=W(n,o,i,r,e[s+12],20,-1926607734),r=K(r,n,o,i,e[s+5],4,-378558),i=K(i,r,n,o,e[s+8],11,-2022574463),o=K(o,i,r,n,e[s+11],16,1839030562),n=K(n,o,i,r,e[s+14],23,-35309556),r=K(r,n,o,i,e[s+1],4,-1530992060),i=K(i,r,n,o,e[s+4],11,1272893353),o=K(o,i,r,n,e[s+7],16,-155497632),n=K(n,o,i,r,e[s+10],23,-1094730640),r=K(r,n,o,i,e[s+13],4,681279174),i=K(i,r,n,o,e[s],11,-358537222),o=K(o,i,r,n,e[s+3],16,-722521979),n=K(n,o,i,r,e[s+6],23,76029189),r=K(r,n,o,i,e[s+9],4,-640364487),i=K(i,r,n,o,e[s+12],11,-421815835),o=K(o,i,r,n,e[s+15],16,530742520),n=K(n,o,i,r,e[s+2],23,-995338651),r=F(r,n,o,i,e[s],6,-198630844),i=F(i,r,n,o,e[s+7],10,1126891415),o=F(o,i,r,n,e[s+14],15,-1416354905),n=F(n,o,i,r,e[s+5],21,-57434055),r=F(r,n,o,i,e[s+12],6,1700485571),i=F(i,r,n,o,e[s+3],10,-1894986606),o=F(o,i,r,n,e[s+10],15,-1051523),n=F(n,o,i,r,e[s+1],21,-2054922799),r=F(r,n,o,i,e[s+8],6,1873313359),i=F(i,r,n,o,e[s+15],10,-30611744),o=F(o,i,r,n,e[s+6],15,-1560198380),n=F(n,o,i,r,e[s+13],21,1309151649),r=F(r,n,o,i,e[s+4],6,-145523070),i=F(i,r,n,o,e[s+11],10,-1120210379),o=F(o,i,r,n,e[s+2],15,718787259),n=F(n,o,i,r,e[s+9],21,-343485551),r=V(r,a),n=V(n,c),o=V(o,u),i=V(i,l)}return[r,n,o,i]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(q(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))}));var G=function(e,t,r){var n=(e=e||{}).random||(e.rng||N)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return D(n)};function J(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Y(e,t){return e<<t|e>>>32-t}M("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var o=0;o<n.length;++o)e.push(n.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var i=e.length/4+2,s=Math.ceil(i/16),a=new Array(s),c=0;c<s;++c){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=e[64*c+4*l]<<24|e[64*c+4*l+1]<<16|e[64*c+4*l+2]<<8|e[64*c+4*l+3];a[c]=u}a[s-1][14]=8*(e.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<s;++f){for(var h=new Uint32Array(80),p=0;p<16;++p)h[p]=a[f][p];for(var d=16;d<80;++d)h[d]=Y(h[d-3]^h[d-8]^h[d-14]^h[d-16],1);for(var _=r[0],v=r[1],y=r[2],g=r[3],m=r[4],b=0;b<80;++b){var w=Math.floor(b/20),S=Y(_,5)+J(w,v,y,g)+m+t[w]+h[b]>>>0;m=g,g=y,y=Y(v,30)>>>0,v=_,_=S}r[0]=r[0]+_>>>0,r[1]=r[1]+v>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+g>>>0,r[4]=r[4]+m>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]}));var Q=function(){return(Q=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},X=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},z=function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},$=o.constants.getSdkName,Z=o.constants.ERRORS,ee=o.utils.genSeqId,te=o.utils.isFormData,re=o.utils.formatUrl,ne=o.utils.createSign,oe=o.adapters.RUNTIME,ie=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function se(e,t,r){var n=e[t];e[t]=function(t){var o={},i={};r.forEach((function(r){var n=r.call(e,t),s=n.data,a=n.headers;Object.assign(o,s),Object.assign(i,a)}));var s=t.data;return s&&function(){if(te(s))for(var e in o)s.append(e,o[e]);else t.data=Q(Q({},s),o)}(),t.headers=Q(Q({},t.headers||{}),i),n.call(e,t)}}function ae(){var e=ee();return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/"+Object(R.g)(),"x-seqid":e}}}var ce=function(){function e(e){this._throwWhenRequestFail=!1;var t=e._fromApp;this.config=e,this._fromApp=t,this._reqClass=new g.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在"+this.config.timeout/1e3+"s内未完成,已中断",restrictedMethods:["post"]}),this._throwWhenRequestFail=e.throw||!1,this._cache=O(this.config.env),this._localCache=I(this.config.env),se(this._reqClass,"post",[ae]),se(this._reqClass,"upload",[ae]),se(this._reqClass,"download",[ae])}return e.prototype.fetch=function(e,t){return X(this,void 0,void 0,(function(){var r,n,o,i,s,a,c,u,l,f;return z(this,(function(h){switch(h.label){case 0:return[4,this.getDeviceId()];case 1:return r=h.sent(),n={"X-Project-Id":this.config.env,"X-SDK-Version":"@cloudbase/js-sdk/"+Object(R.g)(),"X-Request-Id":ee(),"X-Request-Timestamp":Date.now(),"X-Device-Id":r},g.runtime!==oe.WEB&&(o=this.config,i=o.appSign,s=o.appSecret,a=Date.now(),c=s.appAccessKey,u=s.appAccessKeyId,l=ne({data:{},timestamp:a,appAccessKeyId:u,appSign:i},c),n["X-TCB-App-Source"]="timestamp="+a+";appAccessKeyId="+u+";appSign="+i+";sign="+l),t.headers=Object.assign({},t.headers,n),f=e.startsWith("http")?e:""+Object(R.d)()+e,[4,fetch(f,t)];case 2:return[2,h.sent()]}}))}))},e.prototype.post=function(e){return X(this,void 0,void 0,(function(){return z(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.post(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.upload=function(e){return X(this,void 0,void 0,(function(){return z(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.upload(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.download=function(e){return X(this,void 0,void 0,(function(){return z(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.download(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.refreshAccessToken=function(){return X(this,void 0,void 0,(function(){var e,t,r;return z(this,(function(n){switch(n.label){case 0:this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._refreshAccessTokenPromise];case 2:return e=n.sent(),[3,4];case 3:return r=n.sent(),t=r,[3,4];case 4:if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return[2,e]}}))}))},e.prototype.refreshAccessTokenFromOauthServer=function(e){return X(this,void 0,void 0,(function(){var t,r,n;return z(this,(function(o){switch(o.label){case 0:this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessTokenFromOauthServer(e)),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._refreshAccessTokenPromise];case 2:return t=o.sent(),[3,4];case 3:return n=o.sent(),r=n,[3,4];case 4:if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,r)throw r;return[2,t]}}))}))},e.prototype.getOauthAccessToken=function(){return X(this,void 0,void 0,(function(){var e;return z(this,(function(t){return(e=this.config.oauthClient)?[2,this.getOauthAccessTokenV2(e)]:[2]}))}))},e.prototype.getOauthAccessTokenV2=function(e){return X(this,void 0,void 0,(function(){var t,r;return z(this,(function(n){switch(n.label){case 0:return[4,e.getAccessToken()];case 1:return t=n.sent(),[4,e._getCredentials()];case 2:return r=n.sent(),[2,{accessToken:t,accessTokenExpire:new Date(r.expires_at).getTime()}]}}))}))},e.prototype.getAccessToken=function(){return X(this,void 0,void 0,(function(){var e,t,r,n,i,s,a,c,u,l,f,h,p;return z(this,(function(d){switch(d.label){case 0:return e=this._cache.keys,t=e.loginTypeKey,r=e.accessTokenKey,n=e.accessTokenExpireKey,i=e.refreshTokenKey,[4,this._cache.getStoreAsync(t)];case 1:return s=d.sent(),[4,this._cache.getStoreAsync(i)];case 2:if(!d.sent())throw new Error(JSON.stringify({code:Z.OPERATION_FAIL,msg:"refresh token is not exist, your local data might be messed up, please retry after clear localStorage or sessionStorage"}));return[4,this._cache.getStoreAsync(r)];case 3:return a=d.sent(),u=Number,[4,this._cache.getStoreAsync(n)];case 4:return c=u.apply(void 0,[d.sent()]),l=!0,(f=this._shouldRefreshAccessTokenHook)?[4,this._shouldRefreshAccessTokenHook(a,c)]:[3,6];case 5:f=!d.sent(),d.label=6;case 6:if(f&&(l=!1),a&&c&&!(c<Date.now())||!l)return[3,15];if(!s.startsWith(R.c))return[3,12];if(!a)return[3,9];h=null,p=null;try{h=o.jwt.decode(a,{header:!0}),p=o.jwt.decode(a)}catch(e){throw new Error("[DECODE_ACCESS_TOKEN_ERROR] "+e.message+", accesstoken: "+a)}return(null==h?void 0:h.kid)&&(null==p?void 0:p.project_id)?[4,this.refreshAccessTokenFromOauthServer(null==p?void 0:p.project_id)]:[3,8];case 7:return[2,d.sent()];case 8:return[3,11];case 9:return[4,this.refreshAccessTokenFromOauthServer(this.config.env)];case 10:return[2,d.sent()];case 11:return[3,14];case 12:return[4,this.refreshAccessToken()];case 13:return[2,d.sent()];case 14:return[3,16];case 15:return[2,{accessToken:a,accessTokenExpire:c}];case 16:return[2]}}))}))},e.prototype.request=function(e,t,r){return X(this,void 0,void 0,(function(){var n,o,i,s,a,c,u,l,f,h,p,d,_,v,y,m,b,w,S,A,O,I,E,T,P,k,N,C,U,x,L;return z(this,(function(D){switch(D.label){case 0:return n=this.config.oauthClient,o="x-tcb-trace_"+this.config.env,i="application/x-www-form-urlencoded",s=Q({action:e,dataVersion:R.a,env:this.config.env},t),n?(a=s,[4,this.getOauthAccessToken()]):[3,2];case 1:return a.access_token=D.sent().accessToken,[3,5];case 2:return[4,this.checkFromAuthV2()];case 3:return"oauth"!==D.sent()?[3,5]:(c=this.config._fromApp,u=c.oauthInstance.oauth2client,l=s,[4,this.getOauthAccessTokenV2(u)]);case 4:l.access_token=D.sent().accessToken,D.label=5;case 5:return-1!==ie.indexOf(e)?[3,8]:(f=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(f)]);case 6:return D.sent()?(h=s,[4,this.getAccessToken()]):[3,8];case 7:h.access_token=D.sent().accessToken,D.label=8;case 8:if("storage.uploadFile"===e){for(d in p=new FormData)p.hasOwnProperty(d)&&void 0!==p[d]&&p.append(d,s[d]);i="multipart/form-data"}else for(d in i="application/json;charset=UTF-8",p={},s)void 0!==s[d]&&(p[d]=s[d]);return _={headers:{"content-type":i}},(null==r?void 0:r.onUploadProgress)&&(_.onUploadProgress=r.onUploadProgress),this.config.region&&(_.headers["X-TCB-Region"]=this.config.region),(v=this._localCache.getStore(o))&&(_.headers["X-TCB-Trace"]=v),g.runtime!==oe.WEB&&(y=this.config,m=y.appSign,b=y.appSecret,w=Date.now(),S=b.appAccessKey,A=b.appAccessKeyId,O=ne({data:{},timestamp:w,appAccessKeyId:A,appSign:m},S),_.headers["X-TCB-App-Source"]="timestamp="+w+";appAccessKeyId="+A+";appSign="+m+";sign="+O),I=t.parse,E=t.inQuery,T=t.search,P={env:this.config.env},I&&(P.parse=!0),E&&(P=Q(Q({},E),P)),k=Object(R.e)(),N=k.BASE_URL,C=k.PROTOCOL,U=re(C,N,P),T&&(U+=T),[4,this.post(Q({url:U,data:p},_))];case 9:if(x=D.sent(),(L=x.header&&x.header["x-tcb-trace"])&&this._localCache.setStore(o,L),200!==Number(x.status)&&200!==Number(x.statusCode)||!x.data)throw new Error("network request error");return[2,x]}}))}))},e.prototype.send=function(e,t){return void 0===t&&(t={}),X(this,void 0,void 0,(function(){var r;return z(this,(function(n){switch(n.label){case 0:return[4,this.request(e,t,{onUploadProgress:t.onUploadProgress})];case 1:return"ACCESS_TOKEN_EXPIRED"!==(r=n.sent()).data.code||-1!==ie.indexOf(e)?[3,4]:[4,this.refreshAccessToken()];case 2:return n.sent(),[4,this.request(e,t,{onUploadProgress:t.onUploadProgress})];case 3:r=n.sent(),n.label=4;case 4:if(r.data.code&&this._throwWhenRequestFail)throw new Error(JSON.stringify({code:Z.OPERATION_FAIL,msg:"["+r.data.code+"] "+r.data.message}));return[2,r.data]}}))}))},e.prototype._refreshAccessToken=function(e){return void 0===e&&(e=1),X(this,void 0,void 0,(function(){var t,r,n,o,i,s,a,c,u,l,f,h,p;return z(this,(function(d){switch(d.label){case 0:return t=this._cache.keys,r=t.accessTokenKey,n=t.accessTokenExpireKey,o=t.refreshTokenKey,i=t.loginTypeKey,s=t.anonymousUuidKey,[4,this._cache.removeStoreAsync(r)];case 1:return d.sent(),[4,this._cache.removeStoreAsync(n)];case 2:return d.sent(),[4,this._cache.getStoreAsync(o)];case 3:if(!(a=d.sent()))throw new Error(JSON.stringify({code:Z.INVALID_OPERATION,msg:"not login"}));return c={refresh_token:a},[4,this.request("auth.fetchAccessTokenWithRefreshToken",c)];case 4:return(u=d.sent()).data.code?"SIGN_PARAM_INVALID"!==(l=u.data.code)&&"REFRESH_TOKEN_EXPIRED"!==l&&"INVALID_REFRESH_TOKEN"!==l?[3,11]:[4,this._cache.getStoreAsync(i)]:[3,12];case 5:return d.sent()===R.b.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===l?[4,this._cache.getStoreAsync(s)]:[3,9];case 6:return f=d.sent(),[4,this._cache.getStoreAsync(o)];case 7:return h=d.sent(),[4,this.send("auth.signInAnonymously",{anonymous_uuid:f,refresh_token:h})];case 8:if(p=d.sent(),this._setRefreshToken(p.refresh_token),e>=1)return[2,this._refreshAccessToken(--e)];throw new Error(JSON.stringify({code:Z.OPERATION_FAIL,message:"重试获取 refresh token 失败"}));case 9:return Oe.fire(T),[4,this._cache.removeStoreAsync(o)];case 10:d.sent(),d.label=11;case 11:throw new Error(JSON.stringify({code:Z.NETWORK_ERROR,msg:"refresh access_token failed:"+u.data.code}));case 12:return u.data.access_token?(Oe.fire(P),[4,this._cache.setStoreAsync(r,u.data.access_token)]):[3,15];case 13:return d.sent(),[4,this._cache.setStoreAsync(n,u.data.access_token_expire+Date.now())];case 14:return d.sent(),[2,{accessToken:u.data.access_token,accessTokenExpire:u.data.access_token_expire}];case 15:return u.data.refresh_token?[4,this._cache.removeStoreAsync(o)]:[3,19];case 16:return d.sent(),[4,this._cache.setStoreAsync(o,u.data.refresh_token)];case 17:return d.sent(),[4,this._refreshAccessToken()];case 18:d.sent(),d.label=19;case 19:return[2]}}))}))},e.prototype._fetchAccessTokenFromOauthServer=function(e,t){return X(this,void 0,void 0,(function(){var r,n,o,i;return z(this,(function(s){switch(s.label){case 0:return[4,this.fetch("/auth/v1/token",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",client_id:t,refresh_token:e})})];case 1:return r=s.sent(),n=r.headers.get("SeqId")||r.headers.get("RequestId"),r.status>=400&&r.status<500?[4,r.json()]:[3,3];case 2:throw o=s.sent(),i=o.request_id||n,new Error("["+$()+"/"+Object(R.g)()+"][OAuth2AuthProvider][status:"+r.status+"]["+o.error+"("+o.error_code+")] "+o.error_description+" ("+i+")");case 3:return r.status>=500?[4,r.json()]:[3,5];case 4:throw o=s.sent(),i=o.request_id||n,new Error("["+$()+"/"+Object(R.g)()+"][OAuth2AuthProvider][status:"+r.status+"]["+o.error+"("+o.error_code+")] "+o.error_description+" ("+i+")");case 5:return[2,r.json()]}}))}))},e.prototype._refreshAccessTokenFromOauthServer=function(e){return X(this,void 0,void 0,(function(){var t,r,n,o,i,s,a,c,u;return z(this,(function(l){switch(l.label){case 0:return t=this._cache.keys,r=t.accessTokenKey,n=t.accessTokenExpireKey,o=t.refreshTokenKey,[4,this._cache.getStoreAsync(o)];case 1:if(!(i=l.sent()))throw new Error(JSON.stringify({code:Z.INVALID_OPERATION,msg:"not login"}));return[4,this._fetchAccessTokenFromOauthServer(i,e)];case 2:if(s=l.sent(),a=s.refresh_token,c=s.access_token,u=s.expires_in,!c||!u)throw new Error(JSON.stringify({code:Z.NETWORK_ERROR,msg:"refresh access_token failed"}));return c&&u?a!==i?[3,4]:[4,this._cache.setStoreAsync(o,a)]:[3,7];case 3:l.sent(),l.label=4;case 4:return[4,this._cache.setStoreAsync(r,c)];case 5:return l.sent(),[4,this._cache.setStoreAsync(n,1e3*u+Date.now())];case 6:return l.sent(),Oe.fire(P),[2,{accessToken:c,accessTokenExpire:u}];case 7:return[2]}}))}))},e.prototype._setRefreshToken=function(e){return X(this,void 0,void 0,(function(){var t,r,n,o;return z(this,(function(i){switch(i.label){case 0:return t=this._cache.keys,r=t.accessTokenKey,n=t.accessTokenExpireKey,o=t.refreshTokenKey,[4,this._cache.removeStoreAsync(r)];case 1:return i.sent(),[4,this._cache.removeStoreAsync(n)];case 2:return i.sent(),[4,this._cache.setStoreAsync(o,e)];case 3:return i.sent(),[2]}}))}))},e.prototype.getDeviceId=function(){return X(this,void 0,void 0,(function(){var e,t,r;return z(this,(function(n){switch(n.label){case 0:return e=this._cache.keys.deviceIdKey,[4,this._cache.getStoreAsync(e)];case 1:return(t=n.sent())?[2,t]:(r=G(),this._cache.setStoreAsync(e,r),[2,r])}}))}))},e.prototype.checkFromAuthV2=function(){return X(this,void 0,void 0,(function(){var e,t;return z(this,(function(r){switch(r.label){case 0:return e=this._fromApp.oauthInstance||this._fromApp.oauth(),(t=e)?[4,e.hasLoginState()]:[3,2];case 1:t=r.sent(),r.label=2;case 2:return t?[2,"oauth"]:[2,""]}}))}))},e}(),ue={};var le=function(){return(le=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},fe=function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},he=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},pe=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},de=function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},_e=o.adapters.useAdapters,ve=o.adapters.useDefaultAdapter,ye=o.adapters.RUNTIME,ge=o.constants.ERRORS,me=o.constants.COMMUNITY_SITE_URL,be=o.utils.printWarn,we=o.helpers.catchErrorsDecorator,Se={timeout:15e3,persistence:"local"},Ae={},Oe=new(function(){function e(e){this._config=e||this._config,this.authInstance=null,this.oauthInstance=null}return Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return g},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return O(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return I(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return e=this._config.env,ue[e];var e},enumerable:!1,configurable:!0}),e.prototype.init=function(t){if(!t.env)throw new Error(JSON.stringify({code:ge.INVALID_PARAMS,msg:"env must not be specified"}));if(g.adapter||this._useDefaultAdapter(),this.requestClient=new g.adapter.reqClass({timeout:t.timeout||5e3,timeoutMsg:"["+Object(R.f)()+"][REQUEST TIMEOUT] request had been abort since didn't finished within"+t.timeout/1e3+"s"}),g.runtime!==ye.WEB){if(!t.appSecret)throw new Error(JSON.stringify({code:ge.INVALID_PARAMS,msg:"invalid appSecret"}));var r=g.adapter.getAppSign?g.adapter.getAppSign():"";if(t.appSign&&r&&t.appSign!==r)throw new Error(JSON.stringify({code:ge.INVALID_PARAMS,msg:"invalid appSign"}));if(r&&(t.appSign=r),!t.appSign)throw new Error(JSON.stringify({code:ge.INVALID_PARAMS,msg:"invalid appSign"}))}this._config=le(le({},Se),t),this._config.timeout=this._formatTimeout(this._config.timeout);var n=this._config,o=n.env,i=n.persistence,s=n.debug,a=n.timeout,c=n.appSecret,u=n.appSign,l=n.oauthClient;A({env:o,persistence:i,debug:s,platformInfo:this.platform}),t.region&&Object(R.i)(o,t.region||"");var f=new e(this._config);return function(e){ue[e.env]=new ce(Q(Q({},e),{throw:!0}))}({env:o,region:t.region||"",timeout:a,appSecret:c,appSign:u,oauthClient:l,_fromApp:f}),f.requestClient=this.requestClient,f},e.prototype.updateConfig=function(e){var t=e.persistence,r=e.debug;this._config.persistence=t,this._config.debug=r,A({env:this._config.env,persistence:t,debug:r,platformInfo:this.platform})},e.prototype.registerExtension=function(e){Ae[e.name]=e},e.prototype.invokeExtension=function(e,t){return pe(this,void 0,void 0,(function(){var r;return de(this,(function(n){switch(n.label){case 0:if(!(r=Ae[e]))throw new Error(JSON.stringify({code:ge.INVALID_PARAMS,msg:"extension:"+e+" must be registered before invoke"}));return[4,r.invoke(t,this)];case 1:return[2,n.sent()]}}))}))},e.prototype.useAdapters=function(e){var t=_e(e)||{},r=t.adapter,n=t.runtime;r&&(g.adapter=r),n&&(g.runtime=n)},e.prototype.registerHook=function(t){!function(e,t){var r=t.entity,n=t.target;if(!e.prototype.hasOwnProperty(n))throw new Error(JSON.stringify({code:_.INVALID_OPERATION,msg:"target:"+n+" is not exist"}));var o=e.prototype[n];if("function"!=typeof o)throw new Error(JSON.stringify({code:_.INVALID_OPERATION,msg:"target:"+n+" is not a function which is the only type supports hook"}));e.prototype[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.call.apply(r,d([this],e)),o.call.apply(o,d([this],e))}}(e,t)},e.prototype.registerComponent=function(t){y(e,t)},e.prototype.registerVersion=function(e){Object(R.k)(e)},e.prototype.registerSdkName=function(e){Object(R.j)(e)},e.prototype.registerEndPoint=function(e,t){Object(R.h)(e,t)},e.prototype._useDefaultAdapter=function(){var e=ve(),t=e.adapter,r=e.runtime;g.adapter=t,g.runtime=r},e.prototype._formatTimeout=function(e){switch(!0){case e>6e5:return be(ge.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),6e5;case e<100:return be(ge.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},fe([we({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv2/adapter.html#jie-ru-liu-cheng)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+me]}),he("design:type",Function),he("design:paramtypes",[Object]),he("design:returntype",e)],e.prototype,"init",null),fe([we({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+me]}),he("design:type",Function),he("design:paramtypes",[String,Object]),he("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}());Oe.useAdapters(p);t.default=Oe}])}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_oauth",[],t):"object"==typeof exports?exports.cloudbase_oauth=t():e.cloudbase_oauth=t()}("undefined"!=typeof window?window:this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function u(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.OAuth2Client=t.LocalCredentials=t.defaultStorage=t.generateRequestId=t.toResponseError=t.defaultRequest=void 0;var s=r(1),u=r(5),a=r(6);function c(){return u.uuidv4()}t.defaultRequest=function(e,t){return i(void 0,void 0,void 0,(function(){var r,n,i,u,a;return o(this,(function(o){switch(o.label){case 0:r=null,n=null,o.label=1;case 1:return o.trys.push([1,4,,5]),(i=Object.assign({},t)).method||(i.method="GET"),i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body)),[4,fetch(e,i)];case 2:return[4,o.sent().json()];case 3:return(null==(u=o.sent())?void 0:u.error)?(n=u).error_uri=new URL(e).pathname:r=u,[3,5];case 4:return a=o.sent(),n={error:s.ErrorType.UNREACHABLE,error_description:a.message,error_uri:new URL(e).pathname},[3,5];case 5:if(n)throw n;return[2,r]}}))}))},t.toResponseError=function(e,t){var r,n=t||{};if(e instanceof Error)r={error:n.error||s.ErrorType.LOCAL,error_description:n.error_description||e.message,error_uri:n.error_uri,details:n.details||e.stack};else{var i=e||{};r={error:n.error||i.error||s.ErrorType.LOCAL,error_description:n.error_description||i.error_description,error_uri:n.error_uri||i.error_uri,details:n.details||i.details}}return r},t.generateRequestId=c;var l=function(){function e(){}return e.prototype.getItem=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,window.localStorage.getItem(e)]}))}))},e.prototype.removeItem=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return window.localStorage.removeItem(e),[2]}))}))},e.prototype.setItem=function(e,t){return i(this,void 0,void 0,(function(){return o(this,(function(r){return window.localStorage.setItem(e,t),[2]}))}))},e.prototype.getItemSync=function(e){return window.localStorage.getItem(e)},e.prototype.removeItemSync=function(e){window.localStorage.removeItem(e)},e.prototype.setItemSync=function(e,t){window.localStorage.setItem(e,t)},e}();function d(e){var t=!0;return(null==e?void 0:e.expires_at)&&(null==e?void 0:e.access_token)&&(t=e.expires_at<new Date),t}t.defaultStorage=new l;var h=function(){function e(e){this._credentials=null,this._singlePromise=new a.SinglePromise,this._tokenSectionName=e.tokenSectionName,this._storage=e.storage}return e.prototype.setCredentials=function(e){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return(null==e?void 0:e.expires_in)?(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30)),this._storage?(t=JSON.stringify(e),[4,this._storage.setItem(this._tokenSectionName,t)]):[3,2]):[3,3];case 1:r.sent(),r.label=2;case 2:return this._credentials=e,[3,6];case 3:return this._storage?[4,this._storage.removeItem(this._tokenSectionName)]:[3,5];case 4:r.sent(),r.label=5;case 5:this._credentials=null,r.label=6;case 6:return[2]}}))}))},e.prototype.getCredentials=function(){return i(this,void 0,void 0,(function(){var e=this;return o(this,(function(t){return[2,this._singlePromise.run("getCredentials",(function(){return i(e,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return d(this._credentials)?(e=this,[4,this._getStorageCredentials()]):[3,2];case 1:e._credentials=t.sent(),t.label=2;case 2:return[2,this._credentials]}}))}))}))]}))}))},e.prototype._getStorageCredentials=function(){return i(this,void 0,void 0,(function(){var e=this;return o(this,(function(t){return[2,this._singlePromise.run("_getStorageCredentials",(function(){return i(e,void 0,void 0,(function(){var e,t;return o(this,(function(r){switch(r.label){case 0:return e=null,[4,this._storage.getItem(this._tokenSectionName)];case 1:if(null==(t=r.sent()))return[3,5];r.label=2;case 2:return r.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),[3,5];case 3:return r.sent(),[4,this._storage.removeItem(this._tokenSectionName)];case 4:return r.sent(),e=null,[3,5];case 5:return[2,e]}}))}))}))]}))}))},e.prototype._getStorageCredentialsSync=function(){var e=null,t=this._storage.getItemSync(this._tokenSectionName);if(null!=t)try{(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at))}catch(t){this._storage.removeItem(this._tokenSectionName),e=null}return e},e}();t.LocalCredentials=h;var _=function(){function e(r){this._singlePromise=new a.SinglePromise,this._apiOrigin=r.apiOrigin,this._clientId=r.clientId,this._retry=this._formatRetry(r.retry,e._defaultRetry),null!=r.baseRequest?this._baseRequest=r.baseRequest:this._baseRequest=t.defaultRequest,this._tokenInURL=r.tokenInURL,this._headers=r.headers,this._storage=r.storage||t.defaultStorage,this._localCredentials=new h({tokenSectionName:"credentials_"+r.clientId,storage:this._storage}),this._clientSecret=r.clientSecret,this._refreshTokenFunc=r.refreshTokenFunc||this._defaultRefreshTokenFunc}return e.prototype.setCredentials=function(e){return this._localCredentials.setCredentials(e)},e.prototype.getAccessToken=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,this._getCredentials()];case 1:return(null==(e=t.sent())?void 0:e.access_token)?[2,Promise.resolve(e.access_token)]:[2,Promise.reject({error:s.ErrorType.UNAUTHENTICATED})]}}))}))},e.prototype.request=function(t,r){return i(this,void 0,void 0,(function(){var i,u,a,l,d,h,_;return o(this,(function(o){switch(o.label){case 0:return r||(r={}),i=this._formatRetry(r.retry,this._retry),r.headers=r.headers||{},this._headers&&(r.headers=n(n({},this._headers),r.headers)),r.headers["x-request-id"]||(r.headers["x-request-id"]=c()),r.headers["x-device-id"]?[3,2]:[4,this._getDeviceId()];case 1:u=o.sent(),r.headers["x-device-id"]=u,o.label=2;case 2:return(null==r?void 0:r.withCredentials)?[4,this._getCredentials()]:[3,4];case 3:return(a=o.sent())&&(this._tokenInURL?(t.indexOf("?")<0&&(t+="?"),t+="access_token="+a.access_token):r.headers.Authorization=a.token_type+" "+a.access_token),[3,5];case 4:this._clientId&&t.indexOf("client_id")<0&&(t+=t.indexOf("?")<0?"?":"&",t+="client_id="+this._clientId),o.label=5;case 5:t.startsWith("/")&&(t=this._apiOrigin+t),l=null,d=i+1,h=0,o.label=6;case 6:if(!(h<d))return[3,15];o.label=7;case 7:return o.trys.push([7,9,,12]),[4,this._baseRequest(t,r)];case 8:return l=o.sent(),[3,15];case 9:return _=o.sent(),r.withCredentials&&_&&_.error===s.ErrorType.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return o.sent(),[2,Promise.reject(_)];case 11:return h!==i&&_&&"unreachable"===_.error?[3,12]:[2,Promise.reject(_)];case 12:return[4,this._sleep(e._retryInterval)];case 13:o.sent(),o.label=14;case 14:return h++,[3,6];case 15:return[2,l]}}))}))},e.prototype._checkRetry=function(t){var r=null;if(("number"!=typeof t||t<e._minRetry||t>e._maxRetry)&&(r={error:s.ErrorType.UNREACHABLE,error_description:"wrong options param: retry"}),r)throw r;return t},e.prototype._formatRetry=function(e,t){return void 0===e?t:this._checkRetry(e)},e.prototype._sleep=function(e){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,new Promise((function(t){setTimeout((function(){t()}),e)}))]}))}))},e.prototype._refreshToken=function(e){return i(this,void 0,void 0,(function(){var t=this;return o(this,(function(r){return[2,this._singlePromise.run("_refreshToken",(function(){return i(t,void 0,void 0,(function(){var t,r;return o(this,(function(n){switch(n.label){case 0:if(!e||!e.refresh_token)return[2,this._unAuthenticatedError("no refresh token found in credentials")];n.label=1;case 1:return n.trys.push([1,4,,7]),[4,this._refreshTokenFunc(e.refresh_token)];case 2:return t=n.sent(),[4,this._localCredentials.setCredentials(t)];case 3:return n.sent(),[2,t];case 4:return(r=n.sent()).error!==s.ErrorType.INVALID_GRANT?[3,6]:[4,this._localCredentials.setCredentials(null)];case 5:return n.sent(),[2,this._unAuthenticatedError(r.error_description)];case 6:return[2,Promise.reject(r)];case 7:return[2]}}))}))}))]}))}))},e.prototype._anonymousSignIn=function(e){return i(this,void 0,void 0,(function(){var t=this;return o(this,(function(r){return[2,this._singlePromise.run("_anonymous",(function(){return i(t,void 0,void 0,(function(){var t,r;return o(this,(function(n){switch(n.label){case 0:if(!e||"anonymous"!==e.scope)return[2,this._unAuthenticatedError("no anonymous in credentials")];n.label=1;case 1:return n.trys.push([1,4,,7]),[4,this.request("/auth/v1/signin/anonymously",{method:"POST",body:{client_id:this._clientId,client_secret:this._clientSecret}})];case 2:return t=n.sent(),[4,this._localCredentials.setCredentials(t)];case 3:return n.sent(),[2,t];case 4:return(r=n.sent()).error!==s.ErrorType.INVALID_GRANT?[3,6]:[4,this._localCredentials.setCredentials(null)];case 5:return n.sent(),[2,this._unAuthenticatedError(r.error_description)];case 6:return[2,Promise.reject(r)];case 7:return[2]}}))}))}))]}))}))},e.prototype._defaultRefreshTokenFunc=function(e){return void 0===e||""===e?this._unAuthenticatedError("refresh token not found"):this.request("/auth/v1/token",{method:"POST",body:{client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:e}})},e.prototype._getCredentials=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,this._localCredentials.getCredentials()];case 1:return d(e=t.sent())?e&&"anonymous"===e.scope?[4,this._anonymousSignIn(e)]:[3,3]:[3,5];case 2:return e=t.sent(),[3,5];case 3:return[4,this._refreshToken(e)];case 4:e=t.sent(),t.label=5;case 5:return[2,e]}}))}))},e.prototype.getCredentialsSync=function(){return this._localCredentials._getStorageCredentialsSync()},e.prototype.getCredentialsAsync=function(){return this._localCredentials.getCredentials()},e.prototype.getScope=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,this._localCredentials.getCredentials()];case 1:return null==(e=t.sent())?[2,this._unAuthenticatedError("credentials not found")]:[2,e.scope]}}))}))},e.prototype._getDeviceId=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return this._deviceID?[2,this._deviceID]:[4,this._storage.getItem("device_id")];case 1:return"string"==typeof(e=t.sent())&&e.length>=16&&e.length<=48?[3,3]:(e=u.uuidv4(),[4,this._storage.setItem("device_id",e)]);case 2:t.sent(),t.label=3;case 3:return this._deviceID=e,[2,e]}}))}))},e.prototype._unAuthenticatedError=function(e){return Promise.reject({error:s.ErrorType.UNAUTHENTICATED,error_description:e})},e._defaultRetry=2,e._minRetry=0,e._maxRetry=5,e._retryInterval=1e3,e}();t.OAuth2Client=_},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorType=t.Syntax=void 0,function(e){e.CLIENT_ID="client_id",e.CLIENT_SECRET="client_secret",e.RESPONSE_TYPE="response_type",e.SCOPE="scope",e.STATE="state",e.REDIRECT_URI="redirect_uri",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ERROR_URI="error_uri",e.GRANT_TYPE="grant_type",e.CODE="code",e.ACCESS_TOKEN="access_token",e.TOKEN_TYPE="token_type",e.EXPIRES_IN="expires_in",e.USERNAME="username",e.PASSWORD="password",e.REFRESH_TOKEN="refresh_token"}(t.Syntax||(t.Syntax={})),function(e){e.UNREACHABLE="unreachable",e.LOCAL="local",e.CANCELLED="cancelled",e.UNKNOWN="unknown",e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.UNAUTHENTICATED="unauthenticated",e.RESOURCE_EXHAUSTED="resource_exhausted",e.FAILED_PRECONDITION="failed_precondition",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid",e.INVALID_PASSWORD="invalid_password",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked",e.INVALID_VERIFICATION_CODE="invalid_verification_code",e.TWO_FACTOR_REQUIRED="two_factor_required",e.INVALID_TWO_FACTOR="invalid_two_factor",e.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",e.UNDER_REVIEW="under_review",e.INVALID_REQUEST="invalid_request",e.UNAUTHORIZED_CLIENT="unauthorized_client",e.ACCESS_DENIED="access_denied",e.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",e.INVALID_SCOPE="invalid_scope",e.INVALID_GRANT="invalid_grant",e.SERVER_ERROR="server_error",e.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",e.INTERACTION_REQUIRED="interaction_required",e.LOGIN_REQUIRED="login_required",e.ACCOUNT_SELECTION_REQUIRED="account_selection_required",e.CONSENT_REQUIRED="consent_required",e.INVALID_REQUEST_URI="invalid_request_uri",e.INVALID_REQUEST_OBJECT="invalid_request_object",e.REQUEST_NOT_SUPPORTED="request_not_supported",e.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",e.REGISTRATION_NOT_SUPPORTED="registration_not_supported"}(t.ErrorType||(t.ErrorType={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function u(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Auth=void 0;var o=r(8),s=r(0),u=r(9),a=function(){function e(e){var t=e.request,r=e.credentialsClient;if(!r){var n={apiOrigin:e.apiOrigin,clientId:e.clientId,storage:e.storage};r=new s.OAuth2Client(n)}if(!t){var i=r.request.bind(r),o=new u.Captcha({clientId:e.clientId,request:i,storage:e.storage});t=o.request.bind(o)}this._config={apiOrigin:e.apiOrigin,clientId:e.clientId,request:t,credentialsClient:r,storage:e.storage||s.defaultStorage}}return e.prototype.signIn=function(e){return n(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this._config.request(o.ApiUrls.AUTH_SIGN_IN_URL,{method:"POST",body:e})];case 1:return t=r.sent(),[4,this._config.credentialsClient.setCredentials(t)];case 2:return r.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signInAnonymously=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,this._config.request(o.ApiUrls.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:{}})];case 1:return e=t.sent(),[4,this._config.credentialsClient.setCredentials(e)];case 2:return t.sent(),[2,Promise.resolve(e)]}}))}))},e.prototype.signUp=function(e){return n(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this._config.request(o.ApiUrls.AUTH_SIGN_UP_URL,{method:"POST",body:e})];case 1:return t=r.sent(),[4,this._config.credentialsClient.setCredentials(t)];case 2:return r.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signOut=function(){return n(this,void 0,void 0,(function(){var e,t;return i(this,(function(r){switch(r.label){case 0:return[4,this._config.credentialsClient.getAccessToken()];case 1:return e=r.sent(),[4,this._config.request(o.ApiUrls.AUTH_REVOKE_URL,{method:"POST",body:{token:e}})];case 2:return t=r.sent(),[4,this._config.credentialsClient.setCredentials()];case 3:return r.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.getVerification=function(e){return n(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return t=!1,"CUR_USER"!=e.target?[3,1]:(t=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:r.sent()&&(t=!0),r.label=3;case 3:return[2,this._config.request(o.ApiUrls.VERIFICATION_URL,{method:"POST",body:e,withCaptcha:!0,withCredentials:t})]}}))}))},e.prototype.verify=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.VERIFY_URL,{method:"POST",body:e})]}))}))},e.prototype.genProviderRedirectUri=function(e){return n(this,void 0,void 0,(function(){var t,r;return i(this,(function(n){return t=o.ApiUrls.PROVIDER_URI_URL+"?client_id="+this._config.clientId+"&provider_id="+e.provider_id+"&redirect_uri="+encodeURIComponent(e.provider_redirect_uri)+"&state="+e.state,(r=e.other_params)&&"string"==typeof r.sign_out_uri&&r.sign_out_uri.length>0&&(t+="&other_params[sign_out_uri]="+r.sign_out_uri),[2,this._config.request(t,{method:"GET"})]}))}))},e.prototype.grantProviderToken=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.PROVIDER_TOKEN_URL,{method:"POST",body:e})]}))}))},e.prototype.patchProviderToken=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.PROVIDER_TOKEN_URL,{method:"PATCH",body:e})]}))}))},e.prototype.signInWithProvider=function(e){return n(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this._config.request(o.ApiUrls.AUTH_SIGN_IN_WITH_PROVIDER_URL,{method:"POST",body:e})];case 1:return t=r.sent(),[4,this._config.credentialsClient.setCredentials(t)];case 2:return r.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.bindWithProvider=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.PROVIDER_BIND_URL,{method:"POST",body:e,withCredentials:!0})]}))}))},e.prototype.getUserProfile=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.getUserInfo()]}))}))},e.prototype.getUserInfo=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,this._config.request(o.ApiUrls.USER_ME_URL,{method:"GET",withCredentials:!0})];case 1:return(e=t.sent()).sub&&(e.uid=e.sub),[2,e]}}))}))},e.prototype.deleteMe=function(t){return n(this,void 0,void 0,(function(){var r;return i(this,(function(n){return r=o.ApiUrls.USER_ME_URL+"?"+e.parseParamsToSearch(t),[2,this._config.request(r,{method:"DELETE",withCredentials:!0})]}))}))},e.prototype.hasLoginState=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this._config.credentialsClient.getAccessToken()];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},e.prototype.hasLoginStateSync=function(){return this._config.credentialsClient.getCredentialsSync()},e.prototype.getLoginState=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this._config.credentialsClient.getCredentialsAsync()]}))}))},e.prototype.transByProvider=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:e,withCredentials:!0})]}))}))},e.prototype.grantToken=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.AUTH_TOKEN_URL,{method:"POST",body:e})]}))}))},e.prototype.getProviders=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this._config.request(o.ApiUrls.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},e.prototype.unbindProvider=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.PROVIDER_UNBIND_URL+"/"+e.provider_id,{method:"DELETE",withCredentials:!0})]}))}))},e.prototype.checkPassword=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(""+o.ApiUrls.CHECK_PWD_URL,{method:"POST",withCredentials:!0,body:e})]}))}))},e.prototype.bindPhone=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(""+o.ApiUrls.BIND_CONTACT_URL,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.bindEmail=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(""+o.ApiUrls.BIND_CONTACT_URL,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.setPassword=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(""+o.ApiUrls.AUTH_SET_PASSWORD,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.updatePasswordByOld=function(e){return n(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.sudo({password:e.old_password})];case 1:return t=r.sent(),[2,this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})]}}))}))},e.prototype.sudo=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(""+o.ApiUrls.SUDO_URL,{method:"POST",withCredentials:!0,body:e})]}))}))},e.prototype.getCurUserVerification=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return e.target="CUR_USER",[2,this._config.request(o.ApiUrls.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})]}))}))},e.prototype.changeBindedProvider=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.PROVIDER_LIST+"/"+e.provider_id+"/trans",{method:"POST",body:{provider_trans_token:e.trans_token},withCredentials:!0})]}))}))},e.prototype.setUserProfile=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})]}))}))},e.prototype.queryUserProfile=function(e){return n(this,void 0,void 0,(function(){var t;return i(this,(function(r){return t=new URLSearchParams(e),[2,this._config.request(o.ApiUrls.USER_QUERY_URL+"?"+t.toString(),{method:"GET",withCredentials:!0})]}))}))},e.prototype.setCustomSignFunc=function(e){this._getCustomSignTicketFn=e},e.prototype.signInWithCustomTicket=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,this._getCustomSignTicketFn()];case 1:return e=t.sent(),[2,this.signInWithProvider({provider_id:"custom",provider_token:e})]}}))}))},e.prototype.resetPassword=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.AUTH_RESET_PASSWORD,{method:"POST",body:e})]}))}))},e.prototype.deviceAuthorize=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.AUTH_GET_DEVICE_CODE,{method:"POST",body:e,withCredentials:!0})]}))}))},e.prototype.checkUsername=function(e){return n(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this._config.request(o.ApiUrls.CHECK_USERNAME,{method:"GET",body:e,withCredentials:!0})]}))}))},e.prototype.checkIfUserExist=function(e){return n(this,void 0,void 0,(function(){var t;return i(this,(function(r){return t=new URLSearchParams(e),[2,this._config.request(o.ApiUrls.CHECK_IF_USER_EXIST+"?"+t.toString(),{method:"GET"})]}))}))},e.prototype.loginScope=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this._config.credentialsClient.getScope()]}))}))},e.parseParamsToSearch=function(e){for(var t in e)e[t]||delete e[t];return new URLSearchParams(e).toString()},e}();t.Auth=a},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4),t)},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&i(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseOAuth=t.authModels=void 0;var u=r(1);Object.defineProperty(t,"Syntax",{enumerable:!0,get:function(){return u.Syntax}}),Object.defineProperty(t,"ErrorType",{enumerable:!0,get:function(){return u.ErrorType}});var a=r(0),c=r(0);Object.defineProperty(t,"defaultStorage",{enumerable:!0,get:function(){return c.defaultStorage}}),Object.defineProperty(t,"defaultRequest",{enumerable:!0,get:function(){return c.defaultRequest}}),Object.defineProperty(t,"toResponseError",{enumerable:!0,get:function(){return c.toResponseError}}),Object.defineProperty(t,"generateRequestId",{enumerable:!0,get:function(){return c.generateRequestId}}),Object.defineProperty(t,"OAuth2Client",{enumerable:!0,get:function(){return c.OAuth2Client}});var l=r(7);Object.defineProperty(t,"AuthClient",{enumerable:!0,get:function(){return l.AuthClient}});var d=r(2),h=r(2);Object.defineProperty(t,"Auth",{enumerable:!0,get:function(){return h.Auth}});var _=s(r(10));t.authModels=_;var f=function(e){var t=e.apiOrigin,r=e.clientId;this.oauth2client=new a.OAuth2Client({apiOrigin:t,clientId:r}),this.authApi=new d.Auth(n({credentialsClient:this.oauth2client},e))};t.CloudbaseOAuth=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uuidv4=void 0,t.uuidv4=function(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function u(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.SinglePromise=void 0;var o=function(){function e(){this._fnPromiseMap=new Map}return e.prototype.run=function(e,t){return n(this,void 0,void 0,(function(){var r,o=this;return i(this,(function(s){return(r=this._fnPromiseMap.get(e))||(r=new Promise((function(r,s){return n(o,void 0,void 0,(function(){var n,o,u;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,4,5]),[4,this._runIdlePromise()];case 1:return i.sent(),n=t(),o=r,[4,n];case 2:return o.apply(void 0,[i.sent()]),[3,5];case 3:return u=i.sent(),s(u),[3,5];case 4:return this._fnPromiseMap.delete(e),[7];case 5:return[2]}}))}))})),this._fnPromiseMap.set(e,r)),[2,r]}))}))},e.prototype._runIdlePromise=function(){return Promise.resolve()},e}();t.SinglePromise=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthClient=void 0;var n=function(){};t.AuthClient=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorType=t.VerificationUsages=t.ApiUrls=void 0,function(e){e.AUTH_SIGN_IN_URL="/auth/v1/signin",e.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",e.AUTH_SIGN_UP_URL="/auth/v1/signup",e.AUTH_TOKEN_URL="/auth/v1/token",e.AUTH_REVOKE_URL="/auth/v1/revoke",e.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",e.PROVIDER_TOKEN_URL="/auth/v1/provider/token",e.PROVIDER_URI_URL="/auth/v1/provider/uri",e.USER_ME_URL="/auth/v1/user/me",e.USER_QUERY_URL="/auth/v1/user/query",e.USER_PRIFILE_URL="/auth/v1/user/profile",e.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",e.VERIFICATION_URL="/auth/v1/verification",e.VERIFY_URL="/auth/v1/verification/verify",e.PROVIDER_LIST="/auth/v1/user/provider",e.PROVIDER_UNBIND_URL="/auth/v1/user/provider",e.CHECK_PWD_URL="/auth/v1/user/sudo",e.SUDO_URL="/auth/v1/user/sudo",e.BIND_CONTACT_URL="/auth/v1/user/contact",e.AUTH_SET_PASSWORD="/auth/v1/user/password",e.AUTH_RESET_PASSWORD="/auth/v1/reset",e.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",e.CHECK_USERNAME="/auth/v1/checkUsername",e.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist"}(t.ApiUrls||(t.ApiUrls={})),function(e){e.REGISTER="REGISTER",e.SIGN_IN="SIGN_IN",e.PASSWORD_RESET="PASSWORD_RESET",e.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",e.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(t.VerificationUsages||(t.VerificationUsages={})),function(e){e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid",e.INVALID_PASSWORD="invalid_password",e.PASSWORD_NOT_SET="password_not_set",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked"}(t.ErrorType||(t.ErrorType={}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function u(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.Captcha=void 0;var o=r(0),s=function(){function e(e){e.openURIWithCallback||(e.openURIWithCallback=this._getDefaultOpenURIWithCallback()),e.storage||(e.storage=o.defaultStorage),this._config=e,this._tokenSectionName="captcha_"+e.clientId}return e.prototype.request=function(e,t){return n(this,void 0,void 0,(function(){var r,n,o,s;return i(this,(function(i){switch(i.label){case 0:return t||(t={}),t.method||(t.method="GET"),r=t.method+":"+e,n=e,t.withCaptcha?[4,this._appendCaptchaTokenToURL(e,r,!1)]:[3,2];case 1:n=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,8]),[4,this._config.request(n,t)];case 3:return o=i.sent(),[3,8];case 4:return"captcha_required"!==(s=i.sent()).error&&"captcha_invalid"!==s.error?[3,6]:[4,this._appendCaptchaTokenToURL(e,r,"captcha_invalid"===s.error)];case 5:return e=i.sent(),[2,this._config.request(e,t)];case 6:return[2,Promise.reject(s)];case 7:return[3,8];case 8:return[2,o]}}))}))},e.prototype._getDefaultOpenURIWithCallback=function(){if(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap")){var e=document.createElement("div");e.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",e.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(e)}),0)}return this._defaultOpenURIWithCallback},e.prototype._defaultOpenURIWithCallback=function(e){return n(this,void 0,void 0,(function(){var t,r;return i(this,(function(n){return t=document.getElementById("captcha_panel_wrap"),r=document.createElement("iframe"),t.innerHTML="",r.setAttribute("src",e),r.setAttribute("id","review-panel-iframe"),r.style.cssText="min-width:355px;display:block;height:355px;margin:0 auto;background-color: rgb(255, 255, 255);border: none;",t.appendChild(r),t.style.display="block",[2,new Promise((function(e,n){r.onload=function(){try{var i=window.location,o=r.contentWindow.location;if(o.host+o.pathname===i.host+i.pathname){t.style.display="none";var s=new URLSearchParams(o.search),u=s.get("captcha_token");return u?e({captcha_token:u,expires_in:Number(s.get("expires_in"))}):n({error:s.get("error"),error_description:s.get("error_description")})}t.style.display="block"}catch(e){t.style.display="block"}}}))]}))}))},e.prototype._getCaptchaToken=function(e,t){return n(this,void 0,void 0,(function(){var r,n,o,s,u;return i(this,(function(i){switch(i.label){case 0:return e?[3,2]:[4,this._findCaptchaToken()];case 1:if(r=i.sent())return[2,r];i.label=2;case 2:return n=window.location.origin+window.location.pathname+"?__captcha=on",[4,this._config.request("/auth/v1/captcha/init",{method:"POST",body:{client_id:this._config.clientId,redirect_uri:n,state:t},withCredentials:!1})];case 3:return(o=i.sent()).captcha_token?(s={captcha_token:o.captcha_token,expires_in:o.expires_in},this._saveCaptchaToken(s),[2,o.captcha_token]):[4,this._config.openURIWithCallback(o.url)];case 4:return u=i.sent(),this._saveCaptchaToken(u),[2,u.captcha_token]}}))}))},e.prototype._appendCaptchaTokenToURL=function(e,t,r){return n(this,void 0,void 0,(function(){var n;return i(this,(function(i){switch(i.label){case 0:return[4,this._getCaptchaToken(r,t)];case 1:return n=i.sent(),e.indexOf("?")>0?e+="&captcha_token="+n:e+="?captcha_token="+n,[2,e]}}))}))},e.prototype._saveCaptchaToken=function(e){return n(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10)),t=JSON.stringify(e),[4,this._config.storage.setItem(this._tokenSectionName,t)];case 1:return r.sent(),[2]}}))}))},e.prototype._findCaptchaToken=function(){return n(this,void 0,void 0,(function(){var e,t;return i(this,(function(r){switch(r.label){case 0:return[4,this._config.storage.getItem(this._tokenSectionName)];case 1:if(null==(e=r.sent()))return[3,5];r.label=2;case 2:return r.trys.push([2,3,,5]),(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at)),t.expires_at<new Date?[2,null]:[2,t.captcha_token];case 3:return r.sent(),[4,this._config.storage.removeItem(this._tokenSectionName)];case 4:return r.sent(),[2,null];case 5:return[2,null]}}))}))},e}();t.Captcha=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0})}])}));
@@ -0,0 +1 @@
1
+ export * from '@cloudbase/oauth';
@@ -0,0 +1,3 @@
1
+ export * from '@cloudbase/oauth';
2
+
3
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsa0JBQWtCLENBQUMiLCJmaWxlIjoiaW5kZXguZXNtLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnQGNsb3VkYmFzZS9vYXV0aCc7XG4iXX0=
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("@cloudbase/oauth"), exports);
14
+
15
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLG1EQUFpQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJ0BjbG91ZGJhc2Uvb2F1dGgnO1xuIl19
16
+
17
+ //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7OztBQUFBLG1EQUFpQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJ0BjbG91ZGJhc2Uvb2F1dGgnO1xuIl19
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@cloudbase/js-sdk/oauth",
3
+ "main": "dist/index.js",
4
+ "module": "dist/index.esm.js",
5
+ "typings": "dist/index.d.ts"
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/js-sdk",
3
- "version": "2.0.0-alpha.7",
3
+ "version": "2.2.0",
4
4
  "description": "cloudbase javascript sdk",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -45,15 +45,15 @@
45
45
  "author": "",
46
46
  "license": "ISC",
47
47
  "dependencies": {
48
- "@cloudbase/analytics": "^2.0.0-alpha.3",
49
- "@cloudbase/app": "^2.0.0-alpha.5",
50
- "@cloudbase/auth": "^2.0.0-alpha.5",
48
+ "@cloudbase/analytics": "^2.0.0-alpha.4",
49
+ "@cloudbase/app": "^2.0.0-alpha.6",
50
+ "@cloudbase/auth": "^2.2.0",
51
51
  "@cloudbase/database": "0.9.18-next",
52
- "@cloudbase/functions": "^2.0.0-alpha.3",
53
- "@cloudbase/realtime": "^2.0.0-alpha.1",
54
- "@cloudbase/storage": "^2.0.0-alpha.3",
55
- "@cloudbase/types": "^2.0.0-alpha.1",
56
- "@cloudbase/utilities": "^2.0.0-alpha.3"
52
+ "@cloudbase/functions": "^2.0.0-alpha.4",
53
+ "@cloudbase/realtime": "^2.0.0-alpha.2",
54
+ "@cloudbase/storage": "^2.0.0-alpha.4",
55
+ "@cloudbase/types": "^2.0.0-alpha.2",
56
+ "@cloudbase/utilities": "^2.0.0-alpha.4"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/core": "^7.9.0",
@@ -88,5 +88,5 @@
88
88
  "not dead",
89
89
  "chrome 53"
90
90
  ],
91
- "gitHead": "22c5407499ecf227e2bd077336578c93ab0ff85a"
91
+ "gitHead": "a3f4ddd730a4348ded548d50cd1f1562fbd05360"
92
92
  }