@cloudbase/auth 2.7.13-beta.0 → 2.7.14-beta.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,2 +1 @@
|
|
|
1
|
-
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@cloudbase/oauth")):"function"==typeof define&&define.amd?define("tcbauth",["@cloudbase/oauth"],t):"object"==typeof exports?exports.tcbauth=t(require("@cloudbase/oauth")):e.tcbauth=t(e.tcboauth)}("undefined"!=typeof window?window:this,e=>(()=>{"use strict";var t={829:(e,t,r)=>{var n;r.r(t),r.d(t,{AbstractSDKRequest:()=>o,AbstractStorage:()=>i,StorageType:()=>n,formatUrl:()=>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}},105:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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.prototype.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(587)),u=r(894);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e){for(var t=0,r=(0,u.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}}},587:function(e,t,r){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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((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(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var u=r(829),c=r(894),l=r(652),d=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=e.method,s=e.headers,a=void 0===s?{}:s,u={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",c=new FormData;return"post"===u?(Object.keys(t).forEach((function(e){c.append(e,t[e])})),c.append("key",n),c.append("file",r),this.request(i(i({},e),{data:c,method:u}),this.restrictedMethods.includes("upload"))):this.request(i(i({},e),{method:"put",headers:a,body:r}),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.fetch=function(e){return s(this,void 0,void 0,(function(){var t,r,n,o,s,u,c,l,d=this;return a(this,(function(a){switch(a.label){case 0:return t=e.url,r=e.enableAbort,n=void 0!==r&&r,o=e.stream,s=void 0!==o&&o,u=new AbortController,c=null,n&&this.timeout&&(c=setTimeout((function(){console.warn(d.timeoutMsg),u.abort(d.timeoutMsg)}),this.timeout)),[4,fetch(t,i(i({},e),{signal:u.signal})).then((function(e){return clearTimeout(c),e})).catch((function(e){return clearTimeout(c),Promise.reject(e)}))];case 1:return l=a.sent(),[2,{data:s?l.body:l.json(),statusCode:l.status,header:l.headers}]}}))}))},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,u=e.headers,d=void 0===u?{}:u,h=e.data,f=e.responseType,p=e.withCredentials,y=e.body,b=e.onUploadProgress,m=(0,c.formatUrl)((0,l.getProtocol)(),a,"get"===n?h:{}),_=new XMLHttpRequest;_.open(n,m),f&&(_.responseType=f),Object.keys(d).forEach((function(e){_.setRequestHeader(e,d[e])})),b&&_.upload.addEventListener("progress",b),_.onreadystatechange=function(){var e={};if(4===_.readyState){var t=_.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=_.status;try{e.data="blob"===f?_.response:JSON.parse(_.responseText)}catch(t){e.data="blob"===f?_.response:_.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=(0,c.isFormData)(h)?h:"application/x-www-form-urlencoded"===d["content-type"]?(0,c.toQueryString)(h):y||(h?JSON.stringify(h):void 0),p&&(_.withCredentials=!0),_.send(s)}))},t}(u.AbstractSDKRequest);t.WebRequest=d,t.genAdapter=function(){return{root:window,reqClass:d,wsClass:WebSocket,localStorage:localStorage}}},652:(e,t)=>{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 r="@cloudbase/js-sdk";t.setSdkName=function(e){r=e},t.getSdkName=function(){return r};var n="https:";t.setProtocol=function(e){n=e},t.getProtocol=function(){return n},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},151:(e,t)=>{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"}},141:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(r(652),t),o(r(151),t),t.OATUH_LOGINTYPE="constants"},64:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((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(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.catchErrorsDecorator=void 0;var i=r(894),s=r(141),a=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(a=-1!==navigator.userAgent.indexOf("Firefox"));var u=a?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,c=/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"),u=a?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),l=a?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),d=s.findIndex((function(e){return u.test(e)}));if(-1!==d){var h=s.filter((function(e,t){return t>d}));h.unshift(s[d].replace(l,"".concat(r,".").concat(n)).replace(c,o)),(i=new Error).stack="".concat(a?"@debugger":"Error","\n").concat(h.join("\n"))}return i}t.catchErrorsDecorator=function(e){var t=e.mode,r=void 0===t?"async":t,a=e.customInfo,d=void 0===a?{}:a,h=e.title,f=e.messages,p=void 0===f?[]:f;return function(e,t,a){if(s.IS_DEBUG_MODE){var f=d.className||e.constructor.name,y=d.methodName||t,b=a.value,m=function(e){var t="",r=e.stack.split("\n"),n=r.findIndex((function(e){return u.test(e)}));if(-1!==n){var o=c.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:f,methodName:y,sourceLink:m});try{return b.apply(this,e)}catch(e){var n=e,o=e.message,s=e.error,a=e.error_description,u={title:h||"".concat(f,".").concat(y," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var c=JSON.parse(o);u.subtitle=o,c.code&&(r?(r.code=c.code,r.msg=c.msg):(e.code=c.code,e.message=c.msg),n=r||e,u.content=p.map((function(e){return{type:"info",body:e}})))}throw s&&a&&(u.subtitle=a,r?(r.code=s,r.msg=a):(e.code=s,e.message=a),n=r||e,u.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(u),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,u,c,d;return o(this,(function(o){switch(o.label){case 0:t=l({err:new Error,className:f,methodName:y,sourceLink:m}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,b.apply(this,e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,s=r.message,a=r.error,u=r.error_description,c={title:h||"".concat(f,".").concat(y," failed"),content:[{type:"error",body:r}]},s&&/^\{.*\}$/.test(s)&&(d=JSON.parse(s),c.subtitle=d,d.code&&(t?(t.code=d.code,t.message=d.msg):(r.code=d.code,r.message=d.msg),n=t||r,c.content=p.map((function(e){return{type:"info",body:e}})))),a&&u&&(c.subtitle=u,t?(t.code=a,t.msg=u):(r.code=a,r.message=u),n=t||r,c.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(c),n;case 4:return[2]}}))}))}}}}},466:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}: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||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(64),t)},418:function(e,t,r){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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((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(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var a=r(829),u=r(894),c=r(141),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);var d=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":return t.localStorage?t.localStorage:((0,u.printWarn)(c.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root));case"none":return new l(t.root);default:return t.localStorage?t.localStorage:((0,u.printWarn)(c.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root))}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.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:c.ERRORS.OPERATION_FAIL,msg:"[".concat((0,c.getSdkName)(),"][").concat(c.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.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]}}))}))},e.prototype.getStore=function(e,t){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(n=o.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.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]}}))}))},e}();t.CloudbaseCache=d},988:function(e,t,r){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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var s=r(894);var a=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=a;var u=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=u;var c=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((0,s.isInstanceOf)(e,u))return console.error(e.error),this;var r=(0,s.isString)(e)?new a(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,c=this.listeners[n]?i([],this.listeners[n],!0):[];o<c.length;o++){c[o].call(this,r)}}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=c;var l=new c;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)}},894:(e,t,r)=>{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.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var n=r(141);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.generateRequestId=function(){var e=(new Date).getTime(),t=(null===performance||void 0===performance?void 0:performance.now)&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),("x"===r?n:7&n|8).toString(16)}))},t.formatUrl=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";return Object.keys(r).forEach((function(e){""===o?!n&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(r[e]))})),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)},t.toQueryString=function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(r){t.push("".concat(r,"=").concat(encodeURIComponent(e[r])))})),t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||window.location.search,n=new RegExp("(^|&)".concat(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("[#?&/]".concat(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="".concat(r,"?").concat(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("[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t))},t.printError=function(e,t){console.error({code:e,msg:"[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t)})},t.printInfo=function(e,t){console.log("[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t))},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(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,u=e.collapsed;void 0!==u&&u?console.groupCollapsed(t,n):console.group(t,n);for(var c=0,l=i;c<l.length;c++){var d=l[c],h=d.type,f=d.body;switch(h){case"info":console.log(f);break;case"warn":console.warn(f);break;case"error":console.error(f)}}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".concat(e)}},297:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e].call(i.exports,i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{Auth:()=>Qn,LoginState:()=>Hn,generateAuthInstance:()=>Gn,registerAuth:()=>Jn});var e=n(297),t=n(894),r=n(141),i=n(466),s=n(988),a=n(418),u=n(829);function c(){}function l(e){return"object"==typeof e&&null!==e||"function"==typeof e}const d=c;function h(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const f=Promise,p=Promise.resolve.bind(f),y=Promise.prototype.then,b=Promise.reject.bind(f),m=p;function _(e){return new f(e)}function v(e){return _(t=>t(e))}function g(e){return b(e)}function w(e,t,r){return y.call(e,t,r)}function S(e,t,r){w(w(e,t,r),void 0,d)}function I(e,t){S(e,t)}function P(e,t){S(e,void 0,t)}function R(e,t,r){return w(e,t,r)}function T(e){w(e,void 0,d)}let O=e=>{if("function"==typeof queueMicrotask)O=queueMicrotask;else{const e=v(void 0);O=t=>w(e,t)}return O(e)};function E(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function A(e,t,r){try{return v(E(e,t,r))}catch(e){return g(e)}}class C{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let n=r+1;const o=e._elements,i=o[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),o[r]=void 0,i}forEach(e){let t=this._cursor,r=this._front,n=r._elements;for(;!(t===n.length&&void 0===r._next||t===n.length&&(r=r._next,n=r._elements,t=0,0===n.length));)e(n[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const k=Symbol("[[AbortSteps]]"),j=Symbol("[[ErrorSteps]]"),q=Symbol("[[CancelSteps]]"),L=Symbol("[[PullSteps]]"),M=Symbol("[[ReleaseSteps]]");function x(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?F(e):"closed"===t._state?function(e){F(e),z(e)}(e):D(e,t._storedError)}function U(e,t){return Yr(e._ownerReadableStream,t)}function W(e){const t=e._ownerReadableStream;"readable"===t._state?B(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){D(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[M](),t._reader=void 0,e._ownerReadableStream=void 0}function N(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function F(e){e._closedPromise=_((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function D(e,t){F(e),B(e,t)}function B(e,t){void 0!==e._closedPromise_reject&&(T(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function z(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const Y=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},$=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function V(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(t+" is not an object.");var r}function H(e,t){if("function"!=typeof e)throw new TypeError(t+" is not a function.")}function Q(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(t+" is not an object.")}function G(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function K(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function J(e){return Number(e)}function X(e){return 0===e?0:e}function Z(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=X(n),!Y(n))throw new TypeError(t+" is not a finite number");if(n=function(e){return X($(e))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return Y(n)&&0!==n?n:0}function ee(e,t){if(!Br(e))throw new TypeError(t+" is not a ReadableStream.")}function te(e){return new se(e)}function re(e,t){e._reader._readRequests.push(t)}function ne(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function oe(e){return e._reader._readRequests.length}function ie(e){const t=e._reader;return void 0!==t&&!!ae(t)}class se{constructor(e){if(G(e,1,"ReadableStreamDefaultReader"),ee(e,"First parameter"),zr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");x(this,e),this._readRequests=new C}get closed(){return ae(this)?this._closedPromise:g(le("closed"))}cancel(e){return ae(this)?void 0===this._ownerReadableStream?g(N("cancel")):U(this,e):g(le("cancel"))}read(){if(!ae(this))return g(le("read"));if(void 0===this._ownerReadableStream)return g(N("read from"));let e,t;const r=_((r,n)=>{e=r,t=n});return ue(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!ae(this))throw le("releaseLock");void 0!==this._ownerReadableStream&&function(e){W(e);ce(e,new TypeError("Reader was released"))}(this)}}function ae(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof se}function ue(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[L](t)}function ce(e,t){const r=e._readRequests;e._readRequests=new C,r.forEach(e=>{e._errorSteps(t)})}function le(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var de,he,fe;function pe(e){return e.slice()}function ye(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(se.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),h(se.prototype.cancel,"cancel"),h(se.prototype.read,"read"),h(se.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(se.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let be=e=>(be="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,be(e)),me=e=>(me="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,me(e));function _e(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return ye(o,0,e,t,n),o}function ve(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(String(t)+" is not a function");return r}}function ge(e){try{const t=e.done,r=e.value;return w(m(r),e=>({done:t,value:e}))}catch(e){return g(e)}}const we=null!==(fe=null!==(de=Symbol.asyncIterator)&&void 0!==de?de:null===(he=Symbol.for)||void 0===he?void 0:he.call(Symbol,"Symbol.asyncIterator"))&&void 0!==fe?fe:"@@asyncIterator";function Se(e){const t=E(e.nextMethod,e.iterator,[]);if(!l(t))throw new TypeError("The iterator.next() method must return an object");return t}class Ie{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?R(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?R(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;let t,r;const n=_((e,n)=>{t=e,r=n});return ue(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,O(()=>t({value:e,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,W(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,W(e),r(t)}}),n}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=U(t,e);return W(t),R(r,()=>({value:e,done:!0}))}return W(t),v({value:e,done:!0})}}const Pe={next(){return Re(this)?this._asyncIteratorImpl.next():g(Te("next"))},return(e){return Re(this)?this._asyncIteratorImpl.return(e):g(Te("return"))},[we](){return this}};function Re(e){if(!l(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Ie}catch(e){return!1}}function Te(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(Pe,we,{enumerable:!1});const Oe=Number.isNaN||function(e){return e!=e};function Ee(e){const t=_e(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function Ae(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Ce(e,t,r){if("number"!=typeof(n=r)||Oe(n)||n<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var n;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function ke(e){e._queue=new C,e._queueTotalSize=0}function je(e){return e===DataView}class qe{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!xe(this))throw at("view");return this._view}respond(e){if(!xe(this))throw at("respond");if(G(e,1,"respond"),e=Z(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(me(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");ot(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!xe(this))throw at("respondWithNewView");if(G(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(me(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");it(this._associatedReadableByteStreamController,e)}}Object.defineProperties(qe.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),h(qe.prototype.respond,"respond"),h(qe.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(qe.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Le{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Me(this))throw ut("byobRequest");return rt(this)}get desiredSize(){if(!Me(this))throw ut("desiredSize");return nt(this)}close(){if(!Me(this))throw ut("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);Xe(this)}enqueue(e){if(!Me(this))throw ut("enqueue");if(G(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);Ze(this,e)}error(e){if(!Me(this))throw ut("error");et(this,e)}[q](e){We(this),ke(this);const t=this._cancelAlgorithm(e);return Je(this),t}[L](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void tt(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let n;try{n=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const o={buffer:n,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}re(t,e),Ue(this)}[M](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new C,this._pendingPullIntos.push(e)}}}function Me(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof Le}function xe(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof qe}function Ue(e){(function(e){const t=e._controlledReadableByteStream;if("readable"!==t._state)return!1;if(e._closeRequested)return!1;if(!e._started)return!1;if(ie(t)&&oe(t)>0)return!0;if(ft(t)&&ht(t)>0)return!0;return nt(e)>0})(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,S(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Ue(e)),null),t=>(et(e,t),null))))}function We(e){He(e),e._pendingPullIntos=new C}function Ne(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=Fe(t);"default"===t.readerType?ne(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function Fe(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function De(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function Be(e,t,r,n){let o;try{o=_e(t,r,r+n)}catch(t){throw et(e,t),t}De(e,o,0,n)}function ze(e,t){t.bytesFilled>0&&Be(e,t.buffer,t.byteOffset,t.bytesFilled),Ke(e)}function Ye(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r;let o=r,i=!1;const s=n-n%t.elementSize;s>=t.minimumFill&&(o=s-t.bytesFilled,i=!0);const a=e._queue;for(;o>0;){const r=a.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;ye(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?a.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,$e(e,n,t),o-=n}return i}function $e(e,t,r){r.bytesFilled+=t}function Ve(e){0===e._queueTotalSize&&e._closeRequested?(Je(e),$r(e._controlledReadableByteStream)):Ue(e)}function He(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function Qe(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();Ye(e,t)&&(Ke(e),Ne(e._controlledReadableByteStream,t))}}function Ge(e,t){const r=e._pendingPullIntos.peek();He(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Ke(e);const r=e._controlledReadableByteStream;if(ft(r))for(;ht(r)>0;)Ne(r,Ke(e))}(e,r):function(e,t,r){if($e(0,t,r),"none"===r.readerType)return ze(e,r),void Qe(e);if(r.bytesFilled<r.minimumFill)return;Ke(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;Be(e,r.buffer,t-n,n)}r.bytesFilled-=n,Ne(e._controlledReadableByteStream,r),Qe(e)}(e,t,r),Ue(e)}function Ke(e){return e._pendingPullIntos.shift()}function Je(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Xe(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!=0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw et(e,t),t}}Je(e),$r(t)}}function Ze(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(me(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const s=be(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(me(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");He(e),t.buffer=be(t.buffer),"none"===t.readerType&&ze(e,t)}ie(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;tt(e,t._readRequests.shift())}}(e),0===oe(r)?De(e,s,o,i):(e._pendingPullIntos.length>0&&Ke(e),ne(r,new Uint8Array(s,o,i),!1))):ft(r)?(De(e,s,o,i),Qe(e)):De(e,s,o,i),Ue(e)}function et(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(We(e),ke(e),Je(e),Vr(r,t))}function tt(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,Ve(e);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function rt(e){if(null===e._byobRequest&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(qe.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function nt(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function ot(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===t)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=be(r.buffer),Ge(e,t)}function it(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===t.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const n=t.byteLength;r.buffer=be(t.buffer),Ge(e,n)}function st(e,t,r,n,o,i,s){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,ke(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=s,t._pendingPullIntos=new C,e._readableStreamController=t,S(v(r()),()=>(t._started=!0,Ue(t),null),e=>(et(t,e),null))}function at(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function ut(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function ct(e,t){if("byob"!=(e=""+e))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function lt(e){return new pt(e)}function dt(e,t){e._reader._readIntoRequests.push(t)}function ht(e){return e._reader._readIntoRequests.length}function ft(e){const t=e._reader;return void 0!==t&&!!yt(t)}Object.defineProperties(Le.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),h(Le.prototype.close,"close"),h(Le.prototype.enqueue,"enqueue"),h(Le.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Le.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class pt{constructor(e){if(G(e,1,"ReadableStreamBYOBReader"),ee(e,"First parameter"),zr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Me(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");x(this,e),this._readIntoRequests=new C}get closed(){return yt(this)?this._closedPromise:g(_t("closed"))}cancel(e){return yt(this)?void 0===this._ownerReadableStream?g(N("cancel")):U(this,e):g(_t("cancel"))}read(e,t={}){if(!yt(this))return g(_t("read"));if(!ArrayBuffer.isView(e))return g(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return g(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return g(new TypeError("view's buffer must have non-zero byteLength"));if(me(e.buffer))return g(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return V(e,t),{min:Z(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,t+" has member 'min' that")}}(t,"options")}catch(e){return g(e)}const n=r.min;if(0===n)return g(new TypeError("options.min must be greater than 0"));if(function(e){return je(e.constructor)}(e)){if(n>e.byteLength)return g(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return g(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return g(N("read from"));let o,i;const s=_((e,t)=>{o=e,i=t});return bt(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),s}releaseLock(){if(!yt(this))throw _t("releaseLock");void 0!==this._ownerReadableStream&&function(e){W(e);mt(e,new TypeError("Reader was released"))}(this)}}function yt(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof pt}function bt(e,t,r,n){const o=e._ownerReadableStream;o._disturbed=!0,"errored"===o._state?n._errorSteps(o._storedError):function(e,t,r,n){const o=e._controlledReadableByteStream,i=t.constructor,s=function(e){return je(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:a,byteLength:u}=t,c=r*s;let l;try{l=be(t.buffer)}catch(e){return void n._errorSteps(e)}const d={buffer:l,bufferByteLength:l.byteLength,byteOffset:a,byteLength:u,bytesFilled:0,minimumFill:c,elementSize:s,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(d),void dt(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(Ye(e,d)){const t=Fe(d);return Ve(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return et(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(d),dt(o,n),Ue(e)}else{const e=new i(d.buffer,d.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function mt(e,t){const r=e._readIntoRequests;e._readIntoRequests=new C,r.forEach(e=>{e._errorSteps(t)})}function _t(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function vt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(Oe(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function gt(e){const{size:t}=e;return t||(()=>1)}function wt(e,t){V(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:J(r),size:void 0===n?void 0:St(n,t+" has member 'size' that")}}function St(e,t){return H(e,t),t=>J(e(t))}function It(e,t,r){return H(e,r),r=>A(e,t,[r])}function Pt(e,t,r){return H(e,r),()=>A(e,t,[])}function Rt(e,t,r){return H(e,r),r=>E(e,t,[r])}function Tt(e,t,r){return H(e,r),(r,n)=>A(e,t,[r,n])}function Ot(e,t){if(!jt(e))throw new TypeError(t+" is not a WritableStream.")}Object.defineProperties(pt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),h(pt.prototype.cancel,"cancel"),h(pt.prototype.read,"read"),h(pt.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(pt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const Et="function"==typeof AbortController;class At{constructor(e={},t={}){void 0===e?e=null:Q(e,"First parameter");const r=wt(t,"Second parameter"),n=function(e,t){V(e,t);const r=null==e?void 0:e.abort,n=null==e?void 0:e.close,o=null==e?void 0:e.start,i=null==e?void 0:e.type,s=null==e?void 0:e.write;return{abort:void 0===r?void 0:It(r,e,t+" has member 'abort' that"),close:void 0===n?void 0:Pt(n,e,t+" has member 'close' that"),start:void 0===o?void 0:Rt(o,e,t+" has member 'start' that"),write:void 0===s?void 0:Tt(s,e,t+" has member 'write' that"),type:i}}(e,"First parameter");if(kt(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=gt(r);!function(e,t,r,n){const o=Object.create(Gt.prototype);let i,s,a,u;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.write?e=>t.write(e,o):()=>v(void 0),a=void 0!==t.close?()=>t.close():()=>v(void 0),u=void 0!==t.abort?e=>t.abort(e):()=>v(void 0),Jt(e,o,i,s,a,u,r,n)}(this,n,vt(r,1),o)}get locked(){if(!jt(this))throw or("locked");return qt(this)}abort(e){return jt(this)?qt(this)?g(new TypeError("Cannot abort a stream that already has a writer")):Lt(this,e):g(or("abort"))}close(){return jt(this)?qt(this)?g(new TypeError("Cannot close a stream that already has a writer")):Nt(this)?g(new TypeError("Cannot close an already-closing stream")):Mt(this):g(or("close"))}getWriter(){if(!jt(this))throw or("getWriter");return Ct(this)}}function Ct(e){return new Bt(e)}function kt(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new C,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function jt(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof At}function qt(e){return void 0!==e._writer}function Lt(e,t){var r;if("closed"===e._state||"errored"===e._state)return v(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const n=e._state;if("closed"===n||"errored"===n)return v(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let o=!1;"erroring"===n&&(o=!0,t=void 0);const i=_((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}});return e._pendingAbortRequest._promise=i,o||Ut(e,t),i}function Mt(e){const t=e._state;if("closed"===t||"errored"===t)return g(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=_((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n}),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&br(n),Ce(o=e._writableStreamController,Qt,0),er(o),r}function xt(e,t){"writable"!==e._state?Wt(e):Ut(e,t)}function Ut(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&$t(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&Wt(e)}function Wt(e){e._state="errored",e._writableStreamController[j]();const t=e._storedError;if(e._writeRequests.forEach(e=>{e._reject(t)}),e._writeRequests=new C,void 0===e._pendingAbortRequest)return void Ft(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Ft(e);S(e._writableStreamController[k](r._reason),()=>(r._resolve(),Ft(e),null),t=>(r._reject(t),Ft(e),null))}function Nt(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function Ft(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&lr(t,e._storedError)}function Dt(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){hr(e)}(r):br(r)),e._backpressure=t}Object.defineProperties(At.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),h(At.prototype.abort,"abort"),h(At.prototype.close,"close"),h(At.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(At.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class Bt{constructor(e){if(G(e,1,"WritableStreamDefaultWriter"),Ot(e,"First parameter"),qt(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!Nt(e)&&e._backpressure?hr(this):pr(this),ur(this);else if("erroring"===t)fr(this,e._storedError),ur(this);else if("closed"===t)pr(this),ur(this),dr(this);else{const t=e._storedError;fr(this,t),cr(this,t)}}get closed(){return zt(this)?this._closedPromise:g(sr("closed"))}get desiredSize(){if(!zt(this))throw sr("desiredSize");if(void 0===this._ownerWritableStream)throw ar("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Zt(t._writableStreamController)}(this)}get ready(){return zt(this)?this._readyPromise:g(sr("ready"))}abort(e){return zt(this)?void 0===this._ownerWritableStream?g(ar("abort")):function(e,t){return Lt(e._ownerWritableStream,t)}(this,e):g(sr("abort"))}close(){if(!zt(this))return g(sr("close"));const e=this._ownerWritableStream;return void 0===e?g(ar("close")):Nt(e)?g(new TypeError("Cannot close an already-closing stream")):Yt(this)}releaseLock(){if(!zt(this))throw sr("releaseLock");void 0!==this._ownerWritableStream&&Vt(this)}write(e){return zt(this)?void 0===this._ownerWritableStream?g(ar("write to")):Ht(this,e):g(sr("write"))}}function zt(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof Bt}function Yt(e){return Mt(e._ownerWritableStream)}function $t(e,t){"pending"===e._readyPromiseState?yr(e,t):function(e,t){fr(e,t)}(e,t)}function Vt(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");$t(e,r),function(e,t){"pending"===e._closedPromiseState?lr(e,t):function(e,t){cr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Ht(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return tr(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return g(ar("write to"));const i=r._state;if("errored"===i)return g(r._storedError);if(Nt(r)||"closed"===i)return g(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return g(r._storedError);const s=function(e){return _((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)})}(r);return function(e,t,r){try{Ce(e,t,r)}catch(t){return void tr(e,t)}const n=e._controlledWritableStream;Nt(n)||"writable"!==n._state||Dt(n,rr(e)),er(e)}(n,t,o),s}Object.defineProperties(Bt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),h(Bt.prototype.abort,"abort"),h(Bt.prototype.close,"close"),h(Bt.prototype.releaseLock,"releaseLock"),h(Bt.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Bt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Qt={};class Gt{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Kt(this))throw ir("abortReason");return this._abortReason}get signal(){if(!Kt(this))throw ir("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e){if(!Kt(this))throw ir("error");"writable"===this._controlledWritableStream._state&&nr(this,e)}[k](e){const t=this._abortAlgorithm(e);return Xt(this),t}[j](){ke(this)}}function Kt(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Gt}function Jt(e,t,r,n,o,i,s,a){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,ke(t),t._abortReason=void 0,t._abortController=function(){if(Et)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=a,t._strategyHWM=s,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const u=rr(t);Dt(e,u),S(v(r()),()=>(t._started=!0,er(t),null),r=>(t._started=!0,xt(e,r),null))}function Xt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Zt(e){return e._strategyHWM-e._queueTotalSize}function er(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void Wt(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===Qt?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Ae(e);const r=e._closeAlgorithm();Xt(e),S(r,()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&dr(t)}(t),null),e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),xt(e,t)}(t,e),null))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r);S(e._writeAlgorithm(t),()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(Ae(e),!Nt(r)&&"writable"===t){const t=rr(e);Dt(r,t)}return er(e),null},t=>("writable"===r._state&&Xt(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,xt(e,t)}(r,t),null))}(e,r)}function tr(e,t){"writable"===e._controlledWritableStream._state&&nr(e,t)}function rr(e){return Zt(e)<=0}function nr(e,t){const r=e._controlledWritableStream;Xt(e),Ut(r,t)}function or(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function ir(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function sr(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function ar(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function ur(e){e._closedPromise=_((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function cr(e,t){ur(e),lr(e,t)}function lr(e,t){void 0!==e._closedPromise_reject&&(T(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function dr(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function hr(e){e._readyPromise=_((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function fr(e,t){hr(e),yr(e,t)}function pr(e){hr(e),br(e)}function yr(e,t){void 0!==e._readyPromise_reject&&(T(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function br(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(Gt.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Gt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const mr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0,_r=function(){const e=null==mr?void 0:mr.DOMException;return function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;if("DOMException"!==e.name)return!1;try{return new e,!0}catch(e){return!1}}(e)?e:void 0}()||function(){const e=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return h(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function vr(e,t,r,n,o,i){const s=te(e),a=Ct(t);e._disturbed=!0;let u=!1,l=v(void 0);return _((d,h)=>{let f;if(void 0!==i){if(f=()=>{const r=void 0!==i.reason?i.reason:new _r("Aborted","AbortError"),s=[];n||s.push(()=>"writable"===t._state?Lt(t,r):v(void 0)),o||s.push(()=>"readable"===e._state?Yr(e,r):v(void 0)),O(()=>Promise.all(s.map(e=>e())),!0,r)},i.aborted)return void f();i.addEventListener("abort",f)}var p,y,b;if(R(e,s._closedPromise,e=>(n?E(!0,e):O(()=>Lt(t,e),!0,e),null)),R(t,a._closedPromise,t=>(o?E(!0,t):O(()=>Yr(e,t),!0,t),null)),p=e,y=s._closedPromise,b=()=>(r?E():O(()=>function(e){const t=e._ownerWritableStream,r=t._state;return Nt(t)||"closed"===r?v(void 0):"errored"===r?g(t._storedError):Yt(e)}(a)),null),"closed"===p._state?b():I(y,b),Nt(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");o?E(!0,t):O(()=>Yr(e,t),!0,t)}function m(){const e=l;return w(l,()=>e!==l?m():void 0)}function R(e,t,r){"errored"===e._state?r(e._storedError):P(t,r)}function O(e,r,n){function o(){return S(e(),()=>A(r,n),e=>A(!0,e)),null}u||(u=!0,"writable"!==t._state||Nt(t)?o():I(m(),o))}function E(e,r){u||(u=!0,"writable"!==t._state||Nt(t)?A(e,r):I(m(),()=>A(e,r)))}function A(e,t){return Vt(a),W(s),void 0!==i&&i.removeEventListener("abort",f),e?h(t):d(void 0),null}T(_((e,t)=>{!function r(n){n?e():w(u?v(!0):w(a._readyPromise,()=>_((e,t)=>{ue(s,{_chunkSteps:t=>{l=w(Ht(a,t),void 0,c),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})),r,t)}(!1)}))})}class gr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!wr(this))throw kr("desiredSize");return Er(this)}close(){if(!wr(this))throw kr("close");if(!Ar(this))throw new TypeError("The stream is not in a state that permits close");Rr(this)}enqueue(e){if(!wr(this))throw kr("enqueue");if(!Ar(this))throw new TypeError("The stream is not in a state that permits enqueue");return Tr(this,e)}error(e){if(!wr(this))throw kr("error");Or(this,e)}[q](e){ke(this);const t=this._cancelAlgorithm(e);return Pr(this),t}[L](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=Ae(this);this._closeRequested&&0===this._queue.length?(Pr(this),$r(t)):Sr(this),e._chunkSteps(r)}else re(t,e),Sr(this)}[M](){}}function wr(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof gr}function Sr(e){Ir(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,S(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Sr(e)),null),t=>(Or(e,t),null))))}function Ir(e){const t=e._controlledReadableStream;return!!Ar(e)&&(!!e._started&&(!!(zr(t)&&oe(t)>0)||Er(e)>0))}function Pr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Rr(e){if(!Ar(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Pr(e),$r(t))}function Tr(e,t){if(!Ar(e))return;const r=e._controlledReadableStream;if(zr(r)&&oe(r)>0)ne(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw Or(e,t),t}try{Ce(e,t,r)}catch(t){throw Or(e,t),t}}Sr(e)}function Or(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(ke(e),Pr(e),Vr(r,t))}function Er(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ar(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Cr(e,t,r,n,o,i,s){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,ke(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=s,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,S(v(r()),()=>(t._started=!0,Sr(t),null),e=>(Or(t,e),null))}function kr(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function jr(e){return l(t=e)&&void 0!==t.getReader?function(e){let t;return t=Nr(c,(function(){let r;try{r=e.read()}catch(r){return g(r)}return R(r,e=>{if(!l(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)Rr(t._readableStreamController);else{const r=e.value;Tr(t._readableStreamController,r)}})}),(function(t){try{return v(e.cancel(t))}catch(t){return g(t)}}),0),t}(e.getReader()):function(e){let t;const r=function e(t,r="sync",n){if(void 0===n)if("async"===r){if(void 0===(n=ve(t,we)))return function(e){const t={next(){let t;try{t=Se(e)}catch(e){return g(e)}return ge(t)},return(t){let r;try{const n=ve(e.iterator,"return");if(void 0===n)return v({done:!0,value:t});r=E(n,e.iterator,[t])}catch(e){return g(e)}return l(r)?ge(r):g(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(e(t,"sync",ve(t,Symbol.iterator)))}else n=ve(t,Symbol.iterator);if(void 0===n)throw new TypeError("The object is not iterable");const o=E(n,t,[]);if(!l(o))throw new TypeError("The iterator method must return an object");return{iterator:o,nextMethod:o.next,done:!1}}(e,"async");return t=Nr(c,(function(){let e;try{e=Se(r)}catch(e){return g(e)}return R(v(e),e=>{if(!l(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)Rr(t._readableStreamController);else{const r=e.value;Tr(t._readableStreamController,r)}})}),(function(e){const t=r.iterator;let n;try{n=ve(t,"return")}catch(e){return g(e)}return void 0===n?v(void 0):R(A(n,t,[e]),e=>{if(!l(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})}),0),t}(e);var t}function qr(e,t,r){return H(e,r),r=>A(e,t,[r])}function Lr(e,t,r){return H(e,r),r=>A(e,t,[r])}function Mr(e,t,r){return H(e,r),r=>E(e,t,[r])}function xr(e,t){if("bytes"!=(e=""+e))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function Ur(e,t){V(e,t);const r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,o=null==e?void 0:e.preventClose,i=null==e?void 0:e.signal;return void 0!==i&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(t+" is not an AbortSignal.")}(i,t+" has member 'signal' that"),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(o),signal:i}}Object.defineProperties(gr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),h(gr.prototype.close,"close"),h(gr.prototype.enqueue,"enqueue"),h(gr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(gr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class Wr{constructor(e={},t={}){void 0===e?e=null:Q(e,"First parameter");const r=wt(t,"Second parameter"),n=function(e,t){V(e,t);const r=e,n=null==r?void 0:r.autoAllocateChunkSize,o=null==r?void 0:r.cancel,i=null==r?void 0:r.pull,s=null==r?void 0:r.start,a=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Z(n,t+" has member 'autoAllocateChunkSize' that"),cancel:void 0===o?void 0:qr(o,r,t+" has member 'cancel' that"),pull:void 0===i?void 0:Lr(i,r,t+" has member 'pull' that"),start:void 0===s?void 0:Mr(s,r,t+" has member 'start' that"),type:void 0===a?void 0:xr(a,t+" has member 'type' that")}}(e,"First parameter");if(Dr(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,r){const n=Object.create(Le.prototype);let o,i,s;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>v(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>v(void 0);const a=t.autoAllocateChunkSize;if(0===a)throw new TypeError("autoAllocateChunkSize must be greater than 0");st(e,n,o,i,s,r,a)}(this,n,vt(r,0))}else{const e=gt(r);!function(e,t,r,n){const o=Object.create(gr.prototype);let i,s,a;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.pull?()=>t.pull(o):()=>v(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>v(void 0),Cr(e,o,i,s,a,r,n)}(this,n,vt(r,1),e)}}get locked(){if(!Br(this))throw Hr("locked");return zr(this)}cancel(e){return Br(this)?zr(this)?g(new TypeError("Cannot cancel a stream that already has a reader")):Yr(this,e):g(Hr("cancel"))}getReader(e){if(!Br(this))throw Hr("getReader");return void 0===function(e,t){V(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:ct(r,t+" has member 'mode' that")}}(e,"First parameter").mode?te(this):lt(this)}pipeThrough(e,t={}){if(!Br(this))throw Hr("pipeThrough");G(e,1,"pipeThrough");const r=function(e,t){V(e,t);const r=null==e?void 0:e.readable;K(r,"readable","ReadableWritablePair"),ee(r,t+" has member 'readable' that");const n=null==e?void 0:e.writable;return K(n,"writable","ReadableWritablePair"),Ot(n,t+" has member 'writable' that"),{readable:r,writable:n}}(e,"First parameter"),n=Ur(t,"Second parameter");if(zr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(qt(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return T(vr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e,t={}){if(!Br(this))return g(Hr("pipeTo"));if(void 0===e)return g("Parameter 1 is required in 'pipeTo'.");if(!jt(e))return g(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=Ur(t,"Second parameter")}catch(e){return g(e)}return zr(this)?g(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):qt(e)?g(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):vr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!Br(this))throw Hr("tee");return pe(function(e,t){return Me(e._readableStreamController)?function(e){let t,r,n,o,i,s=te(e),a=!1,u=!1,c=!1,l=!1,d=!1;const h=_(e=>{i=e});function f(e){P(e._closedPromise,t=>(e!==s||(et(n._readableStreamController,t),et(o._readableStreamController,t),l&&d||i(void 0)),null))}function p(){yt(s)&&(W(s),s=te(e),f(s)),ue(s,{_chunkSteps:t=>{O(()=>{u=!1,c=!1;const r=t;let s=t;if(!l&&!d)try{s=Ee(t)}catch(t){return et(n._readableStreamController,t),et(o._readableStreamController,t),void i(Yr(e,t))}l||Ze(n._readableStreamController,r),d||Ze(o._readableStreamController,s),a=!1,u?b():c&&m()})},_closeSteps:()=>{a=!1,l||Xe(n._readableStreamController),d||Xe(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&ot(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&ot(o._readableStreamController,0),l&&d||i(void 0)},_errorSteps:()=>{a=!1}})}function y(t,r){ae(s)&&(W(s),s=lt(e),f(s));const h=r?o:n,p=r?n:o;bt(s,t,1,{_chunkSteps:t=>{O(()=>{u=!1,c=!1;const n=r?d:l;if(r?l:d)n||it(h._readableStreamController,t);else{let r;try{r=Ee(t)}catch(t){return et(h._readableStreamController,t),et(p._readableStreamController,t),void i(Yr(e,t))}n||it(h._readableStreamController,t),Ze(p._readableStreamController,r)}a=!1,u?b():c&&m()})},_closeSteps:e=>{a=!1;const t=r?d:l,n=r?l:d;t||Xe(h._readableStreamController),n||Xe(p._readableStreamController),void 0!==e&&(t||it(h._readableStreamController,e),!n&&p._readableStreamController._pendingPullIntos.length>0&&ot(p._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{a=!1}})}function b(){if(a)return u=!0,v(void 0);a=!0;const e=rt(n._readableStreamController);return null===e?p():y(e._view,!1),v(void 0)}function m(){if(a)return c=!0,v(void 0);a=!0;const e=rt(o._readableStreamController);return null===e?p():y(e._view,!0),v(void 0)}function g(){}return n=Fr(g,b,(function(n){if(l=!0,t=n,d){const n=pe([t,r]),o=Yr(e,n);i(o)}return h})),o=Fr(g,m,(function(n){if(d=!0,r=n,l){const n=pe([t,r]),o=Yr(e,n);i(o)}return h})),f(s),[n,o]}(e):function(e,t){const r=te(e);let n,o,i,s,a,u=!1,c=!1,l=!1,d=!1;const h=_(e=>{a=e});function f(){return u?(c=!0,v(void 0)):(u=!0,ue(r,{_chunkSteps:e=>{O(()=>{c=!1;const t=e,r=e;l||Tr(i._readableStreamController,t),d||Tr(s._readableStreamController,r),u=!1,c&&f()})},_closeSteps:()=>{u=!1,l||Rr(i._readableStreamController),d||Rr(s._readableStreamController),l&&d||a(void 0)},_errorSteps:()=>{u=!1}}),v(void 0))}function p(){}return i=Nr(p,f,(function(t){if(l=!0,n=t,d){const t=pe([n,o]),r=Yr(e,t);a(r)}return h})),s=Nr(p,f,(function(t){if(d=!0,o=t,l){const t=pe([n,o]),r=Yr(e,t);a(r)}return h})),P(r._closedPromise,e=>(Or(i._readableStreamController,e),Or(s._readableStreamController,e),l&&d||a(void 0),null)),[i,s]}(e)}(this))}values(e){if(!Br(this))throw Hr("values");return function(e,t){const r=te(e),n=new Ie(r,t),o=Object.create(Pe);return o._asyncIteratorImpl=n,o}(this,function(e,t){V(e,"First parameter");const r=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(r)}}(e).preventCancel)}[we](e){return this.values(e)}static from(e){return jr(e)}}function Nr(e,t,r,n=1,o=(()=>1)){const i=Object.create(Wr.prototype);return Dr(i),Cr(i,Object.create(gr.prototype),e,t,r,n,o),i}function Fr(e,t,r){const n=Object.create(Wr.prototype);return Dr(n),st(n,Object.create(Le.prototype),e,t,r,0,void 0),n}function Dr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Br(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof Wr}function zr(e){return void 0!==e._reader}function Yr(e,t){if(e._disturbed=!0,"closed"===e._state)return v(void 0);if("errored"===e._state)return g(e._storedError);$r(e);const r=e._reader;if(void 0!==r&&yt(r)){const e=r._readIntoRequests;r._readIntoRequests=new C,e.forEach(e=>{e._closeSteps(void 0)})}return R(e._readableStreamController[q](t),c)}function $r(e){e._state="closed";const t=e._reader;if(void 0!==t&&(z(t),ae(t))){const e=t._readRequests;t._readRequests=new C,e.forEach(e=>{e._closeSteps()})}}function Vr(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(B(r,t),ae(r)?ce(r,t):mt(r,t))}function Hr(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Qr(e,t){V(e,t);const r=null==e?void 0:e.highWaterMark;return K(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:J(r)}}Object.defineProperties(Wr,{from:{enumerable:!0}}),Object.defineProperties(Wr.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),h(Wr.from,"from"),h(Wr.prototype.cancel,"cancel"),h(Wr.prototype.getReader,"getReader"),h(Wr.prototype.pipeThrough,"pipeThrough"),h(Wr.prototype.pipeTo,"pipeTo"),h(Wr.prototype.tee,"tee"),h(Wr.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Wr.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(Wr.prototype,we,{value:Wr.prototype.values,writable:!0,configurable:!0});const Gr=e=>e.byteLength;h(Gr,"size");class Kr{constructor(e){G(e,1,"ByteLengthQueuingStrategy"),e=Qr(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Xr(this))throw Jr("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Xr(this))throw Jr("size");return Gr}}function Jr(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Xr(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof Kr}Object.defineProperties(Kr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Kr.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Zr=()=>1;h(Zr,"size");class en{constructor(e){G(e,1,"CountQueuingStrategy"),e=Qr(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!rn(this))throw tn("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!rn(this))throw tn("size");return Zr}}function tn(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function rn(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof en}function nn(e,t,r){return H(e,r),r=>A(e,t,[r])}function on(e,t,r){return H(e,r),r=>E(e,t,[r])}function sn(e,t,r){return H(e,r),(r,n)=>A(e,t,[r,n])}function an(e,t,r){return H(e,r),r=>A(e,t,[r])}Object.defineProperties(en.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(en.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class un{constructor(e={},t={},r={}){void 0===e&&(e=null);const n=wt(t,"Second parameter"),o=wt(r,"Third parameter"),i=function(e,t){V(e,t);const r=null==e?void 0:e.cancel,n=null==e?void 0:e.flush,o=null==e?void 0:e.readableType,i=null==e?void 0:e.start,s=null==e?void 0:e.transform,a=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:an(r,e,t+" has member 'cancel' that"),flush:void 0===n?void 0:nn(n,e,t+" has member 'flush' that"),readableType:o,start:void 0===i?void 0:on(i,e,t+" has member 'start' that"),transform:void 0===s?void 0:sn(s,e,t+" has member 'transform' that"),writableType:a}}(e,"First parameter");if(void 0!==i.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==i.writableType)throw new RangeError("Invalid writableType specified");const s=vt(o,0),a=gt(o),u=vt(n,1),c=gt(n);let l;!function(e,t,r,n,o,i){function s(){return t}e._writable=function(e,t,r,n,o=1,i=(()=>1)){const s=Object.create(At.prototype);return kt(s),Jt(s,Object.create(Gt.prototype),e,t,r,n,o,i),s}(s,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?R(e._backpressureChangePromise,()=>{const n=e._writable;if("erroring"===n._state)throw n._storedError;return _n(r,t)}):_n(r,t)}(e,t)}),(function(){return function(e){const t=e._transformStreamController;if(void 0!==t._finishPromise)return t._finishPromise;const r=e._readable;t._finishPromise=_((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r});const n=t._flushAlgorithm();return bn(t),S(n,()=>("errored"===r._state?wn(t,r._storedError):(Rr(r._readableStreamController),gn(t)),null),e=>(Or(r._readableStreamController,e),wn(t,e),null)),t._finishPromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._readable;r._finishPromise=_((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t});const o=r._cancelAlgorithm(t);return bn(r),S(o,()=>("errored"===n._state?wn(r,n._storedError):(Or(n._readableStreamController,t),gn(r)),null),e=>(Or(n._readableStreamController,e),wn(r,e),null)),r._finishPromise}(e,t)}),r,n),e._readable=Nr(s,(function(){return function(e){return fn(e,!1),e._backpressureChangePromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._writable;r._finishPromise=_((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t});const o=r._cancelAlgorithm(t);return bn(r),S(o,()=>("errored"===n._state?wn(r,n._storedError):(tr(n._writableStreamController,t),hn(e),gn(r)),null),t=>(tr(n._writableStreamController,t),hn(e),wn(r,t),null)),r._finishPromise}(e,t)}),o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,fn(e,!0),e._transformStreamController=void 0}(this,_(e=>{l=e}),u,c,s,a),function(e,t){const r=Object.create(pn.prototype);let n,o,i;n=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return mn(r,e),v(void 0)}catch(e){return g(e)}},o=void 0!==t.flush?()=>t.flush(r):()=>v(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>v(void 0),function(e,t,r,n,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n,t._cancelAlgorithm=o,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,n,o,i)}(this,i),void 0!==i.start?l(i.start(this._transformStreamController)):l(void 0)}get readable(){if(!cn(this))throw Sn("readable");return this._readable}get writable(){if(!cn(this))throw Sn("writable");return this._writable}}function cn(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof un}function ln(e,t){Or(e._readable._readableStreamController,t),dn(e,t)}function dn(e,t){bn(e._transformStreamController),tr(e._writable._writableStreamController,t),hn(e)}function hn(e){e._backpressure&&fn(e,!1)}function fn(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=_(t=>{e._backpressureChangePromise_resolve=t}),e._backpressure=t}Object.defineProperties(un.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(un.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class pn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!yn(this))throw vn("desiredSize");return Er(this._controlledTransformStream._readable._readableStreamController)}enqueue(e){if(!yn(this))throw vn("enqueue");mn(this,e)}error(e){if(!yn(this))throw vn("error");var t;t=e,ln(this._controlledTransformStream,t)}terminate(){if(!yn(this))throw vn("terminate");!function(e){const t=e._controlledTransformStream;Rr(t._readable._readableStreamController);dn(t,new TypeError("TransformStream terminated"))}(this)}}function yn(e){return!!l(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof pn}function bn(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function mn(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Ar(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{Tr(n,t)}catch(e){throw dn(r,e),r._readable._storedError}(function(e){return!Ir(e)})(n)!==r._backpressure&&fn(r,!0)}function _n(e,t){return R(e._transformAlgorithm(t),void 0,t=>{throw ln(e._controlledTransformStream,t),t})}function vn(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function gn(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function wn(e,t){void 0!==e._finishPromise_reject&&(T(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Sn(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(pn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),h(pn.prototype.enqueue,"enqueue"),h(pn.prototype.error,"error"),h(pn.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(pn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var In,Pn=(In=function(e,t){return(In=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}In(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Rn=function(){return(Rn=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)},Tn=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},On=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 En=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 Pn(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(r,n){var o=e.url,i=e.data,s=e.headers,a=wx.request({url:(0,u.formatUrl)("https:",o),data:i,timeout:t._timeout,method:"POST",header:s,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{a.abort()}catch(e){}}}})}))},t.prototype.upload=function(e){var t=this,r=this;return new Promise((function(n){return Tn(t,void 0,void 0,(function(){var t,o,i,s,a,u;return On(this,(function(c){return t=e.url,o=e.file,i=e.data,s=e.headers,a=e.onUploadProgress,u=wx.uploadFile({url:t,filePath:o,name:"file",formData:Rn({},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{u.abort()}catch(e){}}}}),a&&u.onProgressUpdate((function(e){a(e)})),[2]}))}))}))},t.prototype.download=function(e){var t=this,r=this;return new Promise((function(n,o){var i=e.url,s=e.headers,a=wx.downloadFile({url:(0,u.formatUrl)("https:",i),header:s,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{a.abort()}catch(e){}}}})}))},t.prototype.fetch=function(e){var t=e.url,r=e.body,n=e.enableAbort,o=e.headers,i=e.method,s=e.stream,a=void 0!==s&&s,c=this,l=null,d=new Wr({start:function(e){l=e},cancel:function(){l=null}});return new Promise((function(e,s){a&&e({data:d});var h=wx.request({url:(0,u.formatUrl)("https:",t),data:r,timeout:c._timeout,method:i.toUpperCase(),header:o,success:function(t){var r;null===(r=l)||void 0===r||r.close(),!a&&e(t)},fail:function(e){var t;if(null===(t=l)||void 0===t||t.close(),s(e),a)throw e},complete:function(e){if(e&&e.errMsg&&(c._timeout&&-1!==c._restrictedMethods.indexOf("post")&&n&&"request:fail timeout"===e.errMsg)){console.warn(c._timeoutMsg);try{h.abort()}catch(e){}}},enableChunked:a});h.onChunkReceived((function(e){var t;null===(t=l)||void 0===t||t.enqueue(e.data)}))}))},t}(u.AbstractSDKRequest),An={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()}},Cn=function(e,t){void 0===t&&(t={});var r=wx.connectSocket(Rn({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}};const kn={genAdapter:function(){return{root:{},reqClass:En,wsClass:Cn,localStorage:An,primaryStorage:u.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"};var jn=n(105),qn=function(){return(qn=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)},Ln=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},Mn=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(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},xn=function(){function e(e){this.localStorage=(null==e?void 0:e.localStorage)||globalThis.localStorage}return e.prototype.getItem=function(e){return Ln(this,void 0,void 0,(function(){return Mn(this,(function(t){return[2,this.localStorage.getItem(e)]}))}))},e.prototype.removeItem=function(e){return Ln(this,void 0,void 0,(function(){return Mn(this,(function(t){return this.localStorage.removeItem(e),[2]}))}))},e.prototype.setItem=function(e,t){return Ln(this,void 0,void 0,(function(){return Mn(this,(function(r){return this.localStorage.setItem(e,t),[2]}))}))},e.prototype.getItemSync=function(e){return this.localStorage.getItem(e)},e.prototype.setItemSync=function(e,t){this.localStorage.setItem(e,t)},e.prototype.removeItemSync=function(e){this.localStorage.removeItem(e)},e}(),Un=/^[^:]+:\/\/[^/]+(\/[^?#]+)/;function Wn(e){return function(t,r){var n;return Ln(this,void 0,void 0,(function(){var o;return Mn(this,(function(i){return o=null===(n=null==r?void 0:r.headers)||void 0===n?void 0:n["x-request-id"],[2,new Promise((function(n,i){var s=Object.assign({},r);s.body&&"string"!=typeof s.body&&(s.body=JSON.stringify(s.body));var a=wx.request({url:t,data:s.body,timeout:e._timeout,method:s.method||"GET",header:s.headers,success:function(e){e.code&&(e={error:e.code,error_description:e.message||e.code,request_id:e.requestId}),e.request_id||(e.request_id=e.request_id||o),e.error&&(e.error_uri=function(e){return Un.test(e)?RegExp.$1:e}(t),i(e)),n(e.data||{})},fail:function(e){i({error:"unreachable",error_description:e.message})},complete:function(t){if(t&&t.errMsg&&(e._timeout&&-1!==e._restrictedMethods.indexOf("request")&&"request:fail timeout"===t.errMsg)){console.warn(e._timeoutMsg);try{a.abort()}catch(e){}}}})}))]}))}))}}var Nn=function(){return(Nn=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)},Fn=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},Dn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Bn=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},zn=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(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Yn="loginStateChanged",$n=new s.CloudbaseEventEmitter,Vn=function(){function e(e){var t=e.cache,r=e.oauthInstance;this.cache=t,this.oauthInstance=r,this.setUserInfo()}return e.prototype.checkLocalInfo=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},e.prototype.checkLocalInfoAsync=function(){return Bn(this,void 0,void 0,(function(){var e,t,r,n;return zn(this,(function(o){switch(o.label){case 0:return e=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return e.uid=o.sent(),t=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return t.gender=o.sent(),this.picture=this.getLocalUserInfo("picture"),r=this,[4,this.getLocalUserInfoAsync("email")];case 3:return r.email=o.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),n=this,[4,this.getLocalUserInfoAsync("username")];case 4:return n.username=o.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},e.prototype.update=function(e){return Bn(this,void 0,void 0,(function(){var t;return zn(this,(function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(Nn({},e))];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2]}}))}))},e.prototype.updateUserBasicInfo=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.updateUserBasicInfo(Nn({},e))];case 1:return t.sent(),this.setLocalUserInfo({username:e.username}),[2]}}))}))},e.prototype.updatePassword=function(e,t){return this.oauthInstance.authApi.updatePasswordByOld({old_password:t,new_password:e})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&(0,t.throwError)(r.ERRORS.INVALID_PARAMS,"username must be a string"),this.update({username:e})},e.prototype.refresh=function(e){return Bn(this,void 0,void 0,(function(){var t;return zn(this,(function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(e)];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2,t]}}))}))},e.prototype.getLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;return this.cache.getStore(t)[e]},e.prototype.getLocalUserInfoAsync=function(e){return Bn(this,void 0,void 0,(function(){var t;return zn(this,(function(r){switch(r.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(t)];case 1:return[2,r.sent()[e]]}}))}))},e.prototype.setUserInfo=function(){var e=this,t=this.cache.keys.userInfoKey,r=this.cache.getStore(t);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(t){e[t]=r[t]}))},e.prototype.setLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;this.cache.setStore(t,e),this.setUserInfo()},Fn([(0,i.catchErrorsDecorator)({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"update",null),Fn([(0,i.catchErrorsDecorator)({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[String,String]),Dn("design:returntype",void 0)],e.prototype,"updatePassword",null),Fn([(0,i.catchErrorsDecorator)({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[String]),Dn("design:returntype",void 0)],e.prototype,"updateUsername",null),Fn([(0,i.catchErrorsDecorator)({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"refresh",null),e}(),Hn=function(){function e(e){var n=e.envId,o=e.cache,i=e.oauthInstance;n||(0,t.throwError)(r.ERRORS.INVALID_PARAMS,"envId is not defined"),this.cache=o,this.oauthInstance=i,this.user=new Vn({cache:this.cache,oauthInstance:i})}return e.prototype.checkLocalState=function(){var e;this.oauthLoginState=null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},e.prototype.checkLocalStateAsync=function(){var e;return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.getLoginState()];case 1:return t.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return t.sent(),[2]}}))}))},e}(),Qn=function(){function e(e){this.config=e,this.cache=e.cache,this.oauthInstance=e.oauthInstance}return e.prototype.bindPhoneNumber=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.editContact(e)]}))}))},e.prototype.unbindProvider=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]}))}))},e.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},e.prototype.verify=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.verify(e)]}))}))},e.prototype.getVerification=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.getVerification(e)]}))}))},Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var e=this.hasLoginState();return e&&e.user||null}(0,t.printWarn)(r.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),e.prototype.getCurrentUser=function(){return Bn(this,void 0,void 0,(function(){var e;return zn(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.signInAnonymously=function(e){return void 0===e&&(e={}),Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signInWithOpenId=function(e){var t=(void 0===e?{}:e).useWxCloud,r=void 0===t||t;return Bn(this,void 0,void 0,(function(){var e,t,n=this;return zn(this,(function(o){switch(o.label){case 0:if(!kn.isMatch())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t=function(t){return Bn(n,void 0,void 0,(function(){var n,o;return zn(this,(function(i){switch(i.label){case 0:n=void 0,o=void 0,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:t,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}},r)];case 2:if((null==(n=i.sent())?void 0:n.error_code)||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:n.provider_token},r)];case 3:if(null==(o=i.sent())?void 0:o.error_code)throw o;return[3,5];case 4:throw i.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(o)];case 6:return i.sent(),[2]}}))}))},[4,new Promise((function(e,r){wx.login({success:function(o){return Bn(n,void 0,void 0,(function(){var n;return zn(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t(o.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return n=i.sent(),r(n),[3,3];case 3:return[2]}}))}))},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})}))];case 1:return o.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signInWithUnionId=function(){return Bn(this,void 0,void 0,(function(){var e=this;return zn(this,(function(t){switch(t.label){case 0:if(!kn.isMatch())throw Error("wx api undefined");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise((function(t,r){var n=wx.getAccountInfoSync().miniProgram;wx.login({success:function(o){return Bn(e,void 0,void 0,(function(){var e,i,s,a,u;return zn(this,(function(c){switch(c.label){case 0:e=null==n?void 0:n.appId,c.label=1;case 1:return c.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:o.code,provider_id:e,provider_params:{provider_code_type:"union_id",appid:null==n?void 0:n.appId}})];case 2:return i=c.sent(),(s=i.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:s})]:(r(i),[2]);case 3:return(null==(a=c.sent())?void 0:a.error_code)?(r(a),[2]):(t(!0),[3,5]);case 4:return u=c.sent(),r(u),[3,5];case 5:return[2]}}))}))},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})}))];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}}))}))},e.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,r=void 0===t?"":t;return Bn(this,void 0,void 0,(function(){var e,t,n,o,i;return zn(this,(function(s){switch(s.label){case 0:if(!kn.isMatch())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:"phone"},provider_id:e.appId},[4,wx.login()];case 1:n=s.sent().code,t.provider_code=n,s.label=2;case 2:return s.trys.push([2,6,,7]),[4,this.oauthInstance.authApi.grantProviderToken(t)];case 3:if((o=s.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.patchProviderToken({provider_token:o.provider_token,provider_id:e.appId,provider_params:{code:r,provider_code_type:"phone"}})];case 4:if((o=s.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:o.provider_token})];case 5:if(null==(i=s.sent())?void 0:i.error_code)throw i;return[3,7];case 6:throw s.sent();case 7:return[2,this.createLoginState()]}}))}))},e.prototype.signInWithSms=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.phoneNum,s=void 0===i?"":i,a=e.bindInfo,u=void 0===a?void 0:a;return Bn(this,void 0,void 0,(function(){var e,t,n,i,a;return zn(this,(function(c){switch(c.label){case 0:return c.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:r.verification_id,verification_code:o})];case 1:if(null==(e=c.sent())?void 0:e.error_code)throw e;return t=e.verification_token,r.is_user?[4,this.oauthInstance.authApi.signIn({username:"+86 ".concat(s),verification_token:t})]:[3,5];case 2:if(null==(n=c.sent())?void 0:n.error_code)throw n;return u?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:null==u?void 0:u.providerToken})]:[3,4];case 3:if(null==(i=c.sent())?void 0:i.error_code)throw i;c.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp({phone_number:"+86 ".concat(s),verification_token:t,provider_token:null==u?void 0:u.providerId})];case 6:if(null==(a=c.sent())?void 0:a.error_code)throw a;c.label=7;case 7:return[2,this.createLoginState()];case 8:throw c.sent();case 9:return[2]}}))}))},e.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},e.prototype.signInWithCustomTicket=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signIn=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.signUp=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signUp(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.setPassword=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.setPassword(e)]}))}))},e.prototype.isUsernameRegistered=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(n){switch(n.label){case 0:return"string"!=typeof e&&(0,t.throwError)(r.ERRORS.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,n.sent().exist]}}))}))},e.prototype.signOut=function(e){return Bn(this,void 0,void 0,(function(){var t,r;return zn(this,(function(n){switch(n.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(e)];case 1:return r=n.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return n.sent(),$n.fire(Yn),[2,r]}}))}))},e.prototype.hasLoginState=function(){var e;if("async"!==this.cache.mode)return(null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync())?new Hn({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;(0,t.printWarn)(r.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return e.sent()?[2,new Hn({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},e.prototype.getUserInfo=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.getUserInfo(e)]}))}))},e.prototype.getWedaUserInfo=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},e.prototype.updateUserBasicInfo=function(e){return Bn(this,void 0,void 0,(function(){var t;return zn(this,(function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return(t=r.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},e.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},e.prototype.bindWithProvider=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]}))}))},e.prototype.queryUser=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]}))}))},e.prototype.getAccessToken=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}}))}))},e.prototype.grantProviderToken=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]}))}))},e.prototype.patchProviderToken=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]}))}))},e.prototype.signInWithProvider=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.signInWithWechat=function(e){return void 0===e&&(e={}),Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.grantToken=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.genProviderRedirectUri=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]}))}))},e.prototype.resetPassword=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]}))}))},e.prototype.deviceAuthorize=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]}))}))},e.prototype.sudo=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.sudo(e)]}))}))},e.prototype.deleteMe=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]}))}))},e.prototype.getProviders=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){return[2,this.oauthInstance.authApi.getProviders()]}))}))},e.prototype.loginScope=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){return[2,this.oauthInstance.authApi.loginScope()]}))}))},e.prototype.loginGroups=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},e.prototype.onLoginStateChanged=function(e){return Bn(this,void 0,void 0,(function(){var t,r=this;return zn(this,(function(n){switch(n.label){case 0:return $n.on(Yn,(function(){return Bn(r,void 0,void 0,(function(){var t;return zn(this,(function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return t=r.sent(),e.call(this,t),[2]}}))}))})),[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))},e.prototype.refreshTokenForce=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]}))}))},e.prototype.getCredentials=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},e.prototype.setCredentials=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.getProviderSubType=function(){return Bn(this,void 0,void 0,(function(){return zn(this,(function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]}))}))},e.prototype.createCaptchaData=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]}))}))},e.prototype.verifyCaptchaData=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]}))}))},e.prototype.getMiniProgramQrCode=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]}))}))},e.prototype.getMiniProgramQrCodeStatus=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]}))}))},e.prototype.modifyPassword=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]}))}))},e.prototype.getUserBehaviorLog=function(e){return Bn(this,void 0,void 0,(function(){return zn(this,(function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]}))}))},e.prototype.createLoginState=function(e){return Bn(this,void 0,void 0,(function(){var t;return zn(this,(function(r){switch(r.label){case 0:return[4,(t=new Hn({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return r.sent(),[4,t.user.refresh(e)];case 2:return r.sent(),$n.fire(Yn),[2,t]}}))}))},Fn([(0,i.catchErrorsDecorator)({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"bindPhoneNumber",null),Fn([(0,i.catchErrorsDecorator)({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"unbindProvider",null),Fn([(0,i.catchErrorsDecorator)({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",void 0)],e.prototype,"bindEmail",null),Fn([(0,i.catchErrorsDecorator)({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"verify",null),Fn([(0,i.catchErrorsDecorator)({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"getVerification",null),Fn([(0,i.catchErrorsDecorator)({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[]),Dn("design:returntype",Promise)],e.prototype,"getCurrentUser",null),Fn([(0,i.catchErrorsDecorator)({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"signInAnonymously",null),Fn([(0,i.catchErrorsDecorator)({title:"小程序openId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序openId静默登录"," 2 - 调用 auth().signInWithOpenId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"signInWithOpenId",null),Fn([(0,i.catchErrorsDecorator)({title:"小程序unionId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序unionId静默登录"," 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[]),Dn("design:returntype",Promise)],e.prototype,"signInWithUnionId",null),Fn([(0,i.catchErrorsDecorator)({title:"小程序手机号授权登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序手机号授权登录"," 2 - 调用 auth().signInWithPhoneAuth() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"signInWithPhoneAuth",null),Fn([(0,i.catchErrorsDecorator)({title:"短信验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序短信验证码登陆"," 2 - 调用 auth().signInWithSms() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"signInWithSms",null),Fn([(0,i.catchErrorsDecorator)({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"signInWithCustomTicket",null),Fn([(0,i.catchErrorsDecorator)({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"signUp",null),Fn([(0,i.catchErrorsDecorator)({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[String]),Dn("design:returntype",Promise)],e.prototype,"isUsernameRegistered",null),Fn([(0,i.catchErrorsDecorator)({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"signOut",null),Fn([(0,i.catchErrorsDecorator)({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[]),Dn("design:returntype",Promise)],e.prototype,"getLoginState",null),Fn([(0,i.catchErrorsDecorator)({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"getUserInfo",null),Fn([(0,i.catchErrorsDecorator)({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[]),Dn("design:returntype",Promise)],e.prototype,"getWedaUserInfo",null),Fn([(0,i.catchErrorsDecorator)({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[Object]),Dn("design:returntype",Promise)],e.prototype,"bindWithProvider",null),Fn([(0,i.catchErrorsDecorator)({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(r.COMMUNITY_SITE_URL)]}),Dn("design:type",Function),Dn("design:paramtypes",[]),Dn("design:returntype",Promise)],e.prototype,"getProviderSubType",null),e}();function Gn(t,r){var n=t.region,o=void 0===n?"ap-shanghai":n,i=(null==r?void 0:r.platform)||(0,jn.useDefaultAdapter)(),s=i.runtime,u=r||{},c=u.env,l=u.clientId,d=u.debug,h=u.cache,f=u.app,p=(r||{}).apiOrigin;p||(p="https://".concat(c,".").concat(o,".tcb-api.tencentcloudapi.com"));var y=new e.CloudbaseOAuth(function(e){if(!kn.isMatch()||e.storage&&e.baseRequest)return e;var t={};try{var r=kn.genAdapter(),n=r.localStorage,o=r.reqClass;if(n&&(t.storage=new xn({localStorage:n})),o){var i=new o({timeout:1e4,restrictedMethods:["get","post","upload","download","request"]});t.request=Wn(i)}return qn(qn({},e),t)}catch(e){console.error("adapter generate fail:",e)}return e}({env:c,clientId:l,apiOrigin:p,storage:null==t?void 0:t.storage,baseRequest:null==t?void 0:t.baseRequest,request:null==t?void 0:t.request,anonymousSignInFunc:null==t?void 0:t.anonymousSignInFunc,captchaOptions:null==t?void 0:t.captchaOptions,wxCloud:null==t?void 0:t.wxCloud}));return{authInstance:new Qn({env:c,region:o,persistence:t.persistence,debug:d,cache:h||new a.CloudbaseCache({persistence:t.persistence,keys:{userInfoKey:"user_info_".concat(c)},platformInfo:i}),runtime:s||"web",_fromApp:f,oauthInstance:y}),oauthInstance:y}}var Kn={name:"auth",namespace:"auth",entity:function(e){if(void 0===e&&(e={region:"",persistence:"local"}),this.authInstance)return(0,t.printWarn)(r.ERRORS.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var n=this.platform.adapter,o=e.persistence||n.primaryStorage;o&&o!==this.config.persistence&&this.updateConfig({persistence:o});var i=Gn(Nn(Nn({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence}),{env:this.config.env,clientId:this.config.clientId,apiOrigin:this.request.getBaseEndPoint(),platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),s=i.authInstance,a=i.oauthInstance;return this.oauthInstance=a,this.authInstance=s,this.authInstance}};try{cloudbase.registerComponent(Kn)}catch(c){}function Jn(e){try{e.registerComponent(Kn)}catch(e){console.warn(e)}}})(),o})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@cloudbase/oauth"),require("@cloudbase/adapter-wx_mp")):"function"==typeof define&&define.amd?define("tcbauth",["@cloudbase/oauth","@cloudbase/adapter-wx_mp"],e):"object"==typeof exports?exports.tcbauth=e(require("@cloudbase/oauth"),require("@cloudbase/adapter-wx_mp")):t.tcbauth=e(t.tcboauth,t.tcbadaptermp)}("undefined"!=typeof window?window:this,(t,e)=>(()=>{"use strict";var n={829:(t,e,n)=>{var r;n.r(e),n.d(e,{AbstractSDKRequest:()=>o,AbstractStorage:()=>i,StorageType:()=>r,formatUrl:()=>s}),function(t){t.local="local",t.none="none",t.session="session"}(r||(r={}));var o=function(){},i=function(){};function s(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";for(var i in n)""===o?!r&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},105:function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var s,a=i(n(587)),c=n(894);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(s=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t){for(var e=0,n=(0,c.isArray)(t)?t:[t];e<n.length;e++){var r=n[e],o=r.isMatch,i=r.genAdapter,s=r.runtime;if(o())return{adapter:i(),runtime:s}}},e.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},587:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},s=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,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(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var c=n(829),u=n(894),h=n(652),p=function(t){function e(e){var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}return o(e,t),e.prototype.get=function(t){return this.request(i(i({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(i(i({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(i(i({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,o=t.method,s=t.headers,a=void 0===s?{}:s,c={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===c?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",r),u.append("file",n),this.request(i(i({},t),{data:u,method:c}),this.restrictedMethods.includes("upload"))):this.request(i(i({},t),{method:"put",headers:a,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return s(this,void 0,void 0,(function(){var e,n,r,o;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(i(i({},t),{headers:{},responseType:"blob"}))];case 1:return e=s.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return s.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){return s(this,void 0,void 0,(function(){var e,n,r,o,s,c,u,h,p=this;return a(this,(function(a){switch(a.label){case 0:return e=t.url,n=t.enableAbort,r=void 0!==n&&n,o=t.stream,s=void 0!==o&&o,c=new AbortController,u=null,r&&this.timeout&&(u=setTimeout((function(){console.warn(p.timeoutMsg),c.abort(p.timeoutMsg)}),this.timeout)),[4,fetch(e,i(i({},t),{signal:c.signal})).then((function(t){return clearTimeout(u),t})).catch((function(t){return clearTimeout(u),Promise.reject(t)}))];case 1:return h=a.sent(),[2,{data:s?h.body:h.json(),statusCode:h.status,header:h.headers}]}}))}))},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=t.url,c=t.headers,p=void 0===c?{}:c,l=t.data,d=t.responseType,f=t.withCredentials,v=t.body,g=t.onUploadProgress,y=(0,u.formatUrl)((0,h.getProtocol)(),a,"get"===r?l:{}),m=new XMLHttpRequest;m.open(r,y),d&&(m.responseType=d),Object.keys(p).forEach((function(t){m.setRequestHeader(t,p[t])})),g&&m.upload.addEventListener("progress",g),m.onreadystatechange=function(){var t={};if(4===m.readyState){var e=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),o=e.join(": ");n[r]=o})),t.header=n,t.statusCode=m.status;try{t.data="blob"===d?m.response:JSON.parse(m.responseText)}catch(e){t.data="blob"===d?m.response:m.responseText}clearTimeout(i),o(t)}},e&&n.timeout&&(i=setTimeout((function(){console.warn(n.timeoutMsg),m.abort()}),n.timeout)),s=(0,u.isFormData)(l)?l:"application/x-www-form-urlencoded"===p["content-type"]?(0,u.toQueryString)(l):v||(l?JSON.stringify(l):void 0),f&&(m.withCredentials=!0),m.send(s)}))},e}(c.AbstractSDKRequest);e.WebRequest=p,e.genAdapter=function(){return{root:window,reqClass:p,wsClass:WebSocket,localStorage:localStorage}}},652:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.COMMUNITY_SITE_URL=e.IS_DEBUG_MODE=e.getProtocol=e.setProtocol=e.getSdkName=e.setSdkName=void 0;var n="@cloudbase/js-sdk";e.setSdkName=function(t){n=t},e.getSdkName=function(){return n};var r="https:";e.setProtocol=function(t){r=t},e.getProtocol=function(){return r},e.IS_DEBUG_MODE=!1,e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},151:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.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"}},141:function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,o(n(652),e),o(n(151),e),e.OATUH_LOGINTYPE="constants"},64:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,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(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.catchErrorsDecorator=void 0;var i=n(894),s=n(141),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 h(t){var e=t.err,n=t.className,r=t.methodName,o=t.sourceLink;if(!o)return null;var i,s=e.stack.split("\n"),c=a?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]\\s*\\(.*\\)$")),h=a?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]")),p=s.findIndex((function(t){return c.test(t)}));if(-1!==p){var l=s.filter((function(t,e){return e>p}));l.unshift(s[p].replace(h,"".concat(n,".").concat(r)).replace(u,o)),(i=new Error).stack="".concat(a?"@debugger":"Error","\n").concat(l.join("\n"))}return i}e.catchErrorsDecorator=function(t){var e=t.mode,n=void 0===e?"async":e,a=t.customInfo,p=void 0===a?{}:a,l=t.title,d=t.messages,f=void 0===d?[]:d;return function(t,e,a){if(s.IS_DEBUG_MODE){var d=p.className||t.constructor.name,v=p.methodName||e,g=a.value,y=function(t){var e="",n=t.stack.split("\n"),r=n.findIndex((function(t){return c.test(t)}));if(-1!==r){var o=u.exec(n[r+1]||"");e=o?o[0]:""}return e}(new Error);a.value="sync"===n?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=h({err:new Error,className:d,methodName:v,sourceLink:y});try{return g.apply(this,t)}catch(t){var r=t,o=t.message,s=t.error,a=t.error_description,c={title:l||"".concat(d,".").concat(v," failed"),content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var u=JSON.parse(o);c.subtitle=o,u.code&&(n?(n.code=u.code,n.msg=u.msg):(t.code=u.code,t.message=u.msg),r=n||t,c.content=f.map((function(t){return{type:"info",body:t}})))}throw s&&a&&(c.subtitle=a,n?(n.code=s,n.msg=a):(t.code=s,t.message=a),r=n||t,c.content=f.map((function(t){return{type:"info",body:t}}))),(0,i.printGroupLog)(c),r}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r(this,void 0,void 0,(function(){var e,n,r,s,a,c,u,p;return o(this,(function(o){switch(o.label){case 0:e=h({err:new Error,className:d,methodName:v,sourceLink:y}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,g.apply(this,t)];case 2:return[2,o.sent()];case 3:throw n=o.sent(),r=n,s=n.message,a=n.error,c=n.error_description,u={title:l||"".concat(d,".").concat(v," failed"),content:[{type:"error",body:n}]},s&&/^\{.*\}$/.test(s)&&(p=JSON.parse(s),u.subtitle=p,p.code&&(e?(e.code=p.code,e.message=p.msg):(n.code=p.code,n.message=p.msg),r=e||n,u.content=f.map((function(t){return{type:"info",body:t}})))),a&&c&&(u.subtitle=c,e?(e.code=a,e.msg=c):(n.code=a,n.message=c),r=e||n,u.content=f.map((function(t){return{type:"info",body:t}}))),(0,i.printGroupLog)(u),r;case 4:return[2]}}))}))}}}}},466:function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),o(n(64),e)},418:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,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(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var a=n(829),c=n(894),u=n(141),h=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return o(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}(a.AbstractStorage);var p=function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,o=t.keys,i=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":return e.localStorage?e.localStorage:((0,c.printWarn)(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new h(e.root));case"none":return new h(e.root);default:return e.localStorage?e.localStorage:((0,c.printWarn)(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new h(e.root))}}(this.persistenceTag,this.platformInfo.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.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:u.ERRORS.OPERATION_FAIL,msg:"[".concat((0,u.getSdkName)(),"][").concat(u.ERRORS.OPERATION_FAIL,"]setStore failed"),info:t}))}}else(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return i(this,void 0,void 0,(function(){var r;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]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return i(this,void 0,void 0,(function(){var r;return s(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(r=o.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}();e.CloudbaseCache=p},988:function(t,e,n){var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.activateEvent=e.addEventListener=e.CloudbaseEventEmitter=e.IErrorEvent=e.CloudbaseEvent=void 0;var s=n(894);var a=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=a;var c=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return o(e,t),e}(a);e.IErrorEvent=c;var u=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if((0,s.isInstanceOf)(t,c))return console.error(t.error),this;var n=(0,s.isString)(t)?new a(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,u=this.listeners[r]?i([],this.listeners[r],!0):[];o<u.length;o++){u[o].call(this,n)}}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();e.CloudbaseEventEmitter=u;var h=new u;e.addEventListener=function(t,e){h.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),h.fire(t,e)},e.removeEventListener=function(t,e){h.off(t,e)}},894:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.transformPhone=e.sleep=e.printGroupLog=e.throwError=e.printInfo=e.printError=e.printWarn=e.execCallback=e.createPromiseCallback=e.removeParam=e.getHash=e.getQuery=e.toQueryString=e.formatUrl=e.generateRequestId=e.genSeqId=e.isFormData=e.isInstanceOf=e.isNull=e.isPalinObject=e.isUndefined=e.isString=e.isArray=void 0;var r=n(141);e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.isString=function(t){return"string"==typeof t},e.isUndefined=function(t){return void 0===t},e.isPalinObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},e.isInstanceOf=function(t,e){return t instanceof e},e.isFormData=function(t){return"[object FormData]"===Object.prototype.toString.call(t)},e.genSeqId=function(){return Math.random().toString(16).slice(2)},e.generateRequestId=function(){var t=(new Date).getTime(),e=(null===performance||void 0===performance?void 0:performance.now)&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var r=16*Math.random();return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),("x"===n?r:7&r|8).toString(16)}))},e.formatUrl=function(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";return Object.keys(n).forEach((function(t){""===o?!r&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)},e.toQueryString=function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var n=e||window.location.search,r=new RegExp("(^|&)".concat(t,"=([^&]*)(&|$)")),o=n.substr(n.indexOf("?")+1).match(r);return null!=o?o[2]:""};e.getHash=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]".concat(t,"=([^&#]*)")));return e?e[1]:""},e.removeParam=function(t,e){var n=e.split("?")[0],r=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var i=(r=o.split("&")).length-1;i>=0;i-=1)r[i].split("=")[0]===t&&r.splice(i,1);n="".concat(n,"?").concat(r.join("&"))}return n},e.createPromiseCallback=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var n=new Promise((function(e,n){t=function(t,r){return t?n(t):e(r)}}));return t.promise=n,t},e.execCallback=function(t,e,n){if(void 0===n&&(n=null),t&&"function"==typeof t)return t(e,n);if(e)throw e;return n},e.printWarn=function(t,e){console.warn("[".concat((0,r.getSdkName)(),"][").concat(t,"]:").concat(e))},e.printError=function(t,e){console.error({code:t,msg:"[".concat((0,r.getSdkName)(),"][").concat(t,"]:").concat(e)})},e.printInfo=function(t,e){console.log("[".concat((0,r.getSdkName)(),"][").concat(t,"]:").concat(e))},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat((0,r.getSdkName)(),"][").concat(t,"]:").concat(e)}))},e.printGroupLog=function(t){var e=t.title,n=t.subtitle,r=void 0===n?"":n,o=t.content,i=void 0===o?[]:o,s=t.printTrace,a=void 0!==s&&s,c=t.collapsed;void 0!==c&&c?console.groupCollapsed(e,r):console.group(e,r);for(var u=0,h=i;u<h.length;u++){var p=h[u],l=p.type,d=p.body;switch(l){case"info":console.log(d);break;case"warn":console.warn(d);break;case"error":console.error(d)}}a&&console.trace("stack trace:"),console.groupEnd()};e.sleep=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},e.transformPhone=function(t){return"+86".concat(t)}},219:t=>{t.exports=e},297:e=>{e.exports=t}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t].call(i.exports,i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{o.r(i),o.d(i,{Auth:()=>P,LoginState:()=>A,generateAuthInstance:()=>E,registerAuth:()=>R});var t=o(297),e=o(894),n=o(141),r=o(466),s=o(988),a=o(418),c=o(219),u=o.n(c),h=o(105),p=function(){return(p=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},l=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},d=function(t,e){var n,r,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(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},f=function(){function t(t){this.localStorage=(null==t?void 0:t.localStorage)||globalThis.localStorage}return t.prototype.getItem=function(t){return l(this,void 0,void 0,(function(){return d(this,(function(e){return[2,this.localStorage.getItem(t)]}))}))},t.prototype.removeItem=function(t){return l(this,void 0,void 0,(function(){return d(this,(function(e){return this.localStorage.removeItem(t),[2]}))}))},t.prototype.setItem=function(t,e){return l(this,void 0,void 0,(function(){return d(this,(function(n){return this.localStorage.setItem(t,e),[2]}))}))},t.prototype.getItemSync=function(t){return this.localStorage.getItem(t)},t.prototype.setItemSync=function(t,e){this.localStorage.setItem(t,e)},t.prototype.removeItemSync=function(t){this.localStorage.removeItem(t)},t}(),v=/^[^:]+:\/\/[^/]+(\/[^?#]+)/;function g(t){return function(e,n){var r;return l(this,void 0,void 0,(function(){var o;return d(this,(function(i){return o=null===(r=null==n?void 0:n.headers)||void 0===r?void 0:r["x-request-id"],[2,new Promise((function(r,i){var s=Object.assign({},n);s.body&&"string"!=typeof s.body&&(s.body=JSON.stringify(s.body));var a=wx.request({url:e,data:s.body,timeout:t._timeout,method:s.method||"GET",header:s.headers,success:function(t){t.code&&(t={error:t.code,error_description:t.message||t.code,request_id:t.requestId}),t.request_id||(t.request_id=t.request_id||o),t.error&&(t.error_uri=function(t){return v.test(t)?RegExp.$1:t}(e),i(t)),r(t.data||{})},fail:function(t){i({error:"unreachable",error_description:t.message})},complete:function(e){if(e&&e.errMsg&&(t._timeout&&-1!==t._restrictedMethods.indexOf("request")&&"request:fail timeout"===e.errMsg)){console.warn(t._timeoutMsg);try{a.abort()}catch(t){}}}})}))]}))}))}}var y=function(){return(y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},m=function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},I=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},_=function(t,e){var n,r,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(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},w="loginStateChanged",O=new s.CloudbaseEventEmitter,S=function(){function t(t){var e=t.cache,n=t.oauthInstance;this.cache=e,this.oauthInstance=n,this.setUserInfo()}return t.prototype.checkLocalInfo=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},t.prototype.checkLocalInfoAsync=function(){return I(this,void 0,void 0,(function(){var t,e,n,r;return _(this,(function(o){switch(o.label){case 0:return t=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return t.uid=o.sent(),e=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return e.gender=o.sent(),this.picture=this.getLocalUserInfo("picture"),n=this,[4,this.getLocalUserInfoAsync("email")];case 3:return n.email=o.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),r=this,[4,this.getLocalUserInfoAsync("username")];case 4:return r.username=o.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},t.prototype.update=function(t){return I(this,void 0,void 0,(function(){var e;return _(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(y({},t))];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2]}}))}))},t.prototype.updateUserBasicInfo=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.updateUserBasicInfo(y({},t))];case 1:return e.sent(),this.setLocalUserInfo({username:t.username}),[2]}}))}))},t.prototype.updatePassword=function(t,e){return this.oauthInstance.authApi.updatePasswordByOld({old_password:e,new_password:t})},t.prototype.updateUsername=function(t){return"string"!=typeof t&&(0,e.throwError)(n.ERRORS.INVALID_PARAMS,"username must be a string"),this.update({username:t})},t.prototype.refresh=function(t){return I(this,void 0,void 0,(function(){var e;return _(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(t)];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2,e]}}))}))},t.prototype.getLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;return this.cache.getStore(e)[t]},t.prototype.getLocalUserInfoAsync=function(t){return I(this,void 0,void 0,(function(){var e;return _(this,(function(n){switch(n.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(e)];case 1:return[2,n.sent()[t]]}}))}))},t.prototype.setUserInfo=function(){var t=this,e=this.cache.keys.userInfoKey,n=this.cache.getStore(e);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(e){t[e]=n[e]}))},t.prototype.setLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;this.cache.setStore(e,t),this.setUserInfo()},m([(0,r.catchErrorsDecorator)({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"update",null),m([(0,r.catchErrorsDecorator)({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[String,String]),b("design:returntype",void 0)],t.prototype,"updatePassword",null),m([(0,r.catchErrorsDecorator)({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",void 0)],t.prototype,"updateUsername",null),m([(0,r.catchErrorsDecorator)({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"refresh",null),t}(),A=function(){function t(t){var r=t.envId,o=t.cache,i=t.oauthInstance;r||(0,e.throwError)(n.ERRORS.INVALID_PARAMS,"envId is not defined"),this.cache=o,this.oauthInstance=i,this.user=new S({cache:this.cache,oauthInstance:i})}return t.prototype.checkLocalState=function(){var t;this.oauthLoginState=null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},t.prototype.checkLocalStateAsync=function(){var t;return I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}}))}))},t}(),P=function(){function t(t){this.config=t,this.cache=t.cache,this.oauthInstance=t.oauthInstance}return t.prototype.bindPhoneNumber=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.editContact(t)]}))}))},t.prototype.unbindProvider=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.unbindProvider(t)]}))}))},t.prototype.bindEmail=function(t){return this.oauthInstance.authApi.editContact(t)},t.prototype.verify=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.verify(t)]}))}))},t.prototype.getVerification=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.getVerification(t)]}))}))},Object.defineProperty(t.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var t=this.hasLoginState();return t&&t.user||null}(0,e.printWarn)(n.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),t.prototype.getCurrentUser=function(){return I(this,void 0,void 0,(function(){var t;return _(this,(function(e){switch(e.label){case 0:return[4,this.getLoginState()];case 1:return(t=e.sent())?[4,t.user.checkLocalInfoAsync()]:[3,3];case 2:return e.sent(),[2,t.user||null];case 3:return[2,null]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signInWithOpenId=function(t){var e=(void 0===t?{}:t).useWxCloud,n=void 0===e||e;return I(this,void 0,void 0,(function(){var t,e,r=this;return _(this,(function(o){switch(o.label){case 0:if(!u().isMatch())throw Error("wx api undefined");return t=wx.getAccountInfoSync().miniProgram,e=function(e){return I(r,void 0,void 0,(function(){var r,o;return _(this,(function(i){switch(i.label){case 0:r=void 0,o=void 0,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==t?void 0:t.appId,provider_code:e,provider_params:{provider_code_type:"open_id",appid:null==t?void 0:t.appId}},n)];case 2:if((null==(r=i.sent())?void 0:r.error_code)||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:r.provider_token},n)];case 3:if(null==(o=i.sent())?void 0:o.error_code)throw o;return[3,5];case 4:throw i.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(o)];case 6:return i.sent(),[2]}}))}))},[4,new Promise((function(t,n){wx.login({success:function(o){return I(r,void 0,void 0,(function(){var r;return _(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e(o.code)];case 1:return i.sent(),t(!0),[3,3];case 2:return r=i.sent(),n(r),[3,3];case 3:return[2]}}))}))},fail:function(t){var e=new Error(null==t?void 0:t.errMsg);e.code=null==t?void 0:t.errno,n(e)}})}))];case 1:return o.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signInWithUnionId=function(){return I(this,void 0,void 0,(function(){var t=this;return _(this,(function(e){switch(e.label){case 0:if(!u().isMatch())throw Error("wx api undefined");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,new Promise((function(e,n){var r=wx.getAccountInfoSync().miniProgram;wx.login({success:function(o){return I(t,void 0,void 0,(function(){var t,i,s,a,c;return _(this,(function(u){switch(u.label){case 0:t=null==r?void 0:r.appId,u.label=1;case 1:return u.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:o.code,provider_id:t,provider_params:{provider_code_type:"union_id",appid:null==r?void 0:r.appId}})];case 2:return i=u.sent(),(s=i.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:t,provider_token:s})]:(n(i),[2]);case 3:return(null==(a=u.sent())?void 0:a.error_code)?(n(a),[2]):(e(!0),[3,5]);case 4:return c=u.sent(),n(c),[3,5];case 5:return[2]}}))}))},fail:function(t){var e=new Error(null==t?void 0:t.errMsg);e.code=null==t?void 0:t.errno,n(e)}})}))];case 2:return e.sent(),[3,4];case 3:throw e.sent();case 4:return[2,this.createLoginState()]}}))}))},t.prototype.signInWithPhoneAuth=function(t){var e=t.phoneCode,n=void 0===e?"":e;return I(this,void 0,void 0,(function(){var t,e,r,o,i;return _(this,(function(s){switch(s.label){case 0:if(!u().isMatch())throw Error("wx api undefined");return t=wx.getAccountInfoSync().miniProgram,e={provider_params:{provider_code_type:"phone"},provider_id:t.appId},[4,wx.login()];case 1:r=s.sent().code,e.provider_code=r,s.label=2;case 2:return s.trys.push([2,6,,7]),[4,this.oauthInstance.authApi.grantProviderToken(e)];case 3:if((o=s.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.patchProviderToken({provider_token:o.provider_token,provider_id:t.appId,provider_params:{code:n,provider_code_type:"phone"}})];case 4:if((o=s.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:o.provider_token})];case 5:if(null==(i=s.sent())?void 0:i.error_code)throw i;return[3,7];case 6:throw s.sent();case 7:return[2,this.createLoginState()]}}))}))},t.prototype.signInWithSms=function(t){var e=t.verificationInfo,n=void 0===e?{verification_id:"",is_user:!1}:e,r=t.verificationCode,o=void 0===r?"":r,i=t.phoneNum,s=void 0===i?"":i,a=t.bindInfo,c=void 0===a?void 0:a;return I(this,void 0,void 0,(function(){var t,e,r,i,a;return _(this,(function(u){switch(u.label){case 0:return u.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:n.verification_id,verification_code:o})];case 1:if(null==(t=u.sent())?void 0:t.error_code)throw t;return e=t.verification_token,n.is_user?[4,this.oauthInstance.authApi.signIn({username:"+86 ".concat(s),verification_token:e})]:[3,5];case 2:if(null==(r=u.sent())?void 0:r.error_code)throw r;return c?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:null==c?void 0:c.providerToken})]:[3,4];case 3:if(null==(i=u.sent())?void 0:i.error_code)throw i;u.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp({phone_number:"+86 ".concat(s),verification_token:e,provider_token:null==c?void 0:c.providerId})];case 6:if(null==(a=u.sent())?void 0:a.error_code)throw a;u.label=7;case 7:return[2,this.createLoginState()];case 8:throw u.sent();case 9:return[2]}}))}))},t.prototype.setCustomSignFunc=function(t){this.oauthInstance.authApi.setCustomSignFunc(t)},t.prototype.signInWithCustomTicket=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signIn=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signIn(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.signUp=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signUp(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setPassword=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.setPassword(t)]}))}))},t.prototype.isUsernameRegistered=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(r){switch(r.label){case 0:return"string"!=typeof t&&(0,e.throwError)(n.ERRORS.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:t})];case 1:return[2,r.sent().exist]}}))}))},t.prototype.signOut=function(t){return I(this,void 0,void 0,(function(){var e,n;return _(this,(function(r){switch(r.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(t)];case 1:return n=r.sent(),[4,this.cache.removeStoreAsync(e)];case 2:return r.sent(),O.fire(w),[2,n]}}))}))},t.prototype.hasLoginState=function(){var t;if("async"!==this.cache.mode)return(null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync())?new A({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;(0,e.printWarn)(n.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},t.prototype.getLoginState=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return t.sent()?[2,new A({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},t.prototype.getUserInfo=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.getUserInfo(t)]}))}))},t.prototype.getWedaUserInfo=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},t.prototype.updateUserBasicInfo=function(t){return I(this,void 0,void 0,(function(){var e;return _(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return(e=n.sent())?[4,e.user.updateUserBasicInfo(t)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},t.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},t.prototype.bindWithProvider=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.bindWithProvider(t)]}))}))},t.prototype.queryUser=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.queryUserProfile(t)]}))}))},t.prototype.getAccessToken=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:t.sent(),env:this.config.env}]}}))}))},t.prototype.grantProviderToken=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.grantProviderToken(t)]}))}))},t.prototype.patchProviderToken=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.patchProviderToken(t)]}))}))},t.prototype.signInWithProvider=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.signInWithWechat=function(t){return void 0===t&&(t={}),I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.grantToken=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.grantToken(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.genProviderRedirectUri=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.genProviderRedirectUri(t)]}))}))},t.prototype.resetPassword=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.resetPassword(t)]}))}))},t.prototype.deviceAuthorize=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.deviceAuthorize(t)]}))}))},t.prototype.sudo=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.sudo(t)]}))}))},t.prototype.deleteMe=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.deleteMe(t)]}))}))},t.prototype.getProviders=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){return[2,this.oauthInstance.authApi.getProviders()]}))}))},t.prototype.loginScope=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){return[2,this.oauthInstance.authApi.loginScope()]}))}))},t.prototype.loginGroups=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},t.prototype.onLoginStateChanged=function(t){return I(this,void 0,void 0,(function(){var e,n=this;return _(this,(function(r){switch(r.label){case 0:return O.on(w,(function(){return I(n,void 0,void 0,(function(){var e;return _(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return e=n.sent(),t.call(this,e),[2]}}))}))})),[4,this.getLoginState()];case 1:return e=r.sent(),t.call(this,e),[2]}}))}))},t.prototype.refreshTokenForce=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.refreshTokenForce(t)]}))}))},t.prototype.getCredentials=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},t.prototype.setCredentials=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(t)];case 1:return e.sent(),[2]}}))}))},t.prototype.getProviderSubType=function(){return I(this,void 0,void 0,(function(){return _(this,(function(t){return[2,this.oauthInstance.authApi.getProviderSubType()]}))}))},t.prototype.createCaptchaData=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.createCaptchaData(t)]}))}))},t.prototype.verifyCaptchaData=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.verifyCaptchaData(t)]}))}))},t.prototype.getMiniProgramQrCode=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.getMiniProgramCode(t)]}))}))},t.prototype.getMiniProgramQrCodeStatus=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(t)]}))}))},t.prototype.modifyPassword=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.modifyPassword(t)]}))}))},t.prototype.getUserBehaviorLog=function(t){return I(this,void 0,void 0,(function(){return _(this,(function(e){return[2,this.oauthInstance.authApi.getUserBehaviorLog(t)]}))}))},t.prototype.createLoginState=function(t){return I(this,void 0,void 0,(function(){var e;return _(this,(function(n){switch(n.label){case 0:return[4,(e=new A({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return n.sent(),[4,e.user.refresh(t)];case 2:return n.sent(),O.fire(w),[2,e]}}))}))},m([(0,r.catchErrorsDecorator)({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"bindPhoneNumber",null),m([(0,r.catchErrorsDecorator)({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"unbindProvider",null),m([(0,r.catchErrorsDecorator)({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",void 0)],t.prototype,"bindEmail",null),m([(0,r.catchErrorsDecorator)({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"verify",null),m([(0,r.catchErrorsDecorator)({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"getVerification",null),m([(0,r.catchErrorsDecorator)({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Promise)],t.prototype,"getCurrentUser",null),m([(0,r.catchErrorsDecorator)({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"signInAnonymously",null),m([(0,r.catchErrorsDecorator)({title:"小程序openId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序openId静默登录"," 2 - 调用 auth().signInWithOpenId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"signInWithOpenId",null),m([(0,r.catchErrorsDecorator)({title:"小程序unionId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序unionId静默登录"," 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Promise)],t.prototype,"signInWithUnionId",null),m([(0,r.catchErrorsDecorator)({title:"小程序手机号授权登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序手机号授权登录"," 2 - 调用 auth().signInWithPhoneAuth() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"signInWithPhoneAuth",null),m([(0,r.catchErrorsDecorator)({title:"短信验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序短信验证码登陆"," 2 - 调用 auth().signInWithSms() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"signInWithSms",null),m([(0,r.catchErrorsDecorator)({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"signInWithCustomTicket",null),m([(0,r.catchErrorsDecorator)({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"signUp",null),m([(0,r.catchErrorsDecorator)({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Promise)],t.prototype,"isUsernameRegistered",null),m([(0,r.catchErrorsDecorator)({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"signOut",null),m([(0,r.catchErrorsDecorator)({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Promise)],t.prototype,"getLoginState",null),m([(0,r.catchErrorsDecorator)({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"getUserInfo",null),m([(0,r.catchErrorsDecorator)({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Promise)],t.prototype,"getWedaUserInfo",null),m([(0,r.catchErrorsDecorator)({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Promise)],t.prototype,"bindWithProvider",null),m([(0,r.catchErrorsDecorator)({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(n.COMMUNITY_SITE_URL)]}),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Promise)],t.prototype,"getProviderSubType",null),t}();function E(e,n){var r=e.region,o=void 0===r?"ap-shanghai":r,i=(null==n?void 0:n.platform)||(0,h.useDefaultAdapter)(),s=i.runtime,c=n||{},l=c.env,d=c.clientId,v=c.debug,y=c.cache,m=c.app,b=(n||{}).apiOrigin;b||(b="https://".concat(l,".").concat(o,".tcb-api.tencentcloudapi.com"));var I=new t.CloudbaseOAuth(function(t){if(!u().isMatch()||t.storage&&t.baseRequest)return t;var e={};try{var n=u().genAdapter(),r=n.localStorage,o=n.reqClass;if(r&&(e.storage=new f({localStorage:r})),o){var i=new o({timeout:1e4,restrictedMethods:["get","post","upload","download","request"]});e.request=g(i)}return p(p({},t),e)}catch(t){console.error("adapter generate fail:",t)}return t}({env:l,clientId:d,apiOrigin:b,storage:null==e?void 0:e.storage,baseRequest:null==e?void 0:e.baseRequest,request:null==e?void 0:e.request,anonymousSignInFunc:null==e?void 0:e.anonymousSignInFunc,captchaOptions:null==e?void 0:e.captchaOptions,wxCloud:null==e?void 0:e.wxCloud}));return{authInstance:new P({env:l,region:o,persistence:e.persistence,debug:v,cache:y||new a.CloudbaseCache({persistence:e.persistence,keys:{userInfoKey:"user_info_".concat(l)},platformInfo:i}),runtime:s||"web",_fromApp:m,oauthInstance:I}),oauthInstance:I}}var U={name:"auth",namespace:"auth",entity:function(t){if(void 0===t&&(t={region:"",persistence:"local"}),this.authInstance)return(0,e.printWarn)(n.ERRORS.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var r=this.platform.adapter,o=t.persistence||r.primaryStorage;o&&o!==this.config.persistence&&this.updateConfig({persistence:o});var i=E(y(y({wxCloud:this.config.wxCloud,storage:this.config.storage},t),{persistence:this.config.persistence}),{env:this.config.env,clientId:this.config.clientId,apiOrigin:this.request.getBaseEndPoint(),platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),s=i.authInstance,a=i.oauthInstance;return this.oauthInstance=a,this.authInstance=s,this.authInstance}};try{cloudbase.registerComponent(U)}catch(t){}function R(t){try{t.registerComponent(U)}catch(t){console.warn(t)}}})(),i})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/auth",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.14-beta.0",
|
|
4
4
|
"description": "cloudbase javascript sdk auth componets",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@cloudbase/adapter-wx_mp": "^1.0.0",
|
|
35
|
-
"@cloudbase/oauth": "^2.7.
|
|
36
|
-
"@cloudbase/utilities": "^2.7.
|
|
35
|
+
"@cloudbase/oauth": "^2.7.14-beta.0",
|
|
36
|
+
"@cloudbase/utilities": "^2.7.14-beta.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@cloudbase/types": "^2.7.
|
|
39
|
+
"@cloudbase/types": "^2.7.14-beta.0",
|
|
40
40
|
"@types/node": "^22.1.0",
|
|
41
41
|
"terser-webpack-plugin": "^3.0.2",
|
|
42
42
|
"webpack-bundle-analyzer": "^4.9.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "28bbeb401ad2a210fe1d2c8cf1aa23a907e254cf"
|
|
45
45
|
}
|
|
@@ -14,6 +14,12 @@ const params = {
|
|
|
14
14
|
globalObject: 'typeof window !== "undefined"?window:this',
|
|
15
15
|
},
|
|
16
16
|
externals: {
|
|
17
|
+
'@cloudbase/adapter-wx_mp': {
|
|
18
|
+
root: 'tcbadaptermp',
|
|
19
|
+
commonjs: '@cloudbase/adapter-wx_mp',
|
|
20
|
+
commonjs2: '@cloudbase/adapter-wx_mp',
|
|
21
|
+
amd: '@cloudbase/adapter-wx_mp',
|
|
22
|
+
},
|
|
17
23
|
'@cloudbase/oauth': {
|
|
18
24
|
root: 'tcboauth',
|
|
19
25
|
commonjs: '@cloudbase/oauth',
|