@cloudbase/js-sdk 3.3.14-beta.1 → 3.3.14-beta.3

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.
Files changed (102) hide show
  1. package/ai/dist/index.esm.js +3 -0
  2. package/ai/dist/index.js +21 -0
  3. package/ai/package.json +6 -0
  4. package/analytics/dist/index.esm.js +4 -0
  5. package/analytics/dist/index.js +9 -0
  6. package/analytics/package.json +6 -0
  7. package/apis/dist/index.esm.js +3 -0
  8. package/apis/dist/index.js +21 -0
  9. package/apis/package.json +6 -0
  10. package/app/dist/index.esm.js +11 -0
  11. package/app/dist/index.js +18 -0
  12. package/app/package.json +6 -0
  13. package/auth/dist/index.esm.js +8 -0
  14. package/auth/dist/index.js +13 -0
  15. package/auth/package.json +6 -0
  16. package/cloudrun/dist/index.esm.js +3 -0
  17. package/cloudrun/dist/index.js +21 -0
  18. package/cloudrun/package.json +6 -0
  19. package/container/dist/index.esm.js +8 -0
  20. package/container/dist/index.js +13 -0
  21. package/container/package.json +6 -0
  22. package/database/dist/index.d.ts +3 -0
  23. package/database/dist/index.esm.js +503 -0
  24. package/database/dist/index.js +509 -0
  25. package/database/package.json +6 -0
  26. package/dist/index.cjs.js +40 -2
  27. package/dist/index.esm.js +35 -2
  28. package/functions/dist/index.esm.js +8 -0
  29. package/functions/dist/index.js +13 -0
  30. package/functions/package.json +6 -0
  31. package/miniprogram_dist/app.js +1 -1
  32. package/miniprogram_dist/database.js +1 -1
  33. package/miniprogram_dist/index.js +1 -1
  34. package/miniprogram_dist/model.js +1 -1
  35. package/miniprogram_dist/mysql.js +1 -1
  36. package/model/dist/index.esm.js +3 -0
  37. package/model/dist/index.js +21 -0
  38. package/model/package.json +6 -0
  39. package/mysql/dist/index.esm.js +3 -0
  40. package/mysql/dist/index.js +21 -0
  41. package/mysql/package.json +6 -0
  42. package/oauth/dist/index.esm.js +3 -0
  43. package/oauth/dist/index.js +21 -0
  44. package/oauth/package.json +6 -0
  45. package/package.json +44 -68
  46. package/realtime/dist/index.esm.js +8 -0
  47. package/realtime/dist/index.js +13 -0
  48. package/realtime/package.json +6 -0
  49. package/storage/dist/index.esm.js +4 -0
  50. package/storage/dist/index.js +9 -0
  51. package/storage/package.json +6 -0
  52. package/dist/index.cjs.js.LICENSE.txt +0 -37
  53. package/dist/index.esm.js.LICENSE.txt +0 -37
  54. package/dist/packages/ai/index.cjs.js +0 -2
  55. package/dist/packages/ai/index.cjs.js.LICENSE.txt +0 -22
  56. package/dist/packages/ai/index.esm.js +0 -2
  57. package/dist/packages/ai/index.esm.js.LICENSE.txt +0 -22
  58. package/dist/packages/analytics/index.cjs.js +0 -1
  59. package/dist/packages/analytics/index.esm.js +0 -1
  60. package/dist/packages/apis/index.cjs.js +0 -1
  61. package/dist/packages/apis/index.esm.js +0 -1
  62. package/dist/packages/app/index.cjs.js +0 -2
  63. package/dist/packages/app/index.cjs.js.LICENSE.txt +0 -7
  64. package/dist/packages/app/index.esm.js +0 -2
  65. package/dist/packages/app/index.esm.js.LICENSE.txt +0 -7
  66. package/dist/packages/auth/index.cjs.js +0 -2
  67. package/dist/packages/auth/index.cjs.js.LICENSE.txt +0 -22
  68. package/dist/packages/auth/index.esm.js +0 -2
  69. package/dist/packages/auth/index.esm.js.LICENSE.txt +0 -22
  70. package/dist/packages/cloudrun/index.cjs.js +0 -1
  71. package/dist/packages/cloudrun/index.esm.js +0 -1
  72. package/dist/packages/container/index.cjs.js +0 -1
  73. package/dist/packages/container/index.esm.js +0 -1
  74. package/dist/packages/functions/index.cjs.js +0 -1
  75. package/dist/packages/functions/index.esm.js +0 -1
  76. package/dist/packages/model/index.cjs.js +0 -1
  77. package/dist/packages/model/index.esm.js +0 -1
  78. package/dist/packages/mysql/index.cjs.js +0 -1
  79. package/dist/packages/mysql/index.esm.js +0 -1
  80. package/dist/packages/oauth/index.cjs.js +0 -2
  81. package/dist/packages/oauth/index.cjs.js.LICENSE.txt +0 -14
  82. package/dist/packages/oauth/index.esm.js +0 -2
  83. package/dist/packages/oauth/index.esm.js.LICENSE.txt +0 -14
  84. package/dist/packages/realtime/index.cjs.js +0 -1
  85. package/dist/packages/realtime/index.esm.js +0 -1
  86. package/dist/packages/storage/index.cjs.js +0 -1
  87. package/dist/packages/storage/index.esm.js +0 -1
  88. package/dist/packages/utilities/index.cjs.js +0 -1
  89. package/dist/packages/utilities/index.esm.js +0 -1
  90. /package/{dist/packages/ai → ai/dist}/index.d.ts +0 -0
  91. /package/{dist/packages/analytics → analytics/dist}/index.d.ts +0 -0
  92. /package/{dist/packages/apis → apis/dist}/index.d.ts +0 -0
  93. /package/{dist/packages/app → app/dist}/index.d.ts +0 -0
  94. /package/{dist/packages/auth → auth/dist}/index.d.ts +0 -0
  95. /package/{dist/packages/cloudrun → cloudrun/dist}/index.d.ts +0 -0
  96. /package/{dist/packages/container → container/dist}/index.d.ts +0 -0
  97. /package/{dist/packages/functions → functions/dist}/index.d.ts +0 -0
  98. /package/{dist/packages/model → model/dist}/index.d.ts +0 -0
  99. /package/{dist/packages/mysql → mysql/dist}/index.d.ts +0 -0
  100. /package/{dist/packages/oauth → oauth/dist}/index.d.ts +0 -0
  101. /package/{dist/packages/realtime → realtime/dist}/index.d.ts +0 -0
  102. /package/{dist/packages/storage → storage/dist}/index.d.ts +0 -0
