UNPKG

hexo-theme-miracle

Version:

A clean and lightweight single-column theme for Hexo.

1 lines 500 kB
var root,factory;root=self,factory=function(){return function(){var __webpack_modules__={9215:function(e){"use strict";e.exports=JSON.parse('{"name":"@cloudbase/js-sdk","version":"1.4.1","description":"cloudbase javascript sdk","main":"dist/index.cjs.js","module":"dist/index.esm.js","miniprogram":"miniprogram_dist","typings":"./index.d.ts","scripts":{"lint":"eslint --fix \\"./src/**/*.ts\\" \\"./database/**/*.ts\\"","build":"rm -rf dist/ && gulp build","build:cdn":"gulp cdn","build:miniapp":"gulp miniapp","build:e2e":"rm -rf dist/ && NODE_ENV=e2e gulp e2e"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloudbase-js-sdk"},"keywords":["tcb","cloudbase","Cloudbase","serverless","Serverless","javascript","JavaScript"],"files":["miniprogram_dist","**/dist/","/index.d.ts","**/package.json"],"components":["app","auth","database","functions","storage"],"author":"","license":"ISC","dependencies":{"@cloudbase/analytics":"^1.0.1-alpha.0","@cloudbase/app":"^1.2.6","@cloudbase/auth":"^1.3.6","@cloudbase/database":"0.9.18-next","@cloudbase/functions":"^1.2.5-alpha.0","@cloudbase/realtime":"^1.1.3","@cloudbase/storage":"^1.2.5-alpha.0","@cloudbase/types":"^1.1.2","@cloudbase/utilities":"^1.2.5-alpha.0"},"devDependencies":{"@babel/core":"^7.9.0","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-transform-runtime":"^7.9.0","@babel/preset-env":"^7.9.5","@babel/preset-typescript":"^7.9.0","@typescript-eslint/eslint-plugin":"^3.8.0","@typescript-eslint/parser":"^3.8.0","awesome-typescript-loader":"^5.2.1","babel-loader":"^8.1.0","eslint":"^7.6.0","eslint-config-alloy":"^3.7.4","gulp":"^4.0.2","gulp-clean":"^0.4.0","gulp-rename":"^2.0.0","gulp-sourcemaps":"^2.6.5","gulp-typescript":"^6.0.0-alpha.1","json-loader":"^0.5.7","merge-stream":"^2.0.0","package-json-cleanup-loader":"^1.0.3","typescript":"^3.8.3","webpack":"4.41.3","webpack-cli":"^3.3.11","webpack-node-externals":"^1.7.2","webpack-stream":"^5.2.1","webpack-visualizer-plugin":"^0.1.11"},"browserslist":["last 2 version","> 1%","not dead","chrome 53"],"gitHead":"ec8b299bf34b54f791ce62712b85fad443a7046a"}')},5323:function(e){"use strict";e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports["default"]=e.exports,e.exports.__esModule=!0},9581:function(e){"use strict";e.exports=function(e){if(Array.isArray(e))return e},e.exports["default"]=e.exports,e.exports.__esModule=!0},2263:function(e,t,n){"use strict";var r=n(5323);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports["default"]=e.exports,e.exports.__esModule=!0},7402:function(e){"use strict";function t(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(c){return void n(c)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=e.apply(n,r);function s(e){t(a,i,o,s,u,"next",e)}function u(e){t(a,i,o,s,u,"throw",e)}s(undefined)}))}},e.exports["default"]=e.exports,e.exports.__esModule=!0},506:function(e){"use strict";e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports["default"]=e.exports,e.exports.__esModule=!0},5910:function(e){"use strict";function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e},e.exports["default"]=e.exports,e.exports.__esModule=!0},6247:function(e){"use strict";e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports["default"]=e.exports,e.exports.__esModule=!0},3483:function(e){"use strict";e.exports=function(e){return e&&e.__esModule?e:{"default":e}},e.exports["default"]=e.exports,e.exports.__esModule=!0},2370:function(e,t,n){"use strict";var r=n(3988)["default"];function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}e.exports=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{"default":e};var t=i();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var s=o?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=e[a]}return n["default"]=e,t&&t.set(e,n),n},e.exports["default"]=e.exports,e.exports.__esModule=!0},7561:function(e){"use strict";e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)},e.exports["default"]=e.exports,e.exports.__esModule=!0},1736:function(e){"use strict";e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=undefined;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(u){i=!0,o=u}finally{try{r||null==s["return"]||s["return"]()}finally{if(i)throw o}}return n}},e.exports["default"]=e.exports,e.exports.__esModule=!0},3770:function(e){"use strict";e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports["default"]=e.exports,e.exports.__esModule=!0},6180:function(e){"use strict";e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports["default"]=e.exports,e.exports.__esModule=!0},8461:function(e,t,n){"use strict";var r=n(9581),i=n(1736),o=n(2191),a=n(3770);e.exports=function(e,t){return r(e)||i(e,t)||o(e,t)||a()},e.exports["default"]=e.exports,e.exports.__esModule=!0},1971:function(e,t,n){"use strict";var r=n(2263),i=n(7561),o=n(2191),a=n(6180);e.exports=function(e){return r(e)||i(e)||o(e)||a()},e.exports["default"]=e.exports,e.exports.__esModule=!0},3988:function(e){"use strict";function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports["default"]=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports["default"]=e.exports,e.exports.__esModule=!0),t(n)}e.exports=t,e.exports["default"]=e.exports,e.exports.__esModule=!0},2191:function(e,t,n){"use strict";var r=n(5323);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports["default"]=e.exports,e.exports.__esModule=!0},6304:function(e,t,n){"use strict";e.exports=n(3355)},1588:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3125);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var i=n(9206);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}))},3125:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractStorage=t.AbstractSDKRequest=t.StorageType=void 0,t.StorageType=n,function(e){e.local="local",e.none="none",e.session="session"}(n||(t.StorageType=n={}));var r=function(){};t.AbstractSDKRequest=r;var i=function(){};t.AbstractStorage=i},9206:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatUrl=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),i="";for(var o in n)""===i?!r&&(t+="?"):i+="&",i+=o+"="+encodeURIComponent(n[o]);return/^http(s)?\:\/\//.test(t+=i)?t:""+e+t}},5086:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setSdkVersion=function(e){a=e},t.getSdkVersion=function(){return a},t.setSdkName=function(e){s=e,i(e)},t.getSdkName=function(){return s},t.setEndPoint=d,t.setRegionLevelEndpoint=function(e,t,n){d(t?"//"+e+"."+t+".tcb-api.tencentcloudapi.com/web":"//"+e+".ap-shanghai.tcb-api.tencentcloudapi.com/web",n)},t.getEndPoint=function(){return{BASE_URL:l,PROTOCOL:c}},t.LOGINTYPE=t.DATA_VERSION=void 0;var r=n(1895),i=r.constants.setSdkName,o=r.constants.setProtocol,a="",s="@cloudbase/js-sdk";t.DATA_VERSION="2020-01-10";var u,c="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:",l="//tcb-api.tencentcloudapi.com/web";function d(e,t){l=e,t&&(c=t,o(t))}t.LOGINTYPE=u,function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.CUSTOM="CUSTOM",e.NULL="NULL"}(u||(t.LOGINTYPE=u={}))},2701:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EVENTS=void 0,t.EVENTS={LOGIN_STATE_CHANGED:"loginStateChanged",LOGIN_STATE_EXPIRED:"loginStateExpire",LOGIN_TYPE_CHANGED:"loginTypeChanged",ANONYMOUS_CONVERTED:"anonymousConverted",ACCESS_TOKEN_REFRESHD:"refreshAccessToken"}},9304:function(e,t,n){"use strict";var r=n(3483);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=t.cloudbase=void 0;var i=r(n(3988)),o=n(1895),a=r(n(4934)),s=n(9487),u=n(1510),c=n(1888),l=n(3704),d=n(5086),f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},p=function(e,t,n,r){var o,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":(0,i["default"])(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(s=(a<3?o(s):a>3?o(t,n,s):o(t,n))||s);return a>3&&s&&Object.defineProperty(t,n,s),s},h=function(e,t){if("object"===("undefined"==typeof Reflect?"undefined":(0,i["default"])(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},_=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r["throw"](e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},g=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),"throw":s(1),"return":s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(s){o=[6,s],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},m=o.adapters.useAdapters,v=o.adapters.useDefaultAdapter,y=o.adapters.RUNTIME,b=o.constants.ERRORS,k=o.constants.COMMUNITY_SITE_URL,E=o.utils.printWarn,A=o.helpers.catchErrorsDecorator,I={timeout:15e3,persistence:"session"},w=6e5,C={},D=new(function(){function e(e){this._config=e||this._config,this.authInstance=null}return Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return u.Platform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return(0,c.getCacheByEnvId)(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return(0,c.getLocalCache)(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return(0,l.getRequestByEnvId)(this._config.env)},enumerable:!1,configurable:!0}),e.prototype.init=function(t){if(!t.env)throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"env must not be specified"}));if(u.Platform.adapter||this._useDefaultAdapter(),this.requestClient=new u.Platform.adapter.reqClass({timeout:t.timeout||5e3,timeoutMsg:"["+(0,d.getSdkName)()+"][REQUEST TIMEOUT] request had been abort since didn't finished within"+t.timeout/1e3+"s"}),u.Platform.runtime!==y.WEB){if(!t.appSecret)throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"invalid appSecret"}));var n=u.Platform.adapter.getAppSign?u.Platform.adapter.getAppSign():"";if(t.appSign&&n&&t.appSign!==n)throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"invalid appSign"}));if(n&&(t.appSign=n),!t.appSign)throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"invalid appSign"}))}this._config=f(f({},I),t),this._config.timeout=this._formatTimeout(this._config.timeout);var r=this._config,i=r.env,o=r.persistence,a=r.debug,s=r.timeout,p=r.appSecret,h=r.appSign;(0,c.initCache)({env:i,persistence:o,debug:a,platformInfo:this.platform}),(0,l.initRequest)({env:i,region:t.region||"",timeout:s,appSecret:p,appSign:h}),t.region&&(0,d.setRegionLevelEndpoint)(i,t.region||"");var _=new e(this._config);return _.requestClient=this.requestClient,_},e.prototype.updateConfig=function(e){var t=e.persistence,n=e.debug;this._config.persistence=t,this._config.debug=n,(0,c.initCache)({env:this._config.env,persistence:t,debug:n,platformInfo:this.platform})},e.prototype.registerExtension=function(e){C[e.name]=e},e.prototype.invokeExtension=function(e,t){return _(this,void 0,void 0,(function(){var n;return g(this,(function(r){switch(r.label){case 0:if(!(n=C[e]))throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"extension:"+e+" must be registered before invoke"}));return[4,n.invoke(t,this)];case 1:return[2,r.sent()]}}))}))},e.prototype.useAdapters=function(e){var t=m(e)||{},n=t.adapter,r=t.runtime;n&&(u.Platform.adapter=n),r&&(u.Platform.runtime=r)},e.prototype.registerHook=function(t){(0,s.registerHook)(e,t)},e.prototype.registerComponent=function(t){(0,s.registerComponent)(e,t)},e.prototype.registerVersion=function(e){(0,d.setSdkVersion)(e)},e.prototype.registerSdkName=function(e){(0,d.setSdkName)(e)},e.prototype.registerEndPoint=function(e,t){(0,d.setEndPoint)(e,t)},e.prototype._useDefaultAdapter=function(){var e=v(),t=e.adapter,n=e.runtime;u.Platform.adapter=t,u.Platform.runtime=n},e.prototype._formatTimeout=function(e){switch(!0){case e>w:return E(b.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),w;case e<100:return E(b.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},p([A({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv2/adapter.html#jie-ru-liu-cheng)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+k]}),h("design:type",Function),h("design:paramtypes",[Object]),h("design:returntype",e)],e.prototype,"init",null),p([A({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+k]}),h("design:type",Function),h("design:paramtypes",[String,Object]),h("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}());t.cloudbase=D,D.useAdapters(a["default"]);var O=D;t["default"]=O},1510:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Platform=void 0,t.Platform={}},1888:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initCache=function(e){var t=e.env,n=e.persistence,r=e.platformInfo,u={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};a[t]?a[t].updatePersistence(n):a[t]=new o(i(i({},e),{keys:u,platformInfo:r,alwaysLocalKeys:["anonymousUuidKey"]})),s[t]=s[t]||new o(i(i({},e),{keys:u,platformInfo:r,persistence:"local"}))},t.getCacheByEnvId=function(e){return a[e]},t.getLocalCache=function(e){return s[e]};var r=n(1895),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=r.cache.CloudbaseCache,a={},s={}},9487:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerComponent=function(e,t){var n=t.name,r=t.namespace,u=t.entity,c=t.injectEvents,l=t.IIFE,d=void 0!==l&&l;if(a[n]||r&&e[r])throw new Error(JSON.stringify({code:o.INVALID_OPERATION,msg:"Duplicate component "+n}));if(d){if(!u||"function"!=typeof u)throw new Error(JSON.stringify({code:o.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));u.call(e)}if(a[n]=t,r?e.prototype[r]=u:s(e.prototype,u),c){var f=c.bus,p=c.events;if(!f||!p||0===p.length)return;var h=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[n]?e.prototype.events[n].events=i(e.prototype.events[n].events,p):e.prototype.events[n]={bus:f,events:p},e.prototype.fire=function(e,t){for(var n in h(e,t),this.events){var r=this.events[n],i=r.bus;if(r.events.includes(e)){i.fire(e,t);break}}}}},t.registerHook=function(e,t){var n=t.entity,r=t.target;if(!e.prototype.hasOwnProperty(r))throw new Error(JSON.stringify({code:o.INVALID_OPERATION,msg:"target:"+r+" is not exist"}));var a=e.prototype[r];if("function"!=typeof a)throw new Error(JSON.stringify({code:o.INVALID_OPERATION,msg:"target:"+r+" is not a function which is the only type supports hook"}));e.prototype[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.call.apply(n,i([this],e)),a.call.apply(a,i([this],e))}};var r=n(1895),i=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r},o=r.constants.ERRORS,a={};function s(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:e===undefined&&(e={});break;case Array:e=[];break;default:return t}for(var n in t)t.hasOwnProperty(n)&&(e[n]=s(e[n],t[n]));return e}},3704:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initRequest=function(e){E[e.env]=new k(c(c({},e),{"throw":!0}))},t.getRequestByEnvId=function(e){return E[e]},t.CloudbaseRequest=void 0;var r=n(5086),i=n(1895),o=n(9304),a=n(1888),s=n(2701),u=n(1510),c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},l=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r["throw"](e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},d=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),"throw":s(1),"return":s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(s){o=[6,s],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},f=i.constants.ERRORS,p=i.utils.genSeqId,h=i.utils.isFormData,_=i.utils.formatUrl,g=i.utils.createSign,m=i.adapters.RUNTIME,v=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function y(e,t,n){var r=e[t];e[t]=function(t){var i={},o={};n.forEach((function(n){var r=n.call(e,t),a=r.data,s=r.headers;Object.assign(i,a),Object.assign(o,s)}));var a=t.data;return a&&function(){if(h(a))for(var e in i)a.append(e,i[e]);else t.data=c(c({},a),i)}(),t.headers=c(c({},t.headers||{}),o),r.call(e,t)}}function b(){var e=p();return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/"+(0,r.getSdkVersion)(),"x-seqid":e}}}var k=function(){function e(e){this._throwWhenRequestFail=!1,this.config=e,this._reqClass=new u.Platform.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在"+this.config.timeout/1e3+"s内未完成,已中断",restrictedMethods:["post"]}),this._throwWhenRequestFail=e["throw"]||!1,this._cache=(0,a.getCacheByEnvId)(this.config.env),this._localCache=(0,a.getLocalCache)(this.config.env),y(this._reqClass,"post",[b]),y(this._reqClass,"upload",[b]),y(this._reqClass,"download",[b])}return e.prototype.post=function(e){return l(this,void 0,void 0,(function(){return d(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 l(this,void 0,void 0,(function(){return d(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 l(this,void 0,void 0,(function(){return d(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 l(this,void 0,void 0,(function(){var e,t,n;return d(this,(function(r){switch(r.label){case 0:this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken()),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._refreshAccessTokenPromise];case 2:return e=r.sent(),[3,4];case 3:return n=r.sent(),t=n,[3,4];case 4:if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return[2,e]}}))}))},e.prototype.getAccessToken=function(){return l(this,void 0,void 0,(function(){var e,t,n,r,i,o,a,s,u;return d(this,(function(c){switch(c.label){case 0:return e=this._cache.keys,t=e.accessTokenKey,n=e.accessTokenExpireKey,r=e.refreshTokenKey,[4,this._cache.getStoreAsync(r)];case 1:if(!c.sent())throw new Error(JSON.stringify({code:f.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(t)];case 2:return i=c.sent(),a=Number,[4,this._cache.getStoreAsync(n)];case 3:return o=a.apply(void 0,[c.sent()]),s=!0,(u=this._shouldRefreshAccessTokenHook)?[4,this._shouldRefreshAccessTokenHook(i,o)]:[3,5];case 4:u=!c.sent(),c.label=5;case 5:return u&&(s=!1),i&&o&&!(o<Date.now())||!s?[3,7]:[4,this.refreshAccessToken()];case 6:return[2,c.sent()];case 7:return[2,{accessToken:i,accessTokenExpire:o}]}}))}))},e.prototype.request=function(e,t,n){return l(this,void 0,void 0,(function(){var i,o,a,s,l,f,p,h,y,b,k,E,A,I,w,C,D,O,x,M,T,S,N,F,P,R;return d(this,(function(d){switch(d.label){case 0:return i="x-tcb-trace_"+this.config.env,o="application/x-www-form-urlencoded",a=c({action:e,dataVersion:r.DATA_VERSION,env:this.config.env},t),-1!==v.indexOf(e)?[3,3]:(s=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(s)]);case 1:return d.sent()?(l=a,[4,this.getAccessToken()]):[3,3];case 2:l.access_token=d.sent().accessToken,d.label=3;case 3:if("storage.uploadFile"===e){for(p in f=new FormData)f.hasOwnProperty(p)&&f[p]!==undefined&&f.append(p,a[p]);o="multipart/form-data"}else for(p in o="application/json;charset=UTF-8",f={},a)a[p]!==undefined&&(f[p]=a[p]);return h={headers:{"content-type":o}},(null==n?void 0:n.onUploadProgress)&&(h.onUploadProgress=n.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(y=this._localCache.getStore(i))&&(h.headers["X-TCB-Trace"]=y),u.Platform.runtime!==m.WEB&&(b=this.config,k=b.appSign,E=b.appSecret,A=Date.now(),I=E.appAccessKey,w=E.appAccessKeyId,C=g({data:f,timestamp:A,appAccessKeyId:w,appSign:k},I),h.headers["X-TCB-App-Source"]="timestamp="+A+";appAccessKeyId="+w+";appSign="+k+";sign="+C),D=t.parse,O=t.inQuery,x=t.search,M={env:this.config.env},D&&(M.parse=!0),O&&(M=c(c({},O),M)),T=(0,r.getEndPoint)(),S=T.BASE_URL,N=T.PROTOCOL,F=_(N,S,M),x&&(F+=x),[4,this.post(c({url:F,data:f},h))];case 4:if(P=d.sent(),(R=P.header&&P.header["x-tcb-trace"])&&this._localCache.setStore(i,R),200!==Number(P.status)&&200!==Number(P.statusCode)||!P.data)throw new Error("network request error");return[2,P]}}))}))},e.prototype.send=function(e,t){return void 0===t&&(t={}),l(this,void 0,void 0,(function(){var n;return d(this,(function(r){switch(r.label){case 0:return[4,this.request(e,t,{onUploadProgress:t.onUploadProgress})];case 1:return"ACCESS_TOKEN_EXPIRED"!==(n=r.sent()).data.code||-1!==v.indexOf(e)?[3,4]:[4,this.refreshAccessToken()];case 2:return r.sent(),[4,this.request(e,t,{onUploadProgress:t.onUploadProgress})];case 3:n=r.sent(),r.label=4;case 4:if(n.data.code&&this._throwWhenRequestFail)throw new Error(JSON.stringify({code:f.OPERATION_FAIL,msg:"["+n.data.code+"] "+n.data.message}));return[2,n.data]}}))}))},e.prototype._refreshAccessToken=function(){return l(this,void 0,void 0,(function(){var e,t,n,i,a,u,c,l,p,h,_,g,m;return d(this,(function(d){switch(d.label){case 0:return e=this._cache.keys,t=e.accessTokenKey,n=e.accessTokenExpireKey,i=e.refreshTokenKey,a=e.loginTypeKey,u=e.anonymousUuidKey,[4,this._cache.removeStoreAsync(t)];case 1:return d.sent(),[4,this._cache.removeStoreAsync(n)];case 2:return d.sent(),[4,this._cache.getStoreAsync(i)];case 3:if(!(c=d.sent()))throw new Error(JSON.stringify({code:f.INVALID_OPERATION,msg:"not login"}));return l={refresh_token:c},[4,this.request("auth.fetchAccessTokenWithRefreshToken",l)];case 4:return(p=d.sent()).data.code?"SIGN_PARAM_INVALID"!==(h=p.data.code)&&"REFRESH_TOKEN_EXPIRED"!==h&&"INVALID_REFRESH_TOKEN"!==h?[3,11]:[4,this._cache.getStoreAsync(a)]:[3,12];case 5:return d.sent()===r.LOGINTYPE.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===h?[4,this._cache.getStoreAsync(u)]:[3,9];case 6:return _=d.sent(),[4,this._cache.getStoreAsync(i)];case 7:return g=d.sent(),[4,this.send("auth.signInAnonymously",{anonymous_uuid:_,refresh_token:g})];case 8:return m=d.sent(),this._setRefreshToken(m.refresh_token),[2,this._refreshAccessToken()];case 9:return o.cloudbase.fire(s.EVENTS.LOGIN_STATE_EXPIRED),[4,this._cache.removeStoreAsync(i)];case 10:d.sent(),d.label=11;case 11:throw new Error(JSON.stringify({code:f.NETWORK_ERROR,msg:"refresh access_token failed:"+p.data.code}));case 12:return p.data.access_token?(o.cloudbase.fire(s.EVENTS.ACCESS_TOKEN_REFRESHD),[4,this._cache.setStoreAsync(t,p.data.access_token)]):[3,15];case 13:return d.sent(),[4,this._cache.setStoreAsync(n,p.data.access_token_expire+Date.now())];case 14:return d.sent(),[2,{accessToken:p.data.access_token,accessTokenExpire:p.data.access_token_expire}];case 15:return p.data.refresh_token?[4,this._cache.removeStoreAsync(i)]:[3,19];case 16:return d.sent(),[4,this._cache.setStoreAsync(i,p.data.refresh_token)];case 17:return d.sent(),[4,this._refreshAccessToken()];case 18:d.sent(),d.label=19;case 19:return[2]}}))}))},e.prototype._setRefreshToken=function(e){return l(this,void 0,void 0,(function(){var t,n,r,i;return d(this,(function(o){switch(o.label){case 0:return t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,i=t.refreshTokenKey,[4,this._cache.removeStoreAsync(n)];case 1:return o.sent(),[4,this._cache.removeStoreAsync(r)];case 2:return o.sent(),[4,this._cache.setStoreAsync(i,e)];case 3:return o.sent(),[2]}}))}))},e}();t.CloudbaseRequest=k;var E={}},627:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LOGINTYPE=void 0,t.LOGINTYPE=n,function(e){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.NULL="NULL"}(n||(t.LOGINTYPE=n={}))},2198:function(e,t,n){"use strict";var r=n(3483);Object.defineProperty(t,"__esModule",{value:!0}),t.registerAuth=function(e){try{e.registerComponent(M)}catch(t){console.warn(t)}},t.registerProvider=function(e,t){O.prototype[e]=function(n){var r="_"+e;return this[r]||(this[r]=new t(p(p({},n),this._config))),this[r]}},Object.defineProperty(t,"AuthProvider",{enumerable:!0,get:function(){return l.AuthProvider}}),t.eventBus=t.EVENTS=t.Auth=t.LoginState=void 0;var i=r(n(3988)),o=n(1895),a=n(9368),s=n(1424),u=n(8432),c=n(627),l=n(2251),d=n(4368),f=n(5518),p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},h=function(e,t,n,r){var o,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":(0,i["default"])(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(s=(a<3?o(s):a>3?o(t,n,s):o(t,n))||s);return a>3&&s&&Object.defineProperty(t,n,s),s},_=function(e,t){if("object"===("undefined"==typeof Reflect?"undefined":(0,i["default"])(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},g=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r["throw"](e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},m=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),"throw":s(1),"return":s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(s){o=[6,s],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},v=o.events.CloudbaseEventEmitter,y=o.adapters.RUNTIME,b=o.utils.printWarn,k=o.utils.throwError,E=o.constants.ERRORS,A=o.constants.COMMUNITY_SITE_URL,I=o.helpers.catchErrorsDecorator,w=new v;t.eventBus=w;var C=function(){function e(e){var t=e.cache,n=e.request;this._cache=t,this._request=n,this._setUserInfo()}return e.prototype.checkLocalInfo=function(){return g(this,void 0,void 0,(function(){return m(this,(function(e){return this.uid=this._getLocalUserInfo("uid"),this.loginType=this._getLocalUserInfo("loginType"),this.openid=this._getLocalUserInfo("wxOpenId"),this.wxOpenId=this._getLocalUserInfo("wxOpenId"),this.wxPublicId=this._getLocalUserInfo("wxPublicId"),this.unionId=this._getLocalUserInfo("wxUnionId"),this.qqMiniOpenId=this._getLocalUserInfo("qqMiniOpenId"),this.customUserId=this._getLocalUserInfo("customUserId"),this.nickName=this._getLocalUserInfo("nickName"),this.gender=this._getLocalUserInfo("gender"),this.avatarUrl=this._getLocalUserInfo("avatarUrl"),this.email=this._getLocalUserInfo("email"),this.hasPassword=Boolean(this._getLocalUserInfo("hasPassword")),this.location={country:this._getLocalUserInfo("country"),province:this._getLocalUserInfo("province"),city:this._getLocalUserInfo("city")},[2]}))}))},e.prototype.checkLocalInfoAsync=function(){return g(this,void 0,void 0,(function(){var e,t,n,r,i,o,a,s,u,c,l,d,f,p,h,_;return m(this,(function(g){switch(g.label){case 0:return e=this,[4,this._getLocalUserInfoAsync("uid")];case 1:return e.uid=g.sent(),t=this,[4,this._getLocalUserInfoAsync("loginType")];case 2:return t.loginType=g.sent(),n=this,[4,this._getLocalUserInfoAsync("wxOpenId")];case 3:return n.openid=g.sent(),r=this,[4,this._getLocalUserInfoAsync("wxOpenId")];case 4:return r.wxOpenId=g.sent(),i=this,[4,this._getLocalUserInfoAsync("wxPublicId")];case 5:return i.wxPublicId=g.sent(),o=this,[4,this._getLocalUserInfoAsync("wxUnionId")];case 6:return o.unionId=g.sent(),a=this,[4,this._getLocalUserInfoAsync("qqMiniOpenId")];case 7:return a.qqMiniOpenId=g.sent(),s=this,[4,this._getLocalUserInfoAsync("customUserId")];case 8:return s.customUserId=g.sent(),u=this,[4,this._getLocalUserInfoAsync("nickName")];case 9:return u.nickName=g.sent(),c=this,[4,this._getLocalUserInfoAsync("gender")];case 10:return c.gender=g.sent(),l=this,[4,this._getLocalUserInfoAsync("avatarUrl")];case 11:return l.avatarUrl=g.sent(),d=this,[4,this._getLocalUserInfoAsync("email")];case 12:return d.email=g.sent(),f=this,p=Boolean,[4,this._getLocalUserInfoAsync("hasPassword")];case 13:return f.hasPassword=p.apply(void 0,[g.sent()]),h=this,_={},[4,this._getLocalUserInfoAsync("country")];case 14:return _.country=g.sent(),[4,this._getLocalUserInfoAsync("province")];case 15:return _.province=g.sent(),[4,this._getLocalUserInfoAsync("city")];case 16:return h.location=(_.city=g.sent(),_),[2]}}))}))},e.prototype.linkWithTicket=function(e){if("string"!=typeof e)throw new Error("ticket must be string");return this._request.send("auth.linkWithTicket",{ticket:e})},e.prototype.linkWithRedirect=function(e){e.signInWithRedirect()},e.prototype.getLinkedUidList=function(){return g(this,void 0,void 0,(function(){var e,t,n,r,i,o;return m(this,(function(a){switch(a.label){case 0:return[4,this._request.send("auth.getLinkedUidList",{})];case 1:for(e=a.sent().data,t=!1,n=e.users,r=0,i=n;r<i.length;r++)if((o=i[r]).wxOpenId&&o.wxPublicId){t=!0;break}return[2,{users:n,hasPrimaryUid:t}]}}))}))},e.prototype.setPrimaryUid=function(e){return this._request.send("auth.setPrimaryUid",{uid:e})},e.prototype.unlink=function(e){return this._request.send("auth.unlink",{platform:e})},e.prototype.update=function(e){return g(this,void 0,void 0,(function(){var t,n,r,i,o,a,s;return m(this,(function(u){switch(u.label){case 0:return t=e.nickName,n=e.gender,r=e.avatarUrl,i=e.province,o=e.country,a=e.city,[4,this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:r,province:i,country:o,city:a})];case 1:return s=u.sent().data,this._setLocalUserInfo(s),[2]}}))}))},e.prototype.updatePassword=function(e,t){return this._request.send("auth.updatePassword",{oldPassword:t,newPassword:e})},e.prototype.updateEmail=function(e){return this._request.send("auth.updateEmail",{newEmail:e})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&k(E.INVALID_PARAMS,"username must be a string"),this._request.send("auth.updateUsername",{username:e})},e.prototype.refresh=function(){return g(this,void 0,void 0,(function(){var e;return m(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.getUserInfo",{})];case 1:return e=t.sent().data,this._setLocalUserInfo(e),[2,e]}}))}))},e.prototype._getLocalUserInfo=function(e){var t=this._cache.keys.userInfoKey;return this._cache.getStore(t)[e]},e.prototype._getLocalUserInfoAsync=function(e){return g(this,void 0,void 0,(function(){var t;return m(this,(function(n){switch(n.label){case 0:return t=this._cache.keys.userInfoKey,[4,this._cache.getStoreAsync(t)];case 1:return[2,n.sent()[e]]}}))}))},e.prototype._setUserInfo=function(){var e=this,t=this._cache.keys.userInfoKey,n=this._cache.getStore(t);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((function(t){e[t]=n[t]})),this.location={country:n.country,province:n.province,city:n.city}},e.prototype._setLocalUserInfo=function(e){var t=this._cache.keys.userInfoKey;this._cache.setStore(t,e),this._setUserInfo()},h([I({title:"绑定自定义登录失败",messages:["请确认以下各项:"," 1 - 调用 User.linkWithTicket() 的语法或参数是否正确"," 2 - 此账户是否已经绑定自定义登录"," 3 - ticket 参数是否归属当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Promise)],e.prototype,"linkWithTicket",null),h([I({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 User.linkWithRedirect() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方"," 3 - 此第三方是否已经授权","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[Object]),_("design:returntype",void 0)],e.prototype,"linkWithRedirect",null),h([I({title:"获取账户列表失败",messages:["请确认以下各项:"," 1 - 调用 User.getLinkedUidList() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Promise)],e.prototype,"getLinkedUidList",null),h([I({title:"设置微信主账号失败",messages:["请确认以下各项:"," 1 - 调用 User.setPrimaryUid() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",void 0)],e.prototype,"setPrimaryUid",null),h([I({title:"接触绑定失败",messages:["请确认以下各项:"," 1 - 调用 User.unlink() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",void 0)],e.prototype,"unlink",null),h([I({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[Object]),_("design:returntype",Promise)],e.prototype,"update",null),h([I({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",void 0)],e.prototype,"updatePassword",null),h([I({title:"更新邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 User.updateEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",void 0)],e.prototype,"updateEmail",null),h([I({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",void 0)],e.prototype,"updateUsername",null),h([I({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Promise)],e.prototype,"refresh",null),e}(),D=function(){function e(e){var t=e.envId,n=e.cache,r=e.request;t||k(E.INVALID_PARAMS,"envId is not defined"),this._cache=n,this.user=new C({cache:n,request:r})}return e.prototype.checkLocalState=function(){return g(this,void 0,void 0,(function(){var e,t,n,r,i,o,a;return m(this,(function(s){return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,i=this._cache.getStore(t),o=this._cache.getStore(n),a=this._cache.getStore(r),this.credential={refreshToken:i,accessToken:o,accessTokenExpire:a},this._loginType=this._cache.getStore(this._cache.keys.loginTypeKey),this.user.checkLocalInfo(),[2]}))}))},e.prototype.checkLocalStateAsync=function(){return g(this,void 0,void 0,(function(){var e,t,n,r,i,o,a,s;return m(this,(function(u){switch(u.label){case 0:return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,[4,this._cache.getStoreAsync(t)];case 1:return i=u.sent(),[4,this._cache.getStoreAsync(n)];case 2:return o=u.sent(),[4,this._cache.getStoreAsync(r)];case 3:return a=u.sent(),this.credential={refreshToken:i,accessToken:o,accessTokenExpire:a},s=this,[4,this._cache.getStoreAsync(this._cache.keys.loginTypeKey)];case 4:return s._loginType=u.sent(),[4,this.user.checkLocalInfoAsync()];case 5:return u.sent(),[2]}}))}))},Object.defineProperty(e.prototype,"isAnonymousAuth",{get:function(){return this.loginType===c.LOGINTYPE.ANONYMOUS},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCustomAuth",{get:function(){return this.loginType===c.LOGINTYPE.CUSTOM},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isWeixinAuth",{get:function(){return this.loginType===c.LOGINTYPE.WECHAT||this.loginType===c.LOGINTYPE.WECHAT_OPEN||this.loginType===c.LOGINTYPE.WECHAT_PUBLIC},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsernameAuth",{get:function(){return this.loginType===c.LOGINTYPE.USERNAME},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginType",{get:function(){return this._loginType},enumerable:!1,configurable:!0}),e}();t.LoginState=D;var O=function(){function e(e){this._config=e,this._cache=e.cache,this._request=e.request,this._runtime=e.runtime||y.WEB,w.on(x.LOGIN_TYPE_CHANGED,this._onLoginTypeChanged.bind(this))}return Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this._cache.mode){var e=this.hasLoginState();return e&&e.user||null}b(E.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrenUser insteed")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginType",{get:function(){return this._cache.getStore(this._cache.keys.loginTypeKey)},enumerable:!1,configurable:!0}),e.prototype.getCurrenUser=function(){return g(this,void 0,void 0,(function(){var e;return m(this,(function(t){switch(t.label){case 0:return[4,this.getLoginState()];case 1:return(e=t.sent())?[4,e.user.checkLocalInfoAsync()]:[3,3];case 2:return t.sent(),[2,e.user||null];case 3:return[2,null]}}))}))},e.prototype.getLoginType=function(){return g(this,void 0,void 0,(function(){return m(this,(function(e){switch(e.label){case 0:return[4,this._cache.getStoreAsync(this._cache.keys.loginTypeKey)];case 1:return[2,e.sent()]}}))}))},e.prototype.getAccessToken=function(){return g(this,void 0,void 0,(function(){var e;return m(this,(function(t){switch(t.label){case 0:return e={},[4,this._request.getAccessToken()];case 1:return[2,(e.accessToken=t.sent().accessToken,e.env=this._config.env,e)]}}))}))},e.prototype.weixinAuthProvider=function(e){var t=e.appid,n=e.scope,r=e.state;return this._weixinAuthProvider||(this._weixinAuthProvider=new a.WeixinAuthProvider(p(p({},this._config),{cache:this._cache,request:this._request,runtime:this._runtime}),t,n,r)),this._weixinAuthProvider},e.prototype.anonymousAuthProvider=function(){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new s.AnonymousAuthProvider(p(p({},this._config),{cache:this._cache,request:this._request}))),this._anonymousAuthProvider},e.prototype.customAuthProvider=function(){return this._customAuthProvider||(this._customAuthProvider=new u.CustomAuthProvider(p(p({},this._config),{cache:this._cache,request:this._request}))),this._customAuthProvider},e.prototype.emailAuthProvider=function(){return this._emailAuthProvider||(this._emailAuthProvider=new d.EmailAuthProvider(p(p({},this._config),{cache:this._cache,request:this._request}))),this._emailAuthProvider},e.prototype.usernameAuthProvider=function(){return this._usernameAuthProvider||(this._usernameAuthProvider=new f.UsernameAuthProvider(p(p({},this._config),{cache:this._cache,request:this._request}))),this._usernameAuthProvider},e.prototype.signInWithUsernameAndPassword=function(e,t){return g(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this.usernameAuthProvider().signIn(e,t)]}))}))},e.prototype.isUsernameRegistered=function(e){return g(this,void 0,void 0,(function(){var t;return m(this,(function(n){switch(n.label){case 0:return"string"!=typeof e&&k(E.INVALID_PARAMS,"username must be a string"),[4,this._request.send("auth.isUsernameRegistered",{username:e})];case 1:return[2,null==(t=n.sent().data)?void 0:t.isRegistered]}}))}))},e.prototype.signInWithEmailAndPassword=function(e,t){return g(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this.emailAuthProvider().signIn(e,t)]}))}))},e.prototype.signUpWithEmailAndPassword=function(e,t){return g(this,void 0,void 0,(function(){return m(this,(function(n){return[2,this.emailAuthProvider().signUp(e,t)]}))}))},e.prototype.sendPasswordResetEmail=function(e){return g(this,void 0,void 0,(function(){return m(this,(function(t){return[2,this.emailAuthProvider().resetPassword(e)]}))}))},e.prototype.signOut=function(){return g(this,void 0,void 0,(function(){var e,t,n,r,i,o,a;return m(this,(function(s){switch(s.label){case 0:return[4,this.getLoginType()];case 1:if(s.sent()===c.LOGINTYPE.ANONYMOUS)throw new Error(JSON.stringify({code:E.INVALID_OPERATION,msg:"anonymous user doesn't support signOut action"}));return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,i="auth.logout",[4,this._cache.getStoreAsync(t)];case 2:return(o=s.sent())?[4,this._request.send(i,{refresh_token:o})]:[2];case 3:return a=s.sent(),this._cache.removeStoreAsync(t),this._cache.removeStoreAsync(n),this._cache.removeStoreAsync(r),w.fire(x.LOGIN_STATE_CHANGED),w.fire(x.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:c.LOGINTYPE.NULL,persistence:this._config.persistence}),[2,a]}}))}))},e.prototype.onLoginStateChanged=function(e){return g(this,void 0,void 0,(function(){var t,n=this;return m(this,(function(r){switch(r.label){case 0:return w.on(x.LOGIN_STATE_CHANGED,(function(){return g(n,void 0,void 0,(function(){var t;return m(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))})),[4,this.getLoginState()];case 1:return t=r.sent(),e.call(this,t),[2]}}))}))},e.prototype.onLoginStateExpired=function(e){w.on(x.LOGIN_STATE_EXPIRED,e.bind(this))},e.prototype.onAccessTokenRefreshed=function(e){w.on(x.ACCESS_TOKEN_REFRESHD,e.bind(this))},e.prototype.onAnonymousConverted=function(e){w.on(x.ANONYMOUS_CONVERTED,e.bind(this))},e.prototype.onLoginTypeChanged=function(e){var t=this;w.on(x.LOGIN_TYPE_CHANGED,(function(){return g(t,void 0,void 0,(function(){var t;return m(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))}))},e.prototype.hasLoginState=function(){if("async"!==this._cache.mode){var e=this._cache.keys.refreshTokenKey;if(this._cache.getStore(e)){var t=new D({envId:this._config.env,cache:this._cache,request:this._request});return t.checkLocalState(),t}return null}b(E.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return g(this,void 0,void 0,(function(){var e,t;return m(this,(function(n){switch(n.label){case 0:return e=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(e)];case 1:return n.sent()?[4,(t=new D({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()]:[3,3];case 2:return n.sent(),[2,t];case 3:return[2,null]}}))}))},e.prototype.shouldRefreshAccessToken=function(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)},e.prototype.getUserInfo=function(){return g(this,void 0,void 0,(function(){var e;return m(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.getUserInfo",{})];case 1:return(e=t.sent()).code?[2,e]:[2,p(p({},e.data),{requestId:e.seqId})]}}))}))},e.prototype.getAuthHeader=function(){var e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=this._cache.getStore(t);return{"x-cloudbase-credentials":this._cache.getStore(n)+"/@@/"+r}},e.prototype.getAuthHeaderAsync=function(){return g(this,void 0,void 0,(function(){var e,t,n,r;return m(this,(function(i){switch(i.label){case 0:return[4,this._request.refreshAccessToken()];case 1:return i.sent(),e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,[4,this._cache.getStoreAsync(t)];case 2:return r=i.sent(),[4,this._cache.getStoreAsync(n)];case 3:return[2,{"x-cloudbase-credentials":i.sent()+"/@@/"+r}]}}))}))},e.prototype._onLoginTypeChanged=function(e){return g(this,void 0,void 0,(function(){var t,n,r;return m(this,(function(i){switch(i.label){case 0:return t=e.data,n=t.loginType,r=t.persistence,t.env!==this._config.env?[2]:[4,this._cache.updatePersistenceAsync(r)];case 1:return i.sent(),[4,this._cache.setStoreAsync(this._cache.keys.loginTypeKey,n)];case 2:return i.sent(),[2]}}))}))},h([I({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrenUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Promise)],e.prototype,"getCurrenUser",null),h([I({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+A]}),_("design:typ