@be-link/request 1.45.0 → 1.45.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +366 -20
  2. package/dist/application/clients/BeLinkClient.d.ts +75 -0
  3. package/dist/application/clients/BeLinkClient.d.ts.map +1 -0
  4. package/dist/application/clients/HttpClient.d.ts +64 -0
  5. package/dist/application/clients/HttpClient.d.ts.map +1 -0
  6. package/dist/application/clients/LiveClient.d.ts +15 -0
  7. package/dist/application/clients/LiveClient.d.ts.map +1 -0
  8. package/dist/application/interceptors/AuthInterceptor.d.ts +23 -0
  9. package/dist/application/interceptors/AuthInterceptor.d.ts.map +1 -0
  10. package/dist/application/interceptors/TimeInterceptor.d.ts +21 -0
  11. package/dist/application/interceptors/TimeInterceptor.d.ts.map +1 -0
  12. package/dist/application/interceptors/TokenInterceptor.d.ts +24 -0
  13. package/dist/application/interceptors/TokenInterceptor.d.ts.map +1 -0
  14. package/dist/application/services/UserInfoService.d.ts +33 -0
  15. package/dist/application/services/UserInfoService.d.ts.map +1 -0
  16. package/dist/cloudbase/index.d.ts +27 -0
  17. package/dist/cloudbase/index.d.ts.map +1 -0
  18. package/dist/cloudbase/types.d.ts +63 -0
  19. package/dist/cloudbase/types.d.ts.map +1 -0
  20. package/dist/core/constants/index.d.ts +59 -0
  21. package/dist/core/constants/index.d.ts.map +1 -0
  22. package/dist/core/errors/index.d.ts +42 -0
  23. package/dist/core/errors/index.d.ts.map +1 -0
  24. package/dist/core/interfaces/IConfigManager.d.ts +31 -0
  25. package/dist/core/interfaces/IConfigManager.d.ts.map +1 -0
  26. package/dist/core/interfaces/IEncryptionService.d.ts +28 -0
  27. package/dist/core/interfaces/IEncryptionService.d.ts.map +1 -0
  28. package/dist/core/interfaces/IHttpClient.d.ts +43 -0
  29. package/dist/core/interfaces/IHttpClient.d.ts.map +1 -0
  30. package/dist/core/interfaces/index.d.ts +4 -0
  31. package/dist/core/interfaces/index.d.ts.map +1 -0
  32. package/dist/core/types/config.types.d.ts +57 -0
  33. package/dist/core/types/config.types.d.ts.map +1 -0
  34. package/dist/core/types/index.d.ts +5 -0
  35. package/dist/core/types/index.d.ts.map +1 -0
  36. package/dist/core/types/interceptor.types.d.ts +48 -0
  37. package/dist/core/types/interceptor.types.d.ts.map +1 -0
  38. package/dist/core/types/request.types.d.ts +65 -0
  39. package/dist/core/types/request.types.d.ts.map +1 -0
  40. package/dist/core/types/response.types.d.ts +29 -0
  41. package/dist/core/types/response.types.d.ts.map +1 -0
  42. package/dist/index.cjs.js +6266 -0
  43. package/dist/index.d.ts +39 -4
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.esm.js +6235 -0
  46. package/dist/infrastructure/adapters/AxiosAdapter.d.ts +47 -0
  47. package/dist/infrastructure/adapters/AxiosAdapter.d.ts.map +1 -0
  48. package/dist/infrastructure/services/ConfigManager.d.ts +52 -0
  49. package/dist/infrastructure/services/ConfigManager.d.ts.map +1 -0
  50. package/dist/infrastructure/services/EncryptionService.d.ts +34 -0
  51. package/dist/infrastructure/services/EncryptionService.d.ts.map +1 -0
  52. package/dist/infrastructure/services/TimeSyncService.d.ts +44 -0
  53. package/dist/infrastructure/services/TimeSyncService.d.ts.map +1 -0
  54. package/dist/infrastructure/utils/env.utils.d.ts +13 -0
  55. package/dist/infrastructure/utils/env.utils.d.ts.map +1 -0
  56. package/dist/presets/belink.preset.d.ts +4 -0
  57. package/dist/presets/belink.preset.d.ts.map +1 -0
  58. package/dist/presets/index.d.ts +4 -0
  59. package/dist/presets/index.d.ts.map +1 -0
  60. package/dist/presets/live.preset.d.ts +4 -0
  61. package/dist/presets/live.preset.d.ts.map +1 -0
  62. package/dist/presets/request.preset.d.ts +9 -0
  63. package/dist/presets/request.preset.d.ts.map +1 -0
  64. package/package.json +37 -35
  65. package/dist/beLinkRequest.d.ts +0 -43
  66. package/dist/beLinkUserInfo.d.ts +0 -12
  67. package/dist/callFunction.d.ts +0 -36
  68. package/dist/config.d.ts +0 -5
  69. package/dist/index.js +0 -1
  70. package/dist/request.d.ts +0 -14
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- import{Buffer as e}from"buffer";import t,{AxiosError as n}from"axios";var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function o(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var u={},l={},f={};Object.defineProperty(f,"__esModule",{value:!0}),f.COMMUNITY_SITE_URL=f.IS_DEBUG_MODE=f.getProtocol=f.setProtocol=f.getSdkName=f.setSdkName=void 0;var h="@cloudbase/js-sdk";f.setSdkName=function(e){h=e},f.getSdkName=function(){return h};var p="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";f.setProtocol=function(e){p=e},f.getProtocol=function(){return p},f.IS_DEBUG_MODE="development"===process.env.NODE_ENV,f.COMMUNITY_SITE_URL="https://support.qq.com/products/148793";var d={};Object.defineProperty(d,"__esModule",{value:!0}),d.ERRORS=void 0,d.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"},function(e){var t=s&&s.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=s&&s.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(f,e),n(d,e)}(l);var y,g={},v={};!function(e){e.local="local",e.none="none",e.session="session"}(y||(y={}));var _=function(){},m=function(){};function b(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var i in n)""===o?!r&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}var w=c(Object.freeze({__proto__:null,AbstractSDKRequest:_,AbstractStorage:m,get StorageType(){return y},formatUrl:b})),E={},S={exports:{}};var I,O={exports:{}};function A(){return I||(I=1,O.exports=function(){var e=e||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==s&&s.crypto&&(n=s.crypto),!n)try{n=require("crypto")}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),i={},a=i.lib={},c=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=a.WordArray=c.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||f).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var s=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=s<<24-(r+i)%4*8}else for(var a=0;a<o;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),l=i.enc={},f=l.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},h=l.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},p=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},d=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,s=this.blockSize,a=i/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,l=e.min(4*c,i);if(c){for(var f=0;f<c;f+=s)this._doProcessBlock(o,f);n=o.splice(0,c),r.sigBytes-=l}return new u.init(n,l)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=d.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new y.HMAC.init(e,n).finalize(t)}}});var y=i.algo={};return i}(Math);return e}()),O.exports}var T,N={exports:{}};function x(){return T||(T=1,N.exports=function(e){return function(t){var n=e,r=n.lib,o=r.WordArray,i=r.Hasher,s=n.algo,a=[],c=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;o<64;)e(r)&&(o<8&&(a[o]=n(t.pow(r,.5))),c[o]=n(t.pow(r,1/3)),o++),r++}();var u=[],l=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],s=n[3],a=n[4],l=n[5],f=n[6],h=n[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var d=u[p-15],y=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,g=u[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;u[p]=y+u[p-7]+v+u[p-16]}var _=r&o^r&i^o&i,m=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+c[p]+u[p];h=f,f=l,l=a,a=s+b|0,s=i,i=o,o=r,r=b+(m+_)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+h|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});n.SHA256=i._createHelper(l),n.HmacSHA256=i._createHmacHelper(l)}(Math),e.SHA256}(A())),N.exports}var R,P={exports:{}};function k(){return R||(R=1,P.exports=function(e){var t,n,r;n=(t=e).lib.Base,r=t.enc.Utf8,t.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,o=4*n;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),s=this._iKey=t.clone(),a=i.words,c=s.words,u=0;u<n;u++)a[u]^=1549556828,c[u]^=909522486;i.sigBytes=s.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})}(A())),P.exports}S.exports=function(e){return e.HmacSHA256}(A(),x(),k());var C,L=S.exports,D={exports:{}};function j(){return C||(C=1,D.exports=function(e){return function(){var t=e,n=t.lib.WordArray;function r(e,t,r){for(var o=[],i=0,s=0;s<t;s++)if(s%4){var a=r[e.charCodeAt(s-1)]<<s%4*2|r[e.charCodeAt(s)]>>>6-s%4*2;o[i>>>2]|=a<<24-i%4*8,i++}return n.create(o,i)}t.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var o=[],i=0;i<n;i+=3)for(var s=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<n;a++)o.push(r.charAt(s>>>6*(3-a)&63));var c=r.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i<n.length;i++)o[n.charCodeAt(i)]=i}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return r(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(A())),D.exports}var U={exports:{}};U.exports=function(e){return e.enc.Utf8}(A());var M=U.exports,B=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(E,"__esModule",{value:!0}),E.transformPhone=E.sleep=E.printGroupLog=E.throwError=E.printInfo=E.printError=E.printWarn=E.execCallback=E.createPromiseCallback=E.removeParam=E.getHash=E.getQuery=E.toQueryString=E.createSign=E.formatUrl=E.genSeqId=E.isFormData=E.isInstanceOf=E.isNull=E.isPalinObject=E.isUndefined=E.isString=E.isArray=void 0;var q=B(L),W=B(j()),F=B(M),H=l;function $(e){var t=W.default.stringify(e);return t=(t=(t=t.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}E.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},E.isString=function(e){return"string"==typeof e},E.isUndefined=function(e){return void 0===e},E.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},E.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},E.isInstanceOf=function(e,t){return e instanceof t},E.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},E.genSeqId=function(){return Math.random().toString(16).slice(2)},E.formatUrl=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var i in n)""===o?!r&&(t+="?"):o+="&",o+="".concat(i,"=").concat(encodeURIComponent(n[i]));return/^http(s)?\:\/\//.test(t+=o)?t:"".concat(e).concat(t)},E.createSign=function(e,t){var n=$(F.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"}))),r=$(F.default.parse(JSON.stringify(e))),o="".concat(n,".").concat(r),i=$((0,q.default)(o,t));return"".concat(o,".").concat(i)},E.toQueryString=function(e){void 0===e&&(e={});var t=[];for(var n in e)t.push("".concat(n,"=").concat(encodeURIComponent(e[n])));return t.join("&")},E.getQuery=function(e,t){if("undefined"==typeof window)return!1;var n=t||window.location.search,r=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),o=n.substr(n.indexOf("?")+1).match(r);return null!=o?o[2]:""};E.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]".concat(e,"=([^&#]*)")));return t?t[1]:""},E.removeParam=function(e,t){var n=t.split("?")[0],r=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(r=o.split("&")).length-1;i>=0;i-=1)r[i].split("=")[0]===e&&r.splice(i,1);n="".concat(n,"?").concat(r.join("&"))}return n},E.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var n=new Promise((function(t,n){e=function(e,r){return e?n(e):t(r)}}));return e.promise=n,e},E.execCallback=function(e,t,n){if(void 0===n&&(n=null),e&&"function"==typeof e)return e(t,n);if(t)throw t;return n},E.printWarn=function(e,t){console.warn("[".concat((0,H.getSdkName)(),"][").concat(e,"]:").concat(t))},E.printError=function(e,t){console.error({code:e,msg:"[".concat((0,H.getSdkName)(),"][").concat(e,"]:").concat(t)})},E.printInfo=function(e,t){console.log("[".concat((0,H.getSdkName)(),"][").concat(e,"]:").concat(t))},E.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,H.getSdkName)(),"][").concat(e,"]:").concat(t)}))},E.printGroupLog=function(e){var t=e.title,n=e.subtitle,r=void 0===n?"":n,o=e.content,i=void 0===o?[]:o,s=e.printTrace,a=void 0!==s&&s,c=e.collapsed;void 0!==c&&c?console.groupCollapsed(t,r):console.group(t,r);for(var u=0,l=i;u<l.length;u++){var f=l[u],h=f.type,p=f.body;switch(h){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}a&&console.trace("stack trace:"),console.groupEnd()};E.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},E.transformPhone=function(e){return"+86".concat(e)};var G,K=s&&s.__extends||(G=function(e,t){return G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},G(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}G(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),V=s&&s.__assign||function(){return V=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},V.apply(this,arguments)},J=s&&s.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},z=s&&s.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(v,"__esModule",{value:!0}),v.WebRequest=v.genAdapter=void 0;var Y=E,X=f,Z=function(e){function t(t){var n=e.call(this)||this,r=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=o||"请求超时",n._restrictedMethods=i||["get","post","upload","download"],n}return K(t,e),t.prototype.get=function(e){return this._request(V(V({},e),{method:"get"}),this._restrictedMethods.includes("get"))},t.prototype.post=function(e){return this._request(V(V({},e),{method:"post"}),this._restrictedMethods.includes("post"))},t.prototype.put=function(e){return this._request(V(V({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,o=new FormData;for(var i in t)o.append(i,t[i]);return o.append("key",r),o.append("file",n),this._request(V(V({},e),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},t.prototype.download=function(e){return J(this,void 0,void 0,(function(){var t,n,r,o;return z(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(V(V({},e),{headers:{},responseType:"blob"}))];case 1:return t=i.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype._request=function(e,t){var n=this;void 0===t&&(t=!1);var r=String(e.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=e.url,c=e.headers,u=void 0===c?{}:c,l=e.data,f=e.responseType,h=e.withCredentials,p=e.body,d=e.onUploadProgress,y=(0,Y.formatUrl)((0,X.getProtocol)(),a,"get"===r?l:{}),g=new XMLHttpRequest;for(var v in g.open(r,y),f&&(g.responseType=f),u)g.setRequestHeader(v,u[v]);d&&g.upload.addEventListener("progress",d),g.onreadystatechange=function(){var e={};if(4===g.readyState){var t=g.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach((function(e){var t=e.split(": "),r=t.shift().toLowerCase(),o=t.join(": ");n[r]=o})),e.header=n,e.statusCode=g.status;try{e.data="blob"===f?g.response:JSON.parse(g.responseText)}catch(t){e.data="blob"===f?g.response:g.responseText}clearTimeout(i),o(e)}},t&&n._timeout&&(i=setTimeout((function(){console.warn(n._timeoutMsg),g.abort()}),n._timeout)),s=(0,Y.isFormData)(l)?l:"application/x-www-form-urlencoded"===u["content-type"]?(0,Y.toQueryString)(l):p||(l?JSON.stringify(l):void 0),h&&(g.withCredentials=!0),g.send(s)}))},t}(w.AbstractSDKRequest);v.WebRequest=Z,v.genAdapter=function(){return{root:window,reqClass:Z,wsClass:WebSocket,localStorage:localStorage,sessionStorage:sessionStorage}},function(e){var t=s&&s.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=s&&s.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=s&&s.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&t(r,e,o);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var o,i=r(v),a=E;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(o=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(e){for(var t=0,n=(0,a.isArray)(e)?e:[e];t<n.length;t++){var r=n[t],o=r.isMatch,i=r.genAdapter,s=r.runtime;if(o())return{adapter:i(),runtime:s}}},e.useDefaultAdapter=function(){return{adapter:i.genAdapter(),runtime:o.WEB}}}(g);var Q={},ee=s&&s.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),te=s&&s.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},ne=s&&s.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(Q,"__esModule",{value:!0}),Q.CloudbaseCache=void 0;var re=E,oe=l,ie=function(e){function t(t){var n=e.call(this)||this;return n._root=t,t.tcbCacheObject||(t.tcbCacheObject={}),n}return ee(t,e),t.prototype.setItem=function(e,t){this._root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this._root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this._root.tcbCacheObject[e]},t.prototype.clear=function(){delete this._root.tcbCacheObject},t}(w.AbstractStorage);function se(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:((0,re.printWarn)(oe.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new ie(t.root));case"none":return new ie(t.root);case"session":return t.sessionStorage?t.sessionStorage:((0,re.printWarn)(oe.ERRORS.INVALID_PARAMS,"sessionStorage is not supported on current platform"),new ie(t.root))}}var ae=function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=void 0===n?{}:n,o=e.keys,i=void 0===o?{}:o,s=e.alwaysLocalKeys,a=void 0===s?[]:s;this._platformInfo=r,this._alwaysLocalKeys=a,this._storage||(this._persistence=r.adapter.primaryStorage||t,this._storage=se(this._persistence,r.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this._storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this._persistence},enumerable:!1,configurable:!0}),e.prototype.updatePersistence=function(e){if("async"!==this.mode){if(e!==this._persistence){var t="local"===this._persistence;this._persistence=e;var n=se(e,this._platformInfo.adapter);for(var r in this.keys){var o=this.keys[r];if(!t||!this._alwaysLocalKeys.includes(r)){var i=this._storage.getItem(o);(0,re.isUndefined)(i)||(0,re.isNull)(i)||(n.setItem(o,i),this._storage.removeItem(o))}}this._storage=n}}else(0,re.printWarn)(oe.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use updatePersistenceAsync insteed")},e.prototype.updatePersistenceAsync=function(e){return te(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,c,u;return ne(this,(function(l){switch(l.label){case 0:if(e===this._persistence)return[2];for(i in t="local"===this._persistence,this._persistence=e,n=se(e,this._platformInfo.adapter),r=this.keys,o=[],r)o.push(i);s=0,l.label=1;case 1:return s<o.length?(i=o[s])in r?(a=i,c=this.keys[a],t&&this._alwaysLocalKeys.includes(a)?[3,4]:[4,this._storage.getItem(c)]):[3,4]:[3,5];case 2:return u=l.sent(),(0,re.isUndefined)(u)||(0,re.isNull)(u)?[3,4]:(n.setItem(c,u),[4,this._storage.removeItem(c)]);case 3:l.sent(),l.label=4;case 4:return s++,[3,1];case 5:return this._storage=n,[2]}}))}))},e.prototype.setStore=function(e,t,n){if("async"!==this.mode){if(this._storage)try{var r={version:n||"localCachev1",content:t};this._storage.setItem(e,JSON.stringify(r))}catch(e){throw new Error(JSON.stringify({code:oe.ERRORS.OPERATION_FAIL,msg:"[".concat((0,oe.getSdkName)(),"][").concat(oe.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,re.printWarn)(oe.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,n){return te(this,void 0,void 0,(function(){var r;return ne(this,(function(o){switch(o.label){case 0:if(!this._storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:t},[4,this._storage.setItem(e,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return process.env.tcb_token;if(!this._storage)return""}catch(e){return""}t=t||"localCachev1";var r=this._storage.getItem(e);return r&&r.indexOf(t)>=0?JSON.parse(r).content:""}(0,re.printWarn)(oe.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var n;return te(this,void 0,void 0,(function(){var r;return ne(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return[2,process.env.tcb_token];if(!this._storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this._storage.getItem(e)];case 1:return(r=o.sent())&&r.indexOf(t)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this._storage.removeItem(e):(0,re.printWarn)(oe.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return te(this,void 0,void 0,(function(){return ne(this,(function(t){switch(t.label){case 0:return[4,this._storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}();Q.CloudbaseCache=ae;var ce={},ue=s&&s.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),le=s&&s.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(ce,"__esModule",{value:!0}),ce.removeEventListener=ce.activateEvent=ce.addEventListener=ce.CloudbaseEventEmitter=ce.IErrorEvent=ce.CloudbaseEvent=void 0;var fe=E;var he=function(e,t){this.data=t||null,this.name=e};ce.CloudbaseEvent=he;var pe=function(e){function t(t,n){var r=e.call(this,"error",{error:t,data:n})||this;return r.error=t,r}return ue(t,e),t}(he);ce.IErrorEvent=pe;var de=function(){function e(){this._listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this._listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(null==n?void 0:n[e]){var r=n[e].indexOf(t);-1!==r&&n[e].splice(r,1)}}(e,t,this._listeners),this},e.prototype.fire=function(e,t){if((0,fe.isInstanceOf)(e,pe))return console.error(e.error),this;var n=(0,fe.isString)(e)?new he(e,t||{}):e,r=n.name;if(this._listens(r)){n.target=this;for(var o=0,i=this._listeners[r]?le([],this._listeners[r],!0):[];o<i.length;o++){i[o].call(this,n)}}return this},e.prototype._listens=function(e){return this._listeners[e]&&this._listeners[e].length>0},e}();ce.CloudbaseEventEmitter=de;var ye=new de;ce.addEventListener=function(e,t){ye.on(e,t)},ce.activateEvent=function(e,t){void 0===t&&(t={}),ye.fire(e,t)},ce.removeEventListener=function(e,t){ye.off(e,t)};var ge={},ve={},_e=s&&s.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},me=s&&s.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(ve,"__esModule",{value:!0}),ve.catchErrorsDecorator=void 0;var be=E,we=l,Ee=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(Ee=-1!==navigator.userAgent.indexOf("Firefox"));var Se=Ee?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,Ie=/https?\:\/\/.+\:\d*\/.*\.js\:\d+\:\d+/;function Oe(e){var t=e.err,n=e.className,r=e.methodName,o=e.sourceLink;if(!o)return null;var i,s=t.stack.split("\n"),a=Ee?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]\\s*\\(.*\\)$")),c=Ee?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]")),u=s.findIndex((function(e){return a.test(e)}));if(-1!==u){var l=s.filter((function(e,t){return t>u}));l.unshift(s[u].replace(c,"".concat(n,".").concat(r)).replace(Ie,o)),(i=new Error).stack="".concat(Ee?"@debugger":"Error","\n").concat(l.join("\n"))}return i}ve.catchErrorsDecorator=function(e){var t=e.mode,n=void 0===t?"async":t,r=e.customInfo,o=void 0===r?{}:r,i=e.title,s=e.messages,a=void 0===s?[]:s;return function(e,t,r){if(we.IS_DEBUG_MODE){var s=o.className||e.constructor.name,c=o.methodName||t,u=r.value,l=function(e){var t="",n=e.stack.split("\n"),r=n.findIndex((function(e){return Se.test(e)}));if(-1!==r){var o=Ie.exec(n[r+1]||"");t=o?o[0]:""}return t}(new Error);r.value="sync"===n?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Oe({err:new Error,className:s,methodName:c,sourceLink:l});try{return u.apply(this,e)}catch(e){var r=e,o=e.message,f={title:i||"".concat(s,".").concat(c," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var h=JSON.parse(o);f.subtitle=o,h.code&&(n?(n.code=h.code,n.msg=h.msg):(e.code=h.code,e.message=h.msg),r=n||e,f.content=a.map((function(e){return{type:"info",body:e}})))}throw(0,be.printGroupLog)(f),r}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _e(this,void 0,void 0,(function(){var t,n,r,o,f,h;return me(this,(function(p){switch(p.label){case 0:t=Oe({err:new Error,className:s,methodName:c,sourceLink:l}),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,u.apply(this,e)];case 2:return[2,p.sent()];case 3:throw n=p.sent(),r=n,o=n.message,f={title:i||"".concat(s,".").concat(c," failed"),content:[{type:"error",body:n}]},o&&/^\{.*\}$/.test(o)&&(h=JSON.parse(o),f.subtitle=h,h.code&&(t?(t.code=h.code,t.message=h.msg):(n.code=h.code,n.message=h.msg),r=t||n,f.content=a.map((function(e){return{type:"info",body:e}})))),(0,be.printGroupLog)(f),r;case 4:return[2]}}))}))}}}},function(e){var t=s&&s.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=s&&s.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(ve,e)}(ge);var Ae=s&&s.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),Te=s&&s.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ne=s&&s.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Ae(t,e,n);return Te(t,e),t};Object.defineProperty(u,"__esModule",{value:!0});var xe=u.helpers=u.utils=u.events=u.cache=u.adapters=u.constants=void 0,Re=Ne(l),Pe=u.constants=Re,ke=Ne(g),Ce=u.adapters=ke,Le=Ne(Q),De=u.cache=Le,je=Ne(ce),Ue=u.events=je,Me=Ne(E),Be=u.utils=Me,qe=Ne(ge);xe=u.helpers=qe;var We=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fe=function(){return Fe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Fe.apply(this,arguments)},He=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},$e=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};var Ge=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this,r=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=o||"请求超时",n._restrictedMethods=i||["get","post","upload","download"],n}return We(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(n,r){var o=e.url,i=e.data,s=e.headers,a=wx.request({url:b("https:",o),data:i,timeout:t._timeout,method:"POST",header:s,success:function(e){n(e)},fail:function(e){r(e)},complete:function(e){if(e&&e.errMsg&&(t._timeout&&-1!==t._restrictedMethods.indexOf("post")&&"request:fail timeout"===e.errMsg)){console.warn(t._timeoutMsg);try{a.abort()}catch(e){}}}})}))},t.prototype.upload=function(e){var t=this,n=this;return new Promise((function(r){return He(t,void 0,void 0,(function(){var t,o,i,s,a,c;return $e(this,(function(u){return t=e.url,o=e.file,i=e.data,s=e.headers,a=e.onUploadProgress,c=wx.uploadFile({url:t,filePath:o,name:"file",formData:Fe({},i),header:s,timeout:this._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&i.success_action_status&&(t.statusCode=parseInt(i.success_action_status,10)),r(t)},fail:function(e){r(e)},complete:function(e){if(e&&e.errMsg&&(n._timeout&&-1!==n._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg)){console.warn(n._timeoutMsg);try{c.abort()}catch(e){}}}}),a&&c.onProgressUpdate((function(e){a(e)})),[2]}))}))}))},t.prototype.download=function(e){var t=this,n=this;return new Promise((function(r,o){var i=e.url,s=e.headers,a=wx.downloadFile({url:b("https:",i),header:s,timeout:t._timeout,success:function(e){200===e.statusCode&&e.tempFilePath?r({statusCode:200,tempFilePath:e.tempFilePath}):r(e)},fail:function(e){o(e)},complete:function(e){if(e&&e.errMsg&&(n._timeout&&-1!==n._restrictedMethods.indexOf("download")&&"request:fail timeout"===e.errMsg)){console.warn(n._timeoutMsg);try{a.abort()}catch(e){}}}})}))},t}(_),Ke={setItem:function(e,t){wx.setStorageSync(e,t)},getItem:function(e){return wx.getStorageSync(e)},removeItem:function(e){wx.removeStorageSync(e)},clear:function(){wx.clearStorageSync()}},Ve=function(e,t){void 0===t&&(t={});var n=wx.connectSocket(Fe({url:e},t));return{set onopen(e){n.onOpen(e)},set onmessage(e){n.onMessage(e)},set onclose(e){n.onClose(e)},set onerror(e){n.onError(e)},send:function(e){return n.send({data:e})},close:function(e,t){return n.close({code:e,reason:t})},get readyState(){return n.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}};var Je={genAdapter:function(){return{root:{},reqClass:Ge,wsClass:Ve,localStorage:Ke,primaryStorage:y.local,getAppSign:function(){var e=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:"":e&&e.plugin?e.plugin.appId:""}}},isMatch:function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(e){return!1}return!0},runtime:"wx_mp"},ze=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Ye=Pe.ERRORS,Xe={};function Ze(e,t){var n=t.name,r=t.namespace,o=t.entity,i=t.injectEvents,s=t.IIFE,a=void 0!==s&&s;if(Xe[n]||r&&e[r])throw new Error(JSON.stringify({code:Ye.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(a){if(!o||"function"!=typeof o)throw new Error(JSON.stringify({code:Ye.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));o.call(e)}if(Xe[n]=t,r?e.prototype[r]=o:Qe(e.prototype,o),i){var c=i.bus,u=i.events;if(!c||!u||0===u.length)return;var l=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[n]?e.prototype.events[n].events=ze(ze([],e.prototype.events[n].events,!0),u,!0):e.prototype.events[n]={bus:c,events:u},e.prototype.fire=function(e,t){for(var n in l(e,t),this.events){var r=this.events[n],o=r.bus;if(r.events.includes(e)){o.fire(e,t);break}}}}}function Qe(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var n in t)t.hasOwnProperty(n)&&(e[n]=Qe(e[n],t[n]));return e}var et={},tt=function(){return tt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},tt.apply(this,arguments)},nt=De.CloudbaseCache,rt={},ot={};function it(e){var t=e.env,n=e.persistence,r=e.platformInfo,o={accessTokenKey:"".concat("access_token","_").concat(t),accessTokenExpireKey:"".concat("access_token_expire","_").concat(t),refreshTokenKey:"".concat("refresh_token","_").concat(t),anonymousUuidKey:"".concat("anonymous_uuid","_").concat(t),loginTypeKey:"".concat("login_type","_").concat(t),userInfoKey:"".concat("user_info","_").concat(t)};rt[t]?rt[t].updatePersistence(n):rt[t]=new nt(tt(tt({},e),{keys:o,platformInfo:r,alwaysLocalKeys:["anonymousUuidKey"]})),ot[t]=ot[t]||new nt(tt(tt({},e),{keys:o,platformInfo:r,persistence:"local"}))}function st(e){return rt[e]}function at(e){return ot[e]}var ct=Pe.setSdkName,ut=Pe.setProtocol,lt="",ft="@cloudbase/js-sdk";var ht,pt="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:",dt="undefined"!=typeof process&&"e2e"===process.env.NODE_ENV&&"pre"===process.env.END_POINT?"//tcb-pre.tencentcloudapi.com/web":"//tcb-api.tencentcloudapi.com/web";function yt(e,t){dt=e,t&&(pt=t,ut(t))}function gt(){return{BASE_URL:dt,PROTOCOL:pt}}!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.CUSTOM="CUSTOM",e.NULL="NULL"}(ht||(ht={}));var vt="loginStateExpire",_t="refreshAccessToken",mt=function(){return mt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mt.apply(this,arguments)},bt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},wt=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Et=Pe.ERRORS,St=Be.genSeqId,It=Be.isFormData,Ot=Be.formatUrl,At=Be.createSign,Tt=Ce.RUNTIME,Nt=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function xt(e,t,n){var r=e[t];e[t]=function(t){var o={},i={};n.forEach((function(n){var r=n.call(e,t),s=r.data,a=r.headers;Object.assign(o,s),Object.assign(i,a)}));var s=t.data;return s&&function(){if(It(s))for(var e in o)s.append(e,o[e]);else t.data=mt(mt({},s),o)}(),t.headers=mt(mt({},t.headers||{}),i),r.call(e,t)}}function Rt(){var e=St();return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(lt),"x-seqid":e}}}var Pt=function(){function e(e){this._throwWhenRequestFail=!1,this.config=e,this._reqClass=new et.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post"]}),this._throwWhenRequestFail=e.throw||!1,this._cache=st(this.config.env),this._localCache=at(this.config.env),xt(this._reqClass,"post",[Rt]),xt(this._reqClass,"upload",[Rt]),xt(this._reqClass,"download",[Rt])}return e.prototype.post=function(e){return bt(this,void 0,void 0,(function(){return wt(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.post(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.upload=function(e){return bt(this,void 0,void 0,(function(){return wt(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.upload(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.download=function(e){return bt(this,void 0,void 0,(function(){return wt(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.download(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.refreshAccessToken=function(){return bt(this,void 0,void 0,(function(){var e,t,n;return wt(this,(function(r){switch(r.label){case 0:this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken()),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._refreshAccessTokenPromise];case 2:return e=r.sent(),[3,4];case 3:return n=r.sent(),t=n,[3,4];case 4:if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return[2,e]}}))}))},e.prototype.getAccessToken=function(){return bt(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a,c;return wt(this,(function(u){switch(u.label){case 0:return e=this._cache.keys,t=e.accessTokenKey,n=e.accessTokenExpireKey,r=e.refreshTokenKey,[4,this._cache.getStoreAsync(r)];case 1:if(!u.sent())throw new Error(JSON.stringify({code:Et.OPERATION_FAIL,msg:"refresh token is not exist, your local data might be messed up, please retry after clear localStorage or sessionStorage"}));return[4,this._cache.getStoreAsync(t)];case 2:return o=u.sent(),s=Number,[4,this._cache.getStoreAsync(n)];case 3:return i=s.apply(void 0,[u.sent()]),a=!0,(c=this._shouldRefreshAccessTokenHook)?[4,this._shouldRefreshAccessTokenHook(o,i)]:[3,5];case 4:c=!u.sent(),u.label=5;case 5:return c&&(a=!1),o&&i&&!(i<Date.now())||!a?[3,7]:[4,this.refreshAccessToken()];case 6:return[2,u.sent()];case 7:return[2,{accessToken:o,accessTokenExpire:i}]}}))}))},e.prototype.request=function(e,t,n){return bt(this,void 0,void 0,(function(){var r,o,i,s,a,c,u,l,f,h,p,d,y,g,v,_,m,b,w,E,S,I,O,A,T,N;return wt(this,(function(x){switch(x.label){case 0:return r="x-tcb-trace_".concat(this.config.env),o="application/x-www-form-urlencoded",i=mt({action:e,dataVersion:"2020-01-10",env:this.config.env},t),-1!==Nt.indexOf(e)?[3,3]:(s=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(s)]);case 1:return x.sent()?(a=i,[4,this.getAccessToken()]):[3,3];case 2:a.access_token=x.sent().accessToken,x.label=3;case 3:if("storage.uploadFile"===e){for(u in c=new FormData)c.hasOwnProperty(u)&&void 0!==c[u]&&c.append(u,i[u]);o="multipart/form-data"}else for(u in o="application/json;charset=UTF-8",c={},i)void 0!==i[u]&&(c[u]=i[u]);return l={headers:{"content-type":o}},(null==n?void 0:n.onUploadProgress)&&(l.onUploadProgress=n.onUploadProgress),this.config.region&&(l.headers["X-TCB-Region"]=this.config.region),(f=this._localCache.getStore(r))&&(l.headers["X-TCB-Trace"]=f),et.runtime!==Tt.WEB&&(h=this.config,p=h.appSign,d=h.appSecret,y=Date.now(),g=d.appAccessKey,v=d.appAccessKeyId,_=At({data:{},timestamp:y,appAccessKeyId:v,appSign:p},g),l.headers["X-TCB-App-Source"]="timestamp=".concat(y,";appAccessKeyId=").concat(v,";appSign=").concat(p,";sign=").concat(_)),m=t.parse,b=t.inQuery,w=t.search,E={env:this.config.env},m&&(E.parse=!0),b&&(E=mt(mt({},b),E)),S=gt(),I=S.BASE_URL,O=S.PROTOCOL,A=Ot(O,I,E),w&&(A+=w),[4,this.post(mt({url:A,data:c},l))];case 4:if(T=x.sent(),(N=T.header&&T.header["x-tcb-trace"])&&this._localCache.setStore(r,N),200!==Number(T.status)&&200!==Number(T.statusCode)||!T.data)throw new Error("network request error");return[2,T]}}))}))},e.prototype.send=function(e,t){return void 0===t&&(t={}),bt(this,void 0,void 0,(function(){var n;return wt(this,(function(r){switch(r.label){case 0:return[4,this.request(e,t,{onUploadProgress:t.onUploadProgress})];case 1:return"ACCESS_TOKEN_EXPIRED"!==(n=r.sent()).data.code||-1!==Nt.indexOf(e)?[3,4]:[4,this.refreshAccessToken()];case 2:return r.sent(),[4,this.request(e,t,{onUploadProgress:t.onUploadProgress})];case 3:n=r.sent(),r.label=4;case 4:if(n.data.code&&this._throwWhenRequestFail)throw new Error(JSON.stringify({code:Et.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},e.prototype._refreshAccessToken=function(e){return void 0===e&&(e=1),bt(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,c,u,l,f,h,p;return wt(this,(function(d){switch(d.label){case 0:return t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,o=t.refreshTokenKey,i=t.loginTypeKey,s=t.anonymousUuidKey,[4,this._cache.removeStoreAsync(n)];case 1:return d.sent(),[4,this._cache.removeStoreAsync(r)];case 2:return d.sent(),[4,this._cache.getStoreAsync(o)];case 3:if(!(a=d.sent()))throw new Error(JSON.stringify({code:Et.INVALID_OPERATION,msg:"not login"}));return c={refresh_token:a},[4,this.request("auth.fetchAccessTokenWithRefreshToken",c)];case 4:return(u=d.sent()).data.code?"SIGN_PARAM_INVALID"!==(l=u.data.code)&&"REFRESH_TOKEN_EXPIRED"!==l&&"INVALID_REFRESH_TOKEN"!==l?[3,11]:[4,this._cache.getStoreAsync(i)]:[3,12];case 5:return d.sent()===ht.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===l?[4,this._cache.getStoreAsync(s)]:[3,9];case 6:return f=d.sent(),[4,this._cache.getStoreAsync(o)];case 7:return h=d.sent(),[4,this.send("auth.signInAnonymously",{anonymous_uuid:f,refresh_token:h})];case 8:if(p=d.sent(),this._setRefreshToken(p.refresh_token),e>=1)return[2,this._refreshAccessToken(--e)];throw new Error(JSON.stringify({code:Et.OPERATION_FAIL,message:"重试获取 refresh token 失败"}));case 9:return zt.fire(vt),[4,this._cache.removeStoreAsync(o)];case 10:d.sent(),d.label=11;case 11:throw new Error(JSON.stringify({code:Et.NETWORK_ERROR,msg:"refresh access_token failed:".concat(u.data.code)}));case 12:return u.data.access_token?(zt.fire(_t),[4,this._cache.setStoreAsync(n,u.data.access_token)]):[3,15];case 13:return d.sent(),[4,this._cache.setStoreAsync(r,u.data.access_token_expire+Date.now())];case 14:return d.sent(),[2,{accessToken:u.data.access_token,accessTokenExpire:u.data.access_token_expire}];case 15:return u.data.refresh_token?[4,this._cache.removeStoreAsync(o)]:[3,19];case 16:return d.sent(),[4,this._cache.setStoreAsync(o,u.data.refresh_token)];case 17:return d.sent(),[4,this._refreshAccessToken()];case 18:d.sent(),d.label=19;case 19:return[2]}}))}))},e.prototype._setRefreshToken=function(e){return bt(this,void 0,void 0,(function(){var t,n,r,o;return wt(this,(function(i){switch(i.label){case 0:return t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,o=t.refreshTokenKey,[4,this._cache.removeStoreAsync(n)];case 1:return i.sent(),[4,this._cache.removeStoreAsync(r)];case 2:return i.sent(),[4,this._cache.setStoreAsync(o,e)];case 3:return i.sent(),[2]}}))}))},e}(),kt={};var Ct=function(){return Ct=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ct.apply(this,arguments)},Lt=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},Dt=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},jt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Ut=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Mt=Ce.useAdapters,Bt=Ce.useDefaultAdapter,qt=Ce.RUNTIME,Wt=Pe.ERRORS,Ft=Pe.COMMUNITY_SITE_URL,Ht=Be.printWarn,$t=xe.catchErrorsDecorator,Gt={timeout:15e3,persistence:"local"},Kt=6e5,Vt={},Jt=function(){function e(e){this._config=e||this._config,this.authInstance=null}return Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return et},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return st(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return at(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return e=this._config.env,kt[e];var e},enumerable:!1,configurable:!0}),e.prototype.init=function(t){if(!t.env)throw new Error(JSON.stringify({code:Wt.INVALID_PARAMS,msg:"env must not be specified"}));if(et.adapter||this._useDefaultAdapter(),this.requestClient=new et.adapter.reqClass({timeout:t.timeout||5e3,timeoutMsg:"[".concat(ft,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(t.timeout/1e3,"s")}),et.runtime!==qt.WEB){if(!t.appSecret)throw new Error(JSON.stringify({code:Wt.INVALID_PARAMS,msg:"invalid appSecret"}));var n=et.adapter.getAppSign?et.adapter.getAppSign():"";if(t.appSign&&n&&t.appSign!==n)throw new Error(JSON.stringify({code:Wt.INVALID_PARAMS,msg:"invalid appSign"}));if(n&&(t.appSign=n),!t.appSign)throw new Error(JSON.stringify({code:Wt.INVALID_PARAMS,msg:"invalid appSign"}))}this._config=Ct(Ct({},Gt),t),this._config.timeout=this._formatTimeout(this._config.timeout);var r=this._config,o=r.env,i=r.persistence,s=r.debug,a=r.timeout,c=r.appSecret,u=r.appSign;it({env:o,persistence:i,debug:s,platformInfo:this.platform}),function(e){kt[e.env]=new Pt(mt(mt({},e),{throw:!0}))}({env:o,region:t.region||"",timeout:a,appSecret:c,appSign:u}),t.region&&function(e,t,n){yt(t?"//".concat(e,".").concat(t,".tcb-api.tencentcloudapi.com/web"):"//".concat(e,".ap-shanghai.tcb-api.tencentcloudapi.com/web"),n)}(o,t.region||"");var l=new e(this._config);return l.requestClient=this.requestClient,l},e.prototype.updateConfig=function(e){var t=e.persistence,n=e.debug;this._config.persistence=t,this._config.debug=n,it({env:this._config.env,persistence:t,debug:n,platformInfo:this.platform})},e.prototype.registerExtension=function(e){Vt[e.name]=e},e.prototype.invokeExtension=function(e,t){return jt(this,void 0,void 0,(function(){var n;return Ut(this,(function(r){switch(r.label){case 0:if(!(n=Vt[e]))throw new Error(JSON.stringify({code:Wt.INVALID_PARAMS,msg:"extension:".concat(e," must be registered before invoke")}));return[4,n.invoke(t,this)];case 1:return[2,r.sent()]}}))}))},e.prototype.useAdapters=function(e){var t=Mt(e)||{},n=t.adapter,r=t.runtime;n&&(et.adapter=n),r&&(et.runtime=r)},e.prototype.registerHook=function(t){!function(e,t){var n=t.entity,r=t.target;if(!e.prototype.hasOwnProperty(r))throw new Error(JSON.stringify({code:Ye.INVALID_OPERATION,msg:"target:".concat(r," is not exist")}));var o=e.prototype[r];if("function"!=typeof o)throw new Error(JSON.stringify({code:Ye.INVALID_OPERATION,msg:"target:".concat(r," is not a function which is the only type supports hook")}));e.prototype[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.call.apply(n,ze([this],e,!1)),o.call.apply(o,ze([this],e,!1))}}(e,t)},e.prototype.registerComponent=function(t){Ze(e,t)},e.prototype.registerVersion=function(e){!function(e){lt=e}(e)},e.prototype.registerSdkName=function(e){!function(e){ft=e,ct(e)}(e)},e.prototype.registerEndPoint=function(e,t){yt(e,t)},e.prototype._useDefaultAdapter=function(){var e=Bt(),t=e.adapter,n=e.runtime;et.adapter=t,et.runtime=n},e.prototype._formatTimeout=function(e){switch(!0){case e>Kt:return Ht(Wt.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),Kt;case e<100:return Ht(Wt.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},Lt([$t({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv2/adapter.html#jie-ru-liu-cheng)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Ft)]}),Dt("design:type",Function),Dt("design:paramtypes",[Object]),Dt("design:returntype",e)],e.prototype,"init",null),Lt([$t({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Ft)]}),Dt("design:type",Function),Dt("design:paramtypes",[String,Object]),Dt("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}(),zt=new Jt;zt.useAdapters(Je);var Yt,Xt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Zt=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Qt=function(){function e(e){this._config=e,this._cache=e.cache,this._request=e.request}return e.prototype.checkLocalLoginState=function(){return Xt(this,void 0,void 0,(function(){var e,t,n,r,o,i;return Zt(this,(function(s){switch(s.label){case 0:return e=this._cache.keys,t=e.accessTokenKey,n=e.accessTokenExpireKey,[4,this._cache.getStoreAsync(t)];case 1:return r=s.sent(),[4,this._cache.getStoreAsync(n)];case 2:return o=s.sent(),r?o&&o>Date.now()?[4,(i=new jr({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()]:[3,4]:[3,7];case 3:return s.sent(),[2,i];case 4:return[4,this._cache.removeStoreAsync(t)];case 5:return s.sent(),[4,this._cache.removeStoreAsync(n)];case 6:s.sent(),s.label=7;case 7:return[2]}}))}))},e.prototype.setRefreshToken=function(e){return Xt(this,void 0,void 0,(function(){var t,n,r,o;return Zt(this,(function(i){switch(i.label){case 0:return t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,o=t.refreshTokenKey,[4,this._cache.removeStoreAsync(n)];case 1:return i.sent(),[4,this._cache.removeStoreAsync(r)];case 2:return i.sent(),[4,this._cache.setStoreAsync(o,e)];case 3:return i.sent(),[2]}}))}))},e.prototype.setAccessToken=function(e,t){return Xt(this,void 0,void 0,(function(){var n,r,o;return Zt(this,(function(i){switch(i.label){case 0:return n=this._cache.keys,r=n.accessTokenKey,o=n.accessTokenExpireKey,[4,this._cache.setStoreAsync(r,e)];case 1:return i.sent(),[4,this._cache.setStoreAsync(o,t)];case 2:return i.sent(),[2]}}))}))},e.prototype.refreshUserInfo=function(){return Xt(this,void 0,void 0,(function(){var e;return Zt(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.getUserInfo",{})];case 1:return e=t.sent().data,[4,this.setLocalUserInfo(e)];case 2:return t.sent(),[2,e]}}))}))},e.prototype.setLocalUserInfo=function(e){return Xt(this,void 0,void 0,(function(){var t;return Zt(this,(function(n){switch(n.label){case 0:return t=this._cache.keys.userInfoKey,[4,this._cache.setStoreAsync(t,e)];case 1:return n.sent(),[2]}}))}))},e}();!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL",e.PHONE="PHONE"}(Yt||(Yt={}));var en=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),tn=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},nn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},rn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},on=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},sn=Pe.getSdkName,an=Pe.ERRORS,cn=Pe.COMMUNITY_SITE_URL,un=Ce.RUNTIME,ln=Be.getQuery,fn=Be.getHash,hn=Be.removeParam,pn=Be.printWarn,dn=xe.catchErrorsDecorator,yn=function(e){function t(t,n,r,o){var i=e.call(this,t)||this;return i._runtime=t.runtime,i._appid=n,i._scope=r,i._state=o||"weixin",i}return en(t,e),t.prototype.signIn=function(){return rn(this,void 0,void 0,(function(){return on(this,(function(e){return[2,pn(an.OPERATION_FAIL,"API signIn has been deprecated, please use signInWithRedirect insteed")]}))}))},t.prototype.signInWithRedirect=function(){return rn(this,void 0,void 0,(function(){return on(this,(function(e){return[2,this._redirect()]}))}))},t.prototype.getRedirectResult=function(e){return rn(this,void 0,void 0,(function(){var t;return on(this,(function(n){return(t=gn())?[2,this._signInWithCode(t,e)]:[2,null]}))}))},t.prototype.getLinkRedirectResult=function(e){return void 0===e&&(e={}),rn(this,void 0,void 0,(function(){var t,n,r,o,i,s;return on(this,(function(a){return s=e.withUnionId,t=void 0!==s&&s,(n=gn())?(r=this._appid,c=this._scope,o="snsapi_login"===c?"WECHAT-OPEN":"WECHAT-PUBLIC",i=this._runtime===un.WX_MP?"1":"0",[2,this._request.send("auth.linkWithWeixinCode",{payload:{appid:r,loginType:o,code:n,hybridMiniapp:i,withUnionId:t}})]):[2,null];var c}))}))},t.prototype._redirect=function(){var e=hn("code",location.href);e=hn("state",e),e=encodeURIComponent(e);var t="//open.weixin.qq.com/connect/oauth2/authorize";"snsapi_login"===this._scope&&(t="//open.weixin.qq.com/connect/qrconnect");try{location.href="".concat(t,"?appid=").concat(this._appid,"&redirect_uri=").concat(e,"&response_type=code&scope=").concat(this._scope,"&state=").concat(this._state,"#wechat_redirect")}catch(e){throw new Error("[".concat(sn(),"][").concat(an.UNKOWN_ERROR,"]").concat(e))}},t.prototype._signInWithCode=function(e,t){return rn(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u;return on(this,(function(l){switch(l.label){case 0:return u=this._cache.keys,n=u.accessTokenKey,r=u.accessTokenExpireKey,o=u.refreshTokenKey,f=this._scope,i="snsapi_login"===f?"WECHAT-OPEN":"WECHAT-PUBLIC",[4,this._getRefreshTokenByWXCode(this._appid,i,e,t)];case 1:return s=l.sent(),a=s.refreshToken,[4,this._cache.setStoreAsync(o,a)];case 2:return l.sent(),s.accessToken?[4,this._cache.setStoreAsync(n,s.accessToken)]:[3,4];case 3:l.sent(),l.label=4;case 4:return s.accessTokenExpire?[4,this._cache.setStoreAsync(r,String(s.accessTokenExpire+Date.now()))]:[3,6];case 5:l.sent(),l.label=6;case 6:return Lr.fire(Mr.LOGIN_STATE_CHANGED),Lr.fire(Mr.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:Yt.WECHAT,persistence:this._config.persistence}),[4,this.refreshUserInfo()];case 7:return l.sent(),[4,(c=new jr({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 8:return l.sent(),[2,c]}var f}))}))},t.prototype._getRefreshTokenByWXCode=function(e,t,n,r){return void 0===r&&(r={}),rn(this,void 0,void 0,(function(){var o,i,s,a,c,u;return on(this,(function(l){return c=r.withUnionId,o=void 0!==c&&c,u=r.createUser,i=void 0===u||u,s="snsapi_base"!==this._scope&&(r.syncUserInfo||!1),a=this._runtime===un.WX_MP?"1":"0",[2,this._request.send("auth.signIn",{appid:e,loginType:t,hybridMiniapp:a,syncUserInfo:s,loginCredential:n,withUnionId:o,createUser:i}).then((function(e){if(e.code)throw new Error("[".concat(sn(),"][").concat(an.OPERATION_FAIL,"] failed login via wechat: ").concat(e.code));if(e.refresh_token)return{refreshToken:e.refresh_token,accessToken:e.access_token,accessTokenExpire:e.access_token_expire};throw new Error("[".concat(sn(),"][").concat(an.OPERATION_FAIL,"] action:getJwt not return refreshToken"))}))]}))}))},tn([dn({title:"跳转微信公众号授权失败",messages:["请确认以下各项:"," 1 - 调用 auth().weixinAuthProvider().signInWithRedirect() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(cn)]}),nn("design:type",Function),nn("design:paramtypes",[]),nn("design:returntype",Promise)],t.prototype,"signInWithRedirect",null),tn([dn({title:"微信公众号登录失败",messages:["请确认以下各项:"," 1 - 调用 auth().weixinAuthProvider().getRedirectResult() 的语法或参数是否正确"," 2 - 当前环境是否开通了微信公众号登录授权"," 3 - 微信公众号的 AppId 与 AppSecret 配置是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(cn)]}),nn("design:type",Function),nn("design:paramtypes",[Object]),nn("design:returntype",Promise)],t.prototype,"getRedirectResult",null),tn([dn({title:"获取微信重定向绑定结果",messages:["请确认以下各项:"," 1 - 调用 auth().weixinAuthProvider().getLinkRedirectResult() 的语法或参数是否正确"," 2 - 当前环境是否开通了微信公众号登录授权"," 3 - 微信公众号的 AppId 与 AppSecret 配置是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(cn)]}),nn("design:type",Function),nn("design:paramtypes",[Object]),nn("design:returntype",Promise)],t.prototype,"getLinkRedirectResult",null),t}(Qt);function gn(){return ln("code")||fn("code")}var vn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_n=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},mn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},bn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},wn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},En=Pe.ERRORS,Sn=Pe.COMMUNITY_SITE_URL,In=Be.throwError,On=Be.isString,An=Ue.addEventListener,Tn=xe.catchErrorsDecorator,Nn=function(e){function t(t){var n=e.call(this,t)||this;return n._onConverted=n._onConverted.bind(n),An(Mr.ANONYMOUS_CONVERTED,n._onConverted),n}return vn(t,e),t.prototype.signIn=function(){return bn(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return wn(this,(function(a){switch(a.label){case 0:return[4,this._cache.updatePersistenceAsync("local")];case 1:return a.sent(),s=this._cache.keys,e=s.anonymousUuidKey,t=s.refreshTokenKey,[4,this._cache.getStoreAsync(e)];case 2:return n=a.sent(),[4,this._cache.getStoreAsync(t)];case 3:return r=a.sent(),[4,this._request.send("auth.signInAnonymously",{anonymous_uuid:n,refresh_token:r})];case 4:return(o=a.sent()).uuid&&o.refresh_token?[4,this._setAnonymousUUID(o.uuid)]:[3,10];case 5:return a.sent(),[4,this.setRefreshToken(o.refresh_token)];case 6:return a.sent(),[4,this._request.refreshAccessToken()];case 7:return a.sent(),Lr.fire(Mr.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:Yt.ANONYMOUS,persistence:"local"}),Lr.fire(Mr.LOGIN_STATE_CHANGED),[4,(i=new jr({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 8:return a.sent(),[4,i.user.refresh()];case 9:return a.sent(),[2,i];case 10:throw new Error(JSON.stringify({code:En.OPERATION_FAIL,msg:JSON.stringify(o)||"anonymous signIn failed"}))}}))}))},t.prototype.linkAndRetrieveDataWithTicket=function(e){return bn(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return wn(this,(function(c){switch(c.label){case 0:return On(e)||In(En.INVALID_PARAMS,"ticket must be a string"),a=this._cache.keys,t=a.anonymousUuidKey,n=a.refreshTokenKey,[4,this._cache.getStoreAsync(t)];case 1:return r=c.sent(),[4,this._cache.getStoreAsync(n)];case 2:return o=c.sent(),[4,this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:r,refresh_token:o,ticket:e})];case 3:return(i=c.sent()).refresh_token?[4,this._clearAnonymousUUID()]:[3,8];case 4:return c.sent(),[4,this.setRefreshToken(i.refresh_token)];case 5:return c.sent(),[4,this._request.refreshAccessToken()];case 6:return c.sent(),Lr.fire(Mr.ANONYMOUS_CONVERTED,{env:this._config.env}),Lr.fire(Mr.LOGIN_TYPE_CHANGED,{loginType:Yt.CUSTOM,persistence:"local"}),[4,(s=new jr({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 7:return c.sent(),[2,s];case 8:return In(En.OPERATION_FAIL,JSON.stringify(i)||"linkAndRetrieveDataWithTicket failed"),[2]}}))}))},t.prototype._setAnonymousUUID=function(e){return bn(this,void 0,void 0,(function(){var t,n,r;return wn(this,(function(o){switch(o.label){case 0:return r=this._cache.keys,t=r.anonymousUuidKey,n=r.loginTypeKey,[4,this._cache.removeStoreAsync(t)];case 1:return o.sent(),[4,this._cache.setStoreAsync(t,e)];case 2:return o.sent(),[4,this._cache.setStoreAsync(n,Yt.ANONYMOUS)];case 3:return o.sent(),[2]}}))}))},t.prototype._clearAnonymousUUID=function(){return bn(this,void 0,void 0,(function(){return wn(this,(function(e){switch(e.label){case 0:return[4,this._cache.removeStoreAsync(this._cache.keys.anonymousUuidKey)];case 1:return e.sent(),[2]}}))}))},t.prototype._onConverted=function(e){return bn(this,void 0,void 0,(function(){return wn(this,(function(t){switch(t.label){case 0:return e.data.env!==this._config.env?[2]:[4,this._cache.updatePersistenceAsync(this._config.persistence)];case 1:return t.sent(),[2]}}))}))},_n([Tn({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().anonymouseProvider().signIn() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Sn)]}),mn("design:type",Function),mn("design:paramtypes",[]),mn("design:returntype",Promise)],t.prototype,"signIn",null),t}(Qt),xn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Rn=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},Pn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},kn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Cn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Ln=Pe.ERRORS,Dn=Pe.COMMUNITY_SITE_URL,jn=Be.isString,Un=xe.catchErrorsDecorator,Mn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return xn(t,e),t.prototype.signIn=function(e){return kn(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Cn(this,(function(c){switch(c.label){case 0:if(!jn(e))throw new Error(JSON.stringify({code:Ln.INVALID_PARAMS,msg:"ticket must be a string"}));return t=this._cache.keys.refreshTokenKey,o=(r=this._request).send,i=["auth.signInWithTicket"],a={ticket:e},[4,this._cache.getStoreAsync(t)];case 1:return[4,o.apply(r,i.concat([(a.refresh_token=c.sent()||"",a)]))];case 2:return(n=c.sent()).refresh_token?[4,this.setRefreshToken(n.refresh_token)]:[3,7];case 3:return c.sent(),[4,this._request.refreshAccessToken()];case 4:return c.sent(),Lr.fire(Mr.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:Yt.CUSTOM,persistence:this._config.persistence}),Lr.fire(Mr.LOGIN_STATE_CHANGED),[4,this.refreshUserInfo()];case 5:return c.sent(),[4,(s=new jr({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 6:return c.sent(),[2,s];case 7:throw new Error(JSON.stringify({code:Ln.OPERATION_FAIL,msg:"custom signIn failed"}))}}))}))},Rn([Un({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().customAuthProvider().signIn() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Dn)]}),Pn("design:type",Function),Pn("design:paramtypes",[String]),Pn("design:returntype",Promise)],t.prototype,"signIn",null),t}(Qt),Bn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qn=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},Wn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Fn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Hn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},$n=Be.throwError,Gn=Be.isString,Kn=Pe.ERRORS,Vn=Pe.COMMUNITY_SITE_URL,Jn=xe.catchErrorsDecorator,zn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Bn(t,e),t.prototype.signIn=function(e,t){return Fn(this,void 0,void 0,(function(){var n,r,o,i,s;return Hn(this,(function(a){switch(a.label){case 0:return Gn(e)||$n(Kn.INVALID_PARAMS,"email must be a string"),n=this._cache.keys.refreshTokenKey,[4,this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(n)||""})];case 1:return r=a.sent(),o=r.refresh_token,i=r.access_token,s=r.access_token_expire,o?[4,this.setRefreshToken(o)]:[3,8];case 2:return a.sent(),i&&s?[4,this.setAccessToken(i,s)]:[3,4];case 3:return a.sent(),[3,6];case 4:return[4,this._request.refreshAccessToken()];case 5:a.sent(),a.label=6;case 6:return[4,this.refreshUserInfo()];case 7:return a.sent(),Lr.fire(Mr.LOGIN_STATE_CHANGED),Lr.fire(Mr.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:Yt.EMAIL,persistence:this._config.persistence}),[2,new jr({envId:this._config.env,cache:this._cache,request:this._request})];case 8:return r.code?$n(Kn.OPERATION_FAIL,"Email login fail[".concat(r.code,"] ").concat(r.message)):$n(Kn.OPERATION_FAIL,"Email login fail"),[2]}}))}))},t.prototype.signUp=function(e,t){return Fn(this,void 0,void 0,(function(){return Hn(this,(function(n){return[2,this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})]}))}))},t.prototype.resetPassword=function(e){return Fn(this,void 0,void 0,(function(){return Hn(this,(function(t){return[2,this._request.send("auth.sendPasswordResetEmail",{email:e})]}))}))},t.prototype.resetPasswordWithToken=function(e,t){return Fn(this,void 0,void 0,(function(){return Hn(this,(function(n){return[2,this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})]}))}))},t.prototype.activate=function(e){return Fn(this,void 0,void 0,(function(){return Hn(this,(function(t){return[2,this._request.send("auth.activateEndUserMail",{token:e})]}))}))},qn([Jn({title:"邮箱密码登录失败",messages:["请确认以下各项:"," 1 - 调用 auth().emailAuthProvider() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录"," 3 - 邮箱地址与密码是否匹配","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Vn)]}),Wn("design:type",Function),Wn("design:paramtypes",[String,String]),Wn("design:returntype",Promise)],t.prototype,"signIn",null),qn([Jn({title:"邮箱注册失败",messages:["请确认以下各项:"," 1 - 调用 auth().signUpWithEmailAndPassword() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录"," 3 - 此邮箱地址是否已经被其他用户占用","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Vn)]}),Wn("design:type",Function),Wn("design:paramtypes",[String,String]),Wn("design:returntype",Promise)],t.prototype,"signUp",null),qn([Jn({title:"重置密码失败",messages:["请确认以下各项:"," 1 - 调用 auth().sendPasswordResetEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录"," 3 - 此邮箱地址是否已经与当前用户绑定"," 4 - 此邮箱地址是否已经被其他用户占用","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Vn)]}),Wn("design:type",Function),Wn("design:paramtypes",[String]),Wn("design:returntype",Promise)],t.prototype,"resetPassword",null),qn([Jn({title:"重置密码失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Vn)]}),Wn("design:type",Function),Wn("design:paramtypes",[String,String]),Wn("design:returntype",Promise)],t.prototype,"resetPasswordWithToken",null),qn([Jn({title:"邮箱激活失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Vn)]}),Wn("design:type",Function),Wn("design:paramtypes",[String]),Wn("design:returntype",Promise)],t.prototype,"activate",null),t}(Qt),Yn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Xn=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},Zn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Qn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},er=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},tr=Be.printWarn,nr=Pe.ERRORS,rr=Pe.COMMUNITY_SITE_URL,or=xe.catchErrorsDecorator,ir=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Yn(t,e),t.prototype.signIn=function(e,t){return Qn(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u,l;return er(this,(function(f){switch(f.label){case 0:if("string"!=typeof e)throw new Error(JSON.stringify({code:nr.INVALID_PARAMS,msg:"username must be a string"}));return"string"!=typeof t&&(t="",tr(nr.INVALID_PARAMS,"password is empty")),n=this._cache.keys.refreshTokenKey,i=(o=this._request).send,s=["auth.signIn"],l={loginType:Yt.USERNAME,username:e,password:t},[4,this._cache.getStoreAsync(n)];case 1:return[4,i.apply(o,s.concat([(l.refresh_token=f.sent()||"",l)]))];case 2:return r=f.sent(),a=r.refresh_token,c=r.access_token_expire,u=r.access_token,a?[4,this.setRefreshToken(a)]:[3,9];case 3:return f.sent(),u&&c?[4,this.setAccessToken(u,c)]:[3,5];case 4:return f.sent(),[3,7];case 5:return[4,this._request.refreshAccessToken()];case 6:f.sent(),f.label=7;case 7:return[4,this.refreshUserInfo()];case 8:return f.sent(),Lr.fire(Mr.LOGIN_STATE_CHANGED),Lr.fire(Mr.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:Yt.USERNAME,persistence:this._config.persistence}),[2,new jr({envId:this._config.env,cache:this._cache,request:this._request})];case 9:throw r.code?new Error(JSON.stringify({code:nr.OPERATION_FAIL,msg:"login by username failed:[".concat(r.code,"] ").concat(r.message)})):new Error(JSON.stringify({code:nr.OPERATION_FAIL,msg:"login by username failed"}))}}))}))},Xn([or({title:"用户名密码登录失败",messages:["请确认以下各项:"," 1 - 调用 auth().signInWithUsernameAndPassword() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录"," 3 - 用户名密码是否匹配","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(rr)]}),Zn("design:type",Function),Zn("design:paramtypes",[String,String]),Zn("design:returntype",Promise)],t.prototype,"signIn",null),t}(Qt),sr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ar=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},cr=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ur=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},lr=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},fr=Be.throwError,hr=Be.isString,pr=Be.transformPhone,dr=Pe.ERRORS,yr=Pe.COMMUNITY_SITE_URL,gr=xe.catchErrorsDecorator,vr="SIGNIN",_r="SIGNUP",mr="FORCERESETPWD",br=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return sr(t,e),t.prototype.signIn=function(e){return ur(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,c,u;return lr(this,(function(l){switch(l.label){case 0:return t=e.phoneNumber,n=e.phoneCode,r=e.password,o=e.signMethod,hr(t)||fr(dr.INVALID_PARAMS,"phoneNumber must be a string"),hr(n)||hr(r)||fr(dr.INVALID_PARAMS,"phoneCode or password must be a string"),o||(o=vr),i=this._cache.keys.refreshTokenKey,[4,this._request.send("auth.signIn",{loginType:Yt.PHONE,phoneNumber:pr(t),phoneCode:n,password:r,refresh_token:this._cache.getStore(i)||"",signMethod:o})];case 1:return s=l.sent(),a=s.refresh_token,c=s.access_token,u=s.access_token_expire,a?[4,this.setRefreshToken(a)]:[3,8];case 2:return l.sent(),c&&u?[4,this.setAccessToken(c,u)]:[3,4];case 3:return l.sent(),[3,6];case 4:return[4,this._request.refreshAccessToken()];case 5:l.sent(),l.label=6;case 6:return[4,this.refreshUserInfo()];case 7:return l.sent(),Lr.fire(Mr.LOGIN_STATE_CHANGED),Lr.fire(Mr.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:Yt.PHONE,persistence:this._config.persistence}),[2,new jr({envId:this._config.env,cache:this._cache,request:this._request})];case 8:return s.code?fr(dr.OPERATION_FAIL,"Phone login fail[".concat(s.code,"] ").concat(s.message)):fr(dr.OPERATION_FAIL,"Phone login fail"),[2]}}))}))},t.prototype.signUp=function(e,t,n){return ur(this,void 0,void 0,(function(){return lr(this,(function(r){return[2,this.signIn({phoneNumber:e,phoneCode:t,password:n,signMethod:_r})]}))}))},t.prototype.forceResetPwd=function(e,t,n){return ur(this,void 0,void 0,(function(){return lr(this,(function(r){return[2,this.signIn({phoneNumber:e,phoneCode:t,password:n,signMethod:mr})]}))}))},ar([gr({title:"手机号登录失败",messages:["请确认以下各项:"," 1 - 调用 auth().SmsAuthProvider() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录"," 3 - 短信验证码/密码是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(yr)]}),cr("design:type",Function),cr("design:paramtypes",[Object]),cr("design:returntype",Promise)],t.prototype,"signIn",null),ar([gr({title:"手机短信注册失败",messages:["请确认以下各项:"," 1 - 调用 auth().signUpWithPhoneCode() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(yr)]}),cr("design:type",Function),cr("design:paramtypes",[String,String,String]),cr("design:returntype",Promise)],t.prototype,"signUp",null),ar([gr({title:"手机密码重置失败",messages:["请确认以下各项:"," 1 - 调用 auth().forceResetPwd() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(yr)]}),cr("design:type",Function),cr("design:paramtypes",[String,String,String]),cr("design:returntype",Promise)],t.prototype,"forceResetPwd",null),t}(Qt),wr=function(){return wr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},wr.apply(this,arguments)},Er=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},Sr=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Ir=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Or=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Ar=Ue.CloudbaseEventEmitter,Tr=Ce.RUNTIME,Nr=Be.printWarn,xr=Be.throwError,Rr=Be.transformPhone,Pr=Pe.ERRORS,kr=Pe.COMMUNITY_SITE_URL,Cr=xe.catchErrorsDecorator,Lr=new Ar,Dr=function(){function e(e){var t=e.cache,n=e.request;this._cache=t,this._request=n,this._setUserInfo()}return e.prototype.checkLocalInfo=function(){return Ir(this,void 0,void 0,(function(){return Or(this,(function(e){return this.uid=this._getLocalUserInfo("uid"),this.loginType=this._getLocalUserInfo("loginType"),this.openid=this._getLocalUserInfo("wxOpenId"),this.wxOpenId=this._getLocalUserInfo("wxOpenId"),this.wxPublicId=this._getLocalUserInfo("wxPublicId"),this.unionId=this._getLocalUserInfo("wxUnionId"),this.qqMiniOpenId=this._getLocalUserInfo("qqMiniOpenId"),this.customUserId=this._getLocalUserInfo("customUserId"),this.nickName=this._getLocalUserInfo("nickName"),this.gender=this._getLocalUserInfo("gender"),this.avatarUrl=this._getLocalUserInfo("avatarUrl"),this.email=this._getLocalUserInfo("email"),this.hasPassword=Boolean(this._getLocalUserInfo("hasPassword")),this.phone=this._getLocalUserInfo("phone"),this.username=this._getLocalUserInfo("username"),this.location={country:this._getLocalUserInfo("country"),province:this._getLocalUserInfo("province"),city:this._getLocalUserInfo("city")},[2]}))}))},e.prototype.checkLocalInfoAsync=function(){return Ir(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a,c,u,l,f,h,p,d,y,g,v;return Or(this,(function(_){switch(_.label){case 0:return e=this,[4,this._getLocalUserInfoAsync("uid")];case 1:return e.uid=_.sent(),t=this,[4,this._getLocalUserInfoAsync("loginType")];case 2:return t.loginType=_.sent(),n=this,[4,this._getLocalUserInfoAsync("wxOpenId")];case 3:return n.openid=_.sent(),r=this,[4,this._getLocalUserInfoAsync("wxOpenId")];case 4:return r.wxOpenId=_.sent(),o=this,[4,this._getLocalUserInfoAsync("wxPublicId")];case 5:return o.wxPublicId=_.sent(),i=this,[4,this._getLocalUserInfoAsync("wxUnionId")];case 6:return i.unionId=_.sent(),s=this,[4,this._getLocalUserInfoAsync("qqMiniOpenId")];case 7:return s.qqMiniOpenId=_.sent(),a=this,[4,this._getLocalUserInfoAsync("customUserId")];case 8:return a.customUserId=_.sent(),c=this,[4,this._getLocalUserInfoAsync("nickName")];case 9:return c.nickName=_.sent(),u=this,[4,this._getLocalUserInfoAsync("gender")];case 10:return u.gender=_.sent(),l=this,[4,this._getLocalUserInfoAsync("avatarUrl")];case 11:return l.avatarUrl=_.sent(),f=this,[4,this._getLocalUserInfoAsync("email")];case 12:return f.email=_.sent(),h=this,p=Boolean,[4,this._getLocalUserInfoAsync("hasPassword")];case 13:return h.hasPassword=p.apply(void 0,[_.sent()]),d=this,[4,this._getLocalUserInfoAsync("phone")];case 14:return d.phone=_.sent(),y=this,[4,this._getLocalUserInfoAsync("username")];case 15:return y.username=_.sent(),g=this,v={},[4,this._getLocalUserInfoAsync("country")];case 16:return v.country=_.sent(),[4,this._getLocalUserInfoAsync("province")];case 17:return v.province=_.sent(),[4,this._getLocalUserInfoAsync("city")];case 18:return g.location=(v.city=_.sent(),v),[2]}}))}))},e.prototype.linkWithTicket=function(e){if("string"!=typeof e)throw new Error("ticket must be string");return this._request.send("auth.linkWithTicket",{ticket:e})},e.prototype.linkWithRedirect=function(e){e.signInWithRedirect()},e.prototype.getLinkedUidList=function(){return Ir(this,void 0,void 0,(function(){var e,t,n,r,o,i;return Or(this,(function(s){switch(s.label){case 0:return[4,this._request.send("auth.getLinkedUidList",{})];case 1:for(e=s.sent().data,t=!1,n=e.users,r=0,o=n;r<o.length;r++)if((i=o[r]).wxOpenId&&i.wxPublicId){t=!0;break}return[2,{users:n,hasPrimaryUid:t}]}}))}))},e.prototype.setPrimaryUid=function(e){return this._request.send("auth.setPrimaryUid",{uid:e})},e.prototype.unlink=function(e){return this._request.send("auth.unlink",{platform:e})},e.prototype.update=function(e){return Ir(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return Or(this,(function(c){switch(c.label){case 0:return t=e.nickName,n=e.gender,r=e.avatarUrl,o=e.province,i=e.country,s=e.city,[4,this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:r,province:o,country:i,city:s})];case 1:return a=c.sent().data,this._setLocalUserInfo(a),[2]}}))}))},e.prototype.updatePassword=function(e,t){return this._request.send("auth.updatePassword",{oldPassword:t,newPassword:e})},e.prototype.updateEmail=function(e,t){return this._request.send("auth.updateEmail",{newEmail:e,password:t})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&xr(Pr.INVALID_PARAMS,"username must be a string"),this._request.send("auth.updateUsername",{username:e})},e.prototype.refresh=function(){return Ir(this,void 0,void 0,(function(){var e;return Or(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.getUserInfo",{})];case 1:return e=t.sent().data,this._setLocalUserInfo(e),[2,e]}}))}))},e.prototype.linkWithPhoneNumber=function(e,t){return Ir(this,void 0,void 0,(function(){return Or(this,(function(n){return[2,this._request.send("auth.linkOrUpdatePhoneNumber",{phoneNumber:Rr(e),phoneCode:t})]}))}))},e.prototype.updatePhoneNumber=function(e,t){return Ir(this,void 0,void 0,(function(){return Or(this,(function(n){return[2,this._request.send("auth.linkOrUpdatePhoneNumber",{phoneNumber:Rr(e),phoneCode:t})]}))}))},e.prototype._getLocalUserInfo=function(e){var t=this._cache.keys.userInfoKey;return this._cache.getStore(t)[e]},e.prototype._getLocalUserInfoAsync=function(e){return Ir(this,void 0,void 0,(function(){var t;return Or(this,(function(n){switch(n.label){case 0:return t=this._cache.keys.userInfoKey,[4,this._cache.getStoreAsync(t)];case 1:return[2,n.sent()[e]]}}))}))},e.prototype._setUserInfo=function(){var e=this,t=this._cache.keys.userInfoKey,n=this._cache.getStore(t);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl","phone","username"].forEach((function(t){e[t]=n[t]})),this.location={country:n.country,province:n.province,city:n.city}},e.prototype._setLocalUserInfo=function(e){var t=this._cache.keys.userInfoKey;this._cache.setStore(t,e),this._setUserInfo()},Er([Cr({title:"绑定自定义登录失败",messages:["请确认以下各项:"," 1 - 调用 User.linkWithTicket() 的语法或参数是否正确"," 2 - 此账户是否已经绑定自定义登录"," 3 - ticket 参数是否归属当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String]),Sr("design:returntype",Promise)],e.prototype,"linkWithTicket",null),Er([Cr({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 User.linkWithRedirect() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方"," 3 - 此第三方是否已经授权","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[Object]),Sr("design:returntype",void 0)],e.prototype,"linkWithRedirect",null),Er([Cr({title:"获取账户列表失败",messages:["请确认以下各项:"," 1 - 调用 User.getLinkedUidList() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[]),Sr("design:returntype",Promise)],e.prototype,"getLinkedUidList",null),Er([Cr({title:"设置微信主账号失败",messages:["请确认以下各项:"," 1 - 调用 User.setPrimaryUid() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String]),Sr("design:returntype",void 0)],e.prototype,"setPrimaryUid",null),Er([Cr({title:"接触绑定失败",messages:["请确认以下各项:"," 1 - 调用 User.unlink() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String]),Sr("design:returntype",void 0)],e.prototype,"unlink",null),Er([Cr({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[Object]),Sr("design:returntype",Promise)],e.prototype,"update",null),Er([Cr({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String,String]),Sr("design:returntype",void 0)],e.prototype,"updatePassword",null),Er([Cr({title:"更新邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 User.updateEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String,String]),Sr("design:returntype",void 0)],e.prototype,"updateEmail",null),Er([Cr({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String]),Sr("design:returntype",void 0)],e.prototype,"updateUsername",null),Er([Cr({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[]),Sr("design:returntype",Promise)],e.prototype,"refresh",null),Er([Cr({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().linkWithPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String,String]),Sr("design:returntype",Promise)],e.prototype,"linkWithPhoneNumber",null),Er([Cr({title:"更新手机号失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String,String]),Sr("design:returntype",Promise)],e.prototype,"updatePhoneNumber",null),e}(),jr=function(){function e(e){var t=e.envId,n=e.cache,r=e.request;t||xr(Pr.INVALID_PARAMS,"envId is not defined"),this._cache=n,this.user=new Dr({cache:n,request:r})}return e.prototype.checkLocalState=function(){return Ir(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Or(this,(function(a){return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,o=this._cache.getStore(t),i=this._cache.getStore(n),s=this._cache.getStore(r),this.credential={refreshToken:o,accessToken:i,accessTokenExpire:s},this._loginType=this._cache.getStore(this._cache.keys.loginTypeKey),this.user.checkLocalInfo(),[2]}))}))},e.prototype.checkLocalStateAsync=function(){return Ir(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a;return Or(this,(function(c){switch(c.label){case 0:return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,[4,this._cache.getStoreAsync(t)];case 1:return o=c.sent(),[4,this._cache.getStoreAsync(n)];case 2:return i=c.sent(),[4,this._cache.getStoreAsync(r)];case 3:return s=c.sent(),this.credential={refreshToken:o,accessToken:i,accessTokenExpire:s},a=this,[4,this._cache.getStoreAsync(this._cache.keys.loginTypeKey)];case 4:return a._loginType=c.sent(),[4,this.user.checkLocalInfoAsync()];case 5:return c.sent(),[2]}}))}))},Object.defineProperty(e.prototype,"isAnonymousAuth",{get:function(){return this.loginType===Yt.ANONYMOUS},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCustomAuth",{get:function(){return this.loginType===Yt.CUSTOM},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isWeixinAuth",{get:function(){return this.loginType===Yt.WECHAT||this.loginType===Yt.WECHAT_OPEN||this.loginType===Yt.WECHAT_PUBLIC},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsernameAuth",{get:function(){return this.loginType===Yt.USERNAME},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginType",{get:function(){return this._loginType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPhoneAuth",{get:function(){return this.loginType===Yt.PHONE},enumerable:!1,configurable:!0}),e}(),Ur=function(){function e(e){this._config=e,this._cache=e.cache,this._request=e.request,this._runtime=e.runtime||Tr.WEB,Lr.on(Mr.LOGIN_TYPE_CHANGED,this._onLoginTypeChanged.bind(this))}return Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this._cache.mode){var e=this.hasLoginState();return e&&e.user||null}Nr(Pr.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginType",{get:function(){return this._cache.getStore(this._cache.keys.loginTypeKey)},enumerable:!1,configurable:!0}),e.prototype.getCurrenUser=function(){return Ir(this,void 0,void 0,(function(){return Or(this,(function(e){switch(e.label){case 0:return[4,this.getCurrentUser()];case 1:return[2,e.sent()]}}))}))},e.prototype.getCurrentUser=function(){return Ir(this,void 0,void 0,(function(){var e;return Or(this,(function(t){switch(t.label){case 0:return[4,this.getLoginState()];case 1:return(e=t.sent())?[4,e.user.checkLocalInfoAsync()]:[3,3];case 2:return t.sent(),[2,e.user||null];case 3:return[2,null]}}))}))},e.prototype.getLoginType=function(){return Ir(this,void 0,void 0,(function(){return Or(this,(function(e){switch(e.label){case 0:return[4,this._cache.getStoreAsync(this._cache.keys.loginTypeKey)];case 1:return[2,e.sent()]}}))}))},e.prototype.getAccessToken=function(){return Ir(this,void 0,void 0,(function(){var e;return Or(this,(function(t){switch(t.label){case 0:return e={},[4,this._request.getAccessToken()];case 1:return[2,(e.accessToken=t.sent().accessToken,e.env=this._config.env,e)]}}))}))},e.prototype.weixinAuthProvider=function(e){var t=e.appid,n=e.scope,r=e.state;return this._weixinAuthProvider||(this._weixinAuthProvider=new yn(wr(wr({},this._config),{cache:this._cache,request:this._request,runtime:this._runtime}),t,n,r)),this._weixinAuthProvider},e.prototype.anonymousAuthProvider=function(){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new Nn(wr(wr({},this._config),{cache:this._cache,request:this._request}))),this._anonymousAuthProvider},e.prototype.customAuthProvider=function(){return this._customAuthProvider||(this._customAuthProvider=new Mn(wr(wr({},this._config),{cache:this._cache,request:this._request}))),this._customAuthProvider},e.prototype.emailAuthProvider=function(){return this._emailAuthProvider||(this._emailAuthProvider=new zn(wr(wr({},this._config),{cache:this._cache,request:this._request}))),this._emailAuthProvider},e.prototype.usernameAuthProvider=function(){return this._usernameAuthProvider||(this._usernameAuthProvider=new ir(wr(wr({},this._config),{cache:this._cache,request:this._request}))),this._usernameAuthProvider},e.prototype.phoneAuthProvider=function(){return this._phoneAuthProvider||(this._phoneAuthProvider=new br(wr(wr({},this._config),{cache:this._cache,request:this._request}))),this._phoneAuthProvider},e.prototype.signInWithUsernameAndPassword=function(e,t){return Ir(this,void 0,void 0,(function(){return Or(this,(function(n){return[2,this.usernameAuthProvider().signIn(e,t)]}))}))},e.prototype.isUsernameRegistered=function(e){return Ir(this,void 0,void 0,(function(){var t;return Or(this,(function(n){switch(n.label){case 0:return"string"!=typeof e&&xr(Pr.INVALID_PARAMS,"username must be a string"),[4,this._request.send("auth.isUsernameRegistered",{username:e})];case 1:return[2,null==(t=n.sent().data)?void 0:t.isRegistered]}}))}))},e.prototype.signInWithEmailAndPassword=function(e,t){return Ir(this,void 0,void 0,(function(){return Or(this,(function(n){return[2,this.emailAuthProvider().signIn(e,t)]}))}))},e.prototype.signUpWithEmailAndPassword=function(e,t){return Ir(this,void 0,void 0,(function(){return Or(this,(function(n){return[2,this.emailAuthProvider().signUp(e,t)]}))}))},e.prototype.sendPasswordResetEmail=function(e){return Ir(this,void 0,void 0,(function(){return Or(this,(function(t){return[2,this.emailAuthProvider().resetPassword(e)]}))}))},e.prototype.signOut=function(){return Ir(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Or(this,(function(a){switch(a.label){case 0:return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,o="auth.logout",[4,this._cache.getStoreAsync(t)];case 1:return(i=a.sent())?[4,this._request.send(o,{refresh_token:i})]:[2];case 2:return s=a.sent(),this._cache.removeStoreAsync(t),this._cache.removeStoreAsync(n),this._cache.removeStoreAsync(r),Lr.fire(Mr.LOGIN_STATE_CHANGED),Lr.fire(Mr.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:Yt.NULL,persistence:this._config.persistence}),[2,s]}}))}))},e.prototype.onLoginStateChanged=function(e){return Ir(this,void 0,void 0,(function(){var t,n=this;return Or(this,(function(r){switch(r.label){case 0:return Lr.on(Mr.LOGIN_STATE_CHANGED,(function(){return Ir(n,void 0,void 0,(function(){var t;return Or(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))})),[4,this.getLoginState()];case 1:return t=r.sent(),e.call(this,t),[2]}}))}))},e.prototype.onLoginStateExpired=function(e){Lr.on(Mr.LOGIN_STATE_EXPIRED,e.bind(this))},e.prototype.onAccessTokenRefreshed=function(e){Lr.on(Mr.ACCESS_TOKEN_REFRESHD,e.bind(this))},e.prototype.onAnonymousConverted=function(e){Lr.on(Mr.ANONYMOUS_CONVERTED,e.bind(this))},e.prototype.onLoginTypeChanged=function(e){var t=this;Lr.on(Mr.LOGIN_TYPE_CHANGED,(function(){return Ir(t,void 0,void 0,(function(){var t;return Or(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))}))},e.prototype.hasLoginState=function(){if("async"!==this._cache.mode){var e=this._cache.keys.refreshTokenKey;if(this._cache.getStore(e)){var t=new jr({envId:this._config.env,cache:this._cache,request:this._request});return t.checkLocalState(),t}return null}Nr(Pr.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return Ir(this,void 0,void 0,(function(){var e,t;return Or(this,(function(n){switch(n.label){case 0:return e=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(e)];case 1:return n.sent()?[4,(t=new jr({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()]:[3,3];case 2:return n.sent(),[2,t];case 3:return[2,null]}}))}))},e.prototype.shouldRefreshAccessToken=function(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)},e.prototype.getUserInfo=function(){return Ir(this,void 0,void 0,(function(){var e;return Or(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.getUserInfo",{})];case 1:return(e=t.sent()).code?[2,e]:[2,wr(wr({},e.data),{requestId:e.seqId})]}}))}))},e.prototype.getAuthHeader=function(){var e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=this._cache.getStore(t),o=this._cache.getStore(n);return{"x-cloudbase-credentials":"".concat(o,"/@@/").concat(r)}},e.prototype.getAuthHeaderAsync=function(){return Ir(this,void 0,void 0,(function(){var e,t,n,r,o;return Or(this,(function(i){switch(i.label){case 0:return[4,this._request.refreshAccessToken()];case 1:return i.sent(),e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,[4,this._cache.getStoreAsync(t)];case 2:return r=i.sent(),[4,this._cache.getStoreAsync(n)];case 3:return o=i.sent(),[2,{"x-cloudbase-credentials":"".concat(o,"/@@/").concat(r)}]}}))}))},e.prototype.sendPhoneCode=function(e){return Ir(this,void 0,void 0,(function(){return Or(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.sendPhoneCode",{phoneNumber:Rr(e)})];case 1:return[2,"Ok"===t.sent().data.SendStatus]}}))}))},e.prototype.signUpWithPhoneCode=function(e,t,n){return Ir(this,void 0,void 0,(function(){return Or(this,(function(r){return[2,this.phoneAuthProvider().signUp(e,t,n)]}))}))},e.prototype.signInWithPhoneCodeOrPassword=function(e){return Ir(this,void 0,void 0,(function(){return Or(this,(function(t){return[2,this.phoneAuthProvider().signIn(e)]}))}))},e.prototype.forceResetPwdByPhoneCode=function(e){return Ir(this,void 0,void 0,(function(){return Or(this,(function(t){return[2,this.phoneAuthProvider().signIn(wr(wr({},e),{signMethod:mr}))]}))}))},e.prototype._onLoginTypeChanged=function(e){return Ir(this,void 0,void 0,(function(){var t,n,r;return Or(this,(function(o){switch(o.label){case 0:return t=e.data,n=t.loginType,r=t.persistence,t.env!==this._config.env?[2]:[4,this._cache.updatePersistenceAsync(r)];case 1:return o.sent(),[4,this._cache.setStoreAsync(this._cache.keys.loginTypeKey,n)];case 2:return o.sent(),[2]}}))}))},Er([Cr({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrenUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[]),Sr("design:returntype",Promise)],e.prototype,"getCurrenUser",null),Er([Cr({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[]),Sr("design:returntype",Promise)],e.prototype,"getCurrentUser",null),Er([Cr({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String]),Sr("design:returntype",Promise)],e.prototype,"isUsernameRegistered",null),Er([Cr({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[]),Sr("design:returntype",Promise)],e.prototype,"signOut",null),Er([Cr({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[]),Sr("design:returntype",Promise)],e.prototype,"getLoginState",null),Er([Cr({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[]),Sr("design:returntype",Promise)],e.prototype,"getUserInfo",null),Er([Cr({title:"发送短信验证码失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(kr)]}),Sr("design:type",Function),Sr("design:paramtypes",[String]),Sr("design:returntype",Promise)],e.prototype,"sendPhoneCode",null),e}(),Mr={LOGIN_STATE_CHANGED:"loginStateChanged",LOGIN_STATE_EXPIRED:"loginStateExpire",LOGIN_TYPE_CHANGED:"loginTypeChanged",ANONYMOUS_CONVERTED:"anonymousConverted",ACCESS_TOKEN_REFRESHD:"refreshAccessToken"},Br={name:"auth",namespace:"auth",injectEvents:{bus:Lr,events:[Mr.LOGIN_TYPE_CHANGED,Mr.LOGIN_STATE_EXPIRED,Mr.LOGIN_STATE_CHANGED,Mr.ACCESS_TOKEN_REFRESHD,Mr.ANONYMOUS_CONVERTED]},entity:function(e){if(void 0===e&&(e={region:"",persistence:"local"}),this.authInstance)return Nr(Pr.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var t=this.platform,n=t.adapter,r=t.runtime,o=e.persistence||n.primaryStorage;o&&o!==this.config.persistence&&this.updateConfig({persistence:o});var i=this.config,s=i.env,a=i.persistence,c=i.debug;return this.authInstance=new Ur({env:s,region:e.region,persistence:a,debug:c,cache:this.cache,request:this.request,runtime:r}),this.authInstance}};try{cloudbase.registerComponent(Br)}catch(e){}var qr=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},Wr=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Fr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Hr=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},$r=Pe.getSdkName,Gr=Pe.ERRORS,Kr=Pe.COMMUNITY_SITE_URL,Vr=Be.execCallback,Jr=xe.catchErrorsDecorator,zr="functions",Yr=function(){function e(){}return e.prototype.callFunction=function(e,t){return Fr(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u,l,f,h,p;return Hr(this,(function(d){switch(d.label){case 0:if(n=e.name,r=e.data,o=e.query,i=e.parse,s=e.search,!n)throw new Error(JSON.stringify({code:Gr.INVALID_PARAMS,msg:"[".concat(zr,".callFunction] invalid function name")}));try{a=r?JSON.stringify(r):""}catch(e){throw new Error(JSON.stringify({code:Gr.INVALID_PARAMS,msg:"[".concat(zr,".callFunction] invalid data")}))}c="functions.invokeFunction",u={inQuery:o,parse:i,search:s,function_name:n,request_data:a},l=this.request,d.label=1;case 1:return d.trys.push([1,3,,4]),[4,l.send(c,u)];case 2:if((f=d.sent()).code)return[2,Vr(t,null,f)];if(h=f.data.response_data,i)return[2,Vr(t,null,{result:h,requestId:f.requestId})];try{return h=JSON.parse(f.data.response_data),[2,Vr(t,null,{result:h,requestId:f.requestId})]}catch(e){Vr(t,new Error("[".concat($r(),"][").concat(Gr.INVALID_PARAMS,"][").concat(zr,".callFunction] response data must be json")))}return[3,4];case 3:return p=d.sent(),Vr(t,p),[3,4];case 4:return[2]}}))}))},qr([Jr({customInfo:{className:"Cloudbase",methodName:"callFunction"},title:"函数调用失败",messages:["请确认以下各项:"," 1 - 调用 callFunction() 的语法或参数是否正确"," 2 - 当前环境下是否存在此函数"," 3 - 函数安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Kr)]}),Wr("design:type",Function),Wr("design:paramtypes",[Object,Function]),Wr("design:returntype",Promise)],e.prototype,"callFunction",null),e}(),Xr=new Yr,Zr={name:zr,entity:{callFunction:Xr.callFunction}};try{cloudbase.registerComponent(Zr)}catch(e){}var Qr=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},eo=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},to=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},no=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},ro=Pe.getSdkName,oo=Pe.ERRORS,io=Pe.COMMUNITY_SITE_URL,so=Be.isArray,ao=Be.isString,co=Be.isPalinObject,uo=Be.execCallback,lo=xe.catchErrorsDecorator,fo="storage",ho=function(){function e(){}return e.prototype.uploadFile=function(e,t){return to(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u,l,f,h,p,d,y,g;return no(this,(function(v){switch(v.label){case 0:if(n=e.cloudPath,r=e.filePath,o=e.onUploadProgress,!ao(n)||!r)throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"[".concat(fo,".uploadFile] invalid params")}));return[4,(i=this.request).send("storage.getUploadMetadata",{path:n})];case 1:return s=v.sent(),a=s.data,c=a.url,u=a.authorization,l=a.token,f=a.fileId,h=a.cosFileId,p=a.download_url,d=s.requestId,y={key:n,signature:u,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":l},[4,i.upload({url:c,data:y,file:r,name:n,onUploadProgress:o})];case 2:return 201===(g=v.sent()).statusCode?[2,uo(t,null,{fileID:f,download_url:p,requestId:d})]:[2,uo(t,new Error("[".concat(ro(),"][").concat(oo.OPERATION_FAIL,"][").concat(fo,"]:").concat(g.data)))]}}))}))},e.prototype.getUploadMetadata=function(e,t){return to(this,void 0,void 0,(function(){var n,r,o,i,s;return no(this,(function(a){switch(a.label){case 0:if(n=e.cloudPath,!ao(n))throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"[".concat(fo,".getUploadMetadata] invalid cloudPath")}));r=this.request,o="storage.getUploadMetadata",a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.send(o,{path:n})];case 2:return i=a.sent(),[2,uo(t,null,i)];case 3:return s=a.sent(),[2,uo(t,s)];case 4:return[2]}}))}))},e.prototype.deleteFile=function(e,t){return to(this,void 0,void 0,(function(){var n,r,o,i,s,a;return no(this,(function(c){switch(c.label){case 0:if(!(n=e.fileList)||!so(n)||0===n.length)throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"[".concat(fo,".deleteFile] fileList must not be empty")}));for(r=0,o=n;r<o.length;r++)if(!(i=o[r])||!ao(i))throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"[".concat(fo,".deleteFile] fileID must be string")}));return[4,this.request.send("storage.batchDeleteFile",{fileid_list:n})];case 1:return(s=c.sent()).code?[2,uo(t,null,s)]:(a={fileList:s.data.delete_list,requestId:s.requestId},[2,uo(t,null,a)])}}))}))},e.prototype.getTempFileURL=function(e,t){return to(this,void 0,void 0,(function(){var n,r,o,i,s,a;return no(this,(function(c){switch(c.label){case 0:if(!(n=e.fileList)||!so(n)||0===n.length)throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"[".concat(fo,".getTempFileURL] fileList must not be empty")}));for(r=[],o=0,i=n;o<i.length;o++)if(s=i[o],co(s)){if(!s.hasOwnProperty("fileID")||!s.hasOwnProperty("maxAge"))throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"[".concat(fo,".getTempFileURL] file info must include fileID and maxAge")}));r.push({fileid:s.fileID,max_age:s.maxAge})}else{if(!ao(s))throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"[".concat(fo,".getTempFileURL] invalid fileList")}));r.push({fileid:s})}return[4,this.request.send("storage.batchGetDownloadUrl",{file_list:r})];case 1:return(a=c.sent()).code?[2,uo(t,null,a)]:[2,uo(t,null,{fileList:a.data.download_list,requestId:a.requestId})]}}))}))},e.prototype.downloadFile=function(e,t){return to(this,void 0,void 0,(function(){var n,r,o,i,s,a;return no(this,(function(c){switch(c.label){case 0:if(n=e.fileID,!ao(n))throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"[".concat(fo,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:n,maxAge:600}]})];case 1:return r=c.sent(),"SUCCESS"!==(o=r.fileList[0]).code?[2,uo(t,o)]:(i=this.request,s=encodeURI(o.download_url),[4,i.download({url:s})]);case 2:return a=c.sent(),[2,uo(t,null,a)]}}))}))},Qr([lo({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(io)]}),eo("design:type",Function),eo("design:paramtypes",[Object,Function]),eo("design:returntype",Promise)],e.prototype,"uploadFile",null),Qr([lo({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(io)]}),eo("design:type",Function),eo("design:paramtypes",[Object,Function]),eo("design:returntype",Promise)],e.prototype,"getUploadMetadata",null),Qr([lo({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(io)]}),eo("design:type",Function),eo("design:paramtypes",[Object,Function]),eo("design:returntype",Promise)],e.prototype,"deleteFile",null),Qr([lo({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(io)]}),eo("design:type",Function),eo("design:paramtypes",[Object,Function]),eo("design:returntype",Promise)],e.prototype,"getTempFileURL",null),Qr([lo({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(io)]}),eo("design:type",Function),eo("design:paramtypes",[Object,Function]),eo("design:returntype",Promise)],e.prototype,"downloadFile",null),e}(),po=new ho,yo={name:fo,entity:{uploadFile:po.uploadFile,deleteFile:po.deleteFile,getTempFileURL:po.getTempFileURL,downloadFile:po.downloadFile,getUploadMetadata:po.getUploadMetadata}};try{cloudbase.registerComponent(yo)}catch(e){}var go="__lodash_hash_undefined__",vo="[object Function]",_o="[object GeneratorFunction]",mo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bo=/^\w*$/,wo=/^\./,Eo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,So=/\\(\\)?/g,Io=/^\[object .+?Constructor\]$/,Oo=/^(?:0|[1-9]\d*)$/,Ao="object"==typeof s&&s&&s.Object===Object&&s,To="object"==typeof self&&self&&self.Object===Object&&self,No=Ao||To||Function("return this")();var xo,Ro=Array.prototype,Po=Function.prototype,ko=Object.prototype,Co=No["__core-js_shared__"],Lo=(xo=/[^.]+$/.exec(Co&&Co.keys&&Co.keys.IE_PROTO||""))?"Symbol(src)_1."+xo:"",Do=Po.toString,jo=ko.hasOwnProperty,Uo=ko.toString,Mo=RegExp("^"+Do.call(jo).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bo=No.Symbol,qo=Ro.splice,Wo=Qo(No,"Map"),Fo=Qo(Object,"create"),Ho=Bo?Bo.prototype:void 0,$o=Ho?Ho.toString:void 0;function Go(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ko(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vo(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Jo(e,t,n){var r=e[t];jo.call(e,t)&&oi(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function zo(e,t){for(var n=e.length;n--;)if(oi(e[n][0],t))return n;return-1}function Yo(e){if(!si(e)||(t=e,Lo&&Lo in t))return!1;var t,n=function(e){var t=si(e)?Uo.call(e):"";return t==vo||t==_o}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?Mo:Io;return n.test(function(e){if(null!=e){try{return Do.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function Xo(e,t,n,r){if(!si(e))return e;t=function(e,t){if(ii(e))return!1;var n=typeof e;if("number"==n||"symbol"==n||"boolean"==n||null==e||ai(e))return!0;return bo.test(e)||!mo.test(e)||null!=t&&e in Object(t)}(t,e)?[t]:function(e){return ii(e)?e:ti(e)}(t);for(var o=-1,i=t.length,s=i-1,a=e;null!=a&&++o<i;){var c=ni(t[o]),u=n;if(o!=s){var l=a[c];void 0===(u=r?r(l,c,a):void 0)&&(u=si(l)?l:ei(t[o+1])?[]:{})}Jo(a,c,u),a=a[c]}return e}function Zo(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Qo(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Yo(n)?n:void 0}function ei(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||Oo.test(e))&&e>-1&&e%1==0&&e<t}Go.prototype.clear=function(){this.__data__=Fo?Fo(null):{}},Go.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Go.prototype.get=function(e){var t=this.__data__;if(Fo){var n=t[e];return n===go?void 0:n}return jo.call(t,e)?t[e]:void 0},Go.prototype.has=function(e){var t=this.__data__;return Fo?void 0!==t[e]:jo.call(t,e)},Go.prototype.set=function(e,t){return this.__data__[e]=Fo&&void 0===t?go:t,this},Ko.prototype.clear=function(){this.__data__=[]},Ko.prototype.delete=function(e){var t=this.__data__,n=zo(t,e);return!(n<0)&&(n==t.length-1?t.pop():qo.call(t,n,1),!0)},Ko.prototype.get=function(e){var t=this.__data__,n=zo(t,e);return n<0?void 0:t[n][1]},Ko.prototype.has=function(e){return zo(this.__data__,e)>-1},Ko.prototype.set=function(e,t){var n=this.__data__,r=zo(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Vo.prototype.clear=function(){this.__data__={hash:new Go,map:new(Wo||Ko),string:new Go}},Vo.prototype.delete=function(e){return Zo(this,e).delete(e)},Vo.prototype.get=function(e){return Zo(this,e).get(e)},Vo.prototype.has=function(e){return Zo(this,e).has(e)},Vo.prototype.set=function(e,t){return Zo(this,e).set(e,t),this};var ti=ri((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(ai(e))return $o?$o.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return wo.test(e)&&n.push(""),e.replace(Eo,(function(e,t,r,o){n.push(r?o.replace(So,"$1"):t||e)})),n}));function ni(e){if("string"==typeof e||ai(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ri(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(ri.Cache||Vo),n}function oi(e,t){return e===t||e!=e&&t!=t}ri.Cache=Vo;var ii=Array.isArray;function si(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ai(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==Uo.call(e)}var ci=a((function(e,t,n){return null==e?e:Xo(e,t,n)})),ui="__lodash_hash_undefined__",li="[object Function]",fi="[object GeneratorFunction]",hi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pi=/^\w*$/,di=/^\./,yi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gi=/\\(\\)?/g,vi=/^\[object .+?Constructor\]$/,_i="object"==typeof s&&s&&s.Object===Object&&s,mi="object"==typeof self&&self&&self.Object===Object&&self,bi=_i||mi||Function("return this")();var wi=Array.prototype,Ei=Function.prototype,Si=Object.prototype,Ii=bi["__core-js_shared__"],Oi=function(){var e=/[^.]+$/.exec(Ii&&Ii.keys&&Ii.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ai=Ei.toString,Ti=Si.hasOwnProperty,Ni=Si.toString,xi=RegExp("^"+Ai.call(Ti).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ri=bi.Symbol,Pi=wi.splice,ki=$i(bi,"Map"),Ci=$i(Object,"create"),Li=Ri?Ri.prototype:void 0,Di=Li?Li.toString:void 0;function ji(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ui(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Mi(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Bi(e,t){for(var n,r,o=e.length;o--;)if((n=e[o][0])===(r=t)||n!=n&&r!=r)return o;return-1}function qi(e){if(!Yi(e)||(t=e,Oi&&Oi in t))return!1;var t,n=function(e){var t=Yi(e)?Ni.call(e):"";return t==li||t==fi}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?xi:vi;return n.test(function(e){if(null!=e){try{return Ai.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function Wi(e,t){e=function(e,t){return 1==t.length?e:function(e,t){for(var n=0,r=(t=Gi(t,e)?[t]:Fi(t)).length;null!=e&&n<r;)e=e[Vi(t[n++])];return n&&n==r?e:void 0}(e,function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}(t,0,-1))}(e,t=Gi(t,e)?[t]:Fi(t));var n,r,o=Vi((r=(n=t)?n.length:0)?n[r-1]:void 0);return!(null!=e&&Ti.call(e,o))||delete e[o]}function Fi(e){return zi(e)?e:Ki(e)}function Hi(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function $i(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return qi(n)?n:void 0}function Gi(e,t){if(zi(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xi(e))||(pi.test(e)||!hi.test(e)||null!=t&&e in Object(t))}ji.prototype.clear=function(){this.__data__=Ci?Ci(null):{}},ji.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ji.prototype.get=function(e){var t=this.__data__;if(Ci){var n=t[e];return n===ui?void 0:n}return Ti.call(t,e)?t[e]:void 0},ji.prototype.has=function(e){var t=this.__data__;return Ci?void 0!==t[e]:Ti.call(t,e)},ji.prototype.set=function(e,t){return this.__data__[e]=Ci&&void 0===t?ui:t,this},Ui.prototype.clear=function(){this.__data__=[]},Ui.prototype.delete=function(e){var t=this.__data__,n=Bi(t,e);return!(n<0)&&(n==t.length-1?t.pop():Pi.call(t,n,1),!0)},Ui.prototype.get=function(e){var t=this.__data__,n=Bi(t,e);return n<0?void 0:t[n][1]},Ui.prototype.has=function(e){return Bi(this.__data__,e)>-1},Ui.prototype.set=function(e,t){var n=this.__data__,r=Bi(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Mi.prototype.clear=function(){this.__data__={hash:new ji,map:new(ki||Ui),string:new ji}},Mi.prototype.delete=function(e){return Hi(this,e).delete(e)},Mi.prototype.get=function(e){return Hi(this,e).get(e)},Mi.prototype.has=function(e){return Hi(this,e).has(e)},Mi.prototype.set=function(e,t){return Hi(this,e).set(e,t),this};var Ki=Ji((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(Xi(e))return Di?Di.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return di.test(e)&&n.push(""),e.replace(yi,(function(e,t,r,o){n.push(r?o.replace(gi,"$1"):t||e)})),n}));function Vi(e){if("string"==typeof e||Xi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ji(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(Ji.Cache||Mi),n}Ji.Cache=Mi;var zi=Array.isArray;function Yi(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xi(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==Ni.call(e)}var Zi=a((function(e,t){return null==e||Wi(e,t)})),Qi={exports:{}};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",l="[object Map]",f="[object Number]",h="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",v="[object Symbol]",_="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",E="[object Float64Array]",S="[object Int8Array]",I="[object Int16Array]",O="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",N="[object Uint16Array]",x="[object Uint32Array]",R=/\w*$/,P=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,C={};C[o]=C["[object Array]"]=C[m]=C[b]=C[i]=C[a]=C[w]=C[E]=C[S]=C[I]=C[O]=C[l]=C[f]=C[h]=C[d]=C[y]=C[g]=C[v]=C[A]=C[T]=C[N]=C[x]=!0,C["[object Error]"]=C[c]=C[_]=!1;var L="object"==typeof s&&s&&s.Object===Object&&s,D="object"==typeof self&&self&&self.Object===Object&&self,j=L||D||Function("return this")(),U=t&&!t.nodeType&&t,M=U&&e&&!e.nodeType&&e,B=M&&M.exports===U;function q(e,t){return e.set(t[0],t[1]),e}function W(e,t){return e.add(t),e}function F(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function H(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function $(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function G(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var V=Array.prototype,J=Function.prototype,z=Object.prototype,Y=j["__core-js_shared__"],X=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Z=J.toString,Q=z.hasOwnProperty,ee=z.toString,te=RegExp("^"+Z.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=B?j.Buffer:void 0,re=j.Symbol,oe=j.Uint8Array,ie=G(Object.getPrototypeOf,Object),se=Object.create,ae=z.propertyIsEnumerable,ce=V.splice,ue=Object.getOwnPropertySymbols,le=ne?ne.isBuffer:void 0,fe=G(Object.keys,Object),he=Ue(j,"DataView"),pe=Ue(j,"Map"),de=Ue(j,"Promise"),ye=Ue(j,"Set"),ge=Ue(j,"WeakMap"),ve=Ue(Object,"create"),_e=Fe(he),me=Fe(pe),be=Fe(de),we=Fe(ye),Ee=Fe(ge),Se=re?re.prototype:void 0,Ie=Se?Se.valueOf:void 0;function Oe(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ae(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Te(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ne(e){this.__data__=new Ae(e)}function xe(e,t){var n=$e(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ge(e)}(e)&&Q.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var s in e)!t&&!Q.call(e,s)||i&&("length"==s||qe(s,r))||n.push(s);return n}function Re(e,t,n){var r=e[t];Q.call(e,t)&&He(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Pe(e,t){for(var n=e.length;n--;)if(He(e[n][0],t))return n;return-1}function ke(e,t,n,r,s,p,_){var P;if(r&&(P=p?r(e,s,p,_):r(e)),void 0!==P)return P;if(!Je(e))return e;var k=$e(e);if(k){if(P=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,P)}else{var L=Be(e),D=L==c||L==u;if(Ke(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(L==h||L==o||D&&!p){if(H(e))return p?e:{};if(P=function(e){return"function"!=typeof e.constructor||We(e)?{}:(t=ie(e),Je(t)?se(t):{});var t}(D?{}:e),!t)return function(e,t){return De(e,Me(e),t)}(e,function(e,t){return e&&De(t,ze(t),e)}(P,e))}else{if(!C[L])return p?e:{};P=function(e,t,n,r){var o=e.constructor;switch(t){case m:return Le(e);case i:case a:return new o(+e);case b:return function(e,t){var n=t?Le(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case E:case S:case I:case O:case A:case T:case N:case x:return function(e,t){var n=t?Le(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case l:return function(e,t,n){var r=t?n($(e),!0):$(e);return F(r,q,new e.constructor)}(e,r,n);case f:case g:return new o(e);case d:return function(e){var t=new e.constructor(e.source,R.exec(e));return t.lastIndex=e.lastIndex,t}(e);case y:return function(e,t,n){var r=t?n(K(e),!0):K(e);return F(r,W,new e.constructor)}(e,r,n);case v:return s=e,Ie?Object(Ie.call(s)):{}}var s}(e,L,ke,t)}}_||(_=new Ne);var j=_.get(e);if(j)return j;if(_.set(e,P),!k)var U=n?function(e){return function(e,t,n){var r=t(e);return $e(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,ze,Me)}(e):ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(U||e,(function(o,i){U&&(o=e[i=o]),Re(P,i,ke(o,t,n,r,i,e,_))})),P}function Ce(e){return!(!Je(e)||(t=e,X&&X in t))&&(Ve(e)||H(e)?te:P).test(Fe(e));var t}function Le(e){var t=new e.constructor(e.byteLength);return new oe(t).set(new oe(e)),t}function De(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var s=t[o],a=r?r(n[s],e[s],s,n,e):void 0;Re(n,s,void 0===a?e[s]:a)}return n}function je(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Ue(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ce(n)?n:void 0}Oe.prototype.clear=function(){this.__data__=ve?ve(null):{}},Oe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Oe.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Q.call(t,e)},Oe.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?n:t,this},Ae.prototype.clear=function(){this.__data__=[]},Ae.prototype.delete=function(e){var t=this.__data__,n=Pe(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},Ae.prototype.get=function(e){var t=this.__data__,n=Pe(t,e);return n<0?void 0:t[n][1]},Ae.prototype.has=function(e){return Pe(this.__data__,e)>-1},Ae.prototype.set=function(e,t){var n=this.__data__,r=Pe(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Te.prototype.clear=function(){this.__data__={hash:new Oe,map:new(pe||Ae),string:new Oe}},Te.prototype.delete=function(e){return je(this,e).delete(e)},Te.prototype.get=function(e){return je(this,e).get(e)},Te.prototype.has=function(e){return je(this,e).has(e)},Te.prototype.set=function(e,t){return je(this,e).set(e,t),this},Ne.prototype.clear=function(){this.__data__=new Ae},Ne.prototype.delete=function(e){return this.__data__.delete(e)},Ne.prototype.get=function(e){return this.__data__.get(e)},Ne.prototype.has=function(e){return this.__data__.has(e)},Ne.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ae){var r=n.__data__;if(!pe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Te(r)}return n.set(e,t),this};var Me=ue?G(ue,Object):function(){return[]},Be=function(e){return ee.call(e)};function qe(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||k.test(e))&&e>-1&&e%1==0&&e<t}function We(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||z)}function Fe(e){if(null!=e){try{return Z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function He(e,t){return e===t||e!=e&&t!=t}(he&&Be(new he(new ArrayBuffer(1)))!=b||pe&&Be(new pe)!=l||de&&Be(de.resolve())!=p||ye&&Be(new ye)!=y||ge&&Be(new ge)!=_)&&(Be=function(e){var t=ee.call(e),n=t==h?e.constructor:void 0,r=n?Fe(n):void 0;if(r)switch(r){case _e:return b;case me:return l;case be:return p;case we:return y;case Ee:return _}return t});var $e=Array.isArray;function Ge(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Ve(e)}var Ke=le||function(){return!1};function Ve(e){var t=Je(e)?ee.call(e):"";return t==c||t==u}function Je(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ze(e){return Ge(e)?xe(e):function(e){if(!We(e))return fe(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return ke(e,!0,!0)}}(Qi,Qi.exports);var es=a(Qi.exports);function ts(e){return void 0===e&&(e=""),"".concat(e?"".concat(e,"_"):"").concat(+new Date,"_").concat(Math.random())}var ns,rs=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}})},os=function(e){var t,n,r=e.id,o=e.docChanges,i=e.docs,s=e.msgType,a=e.type;Object.defineProperties(this,{id:{get:function(){return r},enumerable:!0},docChanges:{get:function(){return t||(t=JSON.parse(JSON.stringify(o))),t},enumerable:!0},docs:{get:function(){return n||(n=JSON.parse(JSON.stringify(i))),n},enumerable:!0},msgType:{get:function(){return s},enumerable:!0},type:{get:function(){return a},enumerable:!0}})},is=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ss=function(e){function t(t){var n=e.call(this,"Watch Error ".concat(JSON.stringify(t.msgData)," (requestid: ").concat(t.requestId,")"))||this;return n.isRealtimeErrorMessageError=!0,n.payload=t,n}return is(t,e),t}(Error),as=function(e){return null==e?void 0:e.isRealtimeErrorMessageError},cs=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 is(t,e),t}(Error),us=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 is(t,e),t}(Error),ls=function(e){function t(t){var n=e.call(this,t.errMsg)||this;return n.errCode="UNKNOWN_ERROR",Object.defineProperties(n,{message:{get:function(){return"errCode: ".concat(this.errCode," ").concat(fs[this.errCode]||""," | errMsg: ").concat(this.errMsg)},set:function(e){this.errMsg=e}}}),n.errCode=t.errCode||"UNKNOWN_ERROR",n.errMsg=t.errMsg,n}return is(t,e),Object.defineProperty(t.prototype,"message",{get:function(){return"errCode: ".concat(this.errCode," | errMsg: ").concat(this.errMsg)},set:function(e){this.errMsg=e},enumerable:!1,configurable:!0}),t}(Error),fs={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"},hs=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},ps=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},ds=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},ys=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};!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"}(ns||(ns={}));var gs=function(){function e(e){var t=this;this.watchStatus=ns.INITING,this._login=function(e,n){return ps(t,void 0,void 0,(function(){var t;return ds(this,(function(r){switch(r.label){case 0:return this.watchStatus=ns.LOGGINGIN,[4,this.login(e,n)];case 1:return t=r.sent(),this.envId||(this.envId=t.envId),[2,t]}}))}))},this.initWatch=function(e){return ps(t,void 0,void 0,(function(){var t,n=this;return ds(this,(function(r){switch(r.label){case 0:if(this._initWatchPromise)return[2,this._initWatchPromise];this._initWatchPromise=new Promise((function(t,r){return ps(n,void 0,void 0,(function(){var n,o,i,s,a,c,u,l,f,h;return ds(this,(function(p){switch(p.label){case 0:return p.trys.push([0,3,,4]),this.watchStatus===ns.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,t()]):[4,this._login(this.envId,e)];case 1:return n=p.sent().envId,this.watchStatus===ns.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,t()]):(this.watchStatus=ns.INITING,o={watchId:this.watchId,requestId:ts(),msgType:"INIT_WATCH",msgData:{envId:n,collName:this.collectionName,query:this.query,limit:this.limit,orderBy:this.orderBy}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!0,timeout:1e4})]);case 2:if(i=p.sent(),s=i.msgData,a=s.events,c=s.currEvent,this.sessionInfo={queryID:i.msgData.queryID,currentEventId:c-1,currentDocs:[]},a.length>0){for(u=0,l=a;u<l.length;u++)l[u].ID=c;this.handleServerEvents(i)}else this.sessionInfo.currentEventId=c,f=new os({id:c,docChanges:[],docs:[],type:"init"}),this.listener.onChange(f),this.scheduleSendACK();return this.onWatchStart(this,this.sessionInfo.queryID),this.watchStatus=ns.ACTIVE,this._availableRetries.INIT_WATCH=2,t(),[3,4];case 3:return h=p.sent(),this.handleWatchEstablishmentError(h,{operationName:"INIT_WATCH",resolve:t,reject:r}),[3,4];case 4:return[2]}}))}))})),t=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this._initWatchPromise];case 2:return r.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 ps(t,void 0,void 0,(function(){var t,n=this;return ds(this,(function(r){switch(r.label){case 0:if(this._rebuildWatchPromise)return[2,this._rebuildWatchPromise];this._rebuildWatchPromise=new Promise((function(t,r){return ps(n,void 0,void 0,(function(){var n,o,i,s;return ds(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),this.watchStatus===ns.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,t()]):[4,this._login(this.envId,e)];case 1:if(n=a.sent().envId,!this.sessionInfo)throw new Error("can not rebuildWatch without a successful initWatch (lack of sessionInfo)");return this.watchStatus===ns.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,t()]):(this.watchStatus=ns.REBUILDING,o={watchId:this.watchId,requestId:ts(),msgType:"REBUILD_WATCH",msgData:{envId:n,collName:this.collectionName,queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!1,timeout:1e4})]);case 2:return i=a.sent(),this.handleServerEvents(i),this.watchStatus=ns.ACTIVE,this._availableRetries.REBUILD_WATCH=2,t(),[3,4];case 3:return s=a.sent(),this.handleWatchEstablishmentError(s,{operationName:"REBUILD_WATCH",resolve:t,reject:r}),[3,4];case 4:return[2]}}))}))})),t=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this._rebuildWatchPromise];case 2:return r.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,n){return ps(t,void 0,void 0,(function(){var t,r,o,i=this;return ds(this,(function(s){return t="INIT_WATCH"===n.operationName,r=function(){i.closeWithError(new ls({errCode:t?fs.SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:fs.SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL,errMsg:e})),n.reject(e)},o=function(e){i.useRetryTicket(n.operationName)?t?(i._initWatchPromise=void 0,n.resolve(i.initWatch(e))):(i._rebuildWatchPromise=void 0,n.resolve(i.rebuildWatch(e))):r()},this.handleCommonError(e,{onSignError:function(){return o(!0)},onTimeoutError:function(){return o(!1)},onNotRetryableError:r,onCancelledError:n.reject,onUnknownError:function(){return ps(i,void 0,void 0,(function(){var e,t=this;return ds(this,(function(r){switch(r.label){case 0:return r.trys.push([0,8,,9]),e=function(){return ps(t,void 0,void 0,(function(){return ds(this,(function(e){switch(e.label){case 0:return this.pause(),[4,this.onceWSConnected()];case 1:return e.sent(),o(!0),[2]}}))}))},this.isWSConnected()?[3,2]:[4,e()];case 1:return r.sent(),[3,7];case 2:return[4,hs(100)];case 3:return r.sent(),this.watchStatus!==ns.PAUSED?[3,4]:(n.reject(new us("".concat(n.operationName," cancelled due to pause after unknownError"))),[3,7]);case 4:return this.isWSConnected()?[3,6]:[4,e()];case 5:return r.sent(),[3,7];case 6:o(!1),r.label=7;case 7:return[3,9];case 8:return r.sent(),o(!0),[3,9];case 9:return[2]}}))}))}}),[2]}))}))},this.closeWatch=function(){return ps(t,void 0,void 0,(function(){var e,t,n;return ds(this,(function(r){switch(r.label){case 0:if(e=this.sessionInfo?this.sessionInfo.queryID:"",this.watchStatus!==ns.ACTIVE)return this.watchStatus=ns.CLOSED,this.onWatchClose(this,e),[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),this.watchStatus=ns.CLOSING,t={watchId:this.watchId,requestId:ts(),msgType:"CLOSE_WATCH",msgData:null},[4,this.send({msg:t})];case 2:return r.sent(),this.sessionInfo=void 0,this.watchStatus=ns.CLOSED,[3,5];case 3:return n=r.sent(),this.closeWithError(new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL,errMsg:n})),[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 ps(t,void 0,void 0,(function(){var e,t,n;return ds(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.watchStatus!==ns.ACTIVE?(this.scheduleSendACK(),[2]):this.sessionInfo?(e={watchId:this.watchId,requestId:ts(),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 r.sent(),this.scheduleSendACK(),[3,3];case 2:if(t=r.sent(),as(t))switch((n=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 ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:n.msgData.code})),[2]}return this._availableRetries.CHECK_LAST&&this._availableRetries.CHECK_LAST>0?(this._availableRetries.CHECK_LAST--,this.scheduleSendACK()):this.closeWithError(new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:t})),[3,3];case 3:return[2]}}))}))},this.handleCommonError=function(e,t){if(as(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(function(e){return"timeout"===e.type}(e))return void t.onTimeoutError(e);if(function(e){return"cancelled"===e.type}(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 rs({close:this.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 ns.PAUSED:if("ERROR"!==e.msgType)return;break;case ns.LOGGINGIN:case ns.INITING:case ns.REBUILDING:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received while ".concat(this.watchStatus));case ns.CLOSED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has closed");case ns.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 ls({errCode:fs.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=ns.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=ns.PAUSED,console.log("[realtime] client paused (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},e.prototype.resume=function(){return ps(this,void 0,void 0,(function(){var e;return ds(this,(function(t){switch(t.label){case 0:this.watchStatus=ns.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]--,console.log("[realtime] ".concat(e," use a retry ticket, now only ").concat(this._availableRetries[e]," retry left")),!0)},e.prototype.handleServerEvents=function(e){return ps(this,void 0,void 0,(function(){var t;return ds(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.scheduleSendACK(),[4,this._handleServerEvents(e)];case 1:return n.sent(),this._postHandleServerEventsValidityCheck(e),[3,3];case 2:throw t=n.sent(),console.error("[realtime listener] internal non-fatal error: handle server events failed with error: ",t),t;case 3:return[2]}}))}))},e.prototype._handleServerEvents=function(e){return ps(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,c,u,l,f,h;return ds(this,(function(p){switch(p.label){case 0:if(t=e.requestId,n=e.msgData.events,r=e.msgType,!n.length||!this.sessionInfo)return[2];o=this.sessionInfo;try{i=n.map(vs)}catch(e){return this.closeWithError(new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA,errMsg:e})),[2]}s=ys([],o.currentDocs,!0),a=!1,c=function(n,c){var l,f,h,p,d,y,g,v,_,m,b;return ds(this,(function(w){switch(w.label){case 0:return l=i[n],o.currentEventId>=l.id?(!i[n-1]||l.id>i[n-1].id?console.warn("[realtime] duplicate event received, cur ".concat(o.currentEventId," but got ").concat(l.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(o.currentEventId!==l.id-1)return[3,2];switch(l.dataType){case"update":if(!l.doc)switch(l.queueType){case"update":case"dequeue":if(f=s.find((function(e){return e._id===l.docId})),f){if(y=es(f),l.updatedFields)for(d in l.updatedFields)ci(y,d,l.updatedFields[d]);if(l.removedFields)for(h=0,p=l.removedFields;h<p.length;h++)d=p[h],Zi(y,d);l.doc=y}else console.error("[realtime listener] internal non-fatal server error: unexpected update dataType event where no doc is associated.");break;case"enqueue":throw g=new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="update" and queueType="enqueue" (requestId '.concat(e.requestId,")")}),u.closeWithError(g),g}break;case"replace":if(!l.doc)throw g=new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="replace" (requestId '.concat(e.requestId,")")}),u.closeWithError(g),g;break;case"remove":(y=s.find((function(e){return e._id===l.docId})))?l.doc=y:console.error("[realtime listener] internal non-fatal server error: unexpected remove event where no doc is associated.");break;case"limit":if(!l.doc)switch(l.queueType){case"dequeue":(y=s.find((function(e){return e._id===l.docId})))?l.doc=y:console.error("[realtime listener] internal non-fatal server error: unexpected limit dataType event where no doc is associated.");break;case"enqueue":throw g=new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="limit" and queueType="enqueue" (requestId '.concat(e.requestId,")")}),u.closeWithError(g),g}}switch(l.queueType){case"init":a?s.push(l.doc):(a=!0,s=[l.doc]);break;case"enqueue":s.push(l.doc);break;case"dequeue":v=s.findIndex((function(e){return e._id===l.docId})),v>-1?s.splice(v,1):console.error("[realtime listener] internal non-fatal server error: unexpected dequeue event where no doc is associated.");break;case"update":v=s.findIndex((function(e){return e._id===l.docId})),v>-1?s[v]=l.doc:console.error("[realtime listener] internal non-fatal server error: unexpected queueType update event where no doc is associated.")}return(n===c-1||i[n+1]&&i[n+1].id!==l.id)&&(_=ys([],s,!0),m=i.slice(0,n+1).filter((function(e){return e.id===l.id})),u.sessionInfo.currentEventId=l.id,u.sessionInfo.currentDocs=s,b=new os({id:l.id,docChanges:m,docs:_,msgType:r}),u.listener.onChange(b)),[3,4];case 2:return console.warn("[realtime listener] event received is out of order, cur ".concat(u.sessionInfo.currentEventId," but got ").concat(l.id)),[4,u.rebuildWatch()];case 3:return w.sent(),[2,{value:void 0}];case 4:return[2]}}))},u=this,l=0,f=i.length,p.label=1;case 1:return l<f?[5,c(l,f)]:[3,4];case 2:if("object"==typeof(h=p.sent()))return[2,h.value];p.label=3;case 3:return l++,[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 vs(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}var _s,ms={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"}};!function(e){e[e.NormalClosure=1e3]="NormalClosure",e[e.GoingAway=1001]="GoingAway",e[e.ProtocolError=1002]="ProtocolError",e[e.UnsupportedData=1003]="UnsupportedData",e[e.NoStatusReceived=1005]="NoStatusReceived",e[e.AbnormalClosure=1006]="AbnormalClosure",e[e.InvalidFramePayloadData=1007]="InvalidFramePayloadData",e[e.PolicyViolation=1008]="PolicyViolation",e[e.MessageTooBig=1009]="MessageTooBig",e[e.MissingExtension=1010]="MissingExtension",e[e.InternalError=1011]="InternalError",e[e.ServiceRestart=1012]="ServiceRestart",e[e.TryAgainLater=1013]="TryAgainLater",e[e.BadGateway=1014]="BadGateway",e[e.TLSHandshake=1015]="TLSHandshake",e[e.ReconnectWebSocket=3e3]="ReconnectWebSocket",e[e.NoRealtimeListeners=3001]="NoRealtimeListeners",e[e.HeartbeatPingError=3002]="HeartbeatPingError",e[e.HeartbeatPongTimeoutError=3003]="HeartbeatPongTimeoutError",e[e.NoAuthentication=3050]="NoAuthentication"}(_s||(_s={}));var bs=function(e,t){var n=ms[e],r=n?"".concat(n.name,", code ").concat(e,", reason ").concat(t||n.description):"code ".concat(e);return new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED,errMsg:r})},ws=null,Es="web";function Ss(){return ws}function Is(){return Es}function Os(e){Es=e}var As=function(){return As=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},As.apply(this,arguments)},Ts=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},Ns=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},xs=1,Rs=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 Ts(t,void 0,void 0,(function(){var t=this;return Ns(this,(function(n){return[2,new Promise((function(n,r){return Ts(t,void 0,void 0,(function(){var t,o,i,s,a,c,u,l=this;return Ns(this,(function(f){switch(f.label){case 0:o=!1,i=!1,s=function(e){o=!0,t&&clearTimeout(t),n(e)},a=function(e){i=!0,t&&clearTimeout(t),r(e)},e.timeout&&(t=setTimeout((function(){return Ts(l,void 0,void 0,(function(){return Ns(this,(function(e){switch(e.label){case 0:return o&&i?[3,2]:[4,hs(0)];case 1:e.sent(),o&&i||a(new cs("wsclient.send timedout")),e.label=2;case 2:return[2]}}))}))}),e.timeout)),f.label=1;case 1:return f.trys.push([1,8,,9]),this._wsInitPromise?[4,this._wsInitPromise]:[3,3];case 2:f.sent(),f.label=3;case 3:if(!this._ws)return a(new Error("invalid state: ws connection not exists, can not send message")),[2];if(this._ws.readyState!==xs)return a(new Error("ws readyState invalid: ".concat(this._ws.readyState,", can not send message"))),[2];e.waitResponse&&this._wsResponseWait.set(e.msg.requestId,{resolve:s,reject:a,skipOnMessage:e.skipOnMessage}),f.label=4;case 4:return f.trys.push([4,6,,7]),[4,this._ws.send(JSON.stringify(e.msg))];case 5:return f.sent(),e.waitResponse||s(void 0),[3,7];case 6:return(c=f.sent())&&(a(c),e.waitResponse&&this._wsResponseWait.delete(e.msg.requestId)),[3,7];case 7:return[3,9];case 8:return u=f.sent(),a(u),[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,n){return void 0===n&&(n=t._maxReconnect),Ts(t,void 0,void 0,(function(){var t=this;return Ns(this,(function(r){switch(r.label){case 0:if(e&&this._reconnectState)return[2];if(e&&(this._reconnectState=!0),this._wsInitPromise)return[2,this._wsInitPromise];e&&this.pauseClients(),this.close(_s.ReconnectWebSocket),this._wsInitPromise=new Promise((function(r,o){return Ts(t,void 0,void 0,(function(){var t,i,s=this;return Ns(this,(function(a){switch(a.label){case 0:return a.trys.push([0,6,,11]),[4,this.getWsSign()];case 1:return t=a.sent(),[4,new Promise((function(e){var n=t.wsUrl||"wss://tcb-ws.tencentcloudapi.com",r=Ss();s._ws=r?new r(n):new WebSocket(n),e(void 0)}))];case 2:return a.sent(),this._ws.connect?[4,this._ws.connect()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[4,this.initWebSocketEvent()];case 5:return a.sent(),r(),e&&(this.resumeClients(),this._reconnectState=!1),[3,11];case 6:return i=a.sent(),console.error("[realtime] initWebSocketConnection connect fail",i),n>0?(this._wsInitPromise=void 0,[4,hs(this._reconnectInterval)]):[3,9];case 7:a.sent(),e&&(this._reconnectState=!1),a.label=8;case 8:return r(this.initWebSocketConnection(e,n-1)),[3,10];case 9:o(i),e&&this.closeAllClients(new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL,errMsg:i})),a.label=10;case 10:return[3,11];case 11:return[2]}}))}))})),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this._wsInitPromise];case 2:return r.sent(),this._wsReadySubsribers.forEach((function(e){return(0,e.resolve)()})),[3,5];case 3:return r.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,n){if(!t._ws)throw new Error("can not initWebSocketEvent, ws not exists");var r=!1;t._ws.onopen=function(t){console.warn("[realtime] ws event: open",t),r=!0,e()},t._ws.onerror=function(e){t._logins=new Map,r?(console.error("[realtime] ws event: error",e),t.clearHeartbeat(),t._virtualWSClient.forEach((function(t){return t.closeWithError(new ls({errCode:fs.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR,errMsg:e}))}))):(console.error("[realtime] ws open failed with ws event: error",e),n(e))},t._ws.onclose=function(e){switch(console.warn("[realtime] ws event: close",e),t._logins=new Map,t.clearHeartbeat(),e.code){case _s.ReconnectWebSocket:case _s.NoRealtimeListeners:break;case _s.HeartbeatPingError:case _s.HeartbeatPongTimeoutError:case _s.NormalClosure:case _s.AbnormalClosure:t._maxReconnect>0?t.initWebSocketConnection(!0,t._maxReconnect):t.closeAllClients(bs(e.code));break;case _s.NoAuthentication:t.closeAllClients(bs(e.code,e.reason));break;default:t._maxReconnect>0?t.initWebSocketConnection(!0,t._maxReconnect):t.closeAllClients(bs(e.code))}},t._ws.onmessage=function(e){var n,r=e.data;t.heartbeat();try{n=JSON.parse(r)}catch(e){throw new Error("[realtime] onMessage parse res.data error: ".concat(e))}if("ERROR"===n.msgType){var o=null;t._virtualWSClient.forEach((function(e){e.watchId===n.watchId&&(o=e)})),o&&o.listener.onError(n)}var i=t._wsResponseWait.get(n.requestId);if(i){try{"ERROR"===n.msgType?i.reject(new ss(n)):i.resolve(n)}catch(e){console.error("ws onMessage responseWaitSpec.resolve(msg) errored:",e)}finally{t._wsResponseWait.delete(n.requestId)}if(i.skipOnMessage)return}if("PONG"!==n.msgType){var s=n.watchId&&t._watchIdClientMap.get(n.watchId);if(s)s.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":(s=t._queryIdClientMap.get(n.msgData.queryID))&&s.onMessage(n);break;default:for(var a=0,c=Array.from(t._watchIdClientMap.entries());a<c.length;a++){c[a][1].onMessage(n);break}}}else if(t._lastPingSendTS){var u=Date.now()-t._lastPingSendTS;if(u>1e4)return void console.warn("[realtime] untrusted rtt observed: ".concat(u));t._rttObserved.length>=3&&t._rttObserved.splice(0,t._rttObserved.length-3+1),t._rttObserved.push(u)}},t.heartbeat()}))},this.isWSConnected=function(){return Boolean(t._ws&&t._ws.readyState===xs)},this.onceWSConnected=function(){return Ts(t,void 0,void 0,(function(){var e=this;return Ns(this,(function(t){return this.isWSConnected()?[2]:this._wsInitPromise?[2,this._wsInitPromise]:[2,new Promise((function(t,n){e._wsReadySubsribers.push({resolve:t,reject:n})}))]}))}))},this.webLogin=function(e,n){return Ts(t,void 0,void 0,(function(){var t,r,o,i,s,a,c,u,l=this;return Ns(this,(function(f){switch(f.label){case 0:if(!n)if(e){if(t=this._logins.get(e)){if(t.loggedIn&&t.loginResult)return[2,t.loginResult];if(t.loggingInPromise)return[2,t.loggingInPromise]}}else if(null==(r=this._logins.get(""))?void 0:r.loggingInPromise)return[2,r.loggingInPromise];o=new Promise((function(e,t){return Ts(l,void 0,void 0,(function(){var n,r,o,i,s;return Ns(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getWsSign()];case 1:return n=a.sent(),r={envId:n.envId||"",accessToken:"",referrer:"web",sdkVersion:"",dataVersion:""},o={watchId:void 0,requestId:ts(),msgType:"LOGIN",msgData:r,exMsgData:{runtime:Is(),signStr:n.signStr,secretVersion:n.secretVersion}},[4,this.send({msg:o,waitResponse:!0,skipOnMessage:!0,timeout:5e3})];case 2:return(i=a.sent()).msgData.code?t(new Error("".concat(i.msgData.code," ").concat(i.msgData.message))):e({envId:n.envId}),[3,4];case 3:return s=a.sent(),t(s),[3,4];case 4:return[2]}}))}))})),i=e&&this._logins.get(e),s=Date.now(),i?(i.loggedIn=!1,i.loggingInPromise=o,i.loginStartTS=s):(i={loggedIn:!1,loggingInPromise:o,loginStartTS:s},this._logins.set(e||"",i)),f.label=1;case 1:return f.trys.push([1,3,,4]),[4,o];case 2:if(a=f.sent(),(c=e&&this._logins.get(e))&&c===i&&c.loginStartTS===s)return i.loggedIn=!0,i.loggingInPromise=void 0,i.loginStartTS=void 0,i.loginResult=a,[2,a];if(c){if(c.loggedIn&&c.loginResult)return[2,c.loginResult];if(c.loggingInPromise)return[2,c.loggingInPromise];throw new Error("ws unexpected login info")}throw new Error("ws login info reset");case 3:throw u=f.sent(),i.loggedIn=!1,i.loggingInPromise=void 0,i.loginStartTS=void 0,i.loginResult=void 0,u;case 4:return[2]}}))}))},this.getWsSign=function(){return Ts(t,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Ns(this,(function(a){switch(a.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:Is()})]);case 1:if((t=a.sent()).code)throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败: ".concat(t.code));if(t.data)return n=t.data,r=n.signStr,o=n.wsUrl,i=n.secretVersion,s=n.envId,[2,{signStr:r,wsUrl:o,secretVersion:i,envId:s,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 Ts(t,void 0,void 0,(function(){var e;return Ns(this,(function(t){switch(t.label){case 0:return e={watchId:void 0,requestId:ts(),msgType:"PING",msgData:null},[4,this.send({msg:e})];case 1:return t.sent(),[2]}}))}))},this.onWatchStart=function(e,n){t._queryIdClientMap.set(n,e)},this.onWatchClose=function(e,n){n&&t._queryIdClientMap.delete(n),t._watchIdClientMap.delete(e.watchId),t._virtualWSClient.delete(e),t._virtualWSClient.size||t.close(_s.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,ms[e].name),this._ws=void 0)},e.prototype.watch=function(e){this._ws||this._wsInitPromise||this.initWebSocketConnection(!1);var t=new gs(As(As({},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(){return Ts(t,void 0,void 0,(function(){var e=this;return Ns(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this._ws&&this._ws.readyState===xs?(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++,e.heartbeat(!0)):e.initWebSocketConnection(!0)}),this._context.appConfig.realtimePongWaitTimeout),[3,3];case 2:return t.sent(),this._pingFailed<2?(this._pingFailed++,this.heartbeat()):this.close(_s.HeartbeatPingError),[3,3];case 3:return[2]}}))}))}),e?0:this._context.appConfig.realtimePingInterval)},e}(),Ps={target:"database",entity:function(){var e,t=this.platform,n=t.adapter,r=t.runtime;e=n.wsClass,ws=e,Os(r)}},ks={name:"realtime",IIFE:!0,entity:function(){this.prototype.wsClientClass=Rs}};try{cloudbase.registerComponent(ks),cloudbase.registerHook(Ps)}catch(e){}var Cs=function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},Ls=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Ds=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},js=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Us=Pe.ERRORS,Ms=Pe.COMMUNITY_SITE_URL,Bs=xe.catchErrorsDecorator,qs="analytics",Ws=["mall"];var Fs,Hs,$s=new(function(){function e(){}return e.prototype.analytics=function(e){return Ds(this,void 0,void 0,(function(){var t,n,r;return js(this,(function(o){if(!function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))return!1;var t=e.report_data,n=e.report_type;return!1!==Ws.includes(n)&&"Object"===Object.prototype.toString.call(t).slice(8,-1)&&!(void 0!==t.action_time&&!Number.isInteger(t.action_time))&&"string"==typeof t.action_type}(e))throw new Error(JSON.stringify({code:Us.INVALID_PARAMS,msg:"[".concat(qs,".analytics] invalid report data")}));return t=void 0===e.report_data.action_time?Math.floor(Date.now()/1e3):e.report_data.action_time,n={analytics_scene:e.report_type,analytics_data:Object.assign({},e.report_data,{action_time:t})},r={requestData:n},this.request.send("analytics.report",r),[2]}))}))},Cs([Bs({customInfo:{className:"Cloudbase",methodName:"analytics"},title:"上报调用失败",messages:["请确认以下各项:"," 1 - 调用 analytics() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Ms)]}),Ls("design:type",Function),Ls("design:paramtypes",[Object]),Ls("design:returntype",Promise)],e.prototype,"analytics",null),e}()),Gs={name:qs,entity:{analytics:$s.analytics}};try{cloudbase.registerComponent(Gs)}catch(e){}!function(e){e.DocIDError="文档ID不合法",e.CollNameError="集合名称不合法",e.OpStrError="操作符不合法",e.DirectionError="排序字符不合法",e.IntergerError="must be integer",e.QueryParamTypeError="查询参数必须为对象",e.QueryParamValueError="查询参数对象值不能均为undefined"}(Hs||(Hs={}));var Ks,Vs,Js="Number",zs="Object",Ys="Array",Xs="GeoPoint",Zs="GeoLineString",Qs="GeoPolygon",ea="GeoMultiPoint",ta="GeoMultiLineString",na="GeoMultiPolygon",ra="Date",oa="ServerDate",ia="BsonDate",sa=["desc","asc"],aa=["<","<=","==",">=",">"];!function(e){e.lt="<",e.gt=">",e.lte="<=",e.gte=">=",e.eq="=="}(Ks||(Ks={})),(Fs={})[Ks.eq]="$eq",Fs[Ks.lt]="$lt",Fs[Ks.lte]="$lte",Fs[Ks.gt]="$gt",Fs[Ks.gte]="$gte",function(e){e.WHERE="WHERE",e.DOC="DOC"}(Vs||(Vs={}));var ca=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ua=[],la={},fa=function(e){function t(t,n){if(n!==la)throw new TypeError("InternalSymbol cannot be constructed with new operator");return e.call(this,t)||this}return ca(t,e),t.for=function(e){for(var n=0,r=ua.length;n<r;n++)if(ua[n].target===e)return ua[n].instance;var o=new t(e,la);return ua.push({target:e,instance:o}),o},t}((function(e){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:e}})})),ha=fa,pa=ha.for("UNSET_FIELD_NAME"),da=ha.for("UPDATE_COMMAND"),ya=ha.for("QUERY_COMMAND"),ga=ha.for("LOGIC_COMMAND"),va=ha.for("GEO_POINT"),_a=ha.for("SYMBOL_GEO_LINE_STRING"),ma=ha.for("SYMBOL_GEO_POLYGON"),ba=ha.for("SYMBOL_GEO_MULTI_POINT"),wa=ha.for("SYMBOL_GEO_MULTI_LINE_STRING"),Ea=ha.for("SYMBOL_GEO_MULTI_POLYGON"),Sa=ha.for("SERVER_DATE"),Ia=ha.for("REGEXP"),Oa=function(){function e(e){var t=(void 0===e?{}:e).offset,n=void 0===t?0:t;this.offset=n}return Object.defineProperty(e.prototype,"_internalType",{get:function(){return Sa},enumerable:!0,configurable:!0}),e.prototype.parse=function(){return{$date:{offset:this.offset}}},e}();function Aa(e){return new Oa(e)}var Ta,Na=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},xa=function(){function e(){}return e.formatResDocumentData=function(t){return t.map((function(t){return e.formatField(t)}))},e.formatField=function(t){var n=Object.keys(t),r={};return Array.isArray(t)&&(r=[]),n.forEach((function(n){var o,i=t[n];switch(e.whichType(i)){case Xs:o=new Ma(i.coordinates[0],i.coordinates[1]);break;case Zs:o=new qa(i.coordinates.map((function(e){return new Ma(e[0],e[1])})));break;case Qs:o=new Fa(i.coordinates.map((function(e){return new qa(e.map((function(e){var t=Na(e,2),n=t[0],r=t[1];return new Ma(n,r)})))})));break;case ea:o=new $a(i.coordinates.map((function(e){return new Ma(e[0],e[1])})));break;case ta:o=new Ka(i.coordinates.map((function(e){return new qa(e.map((function(e){var t=Na(e,2),n=t[0],r=t[1];return new Ma(n,r)})))})));break;case na:o=new Ja(i.coordinates.map((function(e){return new Fa(e.map((function(e){return new qa(e.map((function(e){var t=Na(e,2),n=t[0],r=t[1];return new Ma(n,r)})))})))})));break;case ra:o=new Date(1e3*i.$timestamp);break;case zs:case Ys:o=e.formatField(i);break;case oa:o=new Date(i.$date);break;default:o=i}Array.isArray(r)?r.push(o):r[n]=o})),r},e.whichType=function(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(t===ra)return ia;if(t===zs){if(e instanceof Ma)return Xs;if(e instanceof Date)return ra;if(e instanceof Oa)return oa;e.$timestamp?t=ra:e.$date?t=oa:Ma.validate(e)?t=Xs:qa.validate(e)?t=Zs:Fa.validate(e)?t=Qs:$a.validate(e)?t=ea:Ka.validate(e)?t=ta:Ja.validate(e)&&(t=na)}return t},e.generateDocId=function(){for(var e="ABCDEFabcdef0123456789",t="",n=0;n<24;n++)t+=e.charAt(Math.floor(22*Math.random()));return t},e}(),Ra=function(){function e(){}return e.isGeopoint=function(e,t){if(xa.whichType(t)!==Js)throw new Error("Geo Point must be number type");var n=Math.abs(t);if("latitude"===e&&n>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===e&&n>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0},e.isInteger=function(e,t){if(!Number.isInteger(t))throw new Error(e+Hs.IntergerError);return!0},e.isFieldOrder=function(e){if(-1===sa.indexOf(e))throw new Error(Hs.DirectionError);return!0},e.isFieldPath=function(e){if(!/^[a-zA-Z0-9-_\.]/.test(e))throw new Error;return!0},e.isOperator=function(e){if(-1===aa.indexOf(e))throw new Error(Hs.OpStrError);return!0},e.isCollName=function(e){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(e))throw new Error(Hs.CollNameError);return!0},e.isDocID=function(e){if(!/^([a-fA-F0-9]){24}$/.test(e))throw new Error(Hs.DocIDError);return!0},e}(),Pa=function(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()},ka=function(e){return"object"===Pa(e)},Ca=function(e){return"number"===Pa(e)},La=function(e){return Array.isArray(e)},Da=function(e){return"date"===Pa(e)},ja=function(e){return"regexp"===Pa(e)},Ua=function(e){return e&&e._internalType instanceof fa},Ma=function(){function e(e,t){Ra.isGeopoint("longitude",e),Ra.isGeopoint("latitude",t),this.longitude=e,this.latitude=t}return e.prototype.parse=function(e){var t;return(t={})[e]={type:"Point",coordinates:[this.longitude,this.latitude]},t},e.prototype.toJSON=function(){return{type:"Point",coordinates:[this.longitude,this.latitude]}},e.prototype.toReadableString=function(){return"["+this.longitude+","+this.latitude+"]"},e.validate=function(e){return"Point"===e.type&&La(e.coordinates)&&Ra.isGeopoint("longitude",e.coordinates[0])&&Ra.isGeopoint("latitude",e.coordinates[1])},Object.defineProperty(e.prototype,"_internalType",{get:function(){return va},enumerable:!0,configurable:!0}),e}(),Ba=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},qa=function(){function e(e){if(!La(e))throw new TypeError('"points" must be of type Point[]. Received type '+typeof e);if(e.length<2)throw new Error('"points" must contain 2 points at least');e.forEach((function(e){if(!(e instanceof Ma))throw new TypeError('"points" must be of type Point[]. Received type '+typeof e+"[]")})),this.points=e}return e.prototype.parse=function(e){var t;return(t={})[e]={type:"LineString",coordinates:this.points.map((function(e){return e.toJSON().coordinates}))},t},e.prototype.toJSON=function(){return{type:"LineString",coordinates:this.points.map((function(e){return e.toJSON().coordinates}))}},e.validate=function(e){var t,n;if("LineString"!==e.type||!La(e.coordinates))return!1;try{for(var r=Ba(e.coordinates),o=r.next();!o.done;o=r.next()){var i=o.value;if(!Ca(i[0])||!Ca(i[1]))return!1}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return!0},e.isClosed=function(e){var t=e.points[0],n=e.points[e.points.length-1];if(t.latitude===n.latitude&&t.longitude===n.longitude)return!0},Object.defineProperty(e.prototype,"_internalType",{get:function(){return _a},enumerable:!0,configurable:!0}),e}(),Wa=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Fa=function(){function e(e){if(!La(e))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof e);if(0===e.length)throw new Error("Polygon must contain 1 linestring at least");e.forEach((function(e){if(!(e instanceof qa))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof e+"[]");if(!qa.isClosed(e))throw new Error("LineString "+e.points.map((function(e){return e.toReadableString()}))+" is not a closed cycle")})),this.lines=e}return e.prototype.parse=function(e){var t;return(t={})[e]={type:"Polygon",coordinates:this.lines.map((function(e){return e.points.map((function(e){return[e.longitude,e.latitude]}))}))},t},e.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.lines.map((function(e){return e.points.map((function(e){return[e.longitude,e.latitude]}))}))}},e.validate=function(e){var t,n,r,o;if("Polygon"!==e.type||!La(e.coordinates))return!1;try{for(var i=Wa(e.coordinates),s=i.next();!s.done;s=i.next()){var a=s.value;if(!this.isCloseLineString(a))return!1;try{for(var c=(r=void 0,Wa(a)),u=c.next();!u.done;u=c.next()){var l=u.value;if(!Ca(l[0])||!Ca(l[1]))return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return!0},e.isCloseLineString=function(e){var t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]},Object.defineProperty(e.prototype,"_internalType",{get:function(){return Ea},enumerable:!0,configurable:!0}),e}(),Ha=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},$a=function(){function e(e){if(!La(e))throw new TypeError('"points" must be of type Point[]. Received type '+typeof e);if(0===e.length)throw new Error('"points" must contain 1 point at least');e.forEach((function(e){if(!(e instanceof Ma))throw new TypeError('"points" must be of type Point[]. Received type '+typeof e+"[]")})),this.points=e}return e.prototype.parse=function(e){var t;return(t={})[e]={type:"MultiPoint",coordinates:this.points.map((function(e){return e.toJSON().coordinates}))},t},e.prototype.toJSON=function(){return{type:"MultiPoint",coordinates:this.points.map((function(e){return e.toJSON().coordinates}))}},e.validate=function(e){var t,n;if("MultiPoint"!==e.type||!La(e.coordinates))return!1;try{for(var r=Ha(e.coordinates),o=r.next();!o.done;o=r.next()){var i=o.value;if(!Ca(i[0])||!Ca(i[1]))return!1}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return!0},Object.defineProperty(e.prototype,"_internalType",{get:function(){return ba},enumerable:!0,configurable:!0}),e}(),Ga=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ka=function(){function e(e){if(!La(e))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof e);if(0===e.length)throw new Error("Polygon must contain 1 linestring at least");e.forEach((function(e){if(!(e instanceof qa))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof e+"[]")})),this.lines=e}return e.prototype.parse=function(e){var t;return(t={})[e]={type:"MultiLineString",coordinates:this.lines.map((function(e){return e.points.map((function(e){return[e.longitude,e.latitude]}))}))},t},e.prototype.toJSON=function(){return{type:"MultiLineString",coordinates:this.lines.map((function(e){return e.points.map((function(e){return[e.longitude,e.latitude]}))}))}},e.validate=function(e){var t,n,r,o;if("MultiLineString"!==e.type||!La(e.coordinates))return!1;try{for(var i=Ga(e.coordinates),s=i.next();!s.done;s=i.next()){var a=s.value;try{for(var c=(r=void 0,Ga(a)),u=c.next();!u.done;u=c.next()){var l=u.value;if(!Ca(l[0])||!Ca(l[1]))return!1}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return!0},Object.defineProperty(e.prototype,"_internalType",{get:function(){return wa},enumerable:!0,configurable:!0}),e}(),Va=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ja=function(){function e(e){var t,n;if(!La(e))throw new TypeError('"polygons" must be of type Polygon[]. Received type '+typeof e);if(0===e.length)throw new Error("MultiPolygon must contain 1 polygon at least");try{for(var r=Va(e),o=r.next();!o.done;o=r.next()){var i=o.value;if(!(i instanceof Fa))throw new TypeError('"polygon" must be of type Polygon[]. Received type '+typeof i+"[]")}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}this.polygons=e}return e.prototype.parse=function(e){var t;return(t={})[e]={type:"MultiPolygon",coordinates:this.polygons.map((function(e){return e.lines.map((function(e){return e.points.map((function(e){return[e.longitude,e.latitude]}))}))}))},t},e.prototype.toJSON=function(){return{type:"MultiPolygon",coordinates:this.polygons.map((function(e){return e.lines.map((function(e){return e.points.map((function(e){return[e.longitude,e.latitude]}))}))}))}},e.validate=function(e){var t,n,r,o,i,s;if("MultiPolygon"!==e.type||!La(e.coordinates))return!1;try{for(var a=Va(e.coordinates),c=a.next();!c.done;c=a.next()){var u=c.value;try{for(var l=(r=void 0,Va(u)),f=l.next();!f.done;f=l.next()){var h=f.value;try{for(var p=(i=void 0,Va(h)),d=p.next();!d.done;d=p.next()){var y=d.value;if(!Ca(y[0])||!Ca(y[1]))return!1}}catch(e){i={error:e}}finally{try{d&&!d.done&&(s=p.return)&&s.call(p)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return!0},Object.defineProperty(e.prototype,"_internalType",{get:function(){return ma},enumerable:!0,configurable:!0}),e}(),za=Object.freeze({__proto__:null,LineString:qa,MultiLineString:Ka,MultiPoint:$a,MultiPolygon:Ja,Point:Ma,Polygon:Fa}),Ya=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var n=new Promise((function(t,n){e=function(e,r){return e?n(e):t(r)}}));return e.promise=n,e};!function(e){e.SET="set",e.REMOVE="remove",e.INC="inc",e.MUL="mul",e.PUSH="push",e.PULL="pull",e.PULL_ALL="pullAll",e.POP="pop",e.SHIFT="shift",e.UNSHIFT="unshift",e.ADD_TO_SET="addToSet",e.BIT="bit",e.RENAME="rename",e.MAX="max",e.MIN="min"}(Ta||(Ta={}));var Xa,Za=function(){function e(e,t,n){this._internalType=da,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=e,this.operands=t,this.fieldName=n||pa}return e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e}();function Qa(e){return e&&e instanceof Za&&e._internalType===da}!function(e){e.AND="and",e.OR="or",e.NOT="not",e.NOR="nor"}(Xa||(Xa={}));var ec=function(){function e(e,t,n){if(this._internalType=ga,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=e,this.operands=t,this.fieldName=n||pa,this.fieldName!==pa)if(Array.isArray(t)){t=t.slice(),this.operands=t;for(var r=0,o=t.length;r<o;r++){(tc(i=t[r])||ic(i))&&(t[r]=i._setFieldName(this.fieldName))}}else{var i;(tc(i=t)||ic(i))&&(t=i._setFieldName(this.fieldName))}}return e.prototype._setFieldName=function(t){var n=this.operands.map((function(n){return n instanceof e?n._setFieldName(t):n}));return new e(this.operator,n,t)},e.prototype.and=function(){var t=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return t.unshift(this),new e(Xa.AND,t,this.fieldName)},e.prototype.or=function(){var t=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return t.unshift(this),new e(Xa.OR,t,this.fieldName)},e}();function tc(e){return e&&e instanceof ec&&e._internalType===ga}var nc,rc=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(e){e.EQ="eq",e.NEQ="neq",e.GT="gt",e.GTE="gte",e.LT="lt",e.LTE="lte",e.IN="in",e.NIN="nin",e.ALL="all",e.ELEM_MATCH="elemMatch",e.EXISTS="exists",e.SIZE="size",e.MOD="mod",e.GEO_NEAR="geoNear",e.GEO_WITHIN="geoWithin",e.GEO_INTERSECTS="geoIntersects"}(nc||(nc={}));var oc=function(e){function t(t,n,r){var o=e.call(this,t,n,r)||this;return o.operator=t,o._internalType=ya,o}return rc(t,e),t.prototype.toJSON=function(){var e,t;switch(this.operator){case nc.IN:case nc.NIN:return(e={})["$"+this.operator]=this.operands,e;default:return(t={})["$"+this.operator]=this.operands[0],t}},t.prototype._setFieldName=function(e){return new t(this.operator,this.operands,e)},t.prototype.eq=function(e){var n=new t(nc.EQ,[e],this.fieldName);return this.and(n)},t.prototype.neq=function(e){var n=new t(nc.NEQ,[e],this.fieldName);return this.and(n)},t.prototype.gt=function(e){var n=new t(nc.GT,[e],this.fieldName);return this.and(n)},t.prototype.gte=function(e){var n=new t(nc.GTE,[e],this.fieldName);return this.and(n)},t.prototype.lt=function(e){var n=new t(nc.LT,[e],this.fieldName);return this.and(n)},t.prototype.lte=function(e){var n=new t(nc.LTE,[e],this.fieldName);return this.and(n)},t.prototype.in=function(e){var n=new t(nc.IN,e,this.fieldName);return this.and(n)},t.prototype.nin=function(e){var n=new t(nc.NIN,e,this.fieldName);return this.and(n)},t.prototype.geoNear=function(e){if(!(e.geometry instanceof Ma))throw new TypeError('"geometry" must be of type Point. Received type '+typeof e.geometry);if(void 0!==e.maxDistance&&!Ca(e.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof e.maxDistance);if(void 0!==e.minDistance&&!Ca(e.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof e.minDistance);var n=new t(nc.GEO_NEAR,[e],this.fieldName);return this.and(n)},t.prototype.geoWithin=function(e){if(!(e.geometry instanceof Ja||e.geometry instanceof Fa))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof e.geometry);var n=new t(nc.GEO_WITHIN,[e],this.fieldName);return this.and(n)},t.prototype.geoIntersects=function(e){if(!(e.geometry instanceof Ma||e.geometry instanceof qa||e.geometry instanceof Fa||e.geometry instanceof $a||e.geometry instanceof Ka||e.geometry instanceof Ja))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof e.geometry);var n=new t(nc.GEO_INTERSECTS,[e],this.fieldName);return this.and(n)},t}(ec);function ic(e){return e&&e instanceof oc&&e._internalType===ya}function sc(e){return ic(e)}var ac={};for(var cc in nc)ac[cc]="$"+cc;for(var cc in Xa)ac[cc]="$"+cc;for(var cc in Ta)ac[cc]="$"+cc;function uc(e){return ac[e]||"$"+e}ac[nc.NEQ]="$ne",ac[Ta.REMOVE]="$unset",ac[Ta.SHIFT]="$pop",ac[Ta.UNSHIFT]="$push";var lc=function(){return lc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},lc.apply(this,arguments)},fc=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},hc=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(fc(arguments[t]));return e};function pc(e){return dc(e,[e])}function dc(e,t){if(!Ua(e)){if(Da(e))return{$date:+e};if(ja(e))return{$regex:e.source,$options:e.flags};if(La(e))return e.map((function(e){if(t.indexOf(e)>-1)throw new Error("Cannot convert circular structure to JSON");return dc(e,hc(t,[e]))}));if(ka(e)){var n=lc({},e);for(var r in n){if(t.indexOf(n[r])>-1)throw new Error("Cannot convert circular structure to JSON");n[r]=dc(n[r],hc(t,[n[r]]))}return n}return e}switch(e._internalType){case va:return e.toJSON();case Sa:case Ia:return e.parse();default:return e.toJSON?e.toJSON():e}}var yc=function(){return yc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},yc.apply(this,arguments)},gc=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},vc=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(gc(arguments[t]));return e};function _c(e,t,n,r){var o=yc({},e);for(var i in e)if(!/^\$/.test(i)){var s=e[i];if(s&&ka(s)&&!t(s)){if(r.indexOf(s)>-1)throw new Error("Cannot convert circular structure to JSON");var a=_c(s,t,vc(n,[i]),vc(r,[s]));o[i]=a;var c=!1;for(var u in a)/^\$/.test(u)?c=!0:(o[i+"."+u]=a[u],delete o[i][u]);c||delete o[i]}}return o}function mc(e){return _c(e,wc,[],[e])}function bc(e,t,n){for(var r in t[n]||delete e[n],t)e[r]?La(e[r])?e[r].push(t[r]):ka(e[r])?ka(t[r])?Object.assign(e[r],t[r]):(console.warn("unmergable condition, query is object but condition is "+Pa(t)+", can only overwrite",t,n),e[r]=t[r]):(console.warn("to-merge query is of type "+Pa(e)+", can only overwrite",e,t,n),e[r]=t[r]):e[r]=t[r]}function wc(e){return Ua(e)||Da(e)||ja(e)}function Ec(e){return pc(e)}var Sc=function(){function e(){}return e.encode=function(t){return(new e).encodeUpdate(t)},e.prototype.encodeUpdate=function(e){return Qa(e)?this.encodeUpdateCommand(e):"object"===Pa(e)?this.encodeUpdateObject(e):e},e.prototype.encodeUpdateCommand=function(e){if(e.fieldName===pa)throw new Error("Cannot encode a comparison command with unset field name");switch(e.operator){case Ta.PUSH:case Ta.PULL:case Ta.PULL_ALL:case Ta.POP:case Ta.SHIFT:case Ta.UNSHIFT:case Ta.ADD_TO_SET:return this.encodeArrayUpdateCommand(e);default:return this.encodeFieldUpdateCommand(e)}},e.prototype.encodeFieldUpdateCommand=function(e){var t,n,r,o,i=uc(e.operator);return e.operator===Ta.REMOVE?((t={})[i]=((n={})[e.fieldName]="",n),t):((r={})[i]=((o={})[e.fieldName]=e.operands[0],o),r)},e.prototype.encodeArrayUpdateCommand=function(e){var t,n,r,o,i,s,a,c,u,l,f=uc(e.operator);switch(e.operator){case Ta.PUSH:var h=void 0;return h=La(e.operands)?{$each:e.operands.map(Ec)}:e.operands,(t={})[f]=((n={})[e.fieldName]=h,n),t;case Ta.UNSHIFT:h={$each:e.operands.map(Ec),$position:0};return(r={})[f]=((o={})[e.fieldName]=h,o),r;case Ta.POP:return(i={})[f]=((s={})[e.fieldName]=1,s),i;case Ta.SHIFT:return(a={})[f]=((c={})[e.fieldName]=-1,c),a;default:return(u={})[f]=((l={})[e.fieldName]=Ec(e.operands),l),u}},e.prototype.encodeUpdateObject=function(e){var t=mc(e);for(var n in t)if(!/^\$/.test(n)){var r=t[n];if(Qa(r)){t[n]=r._setFieldName(n),bc(t,this.encodeUpdateCommand(t[n]),n)}else{t[n]=r=Ec(r);var o=new Za(Ta.SET,[r],n);bc(t,this.encodeUpdateCommand(o),n)}}return t},e}(),Ic={};function Oc(e){if(!yl.wsClientClass)throw new Error("to use realtime you must import realtime module first");var t=e.config.env;return Ic[t]||(Ic[t]=new yl.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:new yl.reqClass(e.config)}}})),Ic[t]}var Ac=function(){return Ac=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ac.apply(this,arguments)},Tc=function(){function e(e,t,n,r){var o=this;void 0===r&&(r={}),this.watch=function(e){return Oc(o._db).watch(Ac(Ac({},e),{envId:o._db.config.env,collectionName:o._coll,query:JSON.stringify({_id:o.id})}))},this._db=e,this._coll=t,this.id=n,this.request=new yl.reqClass(this._db.config),this.projection=r}return e.prototype.create=function(e,t){t=t||Ya();var n={collectionName:this._coll,data:pc(e)};return this.id&&(n._id=this.id),this.request.send("database.addDocument",n).then((function(e){e.code?t(0,e):t(0,{id:e.data._id,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},e.prototype.set=function(e,t){if(t=t||Ya(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!e||"object"!=typeof e)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(e.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n=!1,r=function(e){if("object"==typeof e)for(var t in e)e[t]instanceof Za?n=!0:"object"==typeof e[t]&&r(e[t])};if(r(e),n)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});var o={collectionName:this._coll,queryType:Vs.DOC,data:pc(e),multi:!1,merge:!1,upsert:!0};return this.id&&(o.query={_id:this.id}),this.request.send("database.updateDocument",o).then((function(e){e.code?t(0,e):t(0,{updated:e.data.updated,upsertedId:e.data.upserted_id,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},e.prototype.update=function(e,t){if(t=t||Ya(),!e||"object"!=typeof e)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(e.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={_id:this.id},r={collectionName:this._coll,data:Sc.encode(e),query:n,queryType:Vs.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",r).then((function(e){e.code?t(0,e):t(0,{updated:e.data.updated,upsertedId:e.data.upserted_id,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},e.prototype.remove=function(e){e=e||Ya();var t={_id:this.id},n={collectionName:this._coll,query:t,queryType:Vs.DOC,multi:!1};return this.request.send("database.deleteDocument",n).then((function(t){t.code?e(0,t):e(0,{deleted:t.data.deleted,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},e.prototype.get=function(e){e=e||Ya();var t={_id:this.id},n={collectionName:this._coll,query:t,queryType:Vs.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",n).then((function(t){if(t.code)e(0,t);else{var n=xa.formatResDocumentData(t.data.list);e(0,{data:n,requestId:t.requestId,total:t.TotalCount,limit:t.Limit,offset:t.Offset})}})).catch((function(t){e(t)})),e.promise},e.prototype.field=function(t){for(var n in t)t[n]?t[n]=1:t[n]=0;return new e(this._db,this._coll,this.id,t)},e}(),Nc=function(){function e(){}return e.encode=function(e){return(new xc).encodeQuery(e)},e}(),xc=function(){function e(){}return e.prototype.encodeQuery=function(e,t){var n;return wc(e)?tc(e)?this.encodeLogicCommand(e):ic(e)?this.encodeQueryCommand(e):((n={})[t]=this.encodeQueryObject(e),n):ka(e)?this.encodeQueryObject(e):e},e.prototype.encodeRegExp=function(e){return{$regex:e.source,$options:e.flags}},e.prototype.encodeLogicCommand=function(e){var t,n,r,o,i,s,a,c=this;switch(e.operator){case Xa.NOR:case Xa.AND:case Xa.OR:var u=uc(e.operator),l=e.operands.map((function(t){return c.encodeQuery(t,e.fieldName)}));return(t={})[u]=l,t;case Xa.NOT:u=uc(e.operator);var f=e.operands[0];if(ja(f))return(n={})[e.fieldName]=((r={})[u]=this.encodeRegExp(f),r),n;l=this.encodeQuery(f)[e.fieldName];return(o={})[e.fieldName]=((i={})[u]=l,i),o;default:u=uc(e.operator);if(1===e.operands.length){var h=this.encodeQuery(e.operands[0]);return(s={})[u]=h,s}l=e.operands.map(this.encodeQuery.bind(this));return(a={})[u]=l,a}},e.prototype.encodeQueryCommand=function(e){return sc(e),this.encodeComparisonCommand(e)},e.prototype.encodeComparisonCommand=function(e){var t,n,r,o,i,s,a,c,u;if(e.fieldName===pa)throw new Error("Cannot encode a comparison command with unset field name");var l=uc(e.operator);switch(e.operator){case nc.EQ:case nc.NEQ:case nc.LT:case nc.LTE:case nc.GT:case nc.GTE:case nc.ELEM_MATCH:case nc.EXISTS:case nc.SIZE:case nc.MOD:return(t={})[e.fieldName]=((n={})[l]=Ec(e.operands[0]),n),t;case nc.IN:case nc.NIN:case nc.ALL:return(r={})[e.fieldName]=((o={})[l]=Ec(e.operands),o),r;case nc.GEO_NEAR:var f=e.operands[0];return(i={})[e.fieldName]={$nearSphere:{$geometry:f.geometry.toJSON(),$maxDistance:f.maxDistance,$minDistance:f.minDistance}},i;case nc.GEO_WITHIN:f=e.operands[0];return(s={})[e.fieldName]={$geoWithin:{$geometry:f.geometry.toJSON()}},s;case nc.GEO_INTERSECTS:f=e.operands[0];return(a={})[e.fieldName]={$geoIntersects:{$geometry:f.geometry.toJSON()}},a;default:return(c={})[e.fieldName]=((u={})[l]=Ec(e.operands[0]),u),c}},e.prototype.encodeQueryObject=function(e){var t=mc(e);for(var n in t){var r=t[n];if(tc(r)){t[n]=r._setFieldName(n);var o=this.encodeLogicCommand(t[n]);this.mergeConditionAfterEncode(t,o,n)}else if(sc(r)){t[n]=r._setFieldName(n);o=this.encodeComparisonCommand(t[n]);this.mergeConditionAfterEncode(t,o,n)}else wc(r)&&(t[n]=Ec(r))}return t},e.prototype.mergeConditionAfterEncode=function(e,t,n){for(var r in t[n]||delete e[n],t)e[r]?La(e[r])?e[r]=e[r].concat(t[r]):ka(e[r])?ka(t[r])?Object.assign(e,t):(console.warn("unmergable condition, query is object but condition is "+Pa(t)+", can only overwrite",t,n),e[r]=t[r]):(console.warn("to-merge query is of type "+Pa(e)+", can only overwrite",e,t,n),e[r]=t[r]):e[r]=t[r]},e}(),Rc=function(){return Rc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Rc.apply(this,arguments)},Pc=function(){function e(e,t,n,r,o){var i=this;this.watch=function(e){return Oc(i._db).watch(Rc(Rc({},e),{envId:i._db.config.env,collectionName:i._coll,query:JSON.stringify(i._fieldFilters||{}),limit:i._queryOptions.limit,orderBy:i._fieldOrders?i._fieldOrders.reduce((function(e,t){return e[t.field]=t.direction,e}),{}):void 0}))},this._db=e,this._coll=t,this._fieldFilters=n,this._fieldOrders=r||[],this._queryOptions=o||{},this._request=new yl.reqClass(this._db.config)}return e.prototype.get=function(e){e=e||Ya();var t=[];this._fieldOrders&&this._fieldOrders.forEach((function(e){t.push(e)}));var n={collectionName:this._coll,queryType:Vs.WHERE};return this._fieldFilters&&(n.query=this._fieldFilters),t.length>0&&(n.order=t),this._queryOptions.offset&&(n.offset=this._queryOptions.offset),this._queryOptions.limit?n.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:n.limit=100,this._queryOptions.projection&&(n.projection=this._queryOptions.projection),this._request.send("database.queryDocument",n).then((function(t){if(t.code)e(0,t);else{var n={data:xa.formatResDocumentData(t.data.list),requestId:t.requestId};t.TotalCount&&(n.total=t.TotalCount),t.Limit&&(n.limit=t.Limit),t.Offset&&(n.offset=t.Offset),e(0,n)}})).catch((function(t){e(t)})),e.promise},e.prototype.count=function(e){e=e||Ya();var t={collectionName:this._coll,queryType:Vs.WHERE};return this._fieldFilters&&(t.query=this._fieldFilters),this._request.send("database.countDocument",t).then((function(t){t.code?e(0,t):e(0,{requestId:t.requestId,total:t.data.total})})).catch((function(t){e(t)})),e.promise},e.prototype.where=function(t){if("Object"!==Object.prototype.toString.call(t).slice(8,-1))throw Error(Hs.QueryParamTypeError);var n=Object.keys(t),r=n.some((function(e){return void 0!==t[e]}));if(n.length&&!r)throw Error(Hs.QueryParamValueError);return new e(this._db,this._coll,Nc.encode(t),this._fieldOrders,this._queryOptions)},e.prototype.orderBy=function(t,n){Ra.isFieldPath(t),Ra.isFieldOrder(n);var r={field:t,direction:n},o=this._fieldOrders.concat(r);return new e(this._db,this._coll,this._fieldFilters,o,this._queryOptions)},e.prototype.limit=function(t){Ra.isInteger("limit",t);var n=Rc({},this._queryOptions);return n.limit=t,new e(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},e.prototype.skip=function(t){Ra.isInteger("offset",t);var n=Rc({},this._queryOptions);return n.offset=t,new e(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},e.prototype.update=function(e,t){if(t=t||Ya(),!e||"object"!=typeof e)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(e.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={collectionName:this._coll,query:this._fieldFilters,queryType:Vs.WHERE,multi:!0,merge:!0,upsert:!1,data:Sc.encode(e)};return this._request.send("database.updateDocument",n).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,updated:e.data.updated,upsertId:e.data.upsert_id})})).catch((function(e){t(e)})),t.promise},e.prototype.field=function(t){for(var n in t)t[n]?"object"!=typeof t[n]&&(t[n]=1):t[n]=0;var r=Rc({},this._queryOptions);return r.projection=t,new e(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},e.prototype.remove=function(e){e=e||Ya(),Object.keys(this._queryOptions).length>0&&console.warn("`offset`, `limit` and `projection` are not supported in remove() operation"),this._fieldOrders.length>0&&console.warn("`orderBy` is not supported in remove() operation");var t={collectionName:this._coll,query:Nc.encode(this._fieldFilters),queryType:Vs.WHERE,multi:!0};return this._request.send("database.deleteDocument",t).then((function(t){t.code?e(0,t):e(0,{requestId:t.requestId,deleted:t.data.deleted})})).catch((function(t){e(t)})),e.promise},e}(),kc=function(e,t){return kc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},kc(e,t)};function Cc(e,t){function n(){this.constructor=e}kc(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Lc=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return Cc(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t}(Error),Dc=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return Cc(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t}(TypeError);function jc(e){return e&&e.Math==Math&&e}function Uc(){return jc("object"==typeof globalThis&&globalThis)||jc("object"==typeof window&&window)||jc("object"==typeof self&&self)||jc("object"==typeof global&&global)||Function("return this")()}var Mc=function(t){var n,r="object"==typeof(n=Uc()).navigator&&"ReactNative"===n.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(r);for(var o=e.alloc(t),i=0;i<t;++i)o[i]=Math.floor(256*Math.random());return o},Bc=function(){var e=void 0;try{e=require("crypto").randomBytes}catch(e){}return e||Mc}();function qc(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)}function Wc(e){return"object"==typeof e&&null!==e}function Fc(e,t){var n=!1;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return n||(console.warn(t),n=!0),e.apply(this,r)}}function Hc(t){if(ArrayBuffer.isView(t))return e.from(t.buffer,t.byteOffset,t.byteLength);if(n=t,["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(n)))return e.from(t);var n;throw new Dc("Must use either Buffer or TypedArray")}var $c=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,Gc=function(e){return"string"==typeof e&&$c.test(e)},Kc=function(t){if(!Gc(t))throw new Dc('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var n=t.replace(/-/g,"");return e.from(n,"hex")},Vc=function(e,t){return void 0===t&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")},Jc=Math.pow(2,53),zc=-Math.pow(2,53),Yc=function(){function t(n,r){if(!(this instanceof t))return new t(n,r);if(!(null==n||"string"==typeof n||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||Array.isArray(n)))throw new Dc("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=r?r:t.BSON_BINARY_SUBTYPE_DEFAULT,null==n?(this.buffer=e.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof n?this.buffer=e.from(n,"binary"):Array.isArray(n)?this.buffer=e.from(n):this.buffer=Hc(n),this.position=this.buffer.byteLength)}return t.prototype.put=function(n){if("string"==typeof n&&1!==n.length)throw new Dc("only accepts single character String");if("number"!=typeof n&&1!==n.length)throw new Dc("only accepts single character Uint8Array or Array");var r;if((r="string"==typeof n?n.charCodeAt(0):"number"==typeof n?n:n[0])<0||r>255)throw new Dc("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var o=e.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o,this.buffer[this.position++]=r}},t.prototype.write=function(t,n){if(n="number"==typeof n?n:this.position,this.buffer.length<n+t.length){var r=e.alloc(this.buffer.length+t.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}ArrayBuffer.isView(t)?(this.buffer.set(Hc(t),n),this.position=n+t.byteLength>this.position?n+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,n,t.length,"binary"),this.position=n+t.length>this.position?n+t.length:this.position)},t.prototype.read=function(e,t){return t=t&&t>0?t:this.position,this.buffer.slice(e,e+t)},t.prototype.value=function(e){return(e=!!e)&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var t=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:t,$type:1===n.length?"0"+n:n}:{$binary:{base64:t,subType:1===n.length?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new Xc(this.buffer.slice(0,this.position));throw new Lc('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(n,r){var o,i;if(r=r||{},"$binary"in n?r.legacy&&"string"==typeof n.$binary&&"$type"in n?(i=n.$type?parseInt(n.$type,16):0,o=e.from(n.$binary,"base64")):"string"!=typeof n.$binary&&(i=n.$binary.subType?parseInt(n.$binary.subType,16):0,o=e.from(n.$binary.base64,"base64")):"$uuid"in n&&(i=4,o=Kc(n.$uuid)),!o)throw new Dc("Unexpected Binary Extended JSON format ".concat(JSON.stringify(n)));return 4===i?new Xc(o):new t(o,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(Yc.prototype,"_bsontype",{value:"Binary"});var Xc=function(t){function n(r){var o,i,s=this;if(null==r)o=n.generate();else if(r instanceof n)o=e.from(r.buffer),i=r.__id;else if(ArrayBuffer.isView(r)&&16===r.byteLength)o=Hc(r);else{if("string"!=typeof r)throw new Dc("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");o=Kc(r)}return(s=t.call(this,o,4)||this).__id=i,s}return Cc(n,t),Object.defineProperty(n.prototype,"id",{get:function(){return this.buffer},set:function(e){this.buffer=e,n.cacheHexString&&(this.__id=Vc(e))},enumerable:!1,configurable:!0}),n.prototype.toHexString=function(e){if(void 0===e&&(e=!0),n.cacheHexString&&this.__id)return this.__id;var t=Vc(this.id,e);return n.cacheHexString&&(this.__id=t),t},n.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},n.prototype.toJSON=function(){return this.toHexString()},n.prototype.equals=function(e){if(!e)return!1;if(e instanceof n)return e.id.equals(this.id);try{return new n(e).id.equals(this.id)}catch(e){return!1}},n.prototype.toBinary=function(){return new Yc(this.id,Yc.SUBTYPE_UUID)},n.generate=function(){var t=Bc(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,e.from(t)},n.isValid=function(e){return!!e&&(e instanceof n||("string"==typeof e?Gc(e):!!qc(e)&&(16===e.length&&(64==(240&e[6])&&!(128&~e[8])))))},n.createFromHexString=function(e){return new n(Kc(e))},n.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},n.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},n}(Yc),Zc=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);this.code=t,this.scope=n}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},e}();Object.defineProperty(Zc.prototype,"_bsontype",{value:"Code"});var Qc=function(){function e(t,n,r,o){if(!(this instanceof e))return new e(t,n,r,o);var i=t.split(".");2===i.length&&(r=i.shift(),t=i.shift()),this.collection=t,this.oid=n,this.db=r,this.fields=o||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(e.$db=this.db),e},e.prototype.toExtendedJSON=function(e){e=e||{};var t={$ref:this.collection,$id:this.oid};return e.legacy?t:(this.db&&(t.$db=this.db),t=Object.assign(t,this.fields))},e.fromExtendedJSON=function(t){var n=Object.assign({},t);return delete n.$ref,delete n.$id,delete n.$db,new e(t.$ref,t.$id,t.$db,n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},e}();Object.defineProperty(Qc.prototype,"_bsontype",{value:"DBRef"});var eu=void 0;try{eu=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(Fs){}var tu=4294967296,nu=0x10000000000000000,ru=nu/2,ou={},iu={},su=function(){function e(t,n,r){if(void 0===t&&(t=0),!(this instanceof e))return new e(t,n,r);"bigint"==typeof t?Object.assign(this,e.fromBigInt(t,!!n)):"string"==typeof t?Object.assign(this,e.fromString(t,!!n)):(this.low=0|t,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,n,r){return new e(t,n,r)},e.fromInt=function(t,n){var r,o,i;return n?(i=0<=(t>>>=0)&&t<256)&&(o=iu[t])?o:(r=e.fromBits(t,(0|t)<0?-1:0,!0),i&&(iu[t]=r),r):(i=-128<=(t|=0)&&t<128)&&(o=ou[t])?o:(r=e.fromBits(t,t<0?-1:0,!1),i&&(ou[t]=r),r)},e.fromNumber=function(t,n){if(isNaN(t))return n?e.UZERO:e.ZERO;if(n){if(t<0)return e.UZERO;if(t>=nu)return e.MAX_UNSIGNED_VALUE}else{if(t<=-ru)return e.MIN_VALUE;if(t+1>=ru)return e.MAX_VALUE}return t<0?e.fromNumber(-t,n).neg():e.fromBits(t%tu|0,t/tu|0,n)},e.fromBigInt=function(t,n){return e.fromString(t.toString(),n)},e.fromString=function(t,n,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var o;if((o=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return e.fromString(t.substring(1),n,r).neg();for(var i=e.fromNumber(Math.pow(r,8)),s=e.ZERO,a=0;a<t.length;a+=8){var c=Math.min(8,t.length-a),u=parseInt(t.substring(a,a+c),r);if(c<8){var l=e.fromNumber(Math.pow(r,c));s=s.mul(l).add(e.fromNumber(u))}else s=(s=s.mul(i)).add(e.fromNumber(u))}return s.unsigned=n,s},e.fromBytes=function(t,n,r){return r?e.fromBytesLE(t,n):e.fromBytesBE(t,n)},e.fromBytesLE=function(t,n){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)},e.fromBytesBE=function(t,n){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)},e.isLong=function(e){return Wc(e)&&!0===e.__isLong__},e.fromValue=function(t,n){return"number"==typeof t?e.fromNumber(t,n):"string"==typeof t?e.fromString(t,n):e.fromBits(t.low,t.high,"boolean"==typeof n?n:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var n=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,s=t.high>>>16,a=65535&t.high,c=t.low>>>16,u=0,l=0,f=0,h=0;return f+=(h+=i+(65535&t.low))>>>16,h&=65535,l+=(f+=o+c)>>>16,f&=65535,u+=(l+=r+a)>>>16,l&=65535,u+=n+s,u&=65535,e.fromBits(f<<16|h,u<<16|l,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(e){return this.compare(e)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(eu){if(!this.unsigned&&-2147483648===this.high&&-1===t.low&&-1===t.high)return this;var n=(this.unsigned?eu.div_u:eu.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,eu.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var r,o,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;i=e.UZERO}else{if(this.eq(e.MIN_VALUE))return t.eq(e.ONE)||t.eq(e.NEG_ONE)?e.MIN_VALUE:t.eq(e.MIN_VALUE)?e.ONE:(r=this.shr(1).div(t).shl(1)).eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(o=this.sub(t.mul(r)),i=r.add(o.div(t)));if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();i=e.ZERO}for(o=this;o.gte(t);){r=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),c=e.fromNumber(r),u=c.mul(t);u.isNegative()||u.gt(o);)r-=a,u=(c=e.fromNumber(r,this.unsigned)).mul(t);c.isZero()&&(c=e.ONE),i=i.add(c),o=o.sub(u)}return i},e.prototype.div=function(e){return this.divide(e)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},e.prototype.eq=function(e){return this.equals(e)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t,n=0!==this.high?this.high:this.low;for(t=31;t>0&&!(n&1<<t);t--);return 0!==this.high?t+33:t+1},e.prototype.greaterThan=function(e){return this.comp(e)>0},e.prototype.gt=function(e){return this.greaterThan(e)},e.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},e.prototype.gte=function(e){return this.greaterThanOrEqual(e)},e.prototype.ge=function(e){return this.greaterThanOrEqual(e)},e.prototype.isEven=function(){return!(1&this.low)},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return!(1&~this.low)},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return 0===this.high&&0===this.low},e.prototype.lessThan=function(e){return this.comp(e)<0},e.prototype.lt=function(e){return this.lessThan(e)},e.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},e.prototype.lte=function(e){return this.lessThanOrEqual(e)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),eu){var n=(this.unsigned?eu.rem_u:eu.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,eu.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(e){return this.modulo(e)},e.prototype.rem=function(e){return this.modulo(e)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),eu){var n=eu.mul(this.low,this.high,t.low,t.high);return e.fromBits(n,eu.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,s=65535&this.low,a=t.high>>>16,c=65535&t.high,u=t.low>>>16,l=65535&t.low,f=0,h=0,p=0,d=0;return p+=(d+=s*l)>>>16,d&=65535,h+=(p+=i*l)>>>16,p&=65535,h+=(p+=s*u)>>>16,p&=65535,f+=(h+=o*l)>>>16,h&=65535,f+=(h+=i*u)>>>16,h&=65535,f+=(h+=s*c)>>>16,h&=65535,f+=r*l+o*u+i*c+s*a,f&=65535,e.fromBits(p<<16|d,f<<16|h,this.unsigned)},e.prototype.mul=function(e){return this.multiply(e)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(e){return!this.equals(e)},e.prototype.neq=function(e){return this.notEquals(e)},e.prototype.ne=function(e){return this.notEquals(e)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(e){return this.shiftLeft(e)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(e){return this.shiftRight(e)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),0===(t&=63))return this;var n=this.high;if(t<32){var r=this.low;return e.fromBits(r>>>t|n<<32-t,n>>>t,this.unsigned)}return 32===t?e.fromBits(n,0,this.unsigned):e.fromBits(n>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},e.prototype.shru=function(e){return this.shiftRightUnsigned(e)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(e){return this.subtract(e)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*tu+(this.low>>>0):this.high*tu+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},e.prototype.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(e.MIN_VALUE)){var n=e.fromNumber(t),r=this.div(n),o=r.mul(n).sub(this);return r.toString(t)+o.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var i=e.fromNumber(Math.pow(t,6),this.unsigned),s=this,a="";;){var c=s.div(i),u=(s.sub(c.mul(i)).toInt()>>>0).toString(t);if((s=c).isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(e){return this.lessThanOrEqual(e)},e.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,n){var r=e.fromString(t.$numberLong);return n&&n.relaxed?r.toNumber():r},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},e.TWO_PWR_24=e.fromInt(16777216),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e}();Object.defineProperty(su.prototype,"__isLong__",{value:!0}),Object.defineProperty(su.prototype,"_bsontype",{value:"Long"});var au=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,cu=/^(\+|-)?(Infinity|inf)$/i,uu=/^(\+|-)?NaN$/i,lu=6111,fu=-6176,hu=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),pu=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),du=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),yu=/^([-+])?(\d+)?$/;function gu(e){return!isNaN(parseInt(e,10))}function vu(e){var t=su.fromNumber(1e9),n=su.fromNumber(0);if(!(e.parts[0]||e.parts[1]||e.parts[2]||e.parts[3]))return{quotient:e,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new su(e.parts[r],0)),e.parts[r]=n.div(t).low,n=n.modulo(t);return{quotient:e,rem:n}}function _u(e,t){throw new Dc('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var mu=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!qc(e))throw new Dc("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new Dc("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}}return t.fromString=function(n){var r,o=!1,i=!1,s=!1,a=0,c=0,u=0,l=0,f=0,h=[0],p=0,d=0,y=0,g=0,v=0,_=0,m=new su(0,0),b=new su(0,0),w=0;if(n.length>=7e3)throw new Dc(n+" not a valid Decimal128 string");var E=n.match(au),S=n.match(cu),I=n.match(uu);if(!E&&!S&&!I||0===n.length)throw new Dc(n+" not a valid Decimal128 string");if(E){var O=E[2],A=E[4],T=E[5],N=E[6];A&&void 0===N&&_u(n,"missing exponent power"),A&&void 0===O&&_u(n,"missing exponent base"),void 0===A&&(T||N)&&_u(n,"missing e before exponent")}if("+"!==n[w]&&"-"!==n[w]||(o="-"===n[w++]),!gu(n[w])&&"."!==n[w]){if("i"===n[w]||"I"===n[w])return new t(e.from(o?pu:du));if("N"===n[w])return new t(e.from(hu))}for(;gu(n[w])||"."===n[w];)"."!==n[w]?(p<34&&("0"!==n[w]||s)&&(s||(f=c),s=!0,h[d++]=parseInt(n[w],10),p+=1),s&&(u+=1),i&&(l+=1),c+=1,w+=1):(i&&_u(n,"contains multiple periods"),i=!0,w+=1);if(i&&!c)throw new Dc(n+" not a valid Decimal128 string");if("e"===n[w]||"E"===n[w]){var x=n.substr(++w).match(yu);if(!x||!x[2])return new t(e.from(hu));v=parseInt(x[0],10),w+=x[0].length}if(n[w])return new t(e.from(hu));if(y=0,p){if(g=p-1,1!==(a=u))for(;0===h[f+a-1];)a-=1}else y=0,g=0,h[0]=0,u=1,p=1,a=0;for(v<=l&&l-v>16384?v=fu:v-=l;v>lu;){if((g+=1)-y>34){if(h.join("").match(/^0+$/)){v=lu;break}_u(n,"overflow")}v-=1}for(;v<fu||p<u;){if(0===g&&a<p){v=fu,a=0;break}if(p<u?u-=1:g-=1,v<lu)v+=1;else{if(h.join("").match(/^0+$/)){v=lu;break}_u(n,"overflow")}}if(g-y+1<a){var R=c;i&&(f+=1,R+=1),o&&(f+=1,R+=1);var P=parseInt(n[f+g+1],10),k=0;if(P>=5&&(k=1,5===P))for(k=h[g]%2==1?1:0,_=f+g+2;_<R;_++)if(parseInt(n[_],10)){k=1;break}if(k)for(var C=g;C>=0;C--)if(++h[C]>9&&(h[C]=0,0===C)){if(!(v<lu))return new t(e.from(o?pu:du));v+=1,h[C]=1}}if(m=su.fromNumber(0),b=su.fromNumber(0),0===a)m=su.fromNumber(0),b=su.fromNumber(0);else if(g-y<17){C=y;for(b=su.fromNumber(h[C++]),m=new su(0,0);C<=g;C++)b=(b=b.multiply(su.fromNumber(10))).add(su.fromNumber(h[C]))}else{C=y;for(m=su.fromNumber(h[C++]);C<=g-17;C++)m=(m=m.multiply(su.fromNumber(10))).add(su.fromNumber(h[C]));for(b=su.fromNumber(h[C++]);C<=g;C++)b=(b=b.multiply(su.fromNumber(10))).add(su.fromNumber(h[C]))}var L,D,j,U,M=function(e,t){if(!e&&!t)return{high:su.fromNumber(0),low:su.fromNumber(0)};var n=e.shiftRightUnsigned(32),r=new su(e.getLowBits(),0),o=t.shiftRightUnsigned(32),i=new su(t.getLowBits(),0),s=n.multiply(o),a=n.multiply(i),c=r.multiply(o),u=r.multiply(i);return s=s.add(a.shiftRightUnsigned(32)),a=new su(a.getLowBits(),0).add(c).add(u.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:u=a.shiftLeft(32).add(new su(u.getLowBits(),0))}}(m,su.fromString("100000000000000000"));M.low=M.low.add(b),L=M.low,D=b,j=L.high>>>0,U=D.high>>>0,(j<U||j===U&&L.low>>>0<D.low>>>0)&&(M.high=M.high.add(su.fromNumber(1))),r=v+6176;var B={low:su.fromNumber(0),high:su.fromNumber(0)};M.high.shiftRightUnsigned(49).and(su.fromNumber(1)).equals(su.fromNumber(1))?(B.high=B.high.or(su.fromNumber(3).shiftLeft(61)),B.high=B.high.or(su.fromNumber(r).and(su.fromNumber(16383).shiftLeft(47))),B.high=B.high.or(M.high.and(su.fromNumber(0x7fffffffffff)))):(B.high=B.high.or(su.fromNumber(16383&r).shiftLeft(49)),B.high=B.high.or(M.high.and(su.fromNumber(562949953421311)))),B.low=M.low,o&&(B.high=B.high.or(su.fromString("9223372036854775808")));var q=e.alloc(16);return w=0,q[w++]=255&B.low.low,q[w++]=B.low.low>>8&255,q[w++]=B.low.low>>16&255,q[w++]=B.low.low>>24&255,q[w++]=255&B.low.high,q[w++]=B.low.high>>8&255,q[w++]=B.low.high>>16&255,q[w++]=B.low.high>>24&255,q[w++]=255&B.high.low,q[w++]=B.high.low>>8&255,q[w++]=B.high.low>>16&255,q[w++]=B.high.low>>24&255,q[w++]=255&B.high.high,q[w++]=B.high.high>>8&255,q[w++]=B.high.high>>16&255,q[w++]=B.high.high>>24&255,new t(q)},t.prototype.toString=function(){for(var e,t=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var o,i,s,a=0,c=!1,u={parts:[0,0,0,0]},l=[];a=0;var f=this.bytes,h=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,p=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,d=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,y=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24;a=0,{low:new su(h,p),high:new su(d,y)}.high.lessThan(su.ZERO)&&l.push("-");var g=y>>26&31;if(g>>3==3){if(30===g)return l.join("")+"Infinity";if(31===g)return"NaN";e=y>>15&16383,o=8+(y>>14&1)}else o=y>>14&7,e=y>>17&16383;var v=e-6176;if(u.parts[0]=(16383&y)+((15&o)<<14),u.parts[1]=d,u.parts[2]=p,u.parts[3]=h,0===u.parts[0]&&0===u.parts[1]&&0===u.parts[2]&&0===u.parts[3])c=!0;else for(s=3;s>=0;s--){var _=0,m=vu(u);if(u=m.quotient,_=m.rem.low)for(i=8;i>=0;i--)n[9*s+i]=_%10,_=Math.floor(_/10)}if(c)t=1,n[a]=0;else for(t=36;!n[a];)t-=1,a+=1;var b=t-1+v;if(b>=34||b<=-7||v>0){if(t>34)return l.push("".concat(0)),v>0?l.push("E+".concat(v)):v<0&&l.push("E".concat(v)),l.join("");l.push("".concat(n[a++])),(t-=1)&&l.push(".");for(r=0;r<t;r++)l.push("".concat(n[a++]));l.push("E"),b>0?l.push("+".concat(b)):l.push("".concat(b))}else if(v>=0)for(r=0;r<t;r++)l.push("".concat(n[a++]));else{var w=t+v;if(w>0)for(r=0;r<w;r++)l.push("".concat(n[a++]));else l.push("0");for(l.push(".");w++<0;)l.push("0");for(r=0;r<t-Math.max(w-1,0);r++)l.push("".concat(n[a++]))}return l.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(mu.prototype,"_bsontype",{value:"Decimal128"});var bu=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(e){return this.value.toString(e)},e.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},e.fromExtendedJSON=function(t,n){var r=parseFloat(t.$numberDouble);return n&&n.relaxed?r:new e(r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},e}();Object.defineProperty(bu.prototype,"_bsontype",{value:"Double"});var wu=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=0|+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(e){return this.value.toString(e)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,n){return n&&n.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},e}();Object.defineProperty(wu.prototype,"_bsontype",{value:"Int32"});var Eu=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e}();Object.defineProperty(Eu.prototype,"_bsontype",{value:"MaxKey"});var Su=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e}();Object.defineProperty(Su.prototype,"_bsontype",{value:"MinKey"});var Iu=new RegExp("^[0-9a-fA-F]{24}$"),Ou=null,Au=Symbol("id"),Tu=function(){function t(n){if(!(this instanceof t))return new t(n);var r;if("object"==typeof n&&n&&"id"in n){if("string"!=typeof n.id&&!ArrayBuffer.isView(n.id))throw new Dc("Argument passed in must have an id that is of type string or Buffer");r="toHexString"in n&&"function"==typeof n.toHexString?e.from(n.toHexString(),"hex"):n.id}else r=n;if(null==r||"number"==typeof r)this[Au]=t.generate("number"==typeof r?r:void 0);else if(ArrayBuffer.isView(r)&&12===r.byteLength)this[Au]=r instanceof e?r:Hc(r);else{if("string"!=typeof r)throw new Dc("Argument passed in does not match the accepted types");if(12===r.length){var o=e.from(r);if(12!==o.byteLength)throw new Dc("Argument passed in must be a string of 12 bytes");this[Au]=o}else{if(24!==r.length||!Iu.test(r))throw new Dc("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Au]=e.from(r,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Au]},set:function(e){this[Au]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(n){"number"!=typeof n&&(n=Math.floor(Date.now()/1e3));var r=t.getInc(),o=e.alloc(12);return o.writeUInt32BE(n,0),null===Ou&&(Ou=Bc(5)),o[4]=Ou[0],o[5]=Ou[1],o[6]=Ou[2],o[7]=Ou[3],o[8]=Ou[4],o[11]=255&r,o[10]=r>>8&255,o[9]=r>>16&255,o},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(n){if(null==n)return!1;if(n instanceof t)return this[Au][11]===n[Au][11]&&this[Au].equals(n[Au]);if("string"==typeof n&&t.isValid(n)&&12===n.length&&qc(this.id))return n===e.prototype.toString.call(this.id,"latin1");if("string"==typeof n&&t.isValid(n)&&24===n.length)return n.toLowerCase()===this.toHexString();if("string"==typeof n&&t.isValid(n)&&12===n.length)return e.from(n).equals(this.id);if("object"==typeof n&&"toHexString"in n&&"function"==typeof n.toHexString){var r=n.toHexString(),o=this.toHexString().toLowerCase();return"string"==typeof r&&r.toLowerCase()===o}return!1},t.prototype.getTimestamp=function(){var e=new Date,t=this.id.readUInt32BE(0);return e.setTime(1e3*Math.floor(t)),e},t.createPk=function(){return new t},t.createFromTime=function(n){var r=e.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(n,0),new t(r)},t.createFromHexString=function(n){if(void 0===n||null!=n&&24!==n.length)throw new Dc("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(e.from(n,"hex"))},t.isValid=function(e){if(null==e)return!1;try{return new t(e),!0}catch(e){return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(Tu.prototype,"generate",{value:Fc((function(e){return Tu.generate(e)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(Tu.prototype,"getInc",{value:Fc((function(){return Tu.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Tu.prototype,"get_inc",{value:Fc((function(){return Tu.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Tu,"get_inc",{value:Fc((function(){return Tu.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Tu.prototype,"_bsontype",{value:"ObjectID"});var Nu=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);if(this.pattern=t,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new Lc("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new Lc("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new Lc("The regular expression option [".concat(this.options[r],"] is not supported"))}return e.parseOptions=function(e){return e?e.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(e){return(e=e||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t){if("string"==typeof t.$regex)return new e(t.$regex,e.parseOptions(t.$options));if("BSONRegExp"===t.$regex._bsontype)return t}if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new Dc("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e}();Object.defineProperty(Nu.prototype,"_bsontype",{value:"BSONRegExp"});var xu=function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e}();Object.defineProperty(xu.prototype,"_bsontype",{value:"Symbol"});var Ru=function(e){function t(n,r){var o=this;return o instanceof t?(o=su.isLong(n)?e.call(this,n.low,n.high,!0)||this:Wc(n)&&void 0!==n.t&&void 0!==n.i?e.call(this,n.i,n.t,!0)||this:e.call(this,n,r,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new t(n,r)}return Cc(t,e),t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(e){return new t(su.fromInt(e,!0))},t.fromNumber=function(e){return new t(su.fromNumber(e,!0))},t.fromBits=function(e,n){return new t(e,n)},t.fromString=function(e,n){return new t(su.fromString(e,!0,n))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(e){return new t(e.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},t.MAX_VALUE=su.MAX_UNSIGNED_VALUE,t}(su);var Pu=2147483647,ku=-2147483648,Cu=0x8000000000000000,Lu=-0x8000000000000000,Du={$oid:Tu,$binary:Yc,$uuid:Yc,$symbol:xu,$numberInt:wu,$numberDecimal:mu,$numberDouble:bu,$numberLong:su,$minKey:Su,$maxKey:Eu,$regex:Nu,$regularExpression:Nu,$timestamp:Ru};function ju(e,t){if(void 0===t&&(t={}),"number"==typeof e){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=ku&&e<=Pu)return new wu(e);if(e>=Lu&&e<=Cu)return su.fromNumber(e)}return new bu(e)}if(null==e||"object"!=typeof e)return e;if(e.$undefined)return null;for(var n=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),r=0;r<n.length;r++){var o=Du[n[r]];if(o)return o.fromExtendedJSON(e,t)}if(null!=e.$date){var i=e.$date,s=new Date;return t.legacy?"number"==typeof i?s.setTime(i):"string"==typeof i&&s.setTime(Date.parse(i)):"string"==typeof i?s.setTime(Date.parse(i)):su.isLong(i)?s.setTime(i.toNumber()):"number"==typeof i&&t.relaxed&&s.setTime(i),s}if(null!=e.$code){var a=Object.assign({},e);return e.$scope&&(a.$scope=ju(e.$scope)),Zc.fromExtendedJSON(e)}if(function(e){return Wc(e)&&null!=e.$id&&"string"==typeof e.$ref&&(null==e.$db||"string"==typeof e.$db)}(e)||e.$dbPointer){var c=e.$ref?e:e.$dbPointer;if(c instanceof Qc)return c;var u=Object.keys(c).filter((function(e){return e.startsWith("$")})),l=!0;if(u.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(l=!1)})),l)return Qc.fromExtendedJSON(c)}return e}function Uu(e){var t=e.toISOString();return 0!==e.getUTCMilliseconds()?t:t.slice(0,-5)+"Z"}function Mu(e,t){if(("object"==typeof e||"function"==typeof e)&&null!==e){var n=t.seenObjects.findIndex((function(t){return t.obj===e}));if(-1!==n){var r=t.seenObjects.map((function(e){return e.propertyName})),o=r.slice(0,n).map((function(e){return"".concat(e," -> ")})).join(""),i=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(e){return"".concat(e," -> ")})).join(""),a=r[r.length-1],c=" ".repeat(o.length+i.length/2),u="-".repeat(s.length+(i.length+a.length)/2-1);throw new Dc("Converting circular structure to EJSON:\n"+" ".concat(o).concat(i).concat(s).concat(a,"\n")+" ".concat(c,"\\").concat(u,"/"))}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return function(e,t){return e.map((function(e,n){t.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return Mu(e,t)}finally{t.seenObjects.pop()}}))}(e,t);if(void 0===e)return null;if(e instanceof Date||Wc(h=e)&&"[object Date]"===Object.prototype.toString.call(h)){var l=e.getTime(),f=l>-1&&l<2534023188e5;return t.legacy?t.relaxed&&f?{$date:e.getTime()}:{$date:Uu(e)}:t.relaxed&&f?{$date:Uu(e)}:{$date:{$numberLong:e.getTime().toString()}}}var h;if(!("number"!=typeof e||t.relaxed&&isFinite(e))){if(Math.floor(e)===e){var p=e>=Lu&&e<=Cu;if(e>=ku&&e<=Pu)return{$numberInt:e.toString()};if(p)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp||function(e){return"[object RegExp]"===Object.prototype.toString.call(e)}(e)){var d=e.flags;if(void 0===d){var y=e.toString().match(/[gimuy]*$/);y&&(d=y[0])}return new Nu(e.source,d).toExtendedJSON(t)}return null!=e&&"object"==typeof e?function(e,t){if(null==e||"object"!=typeof e)throw new Lc("not an object instance");var n=e._bsontype;if(void 0===n){var r={};for(var o in e){t.seenObjects.push({propertyName:o,obj:null});try{var i=Mu(e[o],t);"__proto__"===o?Object.defineProperty(r,o,{value:i,writable:!0,enumerable:!0,configurable:!0}):r[o]=i}finally{t.seenObjects.pop()}}return r}if(function(e){return Wc(e)&&Reflect.has(e,"_bsontype")&&"string"==typeof e._bsontype}(e)){var s=e;if("function"!=typeof s.toExtendedJSON){var a=qu[e._bsontype];if(!a)throw new Dc("Unrecognized or invalid _bsontype: "+e._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new Zc(s.code,Mu(s.scope,t)):"DBRef"===n&&s.oid&&(s=new Qc(Mu(s.collection,t),Mu(s.oid,t),Mu(s.db,t),Mu(s.fields,t))),s.toExtendedJSON(t)}throw new Lc("_bsontype must be a string, but was: "+typeof n)}(e,t):e}var Bu,qu={Binary:function(e){return new Yc(e.value(),e.sub_type)},Code:function(e){return new Zc(e.code,e.scope)},DBRef:function(e){return new Qc(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new mu(e.bytes)},Double:function(e){return new bu(e.value)},Int32:function(e){return new wu(e.value)},Long:function(e){return su.fromBits(null!=e.low?e.low:e.low_,null!=e.low?e.high:e.high_,null!=e.low?e.unsigned:e.unsigned_)},MaxKey:function(){return new Eu},MinKey:function(){return new Su},ObjectID:function(e){return new Tu(e)},ObjectId:function(e){return new Tu(e)},BSONRegExp:function(e){return new Nu(e.pattern,e.options)},Symbol:function(e){return new xu(e.value)},Timestamp:function(e){return Ru.fromBits(e.low,e.high)}};!function(e){function t(e,t){var n=Object.assign({},{relaxed:!0,legacy:!1},t);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(e,(function(e,t){if(-1!==e.indexOf("\0"))throw new Lc("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(e)));return ju(t,n)}))}function n(e,t,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==t||"object"!=typeof t||Array.isArray(t)||(r=t,t=void 0,n=0);var o=Mu(e,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,t,n)}e.parse=t,e.stringify=n,e.serialize=function(e,t){return t=t||{},JSON.parse(n(e,t))},e.deserialize=function(e,n){return n=n||{},t(JSON.stringify(e),n)}}(Bu||(Bu={}));var Wu=Uc();Wu.Map?Wu.Map:function(){function e(e){void 0===e&&(e=[]),this._keys=[],this._values={};for(var t=0;t<e.length;t++)if(null!=e[t]){var n=e[t],r=n[0],o=n[1];this._keys.push(r),this._values[r]={v:o,i:this._keys.length-1}}}e.prototype.clear=function(){this._keys=[],this._values={}},e.prototype.delete=function(e){var t=this._values[e];return null!=t&&(delete this._values[e],this._keys.splice(t.i,1),!0)},e.prototype.entries=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?[n,e._values[n].v]:void 0,done:void 0===n}}}},e.prototype.forEach=function(e,t){t=t||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];e.call(t,this._values[r].v,r,t)}},e.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},e.prototype.has=function(e){return null!=this._values[e]},e.prototype.keys=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},e.prototype.set=function(e,t){return this._values[e]?(this._values[e].v=t,this):(this._keys.push(e),this._values[e]={v:t,i:this._keys.length-1},this)},e.prototype.values=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?e._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0})}(),su.fromNumber(Jc),su.fromNumber(zc);var Fu=new Uint8Array(8);new DataView(Fu.buffer,Fu.byteOffset,Fu.byteLength);e.alloc(17825792);var Hu=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},$u=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},Gu=function(){function e(e,t){this._stages=[],e&&t&&(this._db=e,this._request=new yl.reqClass(this._db.config),this._collectionName=t)}return e.prototype.end=function(){return Hu(this,void 0,void 0,(function(){var e;return $u(this,(function(t){switch(t.label){case 0:if(!this._collectionName||!this._db)throw new Error("Aggregation pipeline cannot send request");return[4,this._request.send("database.aggregate",{collectionName:this._collectionName,stages:this._stages})];case 1:return(e=t.sent())&&e.data&&e.data.list?[2,{requestId:e.requestId,data:JSON.parse(e.data.list).map(Bu.parse)}]:[2,e]}}))}))},e.prototype.unwrap=function(){return this._stages},e.prototype.done=function(){return this._stages.map((function(e){var t,n=e.stageKey,r=e.stageValue;return(t={})[n]=JSON.parse(r),t}))},e.prototype._pipe=function(e,t){return this._stages.push({stageKey:"$"+e,stageValue:JSON.stringify(t)}),this},e.prototype.addFields=function(e){return this._pipe("addFields",e)},e.prototype.bucket=function(e){return this._pipe("bucket",e)},e.prototype.bucketAuto=function(e){return this._pipe("bucketAuto",e)},e.prototype.count=function(e){return this._pipe("count",e)},e.prototype.geoNear=function(e){return this._pipe("geoNear",e)},e.prototype.group=function(e){return this._pipe("group",e)},e.prototype.limit=function(e){return this._pipe("limit",e)},e.prototype.match=function(e){return this._pipe("match",Nc.encode(e))},e.prototype.project=function(e){return this._pipe("project",e)},e.prototype.lookup=function(e){return this._pipe("lookup",e)},e.prototype.replaceRoot=function(e){return this._pipe("replaceRoot",e)},e.prototype.sample=function(e){return this._pipe("sample",e)},e.prototype.skip=function(e){return this._pipe("skip",e)},e.prototype.sort=function(e){return this._pipe("sort",e)},e.prototype.sortByCount=function(e){return this._pipe("sortByCount",e)},e.prototype.unwind=function(e){return this._pipe("unwind",e)},e}(),Ku=Gu,Vu=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ju=function(e){function t(t,n){return e.call(this,t,n)||this}return Vu(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),t.prototype.doc=function(e){if("string"!=typeof e&&"number"!=typeof e)throw new Error("docId必须为字符串或数字");return new Tc(this._db,this._coll,e)},t.prototype.add=function(e,t){return new Tc(this._db,this._coll,void 0).create(e,t)},t.prototype.aggregate=function(){return new Ku(this._db,this._coll)},t}(Pc),zu={eq:function(e){return new oc(nc.EQ,[e])},neq:function(e){return new oc(nc.NEQ,[e])},lt:function(e){return new oc(nc.LT,[e])},lte:function(e){return new oc(nc.LTE,[e])},gt:function(e){return new oc(nc.GT,[e])},gte:function(e){return new oc(nc.GTE,[e])},in:function(e){return new oc(nc.IN,e)},nin:function(e){return new oc(nc.NIN,e)},all:function(e){return new oc(nc.ALL,e)},elemMatch:function(e){return new oc(nc.ELEM_MATCH,[e])},exists:function(e){return new oc(nc.EXISTS,[e])},size:function(e){return new oc(nc.SIZE,[e])},mod:function(e){return new oc(nc.MOD,[e])},geoNear:function(e){return new oc(nc.GEO_NEAR,[e])},geoWithin:function(e){return new oc(nc.GEO_WITHIN,[e])},geoIntersects:function(e){return new oc(nc.GEO_INTERSECTS,[e])},and:function(){var e=La(arguments[0])?arguments[0]:Array.from(arguments);return new ec(Xa.AND,e)},nor:function(){var e=La(arguments[0])?arguments[0]:Array.from(arguments);return new ec(Xa.NOR,e)},or:function(){var e=La(arguments[0])?arguments[0]:Array.from(arguments);return new ec(Xa.OR,e)},not:function(){var e=La(arguments[0])?arguments[0]:Array.from(arguments);return new ec(Xa.NOT,e)},set:function(e){return new Za(Ta.SET,[e])},remove:function(){return new Za(Ta.REMOVE,[])},inc:function(e){return new Za(Ta.INC,[e])},mul:function(e){return new Za(Ta.MUL,[e])},push:function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(ka(t[0])&&t[0].hasOwnProperty("each")){var r=t[0];e={$each:r.each,$position:r.position,$sort:r.sort,$slice:r.slice}}else e=La(t[0])?t[0]:Array.from(t);return new Za(Ta.PUSH,e)},pull:function(e){return new Za(Ta.PULL,e)},pullAll:function(e){return new Za(Ta.PULL_ALL,e)},pop:function(){return new Za(Ta.POP,[])},shift:function(){return new Za(Ta.SHIFT,[])},unshift:function(){var e=La(arguments[0])?arguments[0]:Array.from(arguments);return new Za(Ta.UNSHIFT,e)},addToSet:function(e){return new Za(Ta.ADD_TO_SET,e)},rename:function(e){return new Za(Ta.RENAME,[e])},bit:function(e){return new Za(Ta.BIT,[e])},max:function(e){return new Za(Ta.MAX,[e])},min:function(e){return new Za(Ta.MIN,[e])},expr:function(e){return{$expr:e}},jsonSchema:function(e){return{$jsonSchema:e}},text:function(e){return"string"===Pa(e)?{$search:e.search}:{$search:e.search,$language:e.language,$caseSensitive:e.caseSensitive,$diacriticSensitive:e.diacriticSensitive}},aggregate:{pipeline:function(){return new Ku},abs:function(e){return new Yu("abs",e)},add:function(e){return new Yu("add",e)},ceil:function(e){return new Yu("ceil",e)},divide:function(e){return new Yu("divide",e)},exp:function(e){return new Yu("exp",e)},floor:function(e){return new Yu("floor",e)},ln:function(e){return new Yu("ln",e)},log:function(e){return new Yu("log",e)},log10:function(e){return new Yu("log10",e)},mod:function(e){return new Yu("mod",e)},multiply:function(e){return new Yu("multiply",e)},pow:function(e){return new Yu("pow",e)},sqrt:function(e){return new Yu("sqrt",e)},subtract:function(e){return new Yu("subtract",e)},trunc:function(e){return new Yu("trunc",e)},arrayElemAt:function(e){return new Yu("arrayElemAt",e)},arrayToObject:function(e){return new Yu("arrayToObject",e)},concatArrays:function(e){return new Yu("concatArrays",e)},filter:function(e){return new Yu("filter",e)},in:function(e){return new Yu("in",e)},indexOfArray:function(e){return new Yu("indexOfArray",e)},isArray:function(e){return new Yu("isArray",e)},map:function(e){return new Yu("map",e)},range:function(e){return new Yu("range",e)},reduce:function(e){return new Yu("reduce",e)},reverseArray:function(e){return new Yu("reverseArray",e)},size:function(e){return new Yu("size",e)},slice:function(e){return new Yu("slice",e)},zip:function(e){return new Yu("zip",e)},and:function(e){return new Yu("and",e)},not:function(e){return new Yu("not",e)},or:function(e){return new Yu("or",e)},cmp:function(e){return new Yu("cmp",e)},eq:function(e){return new Yu("eq",e)},gt:function(e){return new Yu("gt",e)},gte:function(e){return new Yu("gte",e)},lt:function(e){return new Yu("lt",e)},lte:function(e){return new Yu("lte",e)},neq:function(e){return new Yu("ne",e)},cond:function(e){return new Yu("cond",e)},ifNull:function(e){return new Yu("ifNull",e)},switch:function(e){return new Yu("switch",e)},dateFromParts:function(e){return new Yu("dateFromParts",e)},dateFromString:function(e){return new Yu("dateFromString",e)},dayOfMonth:function(e){return new Yu("dayOfMonth",e)},dayOfWeek:function(e){return new Yu("dayOfWeek",e)},dayOfYear:function(e){return new Yu("dayOfYear",e)},isoDayOfWeek:function(e){return new Yu("isoDayOfWeek",e)},isoWeek:function(e){return new Yu("isoWeek",e)},isoWeekYear:function(e){return new Yu("isoWeekYear",e)},millisecond:function(e){return new Yu("millisecond",e)},minute:function(e){return new Yu("minute",e)},month:function(e){return new Yu("month",e)},second:function(e){return new Yu("second",e)},hour:function(e){return new Yu("hour",e)},week:function(e){return new Yu("week",e)},year:function(e){return new Yu("year",e)},literal:function(e){return new Yu("literal",e)},mergeObjects:function(e){return new Yu("mergeObjects",e)},objectToArray:function(e){return new Yu("objectToArray",e)},allElementsTrue:function(e){return new Yu("allElementsTrue",e)},anyElementTrue:function(e){return new Yu("anyElementTrue",e)},setDifference:function(e){return new Yu("setDifference",e)},setEquals:function(e){return new Yu("setEquals",e)},setIntersection:function(e){return new Yu("setIntersection",e)},setIsSubset:function(e){return new Yu("setIsSubset",e)},setUnion:function(e){return new Yu("setUnion",e)},concat:function(e){return new Yu("concat",e)},dateToString:function(e){return new Yu("dateToString",e)},indexOfBytes:function(e){return new Yu("indexOfBytes",e)},indexOfCP:function(e){return new Yu("indexOfCP",e)},split:function(e){return new Yu("split",e)},strLenBytes:function(e){return new Yu("strLenBytes",e)},strLenCP:function(e){return new Yu("strLenCP",e)},strcasecmp:function(e){return new Yu("strcasecmp",e)},substr:function(e){return new Yu("substr",e)},substrBytes:function(e){return new Yu("substrBytes",e)},substrCP:function(e){return new Yu("substrCP",e)},toLower:function(e){return new Yu("toLower",e)},toUpper:function(e){return new Yu("toUpper",e)},meta:function(e){return new Yu("meta",e)},addToSet:function(e){return new Yu("addToSet",e)},avg:function(e){return new Yu("avg",e)},first:function(e){return new Yu("first",e)},last:function(e){return new Yu("last",e)},max:function(e){return new Yu("max",e)},min:function(e){return new Yu("min",e)},push:function(e){return new Yu("push",e)},stdDevPop:function(e){return new Yu("stdDevPop",e)},stdDevSamp:function(e){return new Yu("stdDevSamp",e)},sum:function(e){return new Yu("sum",e)},let:function(e){return new Yu("let",e)}},project:{slice:function(e){return new Xu("slice",e)},elemMatch:function(e){return new Xu("elemMatch",e)}}},Yu=function(e,t){this["$"+e]=t},Xu=function(e,t){this["$"+e]=t},Zu=function(){function e(e){var t=e.regexp,n=e.options;if(!t)throw new TypeError("regexp must be a string");this.$regex=t,this.$options=n}return e.prototype.parse=function(){return{$regex:this.$regex,$options:this.$options}},Object.defineProperty(e.prototype,"_internalType",{get:function(){return Ia},enumerable:!0,configurable:!0}),e}();function Qu(e){return new Zu(e)}var el={code:"INSERT_DOC_FAIL",message:"insert document failed"},tl={code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"},nl=function(){return nl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},nl.apply(this,arguments)},rl=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},ol=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},il="database.updateDocInTransaction",sl=function(){function e(e,t,n){this._coll=t,this.id=n,this._transaction=e,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return e.prototype.create=function(e){return rl(this,void 0,void 0,(function(){var t,n,r,o;return ol(this,(function(i){switch(i.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,data:Bu.stringify(pc(e),{relaxed:!1})},this.id&&(t._id=this.id),[4,this._request.send("database.insertDocInTransaction",t)];case 1:if((n=i.sent()).code)throw n;if(r=Bu.parse(n.inserted),1==(o=Bu.parse(n.ok))&&1==r)return[2,nl(nl({},n),{ok:o,inserted:r})];throw new Error(el.message)}}))}))},e.prototype.get=function(){return rl(this,void 0,void 0,(function(){var e,t;return ol(this,(function(n){switch(n.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.getInTransaction",e)];case 1:if((t=n.sent()).code)throw t;return[2,{data:"null"!==t.data?xa.formatField(Bu.parse(t.data)):Bu.parse(t.data),requestId:t.requestId}]}}))}))},e.prototype.set=function(e){return rl(this,void 0,void 0,(function(){var t,n;return ol(this,(function(r){switch(r.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Bu.stringify(pc(e),{relaxed:!1}),upsert:!0},[4,this._request.send(il,t)];case 1:if((n=r.sent()).code)throw n;return[2,nl(nl({},n),{updated:Bu.parse(n.updated),upserted:n.upserted?JSON.parse(n.upserted):null})]}}))}))},e.prototype.update=function(e){return rl(this,void 0,void 0,(function(){var t,n;return ol(this,(function(r){switch(r.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Bu.stringify(Sc.encode(e),{relaxed:!1})},[4,this._request.send(il,t)];case 1:if((n=r.sent()).code)throw n;return[2,nl(nl({},n),{updated:Bu.parse(n.updated)})]}}))}))},e.prototype.delete=function(){return rl(this,void 0,void 0,(function(){var e,t;return ol(this,(function(n){switch(n.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.deleteDocInTransaction",e)];case 1:if((t=n.sent()).code)throw t;return[2,nl(nl({},t),{deleted:Bu.parse(t.deleted)})]}}))}))},e}(),al=function(e,t){this._coll=t,this._transaction=e},cl=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ul=function(e){function t(t,n){return e.call(this,t,n)||this}return cl(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),t.prototype.doc=function(e){if("string"!=typeof e&&"number"!=typeof e)throw new Error("docId必须为字符串或数字");return new sl(this._transaction,this._coll,e)},t.prototype.add=function(e){var t;return void 0!==e._id&&(t=e._id),new sl(this._transaction,this._coll,t).create(e)},t}(al),ll=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},fl=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},hl=function(){function e(e){this._db=e,this._request=new yl.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return e.prototype.init=function(){return ll(this,void 0,void 0,(function(){var e;return fl(this,(function(t){switch(t.label){case 0:return[4,this._request.send("database.startTransaction")];case 1:if((e=t.sent()).code)throw e;return this.inited=!0,this._id=e.transactionId,[2]}}))}))},e.prototype.collection=function(e){if(!e)throw new Error("Collection name is required");return new ul(this,e)},e.prototype.getTransactionId=function(){return this._id},e.prototype.getRequestMethod=function(){return this._request},e.prototype.commit=function(){return ll(this,void 0,void 0,(function(){var e,t;return fl(this,(function(n){switch(n.label){case 0:return e={transactionId:this._id},[4,this._request.send("database.commitTransaction",e)];case 1:if((t=n.sent()).code)throw t;return this.commited=!0,[2,t]}}))}))},e.prototype.rollback=function(e){return ll(this,void 0,void 0,(function(){var t,n;return fl(this,(function(r){switch(r.label){case 0:return t={transactionId:this._id},[4,this._request.send("database.abortTransaction",t)];case 1:if((n=r.sent()).code)throw n;return this.aborted=!0,this.abortReason=e,[2,n]}}))}))},e}();function pl(){return ll(this,void 0,void 0,(function(){var e;return fl(this,(function(t){switch(t.label){case 0:return[4,(e=new hl(this)).init()];case 1:return t.sent(),[2,e]}}))}))}function dl(e,t){return void 0===t&&(t=3),ll(this,void 0,void 0,(function(){var n,r,o,i,s=this;return fl(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,10]),[4,(n=new hl(this)).init()];case 1:return a.sent(),[4,e(n)];case 2:if(r=a.sent(),!0===n.aborted)throw n.abortReason;return[4,n.commit()];case 3:return a.sent(),[2,r];case 4:if(o=a.sent(),!1===n.inited)throw o;return i=function(e){return ll(s,void 0,void 0,(function(){return fl(this,(function(t){switch(t.label){case 0:if(n.aborted||n.commited)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,n.rollback()];case 2:case 3:return t.sent(),[3,4];case 4:throw e;case 5:if(!0===n.aborted)throw n.abortReason;throw e}}))}))},t<=0?[4,i(o)]:[3,6];case 5:a.sent(),a.label=6;case 6:return o&&o.code===tl.code?[4,dl.bind(this)(e,--t)]:[3,8];case 7:return[2,a.sent()];case 8:return[4,i(o)];case 9:return a.sent(),[3,10];case 10:return[2]}}))}))}var yl=function(){function e(e){this.config=e,this.Geo=za,this.serverDate=Aa,this.command=zu,this.RegExp=Qu,this.startTransaction=pl,this.runTransaction=dl,this.logicCommand=ec,this.updateCommand=Za,this.queryCommand=oc}return e.prototype.collection=function(e){if(!e)throw new Error("Collection name is required");return new Ju(this,e)},e.prototype.createCollection=function(t){var n={collectionName:t};return new e.reqClass(this.config).send("database.addCollection",n)},e}(),gl=function(){return gl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},gl.apply(this,arguments)};var vl={name:"database",entity:{database:function(e){var t=this.platform,n=t.adapter,r=t.runtime;return yl.reqClass=this.request.constructor,yl.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},yl.runtime=r,this.wsClientClass&&(yl.wsClass=n.wsClass,yl.wsClientClass=this.wsClientClass),yl.ws||(yl.ws=null),new yl(gl(gl({},this.config),e))}}};try{cloudbase.registerComponent(vl)}catch(e){}var _l;zt.registerVersion("1.7.1");try{!function(e){try{e.registerComponent(Br)}catch(e){console.warn(e)}}(zt),function(e){try{e.registerComponent(Zr)}catch(e){console.warn(e)}}(zt),function(e){try{e.registerComponent(yo)}catch(e){console.warn(e)}}(zt),function(e){try{e.registerComponent(vl)}catch(e){console.warn(e)}}(zt),function(e){try{e.registerComponent(ks),e.registerHook(Ps)}catch(e){console.warn(e)}}(zt),function(e){try{e.registerComponent(Gs)}catch(e){console.warn(e)}}(zt)}catch(e){}try{window.cloudbase=zt}catch(e){}!function(e){e.development="dev-1gpp53ju3ceb46c7",e.testing="dev-1gpp53ju3ceb46c7",e.production="release-7gvojkxi667a3f26"}(_l||(_l={}));var ml=new(function(){function e(){this.userInfo={name:""}}return e.prototype.init=function(e){this.userInfo=e||{name:""}},e.prototype.getParams=function(){return this.userInfo},e}()),bl={ENV:_l[void 0!==import.meta&&import.meta.env?import.meta.env.VITE_API_ENV||"development":"undefined"!=typeof process&&process.env?process.env.API_ENV||"development":(console.warn('Neither Vite nor Webpack environment detected. Defaulting to "development".'),"development")],REGION:"ap-shanghai"},wl={region:bl.REGION,env:bl.ENV,timeout:6e4},El=zt.init(wl);function Sl(e){return o(this,void 0,void 0,(function(){var t,n;return i(this,(function(o){switch(o.label){case 0:return(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.operateUser)||(e.data.operateUser=r({},ml.getParams())),[4,El.callFunction(e)];case 1:return t=o.sent(),[2,new Promise((function(e,n){var r;(null===(r=t.result)||void 0===r?void 0:r.success)?e(t.result.data):n(t.result)}))]}}))}))}var Il=t.create();function Ol(e){return function(e){!e.method&&e.data&&(e.method="post"),e.method||e.data||(e.method="get")}(e),function(e){e.requestInterceptors&&"function"==typeof e.requestInterceptors&&Il.interceptors.request.use(e.requestInterceptors),e.responseInterceptors&&"function"==typeof e.responseInterceptors&&Il.interceptors.response.use(e.responseInterceptors)}(e),new Promise((function(t,n){Il.request({method:e.method,url:e.url,headers:(null==e?void 0:e.headers)||{},data:null==e?void 0:e.data,params:null==e?void 0:e.params,timeout:(null==e?void 0:e.timeout)||8e3}).then((function(e){if(200===e.status){var r=e.data;t(r)}else{r=e.data;n(r)}})).catch((function(t){var r=(null==t?void 0:t.response)||{};(null==e?void 0:e.catchCallback)&&"function"==typeof(null==e?void 0:e.catchCallback)&&(null==e||e.catchCallback(t));var o=null==r?void 0:r.data;n(o)}))}))}var Al,Tl={exports:{}},Nl={exports:{}};function xl(){return Al||(Al=1,Nl.exports=function(e){return r=(n=e).lib,o=r.Base,i=r.WordArray,(s=n.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),s.WordArray=o.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r<t;r++){var o=e[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),n=t.length,r=0;r<n;r++)t[r]=t[r].clone();return e}}),e;var t,n,r,o,i,s}(A())),Nl.exports}var Rl,Pl={exports:{}};function kl(){return Rl||(Rl=1,Pl.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,n=t.init,r=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,r=[],o=0;o<t;o++)r[o>>>2]|=e[o]<<24-o%4*8;n.call(this,r,t)}else n.apply(this,arguments)};r.prototype=t}}(),e.lib.WordArray}(A())),Pl.exports}var Cl,Ll={exports:{}};function Dl(){return Cl||(Cl=1,Ll.exports=function(e){return function(){var t=e,n=t.lib.WordArray,r=t.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o+=2){var i=t[o>>>2]>>>16-o%4*8&65535;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,r=[],o=0;o<t;o++)r[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return n.create(r,2*t)}},r.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i+=2){var s=o(t[i>>>2]>>>16-i%4*8&65535);r.push(String.fromCharCode(s))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>1]|=o(e.charCodeAt(i)<<16-i%2*16);return n.create(r,2*t)}}}(),e.enc.Utf16}(A())),Ll.exports}var jl,Ul={exports:{}};function Ml(){return jl||(jl=1,Ul.exports=function(e){return function(){var t=e,n=t.lib.WordArray;function r(e,t,r){for(var o=[],i=0,s=0;s<t;s++)if(s%4){var a=r[e.charCodeAt(s-1)]<<s%4*2|r[e.charCodeAt(s)]>>>6-s%4*2;o[i>>>2]|=a<<24-i%4*8,i++}return n.create(o,i)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var n=e.words,r=e.sigBytes,o=t?this._safe_map:this._map;e.clamp();for(var i=[],s=0;s<r;s+=3)for(var a=(n[s>>>2]>>>24-s%4*8&255)<<16|(n[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|n[s+2>>>2]>>>24-(s+2)%4*8&255,c=0;c<4&&s+.75*c<r;c++)i.push(o.charAt(a>>>6*(3-c)&63));var u=o.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e,t){void 0===t&&(t=!0);var n=e.length,o=t?this._safe_map:this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var s=0;s<o.length;s++)i[o.charCodeAt(s)]=s}var a=o.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(n=c)}return r(e,n,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(A())),Ul.exports}var Bl,ql={exports:{}};function Wl(){return Bl||(Bl=1,ql.exports=function(e){return function(t){var n=e,r=n.lib,o=r.WordArray,i=r.Hasher,s=n.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=s.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,o=e[r];e[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,s=e[t+0],c=e[t+1],p=e[t+2],d=e[t+3],y=e[t+4],g=e[t+5],v=e[t+6],_=e[t+7],m=e[t+8],b=e[t+9],w=e[t+10],E=e[t+11],S=e[t+12],I=e[t+13],O=e[t+14],A=e[t+15],T=i[0],N=i[1],x=i[2],R=i[3];T=u(T,N,x,R,s,7,a[0]),R=u(R,T,N,x,c,12,a[1]),x=u(x,R,T,N,p,17,a[2]),N=u(N,x,R,T,d,22,a[3]),T=u(T,N,x,R,y,7,a[4]),R=u(R,T,N,x,g,12,a[5]),x=u(x,R,T,N,v,17,a[6]),N=u(N,x,R,T,_,22,a[7]),T=u(T,N,x,R,m,7,a[8]),R=u(R,T,N,x,b,12,a[9]),x=u(x,R,T,N,w,17,a[10]),N=u(N,x,R,T,E,22,a[11]),T=u(T,N,x,R,S,7,a[12]),R=u(R,T,N,x,I,12,a[13]),x=u(x,R,T,N,O,17,a[14]),T=l(T,N=u(N,x,R,T,A,22,a[15]),x,R,c,5,a[16]),R=l(R,T,N,x,v,9,a[17]),x=l(x,R,T,N,E,14,a[18]),N=l(N,x,R,T,s,20,a[19]),T=l(T,N,x,R,g,5,a[20]),R=l(R,T,N,x,w,9,a[21]),x=l(x,R,T,N,A,14,a[22]),N=l(N,x,R,T,y,20,a[23]),T=l(T,N,x,R,b,5,a[24]),R=l(R,T,N,x,O,9,a[25]),x=l(x,R,T,N,d,14,a[26]),N=l(N,x,R,T,m,20,a[27]),T=l(T,N,x,R,I,5,a[28]),R=l(R,T,N,x,p,9,a[29]),x=l(x,R,T,N,_,14,a[30]),T=f(T,N=l(N,x,R,T,S,20,a[31]),x,R,g,4,a[32]),R=f(R,T,N,x,m,11,a[33]),x=f(x,R,T,N,E,16,a[34]),N=f(N,x,R,T,O,23,a[35]),T=f(T,N,x,R,c,4,a[36]),R=f(R,T,N,x,y,11,a[37]),x=f(x,R,T,N,_,16,a[38]),N=f(N,x,R,T,w,23,a[39]),T=f(T,N,x,R,I,4,a[40]),R=f(R,T,N,x,s,11,a[41]),x=f(x,R,T,N,d,16,a[42]),N=f(N,x,R,T,v,23,a[43]),T=f(T,N,x,R,b,4,a[44]),R=f(R,T,N,x,S,11,a[45]),x=f(x,R,T,N,A,16,a[46]),T=h(T,N=f(N,x,R,T,p,23,a[47]),x,R,s,6,a[48]),R=h(R,T,N,x,_,10,a[49]),x=h(x,R,T,N,O,15,a[50]),N=h(N,x,R,T,g,21,a[51]),T=h(T,N,x,R,S,6,a[52]),R=h(R,T,N,x,d,10,a[53]),x=h(x,R,T,N,w,15,a[54]),N=h(N,x,R,T,c,21,a[55]),T=h(T,N,x,R,m,6,a[56]),R=h(R,T,N,x,A,10,a[57]),x=h(x,R,T,N,v,15,a[58]),N=h(N,x,R,T,I,21,a[59]),T=h(T,N,x,R,y,6,a[60]),R=h(R,T,N,x,E,10,a[61]),x=h(x,R,T,N,p,15,a[62]),N=h(N,x,R,T,b,21,a[63]),i[0]=i[0]+T|0,i[1]=i[1]+N|0,i[2]=i[2]+x|0,i[3]=i[3]+R|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;n[o>>>5]|=128<<24-o%32;var i=t.floor(r/4294967296),s=r;n[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),n[14+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,o,i,s){var a=e+(t&n|~t&r)+o+s;return(a<<i|a>>>32-i)+t}function l(e,t,n,r,o,i,s){var a=e+(t&r|n&~r)+o+s;return(a<<i|a>>>32-i)+t}function f(e,t,n,r,o,i,s){var a=e+(t^n^r)+o+s;return(a<<i|a>>>32-i)+t}function h(e,t,n,r,o,i,s){var a=e+(n^(t|~r))+o+s;return(a<<i|a>>>32-i)+t}n.MD5=i._createHelper(c),n.HmacMD5=i._createHmacHelper(c)}(Math),e.MD5}(A())),ql.exports}var Fl,Hl={exports:{}};function $l(){return Fl||(Fl=1,Hl.exports=function(e){return n=(t=e).lib,r=n.WordArray,o=n.Hasher,i=t.algo,s=[],a=i.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],c=n[4],u=0;u<80;u++){if(u<16)s[u]=0|e[t+u];else{var l=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=l<<1|l>>>31}var f=(r<<5|r>>>27)+c+s[u];f+=u<20?1518500249+(o&i|~o&a):u<40?1859775393+(o^i^a):u<60?(o&i|o&a|i&a)-1894007588:(o^i^a)-899497514,c=a,a=i,i=o<<30|o>>>2,o=r,r=f}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a),e.SHA1;var t,n,r,o,i,s,a}(A())),Hl.exports}var Gl,Kl={exports:{}};var Vl,Jl={exports:{}};function zl(){return Vl||(Vl=1,Jl.exports=function(e){return function(){var t=e,n=t.lib.Hasher,r=t.x64,o=r.Word,i=r.WordArray,s=t.algo;function a(){return o.create.apply(o,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=a()}();var l=s.SHA512=n.extend({_doReset:function(){this._hash=new i.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],s=n[3],a=n[4],l=n[5],f=n[6],h=n[7],p=r.high,d=r.low,y=o.high,g=o.low,v=i.high,_=i.low,m=s.high,b=s.low,w=a.high,E=a.low,S=l.high,I=l.low,O=f.high,A=f.low,T=h.high,N=h.low,x=p,R=d,P=y,k=g,C=v,L=_,D=m,j=b,U=w,M=E,B=S,q=I,W=O,F=A,H=T,$=N,G=0;G<80;G++){var K,V,J=u[G];if(G<16)V=J.high=0|e[t+2*G],K=J.low=0|e[t+2*G+1];else{var z=u[G-15],Y=z.high,X=z.low,Z=(Y>>>1|X<<31)^(Y>>>8|X<<24)^Y>>>7,Q=(X>>>1|Y<<31)^(X>>>8|Y<<24)^(X>>>7|Y<<25),ee=u[G-2],te=ee.high,ne=ee.low,re=(te>>>19|ne<<13)^(te<<3|ne>>>29)^te>>>6,oe=(ne>>>19|te<<13)^(ne<<3|te>>>29)^(ne>>>6|te<<26),ie=u[G-7],se=ie.high,ae=ie.low,ce=u[G-16],ue=ce.high,le=ce.low;V=(V=(V=Z+se+((K=Q+ae)>>>0<Q>>>0?1:0))+re+((K+=oe)>>>0<oe>>>0?1:0))+ue+((K+=le)>>>0<le>>>0?1:0),J.high=V,J.low=K}var fe,he=U&B^~U&W,pe=M&q^~M&F,de=x&P^x&C^P&C,ye=R&k^R&L^k&L,ge=(x>>>28|R<<4)^(x<<30|R>>>2)^(x<<25|R>>>7),ve=(R>>>28|x<<4)^(R<<30|x>>>2)^(R<<25|x>>>7),_e=(U>>>14|M<<18)^(U>>>18|M<<14)^(U<<23|M>>>9),me=(M>>>14|U<<18)^(M>>>18|U<<14)^(M<<23|U>>>9),be=c[G],we=be.high,Ee=be.low,Se=H+_e+((fe=$+me)>>>0<$>>>0?1:0),Ie=ve+ye;H=W,$=F,W=B,F=q,B=U,q=M,U=D+(Se=(Se=(Se=Se+he+((fe+=pe)>>>0<pe>>>0?1:0))+we+((fe+=Ee)>>>0<Ee>>>0?1:0))+V+((fe+=K)>>>0<K>>>0?1:0))+((M=j+fe|0)>>>0<j>>>0?1:0)|0,D=C,j=L,C=P,L=k,P=x,k=R,x=Se+(ge+de+(Ie>>>0<ve>>>0?1:0))+((R=fe+Ie|0)>>>0<fe>>>0?1:0)|0}d=r.low=d+R,r.high=p+x+(d>>>0<R>>>0?1:0),g=o.low=g+k,o.high=y+P+(g>>>0<k>>>0?1:0),_=i.low=_+L,i.high=v+C+(_>>>0<L>>>0?1:0),b=s.low=b+j,s.high=m+D+(b>>>0<j>>>0?1:0),E=a.low=E+M,a.high=w+U+(E>>>0<M>>>0?1:0),I=l.low=I+q,l.high=S+B+(I>>>0<q>>>0?1:0),A=f.low=A+F,f.high=O+W+(A>>>0<F>>>0?1:0),N=h.low=N+$,h.high=T+H+(N>>>0<$>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(r+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=n._createHelper(l),t.HmacSHA512=n._createHmacHelper(l)}(),e.SHA512}(A(),xl())),Jl.exports}var Yl,Xl={exports:{}};var Zl,Ql={exports:{}};function ef(){return Zl||(Zl=1,Ql.exports=function(e){return function(t){var n=e,r=n.lib,o=r.WordArray,i=r.Hasher,s=n.x64.Word,a=n.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,n=0;n<24;n++){c[e+5*t]=(n+1)*(n+2)/2%64;var r=(2*e+3*t)%5;e=t%5,t=r}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,i=0;i<24;i++){for(var a=0,f=0,h=0;h<7;h++){if(1&o){var p=(1<<h)-1;p<32?f^=1<<p:a^=1<<p-32}128&o?o=o<<1^113:o<<=1}l[i]=s.create(a,f)}}();var f=[];!function(){for(var e=0;e<25;e++)f[e]=s.create()}();var h=a.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var n=this._state,r=this.blockSize/2,o=0;o<r;o++){var i=e[t+2*o],s=e[t+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(N=n[o]).high^=s,N.low^=i}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var p=0,d=0,y=0;y<5;y++)p^=(N=n[h+5*y]).high,d^=N.low;var g=f[h];g.high=p,g.low=d}for(h=0;h<5;h++){var v=f[(h+4)%5],_=f[(h+1)%5],m=_.high,b=_.low;for(p=v.high^(m<<1|b>>>31),d=v.low^(b<<1|m>>>31),y=0;y<5;y++)(N=n[h+5*y]).high^=p,N.low^=d}for(var w=1;w<25;w++){var E=(N=n[w]).high,S=N.low,I=c[w];I<32?(p=E<<I|S>>>32-I,d=S<<I|E>>>32-I):(p=S<<I-32|E>>>64-I,d=E<<I-32|S>>>64-I);var O=f[u[w]];O.high=p,O.low=d}var A=f[0],T=n[0];for(A.high=T.high,A.low=T.low,h=0;h<5;h++)for(y=0;y<5;y++){var N=n[w=h+5*y],x=f[w],R=f[(h+1)%5+5*y],P=f[(h+2)%5+5*y];N.high=x.high^~R.high&P.high,N.low=x.low^~R.low&P.low}N=n[0];var k=l[a];N.high^=k.high,N.low^=k.low}},_doFinalize:function(){var e=this._data,n=e.words;this._nDataBytes;var r=8*e.sigBytes,i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(t.ceil((r+1)/i)*i>>>5)-1]|=128,e.sigBytes=4*n.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,u=[],l=0;l<c;l++){var f=s[l],h=f.high,p=f.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),u.push(p),u.push(h)}return new o.init(u,a)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),n=0;n<25;n++)t[n]=t[n].clone();return e}});n.SHA3=i._createHelper(h),n.HmacSHA3=i._createHmacHelper(h)}(Math),e.SHA3}(A(),xl())),Ql.exports}var tf,nf={exports:{}};var rf,of={exports:{}};var sf,af={exports:{}};function cf(){return sf||(sf=1,af.exports=function(e){return n=(t=e).lib,r=n.Base,o=n.WordArray,i=t.algo,s=i.MD5,a=i.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,r=this.cfg,i=r.hasher.create(),s=o.create(),a=s.words,c=r.keySize,u=r.iterations;a.length<c;){n&&i.update(n),n=i.update(e).finalize(t),i.reset();for(var l=1;l<u;l++)n=i.finalize(n),i.reset();s.concat(n)}return s.sigBytes=4*c,s}}),t.EvpKDF=function(e,t,n){return a.create(n).compute(e,t)},e.EvpKDF;var t,n,r,o,i,s,a}(A(),$l(),k())),af.exports}var uf,lf={exports:{}};function ff(){return uf||(uf=1,lf.exports=function(e){e.lib.Cipher||function(t){var n=e,r=n.lib,o=r.Base,i=r.WordArray,s=r.BufferedBlockAlgorithm,a=n.enc;a.Utf8;var c=a.Base64,u=n.algo.EvpKDF,l=r.Cipher=s.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?m:v}return function(t){return{encrypt:function(n,r,o){return e(r).encrypt(t,n,r,o)},decrypt:function(n,r,o){return e(r).decrypt(t,n,r,o)}}}}()});r.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var f=n.mode={},h=r.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=f.CBC=function(){var e=h.extend();function n(e,n,r){var o,i=this._iv;i?(o=i,this._iv=t):o=this._prevBlock;for(var s=0;s<r;s++)e[n+s]^=o[s]}return e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize;n.call(this,e,t,o),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=e.slice(t,t+o);r.decryptBlock(e,t),n.call(this,e,t,o),this._prevBlock=i}}),e}(),d=(n.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,r=n-e.sigBytes%n,o=r<<24|r<<16|r<<8|r,s=[],a=0;a<r;a+=4)s.push(o);var c=i.create(s,r);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:p,padding:d}),reset:function(){var e;l.reset.call(this);var t=this.cfg,n=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(r,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var y=r.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?i.create([1398893684,1701076831]).concat(n).concat(t):t).toString(c)},parse:function(e){var t,n=c.parse(e),r=n.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=i.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),y.create({ciphertext:n,salt:t})}},v=r.SerializableCipher=o.extend({cfg:o.extend({format:g}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var o=e.createEncryptor(n,r),i=o.finalize(t),s=o.cfg;return y.create({ciphertext:i,key:n,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),_=(n.kdf={}).OpenSSL={execute:function(e,t,n,r,o){if(r||(r=i.random(8)),o)s=u.create({keySize:t+n,hasher:o}).compute(e,r);else var s=u.create({keySize:t+n}).compute(e,r);var a=i.create(s.words.slice(t),4*n);return s.sigBytes=4*t,y.create({key:s,iv:a,salt:r})}},m=r.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:_}),encrypt:function(e,t,n,r){var o=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=o.iv;var i=v.encrypt.call(this,e,t,o.key,r);return i.mixIn(o),i},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var o=r.kdf.execute(n,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=o.iv,v.decrypt.call(this,e,t,o.key,r)}})}()}(A(),cf())),lf.exports}var hf,pf={exports:{}};function df(){return hf||(hf=1,pf.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function n(e,t,n,r){var o,i=this._iv;i?(o=i.slice(0),this._iv=void 0):o=this._prevBlock,r.encryptBlock(o,0);for(var s=0;s<n;s++)e[t+s]^=o[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize;n.call(this,e,t,o,r),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=e.slice(t,t+o);n.call(this,e,t,o,r),this._prevBlock=i}}),t}(),e.mode.CFB}(A(),ff())),pf.exports}var yf,gf={exports:{}};function vf(){return yf||(yf=1,gf.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),n=t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var s=i.slice(0);n.encryptBlock(s,0),i[r-1]=i[r-1]+1|0;for(var a=0;a<r;a++)e[t+a]^=s[a]}}),t.Decryptor=n,t),e.mode.CTR;var t,n}(A(),ff())),gf.exports}var _f,mf={exports:{}};function bf(){return _f||(_f=1,mf.exports=function(e){return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function n(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,n=e>>8&255,r=255&e;255===t?(t=0,255===n?(n=0,255===r?r=0:++r):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=r}return e}function r(e){return 0===(e[0]=n(e[0]))&&(e[1]=n(e[1])),e}var o=t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=this._iv,s=this._counter;i&&(s=this._counter=i.slice(0),this._iv=void 0),r(s);var a=s.slice(0);n.encryptBlock(a,0);for(var c=0;c<o;c++)e[t+c]^=a[c]}});return t.Decryptor=o,t}(),e.mode.CTRGladman}(A(),ff())),mf.exports}var wf,Ef={exports:{}};function Sf(){return wf||(wf=1,Ef.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),n=t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),n.encryptBlock(i,0);for(var s=0;s<r;s++)e[t+s]^=i[s]}}),t.Decryptor=n,t),e.mode.OFB;var t,n}(A(),ff())),Ef.exports}var If,Of={exports:{}};var Af,Tf={exports:{}};var Nf,xf={exports:{}};var Rf,Pf={exports:{}};var kf,Cf={exports:{}};var Lf,Df={exports:{}};var jf,Uf={exports:{}};var Mf,Bf={exports:{}};var qf,Wf={exports:{}};function Ff(){return qf||(qf=1,Wf.exports=function(e){return function(){var t=e,n=t.lib,r=n.WordArray,o=n.BlockCipher,i=t.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=i.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;n<56;n++){var r=s[n]-1;t[n]=e[r>>>5]>>>31-r%32&1}for(var o=this._subKeys=[],i=0;i<16;i++){var u=o[i]=[],l=c[i];for(n=0;n<24;n++)u[n/6|0]|=t[(a[n]-1+l)%28]<<31-n%6,u[4+(n/6|0)]|=t[28+(a[n+24]-1+l)%28]<<31-n%6;for(u[0]=u[0]<<1|u[0]>>>31,n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var f=this._invSubKeys=[];for(n=0;n<16;n++)f[n]=o[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,n){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var r=0;r<16;r++){for(var o=n[r],i=this._lBlock,s=this._rBlock,a=0,c=0;c<8;c++)a|=u[c][((s^o[c])&l[c])>>>0];this._lBlock=s,this._rBlock=i^a}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function p(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}t.DES=o._createHelper(f);var d=i.TripleDES=o.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),n=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=f.createEncryptor(r.create(t)),this._des2=f.createEncryptor(r.create(n)),this._des3=f.createEncryptor(r.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=o._createHelper(d)}(),e.TripleDES}(A(),j(),Wl(),cf(),ff())),Wf.exports}var Hf,$f={exports:{}};var Gf,Kf={exports:{}};var Vf,Jf={exports:{}};var zf,Yf={exports:{}};function Xf(){return zf||(zf=1,Yf.exports=function(e){return function(){var t=e,n=t.lib.BlockCipher,r=t.algo;const o=16,i=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function c(e,t){let n=t>>24&255,r=t>>16&255,o=t>>8&255,i=255&t,s=e.sbox[0][n]+e.sbox[1][r];return s^=e.sbox[2][o],s+=e.sbox[3][i],s}function u(e,t,n){let r,i=t,s=n;for(let t=0;t<o;++t)i^=e.pbox[t],s=c(e,i)^s,r=i,i=s,s=r;return r=i,i=s,s=r,s^=e.pbox[o],i^=e.pbox[o+1],{left:i,right:s}}function l(e,t,n){let r,i=t,s=n;for(let t=o+1;t>1;--t)i^=e.pbox[t],s=c(e,i)^s,r=i,i=s,s=r;return r=i,i=s,s=r,s^=e.pbox[1],i^=e.pbox[0],{left:i,right:s}}function f(e,t,n){for(let t=0;t<4;t++){e.sbox[t]=[];for(let n=0;n<256;n++)e.sbox[t][n]=s[t][n]}let r=0;for(let s=0;s<o+2;s++)e.pbox[s]=i[s]^t[r],r++,r>=n&&(r=0);let a=0,c=0,l=0;for(let t=0;t<o+2;t+=2)l=u(e,a,c),a=l.left,c=l.right,e.pbox[t]=a,e.pbox[t+1]=c;for(let t=0;t<4;t++)for(let n=0;n<256;n+=2)l=u(e,a,c),a=l.left,c=l.right,e.sbox[t][n]=a,e.sbox[t][n+1]=c;return!0}var h=r.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4;f(a,t,n)}},encryptBlock:function(e,t){var n=u(a,e[t],e[t+1]);e[t]=n.left,e[t+1]=n.right},decryptBlock:function(e,t){var n=l(a,e[t],e[t+1]);e[t]=n.left,e[t+1]=n.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=n._createHelper(h)}(),e.Blowfish}(A(),j(),Wl(),cf(),ff())),Yf.exports}Tl.exports=function(e){return e}(A(),xl(),kl(),Dl(),j(),Ml(),Wl(),$l(),x(),Gl||(Gl=1,Kl.exports=function(e){return n=(t=e).lib.WordArray,r=t.algo,o=r.SHA256,i=r.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=o._createHelper(i),t.HmacSHA224=o._createHmacHelper(i),e.SHA224;var t,n,r,o,i}(A(),x())),zl(),Yl||(Yl=1,Xl.exports=function(e){return n=(t=e).x64,r=n.Word,o=n.WordArray,i=t.algo,s=i.SHA512,a=i.SHA384=s.extend({_doReset:function(){this._hash=new o.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=s._createHelper(a),t.HmacSHA384=s._createHmacHelper(a),e.SHA384;var t,n,r,o,i,s,a}(A(),xl(),zl())),ef(),tf||(tf=1,nf.exports=function(e){return function(){var t=e,n=t.lib,r=n.WordArray,o=n.Hasher,i=t.algo,s=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=r.create([0,1518500249,1859775393,2400959708,2840853838]),f=r.create([1352829926,1548603684,1836072691,2053994217,0]),h=i.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,o=e[r];e[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,h,m,b,w,E,S,I,O,A,T,N=this._hash.words,x=l.words,R=f.words,P=s.words,k=a.words,C=c.words,L=u.words;for(E=i=N[0],S=h=N[1],I=m=N[2],O=b=N[3],A=w=N[4],n=0;n<80;n+=1)T=i+e[t+P[n]]|0,T+=n<16?p(h,m,b)+x[0]:n<32?d(h,m,b)+x[1]:n<48?y(h,m,b)+x[2]:n<64?g(h,m,b)+x[3]:v(h,m,b)+x[4],T=(T=_(T|=0,C[n]))+w|0,i=w,w=b,b=_(m,10),m=h,h=T,T=E+e[t+k[n]]|0,T+=n<16?v(S,I,O)+R[0]:n<32?g(S,I,O)+R[1]:n<48?y(S,I,O)+R[2]:n<64?d(S,I,O)+R[3]:p(S,I,O)+R[4],T=(T=_(T|=0,L[n]))+A|0,E=A,A=O,O=_(I,10),I=S,S=T;T=N[1]+m+O|0,N[1]=N[2]+b+A|0,N[2]=N[3]+w+E|0,N[3]=N[4]+i+S|0,N[4]=N[0]+h+I|0,N[0]=T},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,s=0;s<5;s++){var a=i[s];i[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,n){return e^t^n}function d(e,t,n){return e&t|~e&n}function y(e,t,n){return(e|~t)^n}function g(e,t,n){return e&n|t&~n}function v(e,t,n){return e^(t|~n)}function _(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(h),t.HmacRIPEMD160=o._createHmacHelper(h)}(),e.RIPEMD160}(A())),k(),rf||(rf=1,of.exports=function(e){return r=(n=(t=e).lib).Base,o=n.WordArray,s=(i=t.algo).SHA256,a=i.HMAC,c=i.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=a.create(n.hasher,e),i=o.create(),s=o.create([1]),c=i.words,u=s.words,l=n.keySize,f=n.iterations;c.length<l;){var h=r.update(t).finalize(s);r.reset();for(var p=h.words,d=p.length,y=h,g=1;g<f;g++){y=r.finalize(y),r.reset();for(var v=y.words,_=0;_<d;_++)p[_]^=v[_]}i.concat(h),u[0]++}return i.sigBytes=4*l,i}}),t.PBKDF2=function(e,t,n){return c.create(n).compute(e,t)},e.PBKDF2;var t,n,r,o,i,s,a,c}(A(),x(),k())),cf(),ff(),df(),vf(),bf(),Sf(),If||(If=1,Of.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(A(),ff())),Af||(Af=1,Tf.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,r=4*t,o=r-n%r,i=n+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(A(),ff())),Nf||(Nf=1,xf.exports=function(e){return e.pad.Iso10126={pad:function(t,n){var r=4*n,o=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(A(),ff())),Rf||(Rf=1,Pf.exports=function(e){return e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(A(),ff())),kf||(kf=1,Cf.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},e.pad.ZeroPadding}(A(),ff())),Lf||(Lf=1,Df.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(A(),ff())),jf||(jf=1,Uf.exports=function(e){return n=(t=e).lib.CipherParams,r=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return n.create({ciphertext:t})}},e.format.Hex;var t,n,r}(A(),ff())),Mf||(Mf=1,Bf.exports=function(e){return function(){var t=e,n=t.lib.BlockCipher,r=t.algo,o=[],i=[],s=[],a=[],c=[],u=[],l=[],f=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var d=r^r<<1^r<<2^r<<3^r<<4;d=d>>>8^255&d^99,o[n]=d,i[d]=n;var y=e[n],g=e[y],v=e[g],_=257*e[d]^16843008*d;s[n]=_<<24|_>>>8,a[n]=_<<16|_>>>16,c[n]=_<<8|_>>>24,u[n]=_,_=16843009*v^65537*g^257*y^16843008*n,l[d]=_<<24|_>>>8,f[d]=_<<16|_>>>16,h[d]=_<<8|_>>>24,p[d]=_,n?(n=y^e[e[e[v^y]]],r^=e[e[r]]):n=r=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],y=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],s=0;s<r;s++)s<n?i[s]=t[s]:(u=i[s-1],s%n?n>6&&s%n==4&&(u=o[u>>>24]<<24|o[u>>>16&255]<<16|o[u>>>8&255]<<8|o[255&u]):(u=o[(u=u<<8|u>>>24)>>>24]<<24|o[u>>>16&255]<<16|o[u>>>8&255]<<8|o[255&u],u^=d[s/n|0]<<24),i[s]=i[s-n]^u);for(var a=this._invKeySchedule=[],c=0;c<r;c++){if(s=r-c,c%4)var u=i[s];else u=i[s-4];a[c]=c<4||s<=4?u:l[o[u>>>24]]^f[o[u>>>16&255]]^h[o[u>>>8&255]]^p[o[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,u,o)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,f,h,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,o,i,s,a){for(var c=this._nRounds,u=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],h=e[t+3]^n[3],p=4,d=1;d<c;d++){var y=r[u>>>24]^o[l>>>16&255]^i[f>>>8&255]^s[255&h]^n[p++],g=r[l>>>24]^o[f>>>16&255]^i[h>>>8&255]^s[255&u]^n[p++],v=r[f>>>24]^o[h>>>16&255]^i[u>>>8&255]^s[255&l]^n[p++],_=r[h>>>24]^o[u>>>16&255]^i[l>>>8&255]^s[255&f]^n[p++];u=y,l=g,f=v,h=_}y=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^n[p++],g=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^n[p++],v=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^n[p++],_=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^n[p++],e[t]=y,e[t+1]=g,e[t+2]=v,e[t+3]=_},keySize:8});t.AES=n._createHelper(y)}(),e.AES}(A(),j(),Wl(),cf(),ff())),Ff(),Hf||(Hf=1,$f.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=r.RC4=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,r=this._S=[],o=0;o<256;o++)r[o]=o;o=0;for(var i=0;o<256;o++){var s=o%n,a=t[s>>>2]>>>24-s%4*8&255;i=(i+r[o]+a)%256;var c=r[o];r[o]=r[i],r[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,n=this._j,r=0,o=0;o<4;o++){n=(n+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[n],e[n]=i,r|=e[(e[t]+e[n])%256]<<24-8*o}return this._i=t,this._j=n,r}t.RC4=n._createHelper(o);var s=r.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=n._createHelper(s)}(),e.RC4}(A(),j(),Wl(),cf(),ff())),Gf||(Gf=1,Kf.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)o[n]^=r[n+4&7];if(t){var i=t.words,s=i[0],a=i[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=u>>>16|4294901760&l,h=l<<16|65535&u;for(o[0]^=u,o[1]^=f,o[2]^=l,o[3]^=h,o[4]^=u,o[5]^=f,o[6]^=l,o[7]^=h,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,u=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.Rabbit=n._createHelper(a)}(),e.Rabbit}(A(),j(),Wl(),cf(),ff())),Vf||(Vf=1,Jf.exports=function(e){return function(){var t=e,n=t.lib.StreamCipher,r=t.algo,o=[],i=[],s=[],a=r.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)r[o]^=n[o+4&7];if(t){var i=t.words,s=i[0],a=i[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=u>>>16|4294901760&l,h=l<<16|65535&u;for(r[0]^=u,r[1]^=f,r[2]^=l,r[3]^=h,r[4]^=u,r[5]^=f,r[6]^=l,r[7]^=h,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),e[t+r]^=o[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)i[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],o=65535&r,a=r>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,u=((4294901760&r)*r|0)+((65535&r)*r|0);s[n]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.RabbitLegacy=n._createHelper(a)}(),e.RabbitLegacy}(A(),j(),Wl(),cf(),ff())),Xf());var Zf=a(Tl.exports),Qf=function(){function e(){this.token=null,this.loginPath="",this.mode="development",this.instance=t.create()}return e.prototype.setupTokenListener=function(e){var t=this;window.addEventListener("storage",(function(n){if("string"==typeof e&&n.key===e&&n.newValue&&t.setToken(n.newValue),"function"==typeof e){var r=e();t.setToken(r)}}));var n="string"==typeof e?window.localStorage.getItem(e):"function"==typeof e?e():null;n&&this.setToken(n)},e.prototype.init=function(e){this.mode=(null==e?void 0:e.mode)||"development",e.loginPath&&this.setupAuthorizationCallback(e.loginPath)},e.prototype.setupAuthorizationCallback=function(e){var t=this.removeReqeustTime;this.instance.interceptors.response.use((function(e){return e}),(function(n){return n.response&&401===n.response.status&&(t(),"string"==typeof e?location.replace(e):"function"==typeof e&&e()),Promise.reject(n)}))},e.prototype.encryptToken=function(e){if(e){var t=localStorage.getItem("x-belink-timeDiff"),n=e+"|+|"+(t?(new Date).getTime()+Number(t):(new Date).getTime());return Zf.AES.encrypt(n,Zf.enc.Utf8.parse("214c!dsf1214c!ds"),{iv:Zf.enc.Utf8.parse("icalqai23cfhgj!s"),mode:Zf.mode.CBC}).toString()}},e.prototype.setToken=function(e){this.token=e},e.prototype.setupInterceptors=function(){var e=this;this.instance.interceptors.request.use((function(t){return e.token&&(t.headers["x-belink-authorization"]=e.encryptToken(e.token)),t}))},e.prototype.setRequestMethod=function(e){e&&!(null==e?void 0:e.method)&&(e.method=(null==e?void 0:e.data)?"post":"get")},e.prototype.setInterceptors=function(e){"function"==typeof e.requestInterceptors&&this.instance.interceptors.request.use(e.requestInterceptors),"function"==typeof e.responseInterceptors&&this.instance.interceptors.response.use(e.responseInterceptors)},e.prototype.setupCustomToken=function(e){(null==e?void 0:e.customToken)&&this.setToken(e.customToken)},e.prototype.removeReqeustTime=function(){return o(this,void 0,void 0,(function(){return i(this,(function(e){return localStorage.removeItem("x-belink-serverTime"),localStorage.removeItem("x-belink-timeDiff"),[2]}))}))},e.prototype.setupReqeustTime=function(e){return o(this,void 0,void 0,(function(){var t,n,r,o,s,a,c;return i(this,(function(i){switch(i.label){case 0:return t=localStorage.getItem("x-belink-serverTime"),n=localStorage.getItem("x-belink-timeDiff"),t&&"undefined"!==t?(e.headers||(e.headers={}),t&&(e.headers["x-belink-serverTime"]=t),n&&(e.headers["x-belink-timeDiff"]=n),[2]):(r="production"===this.mode?"https://shield-60660-10-1304510571.sh.run.tcloudbase.com/config/fetch-system-time":"https://shield-74680-5-1304510571.sh.run.tcloudbase.com/config/fetch-system-time",[4,fetch(r,{method:"POST"})]);case 1:return[4,i.sent().json()];case 2:return o=i.sent(),(s=o.data)?(a=(new Date).getTime(),c=s-a,localStorage.setItem("x-belink-serverTime",String(s)),localStorage.setItem("x-belink-timeDiff",String(c)),[2]):(localStorage.setItem("x-belink-serverTime",""),localStorage.setItem("x-belink-timeDiff",""),[2])}}))}))},e.prototype.setupToken=function(e){var t=localStorage.getItem("token");t&&(e.headers||(e.headers={}),e.headers["x-belink-authorization"]=this.encryptToken(t))},e.prototype.request=function(e){return o(this,void 0,void 0,(function(){var t=this;return i(this,(function(r){switch(r.label){case 0:return[4,this.setupReqeustTime(e)];case 1:return r.sent(),this.setRequestMethod(e),this.setInterceptors(e),this.setupCustomToken(e),this.setupToken(e),[2,new Promise((function(r,o){t.instance.request({method:e.method,url:e.url,headers:e.headers,data:e.data,params:e.params,timeout:e.timeout||8e3}).then((function(e){200===e.status?r(e.data):o(e.data)})).catch((function(t){var r;null==t||t.response,e.catchCallback&&t instanceof n&&e.catchCallback(t),o((null===(r=t.response)||void 0===r?void 0:r.data)||t)}))}))]}}))}))},e}(),eh=new Qf;export{eh as beLinkRequest,ml as beLinkUserInfo,Sl as callFunction,Ol as request};