@@ -1,2 +0,0 @@
1
- /*! For license information please see index.esm.js.LICENSE.txt */
2
- var t,e,r={829:(t,e,r)=>{var n;r.r(e),r.d(e,{AbstractSDKRequest:()=>i,AbstractStorage:()=>o,StorageType:()=>n,formatUrl:()=>s}),function(t){t.local="local",t.none="none",t.session="session"}(n||(n={}));var i=function(){},o=function(){};function s(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),i="";for(var o in r)""===i?!n&&(e+="?"):i+="&",i+=o+"="+encodeURIComponent(r[o]);return/^http(s)?\:\/\//.test(e+=i)?e:""+t+e}},949:(t,e,r)=>{function n(t){this.message=t}r.r(e),r.d(e,{InvalidTokenError:()=>s,default:()=>a}),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var i="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,o=0,s=0,a="";i=e.charAt(s++);~i&&(r=o%4?64*r+i:i,o++%4)?a+=String.fromCharCode(255&r>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};function o(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(i(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return i(e)}}function s(t){this.message=t}s.prototype=new Error,s.prototype.name="InvalidTokenError";const a=function(t,e){if("string"!=typeof t)throw new s("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(o(t.split(".")[r]))}catch(t){throw new s("Invalid token specified: "+t.message)}}},841:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=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(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},s=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Auth=void 0;var u=r(806),c=r(351),l=r(295),h=r(173),d=a(r(81)),f=r(70);function p(t,e){var n;return i(this,void 0,void 0,(function(){var s,a=this;return o(this,(function(u){s=function(){return i(a,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,1,,6]),[2,r(900)];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,4,,5]),[4,Promise.resolve().then(r.t.bind(r,900,23))];case 3:return[2,t.sent()];case 4:return t.sent(),[2];case 5:return[3,6];case 6:return[2]}}))}))};try{if(((null===(n=null==e?void 0:e.root)||void 0===n?void 0:n.globalThis)||globalThis).IS_MP_BUILD)return[2];if(!process.env.IS_MP_BUILD&&t)return[2,s()]}catch(e){if(t)return[2,s()]}return[2]}))}))}var v=function(){function t(t){var e=t.request,r=t.credentialsClient;if(!r){var i={apiOrigin:t.apiOrigin,apiPath:t.apiPath,clientId:t.clientId,storage:t.storage,env:t.env,baseRequest:t.baseRequest,anonymousSignInFunc:t.anonymousSignInFunc,wxCloud:t.wxCloud,onCredentialsError:t.onCredentialsError,headers:t.headers||{},i18n:t.i18n,debug:t.debug};r=new c.OAuth2Client(i)}if(!e){var o=r.request.bind(r),s=new l.Captcha(n({env:t.env,clientId:t.clientId,request:o,storage:t.storage,adapter:t.adapter,oauthInstance:this},t.captchaOptions));e=s.request.bind(s)}this.config={env:t.env,apiOrigin:t.apiOrigin,apiPath:t.apiPath,clientId:t.clientId,request:e,credentialsClient:r,storage:t.storage||c.defaultStorage,adapter:t.adapter}}return t.parseParamsToSearch=function(t){return Object.keys(t).forEach((function(e){t[e]||delete t[e]})),new d.default(t).toString()},t.prototype.getParamsByVersion=function(t,e){var r,n=(0,h.deepClone)(t),i=(null===(r={v2:u.ApiUrlsV2}[null==n?void 0:n.version])||void 0===r?void 0:r[e])||u.ApiUrls[e];return n&&delete n.version,{params:n,url:i}},t.prototype.signIn=function(t){return i(this,void 0,Promise,(function(){var e,r,i,s;return o(this,(function(o){switch(o.label){case 0:return e=t.version||"v1",(r=this.getParamsByVersion(t,"AUTH_SIGN_IN_URL")).params.query&&delete r.params.query,[4,this.getEncryptParams(r.params)];case 1:return i=o.sent(),[4,this.config.request(r.url,{method:"POST",body:i})];case 2:return s=o.sent(),[4,this.config.credentialsClient.setCredentials(n(n({},s),{version:e}))];case 3:return o.sent(),[2,Promise.resolve(s)]}}))}))},t.prototype.signInAnonymously=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!1),i(this,void 0,Promise,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return[4,this.config.request(u.ApiUrls.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:t,useWxCloud:e})];case 1:return r=n.sent(),[4,this.config.credentialsClient.setCredentials(r)];case 2:return n.sent(),[2,Promise.resolve(r)]}}))}))},t.prototype.signUp=function(t){return i(this,void 0,Promise,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return[4,this.config.request(u.ApiUrls.AUTH_SIGN_UP_URL,{method:"POST",body:t})];case 1:return e=r.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return r.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signOut=function(t){return i(this,void 0,Promise,(function(){var e,r,n,i;return o(this,(function(o){switch(o.label){case 0:if(e={},!t)return[3,6];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.request(u.ApiUrls.AUTH_SIGNOUT_URL,{method:"POST",withCredentials:!0,body:t})];case 2:return e=o.sent(),[3,4];case 3:return(r=o.sent()).error!==u.ErrorType.UNAUTHENTICATED&&console.log("sign_out_error",r),[3,4];case 4:return[4,this.config.credentialsClient.setCredentials()];case 5:return o.sent(),[2,e];case 6:return[4,this.config.credentialsClient.getAccessToken()];case 7:return n=o.sent(),[4,this.config.request(u.ApiUrls.AUTH_REVOKE_URL,{method:"POST",body:{token:n}})];case 8:return i=o.sent(),[4,this.config.credentialsClient.setCredentials()];case 9:return o.sent(),[2,Promise.resolve(i)]}}))}))},t.prototype.revokeAllDevices=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.config.request(u.ApiUrls.AUTH_REVOKE_ALL_URL,{method:"DELETE",withCredentials:!0})];case 1:return t.sent(),[2]}}))}))},t.prototype.revokeDevice=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.config.request(u.ApiUrls.AUTHORIZED_DEVICES_DELETE_URL+t.device_id,{method:"DELETE",withCredentials:!0})];case 1:return e.sent(),[2]}}))}))},t.prototype.getVerification=function(t,e){return i(this,void 0,Promise,(function(){var r,n;return o(this,(function(i){switch(i.label){case 0:return r=!1,"CUR_USER"!==t.target?[3,1]:(r=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:i.sent()&&(r=!0),i.label=3;case 3:return(n=(0,h.deepClone)(t)).phone_number&&!/^\+\d{1,3}\s+\d+/.test(n.phone_number)&&(n.phone_number="+86 ".concat(n.phone_number)),[2,this.config.request(u.ApiUrls.VERIFICATION_URL,{method:"POST",body:n,withCaptcha:(null==e?void 0:e.withCaptcha)||!1,withCredentials:r})]}}))}))},t.prototype.verify=function(t){return i(this,void 0,Promise,(function(){var e,r;return o(this,(function(i){switch(i.label){case 0:return e=this.getParamsByVersion(t,"VERIFY_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return r=i.sent(),"v2"!==(null==t?void 0:t.version)?[3,3]:[4,this.config.credentialsClient.setCredentials(n(n({},r),{version:"v2"}))];case 2:i.sent(),i.label=3;case 3:return[2,r]}}))}))},t.prototype.genProviderRedirectUri=function(e){return i(this,void 0,Promise,(function(){var r,n,i,a,c;return o(this,(function(o){return r=e.provider_redirect_uri,n=e.other_params,i=void 0===n?{}:n,a=s(e,["provider_redirect_uri","other_params"]),r&&!a.redirect_uri&&(a.redirect_uri=r),c="".concat(u.ApiUrls.PROVIDER_URI_URL,"?").concat(t.parseParamsToSearch(a)),Object.keys(i).forEach((function(t){var e=i[t];("sign_out_uri"!==t||(null==e?void 0:e.length)>0)&&(c+="&other_params[".concat(t,"]=").concat(encodeURIComponent(e)))})),[2,this.config.request(c,{method:"GET"})]}))}))},t.prototype.grantProviderToken=function(t,e){return void 0===e&&(e=!1),i(this,void 0,Promise,(function(){return o(this,(function(r){return[2,this.config.request(u.ApiUrls.PROVIDER_TOKEN_URL,{method:"POST",body:t,useWxCloud:e})]}))}))},t.prototype.patchProviderToken=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})]}))}))},t.prototype.signInWithProvider=function(t,e){return void 0===e&&(e=!1),i(this,void 0,Promise,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return r=this.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),[4,this.config.request(r.url,{method:"POST",body:r.params,useWxCloud:e})];case 1:return i=o.sent(),[4,this.config.credentialsClient.setCredentials(n(n({},i),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return o.sent(),[2,Promise.resolve(i)]}}))}))},t.prototype.toBindIdentity=function(t){var e,r;return i(this,void 0,void 0,(function(){var n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return(i=t.credentials)?[3,2]:[4,this.config.credentialsClient.localCredentials.getCredentials()];case 1:i=o.sent(),o.label=2;case 2:n=i,o.label=3;case 3:return o.trys.push([3,5,,6]),[4,this.bindWithProvider({provider_token:t.provider_token},n)];case 4:return o.sent(),s={data:{type:u.OAUTH_TYPE.BIND_IDENTITY,provider:t.provider},error:null},[3,6];case 5:return a=o.sent(),s={data:{type:u.OAUTH_TYPE.BIND_IDENTITY},error:new f.AuthError(a)},[3,6];case 6:return t.fireEvent&&(null===(r=null===(e=this.config.eventBus)||void 0===e?void 0:e.fire)||void 0===r||r.call(e,u.EVENTS.AUTH_STATE_CHANGED,{event:u.AUTH_STATE_CHANGED_TYPE.BIND_IDENTITY,info:s})),[2,s]}}))}))},t.prototype.getInitialSession=function(){return i(this,void 0,Promise,(function(){var t,e,r,i,s,a,c,l,h,d,p,v,g,y,_;return o(this,(function(o){switch(o.label){case 0:t={},o.label=1;case 1:if(o.trys.push([1,12,,13]),"undefined"==typeof window||"undefined"==typeof document)return[2,{data:null,error:null}];if(e=new URLSearchParams(null===location||void 0===location?void 0:location.search),r=e.get("code"),i=e.get("state"),!r||!i)return[2,{data:null,error:null}];s=null;try{s=JSON.parse(sessionStorage.getItem(i)||"null")}catch(t){}return t={type:null==s?void 0:s.type},a=e.get("error"),c=e.get("error_description"),a||c?[2,{data:t,error:new f.AuthError({message:c||a||"Unknown error from OAuth provider"})}]:(l=(null==s?void 0:s.provider)||e.get("provider"))?(h=location.origin+location.pathname,[4,this.grantProviderToken({provider_id:l,provider_redirect_uri:h,provider_code:r})]):[2,{data:t,error:new f.AuthError({message:"Provider is required for OAuth verification"})}];case 2:return d=o.sent().provider_token,p=void 0,v=null,g=void 0,s.type!==u.OAUTH_TYPE.BIND_IDENTITY?[3,5]:[4,this.config.credentialsClient.localCredentials.getCredentials()];case 3:return p=o.sent(),[4,this.toBindIdentity({provider:l,provider_token:d,credentials:p})];case 4:return g=o.sent(),[3,11];case 5:return s.type!==u.OAUTH_TYPE.SIGN_IN?[3,11]:(g=this.getParamsByVersion({provider:l},"AUTH_SIGN_IN_WITH_PROVIDER_URL"),[4,this.config.request(g.url,{method:"POST",body:{provider_token:d}})]);case 6:p=o.sent(),o.label=7;case 7:return o.trys.push([7,9,,10]),[4,this.getUserInfo({credentials:p})];case 8:return v=o.sent(),[3,10];case 9:return y=o.sent(),console.error("get user info error",y),[3,10];case 10:g={data:n(n({},t),{session:p,user:v}),error:null},o.label=11;case 11:e.delete("code"),e.delete("state"),e.delete("provider"),this.restoreUrlState(void 0===(null==s?void 0:s.search)?"?".concat(e.toString()):s.search,(null==s?void 0:s.hash)||location.hash);try{sessionStorage.removeItem(i)}catch(t){}return[2,g];case 12:return _=o.sent(),[2,{data:t,error:new f.AuthError(_)}];case 13:return[2]}}))}))},t.prototype.signInCustom=function(t){return i(this,void 0,Promise,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return[4,this.config.request(u.ApiUrls.AUTH_SIGN_IN_CUSTOM,{method:"POST",body:t})];case 1:return e=r.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return r.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signInWithWechat=function(t){return void 0===t&&(t={}),i(this,void 0,Promise,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return[4,this.config.request(u.ApiUrls.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:"POST",body:t})];case 1:return e=r.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return r.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.bindWithProvider=function(t,e){return i(this,void 0,Promise,(function(){return o(this,(function(r){return[2,this.config.request(u.ApiUrls.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0,getCredentials:e?function(){return e}:void 0})]}))}))},t.prototype.getUserProfile=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.getUserInfo(t)]}))}))},t.prototype.getUserInfo=function(t){var e,r,n;return void 0===t&&(t={}),i(this,void 0,Promise,(function(){var i,s,a,u,c;return o(this,(function(o){switch(o.label){case 0:return i=this.getParamsByVersion(t,"USER_ME_URL"),(null===(e=i.params)||void 0===e?void 0:e.query)&&(s=new d.default(i.params.query),i.url+="?".concat(s.toString())),[4,this.config.request(i.url,{method:"GET",withCredentials:!0,getCredentials:t.credentials?function(){return t.credentials}:void 0})];case 1:if((a=o.sent()).sub&&(a.uid=a.sub),null===(r=a.providers)||void 0===r?void 0:r.length)try{"undefined"!=typeof wx&&wx.getAccountInfoSync&&(u=null===(n=wx.getAccountInfoSync().miniProgram)||void 0===n?void 0:n.appId,(null==(c=a.providers.find((function(t){return t.id===u})))?void 0:c.provider_user_id)&&(a.open_id=c.provider_user_id))}catch(t){}return[2,a]}}))}))},t.prototype.getWedaUserInfo=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.config.request(u.ApiUrls.WEDA_USER_URL,{method:"GET",withCredentials:!0})];case 1:return[2,t.sent()]}}))}))},t.prototype.deleteMe=function(e){return i(this,void 0,Promise,(function(){var r,n;return o(this,(function(i){return r=this.getParamsByVersion(e,"USER_ME_URL"),n="".concat(r.url,"?").concat(t.parseParamsToSearch(r.params)),[2,this.config.request(n,{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.hasLoginState=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},t.prototype.getLoginState=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},t.prototype.transByProvider=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.grantToken=function(t){return i(this,void 0,Promise,(function(){var e;return o(this,(function(r){return e=this.getParamsByVersion(t,"AUTH_TOKEN_URL"),[2,this.config.request(e.url,{method:"POST",body:e.params})]}))}))},t.prototype.getProviders=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){return[2,this.config.request(u.ApiUrls.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},t.prototype.unbindProvider=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request("".concat(u.ApiUrls.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.checkPassword=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request("".concat(u.ApiUrls.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.editContact=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request("".concat(u.ApiUrls.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.setPassword=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request("".concat(u.ApiUrls.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.updatePasswordByOld=function(t){return i(this,void 0,Promise,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return[4,this.sudo({password:t.old_password})];case 1:return e=r.sent(),[2,this.setPassword({sudo_token:e.sudo_token,new_password:t.new_password})]}}))}))},t.prototype.sudo=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request("".concat(u.ApiUrls.SUDO_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.sendVerificationCodeToCurrentUser=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return t.target="CUR_USER",[2,this.config.request(u.ApiUrls.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})]}))}))},t.prototype.changeBoundProvider=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request("".concat(u.ApiUrls.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})]}))}))},t.prototype.setUserProfile=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.updateUserBasicInfo=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.queryUserProfile=function(t){return i(this,void 0,Promise,(function(){var e;return o(this,(function(r){return e=new d.default(t),[2,this.config.request("".concat(u.ApiUrls.USER_QUERY_URL,"?").concat(e.toString()),{method:"GET",withCredentials:!0})]}))}))},t.prototype.setCustomSignFunc=function(t){this.getCustomSignTicketFn=t},t.prototype.signInWithCustomTicket=function(){return i(this,void 0,Promise,(function(){var t,e;return o(this,(function(r){switch(r.label){case 0:return(t=this.getCustomSignTicketFn)?[4,t()]:[2,Promise.reject({error:"failed_precondition",error_description:"please use setCustomSignFunc to set custom sign function"})];case 1:return e=r.sent(),[2,this.signInCustom({provider_id:"custom",ticket:e})]}}))}))},t.prototype.resetPassword=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.AUTH_RESET_PASSWORD,{method:"POST",body:t})]}))}))},t.prototype.authorize=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.AUTHORIZE_URL,{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.authorizeDevice=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.AUTHORIZE_DEVICE_URL,{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.deviceAuthorize=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.AUTH_GET_DEVICE_CODE,{method:"POST",body:t})]}))}))},t.prototype.authorizeInfo=function(e){return i(this,void 0,Promise,(function(){var r,n,i;return o(this,(function(o){switch(o.label){case 0:return r="".concat(u.ApiUrls.AUTHORIZE_INFO_URL,"?").concat(t.parseParamsToSearch(e)),n=!0,i=!1,[4,this.hasLoginState()];case 1:return o.sent()&&(i=!0,n=!1),[2,this.config.request(r,{method:"GET",withBasicAuth:n,withCredentials:i})]}}))}))},t.prototype.checkUsername=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})]}))}))},t.prototype.checkIfUserExist=function(t){return i(this,void 0,Promise,(function(){var e;return o(this,(function(r){return e=new d.default(t),[2,this.config.request("".concat(u.ApiUrls.CHECK_IF_USER_EXIST,"?").concat(e.toString()),{method:"GET"})]}))}))},t.prototype.loginScope=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){return[2,this.config.credentialsClient.getScope()]}))}))},t.prototype.loginGroups=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){return[2,this.config.credentialsClient.getGroups()]}))}))},t.prototype.refreshTokenForce=function(t){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return e=r.sent(),[4,this.config.credentialsClient.refreshToken(n(n({},e),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return[2,r.sent()]}}))}))},t.prototype.getCredentials=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.config.credentialsClient.getCredentials()]}))}))},t.prototype.getPublicKey=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){return[2,this.config.request(u.ApiUrlsV2.AUTH_PUBLIC_KEY,{method:"POST",body:{}})]}))}))},t.prototype.getEncryptParams=function(t){return i(this,void 0,Promise,(function(){var e,r,n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return e=t.isEncrypt,delete t.isEncrypt,r=(0,h.deepClone)(t),[4,p(e,this.config.adapter)];case 1:if(!(n=o.sent()))return[2,t];i="",s="",o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(a=o.sent(),i=a.public_key,s=a.public_key_thumbprint,!i||!s)throw a;return[3,5];case 4:throw o.sent();case 5:return[2,{params:n.getEncryptInfo({publicKey:i,payload:r}),public_key_thumbprint:s}]}}))}))},t.prototype.getProviderSubType=function(){return i(this,void 0,Promise,(function(){return o(this,(function(t){return[2,this.config.request(u.ApiUrls.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})]}))}))},t.prototype.verifyCaptchaData=function(t){var e=t.token,r=t.key;return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.config.request(u.ApiUrls.VERIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:e,key:r},withCredentials:!1})]}))}))},t.prototype.createCaptchaData=function(t){var e=t.state,r=t.redirect_uri,n=void 0===r?void 0:r;return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.config.request(u.ApiUrls.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:n},withCredentials:!1})]}))}))},t.prototype.getMiniProgramCode=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.GET_MINIPROGRAM_QRCODE,{method:"POST",body:t})]}))}))},t.prototype.getMiniProgramQrCodeStatus=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,this.config.request(u.ApiUrls.GET_MINIPROGRAM_QRCODE_STATUS,{method:"POST",body:t})]}))}))},t.prototype.getUserBehaviorLog=function(t){return i(this,void 0,Promise,(function(){var e,r;return o(this,(function(n){return e={LOGIN:"query[action]=USER_LOGIN",MODIFY:"ne_query[action]=USER_LOGIN"},r="".concat(u.ApiUrls.GET_USER_BEHAVIOR_LOG,"?").concat(e[t.type],"&limit=").concat(t.limit).concat(t.page_token?"&page_token=".concat(t.page_token):""),[2,this.config.request(r,{method:"GET",withCredentials:!0})]}))}))},t.prototype.modifyPassword=function(t){return i(this,void 0,Promise,(function(){var e,r,n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return e="",r="",[4,p(!0,this.config.adapter)];case 1:if(!(n=o.sent()))throw new Error("do not support encrypt, a encrypt util required.");o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(i=o.sent(),e=i.public_key,r=i.public_key_thumbprint,!e||!r)throw i;return[3,5];case 4:throw o.sent();case 5:return s=t.password?n.getEncryptInfo({publicKey:e,payload:t.password}):"",a=n.getEncryptInfo({publicKey:e,payload:t.new_password}),[2,this.config.request(u.ApiUrls.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:{user_id:t.user_id,encrypt_password:s,encrypt_new_password:a,public_key_thumbprint:r}})]}}))}))},t.prototype.modifyPasswordWithoutLogin=function(t){return i(this,void 0,Promise,(function(){var e,r,n,i,s,a;return o(this,(function(o){switch(o.label){case 0:return e="",r="",[4,p(!0,this.config.adapter)];case 1:if(!(n=o.sent()))throw new Error("do not support encrypt, a encrypt util required.");o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(i=o.sent(),e=i.public_key,r=i.public_key_thumbprint,!e||!r)throw i;return[3,5];case 4:throw o.sent();case 5:return s=t.password?n.getEncryptInfo({publicKey:e,payload:t.password}):"",a=n.getEncryptInfo({publicKey:e,payload:t.new_password}),[2,this.config.request(u.ApiUrlsV2.AUTH_RESET_PASSWORD,{method:"POST",body:{username:t.username,password:s,new_password:a,public_key_thumbprint:r}})]}}))}))},t.prototype.restoreUrlState=function(t,e){if(void 0!==t)try{var r=new URL(window.location.href);r.search=t,r.hash=e||"",window.history.replaceState(null,"",r.toString()),window.location.replace(r.toString())}catch(t){}},t}();e.Auth=v},70:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AuthError=e.AuthErrorCategory=void 0;var o,s=r(806);!function(t){t.PROVIDER_NOT_ENABLED="PROVIDER_NOT_ENABLED",t.INVALID_CREDENTIALS="INVALID_CREDENTIALS",t.USER_NOT_FOUND="USER_NOT_FOUND",t.USER_STATUS_ABNORMAL="USER_STATUS_ABNORMAL",t.SERVICE_ERROR="SERVICE_ERROR",t.INVALID_PARAMS="INVALID_PARAMS",t.AUTH_METHOD_MISMATCH="AUTH_METHOD_MISMATCH",t.UNKNOWN="UNKNOWN"}(o=e.AuthErrorCategory||(e.AuthErrorCategory={}));var a="https://tcb.cloud.tencent.com/dev?envId=#/identity/login-manage",u="https://docs.cloudbase.net/api-reference/webv3-next/initialization",c=function(t){function e(e,r){var n,i=this,c=e.error_description||e.message;return(i=t.call(this,c)||this).__isAuthError=!0,i.name="AuthError",i.status=e.error,i.code=e.error_code,i.requestId=e.requestId,i.category=function(t,e){if(!t&&!e)return o.UNKNOWN;try{var r=(t||"").toLowerCase();return e===s.ErrorType.FAILED_PRECONDITION||e===s.ErrorType.PROVIDER_NOT_ENABLED||e===s.ErrorType.LOGIN_METHOD_DISABLED||r.includes("身份源")||r.includes("开启")||r.includes("identity provider")||r.includes("provider not enabled")||r.includes("login method")||r.includes("登录方式")||r.includes("not enabled")||r.includes("未开启")||r.includes("未启用")||r.includes("请联系开发者")||r.includes("anonymous login is not enabled")||r.includes("匿名登录未开启")?o.PROVIDER_NOT_ENABLED:e===s.ErrorType.INVALID_PASSWORD||e===s.ErrorType.INVALID_GRANT||e===s.ErrorType.INVALID_VERIFICATION_CODE||e===s.ErrorType.INVALID_USERNAME_OR_PASSWORD||e===s.ErrorType.INVALID_CREDENTIALS||e===s.ErrorType.WRONG_PASSWORD||e===s.ErrorType.UNAUTHENTICATED||e===s.ErrorType.INVALID_TWO_FACTOR||e===s.ErrorType.INVALID_TWO_FACTOR_RECOVERY||e===s.ErrorType.PASSWORD_NOT_SET||r.includes("密码不正确")||r.includes("password")||r.includes("invalid_password")||r.includes("凭据")||r.includes("credentials")||r.includes("验证码")||r.includes("verification")||r.includes("invalid_verification_code")||r.includes("invalid_username_or_password")||r.includes("username or password")||r.includes("用户名或密码")||r.includes("wrong password")||r.includes("incorrect password")?o.INVALID_CREDENTIALS:e===s.ErrorType.NOT_FOUND||e===s.ErrorType.USER_NOT_FOUND||r.includes("用户不存在")||r.includes("not found")||r.includes("user not found")||r.includes("不存在")||r.includes("no such user")||r.includes("user does not exist")?o.USER_NOT_FOUND:e===s.ErrorType.USER_BLOCKED||e===s.ErrorType.USER_PENDING||e===s.ErrorType.UNDER_REVIEW||e===s.ErrorType.INVALID_STATUS||r.includes("被封禁")||r.includes("blocked")||r.includes("pending")||r.includes("审核")||r.includes("review")||r.includes("locked")||r.includes("已锁定")?o.USER_STATUS_ABNORMAL:e===s.ErrorType.SERVER_ERROR||e===s.ErrorType.UNAVAILABLE||e===s.ErrorType.TEMPORARILY_UNAVAILABLE||e===s.ErrorType.INTERNAL||e===s.ErrorType.UNREACHABLE||e===s.ErrorType.DEADLINE_EXCEEDED||e===s.ErrorType.DATA_LOSS||r.includes("network")||r.includes("timeout")||r.includes("服务")||r.includes("timed out")||r.includes("超时")?o.SERVICE_ERROR:e===s.ErrorType.INVALID_ARGUMENT||e===s.ErrorType.INVALID_REQUEST||e===s.ErrorType.INVALID_SCOPE||e===s.ErrorType.INVALID_REQUEST_URI||e===s.ErrorType.INVALID_REQUEST_OBJECT?o.INVALID_PARAMS:e===s.ErrorType.PERMISSION_DENIED||e===s.ErrorType.ACCESS_DENIED||e===s.ErrorType.UNAUTHORIZED_CLIENT?o.PROVIDER_NOT_ENABLED:o.UNKNOWN}catch(t){return e}}(c,i.status),i.helpMessage=function(t,e){var r=(null==e?void 0:e.method)||"signIn",n={signInWithPassword:"「用户名密码登录」",signInAnonymously:"「匿名登录」",signInWithOtp:"「短信验证码登录」或「邮箱验证码登录」",signUp:"「短信验证码登录」或「邮箱验证码登录」",signInWithOAuth:"对应的第三方身份源",signInWithIdToken:"对应的第三方身份源",signInWithOpenId:"「微信小程序 OpenID 登录」",signInWithPhoneAuth:"「微信小程序手机号授权登录」",signInWithCustomTicket:"「自定义登录」"}[r]||"对应的登录方式";switch(t){case o.PROVIDER_NOT_ENABLED:return"[CloudBase Auth] 登录方式未开启\n\n"+" 当前调用的 ".concat(r,"() 所需的登录方式尚未在云开发控制台启用。\n")+" 需要开启的登录方式:".concat(n,"\n")+"\n 请按以下步骤开启:\n"+" 1. 打开云开发控制台:".concat(a,"\n")+" 2. 选择对应的云开发环境\n 3. 进入「登录授权」页面,在「登录方式」或「身份源列表」中开启所需的登录方式\n\n 各登录方法与所需登录方式的对应关系:\n - signInWithPassword → 「用户名密码登录」\n - signInAnonymously → 「匿名登录」\n - signInWithOtp/signUp → 「短信验证码登录」或「邮箱验证码登录」\n - signInWithOAuth/signInWithIdToken → 对应的第三方身份源\n\n 如使用 CLI/MCP 工具,可通过 auth 工具查询和配置身份源状态。\n"+" 更多帮助请参考文档:".concat(u);case o.INVALID_CREDENTIALS:return"[CloudBase Auth] 凭据验证失败\n\n"+" 调用 ".concat(r,"() 时凭据校验未通过。\n")+"\n 请按优先级逐项排查:\n 1. 确认用户名/邮箱/手机号是否拼写正确、格式完整\n 2. 确认密码是否正确(注意大小写、特殊字符、前后空格)\n 3. 确认用户账号确实存在(可通过 auth.isUsernameRegistered() 检查)\n 4. 确认凭据参数来源可靠(环境变量、配置文件中的值是否已正确设置)\n 5. 如使用加密登录(is_encrypt: true),请确认公钥版本正确\n\n 如忘记密码,可通过 auth.resetPasswordForEmail() 重置密码。\n\n 提示:如果是 AI agent / 自动化测试场景,请确认 ENV_ID、USERNAME、PASSWORD\n 等环境变量已正确传入,且对应用户已在目标环境中注册。";case o.USER_NOT_FOUND:return"[CloudBase Auth] 用户不存在\n\n 请检查以下项目:\n 1. 确认用户名/邮箱/手机号是否正确\n 2. 确认是在正确的云开发环境(envId)下操作\n 3. 如果是新用户,请先通过 auth.signUp() 注册\n"+" 4. 也可在云开发控制台手动创建用户:".concat(a,"\n")+"\n 提示:不同环境(开发/测试/生产)的用户库是隔离的,请确认 envId 正确。";case o.USER_STATUS_ABNORMAL:return"[CloudBase Auth] 用户状态异常\n\n 当前用户账号可能处于以下状态之一:\n - 账号已被封禁\n - 账号正在审核中\n - 账号已被锁定(多次密码错误)\n\n"+" 请联系管理员在云开发控制台检查用户状态:".concat(a);case o.SERVICE_ERROR:return"[CloudBase Auth] 服务异常\n\n 请检查以下项目:\n 1. 网络连接是否正常\n 2. 云开发环境是否正常运行\n 3. 稍后重试,如持续失败请联系技术支持\n\n 提示:如果是超时错误,请检查网络环境和请求频率。";case o.INVALID_PARAMS:return"[CloudBase Auth] 参数错误\n\n 请检查传入的参数是否符合要求,参考 API 文档确认各参数的格式和约束。\n"+" 文档地址:".concat(u);case o.AUTH_METHOD_MISMATCH:return"[CloudBase Auth] 登录方式不匹配\n\n"+" 调用 ".concat(r,"() 时遇到错误,可能原因:\n")+" - 匿名登录失败后尝试了用户名密码登录,但凭据不正确或用户不存在\n - 应使用匿名登录但传入了密码参数\n - 应使用密码登录但未传入正确的凭据\n\n 建议:\n 1. 明确当前场景需要的登录方式:\n - 无需用户注册 → auth.signInAnonymously()\n - 有用户名和密码 → auth.signInWithPassword({ username, password })\n - 第三方平台 → auth.signInWithOAuth({ provider })\n 2. 不要在同一流程中混合使用不同的登录方式\n 3. 每种登录方式需要在控制台开启对应的身份源\n"+" 4. 控制台地址:".concat(a);default:return"[CloudBase Auth] 操作失败\n\n 如果问题持续存在,建议:\n"+" 1. 检查云开发控制台的认证配置:".concat(a,"\n")+" 2. 到官方问答社区提问:https://cnb.cool/tencent/cloud/cloudbase/community/-/issues\n"+" 3. 查阅文档:".concat(u)}}(i.category,r),i.loginMethodHint=(n=null==r?void 0:r.method)&&{signInWithPassword:"当前使用「用户名密码登录」,需确保:\n ✓ 控制台已开启「用户名密码登录」\n ✓ 用户已注册且凭据正确\n 如果不需要用户系统,建议改用 auth.signInAnonymously()",signInAnonymously:"当前使用「匿名登录」,需确保:\n ✓ 控制台已开启「匿名登录」\n 注意:匿名用户无需用户名密码,适用于快速体验或临时访问场景",signInWithOtp:"当前使用「OTP 验证码登录」,需确保:\n ✓ 控制台已开启「短信验证码登录」或「邮箱验证码登录」",signInWithOAuth:"当前使用「第三方 OAuth 登录」,需确保:\n ✓ 控制台已配置并开启对应的第三方身份源"}[n]||"",i}return i(e,t),e}(Error);e.AuthError=c},806:(t,e)=>{var r,n,i,o;Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_NODE_ACCESS_SCOPE=e.OAUTH_TYPE=e.EVENTS=e.AUTH_STATE_CHANGED_TYPE=e.LOGIN_STATE_CHANGED_TYPE=e.ErrorType=e.VerificationUsages=e.ApiUrlsV2=e.ApiUrls=e.AUTH_API_PREFIX=void 0,e.AUTH_API_PREFIX="/auth",(o=e.ApiUrls||(e.ApiUrls={})).AUTH_SIGN_UP_URL="/v1/signup",o.AUTH_TOKEN_URL="/v1/token",o.AUTH_REVOKE_URL="/v1/revoke",o.WEDA_USER_URL="/v1/plugin/weda/userinfo",o.AUTH_RESET_PASSWORD="/v1/reset",o.AUTH_GET_DEVICE_CODE="/v1/device/code",o.CHECK_USERNAME="/v1/checkUsername",o.CHECK_IF_USER_EXIST="/v1/checkIfUserExist",o.GET_PROVIDER_TYPE="/v1/mgr/provider/providerSubType",o.AUTH_SIGN_IN_URL="/v1/signin",o.AUTH_SIGN_IN_ANONYMOUSLY_URL="/v1/signin/anonymously",o.AUTH_SIGN_IN_WITH_PROVIDER_URL="/v1/signin/with/provider",o.AUTH_SIGN_IN_WITH_WECHAT_URL="/v1/signin/wechat/noauth",o.AUTH_SIGN_IN_CUSTOM="/v1/signin/custom",o.PROVIDER_TOKEN_URL="/v1/provider/token",o.PROVIDER_URI_URL="/v1/provider/uri",o.USER_ME_URL="/v1/user/me",o.AUTH_SIGNOUT_URL="/v1/user/signout",o.USER_QUERY_URL="/v1/user/query",o.USER_PRIFILE_URL="/v1/user/profile",o.USER_BASIC_EDIT_URL="/v1/user/basic/edit",o.USER_TRANS_BY_PROVIDER_URL="/v1/user/trans/by/provider",o.PROVIDER_LIST="/v1/user/provider",o.PROVIDER_BIND_URL="/v1/user/provider/bind",o.PROVIDER_UNBIND_URL="/v1/user/provider",o.CHECK_PWD_URL="/v1/user/sudo",o.SUDO_URL="/v1/user/sudo",o.BIND_CONTACT_URL="/v1/user/contact",o.AUTH_SET_PASSWORD="/v1/user/password",o.AUTHORIZE_DEVICE_URL="/v1/user/device/authorize",o.AUTHORIZE_URL="/v1/user/authorize",o.AUTHORIZE_INFO_URL="/v1/user/authorize/info",o.AUTHORIZED_DEVICES_DELETE_URL="/v1/user/authorized/devices/",o.AUTH_REVOKE_ALL_URL="/v1/user/revoke/all",o.GET_USER_BEHAVIOR_LOG="/v1/user/security/history",o.VERIFICATION_URL="/v1/verification",o.VERIFY_URL="/v1/verification/verify",o.CAPTCHA_DATA_URL="/v1/captcha/data",o.VERIFY_CAPTCHA_DATA_URL="/v1/captcha/data/verify",o.GET_CAPTCHA_URL="/v1/captcha/init",o.GET_MINIPROGRAM_QRCODE="/v1/qrcode/generate",o.GET_MINIPROGRAM_QRCODE_STATUS="/v1/qrcode/get/status",(i=e.ApiUrlsV2||(e.ApiUrlsV2={})).AUTH_SIGN_IN_URL="/v2/signin/username",i.AUTH_TOKEN_URL="/v2/token",i.USER_ME_URL="/v2/user/me",i.VERIFY_URL="/v2/signin/verificationcode",i.AUTH_SIGN_IN_WITH_PROVIDER_URL="/v2/signin/with/provider",i.AUTH_PUBLIC_KEY="/v2/signin/publichkey",i.AUTH_RESET_PASSWORD="/v2/signin/password/update",(n=e.VerificationUsages||(e.VerificationUsages={})).REGISTER="REGISTER",n.SIGN_IN="SIGN_IN",n.PASSWORD_RESET="PASSWORD_RESET",n.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",n.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE",(r=e.ErrorType||(e.ErrorType={})).UNREACHABLE="unreachable",r.LOCAL="local",r.CANCELLED="cancelled",r.UNKNOWN="unknown",r.UNAUTHENTICATED="unauthenticated",r.RESOURCE_EXHAUSTED="resource_exhausted",r.FAILED_PRECONDITION="failed_precondition",r.INVALID_ARGUMENT="invalid_argument",r.DEADLINE_EXCEEDED="deadline_exceeded",r.NOT_FOUND="not_found",r.ALREADY_EXISTS="already_exists",r.PERMISSION_DENIED="permission_denied",r.ABORTED="aborted",r.OUT_OF_RANGE="out_of_range",r.UNIMPLEMENTED="unimplemented",r.INTERNAL="internal",r.UNAVAILABLE="unavailable",r.DATA_LOSS="data_loss",r.INVALID_PASSWORD="invalid_password",r.PASSWORD_NOT_SET="password_not_set",r.INVALID_STATUS="invalid_status",r.USER_PENDING="user_pending",r.USER_BLOCKED="user_blocked",r.INVALID_VERIFICATION_CODE="invalid_verification_code",r.TWO_FACTOR_REQUIRED="two_factor_required",r.INVALID_TWO_FACTOR="invalid_two_factor",r.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",r.UNDER_REVIEW="under_review",r.INVALID_REQUEST="invalid_request",r.UNAUTHORIZED_CLIENT="unauthorized_client",r.ACCESS_DENIED="access_denied",r.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",r.INVALID_SCOPE="invalid_scope",r.INVALID_GRANT="invalid_grant",r.SERVER_ERROR="server_error",r.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",r.INTERACTION_REQUIRED="interaction_required",r.LOGIN_REQUIRED="login_required",r.ACCOUNT_SELECTION_REQUIRED="account_selection_required",r.CONSENT_REQUIRED="consent_required",r.INVALID_REQUEST_URI="invalid_request_uri",r.INVALID_REQUEST_OBJECT="invalid_request_object",r.REQUEST_NOT_SUPPORTED="request_not_supported",r.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",r.REGISTRATION_NOT_SUPPORTED="registration_not_supported",r.CAPTCHA_REQUIRED="captcha_required",r.CAPTCHA_INVALID="captcha_invalid",r.PROVIDER_NOT_ENABLED="provider_not_enabled",r.LOGIN_METHOD_DISABLED="login_method_disabled",r.INVALID_USERNAME_OR_PASSWORD="invalid_username_or_password",r.INVALID_CREDENTIALS="invalid_credentials",r.WRONG_PASSWORD="wrong_password",r.USER_NOT_FOUND="user_not_found",e.LOGIN_STATE_CHANGED_TYPE={SIGN_OUT:"sign_out",SIGN_IN:"sign_in",CREDENTIALS_ERROR:"credentials_error"},e.AUTH_STATE_CHANGED_TYPE={SIGNED_OUT:"SIGNED_OUT",SIGNED_IN:"SIGNED_IN",INITIAL_SESSION:"INITIAL_SESSION",PASSWORD_RECOVERY:"PASSWORD_RECOVERY",TOKEN_REFRESHED:"TOKEN_REFRESHED",USER_UPDATED:"USER_UPDATED",BIND_IDENTITY:"BIND_IDENTITY"},e.EVENTS={LOGIN_STATE_CHANGED:"loginStateChanged",AUTH_STATE_CHANGED:"authStateChanged"},e.OAUTH_TYPE={SIGN_IN:"sign_in",BIND_IDENTITY:"bind_identity"},e.DEFAULT_NODE_ACCESS_SCOPE="node-sdk-scope"},705:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},41:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=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(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.openURIWithCallback=void 0;var s=r(689),a=r(443),u=function(t,e){var r;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];clearTimeout(r),r=setTimeout((function(){return t.apply(null,n)}),e)}},c=new s.CloudbaseEventEmitter,l="resolveCaptchaData",h="padding:10px 8px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer;flex:1;white-space:nowrap;margin-left:10px",d="width:100%;padding:10px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer",f="background:#6c757d;cursor:not-allowed";e.openURIWithCallback=function(t,e){return i(void 0,void 0,Promise,(function(){var r,s,p,v;return o(this,(function(g){return r=(0,a.parseCaptcha)(t),s=r.captchaData,p=r.state,v=r.token,function(t){var e=t.oauthInstance,r=t.captchaState,s="captcha-image",a=function(){return i(void 0,void 0,void 0,(function(){var t,i;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e.createCaptchaData({state:r.state})];case 1:return t=o.sent(),r=n(n({},r),{captchaData:t.data,token:t.token}),document.getElementById(s).src=t.data,[3,3];case 2:return i=o.sent(),console.error("刷新图形验证码失败",i),[3,3];case 3:return[2]}}))}))},p=function(t,e,r){var n=document.createElement(t);return e&&(n.style.cssText=e),r&&(n.textContent=r),n},v=p("div","position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:999"),g=p("div","position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:320px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 0 10px rgba(0,0,0,0.2);z-index:1000");g.appendChild(p("p","margin-bottom:15px","请输入你看到的字符:"));var y=p("div","display:flex;align-items:center;justify-content:space-between;margin-bottom:15px"),_=p("img","width:100%;height:auto;border:1px solid #eee");_.id=s,_.src=r.captchaData,y.appendChild(_);var m=p("button",h,"刷新");m.onclick=u((function(){return i(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:m.textContent="加载中...",m.disabled=!0,m.style.cssText="".concat(h,";").concat(f),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,a()];case 2:return t.sent(),[3,4];case 3:return m.textContent="刷新",m.disabled=!1,m.style.cssText=h,[7];case 4:return[2]}}))}))}),500),y.appendChild(m),g.appendChild(y);var E=p("input","width:100%;padding:14px 16px;margin-bottom:15px;box-sizing:border-box;border:2px solid #e8ecf4;border-radius:10px;font-size:15px");E.type="text",E.placeholder="输入字符",E.maxLength=4,g.appendChild(E);var b=p("div","color:#dc3545;font-size:12px;margin-bottom:10px;display:none;padding:8px;background:#f8d7da;border:1px solid #f5c6cb;border-radius:4px");g.appendChild(b);var T=function(t){b.textContent=t,b.style.display="block"},S=p("button",d,"确定");S.onclick=u((function(){return i(void 0,void 0,void 0,(function(){var t,n,i,s;return o(this,(function(o){switch(o.label){case 0:if(!(t=E.value.trim()))return T("请输入字符"),[2];b.style.display="none",S.textContent="验证中...",S.disabled=!0,S.style.cssText="".concat(d,";").concat(f),o.label=1;case 1:return o.trys.push([1,3,5,6]),[4,e.verifyCaptchaData({token:r.token,key:t})];case 2:return n=o.sent(),c.fire(l,n),console.log("图形验证码校验成功"),document.body.removeChild(v),document.body.removeChild(g),[3,6];case 3:return i=o.sent(),console.error("图形验证码校验失败",i),s=i.error_description||"图形验证码校验失败",T(s),E.value="",E.focus(),[4,a()];case 4:return o.sent(),[3,6];case 5:return S.textContent="确定",S.disabled=!1,S.style.cssText=d,[7];case 6:return[2]}}))}))}),500),g.appendChild(S),document.body.appendChild(v),document.body.appendChild(g)}({oauthInstance:e,captchaState:{captchaData:s,state:p,token:v}}),[2,new Promise((function(t){console.log("等待图形验证码校验结果..."),c.on(l,(function(e){t(null==e?void 0:e.data)}))}))]}))}))}},295:function(t,e,r){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=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(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.Captcha=void 0;var o=r(806),s=r(351),a=r(536),u=r(41),c=function(){function t(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=s.defaultStorage),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId||t.env)}return t.prototype.isMatch=function(){var t,e,r;return(null===(r=null===(e=null===(t=this.config)||void 0===t?void 0:t.adapter)||void 0===e?void 0:e.isMatch)||void 0===r?void 0:r.call(e))||(0,a.isMp)()},t.prototype.request=function(t,e){return n(this,void 0,Promise,(function(){var r,n,s,a;return i(this,(function(i){switch(i.label){case 0:return e||(e={}),e.method||(e.method="GET"),r="".concat(e.method,":").concat(t),n=t,e.withCaptcha?[4,this.appendCaptchaTokenToURL(t,r,!1)]:[3,2];case 1:n=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,7]),[4,this.config.request(n,e)];case 3:return s=i.sent(),[3,7];case 4:return(a=i.sent()).error!==o.ErrorType.CAPTCHA_REQUIRED&&a.error!==o.ErrorType.CAPTCHA_INVALID?[3,6]:[4,this.appendCaptchaTokenToURL(t,r,a.error===o.ErrorType.CAPTCHA_INVALID)];case 5:return t=i.sent(),[2,this.config.request(t,e)];case 6:return[2,Promise.reject(a)];case 7:return[2,s]}}))}))},t.prototype.getDefaultOpenURIWithCallback=function(){var t=this;return function(e){return(0,u.openURIWithCallback)(e,t.config.oauthInstance)}},t.prototype.getCaptchaToken=function(t,e){return n(this,void 0,Promise,(function(){var r,n,s,a;return i(this,(function(i){switch(i.label){case 0:return t?[3,2]:[4,this.findCaptchaToken()];case 1:if(r=i.sent())return[2,r];i.label=2;case 2:return[4,this.config.request(o.ApiUrls.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:""},withCredentials:!1})];case 3:return n=i.sent(),s="".concat(n.data,"?state=").concat(encodeURIComponent(e),"&token=").concat(encodeURIComponent(n.token)),[4,this.config.openURIWithCallback(s)];case 4:return a=i.sent(),this.saveCaptchaToken(a),[2,a.captcha_token]}}))}))},t.prototype.appendCaptchaTokenToURL=function(t,e,r){return n(this,void 0,Promise,(function(){var n;return i(this,(function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(r,e)];case 1:return n=i.sent(),t.indexOf("?")>0?t+="&captcha_token=".concat(n):t+="?captcha_token=".concat(n),[2,t]}}))}))},t.prototype.saveCaptchaToken=function(t){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10)),e=JSON.stringify(t),[4,this.config.storage.setItem(this.tokenSectionName,e)];case 1:return r.sent(),[2]}}))}))},t.prototype.findCaptchaToken=function(){return n(this,void 0,Promise,(function(){var t,e;return i(this,(function(r){switch(r.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if(null==(t=r.sent()))return[3,5];r.label=2;case 2:return r.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),e.expires_at<new Date?[2,null]:[2,e.captcha_token];case 3:return r.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return r.sent(),[2,null];case 5:return[2,null]}}))}))},t}();e.Captcha=c},463:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseOAuth=e.AUTH_STATE_CHANGED_TYPE=e.EVENTS=e.LOGIN_STATE_CHANGED_TYPE=e.DEFAULT_NODE_ACCESS_SCOPE=e.OAUTH_TYPE=e.AUTH_API_PREFIX=e.weAppJwtDecodeAll=e.authModels=e.AuthErrorCategory=e.AuthError=e.Auth=void 0;var a=r(351),u=r(841),c=r(806),l=r(841);Object.defineProperty(e,"Auth",{enumerable:!0,get:function(){return l.Auth}});var h=r(70);Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return h.AuthError}}),Object.defineProperty(e,"AuthErrorCategory",{enumerable:!0,get:function(){return h.AuthErrorCategory}}),e.authModels=s(r(705));var d=r(306);Object.defineProperty(e,"weAppJwtDecodeAll",{enumerable:!0,get:function(){return d.weAppJwtDecodeAll}});var f=r(806);Object.defineProperty(e,"AUTH_API_PREFIX",{enumerable:!0,get:function(){return f.AUTH_API_PREFIX}}),Object.defineProperty(e,"OAUTH_TYPE",{enumerable:!0,get:function(){return f.OAUTH_TYPE}}),Object.defineProperty(e,"DEFAULT_NODE_ACCESS_SCOPE",{enumerable:!0,get:function(){return f.DEFAULT_NODE_ACCESS_SCOPE}}),Object.defineProperty(e,"LOGIN_STATE_CHANGED_TYPE",{enumerable:!0,get:function(){return f.LOGIN_STATE_CHANGED_TYPE}}),Object.defineProperty(e,"EVENTS",{enumerable:!0,get:function(){return f.EVENTS}}),Object.defineProperty(e,"AUTH_STATE_CHANGED_TYPE",{enumerable:!0,get:function(){return f.AUTH_STATE_CHANGED_TYPE}});var p=function(){function t(t){var e=t.apiOrigin,r=t.apiPath,i=void 0===r?c.AUTH_API_PREFIX:r,o=t.clientId,s=t.env,l=t.storage,h=t.request,d=t.baseRequest,f=t.anonymousSignInFunc,p=t.wxCloud,v=t.adapter,g=t.onCredentialsError,y=t.headers,_=t.i18n,m=t.useWxCloud,E=t.eventBus,b=t.detectSessionInUrl,T=t.debug;if(this.detectSessionInUrl=null!=b&&b,this.oauth2client=new a.OAuth2Client({apiOrigin:e,apiPath:i,clientId:o,env:s,storage:l,baseRequest:d||h,anonymousSignInFunc:f,wxCloud:p,onCredentialsError:g,headers:y||{},i18n:_,useWxCloud:m,eventBus:E,debug:T}),this.authApi=new u.Auth(n(n({credentialsClient:this.oauth2client},t),{request:h?this.oauth2client.request.bind(this.oauth2client):void 0,adapter:v})),b)this.oauth2client.setGetInitialSession(this.authApi.getInitialSession.bind(this.authApi));else try{var S=new URL(window.location.href),I=S.searchParams.get("code"),A=S.searchParams.get("state"),O=JSON.parse(sessionStorage.getItem(A)||"null");I&&A&&(null==O?void 0:O.hash)&&(S.hash=O.hash,window.history.replaceState(null,"",S.toString()),window.location.replace(S.toString()))}catch(t){}}return t.prototype.initializeSession=function(t){this.detectSessionInUrl?(this.oauth2client.setOnInitialSessionObtained(t),this.oauth2client.initialize()):this.oauth2client.initialize(Promise.resolve({error:null}))},t}();e.CloudbaseOAuth=p},796:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Syntax=e.ErrorType=void 0;var n,i=r(806);Object.defineProperty(e,"ErrorType",{enumerable:!0,get:function(){return i.ErrorType}}),(n=e.Syntax||(e.Syntax={})).CLIENT_ID="client_id",n.CLIENT_SECRET="client_secret",n.RESPONSE_TYPE="response_type",n.SCOPE="scope",n.STATE="state",n.REDIRECT_URI="redirect_uri",n.ERROR="error",n.ERROR_DESCRIPTION="error_description",n.ERROR_URI="error_uri",n.GRANT_TYPE="grant_type",n.CODE="code",n.ACCESS_TOKEN="access_token",n.TOKEN_TYPE="token_type",n.EXPIRES_IN="expires_in",n.USERNAME="username",n.PASSWORD="password",n.REFRESH_TOKEN="refresh_token"},351:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=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(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.OAuth2Client=e.defaultStorage=e.generateRequestId=e.toResponseError=e.defaultRequest=void 0;var a=r(796),u=r(806),c=r(423),l=r(173),h=r(74),d=r(306),f=r(536),p=r(515),v="x-request-id",g="x-device-id",y="device_id";function _(){return(0,c.uuidv4)()}e.defaultRequest=function(t,e){return i(this,void 0,Promise,(function(){var r,n,i,s,u;return o(this,(function(o){switch(o.label){case 0:r=null,n=null,o.label=1;case 1:return o.trys.push([1,4,,5]),(i=Object.assign({},e)).method||(i.method="GET"),i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body)),[4,fetch(t,i)];case 2:return[4,o.sent().json()];case 3:return(null==(s=o.sent())?void 0:s.error)?(n=s).error_uri=new URL(t).pathname:r=s,[3,5];case 4:return u=o.sent(),n={error:a.ErrorType.UNREACHABLE,error_description:u.message,error_uri:new URL(t).pathname},[3,5];case 5:if(n)throw n;return[2,r]}}))}))},e.toResponseError=function(t,e){var r,n=e||{};if(t instanceof Error)r={error:n.error||a.ErrorType.LOCAL,error_description:n.error_description||t.message,error_uri:n.error_uri,details:n.details||t.stack};else{var i=t||{};r={error:n.error||i.error||a.ErrorType.LOCAL,error_description:n.error_description||i.error_description,error_uri:n.error_uri||i.error_uri,details:n.details||i.details}}return r},e.generateRequestId=_;var m=function(){function t(t){this._env=(null==t?void 0:t.env)||""}return t.prototype.getItem=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,window.localStorage.getItem("".concat(t).concat(this._env))]}))}))},t.prototype.removeItem=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return window.localStorage.removeItem("".concat(t).concat(this._env)),[2]}))}))},t.prototype.setItem=function(t,e){return i(this,void 0,Promise,(function(){return o(this,(function(r){return window.localStorage.setItem("".concat(t).concat(this._env),e),[2]}))}))},t.prototype.getItemSync=function(t){return window.localStorage.getItem("".concat(t).concat(this._env))},t.prototype.removeItemSync=function(t){window.localStorage.removeItem("".concat(t).concat(this._env))},t.prototype.setItemSync=function(t,e){window.localStorage.setItem("".concat(t).concat(this._env),e)},t}();function E(t){var e=!0;return(null==t?void 0:t.expires_at)&&(null==t?void 0:t.access_token)&&(e=t.expires_at<new Date),e}e.defaultStorage=new m;var b=function(){function t(t){this.credentials=null,this.accessKeyCredentials=null,this.singlePromise=null,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage,this.clientId=t.clientId,this.singlePromise=new h.SinglePromise({clientId:this.clientId}),this.credentials=t.credentials||null}return t.prototype.getStorageCredentialsSync=function(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t},t.prototype.setCredentials=function(t){return i(this,void 0,Promise,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return(null==t?void 0:t.expires_in)?((null==t?void 0:t.expires_at)||(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30))),this.storage?(e=JSON.stringify(t),[4,this.storage.setItem(this.tokenSectionName,e)]):[3,2]):[3,3];case 1:r.sent(),r.label=2;case 2:return this.credentials=t,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:r.sent(),r.label=5;case 5:this.credentials=null,r.label=6;case 6:return[2]}}))}))},t.prototype.setAccessKeyCredentials=function(t){this.accessKeyCredentials=t,t.scope===u.DEFAULT_NODE_ACCESS_SCOPE&&(this.credentials=t)},t.prototype.getCredentials=function(){return i(this,void 0,Promise,(function(){var t=this;return o(this,(function(e){return[2,this.singlePromise.run("getCredentials",(function(){return i(t,void 0,void 0,(function(){var t,e;return o(this,(function(r){switch(r.label){case 0:return E(this.credentials)?[4,this.getStorageCredentials()]:[3,2];case 1:if(t=r.sent(),e=t.credentials,t.isAccessKeyCredentials)return[2,e];this.credentials=e,r.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},t.prototype.getStorageCredentials=function(){return i(this,void 0,Promise,(function(){var t=this;return o(this,(function(e){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return i(t,void 0,void 0,(function(){var t,e,r;return o(this,(function(n){switch(n.label){case 0:return t=null,e=!1,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(!(r=n.sent()))return[3,6];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(t=JSON.parse(r))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),t=null,[3,5];case 5:return[3,7];case 6:t=this.accessKeyCredentials||null,e=!0,n.label=7;case 7:return[2,{credentials:t,isAccessKeyCredentials:e}]}}))}))}))]}))}))},t}();e.OAuth2Client=function(){function t(r){var n,i=this;this.initializePromise=null,this.lockAcquired=!1,this.pendingInLock=[],this.singlePromise=null,r.clientSecret||(r.clientSecret=""),!r.clientId&&r.env&&(r.clientId=r.env),this.apiOrigin=r.apiOrigin,this.apiPath=r.apiPath||u.AUTH_API_PREFIX,this.clientId=r.clientId,this.i18n=r.i18n,this.eventBus=r.eventBus,this.singlePromise=new h.SinglePromise({clientId:this.clientId}),this.retry=this.formatRetry(r.retry,t.defaultRetry),r.baseRequest?this.baseRequest=r.baseRequest:this.baseRequest=e.defaultRequest,this.tokenInURL=r.tokenInURL,this.headers=r.headers,this.storage=r.storage||e.defaultStorage,this.localCredentials=new b({tokenSectionName:"credentials_".concat(r.clientId),storage:this.storage,clientId:r.clientId}),this.clientSecret=r.clientSecret,r.clientId&&(this.basicAuth="Basic ".concat((0,d.weBtoa)("".concat(r.clientId,":").concat(this.clientSecret)))),this.wxCloud=r.wxCloud;try{(0,f.isMp)()&&(this.useWxCloud=r.useWxCloud,void 0===this.wxCloud&&r.env&&(wx.cloud.init({env:r.env}),this.wxCloud=wx.cloud))}catch(t){}this.refreshTokenFunc=r.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=r.anonymousSignInFunc,this.onCredentialsError=r.onCredentialsError,this.getInitialSession=r.getInitialSession,this.onInitialSessionObtained=r.onInitialSessionObtained,this.logDebugMessages=null!==(n=r.debug)&&void 0!==n&&n,p.langEvent.bus.on(p.langEvent.LANG_CHANGE_EVENT,(function(t){var e;i.i18n=(null===(e=t.data)||void 0===e?void 0:e.i18n)||i.i18n}))}return t.prototype.setGetInitialSession=function(t){this.getInitialSession=t},t.prototype.setOnInitialSessionObtained=function(t){this.onInitialSessionObtained=t},t.prototype.initialize=function(t){return i(this,void 0,Promise,(function(){var e=this;return o(this,(function(r){switch(r.label){case 0:return this.initializePromise?[4,this.initializePromise]:[3,2];case 1:case 3:case 5:return[2,r.sent()];case 2:return void 0===t?[3,4]:(this.initializePromise=t,[4,this.initializePromise]);case 4:return this.initializePromise=i(e,void 0,void 0,(function(){var t=this;return o(this,(function(e){switch(e.label){case 0:return[4,this._acquireLock(-1,(function(){return i(t,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._initialize()];case 1:return[2,t.sent()]}}))}))}))];case 1:return[2,e.sent()]}}))})),[4,this.initializePromise]}}))}))},t.prototype.setCredentials=function(t){return i(this,void 0,Promise,(function(){var e=this;return o(this,(function(r){switch(r.label){case 0:return[4,this.initializePromise];case 1:return r.sent(),[2,this._acquireLock(-1,(function(){return i(e,void 0,void 0,(function(){return o(this,(function(e){return[2,this.localCredentials.setCredentials(t)]}))}))}))]}}))}))},t.prototype.setAccessKeyCredentials=function(t){return this.localCredentials.setAccessKeyCredentials(t)},t.prototype.getAccessToken=function(){return i(this,void 0,Promise,(function(){var t,e;return o(this,(function(r){switch(r.label){case 0:return[4,this.initializePromise];case 1:return r.sent(),[4,this.getCredentials()];case 2:return(null==(t=r.sent())?void 0:t.scope)===u.DEFAULT_NODE_ACCESS_SCOPE||(null==t?void 0:t.access_token)?[2,Promise.resolve(t.access_token)]:(e={error:a.ErrorType.UNAUTHENTICATED},[2,Promise.reject(e)])}}))}))},t.prototype.request=function(e,r){var s,u;return i(this,void 0,Promise,(function(){var i,c,l,h,d,f,p,y,m;return o(this,(function(o){switch(o.label){case 0:return r||(r={}),i=this.formatRetry(r.retry,this.retry),r.headers=n(n({},r.headers),((m={})[null===(s=this.i18n)||void 0===s?void 0:s.LANG_HEADER_KEY]=null===(u=this.i18n)||void 0===u?void 0:u.lang,m)),this.headers&&(r.headers=n(n({},this.headers),r.headers)),r.headers[v]||(r.headers[v]=_()),r.headers[g]?[3,2]:[4,this.getDeviceId()];case 1:c=o.sent(),r.headers[g]=c,o.label=2;case 2:return(null==r?void 0:r.withBasicAuth)&&this.basicAuth&&(r.headers.Authorization=this.basicAuth),(null==r?void 0:r.withCredentials)?r.getCredentials?[4,r.getCredentials()]:[3,4]:[3,7];case 3:return h=o.sent(),[3,6];case 4:return[4,this.getCredentials()];case 5:h=o.sent(),o.label=6;case 6:return(l=h)&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(l.access_token)):r.headers.Authorization="".concat(l.token_type," ").concat(l.access_token)),[3,8];case 7:this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId)),o.label=8;case 8:e.startsWith("/")&&(e="".concat(this.apiOrigin).concat(this.apiPath).concat(e)),d=null,f=i+1,p=0,o.label=9;case 9:if(!(p<f))return[3,21];o.label=10;case 10:return o.trys.push([10,15,,18]),r.useWxCloud||this.useWxCloud?[4,this.wxCloudCallFunction(e,r)]:[3,12];case 11:return d=o.sent(),[3,14];case 12:return[4,this.baseRequest(e,r)];case 13:d=o.sent(),o.label=14;case 14:if(null==d?void 0:d.code)throw{error:d.code,error_description:d.message,error_uri:new URL(e).pathname};return[3,21];case 15:y=o.sent();try{y.requestId=y.requestId||r.headers[v]||""}catch(t){}return r.withCredentials&&y&&y.error===a.ErrorType.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,17];case 16:return o.sent(),[2,Promise.reject(y)];case 17:return p!==i&&y&&"unreachable"===y.error?[3,18]:[2,Promise.reject(y)];case 18:return[4,this.sleep(t.retryInterval)];case 19:o.sent(),o.label=20;case 20:return p++,[3,9];case 21:return[2,d]}}))}))},t.prototype.wxCloudCallFunction=function(t,e){var r;return i(this,void 0,Promise,(function(){var i,s,u,c,h;return o(this,(function(o){switch(o.label){case 0:i=null,s=null,o.label=1;case 1:o.trys.push([1,7,,8]),u="",o.label=2;case 2:return o.trys.push([2,4,,5]),[4,wx.getRendererUserAgent()];case 3:return u=o.sent(),[3,5];case 4:return o.sent(),[3,5];case 5:return[4,this.wxCloud.callFunction({name:"httpOverCallFunction",data:{url:t,method:e.method,headers:n({origin:"https://servicewechat.com","User-Agent":u},e.headers),body:e.body}})];case 6:return c=o.sent().result,(null===(r=null==c?void 0:c.body)||void 0===r?void 0:r.error_code)?(s=null==c?void 0:c.body).error_uri=(0,l.getPathName)(t):i=null==c?void 0:c.body,[3,8];case 7:return h=o.sent(),s={error:a.ErrorType.UNREACHABLE,error_description:h.message,error_uri:(0,l.getPathName)(t)},[3,8];case 8:if(s)throw s;return[2,i]}}))}))},t.prototype.getCredentials=function(){return i(this,void 0,Promise,(function(){var t=this;return o(this,(function(e){switch(e.label){case 0:return[4,this.initializePromise];case 1:return e.sent(),[2,this._acquireLock(-1,(function(){return i(t,void 0,void 0,(function(){return o(this,(function(t){return[2,this._getCredentials()]}))}))}))]}}))}))},t.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},t.prototype.getCredentialsAsync=function(){return this.getCredentials()},t.prototype.getScope=function(){var t;return i(this,void 0,Promise,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(e=n.sent())?[2,e.scope]:(r="credentials not found",null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:r}),[2,this.unAuthenticatedError(r)])}}))}))},t.prototype.getGroups=function(){var t;return i(this,void 0,Promise,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(e=n.sent())?[2,e.groups]:(r="credentials not found",null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:r}),[2,this.unAuthenticatedError(r)])}}))}))},t.prototype.refreshToken=function(t,e){return i(this,void 0,Promise,(function(){var r=this;return o(this,(function(n){switch(n.label){case 0:return[4,this.initializePromise];case 1:return n.sent(),[2,this._acquireLock(-1,(function(){return i(r,void 0,void 0,(function(){return o(this,(function(r){return[2,this._refreshToken(t,e)]}))}))}))]}}))}))},t.prototype._refreshToken=function(t,e){return i(this,void 0,Promise,(function(){var r=this;return o(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return i(r,void 0,void 0,(function(){var r,n,i,s,c,l,h;return o(this,(function(o){switch(o.label){case 0:if((null==t?void 0:t.scope)===u.DEFAULT_NODE_ACCESS_SCOPE)return[2,t];if(!t||!t.refresh_token)return i="no refresh token found in credentials",null===(s=this.onCredentialsError)||void 0===s||s.call(this,{msg:i}),[2,this.unAuthenticatedError(i)];o.label=1;case 1:return o.trys.push([1,4,,7]),[4,this.refreshTokenFunc(t.refresh_token,t)];case 2:return r=o.sent(),[4,this.localCredentials.setCredentials(r)];case 3:return o.sent(),null===(c=this.eventBus)||void 0===c||c.fire(u.EVENTS.AUTH_STATE_CHANGED,{event:u.AUTH_STATE_CHANGED_TYPE.TOKEN_REFRESHED}),[2,r];case 4:if(n=o.sent(),null==e?void 0:e.throwError)throw n;return n.error!==a.ErrorType.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return o.sent(),i=n.error_description,null===(l=this.onCredentialsError)||void 0===l||l.call(this,{msg:i}),[2,this.unAuthenticatedError(i)];case 6:return null===(h=this.onCredentialsError)||void 0===h||h.call(this,{msg:n.error_description}),[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.anonymousLogin=function(t){return i(this,void 0,void 0,(function(){var e=this;return o(this,(function(r){return[2,this.singlePromise.run("_anonymousLogin",(function(){return i(e,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:return this.anonymousSignInFunc?[4,this.anonymousSignInFunc(t)]:[3,4];case 1:return e=n.sent(),(r=e)?[3,3]:[4,this.localCredentials.getCredentials()];case 2:r=n.sent(),n.label=3;case 3:return t=r,[3,6];case 4:return[4,this.anonymousSignIn(t)];case 5:t=n.sent(),n.label=6;case 6:return[2,t]}}))}))}))]}))}))},t.prototype.checkRetry=function(e){var r=null;if(("number"!=typeof e||e<t.minRetry||e>t.maxRetry)&&(r={error:a.ErrorType.UNREACHABLE,error_description:"wrong options param: retry"}),r)throw r;return e},t.prototype.formatRetry=function(t,e){return void 0===t?e:this.checkRetry(t)},t.prototype.sleep=function(t){return i(this,void 0,Promise,(function(){return o(this,(function(e){return[2,new Promise((function(e){setTimeout((function(){e()}),t)}))]}))}))},t.prototype.anonymousSignIn=function(t){return i(this,void 0,Promise,(function(){var e=this;return o(this,(function(r){return[2,this.singlePromise.run("_anonymous",(function(){return i(e,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:if(!t||"anonymous"!==t.scope)return[2,this.unAuthenticatedError("no anonymous in credentials")];n.label=1;case 1:return n.trys.push([1,4,,7]),[4,this.request(u.ApiUrls.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",withBasicAuth:!0,body:{}})];case 2:return e=n.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return n.sent(),[2,e];case 4:return(r=n.sent()).error!==a.ErrorType.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return n.sent(),[2,this.unAuthenticatedError(r.error_description)];case 6:return[2,Promise.reject(r)];case 7:return[2]}}))}))}))]}))}))},t.prototype.defaultRefreshTokenFunc=function(t,e){var r;return i(this,void 0,Promise,(function(){var i,s,a;return o(this,(function(o){switch(o.label){case 0:return void 0===t||""===t?(i="refresh token not found",null===(r=this.onCredentialsError)||void 0===r||r.call(this,{msg:i}),[2,this.unAuthenticatedError(i)]):(s=u.ApiUrls.AUTH_TOKEN_URL,"v2"===(null==e?void 0:e.version)&&(s=u.ApiUrlsV2.AUTH_TOKEN_URL),[4,this.request(s,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:t}})]);case 1:return a=o.sent(),[2,n(n({},a),{version:(null==e?void 0:e.version)||"v1"})]}}))}))},t.prototype.getDeviceId=function(){return i(this,void 0,Promise,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(y)];case 1:return"string"==typeof(t=e.sent())&&t.length>=16&&t.length<=48?[3,3]:(t=(0,c.uuidv4)(),[4,this.storage.setItem(y,t)]);case 2:e.sent(),e.label=3;case 3:return this.deviceID=t,[2,t]}}))}))},t.prototype.unAuthenticatedError=function(t){var e={error:a.ErrorType.UNAUTHENTICATED,error_description:t};return Promise.reject(e)},t.prototype._debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.logDebugMessages&&console.log.apply(console,s(["[OAuth2Client]"],t,!1))},t.prototype._initialize=function(){return i(this,void 0,Promise,(function(){var t,e,r,n,i,s;return o(this,(function(o){switch(o.label){case 0:if(o.trys.push([0,11,12,13]),!this.getInitialSession)return this._debug("#_initialize()","no getInitialSession callback set, skipping"),[2,{error:null}];this._debug("#_initialize()","calling getInitialSession callback"),o.label=1;case 1:return o.trys.push([1,9,,10]),[4,this.getInitialSession()];case 2:return s=o.sent(),t=s.data,e=s.error,(null==t?void 0:t.session)?(this._debug("#_initialize()","session obtained from getInitialSession",t.session),[4,this.localCredentials.setCredentials(null==t?void 0:t.session)]):[3,4];case 3:o.sent(),o.label=4;case 4:if(!this.onInitialSessionObtained)return[3,8];this._debug("#_initialize()","calling onInitialSessionObtained callback"),o.label=5;case 5:return o.trys.push([5,7,,8]),[4,this.onInitialSessionObtained(t,e)];case 6:return o.sent(),[3,8];case 7:return r=o.sent(),this._debug("#_initialize()","error in onInitialSessionObtained",r),[3,8];case 8:return e?(this._debug("#_initialize()","error from getInitialSession",e),[2,{error:e}]):[2,{error:null}];case 9:return n=o.sent(),this._debug("#_initialize()","exception during getInitialSession",n),[2,{error:n instanceof Error?n:new Error(String(n))}];case 10:return[3,13];case 11:return i=o.sent(),this._debug("#_initialize()","unexpected error",i),[2,{error:i instanceof Error?i:new Error(String(i))}];case 12:return this._debug("#_initialize()","end"),[7];case 13:return[2]}}))}))},t.prototype._acquireLock=function(t,e){return i(this,void 0,Promise,(function(){var r,n,a,u,c=this;return o(this,(function(l){switch(l.label){case 0:this._debug("#_acquireLock","begin",t),l.label=1;case 1:if(l.trys.push([1,,10,11]),this.lockAcquired)return r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=i(c,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,r];case 1:return t.sent(),[4,e()];case 2:return[2,t.sent()]}}))})),this.pendingInLock.push(i(c,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,n];case 1:case 2:return t.sent(),[3,3];case 3:return[2]}}))}))),[2,n];this._debug("#_acquireLock","acquiring lock for client",this.clientId),l.label=2;case 2:return l.trys.push([2,,8,9]),this.lockAcquired=!0,a=e(),this.pendingInLock.push(i(c,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,a];case 1:case 2:return t.sent(),[3,3];case 3:return[2]}}))}))),[4,a];case 3:l.sent(),l.label=4;case 4:return this.pendingInLock.length?(u=s([],this.pendingInLock,!0),[4,Promise.all(u)]):[3,6];case 5:return l.sent(),this.pendingInLock.splice(0,u.length),[3,4];case 6:return[4,a];case 7:return[2,l.sent()];case 8:return this._debug("#_acquireLock","releasing lock for client",this.clientId),this.lockAcquired=!1,[7];case 9:return[3,11];case 10:return this._debug("#_acquireLock","end"),[7];case 11:return[2]}}))}))},t.prototype._getCredentials=function(){var t,e,r;return i(this,void 0,Promise,(function(){var n,i,s;return o(this,(function(o){switch(o.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:if((null==(n=o.sent())?void 0:n.scope)===u.DEFAULT_NODE_ACCESS_SCOPE)return[2,n];if(!n)return s="credentials not found",null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:s}),[2,this.unAuthenticatedError(s)];if(!E(n))return[3,12];if(!n.refresh_token)return[3,9];o.label=2;case 2:return o.trys.push([2,4,,8]),[4,this._refreshToken(n)];case 3:return n=o.sent(),[3,8];case 4:return i=o.sent(),"anonymous"!==n.scope?[3,6]:[4,this.anonymousLogin(n)];case 5:return n=o.sent(),[3,7];case 6:return null===(e=this.onCredentialsError)||void 0===e||e.call(this,{msg:i.error_description}),[2,Promise.reject(i)];case 7:return[3,8];case 8:return[3,12];case 9:return"anonymous"!==n.scope?[3,11]:[4,this.anonymousLogin(n)];case 10:return n=o.sent(),[3,12];case 11:return s="no refresh token found in credentials",null===(r=this.onCredentialsError)||void 0===r||r.call(this,{msg:s}),[2,this.unAuthenticatedError(s)];case 12:return[2,n]}}))}))},t.defaultRetry=2,t.minRetry=0,t.maxRetry=5,t.retryInterval=1e3,t}()},306:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.weAppJwtDecodeAll=e.weappJwtDecode=e.base64_url_decode=e.weAtob=e.weBtoa=void 0;var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function i(t){var r=t.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(t){return decodeURIComponent((0,e.weAtob)(t).replace(/(.)/g,(function(t){var e=t.charCodeAt(0).toString(16).toUpperCase();return e.length<2&&(e="0".concat(e)),"%".concat(e)})))}(r)}catch(t){return(0,e.weAtob)(r)}}e.weBtoa=function(t){for(var e,n,i,o,s="",a=0,u=(t=String(t)).length%3;a<t.length;){if((n=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255||(o=t.charCodeAt(a++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");s+=r.charAt((e=n<<16|i<<8|o)>>18&63)+r.charAt(e>>12&63)+r.charAt(e>>6&63)+r.charAt(63&e)}return u?s.slice(0,u-3)+"===".substring(u):s},e.weAtob=function(t){if(t=String(t).replace(/[\t\n\f\r ]+/g,""),!n.test(t))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var e;t+="==".slice(2-(3&t.length));for(var i,o,s="",a=0;a<t.length;)e=r.indexOf(t.charAt(a++))<<18|r.indexOf(t.charAt(a++))<<12|(i=r.indexOf(t.charAt(a++)))<<6|(o=r.indexOf(t.charAt(a++))),s+=64===i?String.fromCharCode(e>>16&255):64===o?String.fromCharCode(e>>16&255,e>>8&255):String.fromCharCode(e>>16&255,e>>8&255,255&e);return s},e.base64_url_decode=i,e.weappJwtDecode=function(t,e){if("string"!=typeof t)throw new Error("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(i(t.split(".")[r]))}catch(t){throw new Error("Invalid token specified: ".concat(t)?t.message:0)}},e.weAppJwtDecodeAll=function(t){if("string"!=typeof t)throw new Error("Invalid token specified");try{var e=t.split(".").map((function(t,e){return 2===e?t:JSON.parse(i(t))}));return{claims:e[1],header:e[0],signature:e[2]}}catch(t){throw new Error("Invalid token specified: ".concat(t)?t.message:0)}}},900:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getEncryptInfo=void 0;var i=n(r(15)),o=r(173);e.getEncryptInfo=function(t){var e=void 0===t?{}:t,r=e.publicKey,n=void 0===r?"":r,s=e.payload,a=void 0===s?{}:s;if(!n)return"";try{var u=(0,o.deepClone)(a),c=new i.default;return c.setPublicKey(n),c.encryptLong("object"==typeof u?JSON.stringify(u):u)}catch(t){console.error("encrypt error:",t)}return""}},74:function(t,e){var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=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(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.SinglePromise=void 0;var i=new Map,o=function(){function t(t){this.clientId=(null==t?void 0:t.clientId)||"",i=i||new Map}return t.prototype.run=function(t,e){return r(this,void 0,Promise,(function(){var o,s=this;return n(this,(function(a){return t="".concat(this.clientId,"_").concat(t),(o=i.get(t))||(o=new Promise((function(o,a){r(s,void 0,void 0,(function(){var r,s,u;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return n.sent(),r=e(),s=o,[4,r];case 2:return s.apply(void 0,[n.sent()]),[3,5];case 3:return u=n.sent(),a(u),[3,5];case 4:return i.delete(t),[7];case 5:return[2]}}))}))})),i.set(t,o)),[2,o]}))}))},t.prototype.runIdlePromise=function(){return Promise.resolve()},t}();e.SinglePromise=o},173:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getPathName=e.deepClone=void 0,e.deepClone=function(t){var r=function(r){for(var n in t)t.hasOwnProperty(n)&&(r[n]=(0,e.deepClone)(t[n]));return r},n=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(n))return t.slice();switch(n){case"Object":return r(Object.create(Object.getPrototypeOf(t)));case"Array":return r([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},e.getPathName=function(t){var e=t.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return e&&e[2]||""}},536:(t,e)=>{function r(){if("undefined"==typeof globalThis)return!1;var t=globalThis.wx;if(void 0===t)return!1;if(void 0===globalThis.Page)return!1;if(!t.getDeviceInfo)return!1;if(!t.getStorageSync)return!1;if(!t.setStorageSync)return!1;if(!t.connectSocket)return!1;if(!t.request)return!1;try{if(!t.getDeviceInfo())return!1;if("qq"===t.getDeviceInfo().platform)return!1}catch(t){return!1}return!0}Object.defineProperty(e,"__esModule",{value:!0}),e.isInMpWebView=e.isMp=void 0,e.isMp=r;var n=!1;function i(){n=n||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}try{r()||(n=n||!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?i():"undefined"!=typeof document&&document.addEventListener("WeixinJSBridgeReady",i,!1))}catch(t){}e.isInMpWebView=function(){return n}},81:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){if(this.params={},"string"==typeof t)this.parse(t);else if(t&&"object"==typeof t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.append(e,t[e])}return t.prototype.parse=function(t){var e=this;t.split("&").forEach((function(t){var r=t.split("=").map(decodeURIComponent),n=r[0],i=r[1];e.append(n,i)}))},t.prototype.append=function(t,e){this.params[t]?this.params[t]=this.params[t].concat([e]):this.params[t]=[e]},t.prototype.get=function(t){return this.params[t]?this.params[t][0]:null},t.prototype.getAll=function(t){return this.params[t]||[]},t.prototype.delete=function(t){delete this.params[t]},t.prototype.has=function(t){return Object.prototype.hasOwnProperty.call(this.params,t)},t.prototype.set=function(t,e){this.params[t]=[e]},t.prototype.toString=function(){var t=[],e=function(e){Object.prototype.hasOwnProperty.call(r.params,e)&&r.params[e].forEach((function(r){t.push("".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(r)))}))},r=this;for(var n in this.params)e(n);return t.join("&")},t}();e.default=r},423:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uuidv4=void 0,e.uuidv4=function(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}},662:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var a,u=s(r(853)),c=r(102);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(a=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t,e){for(var r=0,i=(0,c.isArray)(t)?t:[t];r<i.length;r++){var o=i[r],s=o.isMatch,a=o.genAdapter,u=o.runtime;if(s())return{adapter:n({isMatch:s},a(e)),runtime:u}}},e.useDefaultAdapter=function(){return{adapter:n({},u.genAdapter()),runtime:a.WEB}}},853:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)},s=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=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(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var u=r(829),c=r(102),l=r(78),h=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=i||"请求超时",r.restrictedMethods=o||["get","post","upload","download"],r}return i(e,t),e.prototype.get=function(t){return this.request(o(o({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(o(o({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(o(o({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,i=t.method,s=t.headers,a=void 0===s?{}:s,u={post:"post",put:"put"}[null==i?void 0:i.toLowerCase()]||"put",c=new FormData;return"post"===u?(Object.keys(e).forEach((function(t){c.append(t,e[t])})),c.append("key",n),c.append("file",r),this.request(o(o({},t),{data:c,method:u}),this.restrictedMethods.includes("upload"))):this.request(o(o({},t),{method:"put",headers:a,body:r}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return s(this,void 0,Promise,(function(){var e,r,n,i;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(o(o({},t),{headers:{},responseType:"blob"}))];case 1:return e=s.sent().data,r=window.URL.createObjectURL(new Blob([e])),n=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(i=document.createElement("a")).href=r,i.setAttribute("download",n),i.style.display="none",document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(r),document.body.removeChild(i),[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){var e;return s(this,void 0,Promise,(function(){var r,n,i,u,c,l,h,d,f,p,v,g,y,_=this;return a(this,(function(m){switch(m.label){case 0:return r=new AbortController,n=t.url,i=t.enableAbort,u=void 0!==i&&i,c=t.stream,l=void 0!==c&&c,h=t.signal,d=t.timeout,f=t.shouldThrowOnError,p=void 0===f||f,v=null!=d?d:this.timeout,h&&(h.aborted&&r.abort(),h.addEventListener("abort",(function(){return r.abort()}))),g=null,u&&v&&(g=setTimeout((function(){console.warn(_.timeoutMsg),r.abort(new Error(_.timeoutMsg))}),v)),[4,fetch(n,o(o({},t),{signal:r.signal})).then((function(t){return s(_,void 0,void 0,(function(){var e,r,n;return a(this,(function(i){switch(i.label){case 0:return clearTimeout(g),p?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return n=(r=Promise).reject,[4,t.json()];case 2:e=n.apply(r,[i.sent()]),i.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){if(clearTimeout(g),p)return Promise.reject(t)}))];case 1:return y=m.sent(),[2,{data:l?y.body:(null===(e=y.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?y.json():y.text(),statusCode:y.status,header:y.headers}]}}))}))},e.prototype.request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(i){var o,s,a=t.url,u=t.headers,h=void 0===u?{}:u,d=t.data,f=t.responseType,p=t.withCredentials,v=t.body,g=t.onUploadProgress,y=(0,c.formatUrl)((0,l.getProtocol)(),a,"get"===n?d:{}),_=new XMLHttpRequest;_.open(n,y),f&&(_.responseType=f),Object.keys(h).forEach((function(t){_.setRequestHeader(t,h[t])})),g&&_.upload.addEventListener("progress",g),_.onreadystatechange=function(){var t={};if(4===_.readyState){var e=_.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),i=e.join(": ");r[n]=i})),t.header=r,t.statusCode=_.status;try{t.data="blob"===f?_.response:JSON.parse(_.responseText)}catch(e){t.data="blob"===f?_.response:_.responseText}clearTimeout(o),i(t)}},e&&r.timeout&&(o=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=(0,c.isFormData)(d)?d:"application/x-www-form-urlencoded"===h["content-type"]?(0,c.toQueryString)(d):v||(d?JSON.stringify(d):void 0),p&&(_.withCredentials=!0),_.send(s)}))},e}(u.AbstractSDKRequest);e.WebRequest=h,e.genAdapter=function(){return{type:"default",root:window,reqClass:h,wsClass:WebSocket,localStorage}}},78:(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 r="@cloudbase/js-sdk";e.setSdkName=function(t){r=t},e.getSdkName=function(){return r};var n="https:";e.setProtocol=function(t){n=t},e.getProtocol=function(){return n},e.IS_DEBUG_MODE=("undefined"==typeof process||process.env,!1),e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},630:(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"}},546:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,i(r(78),e),i(r(630),e),e.OATUH_LOGINTYPE="constants"},640:function(t,e,r){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=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(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.catchErrorsDecorator=void 0;var o=r(102),s=r(546),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(t){var e=t.err,r=t.className,n=t.methodName,i=t.sourceLink;if(!i)return null;var o,s=e.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,"\\]")),h=s.findIndex((function(t){return u.test(t)}));if(-1!==h){var d=s.filter((function(t,e){return e>h}));d.unshift(s[h].replace(l,"".concat(r,".").concat(n)).replace(c,i)),(o=new Error).stack="".concat(a?"@debugger":"Error","\n").concat(d.join("\n"))}return o}e.catchErrorsDecorator=function(t){var e=t.mode,r=void 0===e?"async":e,a=t.customInfo,h=void 0===a?{}:a,d=t.title,f=t.messages,p=void 0===f?[]:f;return function(t,e,a){if(s.IS_DEBUG_MODE){var f=h.className||t.constructor.name,v=h.methodName||e,g=a.value,y=function(){var t="",e=(new Error).stack.split("\n"),r=e.findIndex((function(t){return u.test(t)}));if(-1!==r){var n=c.exec(e[r+1]||"");t=n?n[0]:""}return t}();a.value="sync"===r?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=l({err:new Error,className:f,methodName:v,sourceLink:y});try{return g.apply(this,t)}catch(t){var n=t,i=t.message,s=t.error,a=t.error_description,u={title:d||"".concat(f,".").concat(v," failed"),content:[{type:"error",body:t}]};if(i&&/^\{.*\}$/.test(i)){var c=JSON.parse(i);u.subtitle=i,c.code&&(r?(r.code=c.code,r.msg=c.msg):(t.code=c.code,t.message=c.msg),n=r||t,u.content=p.map((function(t){return{type:"info",body:t}})))}throw s&&a&&(u.subtitle=a,r?(r.code=s,r.msg=a):(t.code=s,t.message=a),n=r||t,u.content=p.map((function(t){return{type:"info",body:t}}))),(0,o.printGroupLog)(u),n}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n(this,void 0,void 0,(function(){var e,r,n,s,a,u,c,h;return i(this,(function(i){switch(i.label){case 0:e=l({err:new Error,className:f,methodName:v,sourceLink:y}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,g.apply(this,t)];case 2:return[2,i.sent()];case 3:throw r=i.sent(),n=r,s=r.message,a=r.error,u=r.error_description,c={title:d||"".concat(f,".").concat(v," failed"),content:[{type:"error",body:r}]},s&&/^\{.*\}$/.test(s)&&(h=JSON.parse(s),c.subtitle=h,h.code&&(e?(e.code=h.code,e.message=h.msg):(r.code=h.code,r.message=h.msg),n=e||r,c.content=p.map((function(t){return{type:"info",body:t}})))),a&&u&&(c.subtitle=u,e?(e.code=a,e.msg=u):(r.code=a,r.message=u),n=e||r,c.content=p.map((function(t){return{type:"info",body:t}}))),(0,o.printGroupLog)(c),n;case 4:return[2]}}))}))}}}}},607:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(640),e)},515:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.langEvent=e.AbortController=e.jwt=e.helpers=e.utils=e.events=e.cache=e.adapters=e.constants=void 0;var a=o(r(546));e.constants=a;var u=o(r(662));e.adapters=u;var c=o(r(388));e.cache=c;var l=o(r(363));e.events=l;var h=o(r(587));e.langEvent=h;var d=o(r(102));e.utils=d;var f=o(r(607));e.helpers=f;var p=s(r(450));e.AbortController=p.default;var v={decode:s(r(949)).default};e.jwt=v},450:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){var t=this;this.listeners=[],this.signal={aborted:!1,addEventListener:function(e,r){"abort"===e&&t.listeners.push(r)}}}return t.prototype.abort=function(){this.signal.aborted||(this.signal.aborted=!0,this.listeners.forEach((function(t){return t()})))},t}();e.default=r},388:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=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(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var a=r(829),u=r(102),c=r(546),l=function(t){function e(e){var r=t.call(this)||this;return r.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return i(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),h=function(){function t(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,i=t.keys,o=void 0===i?{}:i;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:((0,u.printWarn)(c.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(e.root));case"none":return new l(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}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,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(n))}catch(t){throw new Error(JSON.stringify({code:c.ERRORS.OPERATION_FAIL,msg:"[".concat((0,c.getSdkName)(),"][").concat(c.ERRORS.OPERATION_FAIL,"]setStore failed"),info:t}))}}else(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,r){return o(this,void 0,void 0,(function(){var n;return s(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(n))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){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(t){return""}e=e||"localCachev1";var n=this.storage.getItem(t);return n&&n.indexOf(e)>=0?JSON.parse(n).content:""}(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var r;return o(this,void 0,void 0,(function(){var n;return s(this,(function(i){switch(i.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(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(n=i.sent())&&n.indexOf(e)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return o(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=h},363:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||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=r(102),a=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=a;var u=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return i(e,t),e}(a);e.IErrorEvent=u;var c=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if((0,s.isInstanceOf)(t,u))return console.error(t.error),this;var r=(0,s.isString)(t)?new a(t,e||{}):t,n=r.name;if(this.listens(n)){r.target=this;for(var i=0,c=this.listeners[n]?o([],this.listeners[n],!0):[];i<c.length;i++)c[i].call(this,r)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();e.CloudbaseEventEmitter=c;var l=new c;e.addEventListener=function(t,e){l.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),l.fire(t,e)},e.removeEventListener=function(t,e){l.off(t,e)}},587:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LANG_CHANGE_EVENT=e.bus=void 0;var n=r(363);e.bus=new n.CloudbaseEventEmitter,e.LANG_CHANGE_EVENT="lang_change"},102:function(t,e,r){var n=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.parseCaptcha=e.parseQueryString=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 i=r(546);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===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return t>0?(n=(t+n)%16|0,t=Math.floor(t/16)):(n=(e+n)%16|0,e=Math.floor(e/16)),("x"===r?n:7&n|8).toString(16)}))},e.formatUrl=function(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),i="";return Object.keys(r).forEach((function(t){""===i?!n&&(e+="?"):i+="&",i+="".concat(t,"=").concat(encodeURIComponent(r[t]))})),/^http(s)?:\/\//.test(e+=i)?e:"".concat(t).concat(e)},e.toQueryString=function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(r){e.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var r=e||decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(t,"=([^&]*)(&|$)")),i=r.substr(r.indexOf("?")+1).match(n);return null!=i?i[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 r=e.split("?")[0],n=[],i=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==i){for(var o=(n=i.split("&")).length-1;o>=0;o-=1)n[o].split("=")[0]===t&&n.splice(o,1);r="".concat(r,"?").concat(n.join("&"))}return r},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 r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t},e.execCallback=function(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r},e.printWarn=function(t,e){console.warn("[".concat((0,i.getSdkName)(),"][").concat(t,"]:").concat(e))},e.printError=function(t,e){console.error({code:t,msg:"[".concat((0,i.getSdkName)(),"][").concat(t,"]:").concat(e)})},e.printInfo=function(t,e){console.log("[".concat((0,i.getSdkName)(),"][").concat(t,"]:").concat(e))},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat((0,i.getSdkName)(),"][").concat(t,"]:").concat(e)}))},e.printGroupLog=function(t){var e,r=t.title,n=t.subtitle,i=void 0===n?"":n,o=t.content,s=void 0===o?[]:o,a=t.printTrace,u=void 0!==a&&a,c=t.collapsed;void 0!==c&&c?(console.groupCollapsed||console.error)(r,i):(console.group||console.error)(r,i);for(var l=0,h=s;l<h.length;l++){var d=h[l],f=d.type,p=d.body;switch(f){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}u&&(console.trace||console.log)("stack trace:"),null===(e=console.groupEnd)||void 0===e||e.call(console)},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)},e.parseQueryString=function(t){t=t.replace(/^\?/,"");var e={};return t.split("&").forEach((function(t){var r=t.split("="),n=r[0],i=r[1];n=decodeURIComponent(n),i=decodeURIComponent(i),n&&(e[n]?Array.isArray(e[n])?e[n].push(i):e[n]=[e[n],i]:e[n]=i)})),e},e.parseCaptcha=function(t){var r={},i=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){t=i[1];var o=i[2];o&&(r=(0,e.parseQueryString)(o))}var s=r.token,a=n(r,["token"]);return/^data:/.test(t)&&!s?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(t)}:s?{state:a.state,token:s,captchaData:t}:{error:"unimplemented",error_description:"need to impl captcha data"}}},15:(t,e,r)=>{let n;if(r.r(e),r.d(e,{default:()=>R}),!globalThis.IS_MP_BUILD){const C="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis;var i="0123456789abcdefghijklmnopqrstuvwxyz";function N(t){return i.charAt(t)}function U(t,e){return t&e}function D(t,e){return t|e}function L(t,e){return t^e}function x(t,e){return t&~e}function k(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function M(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function j(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=o.charAt(r>>6)+o.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=o.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=o.charAt(r>>2)+o.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function q(t){var e,r="",n=0,i=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e){var s=o.indexOf(t.charAt(e));s<0||(0==n?(r+=N(s>>2),i=3&s,n=1):1==n?(r+=N(i<<2|s>>4),i=15&s,n=2):2==n?(r+=N(i),r+=N(s>>2),i=3&s,n=3):(r+=N(i<<2|s>>4),r+=N(15&s),n=0))}return 1==n&&(r+=N(i<<2)),r}var s,a,u={decode:function(t){var e;if(void 0===s){var r="0123456789ABCDEF";for(s={},e=0;e<16;++e)s[r.charAt(e)]=e;for(r=r.toLowerCase(),e=10;e<16;++e)s[r.charAt(e)]=e;for(e=0;e<8;++e)s[" \f\n\r\t \u2028\u2029".charAt(e)]=-1}var n=[],i=0,o=0;for(e=0;e<t.length;++e){var a=t.charAt(e);if("="==a)break;if(-1!=(a=s[a])){if(void 0===a)throw new Error("Illegal character at offset "+e);i|=a,++o>=2?(n[n.length]=i,i=0,o=0):i<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},c={decode:function(t){var e;if(void 0===a){for(a=Object.create(null),e=0;e<64;++e)a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(e=0;e<9;++e)a["= \f\n\r\t \u2028\u2029".charAt(e)]=-1}var r=[],n=0,i=0;for(e=0;e<t.length;++e){var o=t.charAt(e);if("="==o)break;if(-1!=(o=a[o])){if(void 0===o)throw new Error("Illegal character at offset "+e);n|=o,++i>=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,i=0):n<<=6}}switch(i){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=c.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return c.decode(t)}},l=1e13;class B{constructor(t){this.buf=[+t||0]}mulAdd(t,e){var r,n,i=this.buf,o=i.length;for(r=0;r<o;++r)(n=i[r]*t+e)<l?e=0:n-=(e=0|n/l)*l,i[r]=n;e>0&&(i[r]=e)}sub(t){var e,r,n=this.buf,i=n.length;for(e=0;e<i;++e)(r=n[e]-t)<0?(r+=l,t=1):t=0,n[e]=r;for(;0===n[n.length-1];)n.pop()}toString(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,r=e[e.length-1].toString(),n=e.length-2;n>=0;--n)r+=(l+e[n]).toString().substring(1);return r}valueOf(){for(var t=this.buf,e=0,r=t.length-1;r>=0;--r)e=e*l+t[r];return e}simplify(){var t=this.buf;return 1==t.length?t[0]:this}}var h,d=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,f=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function V(t,e){return t.length>e&&(t=t.substring(0,e)+"…"),t}class H{constructor(t,e){this.hexDigits="0123456789ABCDEF",t instanceof H?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}get(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]}hexByte(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)}hexDump(t,e,r){for(var n="",i=t;i<e;++i)if(n+=this.hexByte(this.get(i)),!0!==r)switch(15&i){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n}isASCII(t,e){for(var r=t;r<e;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0}parseStringISO(t,e){for(var r="",n=t;n<e;++n)r+=String.fromCharCode(this.get(n));return r}parseStringUTF(t,e){for(var r="",n=t;n<e;){var i=this.get(n++);r+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(n++)):String.fromCharCode((15&i)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r}parseStringBMP(t,e){for(var r,n,i="",o=t;o<e;)r=this.get(o++),n=this.get(o++),i+=String.fromCharCode(r<<8|n);return i}parseTime(t,e,r){var n=this.parseStringISO(t,e),i=(r?d:f).exec(n);return i?(r&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),n=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(n+=":"+i[5],i[6]&&(n+=":"+i[6],i[7]&&(n+="."+i[7]))),i[8]&&(n+=" UTC","Z"!=i[8]&&(n+=i[8],i[9]&&(n+=":"+i[9]))),n):"Unrecognized time: "+n}parseInteger(t,e){for(var r,n=this.get(t),i=n>127,o=i?255:0,s="";n==o&&++t<e;)n=this.get(t);if(0==(r=e-t))return i?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^o));)s=+s<<1,--r;s="("+r+" bit)\n"}i&&(n-=256);for(var a=new B(n),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()}parseBitString(t,e,r){for(var n=this.get(t),i="("+((e-t-1<<3)-n)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?n:0,c=7;c>=u;--c)o+=a>>c&1?"1":"0";if(o.length>r)return i+V(o,r)}return i+o}parseOctetString(t,e,r){if(this.isASCII(t,e))return V(this.parseStringISO(t,e),r);var n=e-t,i="("+n+" byte)\n";n>(r/=2)&&(e=t+r);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return n>r&&(i+="…"),i}parseOID(t,e,r){for(var n="",i=new B,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===n)if((i=i.simplify())instanceof B)i.sub(80),n="2."+i.toString();else{var u=i<80?i<40?0:1:2;n=u+"."+(i-40*u)}else n+="."+i.toString();if(n.length>r)return V(n,r);i=new B,o=0}}return o>0&&(n+=".incomplete"),n}}class G{constructor(t,e,r,n,i){if(!(n instanceof W))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=r,this.tag=n,this.sub=i}typeName(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}}content(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+r,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);case 6:return this.stream.parseOID(e,e+r,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return V(this.stream.parseStringUTF(e,e+r),t);case 18:case 19:case 20:case 21:case 22:case 26:return V(this.stream.parseStringISO(e,e+r),t);case 30:return V(this.stream.parseStringBMP(e,e+r),t);case 23:case 24:return this.stream.parseTime(e,e+r,23==this.tag.tagNumber)}return null}toString(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"}toPrettyString(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var r=0,n=this.sub.length;r<n;++r)e+=this.sub[r].toPrettyString(t)}return e}posStart(){return this.stream.pos}posContent(){return this.stream.pos+this.header}posEnd(){return this.stream.pos+this.header+Math.abs(this.length)}toHexString(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)}static decodeLength(t){var e=t.get(),r=127&e;if(r==e)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===r)return null;e=0;for(var n=0;n<r;++n)e=256*e+t.get();return e}getHexStringValue(){var t=this.toHexString(),e=2*this.header,r=2*this.length;return t.substr(e,r)}static decode(t){var e;e=t instanceof H?t:new H(t,0);var r=new H(e),n=new W(e),i=G.decodeLength(e),o=e.pos,s=o-r.pos,a=null,u=function(){var t=[];if(null!==i){for(var r=o+i;e.pos<r;)t[t.length]=G.decode(e);if(e.pos!=r)throw new Error("Content size is not correct for container starting at offset "+o)}else try{for(;;){var n=G.decode(e);if(n.tag.isEOC())break;t[t.length]=n}i=o-e.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return t};if(n.tagConstructed)a=u();else if(n.isUniversal()&&(3==n.tagNumber||4==n.tagNumber))try{if(3==n.tagNumber&&0!=e.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");a=u();for(var c=0;c<a.length;++c)if(a[c].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){a=null}if(null===a){if(null===i)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);e.pos=o+Math.abs(i)}return new G(r,s,i,n,a)}}class W{constructor(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=!!(32&e),this.tagNumber=31&e,31==this.tagNumber){var r=new B;do{e=t.get(),r.mulAdd(128,127&e)}while(128&e);this.tagNumber=r.simplify()}}isUniversal(){return 0===this.tagClass}isEOC(){return 0===this.tagClass&&0===this.tagNumber}}var p=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],v=(1<<26)/p[p.length-1];class F{constructor(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}toString(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=N(r));s>=0;)a<e?(r=(this[s]&(1<<a)-1)<<e-a,r|=this[--s]>>(a+=this.DB-e)):(r=this[s]>>(a-=e)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=N(r));return i?o:"0"}negate(){var t=K();return F.ZERO.subTo(this,t),t}abs(){return this.s<0?this.negate():this}compareTo(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0}bitLength(){return this.t<=0?0:this.DB*(this.t-1)+$(this[this.t-1]^this.s&this.DM)}mod(t){var e=K();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(F.ZERO)>0&&t.subTo(e,e),e}modPowInt(t,e){var r;return r=t<256||e.isEven()?new y(e):new _(e),this.exp(t,r)}clone(){var t=K();return this.copyTo(t),t}intValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}byteValue(){return 0==this.t?this.s:this[0]<<24>>24}shortValue(){return 0==this.t?this.s:this[0]<<16>>16}signum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}toByteArray(){var t=this.t,e=[];e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),128&r&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e}equals(t){return 0==this.compareTo(t)}min(t){return this.compareTo(t)<0?this:t}max(t){return this.compareTo(t)>0?this:t}and(t){var e=K();return this.bitwiseTo(t,U,e),e}or(t){var e=K();return this.bitwiseTo(t,D,e),e}xor(t){var e=K();return this.bitwiseTo(t,L,e),e}andNot(t){var e=K();return this.bitwiseTo(t,x,e),e}not(){for(var t=K(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}shiftLeft(t){var e=K();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}shiftRight(t){var e=K();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}getLowestSetBit(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+k(this[t]);return this.s<0?this.t*this.DB:-1}bitCount(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=M(this[r]^e);return t}testBit(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)}setBit(t){return this.changeBit(t,D)}clearBit(t){return this.changeBit(t,x)}flipBit(t){return this.changeBit(t,L)}add(t){var e=K();return this.addTo(t,e),e}subtract(t){var e=K();return this.subTo(t,e),e}multiply(t){var e=K();return this.multiplyTo(t,e),e}divide(t){var e=K();return this.divRemTo(t,e,null),e}remainder(t){var e=K();return this.divRemTo(t,null,e),e}divideAndRemainder(t){var e=K(),r=K();return this.divRemTo(t,e,r),[e,r]}modPow(t,e){var r,n,i=t.bitLength(),o=X(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(e):e.isEven()?new m(e):new _(e);var s=[],a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var l=K();for(n.sqrTo(s[1],l);a<=c;)s[a]=K(),n.mulTo(l,s[a-2],s[a]),a+=2}var h,d,f=t.t-1,p=!0,v=K();for(i=$(t[f])-1;f>=0;){for(i>=u?h=t[f]>>i-u&c:(h=(t[f]&(1<<i+1)-1)<<u-i,f>0&&(h|=t[f-1]>>this.DB+i-u)),a=r;!(1&h);)h>>=1,--a;if((i-=a)<0&&(i+=this.DB,--f),p)s[h].copyTo(o),p=!1;else{for(;a>1;)n.sqrTo(o,v),n.sqrTo(v,o),a-=2;a>0?n.sqrTo(o,v):(d=o,o=v,v=d),n.mulTo(v,s[h],o)}for(;f>=0&&!(t[f]&1<<i);)n.sqrTo(o,v),d=o,o=v,v=d,--i<0&&(i=this.DB-1,--f)}return n.revert(o)}modInverse(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return F.ZERO;for(var r=t.clone(),n=this.clone(),i=X(1),o=X(0),s=X(0),a=X(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}return 0!=n.compareTo(F.ONE)?F.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a}pow(t){return this.exp(t,new g)}gcd(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}isProbablePrime(t){var e,r=this.abs();if(1==r.t&&r[0]<=p[p.length-1]){for(e=0;e<p.length;++e)if(r[0]==p[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<p.length;){for(var n=p[e],i=e+1;i<p.length&&n<v;)n*=p[i++];for(n=r.modInt(n);e<i;)if(n%p[e++]==0)return!1}return r.millerRabin(t)}copyTo(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}fromInt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}fromString(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,o=0;--n>=0;){var s=8==r?255&+t[n]:Z(t,n);s<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&F.ZERO.subTo(this,this)}clamp(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}dlShiftTo(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}drShiftTo(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}lShiftTo(t,e){for(var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>n|s,s=(this[a]&i)<<r;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}rShiftTo(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<i,e[s-r]=this[s]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}}subTo(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()}multiplyTo(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&F.ZERO.subTo(e,e)}squareTo(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}divRemTo(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=K());var o=K(),s=this.s,a=t.s,u=this.DB-$(n[n.t-1]);u>0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var c=o.t,l=o[c-1];if(0!=l){var h=l*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),d=this.FV/h,f=(1<<this.F1)/h,p=1<<this.F2,v=r.t,g=v-c,y=null==e?K():e;for(o.dlShiftTo(g,y),r.compareTo(y)>=0&&(r[r.t++]=1,r.subTo(y,r)),F.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--g>=0;){var _=r[--v]==l?this.DM:Math.floor(r[v]*d+(r[v-1]+p)*f);if((r[v]+=o.am(0,_,r,g,0,c))<_)for(o.dlShiftTo(g,y),r.subTo(y,r);r[v]<--_;)r.subTo(y,r)}null!=e&&(r.drShiftTo(c,e),s!=a&&F.ZERO.subTo(e,e)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&F.ZERO.subTo(r,r)}}}invDigit(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e}isEven(){return 0==(this.t>0?1&this[0]:this.s)}exp(t,e){if(t>4294967295||t<1)return F.ONE;var r=K(),n=K(),i=e.convert(this),o=$(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)}chunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}toRadix(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=X(r),i=K(),o=K(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s}fromRadix(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a<t.length;++a){var u=Z(t,a);u<0?"-"==t.charAt(a)&&0==this.signum()&&(i=!0):(s=e*s+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&F.ZERO.subTo(this,this)}fromNumber(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(F.ONE.shiftLeft(t-1),D,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(F.ONE.shiftLeft(t-1),this);else{var n=[],i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}bitwiseTo(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}changeBit(t,e){var r=F.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}addTo(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()}dMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}dAddOffset(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}multiplyLowerTo(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()}multiplyUpperTo(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)}modInt(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r}millerRabin(t){var e=this.subtract(F.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>p.length&&(t=p.length);for(var i=K(),o=0;o<t;++o){i.fromInt(p[Math.floor(Math.random()*p.length)]);var s=i.modPow(n,this);if(0!=s.compareTo(F.ONE)&&0!=s.compareTo(e)){for(var a=1;a++<r&&0!=s.compareTo(e);)if(0==(s=s.modPowInt(2,this)).compareTo(F.ONE))return!1;if(0!=s.compareTo(e))return!1}}return!0}square(){var t=K();return this.squareTo(t),t}gcda(t,e){var r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(r.compareTo(n)<0){var i=r;r=n,n=i}var o=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)e(r);else{o<s&&(s=o),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=()=>{(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout((function(){e(n)}),0))};setTimeout(a,10)}}fromNumberAsync(t,e,r,n){if("number"==typeof e)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(F.ONE.shiftLeft(t-1),D,this),this.isEven()&&this.dAddOffset(1,0);var i=this,o=function(){i.dAddOffset(2,0),i.bitLength()>t&&i.subTo(F.ONE.shiftLeft(t-1),i),i.isProbablePrime(e)?setTimeout((function(){n()}),0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],a=7&t;s.length=1+(t>>3),e.nextBytes(s),a>0?s[0]&=(1<<a)-1:s[0]=0,this.fromString(s,256)}}}var g=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),y=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),_=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=K();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(F.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=K();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),m=function(){function t(t){this.m=t,this.r2=K(),this.q3=K(),F.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=K();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function K(){return new F(null)}function Y(t,e){return new F(t,e)}function z(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i}function Q(t,e,r,n,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,l=a*u+c*s;i=((u=s*u+((32767&l)<<15)+r[n]+(1073741823&i))>>>30)+(l>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i}function J(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,l=a*u+c*s;i=((u=s*u+((16383&l)<<14)+r[n]+i)>>28)+(l>>14)+a*c,r[n++]=268435455&u}return i}void 0!==C&&"Microsoft Internet Explorer"==C?.appName?(F.prototype.am=Q,h=30):"Netscape"!=C?.appName?(F.prototype.am=z,h=26):(F.prototype.am=J,h=28),F.prototype.DB=h,F.prototype.DM=(1<<h)-1,F.prototype.DV=1<<h,F.prototype.FV=Math.pow(2,52),F.prototype.F1=52-h,F.prototype.F2=2*h-52;var E,b,T=[];for(E="0".charCodeAt(0),b=0;b<=9;++b)T[E++]=b;for(E="a".charCodeAt(0),b=10;b<36;++b)T[E++]=b;for(E="A".charCodeAt(0),b=10;b<36;++b)T[E++]=b;function Z(t,e){var r=T[t.charCodeAt(e)];return null==r?-1:r}function X(t){var e=K();return e.fromInt(t),e}function $(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}F.ZERO=X(0),F.ONE=X(1);class tt{constructor(){this.i=0,this.j=0,this.S=[]}init(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0}next(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}}var S,I,A=null;if(null==A){A=[],I=0;var O=void 0;if("undefined"!=typeof window&&window?.crypto&&window?.crypto.getRandomValues){var w=new Uint32Array(256);for(window?.crypto.getRandomValues(w),O=0;O<w.length;++O)A[I++]=255&w[O]}var P=function(t){if(this.count=this.count||0,this.count>=256||I>=256)"undefined"!=typeof window&&(window?.removeEventListener?window?.removeEventListener("mousemove",P,!1):window?.detachEvent&&window?.detachEvent("onmousemove",P));else try{var e=t.x+t.y;A[I++]=255&e,this.count+=1}catch(t){}};"undefined"!=typeof window&&(window?.addEventListener?window?.addEventListener("mousemove",P,!1):window?.attachEvent&&window?.attachEvent("onmousemove",P))}function et(){if(null==S){for(S=new tt;I<256;){var t=Math.floor(65536*Math.random());A[I++]=255&t}for(S.init(A),I=0;I<A.length;++I)A[I]=0;I=0}return S.next()}class rt{constructor(){}nextBytes(t){for(var e=0;e<t.length;++e)t[e]=et()}}function nt(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=t.length-1;n>=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new rt,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new F(r)}class it{constructor(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}doPublic(t){return t.modPowInt(this.e,this.n)}doPrivate(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}setPublic(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=Y(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")}encrypt(t){var e=nt(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var n=r.toString(16);return 1&n.length?"0"+n:n}encryptLong(t){var e=this,r=(this.n.bitLength()+7>>3)-11;try{var n="";return t.length>r?(t.match(/.{1,117}/g).forEach((function(t){var r=e.encrypt(t);n+=r})),j(n)):j(this.encrypt(t))}catch(t){return!1}}decryptLong(t){var e=this,r=this.n.bitLength()+7>>3;t=q(t);try{if(t.length>r){var n="";return t.match(/.{1,256}/g).forEach((function(t){var r=e.decrypt(t);n+=r})),n}return this.decrypt(t)}catch(t){return!1}}setPrivate(t,e,r){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=Y(t,16),this.e=parseInt(e,16),this.d=Y(r,16)):console.error("Invalid RSA private key")}setPrivateEx(t,e,r,n,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=Y(t,16),this.e=parseInt(e,16),this.d=Y(r,16),this.p=Y(n,16),this.q=Y(i,16),this.dmp1=Y(o,16),this.dmq1=Y(s,16),this.coeff=Y(a,16)):console.error("Invalid RSA private key")}generate(t,e){var r=new rt,n=t>>1;this.e=parseInt(e,16);for(var i=new F(e,16);;){for(;this.p=new F(t-n,1,r),0!=this.p.subtract(F.ONE).gcd(i).compareTo(F.ONE)||!this.p.isProbablePrime(10););for(;this.q=new F(n,1,r),0!=this.q.subtract(F.ONE).gcd(i).compareTo(F.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(F.ONE),a=this.q.subtract(F.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo(F.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}decrypt(t){var e=Y(t,16),r=this.doPrivate(e);return null==r?null:ot(r,this.n.bitLength()+7>>3)}generateAsync(t,e,r){var n=new rt,i=t>>1;this.e=parseInt(e,16);var o=new F(e,16),s=this,a=()=>{var e=()=>{if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract(F.ONE),n=s.q.subtract(F.ONE),i=e.multiply(n);0==i.gcd(o).compareTo(F.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout((function(){r()}),0)):setTimeout(a,0)},u=()=>{s.q=K(),s.q.fromNumberAsync(i,1,n,(function(){s.q.subtract(F.ONE).gcda(o,(function(t){0==t.compareTo(F.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},c=()=>{s.p=K(),s.p.fromNumberAsync(t-i,1,n,(function(){s.p.subtract(F.ONE).gcda(o,(function(t){0==t.compareTo(F.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)}}function ot(t,e){for(var r=t.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var o=255&r[n];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}class st extends it{constructor(t=""){super(),t&&("string"==typeof t?this.parseKey(t):(this.hasPrivateKeyProperty(t)||this.hasPublicKeyProperty(t))&&this.parsePropertiesFrom(t))}parseKey(t){try{var e=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?u.decode(t):c.unarmor(t),i=G.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=Y(e,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=Y(o,16);var s=i.sub[4].getHexStringValue();this.p=Y(s,16);var a=i.sub[5].getHexStringValue();this.q=Y(a,16);var l=i.sub[6].getHexStringValue();this.dmp1=Y(l,16);var h=i.sub[7].getHexStringValue();this.dmq1=Y(h,16);var d=i.sub[8].getHexStringValue();this.coeff=Y(d,16)}else{if(2!==i.sub.length)return!1;var f=i.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=Y(e,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}}hasPublicKeyProperty(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")}hasPrivateKeyProperty(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")}parsePropertiesFrom(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)}}n=function(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null},n.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new st(t)},n.prototype.setPrivateKey=function(t){this.setKey(t)},n.prototype.setPublicKey=function(t){this.setKey(t)},n.prototype.decrypt=function(t){try{return this.getKey().decrypt(q(t))}catch(t){return!1}},n.prototype.encrypt=function(t){try{return j(this.getKey().encrypt(t))}catch(t){return!1}},n.prototype.encryptLong=function(t){try{for(var e=this.getKey().encryptLong(t)||"",r=this.getKey().decryptLong(e)||"",n=0,i=/null$/g;i.test(r)&&(n++,e=this.getKey().encryptLong(t)||"",r=this.getKey().decryptLong(e)||"",!(n>10)););return e}catch(t){return!1}},n.prototype.getKey=function(t){if(!this.key){if(this.key=new st,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},n.version="3.1.4"}const R=n},151:(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 r="@cloudbase/js-sdk";e.setSdkName=function(t){r=t},e.getSdkName=function(){return r};var n="https:";e.setProtocol=function(t){n=t},e.getProtocol=function(){return n},e.IS_DEBUG_MODE=("undefined"==typeof process||process.env,!1),e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},248:(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"}},932:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,i(r(151),e),i(r(248),e),e.OATUH_LOGINTYPE="constants"},689:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||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=r(443),a=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=a;var u=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return i(e,t),e}(a);e.IErrorEvent=u;var c=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if((0,s.isInstanceOf)(t,u))return console.error(t.error),this;var r=(0,s.isString)(t)?new a(t,e||{}):t,n=r.name;if(this.listens(n)){r.target=this;for(var i=0,c=this.listeners[n]?o([],this.listeners[n],!0):[];i<c.length;i++)c[i].call(this,r)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();e.CloudbaseEventEmitter=c;var l=new c;e.addEventListener=function(t,e){l.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),l.fire(t,e)},e.removeEventListener=function(t,e){l.off(t,e)}},443:function(t,e,r){var n=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.parseCaptcha=e.parseQueryString=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 i=r(932);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===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return t>0?(n=(t+n)%16|0,t=Math.floor(t/16)):(n=(e+n)%16|0,e=Math.floor(e/16)),("x"===r?n:7&n|8).toString(16)}))},e.formatUrl=function(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),i="";return Object.keys(r).forEach((function(t){""===i?!n&&(e+="?"):i+="&",i+="".concat(t,"=").concat(encodeURIComponent(r[t]))})),/^http(s)?:\/\//.test(e+=i)?e:"".concat(t).concat(e)},e.toQueryString=function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(r){e.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var r=e||decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(t,"=([^&]*)(&|$)")),i=r.substr(r.indexOf("?")+1).match(n);return null!=i?i[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 r=e.split("?")[0],n=[],i=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==i){for(var o=(n=i.split("&")).length-1;o>=0;o-=1)n[o].split("=")[0]===t&&n.splice(o,1);r="".concat(r,"?").concat(n.join("&"))}return r},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 r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t},e.execCallback=function(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r},e.printWarn=function(t,e){console.warn("[".concat((0,i.getSdkName)(),"][").concat(t,"]:").concat(e))},e.printError=function(t,e){console.error({code:t,msg:"[".concat((0,i.getSdkName)(),"][").concat(t,"]:").concat(e)})},e.printInfo=function(t,e){console.log("[".concat((0,i.getSdkName)(),"][").concat(t,"]:").concat(e))},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat((0,i.getSdkName)(),"][").concat(t,"]:").concat(e)}))},e.printGroupLog=function(t){var e,r=t.title,n=t.subtitle,i=void 0===n?"":n,o=t.content,s=void 0===o?[]:o,a=t.printTrace,u=void 0!==a&&a,c=t.collapsed;void 0!==c&&c?(console.groupCollapsed||console.error)(r,i):(console.group||console.error)(r,i);for(var l=0,h=s;l<h.length;l++){var d=h[l],f=d.type,p=d.body;switch(f){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}u&&(console.trace||console.log)("stack trace:"),null===(e=console.groupEnd)||void 0===e||e.call(console)},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)},e.parseQueryString=function(t){t=t.replace(/^\?/,"");var e={};return t.split("&").forEach((function(t){var r=t.split("="),n=r[0],i=r[1];n=decodeURIComponent(n),i=decodeURIComponent(i),n&&(e[n]?Array.isArray(e[n])?e[n].push(i):e[n]=[e[n],i]:e[n]=i)})),e},e.parseCaptcha=function(t){var r={},i=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){t=i[1];var o=i[2];o&&(r=(0,e.parseQueryString)(o))}var s=r.token,a=n(r,["token"]);return/^data:/.test(t)&&!s?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(t)}:s?{state:a.state,token:s,captchaData:t}:{error:"unimplemented",error_description:"need to impl captcha data"}}}},n={};function i(t){var e=n[t];if(void 0!==e)return e.exports;var o=n[t]={exports:{}};return r[t].call(o.exports,o,o.exports,i),o.exports}e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var o=Object.create(null);i.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&n&&r;"object"==typeof a&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach((t=>s[t]=()=>r[t]));return s.default=()=>r,i.d(o,s),o},i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(463);
@@ -1,14 +0,0 @@
1
- /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation. All rights reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
- this file except in compliance with the License. You may obtain a copy of the
5
- License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
- MERCHANTABLITY OR NON-INFRINGEMENT.
11
-
12
- See the Apache Version 2.0 License for specific language governing permissions
13
- and limitations under the License.
14
- ***************************************************************************** */
@@ -1 +0,0 @@
1
- (()=>{var e={9515:(e,t,r)=>{var n=r(8761)(r(7772),"DataView");e.exports=n},9612:(e,t,r)=>{var n=r(2118),o=r(6909),i=r(8138),s=r(4174),a=r(7942);function c(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},235:(e,t,r)=>{var n=r(3945),o=r(1846),i=r(8028),s=r(2344),a=r(4769);function c(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},326:(e,t,r)=>{var n=r(8761)(r(7772),"Map");e.exports=n},6738:(e,t,r)=>{var n=r(2411),o=r(6417),i=r(6928),s=r(9493),a=r(4150);function c(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},2760:(e,t,r)=>{var n=r(8761)(r(7772),"Promise");e.exports=n},2143:(e,t,r)=>{var n=r(8761)(r(7772),"Set");e.exports=n},6571:(e,t,r)=>{var n=r(235),o=r(5243),i=r(2858),s=r(4417),a=r(8605),c=r(1418);function u(e){var t=this.__data__=new n(e);this.size=t.size}u.prototype.clear=o,u.prototype.delete=i,u.prototype.get=s,u.prototype.has=a,u.prototype.set=c,e.exports=u},857:(e,t,r)=>{var n=r(7772).Symbol;e.exports=n},9162:(e,t,r)=>{var n=r(7772).Uint8Array;e.exports=n},3215:(e,t,r)=>{var n=r(8761)(r(7772),"WeakMap");e.exports=n},2517:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}},7552:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var s=e[r];t(s,r,e)&&(i[o++]=s)}return i}},1634:(e,t,r)=>{var n=r(6473),o=r(9631),i=r(6152),s=r(3226),a=r(9045),c=r(7598),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=i(e),l=!r&&o(e),h=!r&&!l&&s(e),d=!r&&!l&&!h&&c(e),p=r||l||h||d,f=p?n(e.length,String):[],v=f.length;for(var E in e)!t&&!u.call(e,E)||p&&("length"==E||h&&("offset"==E||"parent"==E)||d&&("buffer"==E||"byteLength"==E||"byteOffset"==E)||a(E,v))||f.push(E);return f}},343:e=>{e.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}},5067:e=>{e.exports=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}},91:(e,t,r)=>{var n=r(3940),o=r(1225),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){var s=e[t];i.call(e,t)&&o(s,r)&&(void 0!==r||t in e)||n(e,t,r)}},2218:(e,t,r)=>{var n=r(1225);e.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}},7993:(e,t,r)=>{var n=r(752),o=r(249);e.exports=function(e,t){return e&&n(t,o(t),e)}},5906:(e,t,r)=>{var n=r(752),o=r(8582);e.exports=function(e,t){return e&&n(t,o(t),e)}},3940:(e,t,r)=>{var n=r(3043);e.exports=function(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}},8874:(e,t,r)=>{var n=r(6571),o=r(2517),i=r(91),s=r(7993),a=r(5906),c=r(2175),u=r(1522),l=r(7680),h=r(9987),d=r(3483),p=r(6939),f=r(940),v=r(9917),E=r(8222),g=r(8725),_=r(6152),m=r(3226),I=r(4714),b=r(9259),y=r(3679),w=r(249),S=r(8582),T="[object Arguments]",C="[object Function]",R="[object Object]",A={};A[T]=A["[object Array]"]=A["[object ArrayBuffer]"]=A["[object DataView]"]=A["[object Boolean]"]=A["[object Date]"]=A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Map]"]=A["[object Number]"]=A[R]=A["[object RegExp]"]=A["[object Set]"]=A["[object String]"]=A["[object Symbol]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A["[object Error]"]=A[C]=A["[object WeakMap]"]=!1,e.exports=function e(t,r,D,x,O,N){var W,L=1&r,j=2&r,P=4&r;if(D&&(W=O?D(t,x,O,N):D(t)),void 0!==W)return W;if(!b(t))return t;var M=_(t);if(M){if(W=v(t),!L)return u(t,W)}else{var k=f(t),K=k==C||"[object GeneratorFunction]"==k;if(m(t))return c(t,L);if(k==R||k==T||K&&!O){if(W=j||K?{}:g(t),!L)return j?h(t,a(W,t)):l(t,s(W,t))}else{if(!A[k])return O?t:{};W=E(t,k,L)}}N||(N=new n);var q=N.get(t);if(q)return q;N.set(t,W),y(t)?t.forEach((function(n){W.add(e(n,r,D,n,t,N))})):I(t)&&t.forEach((function(n,o){W.set(o,e(n,r,D,o,t,N))}));var B=M?void 0:(P?j?p:d:j?S:w)(t);return o(B||t,(function(n,o){B&&(n=t[o=n]),i(W,o,e(n,r,D,o,t,N))})),W}},9413:(e,t,r)=>{var n=r(9259),o=Object.create,i=function(){function e(){}return function(t){if(!n(t))return{};if(o)return o(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();e.exports=i},3324:(e,t,r)=>{var n=r(7297),o=r(3812);e.exports=function(e,t){for(var r=0,i=(t=n(t,e)).length;null!=e&&r<i;)e=e[o(t[r++])];return r&&r==i?e:void 0}},1897:(e,t,r)=>{var n=r(5067),o=r(6152);e.exports=function(e,t,r){var i=t(e);return o(e)?i:n(i,r(e))}},3366:(e,t,r)=>{var n=r(857),o=r(2107),i=r(7157),s=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?o(e):i(e)}},5183:(e,t,r)=>{var n=r(3366),o=r(5125);e.exports=function(e){return o(e)&&"[object Arguments]"==n(e)}},4511:(e,t,r)=>{var n=r(940),o=r(5125);e.exports=function(e){return o(e)&&"[object Map]"==n(e)}},6840:(e,t,r)=>{var n=r(1049),o=r(7394),i=r(9259),s=r(7035),a=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,h=u.hasOwnProperty,d=RegExp("^"+l.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(n(e)?d:a).test(s(e))}},8436:(e,t,r)=>{var n=r(940),o=r(5125);e.exports=function(e){return o(e)&&"[object Set]"==n(e)}},5522:(e,t,r)=>{var n=r(3366),o=r(1158),i=r(5125),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!s[n(e)]}},6411:(e,t,r)=>{var n=r(6001),o=r(4248),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return o(e);var t=[];for(var r in Object(e))i.call(e,r)&&"constructor"!=r&&t.push(r);return t}},8390:(e,t,r)=>{var n=r(9259),o=r(6001),i=r(2966),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=o(e),r=[];for(var a in e)("constructor"!=a||!t&&s.call(e,a))&&r.push(a);return r}},2857:(e,t,r)=>{var n=r(91),o=r(7297),i=r(9045),s=r(9259),a=r(3812);e.exports=function(e,t,r,c){if(!s(e))return e;for(var u=-1,l=(t=o(t,e)).length,h=l-1,d=e;null!=d&&++u<l;){var p=a(t[u]),f=r;if("__proto__"===p||"constructor"===p||"prototype"===p)return e;if(u!=h){var v=d[p];void 0===(f=c?c(v,p,d):void 0)&&(f=s(v)?v:i(t[u+1])?[]:{})}n(d,p,f),d=d[p]}return e}},9872:e=>{e.exports=function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(o);++n<o;)i[n]=e[n+t];return i}},6473:e=>{e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},1054:(e,t,r)=>{var n=r(857),o=r(343),i=r(6152),s=r(4795),a=n?n.prototype:void 0,c=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return o(t,e)+"";if(s(t))return c?c.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}},7826:e=>{e.exports=function(e){return function(t){return e(t)}}},9078:(e,t,r)=>{var n=r(7297),o=r(6974),i=r(2721),s=r(3812);e.exports=function(e,t){return t=n(t,e),null==(e=i(e,t))||delete e[s(o(t))]}},7297:(e,t,r)=>{var n=r(6152),o=r(1401),i=r(4452),s=r(6188);e.exports=function(e,t){return n(e)?e:o(e,t)?[e]:i(s(e))}},9882:(e,t,r)=>{var n=r(9162);e.exports=function(e){var t=new e.constructor(e.byteLength);return new n(t).set(new n(e)),t}},2175:(e,t,r)=>{e=r.nmd(e);var n=r(7772),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o?n.Buffer:void 0,a=s?s.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=a?a(r):new e.constructor(r);return e.copy(n),n}},4727:(e,t,r)=>{var n=r(9882);e.exports=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}},6058:e=>{var t=/\w*$/;e.exports=function(e){var r=new e.constructor(e.source,t.exec(e));return r.lastIndex=e.lastIndex,r}},169:(e,t,r)=>{var n=r(857),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},6190:(e,t,r)=>{var n=r(9882);e.exports=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}},1522:e=>{e.exports=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}},752:(e,t,r)=>{var n=r(91),o=r(3940);e.exports=function(e,t,r,i){var s=!r;r||(r={});for(var a=-1,c=t.length;++a<c;){var u=t[a],l=i?i(r[u],e[u],u,r,e):void 0;void 0===l&&(l=e[u]),s?o(r,u,l):n(r,u,l)}return r}},7680:(e,t,r)=>{var n=r(752),o=r(633);e.exports=function(e,t){return n(e,o(e),t)}},9987:(e,t,r)=>{var n=r(752),o=r(2680);e.exports=function(e,t){return n(e,o(e),t)}},4019:(e,t,r)=>{var n=r(7772)["__core-js_shared__"];e.exports=n},3043:(e,t,r)=>{var n=r(8761),o=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},1242:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},3483:(e,t,r)=>{var n=r(1897),o=r(633),i=r(249);e.exports=function(e){return n(e,i,o)}},6939:(e,t,r)=>{var n=r(1897),o=r(2680),i=r(8582);e.exports=function(e){return n(e,i,o)}},7937:(e,t,r)=>{var n=r(8304);e.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}},8761:(e,t,r)=>{var n=r(6840),o=r(8109);e.exports=function(e,t){var r=o(e,t);return n(r)?r:void 0}},7353:(e,t,r)=>{var n=r(241)(Object.getPrototypeOf,Object);e.exports=n},2107:(e,t,r)=>{var n=r(857),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var o=s.call(e);return n&&(t?e[a]=r:delete e[a]),o}},633:(e,t,r)=>{var n=r(7552),o=r(981),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(e){return null==e?[]:(e=Object(e),n(s(e),(function(t){return i.call(e,t)})))}:o;e.exports=a},2680:(e,t,r)=>{var n=r(5067),o=r(7353),i=r(633),s=r(981),a=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)n(t,i(e)),e=o(e);return t}:s;e.exports=a},940:(e,t,r)=>{var n=r(9515),o=r(326),i=r(2760),s=r(2143),a=r(3215),c=r(3366),u=r(7035),l="[object Map]",h="[object Promise]",d="[object Set]",p="[object WeakMap]",f="[object DataView]",v=u(n),E=u(o),g=u(i),_=u(s),m=u(a),I=c;(n&&I(new n(new ArrayBuffer(1)))!=f||o&&I(new o)!=l||i&&I(i.resolve())!=h||s&&I(new s)!=d||a&&I(new a)!=p)&&(I=function(e){var t=c(e),r="[object Object]"==t?e.constructor:void 0,n=r?u(r):"";if(n)switch(n){case v:return f;case E:return l;case g:return h;case _:return d;case m:return p}return t}),e.exports=I},8109:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},2118:(e,t,r)=>{var n=r(9191);e.exports=function(){this.__data__=n?n(null):{},this.size=0}},6909:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},8138:(e,t,r)=>{var n=r(9191),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(n){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(t,e)?t[e]:void 0}},4174:(e,t,r)=>{var n=r(9191),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:o.call(t,e)}},7942:(e,t,r)=>{var n=r(9191);e.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}},9917:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var r=e.length,n=new e.constructor(r);return r&&"string"==typeof e[0]&&t.call(e,"index")&&(n.index=e.index,n.input=e.input),n}},8222:(e,t,r)=>{var n=r(9882),o=r(4727),i=r(6058),s=r(169),a=r(6190);e.exports=function(e,t,r){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return n(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return o(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(e,r);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return i(e);case"[object Symbol]":return s(e)}}},8725:(e,t,r)=>{var n=r(9413),o=r(7353),i=r(6001);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:n(o(e))}},9045:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}},1401:(e,t,r)=>{var n=r(6152),o=r(4795),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=function(e,t){if(n(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!o(e))||s.test(e)||!i.test(e)||null!=t&&e in Object(t)}},8304:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},7394:(e,t,r)=>{var n,o=r(4019),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!i&&i in e}},6001:e=>{var t=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}},3945:e=>{e.exports=function(){this.__data__=[],this.size=0}},1846:(e,t,r)=>{var n=r(2218),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,r=n(t,e);return!(r<0||(r==t.length-1?t.pop():o.call(t,r,1),--this.size,0))}},8028:(e,t,r)=>{var n=r(2218);e.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}},2344:(e,t,r)=>{var n=r(2218);e.exports=function(e){return n(this.__data__,e)>-1}},4769:(e,t,r)=>{var n=r(2218);e.exports=function(e,t){var r=this.__data__,o=n(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}},2411:(e,t,r)=>{var n=r(9612),o=r(235),i=r(326);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},6417:(e,t,r)=>{var n=r(7937);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},6928:(e,t,r)=>{var n=r(7937);e.exports=function(e){return n(this,e).get(e)}},9493:(e,t,r)=>{var n=r(7937);e.exports=function(e){return n(this,e).has(e)}},4150:(e,t,r)=>{var n=r(7937);e.exports=function(e,t){var r=n(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}},7777:(e,t,r)=>{var n=r(733);e.exports=function(e){var t=n(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}},9191:(e,t,r)=>{var n=r(8761)(Object,"create");e.exports=n},4248:(e,t,r)=>{var n=r(241)(Object.keys,Object);e.exports=n},2966:e=>{e.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},4146:(e,t,r)=>{e=r.nmd(e);var n=r(1242),o=t&&!t.nodeType&&t,i=o&&e&&!e.nodeType&&e,s=i&&i.exports===o&&n.process,a=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=a},7157:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},241:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},2721:(e,t,r)=>{var n=r(3324),o=r(9872);e.exports=function(e,t){return t.length<2?e:n(e,o(t,0,-1))}},7772:(e,t,r)=>{var n=r(1242),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();e.exports=i},5243:(e,t,r)=>{var n=r(235);e.exports=function(){this.__data__=new n,this.size=0}},2858:e=>{e.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}},4417:e=>{e.exports=function(e){return this.__data__.get(e)}},8605:e=>{e.exports=function(e){return this.__data__.has(e)}},1418:(e,t,r)=>{var n=r(235),o=r(326),i=r(6738);e.exports=function(e,t){var r=this.__data__;if(r instanceof n){var s=r.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++r.size,this;r=this.__data__=new i(s)}return r.set(e,t),this.size=r.size,this}},4452:(e,t,r)=>{var n=r(7777),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=n((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,r,n,o){t.push(n?o.replace(i,"$1"):r||e)})),t}));e.exports=s},3812:(e,t,r)=>{var n=r(4795);e.exports=function(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},7035:e=>{var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},9850:(e,t,r)=>{var n=r(8874);e.exports=function(e){return n(e,5)}},1225:e=>{e.exports=function(e,t){return e===t||e!=e&&t!=t}},9631:(e,t,r)=>{var n=r(5183),o=r(5125),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(e){return o(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=c},6152:e=>{var t=Array.isArray;e.exports=t},7878:(e,t,r)=>{var n=r(1049),o=r(1158);e.exports=function(e){return null!=e&&o(e.length)&&!n(e)}},3226:(e,t,r)=>{e=r.nmd(e);var n=r(7772),o=r(6330),i=t&&!t.nodeType&&t,s=i&&e&&!e.nodeType&&e,a=s&&s.exports===i?n.Buffer:void 0,c=(a?a.isBuffer:void 0)||o;e.exports=c},1049:(e,t,r)=>{var n=r(3366),o=r(9259);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},1158:e=>{e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},4714:(e,t,r)=>{var n=r(4511),o=r(7826),i=r(4146),s=i&&i.isMap,a=s?o(s):n;e.exports=a},9259:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},5125:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},3679:(e,t,r)=>{var n=r(8436),o=r(7826),i=r(4146),s=i&&i.isSet,a=s?o(s):n;e.exports=a},4795:(e,t,r)=>{var n=r(3366),o=r(5125);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},7598:(e,t,r)=>{var n=r(5522),o=r(7826),i=r(4146),s=i&&i.isTypedArray,a=s?o(s):n;e.exports=a},249:(e,t,r)=>{var n=r(1634),o=r(6411),i=r(7878);e.exports=function(e){return i(e)?n(e):o(e)}},8582:(e,t,r)=>{var n=r(1634),o=r(8390),i=r(7878);e.exports=function(e){return i(e)?n(e,!0):o(e)}},6974:e=>{e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},733:(e,t,r)=>{var n=r(6738);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=e.apply(this,n);return r.cache=i.set(o,s)||i,s};return r.cache=new(o.Cache||n),r}o.Cache=n,e.exports=o},6765:(e,t,r)=>{var n=r(2857);e.exports=function(e,t,r){return null==e?e:n(e,t,r)}},981:e=>{e.exports=function(){return[]}},6330:e=>{e.exports=function(){return!1}},6188:(e,t,r)=>{var n=r(1054);e.exports=function(e){return null==e?"":n(e)}},7195:(e,t,r)=>{var n=r(9078);e.exports=function(e,t){return null==e||n(e,t)}},508:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setRuntime=t.getRuntime=t.setWsClass=t.getWsClass=void 0;var r=null,n="web";t.getWsClass=function(){return r},t.setWsClass=function(e){r=e},t.getRuntime=function(){return n},t.setRuntime=function(e){n=e}},5889:function(e,t){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return r=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])},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 n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.ERR_CODE=t.CloudSDKError=t.isCancelledError=t.CancelledError=t.isTimeoutError=t.TimeoutError=t.isRealtimeErrorMessageError=t.RealtimeErrorMessageError=void 0;var o=function(e){function t(t){var r=e.call(this,"Watch Error ".concat(JSON.stringify(t.msgData)," (requestid: ").concat(t.requestId,")"))||this;return r.isRealtimeErrorMessageError=!0,r.payload=t,r}return n(t,e),t}(Error);t.RealtimeErrorMessageError=o,t.isRealtimeErrorMessageError=function(e){return null==e?void 0:e.isRealtimeErrorMessageError};var i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="timeout",t.payload=null,t.generic=!0,t}return n(t,e),t}(Error);t.TimeoutError=i,t.isTimeoutError=function(e){return"timeout"===e.type};var s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="cancelled",t.payload=null,t.generic=!0,t}return n(t,e),t}(Error);t.CancelledError=s,t.isCancelledError=function(e){return"cancelled"===e.type};var a=function(e){function r(r){var n=e.call(this,r.errMsg)||this;return n.errCode="UNKNOWN_ERROR",Object.defineProperties(n,{message:{get:function(){return"errCode: ".concat(this.errCode," ").concat(t.ERR_CODE[this.errCode]||""," | errMsg: ").concat(this.errMsg)},set:function(e){this.errMsg=e}}}),n.errCode=r.errCode||"UNKNOWN_ERROR",n.errMsg=r.errMsg,n}return n(r,e),Object.defineProperty(r.prototype,"message",{get:function(){return"errCode: ".concat(this.errCode," | errMsg: ").concat(this.errMsg)},set:function(e){this.errMsg=e},enumerable:!1,configurable:!0}),r}(Error);t.CloudSDKError=a,t.ERR_CODE={UNKNOWN_ERROR:"UNKNOWN_ERROR",SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG:"SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG",SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA:"SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED",SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL",SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR:"SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR"}},5157:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RealtimeListener=void 0;t.RealtimeListener=function(e){this.close=e.close,this.onChange=e.onChange,this.onError=e.onError,e.debug&&Object.defineProperty(this,"virtualClient",{get:function(){return e.virtualClient}})}},4699:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInitEventMessage=t.genRequestId=void 0,t.genRequestId=function(e){return void 0===e&&(e=""),"".concat(e?"".concat(e,"_"):"").concat(+new Date,"_").concat(Math.random())},t.isInitEventMessage=function(e){return"INIT_EVENT"===e.msgType}},4005:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Snapshot=void 0;t.Snapshot=function(e){var t,r,n=e.id,o=e.docChanges,i=e.docs,s=e.msgType,a=e.type;Object.defineProperties(this,{id:{get:function(){return n},enumerable:!0},docChanges:{get:function(){return t||(t=JSON.parse(JSON.stringify(o))),t},enumerable:!0},docs:{get:function(){return r||(r=JSON.parse(JSON.stringify(i))),r},enumerable:!0},msgType:{get:function(){return s},enumerable:!0},type:{get:function(){return a},enumerable:!0}})}},1550:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sleep=void 0,t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))}},4833:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){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=(o=s.trys).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,c])}}},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))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualWebSocketClient=void 0;var a,c=s(r(6765)),u=s(r(7195)),l=s(r(9850)),h=r(4699),d=r(5157),p=r(4005),f=r(5889),v=r(1550);!function(e){e.LOGGINGIN="LOGGINGIN",e.INITING="INITING",e.REBUILDING="REBUILDING",e.ACTIVE="ACTIVE",e.ERRORED="ERRORED",e.CLOSING="CLOSING",e.CLOSED="CLOSED",e.PAUSED="PAUSED",e.RESUMING="RESUMING"}(a||(a={}));var E=function(){function e(e){var t=this;this.watchStatus=a.INITING,this.wsLogin=function(e,r){return n(t,void 0,Promise,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return this.watchStatus=a.LOGGINGIN,[4,this.login(e,r)];case 1:return t=n.sent(),this.envId||(this.envId=t.envId),[2,t]}}))}))},this.initWatch=function(e){return n(t,void 0,Promise,(function(){var t,r=this;return o(this,(function(i){switch(i.label){case 0:if(null!==this.initWatchPromise&&void 0!==this.initWatchPromise)return[2,this.initWatchPromise];this.initWatchPromise=new Promise((function(t,i){n(r,void 0,void 0,(function(){var r,n,s,c,u,l,d,f,v,E;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),this.watchStatus===a.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,t()]):[4,this.wsLogin(this.envId,e)];case 1:return r=o.sent().envId,this.watchStatus===a.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,t()]):(this.watchStatus=a.INITING,n={watchId:this.watchId,requestId:(0,h.genRequestId)(),msgType:"INIT_WATCH",msgData:{envId:r,collName:this.collectionName,query:this.query,limit:this.limit,orderBy:this.orderBy}},[4,this.send({msg:n,waitResponse:!0,skipOnMessage:!0,timeout:1e4})]);case 2:if(s=o.sent(),c=s.msgData,u=c.events,l=c.currEvent,this.sessionInfo={queryID:s.msgData.queryID,currentEventId:l-1,currentDocs:[]},u.length>0){for(d=0,f=u;d<f.length;d++)f[d].ID=l;this.handleServerEvents(s)}else this.sessionInfo.currentEventId=l,v=new p.Snapshot({id:l,docChanges:[],docs:[],type:"init"}),this.listener.onChange(v),this.scheduleSendACK();return this.onWatchStart(this,this.sessionInfo.queryID),this.watchStatus=a.ACTIVE,this.availableRetries.INIT_WATCH=2,t(),[3,4];case 3:return E=o.sent(),this.handleWatchEstablishmentError(E,{operationName:"INIT_WATCH",resolve:t,reject:i}),[3,4];case 4:return[2]}}))}))})),t=!1,i.label=1;case 1:return i.trys.push([1,,3,4]),[4,this.initWatchPromise];case 2:return i.sent(),t=!0,[3,4];case 3:return this.initWatchPromise=void 0,[7];case 4:return console.log("[realtime] initWatch ".concat(t?"success":"fail")),[2]}}))}))},this.rebuildWatch=function(e){return n(t,void 0,Promise,(function(){var t,r=this;return o(this,(function(i){switch(i.label){case 0:if(null!==this.rebuildWatchPromise&&void 0!==this.rebuildWatchPromise)return[2,this.rebuildWatchPromise];this.rebuildWatchPromise=new Promise((function(t,i){n(r,void 0,void 0,(function(){var r,n,s,c;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),this.watchStatus===a.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,t()]):[4,this.wsLogin(this.envId,e)];case 1:if(r=o.sent().envId,!this.sessionInfo)throw new Error("can not rebuildWatch without a successful initWatch (lack of sessionInfo)");return this.watchStatus===a.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,t()]):(this.watchStatus=a.REBUILDING,n={watchId:this.watchId,requestId:(0,h.genRequestId)(),msgType:"REBUILD_WATCH",msgData:{envId:r,collName:this.collectionName,queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:n,waitResponse:!0,skipOnMessage:!1,timeout:1e4})]);case 2:return s=o.sent(),this.handleServerEvents(s),this.watchStatus=a.ACTIVE,this.availableRetries.REBUILD_WATCH=2,t(),[3,4];case 3:return c=o.sent(),this.handleWatchEstablishmentError(c,{operationName:"REBUILD_WATCH",resolve:t,reject:i}),[3,4];case 4:return[2]}}))}))})),t=!1,i.label=1;case 1:return i.trys.push([1,,3,4]),[4,this.rebuildWatchPromise];case 2:return i.sent(),t=!0,[3,4];case 3:return this.rebuildWatchPromise=void 0,[7];case 4:return console.log("[realtime] rebuildWatch ".concat(t?"success":"fail")),[2]}}))}))},this.handleWatchEstablishmentError=function(e,r){return n(t,void 0,void 0,(function(){var t,i,s,c=this;return o(this,(function(u){return t="INIT_WATCH"===r.operationName,i=function(){c.closeWithError(new f.CloudSDKError({errCode:t?f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL,errMsg:e})),r.reject(e)},s=function(e){c.useRetryTicket(r.operationName)?t?(c.initWatchPromise=void 0,r.resolve(c.initWatch(e))):(c.rebuildWatchPromise=void 0,r.resolve(c.rebuildWatch(e))):i()},this.handleCommonError(e,{onSignError:function(){return s(!0)},onTimeoutError:function(){return s(!1)},onNotRetryableError:i,onCancelledError:r.reject,onUnknownError:function(){n(c,void 0,void 0,(function(){var e,t=this;return o(this,(function(i){switch(i.label){case 0:return i.trys.push([0,8,,9]),e=function(){return n(t,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.pause(),[4,this.onceWSConnected()];case 1:return e.sent(),s(!0),[2]}}))}))},this.isWSConnected()?[3,2]:[4,e()];case 1:return i.sent(),[3,7];case 2:return[4,(0,v.sleep)(100)];case 3:return i.sent(),this.watchStatus!==a.PAUSED?[3,4]:(r.reject(new f.CancelledError("".concat(r.operationName," cancelled due to pause after unknownError"))),[3,7]);case 4:return this.isWSConnected()?[3,6]:[4,e()];case 5:return i.sent(),[3,7];case 6:s(!1),i.label=7;case 7:return[3,9];case 8:return i.sent(),s(!0),[3,9];case 9:return[2]}}))}))}}),[2]}))}))},this.closeWatch=function(){return n(t,void 0,void 0,(function(){var e,t,r;return o(this,(function(n){switch(n.label){case 0:if(e=this.sessionInfo?this.sessionInfo.queryID:"",this.watchStatus!==a.ACTIVE)return this.watchStatus=a.CLOSED,this.onWatchClose(this,e),[2];n.label=1;case 1:return n.trys.push([1,3,4,5]),this.watchStatus=a.CLOSING,t={watchId:this.watchId,requestId:(0,h.genRequestId)(),msgType:"CLOSE_WATCH",msgData:null},[4,this.send({msg:t})];case 2:return n.sent(),this.sessionInfo=void 0,this.watchStatus=a.CLOSED,[3,5];case 3:return r=n.sent(),this.closeWithError(new f.CloudSDKError({errCode:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL,errMsg:r})),[3,5];case 4:return this.onWatchClose(this,e),[7];case 5:return[2]}}))}))},this.scheduleSendACK=function(){t.clearACKSchedule(),t.ackTimeoutId=setTimeout((function(){t.waitExpectedTimeoutId?t.scheduleSendACK():t.sendACK()}),1e4)},this.clearACKSchedule=function(){t.ackTimeoutId&&clearTimeout(t.ackTimeoutId)},this.sendACK=function(){return n(t,void 0,Promise,(function(){var e,t,r;return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.watchStatus!==a.ACTIVE?(this.scheduleSendACK(),[2]):this.sessionInfo?(e={watchId:this.watchId,requestId:(0,h.genRequestId)(),msgType:"CHECK_LAST",msgData:{queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:e})]):(console.warn("[realtime listener] can not send ack without a successful initWatch (lack of sessionInfo)"),[2]);case 1:return n.sent(),this.scheduleSendACK(),[3,3];case 2:if(t=n.sent(),(0,f.isRealtimeErrorMessageError)(t))switch((r=t.payload).msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return this.rebuildWatch(),[2];case"QUERYID_INVALID_ERROR":case"SYS_ERR":case"INVALIID_ENV":case"COLLECTION_PERMISSION_DENIED":return this.closeWithError(new f.CloudSDKError({errCode:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:r.msgData.code})),[2]}return this.availableRetries.CHECK_LAST&&this.availableRetries.CHECK_LAST>0?(this.availableRetries.CHECK_LAST-=1,this.scheduleSendACK()):this.closeWithError(new f.CloudSDKError({errCode:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:t})),[3,3];case 3:return[2]}}))}))},this.handleCommonError=function(e,t){if((0,f.isRealtimeErrorMessageError)(e))switch(e.payload.msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return void t.onSignError(e);default:return void t.onNotRetryableError(e)}else{if((0,f.isTimeoutError)(e))return void t.onTimeoutError(e);if((0,f.isCancelledError)(e))return void t.onCancelledError(e)}t.onUnknownError(e)},this.watchId="watchid_".concat(+new Date,"_").concat(Math.random()),this.envId=e.envId,this.collectionName=e.collectionName,this.query=e.query,this.limit=e.limit,this.orderBy=e.orderBy,this.send=e.send,this.login=e.login,this.isWSConnected=e.isWSConnected,this.onceWSConnected=e.onceWSConnected,this.getWaitExpectedTimeoutLength=e.getWaitExpectedTimeoutLength,this.onWatchStart=e.onWatchStart,this.onWatchClose=e.onWatchClose,this.debug=e.debug,this.availableRetries={INIT_WATCH:2,REBUILD_WATCH:2,CHECK_LAST:2},this.listener=new d.RealtimeListener({close:function(){t.closeWatch()},onChange:e.onChange,onError:e.onError,debug:this.debug,virtualClient:this}),this.initWatch()}return e.prototype.onMessage=function(e){var t=this;switch(this.watchStatus){case a.PAUSED:if("ERROR"!==e.msgType)return;break;case a.LOGGINGIN:case a.INITING:case a.REBUILDING:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received while ".concat(this.watchStatus));case a.CLOSED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has closed");case a.ERRORED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has ended with error")}if(this.sessionInfo)switch(this.scheduleSendACK(),e.msgType){case"NEXT_EVENT":console.warn("nextevent ".concat(e.msgData.currEvent," ignored"),e),this.handleServerEvents(e);break;case"CHECK_EVENT":this.sessionInfo.currentEventId<e.msgData.currEvent&&(this.sessionInfo.expectEventId=e.msgData.currEvent,this.clearWaitExpectedEvent(),this.waitExpectedTimeoutId=setTimeout((function(){t.rebuildWatch()}),this.getWaitExpectedTimeoutLength()),console.log("[realtime] waitExpectedTimeoutLength ".concat(this.getWaitExpectedTimeoutLength())));break;case"ERROR":this.closeWithError(new f.CloudSDKError({errCode:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG,errMsg:"".concat(e.msgData.code," - ").concat(e.msgData.message)}));break;default:console.warn("[realtime listener] virtual client receive unexpected msg ".concat(e.msgType,": "),e)}else console.warn("[realtime listener] internal non-fatal error: sessionInfo not found while message is received.")},e.prototype.closeWithError=function(e){var t;this.watchStatus=a.ERRORED,this.clearACKSchedule(),this.listener.onError(e),this.onWatchClose(this,(null===(t=this.sessionInfo)||void 0===t?void 0:t.queryID)||""),console.log("[realtime] client closed (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},e.prototype.pause=function(){this.watchStatus=a.PAUSED,console.log("[realtime] client paused (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},e.prototype.resume=function(){return n(this,void 0,Promise,(function(){var e;return o(this,(function(t){switch(t.label){case 0:this.watchStatus=a.RESUMING,console.log("[realtime] client resuming with ".concat(this.sessionInfo?"REBUILD_WATCH":"INIT_WATCH"," (").concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.sessionInfo?this.rebuildWatch():this.initWatch()];case 2:return t.sent(),console.log("[realtime] client successfully resumed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),[3,4];case 3:return e=t.sent(),console.error("[realtime] client resume failed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")"),e),[3,4];case 4:return[2]}}))}))},e.prototype.useRetryTicket=function(e){return!!(this.availableRetries[e]&&this.availableRetries[e]>0)&&(this.availableRetries[e]-=1,console.log("[realtime] ".concat(e," use a retry ticket, now only ").concat(this.availableRetries[e]," retry left")),!0)},e.prototype.handleServerEvents=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.scheduleSendACK(),[4,this.handleServerEventsInternel(e)];case 1:return r.sent(),this.postHandleServerEventsValidityCheck(e),[3,3];case 2:throw t=r.sent(),console.error("[realtime listener] internal non-fatal error: handle server events failed with error: ",t),t;case 3:return[2]}}))}))},e.prototype.handleServerEventsInternel=function(e){return n(this,void 0,void 0,(function(){var t,r,n,s,a,h,d,v,E,_,m,I;return o(this,(function(b){switch(b.label){case 0:if(t=e.requestId,r=e.msgData.events,n=e.msgType,!r.length||!this.sessionInfo)return[2];s=this.sessionInfo;try{a=r.map(g)}catch(e){return this.closeWithError(new f.CloudSDKError({errCode:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA,errMsg:e})),[2]}h=i([],s.currentDocs,!0),d=!1,v=function(r,v){var g,_,m,I,b,y,w,S,T,C,R,A;return o(this,(function(o){switch(o.label){case 0:return g=a[r],s.currentEventId>=g.id?(!a[r-1]||g.id>a[r-1].id?console.warn("[realtime] duplicate event received, cur ".concat(s.currentEventId," but got ").concat(g.id)):console.error("[realtime listener] server non-fatal error: events out of order (the latter event's id is smaller than that of the former) (requestId ".concat(t,")")),[2,"continue"]):[3,1];case 1:if(s.currentEventId!==g.id-1)return[3,2];switch(g.dataType){case"update":if(!g.doc)switch(g.queueType){case"update":case"dequeue":if(_=h.find((function(e){return e._id===g.docId})),_){if(m=(0,l.default)(_),g.updatedFields&&Object.keys(g.updatedFields).forEach((function(e){(0,c.default)(m,e,g.updatedFields[e])})),g.removedFields)for(I=0,b=g.removedFields;I<b.length;I++)y=b[I],(0,u.default)(m,y);g.doc=m}else console.error("[realtime listener] internal non-fatal server error: unexpected update dataType event where no doc is associated.");break;case"enqueue":throw S=new f.CloudSDKError({errCode:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="update" and queueType="enqueue" (requestId '.concat(e.requestId,")")}),E.closeWithError(S),S}break;case"replace":if(!g.doc)throw S=new f.CloudSDKError({errCode:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="replace" (requestId '.concat(e.requestId,")")}),E.closeWithError(S),S;break;case"remove":(w=h.find((function(e){return e._id===g.docId})))?g.doc=w:console.error("[realtime listener] internal non-fatal server error: unexpected remove event where no doc is associated.");break;case"limit":if(!g.doc)switch(g.queueType){case"dequeue":(w=h.find((function(e){return e._id===g.docId})))?g.doc=w:console.error("[realtime listener] internal non-fatal server error: unexpected limit dataType event where no doc is associated.");break;case"enqueue":throw S=new f.CloudSDKError({errCode:f.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="limit" and queueType="enqueue" (requestId '.concat(e.requestId,")")}),E.closeWithError(S),S}}switch(g.queueType){case"init":d?h.push(g.doc):(d=!0,h=[g.doc]);break;case"enqueue":h.push(g.doc);break;case"dequeue":T=h.findIndex((function(e){return e._id===g.docId})),T>-1?h.splice(T,1):console.error("[realtime listener] internal non-fatal server error: unexpected dequeue event where no doc is associated.");break;case"update":T=h.findIndex((function(e){return e._id===g.docId})),T>-1?h[T]=g.doc:console.error("[realtime listener] internal non-fatal server error: unexpected queueType update event where no doc is associated.")}return(r===v-1||a[r+1]&&a[r+1].id!==g.id)&&(C=i([],h,!0),R=a.slice(0,r+1).filter((function(e){return e.id===g.id})),E.sessionInfo.currentEventId=g.id,E.sessionInfo.currentDocs=h,A=new p.Snapshot({id:g.id,docChanges:R,docs:C,msgType:n}),E.listener.onChange(A)),[3,4];case 2:return console.warn("[realtime listener] event received is out of order, cur ".concat(E.sessionInfo.currentEventId," but got ").concat(g.id)),[4,E.rebuildWatch()];case 3:return o.sent(),[2,{value:void 0}];case 4:return[2]}}))},E=this,_=0,m=a.length,b.label=1;case 1:return _<m?[5,v(_,m)]:[3,4];case 2:if("object"==typeof(I=b.sent()))return[2,I.value];b.label=3;case 3:return _++,[3,1];case 4:return[2]}}))}))},e.prototype.postHandleServerEventsValidityCheck=function(e){this.sessionInfo?(this.sessionInfo.expectEventId&&this.sessionInfo.currentEventId>=this.sessionInfo.expectEventId&&this.clearWaitExpectedEvent(),this.sessionInfo.currentEventId<e.msgData.currEvent&&console.warn("[realtime listener] internal non-fatal error: client eventId does not match with server event id after server event handling")):console.error("[realtime listener] internal non-fatal error: sessionInfo lost after server event handling, this should never occur")},e.prototype.clearWaitExpectedEvent=function(){this.waitExpectedTimeoutId&&(clearTimeout(this.waitExpectedTimeoutId),this.waitExpectedTimeoutId=void 0)},e}();function g(e){var t={id:e.ID,dataType:e.DataType,queueType:e.QueueType,docId:e.DocID,doc:e.Doc&&"{}"!==e.Doc?JSON.parse(e.Doc):void 0};return"update"===e.DataType&&(e.UpdatedFields&&(t.updatedFields=JSON.parse(e.UpdatedFields)),(e.removedFields||e.RemovedFields)&&(t.removedFields=JSON.parse(e.removedFields))),t}t.VirtualWebSocketClient=E},2697:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){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=(o=s.trys).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,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.RealtimeWebSocketClient=void 0;var s=r(4833),a=r(4699),c=r(7164),u=r(5889),l=r(508),h=r(1550),d=function(){function e(e){var t=this;this.virtualWSClient=new Set,this.queryIdClientMap=new Map,this.watchIdClientMap=new Map,this.pingFailed=0,this.pongMissed=0,this.logins=new Map,this.wsReadySubsribers=[],this.wsResponseWait=new Map,this.rttObserved=[],this.send=function(e){return o(t,void 0,Promise,(function(){var t=this;return i(this,(function(r){return[2,new Promise((function(r,n){o(t,void 0,void 0,(function(){var t,s,a,c,l,d,p,f,v=this;return i(this,(function(E){switch(E.label){case 0:s=!1,a=!1,c=function(e){s=!0,t&&clearTimeout(t),r(e)},l=function(e){a=!0,t&&clearTimeout(t),n(e)},e.timeout&&(t=setTimeout((function(){o(v,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return s&&a?[3,2]:[4,(0,h.sleep)(0)];case 1:e.sent(),s&&a||l(new u.TimeoutError("wsclient.send timedout")),e.label=2;case 2:return[2]}}))}))}),e.timeout)),E.label=1;case 1:return E.trys.push([1,8,,9]),void 0===this.wsInitPromise&&null===this.wsInitPromise?[3,3]:[4,this.wsInitPromise];case 2:E.sent(),E.label=3;case 3:if(!this.ws)return l(new Error("invalid state: ws connection not exists, can not send message")),[2];if(1!==this.ws.readyState)return l(new Error("ws readyState invalid: ".concat(this.ws.readyState,", can not send message"))),[2];e.waitResponse&&(d={resolve:c,reject:l,skipOnMessage:e.skipOnMessage},this.wsResponseWait.set(e.msg.requestId,d)),E.label=4;case 4:return E.trys.push([4,6,,7]),[4,this.ws.send(JSON.stringify(e.msg))];case 5:return E.sent(),e.waitResponse||c(void 0),[3,7];case 6:return(p=E.sent())&&(l(p),e.waitResponse&&this.wsResponseWait.delete(e.msg.requestId)),[3,7];case 7:return[3,9];case 8:return f=E.sent(),l(f),[3,9];case 9:return[2]}}))}))}))]}))}))},this.closeAllClients=function(e){t.virtualWSClient.forEach((function(t){t.closeWithError(e)}))},this.pauseClients=function(e){(e||t.virtualWSClient).forEach((function(e){e.pause()}))},this.resumeClients=function(e){(e||t.virtualWSClient).forEach((function(e){e.resume()}))},this.initWebSocketConnection=function(e,r){return void 0===r&&(r=t.maxReconnect),o(t,void 0,Promise,(function(){var t=this;return i(this,(function(n){switch(n.label){case 0:if(e&&this.reconnectState)return[2];if(e&&(this.reconnectState=!0),void 0!==this.wsInitPromise&&null!==this.wsInitPromise)return[2,this.wsInitPromise];e&&this.pauseClients(),this.close(c.CloseEventCode.ReconnectWebSocket),this.wsInitPromise=new Promise((function(n,s){o(t,void 0,void 0,(function(){var t,o,a=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,6,,11]),[4,this.getWsSign()];case 1:return t=i.sent(),[4,new Promise((function(e){var r=t.wsUrl||"wss://tcb-ws.tencentcloudapi.com",n=(0,l.getWsClass)();a.ws=n?new n(r):new WebSocket(r),e(void 0)}))];case 2:return i.sent(),this.ws.connect?[4,this.ws.connect()]:[3,4];case 3:i.sent(),i.label=4;case 4:return[4,this.initWebSocketEvent()];case 5:return i.sent(),n(),e&&(this.resumeClients(),this.reconnectState=!1),[3,11];case 6:return o=i.sent(),console.error("[realtime] initWebSocketConnection connect fail",o),r>0?(this.wsInitPromise=void 0,[4,(0,h.sleep)(this.reconnectInterval)]):[3,9];case 7:i.sent(),e&&(this.reconnectState=!1),i.label=8;case 8:return n(this.initWebSocketConnection(e,r-1)),[3,10];case 9:s(o),e&&this.closeAllClients(new u.CloudSDKError({errCode:u.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL,errMsg:o})),i.label=10;case 10:return[3,11];case 11:return[2]}}))}))})),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.wsInitPromise];case 2:return n.sent(),this.wsReadySubsribers.forEach((function(e){return(0,e.resolve)()})),[3,5];case 3:return n.sent(),this.wsReadySubsribers.forEach((function(e){return(0,e.reject)()})),[3,5];case 4:return this.wsInitPromise=void 0,this.wsReadySubsribers=[],[7];case 5:return[2]}}))}))},this.initWebSocketEvent=function(){return new Promise((function(e,r){if(!t.ws)throw new Error("can not initWebSocketEvent, ws not exists");var n=!1;t.ws.onopen=function(t){console.warn("[realtime] ws event: open",t),n=!0,e()},t.ws.onerror=function(e){t.logins=new Map,n?(console.error("[realtime] ws event: error",e),t.clearHeartbeat(),t.virtualWSClient.forEach((function(t){return t.closeWithError(new u.CloudSDKError({errCode:u.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR,errMsg:e}))}))):(console.error("[realtime] ws open failed with ws event: error",e),r(e))},t.ws.onclose=function(e){switch(console.warn("[realtime] ws event: close",e),t.logins=new Map,t.clearHeartbeat(),e.code){case c.CloseEventCode.ReconnectWebSocket:case c.CloseEventCode.NoRealtimeListeners:break;case c.CloseEventCode.HeartbeatPingError:case c.CloseEventCode.HeartbeatPongTimeoutError:case c.CloseEventCode.NormalClosure:case c.CloseEventCode.AbnormalClosure:t.maxReconnect>0?t.initWebSocketConnection(!0,t.maxReconnect):t.closeAllClients((0,c.getWSCloseError)(e.code));break;case c.CloseEventCode.NoAuthentication:t.closeAllClients((0,c.getWSCloseError)(e.code,e.reason));break;default:t.maxReconnect>0?t.initWebSocketConnection(!0,t.maxReconnect):t.closeAllClients((0,c.getWSCloseError)(e.code))}},t.ws.onmessage=function(e){var r,n,o=(null===(r=e.data)||void 0===r?void 0:r.data)||e.data;t.heartbeat();try{n="string"==typeof o?JSON.parse(o):o}catch(e){throw new Error("[realtime] onMessage parse res.data error: ".concat(e))}if("ERROR"===n.msgType){var i=null;t.virtualWSClient.forEach((function(e){e.watchId===n.watchId&&(i=e)})),i&&i.listener.onError(n)}var s=t.wsResponseWait.get(n.requestId);if(s){try{"ERROR"===n.msgType?s.reject(new u.RealtimeErrorMessageError(n)):s.resolve(n)}catch(e){console.error("ws onMessage responseWaitSpec.resolve(msg) errored:",e)}finally{t.wsResponseWait.delete(n.requestId)}if(s.skipOnMessage)return}if("PONG"!==n.msgType){var a=n.watchId&&t.watchIdClientMap.get(n.watchId);if(a)a.onMessage(n);else switch(console.error("[realtime] no realtime listener found responsible for watchId ".concat(n.watchId,": "),n),n.msgType){case"INIT_EVENT":case"NEXT_EVENT":case"CHECK_EVENT":(a=t.queryIdClientMap.get(n.msgData.queryID))&&a.onMessage(n);break;default:for(var c=0,l=Array.from(t.watchIdClientMap.entries());c<l.length;c++){l[c][1].onMessage(n);break}}}else if(t.lastPingSendTS){var h=Date.now()-t.lastPingSendTS;if(h>1e4)return void console.warn("[realtime] untrusted rtt observed: ".concat(h));t.rttObserved.length>=3&&t.rttObserved.splice(0,t.rttObserved.length-3+1),t.rttObserved.push(h)}},t.heartbeat()}))},this.isWSConnected=function(){return Boolean(t.ws&&1===t.ws.readyState)},this.onceWSConnected=function(){return o(t,void 0,Promise,(function(){var e=this;return i(this,(function(t){return this.isWSConnected()?[2]:null!==this.wsInitPromise&&void 0!==this.wsInitPromise?[2,this.wsInitPromise]:[2,new Promise((function(t,r){e.wsReadySubsribers.push({resolve:t,reject:r})}))]}))}))},this.webLogin=function(e,r){return o(t,void 0,Promise,(function(){var t,n,s,c,u,h,d,p,f=this;return i(this,(function(v){switch(v.label){case 0:if(!r)if(e){if(t=this.logins.get(e)){if(t.loggedIn&&t.loginResult)return[2,t.loginResult];if(null!==t.loggingInPromise&&void 0!==t.loggingInPromise)return[2,t.loggingInPromise]}}else if(null!==(null==(n=this.logins.get(""))?void 0:n.loggingInPromise)&&void 0!==(null==n?void 0:n.loggingInPromise))return[2,n.loggingInPromise];s=new Promise((function(e,t){o(f,void 0,void 0,(function(){var r,n,o,s,c;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.getWsSign()];case 1:return r=i.sent(),n={envId:r.envId||"",accessToken:"",referrer:"web",sdkVersion:"",dataVersion:""},o={watchId:void 0,requestId:(0,a.genRequestId)(),msgType:"LOGIN",msgData:n,exMsgData:{runtime:(0,l.getRuntime)(),signStr:r.signStr,secretVersion:r.secretVersion}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!0,timeout:5e3})];case 2:return(s=i.sent()).msgData.code?t(new Error("".concat(s.msgData.code," ").concat(s.msgData.message))):e({envId:r.envId}),[3,4];case 3:return c=i.sent(),t(c),[3,4];case 4:return[2]}}))}))})),c=e&&this.logins.get(e),u=Date.now(),c?(c.loggedIn=!1,c.loggingInPromise=s,c.loginStartTS=u):(c={loggedIn:!1,loggingInPromise:s,loginStartTS:u},this.logins.set(e||"",c)),v.label=1;case 1:return v.trys.push([1,3,,4]),[4,s];case 2:if(h=v.sent(),(d=e&&this.logins.get(e))&&d===c&&d.loginStartTS===u)return c.loggedIn=!0,c.loggingInPromise=void 0,c.loginStartTS=void 0,c.loginResult=h,[2,h];if(d){if(d.loggedIn&&d.loginResult)return[2,d.loginResult];if(null!==d.loggingInPromise&&void 0!==d.loggingInPromise)return[2,d.loggingInPromise];throw new Error("ws unexpected login info")}throw new Error("ws login info reset");case 3:throw p=v.sent(),c.loggedIn=!1,c.loggingInPromise=void 0,c.loginStartTS=void 0,c.loginResult=void 0,p;case 4:return[2]}}))}))},this.getWsSign=function(){return o(t,void 0,Promise,(function(){var e,t,r,n,o,s,a;return i(this,(function(i){switch(i.label){case 0:return this.wsSign&&this.wsSign.expiredTs>Date.now()?[2,this.wsSign]:(e=Date.now()+6e4,[4,this.context.appConfig.request.send("auth.wsWebSign",{runtime:(0,l.getRuntime)()})]);case 1:if((t=i.sent()).code)throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败: ".concat(t.code));if(t.data)return r=t.data,n=r.signStr,o=r.wsUrl,s=r.secretVersion,a=r.envId,[2,{signStr:n,wsUrl:o,secretVersion:s,envId:a,expiredTs:e}];throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败")}}))}))},this.getWaitExpectedTimeoutLength=function(){return t.rttObserved.length?t.rttObserved.reduce((function(e,t){return e+t}))/t.rttObserved.length*1.5:5e3},this.ping=function(){return o(t,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return e={watchId:void 0,requestId:(0,a.genRequestId)(),msgType:"PING",msgData:null},[4,this.send({msg:e})];case 1:return t.sent(),[2]}}))}))},this.onWatchStart=function(e,r){t.queryIdClientMap.set(r,e)},this.onWatchClose=function(e,r){r&&t.queryIdClientMap.delete(r),t.watchIdClientMap.delete(e.watchId),t.virtualWSClient.delete(e),t.virtualWSClient.size||t.close(c.CloseEventCode.NoRealtimeListeners)},this.maxReconnect=e.maxReconnect||5,this.reconnectInterval=e.reconnectInterval||1e4,this.context=e.context}return e.prototype.clearHeartbeat=function(){this.pingTimeoutId&&clearTimeout(this.pingTimeoutId),this.pongTimeoutId&&clearTimeout(this.pongTimeoutId)},e.prototype.close=function(e){this.clearHeartbeat(),this.ws&&(this.ws.close(e,c.CLOSE_EVENT_CODE_INFO[e].name),this.ws=void 0)},e.prototype.watch=function(e){this.ws||void 0!==this.wsInitPromise&&null!==this.wsInitPromise||this.initWebSocketConnection(!1);var t=new s.VirtualWebSocketClient(n(n({},e),{send:this.send,login:this.webLogin,isWSConnected:this.isWSConnected,onceWSConnected:this.onceWSConnected,getWaitExpectedTimeoutLength:this.getWaitExpectedTimeoutLength,onWatchStart:this.onWatchStart,onWatchClose:this.onWatchClose,debug:!0}));return this.virtualWSClient.add(t),this.watchIdClientMap.set(t.watchId,t),t.listener},e.prototype.heartbeat=function(e){var t=this;this.clearHeartbeat(),this.pingTimeoutId=setTimeout((function(){o(t,void 0,void 0,(function(){var e=this;return i(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.ws&&1===this.ws.readyState?(this.lastPingSendTS=Date.now(),[4,this.ping()]):[2];case 1:return t.sent(),this.pingFailed=0,this.pongTimeoutId=setTimeout((function(){console.error("pong timed out"),e.pongMissed<2?(e.pongMissed+=1,e.heartbeat(!0)):e.initWebSocketConnection(!0)}),this.context.appConfig.realtimePongWaitTimeout),[3,3];case 2:return t.sent(),this.pingFailed<2?(this.pingFailed+=1,this.heartbeat()):this.close(c.CloseEventCode.HeartbeatPingError),[3,3];case 3:return[2]}}))}))}),e?0:this.context.appConfig.realtimePingInterval)},e}();t.RealtimeWebSocketClient=d},7164:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWSCloseError=t.CloseEventCode=t.CLOSE_EVENT_CODE_INFO=void 0;var n,o=r(5889);t.CLOSE_EVENT_CODE_INFO={1e3:{code:1e3,name:"Normal Closure",description:"Normal closure; the connection successfully completed whatever purpose for which it was created."},1001:{code:1001,name:"Going Away",description:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{code:1002,name:"Protocol Error",description:"The endpoint is terminating the connection due to a protocol error."},1003:{code:1003,name:"Unsupported Data",description:"The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data)."},1005:{code:1005,name:"No Status Received",description:"Indicates that no status code was provided even though one was expected."},1006:{code:1006,name:"Abnormal Closure",description:"Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{code:1007,name:"Invalid frame payload data",description:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{code:1008,name:"Policy Violation",description:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{code:1009,name:"Message too big",description:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{code:1010,name:"Missing Extension",description:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{code:1011,name:"Internal Error",description:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{code:1012,name:"Service Restart",description:"The server is terminating the connection because it is restarting."},1013:{code:1013,name:"Try Again Later",description:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{code:1014,name:"Bad Gateway",description:"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{code:1015,name:"TLS Handshake",description:"Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},3e3:{code:3e3,name:"Reconnect WebSocket",description:"The client is terminating the connection because it wants to reconnect"},3001:{code:3001,name:"No Realtime Listeners",description:"The client is terminating the connection because no more realtime listeners exist"},3002:{code:3002,name:"Heartbeat Ping Error",description:"The client is terminating the connection due to its failure in sending heartbeat messages"},3003:{code:3003,name:"Heartbeat Pong Timeout Error",description:"The client is terminating the connection because no heartbeat response is received from the server"},3050:{code:3050,name:"Server Close",description:"The client is terminating the connection because no heartbeat response is received from the server"}},(n=t.CloseEventCode||(t.CloseEventCode={}))[n.NormalClosure=1e3]="NormalClosure",n[n.GoingAway=1001]="GoingAway",n[n.ProtocolError=1002]="ProtocolError",n[n.UnsupportedData=1003]="UnsupportedData",n[n.NoStatusReceived=1005]="NoStatusReceived",n[n.AbnormalClosure=1006]="AbnormalClosure",n[n.InvalidFramePayloadData=1007]="InvalidFramePayloadData",n[n.PolicyViolation=1008]="PolicyViolation",n[n.MessageTooBig=1009]="MessageTooBig",n[n.MissingExtension=1010]="MissingExtension",n[n.InternalError=1011]="InternalError",n[n.ServiceRestart=1012]="ServiceRestart",n[n.TryAgainLater=1013]="TryAgainLater",n[n.BadGateway=1014]="BadGateway",n[n.TLSHandshake=1015]="TLSHandshake",n[n.ReconnectWebSocket=3e3]="ReconnectWebSocket",n[n.NoRealtimeListeners=3001]="NoRealtimeListeners",n[n.HeartbeatPingError=3002]="HeartbeatPingError",n[n.HeartbeatPongTimeoutError=3003]="HeartbeatPongTimeoutError",n[n.NoAuthentication=3050]="NoAuthentication",t.getWSCloseError=function(e,r){var n=t.CLOSE_EVENT_CODE_INFO[e],i=n?"".concat(n.name,", code ").concat(e,", reason ").concat(r||n.description):"code ".concat(e);return new o.CloudSDKError({errCode:o.ERR_CODE.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED,errMsg:i})}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.registerRealtime=void 0;var t=r(2697),o=r(508),i={target:"database",entity:function(){var e=this.platform,t=e.adapter,r=e.runtime;(0,o.setWsClass)(t.wsClass),(0,o.setRuntime)(r)}},s={name:"realtime",IIFE:!0,entity:function(){this.prototype.wsClientClass=t.RealtimeWebSocketClient}};try{cloudbase.registerComponent(s),cloudbase.registerHook(i)}catch(e){}e.registerRealtime=function(e){try{e.registerComponent(s),e.registerHook(i)}catch(e){console.warn(e)}}})(),module.exports=n})();